Skip to content

Commit a2f431c

Browse files
authored
Merge pull request #89 from robooooo-bs/master
chargeboots for uya too
2 parents 86fa4d1 + d32cde1 commit a2f431c

10 files changed

+130
-57
lines changed

RaCTrainer/RAC2/RAC2Cosmetics.Designer.cs RaCTrainer/ChargebootColorPicker.Designer.cs

+9-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RaCTrainer/RAC2/RAC2Cosmetics.cs RaCTrainer/ChargebootColorPicker.cs

+26-17
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,25 @@
77
using System.Text;
88
using System.Threading.Tasks;
99
using System.Windows.Forms;
10-
using System.Windows.Media;
1110

12-
namespace racman.RAC2
11+
namespace racman
1312
{
14-
public partial class RAC2Cosmetics : Form
13+
public partial class ChargebootColorPicker : Form
1514
{
16-
RAC2Form rac2form;
17-
public RAC2Cosmetics(RAC2Form parent)
15+
IPS3API api;
16+
uint primaryFront;
17+
uint primaryBack;
18+
uint tintFront;
19+
uint tintBack;
20+
21+
public ChargebootColorPicker(IPS3API ps3api, uint pf, uint pb, uint tf, uint tb)
1822
{
19-
rac2form = parent;
23+
api = ps3api;
24+
primaryFront = pf;
25+
primaryBack = pb;
26+
tintFront = tf;
27+
tintBack = tb;
28+
2029
InitializeComponent();
2130
}
2231

@@ -40,12 +49,11 @@ private void buttonReset_Click(object sender, EventArgs e)
4049
{
4150
DefaultColors();
4251

43-
var api = rac2form.game.api;
4452
var pid = api.getCurrentPID();
45-
api.WriteMemory(pid, rac2.addr.chargebootsPrimaryFrontColor, 4, "40FF8020");
46-
api.WriteMemory(pid, rac2.addr.chargebootsPrimaryBackColor, 4, "00CF6000");
47-
api.WriteMemory(pid, rac2.addr.chargebootsTintFrontColor, 4, "20FFFF00");
48-
api.WriteMemory(pid, rac2.addr.chargebootsTintBackColor, 4, "00008000");
53+
api.WriteMemory(pid, primaryFront, 4, "40FF8020");
54+
api.WriteMemory(pid, primaryBack, 4, "00CF6000");
55+
api.WriteMemory(pid, tintFront, 4, "20FFFF00");
56+
api.WriteMemory(pid, tintBack, 4, "00008000");
4957
}
5058

5159
private void buttonColor_Click(object sender, EventArgs e)
@@ -92,29 +100,28 @@ private void pictureBox3_Click(object sender, EventArgs e)
92100

93101
private void ApplyChanges()
94102
{
95-
var api = rac2form.game.api;
96103
var pid = api.getCurrentPID();
97104

98105
// FRONT: primary front, tint front
99-
api.WriteMemory(pid, rac2.addr.chargebootsPrimaryFrontColor, new byte[]
106+
api.WriteMemory(pid, primaryFront, new byte[]
100107
{
101108
0x40, colorDialog1.Color.B, colorDialog1.Color.G, colorDialog1.Color.R
102109
});
103-
api.WriteMemory(pid, rac2.addr.chargebootsTintFrontColor, new byte[]
110+
api.WriteMemory(pid, tintFront, new byte[]
104111
{
105112
0x40, colorDialog1.Color.B, colorDialog1.Color.G, colorDialog1.Color.R
106113
});
107114

108115
// MID: tint back
109-
api.WriteMemory(pid, rac2.addr.chargebootsTintBackColor, new byte[]
116+
api.WriteMemory(pid, tintBack, new byte[]
110117
{
111118
0x40, colorDialog2.Color.B, colorDialog2.Color.G, colorDialog2.Color.R
112119
});
113120

114121
// BACK: primary back
115-
api.WriteMemory(pid, rac2.addr.chargebootsPrimaryBackColor, new byte[]
122+
api.WriteMemory(pid, primaryBack, new byte[]
116123
{
117-
0x30, colorDialog3.Color.B, colorDialog3.Color.G, colorDialog3.Color.R
124+
0x25, colorDialog3.Color.B, colorDialog3.Color.G, colorDialog3.Color.R
118125
});
119126
}
120127

@@ -138,6 +145,8 @@ private void buttonLoad_Click(object sender, EventArgs e)
138145
pictureBox1.BackColor = colorDialog1.Color;
139146
pictureBox2.BackColor = colorDialog2.Color;
140147
pictureBox3.BackColor = colorDialog3.Color;
148+
149+
ApplyChanges();
141150
}
142151
}
143152
}
File renamed without changes.

RaCTrainer/RAC2/RAC2Form.cs

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using racman.RAC2;
2-
using System;
1+
using System;
32
using System.Collections.Generic;
43
using System.ComponentModel;
54
using System.Data;
@@ -17,7 +16,7 @@ namespace racman
1716
public partial class RAC2Form : Form
1817
{
1918
static ModLoaderForm modLoaderForm;
20-
static RAC2Cosmetics cosmeticsForm;
19+
static ChargebootColorPicker cosmeticsForm;
2120

2221
AutosplitterHelper autosplitter;
2322
public rac2 game;
@@ -590,7 +589,13 @@ private void button3_Click(object sender, EventArgs e)
590589

591590
private void buttonCosmetics_Click(object sender, EventArgs e)
592591
{
593-
cosmeticsForm = new RAC2Cosmetics(this);
592+
cosmeticsForm = new ChargebootColorPicker(
593+
game.api,
594+
rac2.addr.chargebootsPrimaryFrontColor,
595+
rac2.addr.chargebootsPrimaryBackColor,
596+
rac2.addr.chargebootsTintFrontColor,
597+
rac2.addr.chargebootsTintBackColor
598+
);
594599
cosmeticsForm.Show();
595600
}
596601
}

RaCTrainer/RAC3/RAC3Form.Designer.cs

+23-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RaCTrainer/RAC3/RAC3Form.cs

+13
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ private enum Planets
5656
int ohkoMemSubID = -1;
5757

5858
public rac3 game;
59+
public ChargebootColorPicker cosmeticsForm;
5960
private AutosplitterHelper autosplitterHelper;
6061
private AutosplitterConfigForm autosplitterConfigForm;
6162

@@ -494,5 +495,17 @@ private void flagViewerToolStripMenuItem_Click(object sender, EventArgs e)
494495
viewer.Text = $"{planets_comboBox.SelectedItem} level flags";
495496
viewer.Show();
496497
}
498+
499+
private void buttonCosmetics_Click(object sender, EventArgs e)
500+
{
501+
cosmeticsForm = new ChargebootColorPicker(
502+
game.api,
503+
rac3.addr.chargebootsPrimaryFrontColor,
504+
rac3.addr.chargebootsPrimaryBackColor,
505+
rac3.addr.chargebootsTintFrontColor,
506+
rac3.addr.chargebootsTintBackColor
507+
);
508+
cosmeticsForm.Show();
509+
}
497510
}
498511
}

RaCTrainer/offsets/RAC3/rac3.cs

+5
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ public class RaC3Addresses : IAddresses
8080
public uint miscLevelFlags => throw new System.NotImplementedException();
8181
public uint infobotFlags => throw new System.NotImplementedException();
8282
public uint moviesFlags => throw new System.NotImplementedException();
83+
84+
public uint chargebootsTintFrontColor => 0xc33ac0;
85+
public uint chargebootsTintBackColor => 0xc33ac4;
86+
public uint chargebootsPrimaryFrontColor => 0xc33ab0;
87+
public uint chargebootsPrimaryBackColor => 0xc33ab4;
8388
}
8489
public class rac3 : IGame, IAutosplitterAvailable
8590
{

RaCTrainer/racman.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@
141141
<Compile Include="offsets\ACIT\ACITTimer.cs" />
142142
<Compile Include="offsets\RAC4\BotsUnlocks.cs" />
143143
<Compile Include="offsets\RAC4\BotsUnlocksFactory.cs" />
144-
<Compile Include="RAC2\RAC2Cosmetics.cs">
144+
<Compile Include="ChargebootColorPicker.cs">
145145
<SubType>Form</SubType>
146146
</Compile>
147-
<Compile Include="RAC2\RAC2Cosmetics.Designer.cs">
148-
<DependentUpon>RAC2Cosmetics.cs</DependentUpon>
147+
<Compile Include="ChargebootColorPicker.Designer.cs">
148+
<DependentUpon>ChargebootColorPicker.cs</DependentUpon>
149149
</Compile>
150150
<Compile Include="RAC2\RC2Unlocks.cs">
151151
<SubType>Form</SubType>
@@ -289,8 +289,8 @@
289289
<EmbeddedResource Include="MemoryForm.resx">
290290
<DependentUpon>MemoryForm.cs</DependentUpon>
291291
</EmbeddedResource>
292-
<EmbeddedResource Include="RAC2\RAC2Cosmetics.resx">
293-
<DependentUpon>RAC2Cosmetics.cs</DependentUpon>
292+
<EmbeddedResource Include="ChargebootColorPicker.resx">
293+
<DependentUpon>ChargebootColorPicker.cs</DependentUpon>
294294
</EmbeddedResource>
295295
<EmbeddedResource Include="RAC2\RAC2JPForm.resx">
296296
<DependentUpon>RAC2JPForm.cs</DependentUpon>

0 commit comments

Comments
 (0)