diff --git a/board/aime-dll.h b/board/aime-dll.h index 354516b..75dba9e 100644 --- a/board/aime-dll.h +++ b/board/aime-dll.h @@ -18,6 +18,7 @@ struct aime_dll { struct aime_dll_config { wchar_t path[MAX_PATH]; + bool path64; }; extern struct aime_dll aime_dll; diff --git a/board/config.c b/board/config.c index 3ffa6ab..bbbf074 100644 --- a/board/config.c +++ b/board/config.c @@ -9,18 +9,59 @@ #include "board/config.h" #include "board/sg-reader.h" +#include "util/dprintf.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 + static void aime_dll_config_load(struct aime_dll_config *cfg, const wchar_t *filename) { assert(cfg != NULL); assert(filename != NULL); - GetPrivateProfileStringW( + // Workaround for x64/x86 external IO dlls + // path32 for 32bit, path64 for 64bit + // for else.. is that possible? idk + + if (cfg->path64) { + #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"aimeio", + L"path", + L"", + cfg->path, + _countof(cfg->path), + filename); + #else + #error "Unknown environment" + #endif + } else { + GetPrivateProfileStringW( L"aimeio", L"path", L"", cfg->path, _countof(cfg->path), filename); + } } void aime_config_load(struct aime_config *cfg, const wchar_t *filename) diff --git a/chusanhook/config.c b/chusanhook/config.c index f3ff50e..0361e98 100644 --- a/chusanhook/config.c +++ b/chusanhook/config.c @@ -141,6 +141,9 @@ void chusan_hook_config_load( memset(cfg, 0, sizeof(*cfg)); + // Force load the 64bit Aime DLL instead of the 32bit one + cfg->aime.dll.path64 = true; + platform_config_load(&cfg->platform, filename); aime_config_load(&cfg->aime, filename); dvd_config_load(&cfg->dvd, filename); diff --git a/chusanhook/dllmain.c b/chusanhook/dllmain.c index cd66dbd..61c7f47 100644 --- a/chusanhook/dllmain.c +++ b/chusanhook/dllmain.c @@ -100,11 +100,7 @@ static DWORD CALLBACK chusan_pre_startup(void) } bool *dipsw = &chusan_hook_cfg.platform.dipsw.dipsw[0]; - - if (dipsw[1] != dipsw[2]) { - dprintf("DipSw: DipSw2 and 3 must be set to the same value!\n"); - goto fail; - } + bool *is_sp = dipsw + 2; for (int i = 0; i < 3; i++) { switch (i) { @@ -117,13 +113,21 @@ static DWORD CALLBACK chusan_pre_startup(void) break; case 2: - dprintf("DipSw: Aime Reader: %s\n", dipsw[2] ? "CVT" : "SP"); + dprintf("DipSw: Cab Type: %s\n", is_sp ? "SP" : "CVT"); break; } } - unsigned int first_port = dipsw[1] ? 2 : 20; + unsigned int first_port = is_sp ? 20 : 2; + + if (is_sp) { + hr = vfd_hook_init(2); + + if (FAILED(hr)) { + goto fail; + } + } hr = led15093_hook_init(&chusan_hook_cfg.led15093, first_port, 2, 2, 1); @@ -131,7 +135,7 @@ static DWORD CALLBACK chusan_pre_startup(void) goto fail; } - hr = sg_reader_hook_init(&chusan_hook_cfg.aime, 4, dipsw[2] ? 2 : 3, chusan_hook_mod); + hr = sg_reader_hook_init(&chusan_hook_cfg.aime, 4, is_sp ? 3: 2, chusan_hook_mod); if (FAILED(hr)) { goto fail; diff --git a/dist/chusan/segatools.ini b/dist/chusan/segatools.ini index df9419f..44d1a96 100644 --- a/dist/chusan/segatools.ini +++ b/dist/chusan/segatools.ini @@ -16,8 +16,8 @@ aimePath=DEVICE\aime.txt ;highbaud=1 [aimeio] -; x64 aimeio dll path. -; Uncomment this if you have custom aime implementation. +; Uncomment this if you have custom (x64) aime implementation. +; Leave empty if you want to use Segatools built-in keyboard input. ;path= [dns] @@ -49,10 +49,10 @@ freeplay=0 ; LAN Install: If multiple machines are present on the same LAN then set ; this to 1 on exactly one machine and set this to 0 on all others. dipsw1=1 -; Monitor type: 0 = 120FPS (SP), 1 = 60FPS (CVT) +; Monitor type: 0 = 120FPS, 1 = 60FPS dipsw2=1 -; Aime reader hardware type: 0 = SP, 1 = CVT. Both dipsw2 and dipsw3 must be -; the same value. +; Cab type: 0 = SP, 1 = CVT. SP will enable VFD and eMoney. This setting will switch +; the LED 837-15093-06 COM port and the AiMe reder hardware generation as well. dipsw3=1 [gfx]