summaryrefslogtreecommitdiff
path: root/src/com
diff options
context:
space:
mode:
authorDabomstew <dbs.stew@gmail.com>2016-02-20 17:52:26 +1300
committerDabomstew <dbs.stew@gmail.com>2016-02-20 17:52:26 +1300
commit1e622c0c96d3e7d1cdb9f3a39aca360ad250072f (patch)
tree7ae2c4b219f60ea041783f8ab2a3279b0d9fe4f8 /src/com
parent6c666c046bf88e63b47edd2165c1ba4c976ea92f (diff)
Gen 4 (Pt/HGSS) instant text patches thanks to Kaphotics' AR codes.
Diffstat (limited to 'src/com')
-rwxr-xr-xsrc/com/dabomstew/pkrandom/config/gen4_offsets.ini3
-rw-r--r--src/com/dabomstew/pkrandom/patches/hgss_instant_text.ipsbin0 -> 49 bytes
-rw-r--r--src/com/dabomstew/pkrandom/patches/plat_instant_text.ipsbin0 -> 49 bytes
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java12
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java26
5 files changed, 35 insertions, 6 deletions
diff --git a/src/com/dabomstew/pkrandom/config/gen4_offsets.ini b/src/com/dabomstew/pkrandom/config/gen4_offsets.ini
index 56a5f10..737284f 100755
--- a/src/com/dabomstew/pkrandom/config/gen4_offsets.ini
+++ b/src/com/dabomstew/pkrandom/config/gen4_offsets.ini
@@ -107,6 +107,7 @@ MapTableNameIndexSize=1
MapNamesTextOffset=433
CatchingTutorialOpponentMonOffset=0x520A0
FossilTableOffset=0xEBFFC
+FastestTextTweak=plat_instant_text
StaticPokemonSupport=1
StaticPokemon[]=[361:0x39, 361:0x48] // Uxie
StaticPokemon[]=[357:0x81, 357:0x90] // Azelf
@@ -174,6 +175,7 @@ FossilTableOvlNumber=21
FossilTableOffset=0x130
CatchingTutorialPlayerMonOffset=0x51B78
CatchingTutorialOpponentMonOffset=0x51B9A
+FastestTextTweak=hgss_instant_text
StaticPokemonSupport=1
StaticPokemon[]=[104:0x108] // Lugia
StaticPokemon[]=[21:0xD1] // Ho-oh
@@ -221,6 +223,7 @@ Type=HGSS
CopyStaticPokemon=1
CopyFrom=IPKE
WildPokemon=a/1/3/6
+FastestTextTweak=hgss_instant_text
[Pearl (J)]
Game=APAJ
diff --git a/src/com/dabomstew/pkrandom/patches/hgss_instant_text.ips b/src/com/dabomstew/pkrandom/patches/hgss_instant_text.ips
new file mode 100644
index 0000000..7352d3e
--- /dev/null
+++ b/src/com/dabomstew/pkrandom/patches/hgss_instant_text.ips
Binary files differ
diff --git a/src/com/dabomstew/pkrandom/patches/plat_instant_text.ips b/src/com/dabomstew/pkrandom/patches/plat_instant_text.ips
new file mode 100644
index 0000000..a7c63d0
--- /dev/null
+++ b/src/com/dabomstew/pkrandom/patches/plat_instant_text.ips
Binary files differ
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java
index f34e983..f11a36b 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java
@@ -124,7 +124,7 @@ public class Gen1RomHandler extends AbstractGBRomHandler {
private String extraTableFile;
private boolean isYellow;
private int crcInHeader = -1;
- private Map<String, String> codeTweaks = new HashMap<String, String>();
+ private Map<String, String> tweakFiles = new HashMap<String, String>();
private List<TMTextEntry> tmTexts = new ArrayList<TMTextEntry>();
private Map<String, Integer> entries = new HashMap<String, Integer>();
private Map<String, int[]> arrayEntries = new HashMap<String, int[]>();
@@ -248,7 +248,7 @@ public class Gen1RomHandler extends AbstractGBRomHandler {
} else if (r[0].equals("CRCInHeader")) {
current.crcInHeader = parseRIInt(r[1]);
} else if (r[0].endsWith("Tweak")) {
- current.codeTweaks.put(r[0], r[1]);
+ current.tweakFiles.put(r[0], r[1]);
} else if (r[0].equals("ExtraTypes")) {
// remove the containers
r[1] = r[1].substring(1, r[1].length() - 1);
@@ -1807,13 +1807,13 @@ public class Gen1RomHandler extends AbstractGBRomHandler {
int available = MiscTweak.LOWER_CASE_POKEMON_NAMES.getValue();
available |= MiscTweak.UPDATE_TYPE_EFFECTIVENESS.getValue();
- if (romEntry.codeTweaks.get("BWXPTweak") != null) {
+ if (romEntry.tweakFiles.get("BWXPTweak") != null) {
available |= MiscTweak.BW_EXP_PATCH.getValue();
}
- if (romEntry.codeTweaks.get("XAccNerfTweak") != null) {
+ if (romEntry.tweakFiles.get("XAccNerfTweak") != null) {
available |= MiscTweak.NERF_X_ACCURACY.getValue();
}
- if (romEntry.codeTweaks.get("CritRateTweak") != null) {
+ if (romEntry.tweakFiles.get("CritRateTweak") != null) {
available |= MiscTweak.FIX_CRIT_RATE.getValue();
}
if (romEntry.getValue("TextDelayFunctionOffset") != 0) {
@@ -1893,7 +1893,7 @@ public class Gen1RomHandler extends AbstractGBRomHandler {
}
private boolean genericIPSPatch(String ctName) {
- String patchName = romEntry.codeTweaks.get(ctName);
+ String patchName = romEntry.tweakFiles.get(ctName);
if (patchName == null) {
return false;
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java
index 0875c58..5414422 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java
@@ -87,6 +87,7 @@ public class Gen4RomHandler extends AbstractDSRomHandler {
private boolean staticPokemonSupport = false,
copyStaticPokemon = false;
private Map<String, String> strings = new HashMap<String, String>();
+ private Map<String, String> tweakFiles = new HashMap<String, String>();
private Map<String, Integer> numbers = new HashMap<String, Integer>();
private Map<String, int[]> arrayEntries = new HashMap<String, int[]>();
private List<StaticPokemon> staticPokemon = new ArrayList<StaticPokemon>();
@@ -200,6 +201,8 @@ public class Gen4RomHandler extends AbstractDSRomHandler {
} else if (r[0].equals("CopyStaticPokemon")) {
int csp = parseRIInt(r[1]);
current.copyStaticPokemon = (csp > 0);
+ } else if (r[0].endsWith("Tweak")) {
+ current.tweakFiles.put(r[0], r[1]);
} else {
if (r[1].startsWith("[") && r[1].endsWith("]")) {
String[] offsets = r[1].substring(1,
@@ -2714,6 +2717,9 @@ public class Gen4RomHandler extends AbstractDSRomHandler {
public int miscTweaksAvailable() {
int available = MiscTweak.LOWER_CASE_POKEMON_NAMES.getValue();
available |= MiscTweak.RANDOMIZE_CATCHING_TUTORIAL.getValue();
+ if (romEntry.tweakFiles.get("FastestTextTweak") != null) {
+ available |= MiscTweak.FASTEST_TEXT.getValue();
+ }
return available;
}
@@ -2723,6 +2729,26 @@ public class Gen4RomHandler extends AbstractDSRomHandler {
applyCamelCaseNames();
} else if (tweak == MiscTweak.RANDOMIZE_CATCHING_TUTORIAL) {
randomizeCatchingTutorial();
+ } else if (tweak == MiscTweak.FASTEST_TEXT) {
+ applyFastestText();
+ }
+ }
+
+ private void applyFastestText() {
+ genericIPSPatch(arm9, "FastestTextTweak");
+ }
+
+ private boolean genericIPSPatch(byte[] data, String ctName) {
+ String patchName = romEntry.tweakFiles.get(ctName);
+ if (patchName == null) {
+ return false;
+ }
+
+ try {
+ FileFunctions.applyPatch(data, patchName);
+ return true;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}