feat: Crude SDVX 5 support
> disable lobby video (cause for crashes in lobby), see #9 > suppress dmoeffector log messages, see #9
This commit is contained in:
+58
-2
@@ -135,9 +135,49 @@ void attach(HINSTANCE hmodule)
|
||||
{
|
||||
BmswLogInit = (BmswLogInit_t) GetProcAddress(bmsw, "BmswLogInit");
|
||||
}
|
||||
if(BmswLogInit) //_REM: keep 0.2.x backward compatibility until 0.3.0
|
||||
if (BmswLogInit) //_REM: keep 0.2.x backward compatibility until 0.3.0
|
||||
{
|
||||
BmswLogInit(reinterpret_cast<void*>(on_log_msg));
|
||||
BmswLogInit(reinterpret_cast<void *>(on_log_msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace hooks::wmisc::cmovieplayer
|
||||
{
|
||||
typedef void (*GetWmvChunk_t)(uint8_t *unk);
|
||||
static GetWmvChunk_t GetWmvChunk_;
|
||||
|
||||
void on_get_wmv_chunk_(uint8_t *unk)
|
||||
{
|
||||
size_t chunksz = *(uint32_t *) (unk + 0x10);
|
||||
void *readbuf = (void *) *(intptr_t *) (unk + 0x08);
|
||||
int *readsz = (int *) (unk + 0x14);
|
||||
|
||||
//_REV: For now simply disable broken video stream
|
||||
*readsz = 0;
|
||||
}
|
||||
void attach(HINSTANCE hmodule)
|
||||
{
|
||||
// Remove crashing movie
|
||||
intptr_t TX_ThumExists = find_pattern_from(hmodule, "40534883ec20448b4110488bd9488b51088b09ff150000000089431485c0791d448bc0488d1500000000488d0d000000004883c4205b48ff25000000004883c4205bc3", "XXXXXXXXXXXXXXXXXXXXX????XXXXXXXXXXXXX????XXX????XXXXXXXX????XXXXXX", 0, 0, 0);
|
||||
log_info("hooks::wmisc::cmovieplayer", "Hooking GetWmvChunk({})", reinterpret_cast<void *>(TX_ThumExists));
|
||||
if (detour::trampoline_try(reinterpret_cast<void *>(TX_ThumExists), reinterpret_cast<void *>(on_get_wmv_chunk_), reinterpret_cast<void **>(&GetWmvChunk_)))
|
||||
{
|
||||
log_warning("hooks::wmisc::cmovieplayer", "Video playback for wmv won't work");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace hooks::wmisc::dmoeffector
|
||||
{
|
||||
void attach(HINSTANCE hmodule)
|
||||
{
|
||||
//_REM: Disable dmoeffector error printing for line55, could not find unique pattern (9 matches, but patching all of them is harmless)
|
||||
intptr_t next = (intptr_t) hmodule;
|
||||
while (next)
|
||||
{
|
||||
next = replace_pattern_from(hmodule, "793ae8????????895424??4c8d05????????488bc8488d15????????41b937000000e8????????ff15????????", "eb3ae8????????895424??4c8d05????????488bc8488d15????????41b937000000e8????????ff15????????", 0, 0, next - reinterpret_cast<intptr_t>(hmodule));
|
||||
if (next) log_info("hooks::wmisc::dmoeffector", "Muting error message({})", reinterpret_cast<void *>(next));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,6 +194,7 @@ void apply_performance_hacks(HINSTANCE hmodule, const char *model, const char *e
|
||||
if (!patchmodel_ && strcmp(model, "FORCE") != 0) return;
|
||||
|
||||
log_info("hooks::wmisc", "Enabling performance patches for {}-{}", model, ext);
|
||||
long extl = strtol(ext, nullptr, 10);
|
||||
switch (to_hash(model))
|
||||
{
|
||||
case to_hash("LDJ"):
|
||||
@@ -165,6 +206,15 @@ void apply_performance_hacks(HINSTANCE hmodule, const char *model, const char *e
|
||||
msacm::attach(hmodule);
|
||||
bmsound::attach(hmodule);
|
||||
break;
|
||||
case to_hash("KFC"):
|
||||
msacm::attach(hmodule);
|
||||
bmsound::attach(hmodule);
|
||||
if (extl > 2019020600 && extl < 2021011800) // SDVX5
|
||||
{
|
||||
cmovieplayer::attach(hmodule);
|
||||
dmoeffector::attach(hmodule);
|
||||
}
|
||||
break;
|
||||
case to_hash("FORCE"):
|
||||
switch (to_hash(ext))
|
||||
{
|
||||
@@ -177,6 +227,12 @@ void apply_performance_hacks(HINSTANCE hmodule, const char *model, const char *e
|
||||
case to_hash("bmsound"):
|
||||
bmsound::attach(hmodule);
|
||||
break;
|
||||
case to_hash("cmovieplayer"):
|
||||
cmovieplayer::attach(hmodule);
|
||||
break;
|
||||
case to_hash("dmoeffector"):
|
||||
dmoeffector::attach(hmodule);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user