Added battle commands
This commit is contained in:
parent
488767b0df
commit
db8aa5e07f
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ScriptTool
|
||||
{
|
||||
class HardcodedString
|
||||
{
|
||||
public int OldPointer { get; set; }
|
||||
public int[] PointerLocations { get; set; }
|
||||
|
||||
public string Old { get; set; }
|
||||
public string New { get; set; }
|
||||
}
|
||||
}
|
|
@ -434,6 +434,11 @@ namespace ScriptTool
|
|||
|
||||
// PSI targets
|
||||
CompileM12FixedStringCollection("m12-psitargets", ref referenceAddress);
|
||||
|
||||
// Battle command strings
|
||||
int[] battleCommandAddresses = CompileM12HardcodedStringCollection("m12-battle-commands", ref referenceAddress);
|
||||
IncludeFile.WriteLine("org $80DC038; add r5,#0x" + (battleCommandAddresses[4] - battleCommandAddresses[1]).ToString("X2")); // Defend (- Goods)
|
||||
IncludeFile.WriteLine("org $80DC0A8; add r1,#0x" + (battleCommandAddresses[8] - battleCommandAddresses[2]).ToString("X2")); // Run Away (- Auto Fight)
|
||||
}
|
||||
|
||||
static void CompileM12MiscStringCollection(string name, ref int referenceAddress)
|
||||
|
@ -511,5 +516,48 @@ namespace ScriptTool
|
|||
|
||||
return newPointers;
|
||||
}
|
||||
|
||||
static int[] CompileM12HardcodedStringCollection(string name, ref int referenceAddress)
|
||||
{
|
||||
int baseAddress = referenceAddress;
|
||||
var buffer = new List<byte>();
|
||||
|
||||
// Read the JSON
|
||||
var hardcodedStrings = JsonConvert.DeserializeObject<HardcodedString[]>(
|
||||
File.ReadAllText(Path.Combine(options.WorkingDirectory, name + ".json")));
|
||||
|
||||
var stringAddresses = new int[hardcodedStrings.Length];
|
||||
|
||||
// Open the data ASM file
|
||||
using (var offsetFile = File.CreateText(Path.Combine(options.WorkingDirectory, name + ".asm")))
|
||||
{
|
||||
// Include the binfile
|
||||
offsetFile.WriteLine(String.Format("org ${0:X}; incbin {1}.bin",
|
||||
baseAddress | 0x8000000, name));
|
||||
offsetFile.WriteLine();
|
||||
|
||||
// Compile all strings
|
||||
int i = 0;
|
||||
foreach (var str in hardcodedStrings)
|
||||
{
|
||||
foreach (int ptr in str.PointerLocations)
|
||||
{
|
||||
offsetFile.WriteLine(String.Format("org ${0:X}; dd ${1:X8}",
|
||||
ptr | 0x8000000, referenceAddress | 0x8000000));
|
||||
}
|
||||
|
||||
stringAddresses[i++] = referenceAddress;
|
||||
m12Compiler.CompileString(str.New, buffer, ref referenceAddress, ebCharLookup);
|
||||
}
|
||||
}
|
||||
|
||||
// Write the buffer
|
||||
File.WriteAllBytes(Path.Combine(options.WorkingDirectory, name + ".bin"), buffer.ToArray());
|
||||
|
||||
// Add to the include file
|
||||
IncludeFile.WriteLine("incsrc " + name + ".asm");
|
||||
|
||||
return stringAddresses;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
<Compile Include="CommandOptions.cs" />
|
||||
<Compile Include="EbControlCode.cs" />
|
||||
<Compile Include="FixedStringCollection.cs" />
|
||||
<Compile Include="HardcodedString.cs" />
|
||||
<Compile Include="ICompiler.cs" />
|
||||
<Compile Include="IControlCode.cs" />
|
||||
<Compile Include="IDecompiler.cs" />
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
[
|
||||
{
|
||||
"OldPointer": 11662440,
|
||||
"PointerLocations": [
|
||||
901040,
|
||||
901792,
|
||||
901904,
|
||||
902848,
|
||||
903040,
|
||||
903208,
|
||||
903408,
|
||||
903652,
|
||||
919016
|
||||
],
|
||||
"Old": "たたく[00 FF]",
|
||||
"New": "Bash[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662447,
|
||||
"PointerLocations": [
|
||||
901400
|
||||
],
|
||||
"Old": "グッズ[00 FF]",
|
||||
"New": "Goods[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662454,
|
||||
"PointerLocations": [
|
||||
901412
|
||||
],
|
||||
"Old": "オ-ト[00 FF]",
|
||||
"New": "Auto Fight[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662461,
|
||||
"PointerLocations": [
|
||||
901612
|
||||
],
|
||||
"Old": "PSI[00 FF]",
|
||||
"New": "PSI[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662468,
|
||||
"PointerLocations": [],
|
||||
"Old": "ガ-ド[00 FF]",
|
||||
"New": "Defend[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662477,
|
||||
"PointerLocations": [
|
||||
901624
|
||||
],
|
||||
"Old": "る[00 FF]",
|
||||
"New": "batl1[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662482,
|
||||
"PointerLocations": [
|
||||
901084
|
||||
],
|
||||
"Old": "うつ[00 FF]",
|
||||
"New": "batl2[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662489,
|
||||
"PointerLocations": [
|
||||
901428
|
||||
],
|
||||
"Old": "チェック[00 FF]",
|
||||
"New": "batl3[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662496,
|
||||
"PointerLocations": [],
|
||||
"Old": "にげる[00 FF]",
|
||||
"New": "Run Away[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662503,
|
||||
"PointerLocations": [
|
||||
901632
|
||||
],
|
||||
"Old": "へんしん[00 FF]",
|
||||
"New": "Mirror[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662521,
|
||||
"PointerLocations": [
|
||||
901384,
|
||||
902804,
|
||||
902996,
|
||||
903164,
|
||||
903364,
|
||||
903600,
|
||||
918972
|
||||
],
|
||||
"Old": "なにもしない[00 FF]",
|
||||
"New": "Do Nothing[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662542,
|
||||
"PointerLocations": [
|
||||
904268
|
||||
],
|
||||
"Old": "どのてきに?:[00 FF]",
|
||||
"New": "batl4[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662551,
|
||||
"PointerLocations": [
|
||||
904440
|
||||
],
|
||||
"Old": "ぜんれつ[00 FF]",
|
||||
"New": "batl5[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662557,
|
||||
"PointerLocations": [
|
||||
904444
|
||||
],
|
||||
"Old": "こうれつ[00 FF]",
|
||||
"New": "batl6[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662563,
|
||||
"PointerLocations": [
|
||||
904272
|
||||
],
|
||||
"Old": " [00 FF]",
|
||||
"New": "batl7[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662577,
|
||||
"PointerLocations": [
|
||||
919436,
|
||||
919748,
|
||||
920200,
|
||||
920432
|
||||
],
|
||||
"Old": " こうげき[01 FF] かいふく[01 FF] アシスト[00 FF]",
|
||||
"New": "batl8[00 FF]"
|
||||
},
|
||||
{
|
||||
"OldPointer": 11662584,
|
||||
"PointerLocations": [
|
||||
904272
|
||||
],
|
||||
"Old": " かいふく[01 FF] アシスト[00 FF]",
|
||||
"New": "batl9[00 FF]"
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue