From e2cc3e996ac3011309911c9311ec4798f1273ccd Mon Sep 17 00:00:00 2001 From: MegAmi Date: Mon, 1 Jan 2024 11:18:13 -0600 Subject: [PATCH] [Sonic Origins] Sonic 1 & 2 game option codes (#87) * [Sonic Origins] Sonic 1 & 2 game option codes * Mark shield/item codes as experimental * Set values normally instead of using WriteProtected --- .../Enable Lives in Anniversary Mode.hmm | 14 +++++------- .../Gameplay/Enable Lives in Mirror Mode.hmm | 14 +++++------- .../Sonic 1/Enable 7th Chaos Emerald.hmm | 21 ++++++++++++++++++ ...hields and Insta Shield (experimental).hmm | 22 +++++++++++++++++++ ...ble Sonic 2 Style Items (experimental).hmm | 22 +++++++++++++++++++ ...hields and Insta Shield (experimental).hmm | 22 +++++++++++++++++++ .../Enable Random Monitors (experimental).hmm | 22 +++++++++++++++++++ .../Gameplay/Sonic 2/Enable Super Tails.hmm | 21 ++++++++++++++++++ 8 files changed, 142 insertions(+), 16 deletions(-) create mode 100644 Source/Sonic Origins/Gameplay/Sonic 1/Enable 7th Chaos Emerald.hmm create mode 100644 Source/Sonic Origins/Gameplay/Sonic 1/Enable Elemental Shields and Insta Shield (experimental).hmm create mode 100644 Source/Sonic Origins/Gameplay/Sonic 1/Enable Sonic 2 Style Items (experimental).hmm create mode 100644 Source/Sonic Origins/Gameplay/Sonic 2/Enable Elemental Shields and Insta Shield (experimental).hmm create mode 100644 Source/Sonic Origins/Gameplay/Sonic 2/Enable Random Monitors (experimental).hmm create mode 100644 Source/Sonic Origins/Gameplay/Sonic 2/Enable Super Tails.hmm diff --git a/Source/Sonic Origins/Gameplay/Enable Lives in Anniversary Mode.hmm b/Source/Sonic Origins/Gameplay/Enable Lives in Anniversary Mode.hmm index 8bf4149d..6ad65d89 100644 --- a/Source/Sonic Origins/Gameplay/Enable Lives in Anniversary Mode.hmm +++ b/Source/Sonic Origins/Gameplay/Enable Lives in Anniversary Mode.hmm @@ -3,7 +3,7 @@ Code "Enable Lives in Anniversary Mode" in "Gameplay" by "ĐeäTh" does Disables the flag for Coins when playing in Anniversary Mode. Notes; -- This will cause Anniversary Mode to use a different set of saves from normal, and your regular Anniversary Mode saves will be inaccessible." +- This will cause Anniversary Mode to use a different set of saves from normal, and your regular Anniversary Mode saves will be inaccessible. */ // #lib "RSDK" @@ -14,21 +14,21 @@ Notes; if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0x1FC) == 1) { // Sonic 1 Coin Mode - WriteProtected(RSDK.GetRSDKv4DataPtr() + 0x1FC, 0x00); + *(byte*)(RSDK.GetRSDKv4DataPtr() + 0x1FC) = 0; } // Check if Sonic 2 game.playMode is set to BOOT_PLAYMODE_ANNIVERSARY if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0x23C) == 1) { // Sonic 2 Coin Mode - WriteProtected(RSDK.GetRSDKv4DataPtr() + 0x288, 0x00); + *(byte*)(RSDK.GetRSDKv4DataPtr() + 0x288) = 0; } // Check if RSDKv3 game.playMode is set to BOOT_PLAYMODE_ANNIVERSARY if (*(byte*)(RSDK.GetRSDKv3DataPtr() + 0x1DC) == 1) { // Sonic CD Coin Mode - WriteProtected(RSDK.GetRSDKv3DataPtr() + 0x220, 0x00); + *(byte*)(RSDK.GetRSDKv3DataPtr() + 0x220) = 0; } // Sonic 3&K Coin Mode and HUD Update @@ -43,15 +43,13 @@ Notes; // HUD Update // Version 1.0.0: RSDKGlobalsPtr + 0x447D20 // Version 1.0.4: RSDKGlobalsPtr + 0x4C34D4 (Thanks to RDC) - WriteProtected(RSDK.GetRSDKGlobalsAbsPtr() + 0xD0, 0x00); + *(byte*)(RSDK.GetRSDKGlobalsAbsPtr() + 0xD0) = 0; // Coin Mode // Version 1.0.0: RSDKGlobalsPtr + 0x447CD4 // Version 1.0.4: RSDKGlobalsPtr + 0x4C3520 (Thanks to RDC) // Version 2.0.0: RSDKGlobalsPtr + RSDKGlobalsOffset + 0x124 - WriteProtected(RSDK.GetRSDKGlobalsAbsPtr() + 0x124, 0x00); + *(byte*)(RSDK.GetRSDKGlobalsAbsPtr() + 0x124) = 0; } } } - - diff --git a/Source/Sonic Origins/Gameplay/Enable Lives in Mirror Mode.hmm b/Source/Sonic Origins/Gameplay/Enable Lives in Mirror Mode.hmm index 6df88016..a31cb305 100644 --- a/Source/Sonic Origins/Gameplay/Enable Lives in Mirror Mode.hmm +++ b/Source/Sonic Origins/Gameplay/Enable Lives in Mirror Mode.hmm @@ -3,7 +3,7 @@ Code "Enable Lives in Mirror Mode" in "Gameplay" by "ĐeäTh" does Disables the flag for Coins when playing in Mirror Mode. Notes; -- This will cause Mirror Mode to use a different set of saves from normal, and your regular Mirror Mode saves will be inaccessible." +- This will cause Mirror Mode to use a different set of saves from normal, and your regular Mirror Mode saves will be inaccessible. */ // #lib "RSDK" @@ -14,21 +14,21 @@ Notes; if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0x1FC) == 3) { // Sonic 1 Coin Mode - WriteProtected(RSDK.GetRSDKv4DataPtr() + 0x1FC, 0x00); + *(byte*)(RSDK.GetRSDKv4DataPtr() + 0x1FC) = 0; } // Check if Sonic 2 game.playMode is set to BOOT_PLAYMODE_MIRRORING if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0x23C) == 3) { // Sonic 2 Coin Mode - WriteProtected(RSDK.GetRSDKv4DataPtr() + 0x288, 0x00); + *(byte*)(RSDK.GetRSDKv4DataPtr() + 0x288) = 0; } // Check if RSDKv3 game.playMode is set to BOOT_PLAYMODE_MIRRORING if (*(byte*)(RSDK.GetRSDKv3DataPtr() + 0x1DC) == 3) { // Sonic CD Coin Mode - WriteProtected(RSDK.GetRSDKv3DataPtr() + 0x220, 0x00); + *(byte*)(RSDK.GetRSDKv3DataPtr() + 0x220) = 0; } // Sonic 3&K Coin Mode and HUD Update @@ -43,15 +43,13 @@ Notes; // HUD Update // Version 1.0.0: RSDKGlobalsPtr + 0x447D20 // Version 1.0.4: RSDKGlobalsPtr + 0x4C34D4 (Thanks to RDC) - WriteProtected(RSDK.GetRSDKGlobalsAbsPtr() + 0xD0, 0x00); + *(byte*)(RSDK.GetRSDKGlobalsAbsPtr() + 0xD0) = 0; // Coin Mode // Version 1.0.0: RSDKGlobalsPtr + 0x447CD4 // Version 1.0.4: RSDKGlobalsPtr + 0x4C3520 (Thanks to RDC) // Version 2.0.0: RSDKGlobalsPtr + RSDKGlobalsOffset + 0x124 - WriteProtected(RSDK.GetRSDKGlobalsPtr() + 0x124, 0x00); + *(byte*)(RSDK.GetRSDKGlobalsAbsPtr() + 0x124) = 0; } } } - - diff --git a/Source/Sonic Origins/Gameplay/Sonic 1/Enable 7th Chaos Emerald.hmm b/Source/Sonic Origins/Gameplay/Sonic 1/Enable 7th Chaos Emerald.hmm new file mode 100644 index 00000000..4f6e7d92 --- /dev/null +++ b/Source/Sonic Origins/Gameplay/Sonic 1/Enable 7th Chaos Emerald.hmm @@ -0,0 +1,21 @@ +Code "Enable 7th Chaos Emerald" in "Gameplay/Sonic 1" by "MegAmi" does +/* +Enables the 7th Chaos Emerald in normal gameplay, allowing the player to use Super forms once all seven are collected. + +Notes; +- The game does not check the emeralds setting when checking if the player should transform, so collecting all seven emeralds in a save file will allow the player to transform regardless of whether or not this code is enabled. +*/ +// + #lib "RSDK" +// +{ + // Check if this is Sonic 1 + if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0xC8) == 0xFF) + { + // Check if Super forms (options.superStates) are disabled + if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0x38) != 0x01) + { + *(byte*)(RSDK.GetRSDKv4DataPtr() + 0x38) = 0x01; + } + } +} diff --git a/Source/Sonic Origins/Gameplay/Sonic 1/Enable Elemental Shields and Insta Shield (experimental).hmm b/Source/Sonic Origins/Gameplay/Sonic 1/Enable Elemental Shields and Insta Shield (experimental).hmm new file mode 100644 index 00000000..55e37862 --- /dev/null +++ b/Source/Sonic Origins/Gameplay/Sonic 1/Enable Elemental Shields and Insta Shield (experimental).hmm @@ -0,0 +1,22 @@ +Code "Enable Elemental Shields and Insta Shield (experimental)" in "Gameplay/Sonic 1" by "MegAmi" does +/* +Enables the Elemental Shields and Sonic's Insta Shield move. + +Known issues; +- The elemental shield monitors will not appear upon initial stage load when starting the game from the main menu. This is fixed upon loading the stage again or loading a different one. +- Progress in save files will not be saved. +*/ +// + #lib "RSDK" +// +{ + // Check if this is Sonic 1 + if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0xC8) == 0xFF) + { + // Check if elemental shields (second bit of options.shieldType) are disabled + if ((*(byte*)(RSDK.GetRSDKv4DataPtr() + 0x34) & 2) == 0) + { + *(byte*)(RSDK.GetRSDKv4DataPtr() + 0x34) |= 2; + } + } +} diff --git a/Source/Sonic Origins/Gameplay/Sonic 1/Enable Sonic 2 Style Items (experimental).hmm b/Source/Sonic Origins/Gameplay/Sonic 1/Enable Sonic 2 Style Items (experimental).hmm new file mode 100644 index 00000000..8b89715a --- /dev/null +++ b/Source/Sonic Origins/Gameplay/Sonic 1/Enable Sonic 2 Style Items (experimental).hmm @@ -0,0 +1,22 @@ +Code "Enable Sonic 2 Style Items (experimental)" in "Gameplay/Sonic 1" by "MegAmi" does +/* +Enables the Sonic 2 style Blue Shield and invincibility stars. + +Known issues; +- The Sonic 1 style items will still appear upon initial stage load when starting the game from the main menu. This is fixed upon loading the stage again or loading a different one. +- Progress in save files will not be saved. +*/ +// + #lib "RSDK" +// +{ + // Check if this is Sonic 1 + if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0xC8) == 0xFF) + { + // Check if S2 items (first bit of options.shieldType) are disabled + if ((*(byte*)(RSDK.GetRSDKv4DataPtr() + 0x34) & 1) == 0) + { + *(byte*)(RSDK.GetRSDKv4DataPtr() + 0x34) |= 1; + } + } +} diff --git a/Source/Sonic Origins/Gameplay/Sonic 2/Enable Elemental Shields and Insta Shield (experimental).hmm b/Source/Sonic Origins/Gameplay/Sonic 2/Enable Elemental Shields and Insta Shield (experimental).hmm new file mode 100644 index 00000000..d35bcf19 --- /dev/null +++ b/Source/Sonic Origins/Gameplay/Sonic 2/Enable Elemental Shields and Insta Shield (experimental).hmm @@ -0,0 +1,22 @@ +Code "Enable Elemental Shields and Insta Shield (experimental)" in "Gameplay/Sonic 2" by "MegAmi" does +/* +Enables the Elemental Shields and Sonic's Insta Shield move. + +Known issues; +- The elemental shield monitors will not appear upon initial stage load when starting the game from the main menu. This is fixed upon loading the stage again or loading a different one. +- Progress in save files will not be saved. +*/ +// + #lib "RSDK" +// +{ + // Check if this is Sonic 2 + if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0xC8) != 0xFF) + { + // Check if elemental shields (first bit of options.shieldType) are disabled + if ((*(byte*)(RSDK.GetRSDKv4DataPtr() + 0x30) & 1) == 0) + { + *(byte*)(RSDK.GetRSDKv4DataPtr() + 0x30) |= 1; + } + } +} diff --git a/Source/Sonic Origins/Gameplay/Sonic 2/Enable Random Monitors (experimental).hmm b/Source/Sonic Origins/Gameplay/Sonic 2/Enable Random Monitors (experimental).hmm new file mode 100644 index 00000000..a54120a9 --- /dev/null +++ b/Source/Sonic Origins/Gameplay/Sonic 2/Enable Random Monitors (experimental).hmm @@ -0,0 +1,22 @@ +Code "Enable Random Monitors (experimental)" in "Gameplay/Sonic 2" by "MegAmi" does +/* +Replaces all monitors in the stages with random monitors. + +Known issues; +- The random monitors will not appear upon initial stage load when starting the game from the main menu. This is fixed upon loading the stage again or loading a different one. +- Progress in save files will not be saved. +*/ +// + #lib "RSDK" +// +{ + // Check if this is Sonic 2 + if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0xC8) != 0xFF) + { + // Check if random monitors (second bit of options.shieldType) are disabled + if ((*(byte*)(RSDK.GetRSDKv4DataPtr() + 0x30) & 2) == 0) + { + *(byte*)(RSDK.GetRSDKv4DataPtr() + 0x30) |= 2; + } + } +} diff --git a/Source/Sonic Origins/Gameplay/Sonic 2/Enable Super Tails.hmm b/Source/Sonic Origins/Gameplay/Sonic 2/Enable Super Tails.hmm new file mode 100644 index 00000000..743e61d6 --- /dev/null +++ b/Source/Sonic Origins/Gameplay/Sonic 2/Enable Super Tails.hmm @@ -0,0 +1,21 @@ +Code "Enable Super Tails" in "Gameplay/Sonic 2" by "MegAmi" does +/* +Allows Tails to transform into Super Tails, like the other characters. + +Notes; +- Due to using the same palette colors as Tails, the Coins icon will flash along with Tails when in his Super form. +*/ +// + #lib "RSDK" +// +{ + // Check if this is Sonic 2 + if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0xC8) != 0xFF) + { + // Check if Super Tails (options.superTails) is disabled + if (*(byte*)(RSDK.GetRSDKv4DataPtr() + 0x40) != 0x01) + { + *(byte*)(RSDK.GetRSDKv4DataPtr() + 0x40) = 0x01; + } + } +}