refactor: Enable spicetools logging for bmsound-wine by default

> optional bmsound-wine API until v0.3.0
This commit is contained in:
[ ]
2025-12-21 09:05:47 +09:00
parent ea5d566218
commit aa9ea9204b
2 changed files with 13 additions and 11 deletions
-1
View File
@@ -44,7 +44,6 @@ public:
{ {
log_warning("hooks::devel::wmisc", "Disabling auto-patching.."); log_warning("hooks::devel::wmisc", "Disabling auto-patching..");
hooks::wmisc::skip_patching_by_model(true); hooks::wmisc::skip_patching_by_model(true);
hooks::wmisc::apply_performance_hacks(avs::game::DLL_INSTANCE, "FORCE", "bmsound");
} }
} wmisc_("wmisc_test"); } wmisc_("wmisc_test");
+13 -10
View File
@@ -107,35 +107,37 @@ void attach(HINSTANCE hmodule)
namespace hooks::wmisc::bmsound namespace hooks::wmisc::bmsound
{ {
typedef void (*BmswLoggerInit_t)(void *cb); typedef void (*BmswLogInit_t)(void *cb);
extern "C" void __cdecl log_printf(char level, const char *scope, const char *fmt) extern "C" void __cdecl on_log_msg(char level, const char *scope, const char *msg)
{ {
switch (level) switch (level)
{ {
case 'I': case 'I':
log_info(scope, "{}", fmt); log_info(scope, "{}", msg);
break; break;
case 'W': case 'W':
log_warning(scope, "{}", fmt); log_warning(scope, "{}", msg);
break; break;
case 'E': case 'E':
log_fatal(scope, "{}", fmt); log_fatal(scope, "{}", msg);
break; break;
case 'M': case 'M':
default: default:
log_misc(scope, "{}", fmt); log_misc(scope, "{}", msg);
break; break;
} }
} }
void attach(HINSTANCE hmodule) void attach(HINSTANCE hmodule)
{ {
BmswLogInit_t BmswLogInit;
BmswLoggerInit_t BmswLoggerInit;
HMODULE bmsw; HMODULE bmsw;
if ((bmsw = libutils::try_library(MODULE_PATH / "bmsound-wine.dll"))) if ((bmsw = libutils::try_library(MODULE_PATH / "bmsound-wine.dll")))
{ {
BmswLoggerInit = (BmswLoggerInit_t) GetProcAddress(bmsw, "BmswLoggerInit"); BmswLogInit = (BmswLogInit_t) GetProcAddress(bmsw, "BmswLogInit");
BmswLoggerInit(reinterpret_cast<void*>(log_printf)); }
if(BmswLogInit) //_REM: keep 0.2.x backward compatibility until 0.3.0
{
BmswLogInit(reinterpret_cast<void*>(on_log_msg));
} }
} }
} }
@@ -157,6 +159,7 @@ void apply_performance_hacks(HINSTANCE hmodule, const char *model, const char *e
case to_hash("LDJ"): case to_hash("LDJ"):
thumbnail::attach(hmodule); thumbnail::attach(hmodule);
msacm::attach(hmodule); msacm::attach(hmodule);
bmsound::attach(hmodule);
break; break;
case to_hash("FORCE"): case to_hash("FORCE"):
switch (to_hash(ext)) switch (to_hash(ext))