Working on "other strings"

For now, this is just window header and navigation stuff, like "To:(X)",
"Weapons" when equipping with huge weapon inventories, etc. Still need to
fix the pointers to some of these.
This commit is contained in:
jeffman 2017-04-15 23:42:07 -04:00
parent cdd63e527b
commit 94f725298b
2 changed files with 189 additions and 0 deletions

View File

@ -302,6 +302,26 @@ namespace ScriptTool
// PSI targets
var miscText2 = M12TextTables.ReadPsiTargets(m12Rom);
DecompileFixedStringCollection(m12Decompiler, m12Rom, "m12-psitargets", miscText2);
// Other
DecompileHardcodedStringCollection(m12Decompiler, m12Rom, "m12-other",
0xB1B492,
0xB1B497,
0xB1B49C,
0xB1B4A1,
0xB1B4A6,
0xB1BA00,
0xB1BA05,
0xB1BA0A,
0xB1BA0F,
0xB1BA14,
0xB1BA1A,
0xB1BA20,
0xB1BA26,
0xB1BA2C,
0xB1BA36,
0xB1BA40,
0xB1BA4A);
}
static void DecompileM12MiscStringCollection(string name, MiscStringCollection miscStringCollection)
@ -345,6 +365,41 @@ namespace ScriptTool
JsonConvert.SerializeObject(fixedStringCollection, Formatting.Indented));
}
static void DecompileHardcodedStringCollection(IDecompiler decompiler, byte[] rom, string name,
params int[] pointers)
{
var hardcodedRefs = new List<HardcodedString>();
foreach (int pointer in pointers)
{
string str = decompiler.DecompileString(rom, pointer, false);
var references = new List<int>();
// Search for all references
for (int refAddress = 0; refAddress < 0x100000; refAddress += 4)
{
int value = rom.ReadGbaPointer(refAddress);
if (value == pointer)
{
references.Add(refAddress);
}
}
var hardcodedRef = new HardcodedString
{
Old = str,
New = "",
PointerLocations = references.ToArray(),
OldPointer = pointer
};
hardcodedRefs.Add(hardcodedRef);
}
File.WriteAllText(Path.Combine(options.WorkingDirectory, name + ".json"),
JsonConvert.SerializeObject(hardcodedRefs, Formatting.Indented));
}
static void CompileM12()
{
int baseAddress = 0xB80000;
@ -440,6 +495,9 @@ namespace ScriptTool
// Battle command strings
CompileM12BattleCommands("m12-battle-commands", ref referenceAddress);
// Other
CompileM12HardcodedStringCollection("m12-other", ref referenceAddress);
}
static void CompileM12MiscStringCollection(string name, ref int referenceAddress)

131
working/m12-other.json Normal file
View File

@ -0,0 +1,131 @@
[
{
"OldPointer": 11646098,
"PointerLocations": [
766280
],
"Old": "ぶき[00 FF]",
"New": "Weapons[00 FF]"
},
{
"OldPointer": 11646103,
"PointerLocations": [],
"Old": "ボディ[00 FF]",
"New": "Body[00 FF]"
},
{
"OldPointer": 11646108,
"PointerLocations": [],
"Old": "うで[00 FF]",
"New": "Arms[00 FF]"
},
{
"OldPointer": 11646113,
"PointerLocations": [],
"Old": "そのた[00 FF]",
"New": "Other[00 FF]"
},
{
"OldPointer": 11646118,
"PointerLocations": [
774896
],
"Old": "かけさき[00 FF]",
"New": "Call:[00 FF]"
},
{
"OldPointer": 11647488,
"PointerLocations": [
808484
],
"Old": "ぶき[00 FF]",
"New": "Weapons[00 FF]"
},
{
"OldPointer": 11647493,
"PointerLocations": [
808508
],
"Old": "ボディ[00 FF]",
"New": "Body[00 FF]"
},
{
"OldPointer": 11647498,
"PointerLocations": [
808548
],
"Old": "うで[00 FF]",
"New": "Arms[00 FF]"
},
{
"OldPointer": 11647503,
"PointerLocations": [
808812
],
"Old": "そのた[00 FF]",
"New": "Other[00 FF]"
},
{
"OldPointer": 11647508,
"PointerLocations": [
809128
],
"Old": "➨ぶき[00 FF]",
"New": "➨Weapons[00 FF]"
},
{
"OldPointer": 11647514,
"PointerLocations": [
809136
],
"Old": "➨ボディ[00 FF]",
"New": "➨Body[00 FF]"
},
{
"OldPointer": 11647520,
"PointerLocations": [
809144
],
"Old": "➨うで[00 FF]",
"New": "➨Arms[00 FF]"
},
{
"OldPointer": 11647526,
"PointerLocations": [
809228
],
"Old": "➨そのた[00 FF]",
"New": "➨Other[00 FF]"
},
{
"OldPointer": 11647532,
"PointerLocations": [
811460
],
"Old": "➨ばしょ(1)へ[00 FF]",
"New": "➨To:(1)[00 FF]"
},
{
"OldPointer": 11647542,
"PointerLocations": [
811048,
811524
],
"Old": "➨ばしょ(2)へ[00 FF]",
"New": "➨To:(2)[00 FF]"
},
{
"OldPointer": 11647552,
"PointerLocations": [],
"Old": "➨ばしょ(3)へ[00 FF]",
"New": "➨To:(3)[00 FF]"
},
{
"OldPointer": 11647562,
"PointerLocations": [
810724
],
"Old": "ばしょ[00 FF]",
"New": "Location[00 FF]"
}
]