From aa9ea9204b60f6824f6e7606b95caf66d5003b17 Mon Sep 17 00:00:00 2001 From: "[ ]" <[ ]> Date: Sun, 21 Dec 2025 09:05:47 +0900 Subject: [PATCH] refactor: Enable spicetools logging for bmsound-wine by default > optional bmsound-wine API until v0.3.0 --- hooks/develhook.cpp | 1 - hooks/wmischook.cpp | 23 +++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hooks/develhook.cpp b/hooks/develhook.cpp index 34f348d..33c3488 100644 --- a/hooks/develhook.cpp +++ b/hooks/develhook.cpp @@ -44,7 +44,6 @@ public: { log_warning("hooks::devel::wmisc", "Disabling auto-patching.."); hooks::wmisc::skip_patching_by_model(true); - hooks::wmisc::apply_performance_hacks(avs::game::DLL_INSTANCE, "FORCE", "bmsound"); } } wmisc_("wmisc_test"); diff --git a/hooks/wmischook.cpp b/hooks/wmischook.cpp index 62912bb..c491cc2 100644 --- a/hooks/wmischook.cpp +++ b/hooks/wmischook.cpp @@ -107,35 +107,37 @@ void attach(HINSTANCE hmodule) namespace hooks::wmisc::bmsound { -typedef void (*BmswLoggerInit_t)(void *cb); -extern "C" void __cdecl log_printf(char level, const char *scope, const char *fmt) +typedef void (*BmswLogInit_t)(void *cb); +extern "C" void __cdecl on_log_msg(char level, const char *scope, const char *msg) { switch (level) { case 'I': - log_info(scope, "{}", fmt); + log_info(scope, "{}", msg); break; case 'W': - log_warning(scope, "{}", fmt); + log_warning(scope, "{}", msg); break; case 'E': - log_fatal(scope, "{}", fmt); + log_fatal(scope, "{}", msg); break; case 'M': default: - log_misc(scope, "{}", fmt); + log_misc(scope, "{}", msg); break; } } void attach(HINSTANCE hmodule) { - - BmswLoggerInit_t BmswLoggerInit; + BmswLogInit_t BmswLogInit; HMODULE bmsw; if ((bmsw = libutils::try_library(MODULE_PATH / "bmsound-wine.dll"))) { - BmswLoggerInit = (BmswLoggerInit_t) GetProcAddress(bmsw, "BmswLoggerInit"); - BmswLoggerInit(reinterpret_cast(log_printf)); + BmswLogInit = (BmswLogInit_t) GetProcAddress(bmsw, "BmswLogInit"); + } + if(BmswLogInit) //_REM: keep 0.2.x backward compatibility until 0.3.0 + { + BmswLogInit(reinterpret_cast(on_log_msg)); } } } @@ -157,6 +159,7 @@ void apply_performance_hacks(HINSTANCE hmodule, const char *model, const char *e case to_hash("LDJ"): thumbnail::attach(hmodule); msacm::attach(hmodule); + bmsound::attach(hmodule); break; case to_hash("FORCE"): switch (to_hash(ext))