From 88a5bdcd14bac85e8f151f1f98dee9a46ca71c94 Mon Sep 17 00:00:00 2001 From: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:57:37 +0200 Subject: [PATCH 1/2] kemono: only load I/O dll inside amdaemon --- kemonohook/config.c | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/kemonohook/config.c b/kemonohook/config.c index d1097be..3eb85c8 100644 --- a/kemonohook/config.c +++ b/kemonohook/config.c @@ -12,19 +12,44 @@ #include "platform/config.h" +// Check windows +#if _WIN32 || _WIN64 + #if _WIN64 + #define ENV64BIT + #else + #define ENV32BIT + #endif +#endif + +// Check GCC +#if __GNUC__ + #if __x86_64__ || __ppc64__ + #define ENV64BIT + #else + #define ENV32BIT + #endif +#endif + void kemono_dll_config_load( struct kemono_dll_config *cfg, const wchar_t *filename) { assert(cfg != NULL); assert(filename != NULL); - GetPrivateProfileStringW( - L"kemonoio", - L"path", - L"", - cfg->path, - _countof(cfg->path), - filename); + #if defined(ENV32BIT) + // Always empty, due to amdaemon being 64 bit in 32 bit mode + memset(cfg->path, 0, sizeof(cfg->path)); + #elif defined(ENV64BIT) + GetPrivateProfileStringW( + L"kemonoio", + L"path", + L"", + cfg->path, + _countof(cfg->path), + filename); + #else + #error "Unknown environment" + #endif } void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename) From 33452394e63397543214add35e5e0bb7d8d280a2 Mon Sep 17 00:00:00 2001 From: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> Date: Thu, 26 Sep 2024 21:09:52 +0200 Subject: [PATCH 2/2] kemono: also only load aimeio dll in x64 process --- kemonohook/dllmain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kemonohook/dllmain.c b/kemonohook/dllmain.c index 42b2b68..5eac13d 100644 --- a/kemonohook/dllmain.c +++ b/kemonohook/dllmain.c @@ -34,6 +34,7 @@ static DWORD CALLBACK kemono_pre_startup(void) { /* Load config */ + kemono_hook_cfg.aime.dll.path64 = true; kemono_hook_config_load(&kemono_hook_cfg, L".\\segatools.ini"); /* Hook Win32 APIs */