Skip to content

Commit a3776e5

Browse files
1.1 Update
1 parent 0a9f2a7 commit a3776e5

17 files changed

Lines changed: 743 additions & 416 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This tool uses stuff from: [ARM9 Music Editor](https://github.com/Ermelber/MKDS-
88
### Roadmap
99
🔵 = Working on it, 🟢 = Will add soon, 🟡 = Will add later 🟠 = Might add
1010

11-
🔵 Addition of changing internal file referenced file names of Characters, Karts, and Emblems.<br>
11+
🔵 Bug fixes retaining to listbox locations and the opening of repository link and info button opening twice.
1212
🟠 .NDS file opening support.
1313

1414
### Contributing

src/ARM9Editor.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
<EmbeddedResource Include="assets\json\slot_offsets.json" />
4444
</ItemGroup>
4545
<ItemGroup>
46+
<Compile Update="forms\ChangeCharacterFileNameForm.cs">
47+
<SubType>Form</SubType>
48+
</Compile>
4649
<Compile Update="forms\ChangeKartPrefixForm.cs">
4750
<SubType>Form</SubType>
4851
</Compile>

src/App.cs

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using System;
1+
using Newtonsoft.Json;
2+
using System;
23
using System.Collections.Generic;
34
using System.Diagnostics;
45
using System.IO;
56
using System.Reflection;
67
using System.Text;
78
using System.Windows.Forms;
8-
using Newtonsoft.Json;
99
namespace ARM9Editor
1010
{
1111
public partial class App : Form
@@ -31,11 +31,13 @@ public App()
3131
weatherlistBox.DoubleClick += weatherListBox_DoubleClick;
3232
emblemlistBox.DoubleClick += emblemListBox_DoubleClick;
3333
kartlistBox.DoubleClick += kartListBox_DoubleClick;
34+
characterlistBox.DoubleClick += characterListBox_DoubleClick;
3435
LoadMusicOffsets();
3536
LoadCourseOffsets();
3637
LoadSlotOffsets();
3738
LoadEmblemOffsets();
3839
LoadKartOffsets();
40+
LoadCharacterOffsets();
3941
}
4042
private void LoadMusicOffsets()
4143
{
@@ -133,6 +135,22 @@ private void LoadKartOffsets()
133135
MessageBox.Show($"Failed to load kart offsets: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
134136
}
135137
}
138+
private void LoadCharacterOffsets()
139+
{
140+
var assembly = Assembly.GetExecutingAssembly();
141+
var resourceName = "ARM9Editor.assets.json.character_offsets.json";
142+
try
143+
{
144+
using var stream = assembly.GetManifestResourceStream(resourceName);
145+
using var reader = new StreamReader(stream);
146+
string jsonData = reader.ReadToEnd();
147+
characterOffsets = JsonConvert.DeserializeObject<Dictionary<string, int>>(jsonData);
148+
}
149+
catch (Exception ex)
150+
{
151+
MessageBox.Show($"Failed to load character offsets: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
152+
}
153+
}
136154
private string GetFileName(int startOffset, int endOffset)
137155
{
138156
if (armValues == null || startOffset < 0 || endOffset > armValues.Length || startOffset >= endOffset)
@@ -162,6 +180,7 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)
162180
RefreshWeatherListBox();
163181
RefreshEmblemListBox();
164182
RefreshKartListBox();
183+
RefreshCharacterListBox();
165184
}
166185
}
167186
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
@@ -259,7 +278,7 @@ private void RefreshKartListBox()
259278
{
260279
if (emblemOffsets == null || armValues == null)
261280
{
262-
MessageBox.Show("Emblem offsets or ARM values are not loaded.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
281+
MessageBox.Show("Kart offsets or ARM values are not loaded.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
263282
return;
264283
}
265284
kartlistBox.Items.Clear();
@@ -271,6 +290,22 @@ private void RefreshKartListBox()
271290
kartlistBox.Items.Add($"{kartName} [{kartValue}]");
272291
}
273292
}
293+
private void RefreshCharacterListBox()
294+
{
295+
if (characterOffsets == null || armValues == null)
296+
{
297+
MessageBox.Show("Character offsets or ARM values are not loaded.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
298+
return;
299+
}
300+
characterlistBox.Items.Clear();
301+
foreach (var kvp in characterOffsets)
302+
{
303+
string characterName = kvp.Key;
304+
int offset = kvp.Value;
305+
string characterValue = Encoding.ASCII.GetString(armValues, offset, 4).TrimEnd('\0');
306+
characterlistBox.Items.Add($"{characterName} [{characterValue}]");
307+
}
308+
}
274309
private void musicListBox_DoubleClick(object sender, EventArgs e)
275310
{
276311
if (musicOffsets == null || armValues == null)
@@ -315,7 +350,7 @@ private void courseListBox_DoubleClick(object sender, EventArgs e)
315350
string courseName = selectedItem.Split('[')[0].Trim();
316351
var offsets = courseOffsets[courseName];
317352

318-
using var form = new ChangeFileNameForm(armValues, offsets.Item1, offsets.Item2);
353+
using var form = new ChangeCourseFileNameForm(armValues, offsets.Item1, offsets.Item2);
319354
{
320355
if (form.ShowDialog() == DialogResult.OK)
321356
{
@@ -403,6 +438,29 @@ private void kartListBox_DoubleClick(object sender, EventArgs e)
403438
}
404439
}
405440
}
441+
private void characterListBox_DoubleClick(object sender, EventArgs e)
442+
{
443+
if (characterOffsets == null || armValues == null)
444+
{
445+
MessageBox.Show("Character offsets or ARM values are not loaded.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
446+
return;
447+
}
448+
if (characterlistBox.SelectedItem != null)
449+
{
450+
string selectedItem = characterlistBox.SelectedItem.ToString();
451+
string characterName = selectedItem.Split('[')[0].Trim();
452+
int offset = characterOffsets[characterName];
453+
454+
using var form = new ChangeCharacterFileNameForm(armValues, offset);
455+
{
456+
if (form.ShowDialog() == DialogResult.OK)
457+
{
458+
RefreshCharacterListBox();
459+
MessageBox.Show($"Character name for {characterName} changed to {form.NewCharacterName}.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
460+
}
461+
}
462+
}
463+
}
406464
private void repositoryToolStripMenuItem_Click(object sender, EventArgs e)
407465
{
408466
string githubUrl = "https://github.com/LandonAndEmma/MKDS-ARM9-EDITOR-VS";
Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
{
2-
"P_MR (Mario)": 1459260,
3-
"E_KO (Toad)": 1459380,
4-
"E_HH (Shy Guy)": 1459468,
5-
"P_HH (Shy Guy)": 1459476,
6-
"E_RB (R.O.B)": 1459492,
7-
"P_RB (R.O.B)": 1459500,
8-
"E_WL (Waluigi)": 1459516,
9-
"P_WL (Waluigi)": 1459524,
10-
"E_DS (Daisy)": 1459540,
11-
"P_DS (Daisy)": 1459548,
12-
"E_KA (Dry Bones)": 1459564,
13-
"P_KA (Dry Bones)": 1459572,
14-
"E_LG (Luigi)": 1459588,
15-
"P_LG (Luigi)": 1459596,
16-
"E_YS (Yoshi)": 1459612,
17-
"P_YS (Yoshi)": 1459620,
18-
"E_WR (Wario)": 1459636,
19-
"P_WR (Wario)": 1459644,
20-
"E_PC (Peach)": 1459660,
21-
"P_PC (Peach)": 1459668,
22-
"E_KP (Bowser)": 1459684,
23-
"P_KP (Bowser)": 1459692,
24-
"P_KO (Toad)": 1459724,
25-
"E_DK (Donkey Kong)": 1459748,
26-
"P_DK (Donkey Kong)": 1459756,
27-
"E_MR (Mario)": 1459772
2+
"Mario (Player)": "1465148",
3+
"Mario (CPU)": "1465836",
4+
"Luigi (Player)": "1465676",
5+
"Luigi (CPU)": "1465668",
6+
"Peach (Player)": "1465748",
7+
"Peach (CPU)": "1465740",
8+
"Yoshi (Player)": "1465700",
9+
"Yoshi (CPU)": "1465692",
10+
"Donkey Kong (Player)": "1465820",
11+
"Donkey Kong (CPU)": "1465812",
12+
"Wario (Player)": "1465724",
13+
"Wario (CPU)": "1465716",
14+
"Bowser (Player)": "1465772",
15+
"Bowser (CPU)": "1465764",
16+
"Daisy (Player)": "1465628",
17+
"Daisy (CPU)": "1465620",
18+
"Dry Bones (Player)": "1465652",
19+
"Dry Bones (CPU)": "1465644",
20+
"Waluigi (Player)": "1465604",
21+
"Waluigi (CPU)": "1465596",
22+
"R.O.B (Player)": "1465580",
23+
"R.O.B (CPU)": "1465572",
24+
"Shy Guy (Player)": "1465556",
25+
"Shy Guy (CPU)": "1465548"
2826
}

0 commit comments

Comments
 (0)