Pass Brutal Peeps HP patch config in suffix
This commit is contained in:
+8
-9
@@ -854,9 +854,6 @@ static std::shared_ptr<AsyncPromise<C_ExecuteCodeResult_B3>> send_brutal_peeps_h
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string suffix;
|
|
||||||
suffix.append(vanilla_data, signature_size);
|
|
||||||
|
|
||||||
auto append_u32l = +[](std::string& out, uint32_t v) {
|
auto append_u32l = +[](std::string& out, uint32_t v) {
|
||||||
out.push_back(static_cast<char>(v & 0xFF));
|
out.push_back(static_cast<char>(v & 0xFF));
|
||||||
out.push_back(static_cast<char>((v >> 8) & 0xFF));
|
out.push_back(static_cast<char>((v >> 8) & 0xFF));
|
||||||
@@ -864,6 +861,13 @@ static std::shared_ptr<AsyncPromise<C_ExecuteCodeResult_B3>> send_brutal_peeps_h
|
|||||||
out.push_back(static_cast<char>((v >> 24) & 0xFF));
|
out.push_back(static_cast<char>((v >> 24) & 0xFF));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string suffix;
|
||||||
|
append_u32l(suffix, scan_start);
|
||||||
|
append_u32l(suffix, scan_end);
|
||||||
|
append_u32l(suffix, signature_size);
|
||||||
|
append_u32l(suffix, hp_patch_bytes);
|
||||||
|
suffix.append(vanilla_data, signature_size);
|
||||||
|
|
||||||
for (size_t z = 0; z < 0x60; z++) {
|
for (size_t z = 0; z < 0x60; z++) {
|
||||||
const auto& hp = table->stats[ultimate_index][z].char_stats.hp;
|
const auto& hp = table->stats[ultimate_index][z].char_stats.hp;
|
||||||
uint32_t hp_offset = reinterpret_cast<const char*>(&hp) - target_data.data();
|
uint32_t hp_offset = reinterpret_cast<const char*>(&hp) - target_data.data();
|
||||||
@@ -885,12 +889,7 @@ static std::shared_ptr<AsyncPromise<C_ExecuteCodeResult_B3>> send_brutal_peeps_h
|
|||||||
c->channel,
|
c->channel,
|
||||||
c->enabled_flags,
|
c->enabled_flags,
|
||||||
fn,
|
fn,
|
||||||
{
|
{},
|
||||||
{"scan_start", scan_start},
|
|
||||||
{"scan_end", scan_end},
|
|
||||||
{"signature_size", signature_size},
|
|
||||||
{"patch_count", hp_patch_bytes},
|
|
||||||
},
|
|
||||||
suffix.data(),
|
suffix.data(),
|
||||||
suffix.size());
|
suffix.size());
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ start:
|
|||||||
jmp get_data_ptr
|
jmp get_data_ptr
|
||||||
|
|
||||||
get_data_ptr_ret:
|
get_data_ptr_ret:
|
||||||
pop ebx
|
pop ebx # ebx = suffix payload
|
||||||
|
|
||||||
mov esi, [ebx + scan_start - data] # candidate ptr
|
mov esi, [ebx] # scan_start
|
||||||
mov edx, [ebx + scan_end - data] # scan end
|
mov edx, [ebx + 4] # scan_end
|
||||||
mov ecx, [ebx + signature_size - data] # signature size
|
mov ecx, [ebx + 8] # signature_size
|
||||||
sub edx, ecx # scan limit = end - sig_size
|
sub edx, ecx # scan limit = end - sig_size
|
||||||
lea edi, [ebx + payload - data] # signature ptr
|
lea edi, [ebx + 16] # signature ptr
|
||||||
|
|
||||||
scan_again:
|
scan_again:
|
||||||
cmp esi, edx
|
cmp esi, edx
|
||||||
@@ -49,16 +49,17 @@ next_candidate:
|
|||||||
|
|
||||||
found_table:
|
found_table:
|
||||||
# esi = BattleParamEntry_on.dat base
|
# esi = BattleParamEntry_on.dat base
|
||||||
mov ecx, [ebx + patch_count - data]
|
mov ecx, [ebx + 12] # patch entry count
|
||||||
mov edi, [ebx + signature_size - data]
|
mov edi, [ebx + 8] # signature_size
|
||||||
lea edi, [ebx + payload - data + edi] # patch entry ptr after signature
|
add edi, ebx
|
||||||
|
add edi, 16 # patch entries after header+signature
|
||||||
|
|
||||||
patch_again:
|
patch_again:
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz done
|
jz done
|
||||||
|
|
||||||
mov edx, [edi] # offset from table base
|
mov edx, [edi] # offset from table base
|
||||||
mov al, [edi + 4] # byte value
|
mov al, [edi + 4] # byte value
|
||||||
mov [esi + edx], al
|
mov [esi + edx], al
|
||||||
|
|
||||||
add edi, 5
|
add edi, 5
|
||||||
@@ -66,7 +67,7 @@ patch_again:
|
|||||||
jmp patch_again
|
jmp patch_again
|
||||||
|
|
||||||
done:
|
done:
|
||||||
mov eax, esi # return found table base
|
mov eax, esi # return found table base
|
||||||
jmp return
|
jmp return
|
||||||
|
|
||||||
not_found:
|
not_found:
|
||||||
@@ -82,18 +83,12 @@ return:
|
|||||||
get_data_ptr:
|
get_data_ptr:
|
||||||
call get_data_ptr_ret
|
call get_data_ptr_ret
|
||||||
|
|
||||||
data:
|
# Server suffix starts here:
|
||||||
scan_start:
|
# uint32_t scan_start
|
||||||
.data 0
|
# uint32_t scan_end
|
||||||
scan_end:
|
# uint32_t signature_size
|
||||||
.data 0
|
# uint32_t patch_entry_count
|
||||||
signature_size:
|
# signature bytes
|
||||||
.data 0
|
# repeated patch entries:
|
||||||
patch_count:
|
# uint32_t offset
|
||||||
.data 0
|
# uint8_t value
|
||||||
payload:
|
|
||||||
# Server suffix:
|
|
||||||
# signature bytes
|
|
||||||
# repeated patch entries:
|
|
||||||
# uint32_t offset
|
|
||||||
# uint8_t value
|
|
||||||
|
|||||||
Reference in New Issue
Block a user