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..");
hooks::wmisc::skip_patching_by_model(true);
hooks::wmisc::apply_performance_hacks(avs::game::DLL_INSTANCE, "FORCE", "bmsound");
}
} wmisc_("wmisc_test");
+13 -10
View File
@@ -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<void*>(log_printf));
BmswLogInit = (BmswLogInit_t) GetProcAddress(bmsw, "BmswLogInit");
}
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"):
thumbnail::attach(hmodule);
msacm::attach(hmodule);
bmsound::attach(hmodule);
break;
case to_hash("FORCE"):
switch (to_hash(ext))