feat: Test spicetools logging bmsound-wine side

> broken commit
> route bmsound messages back to spicetools log
This commit is contained in:
[ ]
2025-12-20 21:23:22 +09:00
parent 56e8e7456b
commit ea5d566218
3 changed files with 40 additions and 1 deletions
+1
View File
@@ -44,6 +44,7 @@ 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");
+38
View File
@@ -105,6 +105,41 @@ 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)
{
switch (level)
{
case 'I':
log_info(scope, "{}", fmt);
break;
case 'W':
log_warning(scope, "{}", fmt);
break;
case 'E':
log_fatal(scope, "{}", fmt);
break;
case 'M':
default:
log_misc(scope, "{}", fmt);
break;
}
}
void attach(HINSTANCE hmodule)
{
BmswLoggerInit_t BmswLoggerInit;
HMODULE bmsw;
if ((bmsw = libutils::try_library(MODULE_PATH / "bmsound-wine.dll")))
{
BmswLoggerInit = (BmswLoggerInit_t) GetProcAddress(bmsw, "BmswLoggerInit");
BmswLoggerInit(reinterpret_cast<void*>(log_printf));
}
}
}
namespace hooks::wmisc namespace hooks::wmisc
{ {
static bool patchmodel_ = true; static bool patchmodel_ = true;
@@ -132,6 +167,9 @@ void apply_performance_hacks(HINSTANCE hmodule, const char *model, const char *e
case to_hash("msacm"): case to_hash("msacm"):
msacm::attach(hmodule); msacm::attach(hmodule);
break; break;
case to_hash("bmsound"):
bmsound::attach(hmodule);
break;
default: default:
break; break;
} }