Skip to content

Commit

Permalink
Some work on synchronizing for new version
Browse files Browse the repository at this point in the history
  • Loading branch information
jbzdarkid committed Nov 18, 2018
1 parent c10b73f commit 0d4ebf3
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Source/ChallengeRandomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,35 +52,35 @@ ChallengeRandomizer::ChallengeRandomizer(const std::shared_ptr<Memory>& memory,
}
}
if (cut_random_edges == -1) {
int index = find(data, {0x8B, 0x80, 0xBC, 0x03, 0x00, 0x00, 0x89, 0x44, 0x24, 0x3C, 0x33, 0xC0});
int index = find(data, {0x89, 0x44, 0x24, 0x3C, 0x33, 0xC0, 0x85, 0xC0, 0x75, 0xFA});
if (index != -1) {
cut_random_edges = i + index - 0x1C;
cut_random_edges = i + index - 0x22;
AdjustRng(cut_random_edges + 0x5D);
}
}
if (get_empty_decoration_slot == -1) {
int index = find(data, {0x57, 0x48, 0x83, 0xEC, 0x20, 0x8B, 0xB9, 0x38, 0x04});
int index = find(data, {0x57, 0x48, 0x83, 0xEC, 0x20, 0x8B, 0xB9, 0x38, 0x04}); // TODO: Sync versions
if (index != -1) {
get_empty_decoration_slot = i + index - 0x5;
AdjustRng(get_empty_decoration_slot + 0x16);
}
}
if (get_empty_dot_spot == -1) {
int index = find(data, {0xF7, 0xF3, 0x85, 0xD2, 0x74, 0xEC});
int index = find(data, {0xF7, 0xF3, 0x85, 0xD2, 0x74, 0xEC}); // TODO: Sync versions
if (index != -1) {
get_empty_dot_spot = i + index - 0x2E;
AdjustRng(get_empty_dot_spot + 0x23);
}
}
if (add_exactly_this_many_bisection_dots == -1) {
int index = find(data, {0x48, 0x8B, 0xB4, 0x24, 0xB8, 0x00, 0x00, 0x00, 0x48, 0x8B, 0xBC, 0x24, 0xB0, 0x00, 0x00, 0x00});
int index = find(data, {0x48, 0x8B, 0xB4, 0x24, 0xB8, 0x00, 0x00, 0x00, 0x48, 0x8B, 0xBC, 0x24, 0xB0, 0x00, 0x00, 0x00}); // TODO: Sync versions
if (index != -1) {
add_exactly_this_many_bisection_dots = i + index - 0x20;
AdjustRng(add_exactly_this_many_bisection_dots + 0x1C);
}
}
if (make_a_shaper == -1) {
int index = find(data, {0xF7, 0xE3, 0xD1, 0xEA, 0x8D, 0x0C, 0x52});
int index = find(data, {0xF7, 0xE3, 0xD1, 0xEA, 0x8D, 0x0C, 0x52}); // TODO: Sync versions
if (index != -1) {
make_a_shaper = i + index - 0x19;
AdjustRng(make_a_shaper + 0x9);
Expand All @@ -89,7 +89,7 @@ ChallengeRandomizer::ChallengeRandomizer(const std::shared_ptr<Memory>& memory,
}
}
if (/*Entity_Machine_Panel::*/init_pattern_data_lotus == -1) {
int index = find(data, {0x40, 0x55, 0x56, 0x48, 0x8D, 0x6C, 0x24, 0xB1});
int index = find(data, {0x40, 0x55, 0x56, 0x48, 0x8D, 0x6C, 0x24, 0xB1}); // TODO: Sync versions
if (index != -1) {
init_pattern_data_lotus = i + index;
AdjustRng(init_pattern_data_lotus + 0x433);
Expand All @@ -102,7 +102,7 @@ ChallengeRandomizer::ChallengeRandomizer(const std::shared_ptr<Memory>& memory,
}
}
if (/*Entity_Record_Player::*/reroll_lotus_eater_stuff == -1) {
int index = find(data, {0xB8, 0xAB, 0xAA, 0xAA, 0xAA, 0x41, 0xC1, 0xE8});
int index = find(data, {0xB8, 0xAB, 0xAA, 0xAA, 0xAA, 0x41, 0xC1, 0xE8}); // TODO: Sync versions
if (index != -1) {
reroll_lotus_eater_stuff = i + index - 0x37;
AdjustRng(reroll_lotus_eater_stuff + 0x24);
Expand All @@ -111,25 +111,26 @@ ChallengeRandomizer::ChallengeRandomizer(const std::shared_ptr<Memory>& memory,
}
// These disable the random locations on timer panels, which would otherwise increment the RNG.
if (do_lotus_minutes == -1) {
int index = find(data, {0x0F, 0xBE, 0x6C, 0x08, 0xFF, 0x45});
int index = find(data, {0x0F, 0xBE, 0x6C, 0x08, 0xFF, 0x45}); // TODO: Sync versions
if (index != -1) {
do_lotus_minutes = i + index - 0x2B;
_memory->WriteData<byte>({do_lotus_minutes + 0x43B}, {0x31, 0xC0, 0x90, 0x90, 0x90}); // xor eax, eax ;RNG returns 0
_memory->WriteData<byte>({do_lotus_minutes + 0x5B3}, {0x31, 0xC0, 0x90, 0x90, 0x90}); // xor eax, eax ;RNG returns 0
}
}
if (do_lotus_eighths == -1) {
int index = find(data, {0x75, 0xF5, 0x0F, 0xBE, 0x44, 0x08, 0xFF});
int index = find(data, {0x75, 0xF5, 0x0F, 0xBE, 0x44, 0x08, 0xFF}); // TODO: Sync versions
if (index != -1) {
do_lotus_eighths = i + index - 0x39;
_memory->WriteData<byte>({do_lotus_eighths + 0x1E7}, {0x31, 0xC0, 0x90, 0x90, 0x90}); // xor eax, eax ;RNG returns 0
}
}
// This injection ensures that the seed is set every time the challenge is started.
if (do_success_side_effects == -1) {
int index = find(data, {0x85, 0xC0, 0x7E, 0x2C, 0x48, 0x6B, 0xC8, 0x34});
int index = find(data, {0xFF, 0xC8, 0x99, 0x2B, 0xC2, 0xD1, 0xF8, 0x8B, 0xD0});
if (index != -1) {
do_success_side_effects = i + index;
do_success_side_effects = i + index + 0x3E;
if (GLOBALS == 0x62A080) do_success_side_effects += 4; // There's an extra 4 opcodes in the new version
_memory->WriteData<byte>({do_success_side_effects}, {
0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00, // mov ecx, [] ;This is going to be the address of the custom RNG
0x67, 0xC7, 0x01, 0x00, 0x00, 0x00, 0x00, // mov dword ptr ds:[ecx], 0x0 ;This is going to be the seed value
Expand Down

0 comments on commit 0d4ebf3

Please sign in to comment.