summary refs log tree commit diff stats
path: root/Source/ChallengeRandomizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/ChallengeRandomizer.cpp')
-rw-r--r--Source/ChallengeRandomizer.cpp18
1 files changed, 1 insertions, 17 deletions
diff --git a/Source/ChallengeRandomizer.cpp b/Source/ChallengeRandomizer.cpp index fa9a234..de08885 100644 --- a/Source/ChallengeRandomizer.cpp +++ b/Source/ChallengeRandomizer.cpp
@@ -1,7 +1,7 @@
1#include "ChallengeRandomizer.h" 1#include "ChallengeRandomizer.h"
2#include <iostream> 2#include <iostream>
3 3
4// Reads the (relative!) address of the RNG, then shifts it to point at RNG2 4// Modify an opcode to use RNG2 instead of main RNG
5void ChallengeRandomizer::AdjustRng(int offset) { 5void ChallengeRandomizer::AdjustRng(int offset) {
6 int currentRng = _memory->ReadData<int>({offset}, 0x1)[0]; 6 int currentRng = _memory->ReadData<int>({offset}, 0x1)[0];
7 _memory->WriteData<int>({offset}, {currentRng + 0x20}); 7 _memory->WriteData<int>({offset}, {currentRng + 0x20});
@@ -39,22 +39,6 @@ ChallengeRandomizer::ChallengeRandomizer(const std::shared_ptr<Memory>& memory,
39 }); 39 });
40 40
41 if (!alreadyInjected) { 41 if (!alreadyInjected) {
42 // reveal_exit_hall
43 _memory->AddSigScan({0x45, 0x8B, 0xF7, 0x48, 0x8B, 0x4D}, [&](int index){
44 _memory->WriteData<byte>({index + 0x15}, {0xEB});
45 });
46
47 // begin_endgame_1
48 _memory->AddSigScan({0x83, 0x7C, 0x01, 0xD0, 0x04}, [&](int index){
49 if (GLOBALS == 0x5B28C0) { // Version differences.
50 index += 0x75;
51 } else if (GLOBALS == 0x62D0A0) {
52 index += 0x86;
53 }
54 // Overwriting a 74 12 opcode
55 _memory->WriteData<byte>({index}, {0xEB});
56 });
57
58 // shuffle_integers 42 // shuffle_integers
59 _memory->AddSigScan({0x48, 0x89, 0x5C, 0x24, 0x10, 0x56, 0x48, 0x83, 0xEC, 0x20, 0x48, 0x63, 0xDA, 0x48, 0x8B, 0xF1, 0x83, 0xFB, 0x01}, [&](int index) { 43 _memory->AddSigScan({0x48, 0x89, 0x5C, 0x24, 0x10, 0x56, 0x48, 0x83, 0xEC, 0x20, 0x48, 0x63, 0xDA, 0x48, 0x8B, 0xF1, 0x83, 0xFB, 0x01}, [&](int index) {
60 AdjustRng(index + 0x23); 44 AdjustRng(index + 0x23);