refactor: Cleanup develhook logic

> refactor hooks::devel to work better with hooks::wmisc
> minor naming consistency changes
This commit is contained in:
[ ]
2025-12-17 00:00:40 +09:00
parent 7f63b77ab3
commit 56e8e7456b
6 changed files with 253 additions and 205 deletions
+24 -5
View File
@@ -55,7 +55,7 @@ MMRESULT __stdcall on_acmFormatSuggest(HANDLE had, LPWAVEFORMATEX pwfxSrc, LPWAV
}
return r;
}
void run(HINSTANCE hmodule)
void attach(HINSTANCE hmodule)
{
// Override acmFormatSuggest
HMODULE msacm = nullptr;
@@ -89,7 +89,7 @@ bool on_thum_exists_(void *titleUTF_getter, int32_t id, char flag)
return it->second;
}
void run(HINSTANCE hmodule)
void attach(HINSTANCE hmodule)
{
// Reverse lookup function head (PUSH RDI) for ThumExists() specific signature, quietly fail if invalid
intptr_t beg, match, TX_ThumExists;
@@ -107,18 +107,37 @@ void run(HINSTANCE hmodule)
namespace hooks::wmisc
{
static bool patchmodel_ = true;
void skip_patching_by_model(bool val)
{
patchmodel_ = !val;
}
void apply_performance_hacks(HINSTANCE hmodule, const char *model, const char *ext)
{
if (!patchmodel_ && strcmp(model, "FORCE") != 0) return;
log_info("hooks::wmisc", "Enabling performance patches for {}-{}", model, ext);
switch (to_hash(model))
{
case to_hash("LDJ"):
thumbnail::run(hmodule);
msacm::run(hmodule);
thumbnail::attach(hmodule);
msacm::attach(hmodule);
break;
case to_hash("FORCE"):
switch (to_hash(ext))
{
case to_hash("thumbnail"):
thumbnail::attach(hmodule);
break;
case to_hash("msacm"):
msacm::attach(hmodule);
break;
default:
break;
}
break;
default:
break;
}
}
}