diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/com/sneed/pkrandom/MiscTweak.java | 1 | ||||
-rwxr-xr-x | src/com/sneed/pkrandom/config/gen5_offsets.ini | 30 | ||||
-rw-r--r-- | src/com/sneed/pkrandom/constants/Gen5Constants.java | 2 | ||||
-rw-r--r-- | src/com/sneed/pkrandom/newgui/Bundle.properties | 2 | ||||
-rw-r--r-- | src/com/sneed/pkrandom/newgui/NewRandomizerGUI.form | 11 | ||||
-rw-r--r-- | src/com/sneed/pkrandom/newgui/NewRandomizerGUI.java | 1 | ||||
-rwxr-xr-x | src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java | 23 |
7 files changed, 70 insertions, 0 deletions
diff --git a/src/com/sneed/pkrandom/MiscTweak.java b/src/com/sneed/pkrandom/MiscTweak.java index 5cbdda1..45f5f51 100755 --- a/src/com/sneed/pkrandom/MiscTweak.java +++ b/src/com/sneed/pkrandom/MiscTweak.java @@ -61,6 +61,7 @@ public class MiscTweak implements Comparable<MiscTweak> { public static final MiscTweak FASTER_HP_AND_EXP_BARS = new MiscTweak(1 << 19, "fasterHpAndExpBars", 0); public static final MiscTweak FAST_DISTORTION_WORLD = new MiscTweak(1 << 20, "fastDistortionWorld", 0); public static final MiscTweak UPDATE_ROTOM_FORME_TYPING = new MiscTweak(1 << 21, "updateRotomFormeTyping", 0); + public static final MiscTweak DISABLE_LOW_HP_MUSIC = new MiscTweak(1 << 22, "disableLowHpMusic", 0); /* @formatter:on */ private final int value; diff --git a/src/com/sneed/pkrandom/config/gen5_offsets.ini b/src/com/sneed/pkrandom/config/gen5_offsets.ini index 246aba5..11684f0 100755 --- a/src/com/sneed/pkrandom/config/gen5_offsets.ini +++ b/src/com/sneed/pkrandom/config/gen5_offsets.ini @@ -28,6 +28,7 @@ ShopItemOvlNumber=21 IntroCryOvlNumber=88
PickupOvlNumber=92
BattleOvlNumber=93
+LowHealthMusicOvlNumber=94
EvolutionOvlNumber=195
IntroGraphicOvlNumber=204
StarterCryOvlNumber=223
@@ -128,6 +129,7 @@ OverlayCRC32<21>=F2B9DC42 OverlayCRC32<88>=26A8C2E1
OverlayCRC32<92>=D4CF0B58
OverlayCRC32<93>=A36EECA9
+OverlayCRC32<94>=58394A4F
OverlayCRC32<195>=E24CC7A8
OverlayCRC32<204>=798061E6
OverlayCRC32<223>=4FFD3D7F
@@ -158,6 +160,7 @@ OverlayCRC32<21>=EAC5BFE0 OverlayCRC32<88>=6728568B
OverlayCRC32<92>=F597B809
OverlayCRC32<93>=167CBE37
+OverlayCRC32<94>=AC9CECAC
OverlayCRC32<195>=6DF520CE
OverlayCRC32<204>=A9A7377A
OverlayCRC32<223>=09541F48
@@ -195,6 +198,7 @@ MoveTutorOvlNumber=36 IntroCryOvlNumber=162
PickupOvlNumber=166
BattleOvlNumber=167
+LowHealthMusicOvlNumber=168
EvolutionOvlNumber=284
IntroGraphicOvlNumber=294
StarterCryOvlNumber=316
@@ -297,6 +301,7 @@ OverlayCRC32<36>=4CF872D1 OverlayCRC32<162>=8D54F1B3
OverlayCRC32<166>=4CB7622C
OverlayCRC32<167>=26B6E3C0
+OverlayCRC32<168>=0439E88C
OverlayCRC32<284>=957DBCBA
OverlayCRC32<294>=F3F8525A
OverlayCRC32<316>=D4756D45
@@ -324,6 +329,7 @@ OverlayCRC32<36>=E3CF3D36 OverlayCRC32<162>=CCA4CB78
OverlayCRC32<166>=759F8A03
OverlayCRC32<167>=3E3CA5FA
+OverlayCRC32<168>=EDE00D9D
OverlayCRC32<284>=0E276134
OverlayCRC32<294>=717E4E01
OverlayCRC32<316>=D7EED8D1
@@ -347,6 +353,7 @@ OverlayCRC32<21>=054897E8 OverlayCRC32<88>=55593929
OverlayCRC32<92>=57E1FE0E
OverlayCRC32<93>=D568F722
+OverlayCRC32<94>=3A8E21BE
OverlayCRC32<195>=6B6112D6
OverlayCRC32<204>=3E6F6775
OverlayCRC32<223>=F01B4C69
@@ -370,6 +377,7 @@ OverlayCRC32<21>=14BA0CDE OverlayCRC32<88>=F4EB70CD
OverlayCRC32<92>=5ACBE24B
OverlayCRC32<93>=B185132E
+OverlayCRC32<94>=985B99B1
OverlayCRC32<195>=F5FB3F97
OverlayCRC32<204>=B391C71E
OverlayCRC32<223>=935717C1
@@ -393,6 +401,7 @@ OverlayCRC32<21>=7E6E109F OverlayCRC32<88>=E2E86BAF
OverlayCRC32<92>=C684D133
OverlayCRC32<93>=5DAB79AA
+OverlayCRC32<94>=5F094FDE
OverlayCRC32<195>=CACEF977
OverlayCRC32<204>=6CBA741B
OverlayCRC32<223>=787E48BF
@@ -416,6 +425,7 @@ OverlayCRC32<21>=61B4BE9C OverlayCRC32<88>=805834D4
OverlayCRC32<92>=1BC6EC0E
OverlayCRC32<93>=FEDB5C26
+OverlayCRC32<94>=DC4FBCB9
OverlayCRC32<195>=BD27975F
OverlayCRC32<204>=4CB70AB9
OverlayCRC32<223>=B1CA7124
@@ -439,6 +449,7 @@ OverlayCRC32<21>=A6539D64 OverlayCRC32<88>=51BB12C3
OverlayCRC32<92>=414ADA7A
OverlayCRC32<93>=F1905C6B
+OverlayCRC32<94>=63537E6B
OverlayCRC32<195>=38859ADE
OverlayCRC32<204>=8ED54FBE
OverlayCRC32<223>=187C0D03
@@ -462,6 +473,7 @@ OverlayCRC32<21>=3882585C OverlayCRC32<88>=54B7C88D
OverlayCRC32<92>=8043EB67
OverlayCRC32<93>=73422427
+OverlayCRC32<94>=325AA919
OverlayCRC32<195>=6637307A
OverlayCRC32<204>=DD127FDF
OverlayCRC32<223>=2F3ADC12
@@ -485,6 +497,7 @@ OverlayCRC32<21>=4F9C6CB1 OverlayCRC32<88>=02AE885C
OverlayCRC32<92>=598C95C4
OverlayCRC32<93>=E0F9359C
+OverlayCRC32<94>=2F85DA79
OverlayCRC32<195>=70F4039C
OverlayCRC32<204>=AE28DAEC
OverlayCRC32<223>=DC1D15FC
@@ -508,6 +521,7 @@ OverlayCRC32<21>=5999FAA1 OverlayCRC32<88>=2B0077F8
OverlayCRC32<92>=F578AD4B
OverlayCRC32<93>=1C399052
+OverlayCRC32<94>=0F25AD49
OverlayCRC32<195>=0C9EEB6B
OverlayCRC32<204>=12FF46BB
OverlayCRC32<223>=0F78FCA2
@@ -534,6 +548,7 @@ OverlayCRC32<21>=2FEEC460 OverlayCRC32<88>=DC1300B9
OverlayCRC32<92>=0EC1245E
OverlayCRC32<93>=65349A4A
+OverlayCRC32<94>=31CB4E7A
OverlayCRC32<195>=CA203F2C
OverlayCRC32<204>=127CF38D
OverlayCRC32<223>=973F0880
@@ -560,6 +575,7 @@ OverlayCRC32<21>=9311D75D OverlayCRC32<88>=2983855B
OverlayCRC32<92>=41E0F3F4
OverlayCRC32<93>=CBF347C4
+OverlayCRC32<94>=4DD90D5E
OverlayCRC32<195>=63636362
OverlayCRC32<204>=88CB9615
OverlayCRC32<223>=57871763
@@ -582,6 +598,7 @@ OverlayCRC32<21>=E79FDDB3 OverlayCRC32<88>=8A835ABF
OverlayCRC32<92>=27B75A9A
OverlayCRC32<93>=3F071EF5
+OverlayCRC32<94>=113D4CDF
OverlayCRC32<195>=FFEF510C
OverlayCRC32<204>=05A0D977
OverlayCRC32<223>=90F700C2
@@ -604,6 +621,7 @@ OverlayCRC32<21>=DD795DB3 OverlayCRC32<88>=43A68763
OverlayCRC32<92>=4410A4AC
OverlayCRC32<93>=61307C75
+OverlayCRC32<94>=1AB592F2
OverlayCRC32<195>=8D5E5514
OverlayCRC32<204>=70E175AF
OverlayCRC32<223>=DF2D29AC
@@ -626,6 +644,7 @@ OverlayCRC32<36>=7314EA5A OverlayCRC32<162>=47279894
OverlayCRC32<166>=DCD888DE
OverlayCRC32<167>=D23B80B4
+OverlayCRC32<168>=F6639242
OverlayCRC32<284>=112A8880
OverlayCRC32<294>=07A19A52
OverlayCRC32<316>=9A87B407
@@ -648,6 +667,7 @@ OverlayCRC32<36>=2936E726 OverlayCRC32<162>=268CD440
OverlayCRC32<166>=4375ED33
OverlayCRC32<167>=99AA7857
+OverlayCRC32<168>=77FD23BD
OverlayCRC32<284>=34FAD991
OverlayCRC32<294>=8E753885
OverlayCRC32<316>=A680DF32
@@ -670,6 +690,7 @@ OverlayCRC32<36>=A1F1DD09 OverlayCRC32<162>=A1A6458A
OverlayCRC32<166>=A06010C3
OverlayCRC32<167>=40392337
+OverlayCRC32<168>=3B1F041B
OverlayCRC32<284>=946AE3C4
OverlayCRC32<294>=4E16F546
OverlayCRC32<316>=699BD8B0
@@ -692,6 +713,7 @@ OverlayCRC32<36>=400EE8B2 OverlayCRC32<162>=A55A3E8E
OverlayCRC32<166>=B8770300
OverlayCRC32<167>=6ECDC783
+OverlayCRC32<168>=D18B4E73
OverlayCRC32<284>=42022F46
OverlayCRC32<294>=AA708716
OverlayCRC32<316>=D35EA355
@@ -714,6 +736,7 @@ OverlayCRC32<36>=96CCDDA7 OverlayCRC32<162>=49534761
OverlayCRC32<166>=2003AFAA
OverlayCRC32<167>=FC14A53F
+OverlayCRC32<168>=E1C34887
OverlayCRC32<284>=122E79F7
OverlayCRC32<294>=8E83C586
OverlayCRC32<316>=96A98A1D
@@ -736,6 +759,7 @@ OverlayCRC32<36>=5DF5BFD5 OverlayCRC32<162>=5C2290A5
OverlayCRC32<166>=C426EC98
OverlayCRC32<167>=5C87223F
+OverlayCRC32<168>=815FC8BA
OverlayCRC32<284>=D13AF02C
OverlayCRC32<294>=0839E1F1
OverlayCRC32<316>=2D552545
@@ -758,6 +782,7 @@ OverlayCRC32<36>=B7A8FDD4 OverlayCRC32<162>=8A291DF2
OverlayCRC32<166>=56E6C955
OverlayCRC32<167>=D87994A8
+OverlayCRC32<168>=334A52E5
OverlayCRC32<284>=12547755
OverlayCRC32<294>=B6F92135
OverlayCRC32<316>=3585F11B
@@ -780,6 +805,7 @@ OverlayCRC32<36>=D8CE4272 OverlayCRC32<162>=C3F7B172
OverlayCRC32<166>=3328105B
OverlayCRC32<167>=56AB1872
+OverlayCRC32<168>=B0723FF9
OverlayCRC32<284>=49386511
OverlayCRC32<294>=4087E658
OverlayCRC32<316>=49765281
@@ -849,6 +875,7 @@ OverlayCRC32<36>=4BF19607 OverlayCRC32<162>=35DA9C90
OverlayCRC32<166>=EBDBC1CB
OverlayCRC32<167>=0D1C66F1
+OverlayCRC32<168>=CDD99E97
OverlayCRC32<284>=E1504E5D
OverlayCRC32<294>=1B490894
OverlayCRC32<316>=074A22B1
@@ -868,6 +895,7 @@ OverlayCRC32<36>=896946FC OverlayCRC32<162>=DD3707A4
OverlayCRC32<166>=083CFC05
OverlayCRC32<167>=27978D30
+OverlayCRC32<168>=094F1D74
OverlayCRC32<284>=337744D2
OverlayCRC32<294>=FC3CEB37
OverlayCRC32<316>=0F57993F
@@ -890,6 +918,7 @@ OverlayCRC32<36>=AC0E0C5A OverlayCRC32<162>=195919EB
OverlayCRC32<166>=C0D5AB8C
OverlayCRC32<167>=6FAC8636
+OverlayCRC32<168>=0E04A907
OverlayCRC32<284>=4621EF7E
OverlayCRC32<294>=A678C4C6
OverlayCRC32<316>=04E41D23
@@ -912,6 +941,7 @@ OverlayCRC32<36>=EACE4819 OverlayCRC32<162>=D9FE03A6
OverlayCRC32<166>=A9F8ADA1
OverlayCRC32<167>=B94A6A8C
+OverlayCRC32<168>=5E4912F4
OverlayCRC32<284>=99975230
OverlayCRC32<294>=28B2F1D4
OverlayCRC32<316>=08076F8F
diff --git a/src/com/sneed/pkrandom/constants/Gen5Constants.java b/src/com/sneed/pkrandom/constants/Gen5Constants.java index 56e49e9..169ecba 100644 --- a/src/com/sneed/pkrandom/constants/Gen5Constants.java +++ b/src/com/sneed/pkrandom/constants/Gen5Constants.java @@ -377,6 +377,8 @@ public class Gen5Constants { public static final String perfectOddsBranchLocator = "08DB002801D0012000E0";
+ public static final String lowHealthMusicLocator = "00D10127";
+
public static final List<Integer> consumableHeldItems = setupAllConsumableItems();
private static List<Integer> setupAllConsumableItems() {
diff --git a/src/com/sneed/pkrandom/newgui/Bundle.properties b/src/com/sneed/pkrandom/newgui/Bundle.properties index 573556b..b3ad8b9 100644 --- a/src/com/sneed/pkrandom/newgui/Bundle.properties +++ b/src/com/sneed/pkrandom/newgui/Bundle.properties @@ -519,6 +519,8 @@ CodeTweaks.fastDistortionWorld.name=Fast Distortion World CodeTweaks.fastDistortionWorld.toolTipText=<html>Cuts out most of the Distortion World by instantly warping you to the Cyrus fight when you enter it. CodeTweaks.updateRotomFormeTyping.name=Update Rotom Appliance Typings CodeTweaks.updateRotomFormeTyping.toolTipText=<html>Updates the typings of Rotom's alternate formes (i.e., the appliances) to match the typings they have in Gen 5 and onwards.<br />For example, Wash Rotom will change from Electric/Ghost to Electric/Water. +CodeTweaks.disableLowHpMusic.name=Disable Low HP Music +CodeTweaks.disableLowHpMusic.toolTipText=<html>Disables the music that plays when one of the player's Pokemon is at low HP in battle, ensuring that the current song will continue playing no matter what. CustomNamesEditorDialog.trainerNamesSP.TabConstraints.tabTitle=Trainer Names CustomNamesEditorDialog.title=Custom Names Editor CustomNamesEditorDialog.closeBtn.text=Close diff --git a/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.form b/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.form index d7ae1f0..8cec194 100644 --- a/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.form +++ b/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.form @@ -3609,6 +3609,17 @@ <toolTipText resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="CodeTweaks.updateRotomFormeTyping.toolTipText"/> </properties> </component> + <component id="1f079" class="javax.swing.JCheckBox" binding="miscDisableLowHPMusicCheckBox"> + <constraints> + <grid row="6" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + <gridbag weightx="0.0" weighty="0.0"/> + </constraints> + <properties> + <enabled value="false"/> + <text resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="CodeTweaks.disableLowHpMusic.name"/> + <toolTipText resource-bundle="com/sneed/pkrandom/newgui/Bundle" key="CodeTweaks.disableLowHpMusic.toolTipText"/> + </properties> + </component> </children> </grid> <hspacer id="c4e06"> diff --git a/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.java b/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.java index 5eecbe7..7e8a1d6 100644 --- a/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.java +++ b/src/com/sneed/pkrandom/newgui/NewRandomizerGUI.java @@ -297,6 +297,7 @@ public class NewRandomizerGUI { private JCheckBox tpBetterMovesetsCheckBox; private JCheckBox paEnsureTwoAbilitiesCheckbox; private JCheckBox miscUpdateRotomFormeTypingCheckBox; + private JCheckBox miscDisableLowHPMusicCheckBox; private static JFrame frame; diff --git a/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java index 26e6e29..58fe224 100755 --- a/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java +++ b/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java @@ -2400,6 +2400,7 @@ public class Gen5RomHandler extends AbstractDSRomHandler { if (romEntry.romType == Gen5Constants.Type_BW2) {
available |= MiscTweak.FORCE_CHALLENGE_MODE.getValue();
}
+ available |= MiscTweak.DISABLE_LOW_HP_MUSIC.getValue();
return available;
}
@@ -2435,6 +2436,8 @@ public class Gen5RomHandler extends AbstractDSRomHandler { updateTypeEffectiveness();
} else if (tweak == MiscTweak.FORCE_CHALLENGE_MODE) {
forceChallengeMode();
+ } else if (tweak == MiscTweak.DISABLE_LOW_HP_MUSIC) {
+ disableLowHpMusic();
}
}
@@ -2613,6 +2616,26 @@ public class Gen5RomHandler extends AbstractDSRomHandler { }
}
+ private void disableLowHpMusic() {
+ try {
+ byte[] lowHealthMusicOverlay = readOverlay(romEntry.getInt("LowHealthMusicOvlNumber"));
+ int offset = find(lowHealthMusicOverlay, Gen5Constants.lowHealthMusicLocator);
+ if (offset > 0) {
+ // The game calls a function that returns 2 if the Pokemon has low HP. The ASM looks like this:
+ // bl funcThatReturns2IfThePokemonHasLowHp
+ // cmp r0, #0x2
+ // bne pokemonDoesNotHaveLowHp
+ // mov r7, #0x1
+ // The offset variable is currently pointing at the bne instruction. If we change that bne to an unconditional
+ // branch, the game will never think the player's Pokemon has low HP (for the purposes of changing the music).
+ lowHealthMusicOverlay[offset + 1] = (byte)0xE0;
+ writeOverlay(romEntry.getInt("LowHealthMusicOvlNumber"), lowHealthMusicOverlay);
+ }
+ } catch (IOException e) {
+ throw new RandomizerIOException(e);
+ }
+ }
+
@Override
public void enableGuaranteedPokemonCatching() {
try {
|