feat: Test spicetools logging bmsound-wine side
> broken commit > route bmsound messages back to spicetools log
This commit is contained in:
@@ -44,6 +44,7 @@ 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");
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
static bool patchmodel_ = true;
|
||||
@@ -132,6 +167,9 @@ void apply_performance_hacks(HINSTANCE hmodule, const char *model, const char *e
|
||||
case to_hash("msacm"):
|
||||
msacm::attach(hmodule);
|
||||
break;
|
||||
case to_hash("bmsound"):
|
||||
bmsound::attach(hmodule);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user