refactor/feat: Further signature scan changes
> funcionality cleanup, API compatibility should be the same > improve patching performance by skipping vector copy (replaced with span) > chain call wrapper (fixes soudbank hook breaking 32-bit styles)
This commit is contained in:
+5
-2
@@ -927,8 +927,11 @@ void init(HINSTANCE hmodule, const char *model, const char *ext)
|
||||
}
|
||||
|
||||
// Override .text (pattern match)
|
||||
offset_.TX_EnumValidSoundbanks = find_pattern_from(hmodule, "CCCCCCCCCCCCCCCC", "XXXXXXXX", 8, 0,
|
||||
find_asm_leacstr_from(hmodule, R8, "%05d/%05d.2dx") - reinterpret_cast<intptr_t>(hmodule), true);
|
||||
offset_.TX_EnumValidSoundbanks = patch_pipeline(
|
||||
hmodule,
|
||||
[](HMODULE hmodule, intptr_t addr) { return find_asm_leacstr_from(hmodule, R8, "%05d/%05d.2dx"); },
|
||||
[](HMODULE hmodule, intptr_t addr) { return find_pattern_from(hmodule, "CCCCCCCCCCCCCCCC", "XXXXXXXX", 8, 0, addr, true); }
|
||||
);
|
||||
snd_bank::resampler_ = avcodec::BmswTranscoderResampler() == avcodec::bmswac_resampler_none ? snd_bank::resampler_ : avcodec::BmswTranscoderResampler();
|
||||
offset_.TX_EnumValidSoundbanks = avcodec::BmswTranscoderEnumValidSoundbanksAddr() == 0x0 ? offset_.TX_EnumValidSoundbanks : (intptr_t) hmodule + (int64_t) avcodec::BmswTranscoderEnumValidSoundbanksAddr();
|
||||
if (!offset_.TX_EnumValidSoundbanks)
|
||||
|
||||
+5
-2
@@ -92,8 +92,11 @@ bool on_thum_exists_(void *titleUTF_getter, int32_t id, char flag)
|
||||
void attach(HINSTANCE hmodule)
|
||||
{
|
||||
// Reverse lookup function head (PUSH RDI) for ThumExists() specific signature, quietly fail if invalid
|
||||
intptr_t TX_ThumExists = find_pattern_from(hmodule, "4057", "XX", 0, 0,
|
||||
find_pattern_from(hmodule, "83f801750c4084ff750732c0", "XXXXXXXXXXXX", 0, 0, 0) - reinterpret_cast<intptr_t>(hmodule), true);
|
||||
intptr_t TX_ThumExists = patch_pipeline(
|
||||
hmodule,
|
||||
[](HMODULE hmodule, intptr_t addr) { return find_pattern_from(hmodule, "83f801750c4084ff750732c0", "XXXXXXXXXXXX", 0, 0, 0); },
|
||||
[](HMODULE hmodule, intptr_t addr) { return find_pattern_from(hmodule, "4057", "XX", 0, 0, addr, true); }
|
||||
);
|
||||
log_info("hooks::wmisc::thumbnail", "Hooking ThumExists({})", reinterpret_cast<void *>(TX_ThumExists));
|
||||
detour::trampoline_try(reinterpret_cast<void *>(TX_ThumExists), reinterpret_cast<void *>(on_thum_exists_), reinterpret_cast<void **>(&ThumExists));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user