refactor/fix: Resolve some wmisc issues

> fix crashes around missing call convention/log hook
> enable wmisc for M39 as well, see #8
This commit is contained in:
[ ]
2026-01-11 21:11:55 +09:00
parent 26bc8fdda5
commit 244f4aa56a
4 changed files with 16 additions and 10 deletions
-8
View File
@@ -18,8 +18,6 @@
#endif #endif
#include "hooks/setupapihook.h" #include "hooks/setupapihook.h"
#include "hooks/sleephook.h" #include "hooks/sleephook.h"
#include "hooks/sndbhook.h"
#include "hooks/wmischook.h"
#include "launcher/options.h" #include "launcher/options.h"
#include "touch/touch.h" #include "touch/touch.h"
#include "misc/wintouchemu.h" #include "misc/wintouchemu.h"
@@ -408,10 +406,6 @@ namespace games::iidx {
// init cfgmgr32 hooks // init cfgmgr32 hooks
cfgmgr32hook_init(avs::game::DLL_INSTANCE); cfgmgr32hook_init(avs::game::DLL_INSTANCE);
// wine fixes
hooks::wmisc::apply_performance_hacks(avs::game::DLL_INSTANCE, avs::game::MODEL, avs::game::EXT);
hooks::soundbank::init(avs::game::DLL_INSTANCE, avs::game::MODEL, avs::game::EXT);
// report common errors on iidx31 and above // report common errors on iidx31 and above
if (avs::game::is_ext(2023091500, MAXINT) && GRAPHICS_9_ON_12_STATE == DX9ON12_FORCE_ON) { if (avs::game::is_ext(2023091500, MAXINT) && GRAPHICS_9_ON_12_STATE == DX9ON12_FORCE_ON) {
deferredlogs::defer_error_messages({ deferredlogs::defer_error_messages({
@@ -468,8 +462,6 @@ namespace games::iidx {
} }
void IIDXGame::detach() { void IIDXGame::detach() {
hooks::soundbank::deinit(avs::game::DLL_INSTANCE);
Game::detach(); Game::detach();
devicehook_dispose(); devicehook_dispose();
+1
View File
@@ -889,6 +889,7 @@ public:
} tests_("sndb_test"); } tests_("sndb_test");
void init(HINSTANCE hmodule, const char *model, const char *ext) void init(HINSTANCE hmodule, const char *model, const char *ext)
{ {
if (to_hash(model) != to_hash("LDJ")) return;
if (false && IsDebuggerPresent()) if (false && IsDebuggerPresent())
{ {
log_warning("hooks::soundbank", "Debugger detected, skipping.."); log_warning("hooks::soundbank", "Debugger detected, skipping..");
+6 -2
View File
@@ -9,7 +9,7 @@
namespace hooks::wmisc::msacm namespace hooks::wmisc::msacm
{ {
typedef MMRESULT (*acmFormatSuggest_t)(HANDLE had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest); typedef MMRESULT (__stdcall *acmFormatSuggest_t)(HANDLE had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest);
static acmFormatSuggest_t acmFormatSuggest; static acmFormatSuggest_t acmFormatSuggest;
static uint64_t hash_waveformatex(const WAVEFORMATEX *pwfx, DWORD fdwSuggest) static uint64_t hash_waveformatex(const WAVEFORMATEX *pwfx, DWORD fdwSuggest)
@@ -129,7 +129,7 @@ extern "C" void __cdecl on_log_msg(char level, const char *scope, const char *ms
} }
void attach(HINSTANCE hmodule) void attach(HINSTANCE hmodule)
{ {
BmswLogInit_t BmswLogInit; BmswLogInit_t BmswLogInit = nullptr;
HMODULE bmsw; HMODULE bmsw;
if ((bmsw = libutils::try_library(MODULE_PATH / "bmsound-wine.dll"))) if ((bmsw = libutils::try_library(MODULE_PATH / "bmsound-wine.dll")))
{ {
@@ -161,6 +161,10 @@ void apply_performance_hacks(HINSTANCE hmodule, const char *model, const char *e
msacm::attach(hmodule); msacm::attach(hmodule);
bmsound::attach(hmodule); bmsound::attach(hmodule);
break; break;
case to_hash("M39"):
msacm::attach(hmodule);
bmsound::attach(hmodule);
break;
case to_hash("FORCE"): case to_hash("FORCE"):
switch (to_hash(ext)) switch (to_hash(ext))
{ {
+9
View File
@@ -74,6 +74,8 @@
#include "hooks/lang.h" #include "hooks/lang.h"
#include "hooks/networkhook.h" #include "hooks/networkhook.h"
#include "hooks/unisintrhook.h" #include "hooks/unisintrhook.h"
#include "hooks/sndbhook.h"
#include "hooks/wmischook.h"
#include "launcher/launcher.h" #include "launcher/launcher.h"
#include "launcher/logger.h" #include "launcher/logger.h"
#include "launcher/signal.h" #include "launcher/signal.h"
@@ -2077,6 +2079,10 @@ int main_implementation(int argc, char *argv[]) {
game->attach(); game->attach();
} }
// wine fixes
hooks::wmisc::apply_performance_hacks(avs::game::DLL_INSTANCE, avs::game::MODEL, avs::game::EXT);
hooks::soundbank::init(avs::game::DLL_INSTANCE, avs::game::MODEL, avs::game::EXT);
#ifdef SPICE64 #ifdef SPICE64
if (!cfg::CONFIGURATOR_STANDALONE) { if (!cfg::CONFIGURATOR_STANDALONE) {
if (games::iidx::TDJ_CAMERA) { if (games::iidx::TDJ_CAMERA) {
@@ -2268,6 +2274,9 @@ int main_implementation(int argc, char *argv[]) {
// clear presence // clear presence
richpresence::shutdown(); richpresence::shutdown();
// cleanup wine fixes
hooks::soundbank::deinit(avs::game::DLL_INSTANCE);
// detach games // detach games
for (auto game : games) { for (auto game : games) {
game->detach(); game->detach();