refactor: Enable spicetools logging for bmsound-wine by default
> optional bmsound-wine API until v0.3.0
This commit is contained in:
+13
-10
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user