Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chargeboots for uya too #89

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,25 @@
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Media;

namespace racman.RAC2
namespace racman
{
public partial class RAC2Cosmetics : Form
public partial class ChargebootColorPicker : Form
{
RAC2Form rac2form;
public RAC2Cosmetics(RAC2Form parent)
IPS3API api;
uint primaryFront;
uint primaryBack;
uint tintFront;
uint tintBack;

public ChargebootColorPicker(IPS3API ps3api, uint pf, uint pb, uint tf, uint tb)
{
rac2form = parent;
api = ps3api;
primaryFront = pf;
primaryBack = pb;
tintFront = tf;
tintBack = tb;

InitializeComponent();
}

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

var api = rac2form.game.api;
var pid = api.getCurrentPID();
api.WriteMemory(pid, rac2.addr.chargebootsPrimaryFrontColor, 4, "40FF8020");
api.WriteMemory(pid, rac2.addr.chargebootsPrimaryBackColor, 4, "00CF6000");
api.WriteMemory(pid, rac2.addr.chargebootsTintFrontColor, 4, "20FFFF00");
api.WriteMemory(pid, rac2.addr.chargebootsTintBackColor, 4, "00008000");
api.WriteMemory(pid, primaryFront, 4, "40FF8020");
api.WriteMemory(pid, primaryBack, 4, "00CF6000");
api.WriteMemory(pid, tintFront, 4, "20FFFF00");
api.WriteMemory(pid, tintBack, 4, "00008000");
}

private void buttonColor_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -92,29 +100,28 @@ private void pictureBox3_Click(object sender, EventArgs e)

private void ApplyChanges()
{
var api = rac2form.game.api;
var pid = api.getCurrentPID();

// FRONT: primary front, tint front
api.WriteMemory(pid, rac2.addr.chargebootsPrimaryFrontColor, new byte[]
api.WriteMemory(pid, primaryFront, new byte[]
{
0x40, colorDialog1.Color.B, colorDialog1.Color.G, colorDialog1.Color.R
});
api.WriteMemory(pid, rac2.addr.chargebootsTintFrontColor, new byte[]
api.WriteMemory(pid, tintFront, new byte[]
{
0x40, colorDialog1.Color.B, colorDialog1.Color.G, colorDialog1.Color.R
});

// MID: tint back
api.WriteMemory(pid, rac2.addr.chargebootsTintBackColor, new byte[]
api.WriteMemory(pid, tintBack, new byte[]
{
0x40, colorDialog2.Color.B, colorDialog2.Color.G, colorDialog2.Color.R
});

// BACK: primary back
api.WriteMemory(pid, rac2.addr.chargebootsPrimaryBackColor, new byte[]
api.WriteMemory(pid, primaryBack, new byte[]
{
0x30, colorDialog3.Color.B, colorDialog3.Color.G, colorDialog3.Color.R
0x25, colorDialog3.Color.B, colorDialog3.Color.G, colorDialog3.Color.R
});
}

Expand All @@ -138,6 +145,8 @@ private void buttonLoad_Click(object sender, EventArgs e)
pictureBox1.BackColor = colorDialog1.Color;
pictureBox2.BackColor = colorDialog2.Color;
pictureBox3.BackColor = colorDialog3.Color;

ApplyChanges();
}
}
}
13 changes: 9 additions & 4 deletions RaCTrainer/RAC2/RAC2Form.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using racman.RAC2;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
Expand All @@ -17,7 +16,7 @@ namespace racman
public partial class RAC2Form : Form
{
static ModLoaderForm modLoaderForm;
static RAC2Cosmetics cosmeticsForm;
static ChargebootColorPicker cosmeticsForm;

AutosplitterHelper autosplitter;
public rac2 game;
Expand Down Expand Up @@ -590,7 +589,13 @@ private void button3_Click(object sender, EventArgs e)

private void buttonCosmetics_Click(object sender, EventArgs e)
{
cosmeticsForm = new RAC2Cosmetics(this);
cosmeticsForm = new ChargebootColorPicker(
game.api,
rac2.addr.chargebootsPrimaryFrontColor,
rac2.addr.chargebootsPrimaryBackColor,
rac2.addr.chargebootsTintFrontColor,
rac2.addr.chargebootsTintBackColor
);
cosmeticsForm.Show();
}
}
Expand Down
33 changes: 23 additions & 10 deletions RaCTrainer/RAC3/RAC3Form.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions RaCTrainer/RAC3/RAC3Form.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private enum Planets
int ohkoMemSubID = -1;

public rac3 game;
public ChargebootColorPicker cosmeticsForm;
private AutosplitterHelper autosplitterHelper;
private AutosplitterConfigForm autosplitterConfigForm;

Expand Down Expand Up @@ -494,5 +495,17 @@ private void flagViewerToolStripMenuItem_Click(object sender, EventArgs e)
viewer.Text = $"{planets_comboBox.SelectedItem} level flags";
viewer.Show();
}

private void buttonCosmetics_Click(object sender, EventArgs e)
{
cosmeticsForm = new ChargebootColorPicker(
game.api,
rac3.addr.chargebootsPrimaryFrontColor,
rac3.addr.chargebootsPrimaryBackColor,
rac3.addr.chargebootsTintFrontColor,
rac3.addr.chargebootsTintBackColor
);
cosmeticsForm.Show();
}
}
}
5 changes: 5 additions & 0 deletions RaCTrainer/offsets/RAC3/rac3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public class RaC3Addresses : IAddresses
public uint miscLevelFlags => throw new System.NotImplementedException();
public uint infobotFlags => throw new System.NotImplementedException();
public uint moviesFlags => throw new System.NotImplementedException();

public uint chargebootsTintFrontColor => 0xc33ac0;
public uint chargebootsTintBackColor => 0xc33ac4;
public uint chargebootsPrimaryFrontColor => 0xc33ab0;
public uint chargebootsPrimaryBackColor => 0xc33ab4;
}
public class rac3 : IGame, IAutosplitterAvailable
{
Expand Down
10 changes: 5 additions & 5 deletions RaCTrainer/racman.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@
<Compile Include="offsets\ACIT\ACITTimer.cs" />
<Compile Include="offsets\RAC4\BotsUnlocks.cs" />
<Compile Include="offsets\RAC4\BotsUnlocksFactory.cs" />
<Compile Include="RAC2\RAC2Cosmetics.cs">
<Compile Include="ChargebootColorPicker.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="RAC2\RAC2Cosmetics.Designer.cs">
<DependentUpon>RAC2Cosmetics.cs</DependentUpon>
<Compile Include="ChargebootColorPicker.Designer.cs">
<DependentUpon>ChargebootColorPicker.cs</DependentUpon>
</Compile>
<Compile Include="RAC2\RC2Unlocks.cs">
<SubType>Form</SubType>
Expand Down Expand Up @@ -289,8 +289,8 @@
<EmbeddedResource Include="MemoryForm.resx">
<DependentUpon>MemoryForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="RAC2\RAC2Cosmetics.resx">
<DependentUpon>RAC2Cosmetics.cs</DependentUpon>
<EmbeddedResource Include="ChargebootColorPicker.resx">
<DependentUpon>ChargebootColorPicker.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="RAC2\RAC2JPForm.resx">
<DependentUpon>RAC2JPForm.cs</DependentUpon>
Expand Down
Loading