From 42bf108c7619277061b03b651de494f0276d6791 Mon Sep 17 00:00:00 2001 From: jeffman Date: Fri, 14 Dec 2018 00:50:56 -0500 Subject: [PATCH] Translate teleport names --- ScriptTool/ScriptTool/M12TextTables.cs | 11 +++ ScriptTool/ScriptTool/Program.cs | 7 ++ m2-hack.asm | 37 +++++++++ notes/m2-notes.txt | 1 + working/m12-teleport-names.json | 107 +++++++++++++++++++++++++ 5 files changed, 163 insertions(+) create mode 100644 working/m12-teleport-names.json diff --git a/ScriptTool/ScriptTool/M12TextTables.cs b/ScriptTool/ScriptTool/M12TextTables.cs index d578055..c7c7824 100644 --- a/ScriptTool/ScriptTool/M12TextTables.cs +++ b/ScriptTool/ScriptTool/M12TextTables.cs @@ -676,5 +676,16 @@ namespace ScriptTool }; return table; } + + public static FixedStringCollection ReadTeleportNames(byte[] rom) + { + var table = ReadFixedStringTable(rom, 0xB2AD10, 0x10, 0x14); + table.TablePointers = new int[] + { + 0xC5F54, + 0xC6234 + }; + return table; + } } } diff --git a/ScriptTool/ScriptTool/Program.cs b/ScriptTool/ScriptTool/Program.cs index 8b6ba86..f6558b2 100644 --- a/ScriptTool/ScriptTool/Program.cs +++ b/ScriptTool/ScriptTool/Program.cs @@ -326,6 +326,10 @@ namespace ScriptTool 0xB1BA61, 0xB1BA6E, 0xB1BA7B); + + // Teleport destinations + var teleportNames = M12TextTables.ReadTeleportNames(m12Rom); + DecompileFixedStringCollection(m12Decompiler, m12Rom, "m12-teleport-names", teleportNames); } static void DecompileM12MiscStringCollection(string name, MiscStringCollection miscStringCollection) @@ -504,6 +508,9 @@ namespace ScriptTool // Other CompileM12HardcodedStringCollection("m12-other", ref referenceAddress); + + // Teleport destinations + CompileM12FixedStringCollection("m12-teleport-names", ref referenceAddress); } static void CompileM12MiscStringCollection(string name, ref int referenceAddress) diff --git a/m2-hack.asm b/m2-hack.asm index c41fd67..8525706 100644 --- a/m2-hack.asm +++ b/m2-hack.asm @@ -698,6 +698,43 @@ ldrh r3,[r3] b 0x080C959A .pool +//--------------------------------------------------------- +// Teleport window hacks +//--------------------------------------------------------- + +// Note that the teleport table pointer has 6 instances in the ROM, +// but we are only changing two of them in m12-teleport-names.json. +// This is because the other four pointers are used for accessing +// the teleport flag/coord data in the table instead of the text. +// We need a couple hacks to make this work... + +.org 0x80C5E8A :: ldr r7,[pc,0xC8] // This is used for text; load from one of the + // pointers that we DID change (previously it + // loaded from a pointer that we didn't change) + +.org 0x80C5D8A +lsl r1,r0,4 // Text entries are now 16 bytes each, so multiply by 16 +ldr r7,[pc,0x1C4] // ... to make room for loading r7 with the text pointer +add r1,r1,r7 +ldrb r0,[r1] +ldr r7,[pc,0x13C] // The game uses r7 as the data pointer when looping back, + // so let's sneak the data pointer in here before it loops + +.org 0x80C5E96 +lsl r0,r1,4 +nop +nop + +.org 0x80C5F2C +lsl r0,r1,4 +nop +nop + +.org 0x80C620C +lsl r0,r1,4 +nop +nop + //============================================================================== // Data files //============================================================================== diff --git a/notes/m2-notes.txt b/notes/m2-notes.txt index b2b3eb7..854501d 100644 --- a/notes/m2-notes.txt +++ b/notes/m2-notes.txt @@ -57,6 +57,7 @@ Hard-coded characters: 0x01: Teleport alpha 0x08: Teleport beta 0x3001FA4: Escargo Express items (36 of them) +0x3001FC8: event flags 0x30023D0: current cash balance 0x30023D4: current ATM balance 0x3002500: buttons being pressed diff --git a/working/m12-teleport-names.json b/working/m12-teleport-names.json new file mode 100644 index 0000000..e68af4f --- /dev/null +++ b/working/m12-teleport-names.json @@ -0,0 +1,107 @@ +{ + "StringsLocation": 11709712, + "TablePointers": [ + 810836, + 811572 + ], + "NumEntries": 16, + "EntryLength": 16, + "StringRefs": [ + { + "Index": 0, + "OldPointer": 11709712, + "Old": "ぁぁぁぁぁぁぁぁぁぁ[00 FF]", + "New": "[00 FF]" + }, + { + "Index": 1, + "OldPointer": 11709732, + "Old": "オネット[00 FF]", + "New": "Onett[00 FF]" + }, + { + "Index": 2, + "OldPointer": 11709752, + "Old": "ツ-ソン[00 FF]", + "New": "Twoson[00 FF]" + }, + { + "Index": 3, + "OldPointer": 11709772, + "Old": "スリ-ク[00 FF]", + "New": "Threed[00 FF]" + }, + { + "Index": 4, + "OldPointer": 11709792, + "Old": "サタ-ンバレ-[00 FF]", + "New": "Saturn Valley[00 FF]" + }, + { + "Index": 5, + "OldPointer": 11709812, + "Old": "フォ-サイド[00 FF]", + "New": "Fourside[00 FF]" + }, + { + "Index": 6, + "OldPointer": 11709832, + "Old": "ウィンタ-ズ[00 FF]", + "New": "Winters[00 FF]" + }, + { + "Index": 7, + "OldPointer": 11709852, + "Old": "サマ-ズ[00 FF]", + "New": "Summers[00 FF]" + }, + { + "Index": 8, + "OldPointer": 11709872, + "Old": "スカラビ[00 FF]", + "New": "Scaraba[00 FF]" + }, + { + "Index": 9, + "OldPointer": 11709892, + "Old": "ランマ[00 FF]", + "New": "Dalaam[00 FF]" + }, + { + "Index": 10, + "OldPointer": 11709912, + "Old": "まきょう[00 FF]", + "New": "Deep Darkness[00 FF]" + }, + { + "Index": 11, + "OldPointer": 11709932, + "Old": "グミぞくのむら[00 FF]", + "New": "Tenda Village[00 FF]" + }, + { + "Index": 12, + "OldPointer": 11709952, + "Old": "ちていたいりく[00 FF]", + "New": "Underworld[00 FF]" + }, + { + "Index": 13, + "OldPointer": 11709972, + "Old": "ぁぁぁぁぁぁぁぁぁぁ[00 FF]", + "New": "[00 FF]" + }, + { + "Index": 14, + "OldPointer": 11709992, + "Old": "ドコドコさばく[00 FF]", + "New": "Dusty Dunes[00 FF]" + }, + { + "Index": 15, + "OldPointer": 11710012, + "Old": "ぁぁぁぁぁぁぁぁぁぁ[00 FF]", + "New": "[00 FF]" + } + ] +} \ No newline at end of file