about summary refs log tree commit diff stats
path: root/Source/ChallengeRandomizer.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-11-18 14:56:10 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2018-11-18 14:56:10 -0800
commit0d4ebf34bfb93dbb215f49e9ca64b58fd7284a2b (patch)
treed310f50714b5e013684430e040e5dc4b22ff753a /Source/ChallengeRandomizer.cpp
parentc10b73f30280e5dd758b77e2ef8e5a622ff3c876 (diff)
downloadwitness-tutorializer-0d4ebf34bfb93dbb215f49e9ca64b58fd7284a2b.tar.gz
witness-tutorializer-0d4ebf34bfb93dbb215f49e9ca64b58fd7284a2b.tar.bz2
witness-tutorializer-0d4ebf34bfb93dbb215f49e9ca64b58fd7284a2b.zip
Some work on synchronizing for new version
Diffstat (limited to 'Source/ChallengeRandomizer.cpp')
-rw-r--r--Source/ChallengeRandomizer.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/Source/ChallengeRandomizer.cpp b/Source/ChallengeRandomizer.cpp index b9b54e0..0bc51f6 100644 --- a/Source/ChallengeRandomizer.cpp +++ b/Source/ChallengeRandomizer.cpp
@@ -52,35 +52,35 @@ ChallengeRandomizer::ChallengeRandomizer(const std::shared_ptr<Memory>& memory,
52 } 52 }
53 } 53 }
54 if (cut_random_edges == -1) { 54 if (cut_random_edges == -1) {
55 int index = find(data, {0x8B, 0x80, 0xBC, 0x03, 0x00, 0x00, 0x89, 0x44, 0x24, 0x3C, 0x33, 0xC0}); 55 int index = find(data, {0x89, 0x44, 0x24, 0x3C, 0x33, 0xC0, 0x85, 0xC0, 0x75, 0xFA});
56 if (index != -1) { 56 if (index != -1) {
57 cut_random_edges = i + index - 0x1C; 57 cut_random_edges = i + index - 0x22;
58 AdjustRng(cut_random_edges + 0x5D); 58 AdjustRng(cut_random_edges + 0x5D);
59 } 59 }
60 } 60 }
61 if (get_empty_decoration_slot == -1) { 61 if (get_empty_decoration_slot == -1) {
62 int index = find(data, {0x57, 0x48, 0x83, 0xEC, 0x20, 0x8B, 0xB9, 0x38, 0x04}); 62 int index = find(data, {0x57, 0x48, 0x83, 0xEC, 0x20, 0x8B, 0xB9, 0x38, 0x04}); // TODO: Sync versions
63 if (index != -1) { 63 if (index != -1) {
64 get_empty_decoration_slot = i + index - 0x5; 64 get_empty_decoration_slot = i + index - 0x5;
65 AdjustRng(get_empty_decoration_slot + 0x16); 65 AdjustRng(get_empty_decoration_slot + 0x16);
66 } 66 }
67 } 67 }
68 if (get_empty_dot_spot == -1) { 68 if (get_empty_dot_spot == -1) {
69 int index = find(data, {0xF7, 0xF3, 0x85, 0xD2, 0x74, 0xEC}); 69 int index = find(data, {0xF7, 0xF3, 0x85, 0xD2, 0x74, 0xEC}); // TODO: Sync versions
70 if (index != -1) { 70 if (index != -1) {
71 get_empty_dot_spot = i + index - 0x2E; 71 get_empty_dot_spot = i + index - 0x2E;
72 AdjustRng(get_empty_dot_spot + 0x23); 72 AdjustRng(get_empty_dot_spot + 0x23);
73 } 73 }
74 } 74 }
75 if (add_exactly_this_many_bisection_dots == -1) { 75 if (add_exactly_this_many_bisection_dots == -1) {
76 int index = find(data, {0x48, 0x8B, 0xB4, 0x24, 0xB8, 0x00, 0x00, 0x00, 0x48, 0x8B, 0xBC, 0x24, 0xB0, 0x00, 0x00, 0x00}); 76 int index = find(data, {0x48, 0x8B, 0xB4, 0x24, 0xB8, 0x00, 0x00, 0x00, 0x48, 0x8B, 0xBC, 0x24, 0xB0, 0x00, 0x00, 0x00}); // TODO: Sync versions
77 if (index != -1) { 77 if (index != -1) {
78 add_exactly_this_many_bisection_dots = i + index - 0x20; 78 add_exactly_this_many_bisection_dots = i + index - 0x20;
79 AdjustRng(add_exactly_this_many_bisection_dots + 0x1C); 79 AdjustRng(add_exactly_this_many_bisection_dots + 0x1C);
80 } 80 }
81 } 81 }
82 if (make_a_shaper == -1) { 82 if (make_a_shaper == -1) {
83 int index = find(data, {0xF7, 0xE3, 0xD1, 0xEA, 0x8D, 0x0C, 0x52}); 83 int index = find(data, {0xF7, 0xE3, 0xD1, 0xEA, 0x8D, 0x0C, 0x52}); // TODO: Sync versions
84 if (index != -1) { 84 if (index != -1) {
85 make_a_shaper = i + index - 0x19; 85 make_a_shaper = i + index - 0x19;
86 AdjustRng(make_a_shaper + 0x9); 86 AdjustRng(make_a_shaper + 0x9);
@@ -89,7 +89,7 @@ ChallengeRandomizer::ChallengeRandomizer(const std::shared_ptr<Memory>& memory,
89 } 89 }
90 } 90 }
91 if (/*Entity_Machine_Panel::*/init_pattern_data_lotus == -1) { 91 if (/*Entity_Machine_Panel::*/init_pattern_data_lotus == -1) {
92 int index = find(data, {0x40, 0x55, 0x56, 0x48, 0x8D, 0x6C, 0x24, 0xB1}); 92 int index = find(data, {0x40, 0x55, 0x56, 0x48, 0x8D, 0x6C, 0x24, 0xB1}); // TODO: Sync versions
93 if (index != -1) { 93 if (index != -1) {
94 init_pattern_data_lotus = i + index; 94 init_pattern_data_lotus = i + index;
95 AdjustRng(init_pattern_data_lotus + 0x433); 95 AdjustRng(init_pattern_data_lotus + 0x433);
@@ -102,7 +102,7 @@ ChallengeRandomizer::ChallengeRandomizer(const std::shared_ptr<Memory>& memory,
102 } 102 }
103 } 103 }
104 if (/*Entity_Record_Player::*/reroll_lotus_eater_stuff == -1) { 104 if (/*Entity_Record_Player::*/reroll_lotus_eater_stuff == -1) {
105 int index = find(data, {0xB8, 0xAB, 0xAA, 0xAA, 0xAA, 0x41, 0xC1, 0xE8}); 105 int index = find(data, {0xB8, 0xAB, 0xAA, 0xAA, 0xAA, 0x41, 0xC1, 0xE8}); // TODO: Sync versions
106 if (index != -1) { 106 if (index != -1) {
107 reroll_lotus_eater_stuff = i + index - 0x37; 107 reroll_lotus_eater_stuff = i + index - 0x37;
108 AdjustRng(reroll_lotus_eater_stuff + 0x24); 108 AdjustRng(reroll_lotus_eater_stuff + 0x24);
@@ -111,7 +111,7 @@ ChallengeRandomizer::ChallengeRandomizer(const std::shared_ptr<Memory>& memory,
111 } 111 }
112 // These disable the random locations on timer panels, which would otherwise increment the RNG. 112 // These disable the random locations on timer panels, which would otherwise increment the RNG.
113 if (do_lotus_minutes == -1) { 113 if (do_lotus_minutes == -1) {
114 int index = find(data, {0x0F, 0xBE, 0x6C, 0x08, 0xFF, 0x45}); 114 int index = find(data, {0x0F, 0xBE, 0x6C, 0x08, 0xFF, 0x45}); // TODO: Sync versions
115 if (index != -1) { 115 if (index != -1) {
116 do_lotus_minutes = i + index - 0x2B; 116 do_lotus_minutes = i + index - 0x2B;
117 _memory->WriteData<byte>({do_lotus_minutes + 0x43B}, {0x31, 0xC0, 0x90, 0x90, 0x90}); // xor eax, eax ;RNG returns 0 117 _memory->WriteData<byte>({do_lotus_minutes + 0x43B}, {0x31, 0xC0, 0x90, 0x90, 0x90}); // xor eax, eax ;RNG returns 0
@@ -119,7 +119,7 @@ ChallengeRandomizer::ChallengeRandomizer(const std::shared_ptr<Memory>& memory,
119 } 119 }
120 } 120 }
121 if (do_lotus_eighths == -1) { 121 if (do_lotus_eighths == -1) {
122 int index = find(data, {0x75, 0xF5, 0x0F, 0xBE, 0x44, 0x08, 0xFF}); 122 int index = find(data, {0x75, 0xF5, 0x0F, 0xBE, 0x44, 0x08, 0xFF}); // TODO: Sync versions
123 if (index != -1) { 123 if (index != -1) {
124 do_lotus_eighths = i + index - 0x39; 124 do_lotus_eighths = i + index - 0x39;
125 _memory->WriteData<byte>({do_lotus_eighths + 0x1E7}, {0x31, 0xC0, 0x90, 0x90, 0x90}); // xor eax, eax ;RNG returns 0 125 _memory->WriteData<byte>({do_lotus_eighths + 0x1E7}, {0x31, 0xC0, 0x90, 0x90, 0x90}); // xor eax, eax ;RNG returns 0
@@ -127,9 +127,10 @@ ChallengeRandomizer::ChallengeRandomizer(const std::shared_ptr<Memory>& memory,
127 } 127 }
128 // This injection ensures that the seed is set every time the challenge is started. 128 // This injection ensures that the seed is set every time the challenge is started.
129 if (do_success_side_effects == -1) { 129 if (do_success_side_effects == -1) {
130 int index = find(data, {0x85, 0xC0, 0x7E, 0x2C, 0x48, 0x6B, 0xC8, 0x34}); 130 int index = find(data, {0xFF, 0xC8, 0x99, 0x2B, 0xC2, 0xD1, 0xF8, 0x8B, 0xD0});
131 if (index != -1) { 131 if (index != -1) {
132 do_success_side_effects = i + index; 132 do_success_side_effects = i + index + 0x3E;
133 if (GLOBALS == 0x62A080) do_success_side_effects += 4; // There's an extra 4 opcodes in the new version
133 _memory->WriteData<byte>({do_success_side_effects}, { 134 _memory->WriteData<byte>({do_success_side_effects}, {
134 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00, // mov ecx, [] ;This is going to be the address of the custom RNG 135 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00, // mov ecx, [] ;This is going to be the address of the custom RNG
135 0x67, 0xC7, 0x01, 0x00, 0x00, 0x00, 0x00, // mov dword ptr ds:[ecx], 0x0 ;This is going to be the seed value 136 0x67, 0xC7, 0x01, 0x00, 0x00, 0x00, 0x00, // mov dword ptr ds:[ecx], 0x0 ;This is going to be the seed value