refactor: Soundbank runtime hooking improvement
> change default behaviour to pattern based patch for hooks::soundbank, see #13 > fix broken check for hooks::soundbank unsupported game version
This commit is contained in:
+8
-34
@@ -901,7 +901,7 @@ void init(HINSTANCE hmodule, const char *model, const char *ext)
|
||||
return;
|
||||
}
|
||||
|
||||
// Override .text .data per datacode _REV: prefer runtime offset lookup based on universal asm pattern
|
||||
// Override .text .data per datacode (pattern match)
|
||||
long extl = strtol(ext, nullptr, 10);
|
||||
if (extl < 2019100800)
|
||||
{
|
||||
@@ -925,42 +925,16 @@ void init(HINSTANCE hmodule, const char *model, const char *ext)
|
||||
offset_.DAT_song_id = 0x67c;
|
||||
offset_.is_lstr_wchar = true;
|
||||
}
|
||||
switch (to_hash(ext))
|
||||
intptr_t beg, match;
|
||||
offset_.TX_EnumValidSoundbanks = beg = match = find_asm_leacstr_from(hmodule, R8, "%05d/%05d.2dx");
|
||||
while (beg > sizeof(void *) && match >= offset_.TX_EnumValidSoundbanks) //_REV: probably should be sigscan helper due to find_pattern_from performance, unify with wmischook
|
||||
{
|
||||
case to_hash("2018091900"):
|
||||
offset_.TX_EnumValidSoundbanks = (intptr_t) hmodule + 0x1170b0;
|
||||
break;
|
||||
case to_hash("2019090200"):
|
||||
case to_hash("2019100700"):
|
||||
offset_.TX_EnumValidSoundbanks = (intptr_t) hmodule + 0x37a540;
|
||||
break;
|
||||
case to_hash("2020092900"):
|
||||
offset_.TX_EnumValidSoundbanks = (intptr_t) hmodule + 0x5ac460;
|
||||
break;
|
||||
case to_hash("2021083000"):
|
||||
offset_.TX_EnumValidSoundbanks = (intptr_t) hmodule + 0x766bc0;
|
||||
break;
|
||||
case to_hash("2021091500"):
|
||||
offset_.TX_EnumValidSoundbanks = (intptr_t) hmodule + 0x766c60;
|
||||
break;
|
||||
case to_hash("2022082400"):
|
||||
offset_.TX_EnumValidSoundbanks = (intptr_t) hmodule + 0x46e160;
|
||||
break;
|
||||
case to_hash("2023090500"):
|
||||
offset_.TX_EnumValidSoundbanks = (intptr_t) hmodule + 0xafd780;
|
||||
break;
|
||||
case to_hash("2024082600"):
|
||||
offset_.TX_EnumValidSoundbanks = (intptr_t) hmodule + 0x8eae40;
|
||||
break;
|
||||
case to_hash("2025082500"):
|
||||
offset_.TX_EnumValidSoundbanks = (intptr_t) hmodule + 0x969fb0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
beg -= sizeof(void *);
|
||||
match = find_pattern_from(hmodule, "4057", "XX", 0, 0, beg - reinterpret_cast<intptr_t>(hmodule));
|
||||
}
|
||||
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 == (intptr_t) hmodule)
|
||||
offset_.TX_EnumValidSoundbanks = avcodec::BmswTranscoderEnumValidSoundbanksAddr() == 0x0 ? match : (intptr_t) hmodule + (int64_t) avcodec::BmswTranscoderEnumValidSoundbanksAddr();
|
||||
if (!offset_.TX_EnumValidSoundbanks)
|
||||
{
|
||||
log_warning("hooks::soundbank", "Unsupported game version({}), skipping..", ext);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user