chusan: fixed dipsw settings, added aimeio DLL loading

This commit is contained in:
Dniel97 2023-12-17 19:43:00 +01:00
parent 1cbc33d97d
commit ad154a83e5
Signed by untrusted user: Dniel97
GPG Key ID: 6180B3C768FB2E08
5 changed files with 63 additions and 14 deletions

View File

@ -18,6 +18,7 @@ struct aime_dll {
struct aime_dll_config { struct aime_dll_config {
wchar_t path[MAX_PATH]; wchar_t path[MAX_PATH];
bool path64;
}; };
extern struct aime_dll aime_dll; extern struct aime_dll aime_dll;

View File

@ -9,11 +9,40 @@
#include "board/config.h" #include "board/config.h"
#include "board/sg-reader.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) static void aime_dll_config_load(struct aime_dll_config *cfg, const wchar_t *filename)
{ {
assert(cfg != NULL); assert(cfg != NULL);
assert(filename != NULL); assert(filename != NULL);
// 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( GetPrivateProfileStringW(
L"aimeio", L"aimeio",
L"path", L"path",
@ -21,6 +50,18 @@ static void aime_dll_config_load(struct aime_dll_config *cfg, const wchar_t *fil
cfg->path, cfg->path,
_countof(cfg->path), _countof(cfg->path),
filename); 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) void aime_config_load(struct aime_config *cfg, const wchar_t *filename)

View File

@ -141,6 +141,9 @@ void chusan_hook_config_load(
memset(cfg, 0, sizeof(*cfg)); 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); platform_config_load(&cfg->platform, filename);
aime_config_load(&cfg->aime, filename); aime_config_load(&cfg->aime, filename);
dvd_config_load(&cfg->dvd, filename); dvd_config_load(&cfg->dvd, filename);

View File

@ -100,11 +100,7 @@ static DWORD CALLBACK chusan_pre_startup(void)
} }
bool *dipsw = &chusan_hook_cfg.platform.dipsw.dipsw[0]; bool *dipsw = &chusan_hook_cfg.platform.dipsw.dipsw[0];
bool *is_sp = dipsw + 2;
if (dipsw[1] != dipsw[2]) {
dprintf("DipSw: DipSw2 and 3 must be set to the same value!\n");
goto fail;
}
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
switch (i) { switch (i) {
@ -117,13 +113,21 @@ static DWORD CALLBACK chusan_pre_startup(void)
break; break;
case 2: case 2:
dprintf("DipSw: Aime Reader: %s\n", dipsw[2] ? "CVT" : "SP"); dprintf("DipSw: Cab Type: %s\n", is_sp ? "SP" : "CVT");
break; 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); 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; 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)) { if (FAILED(hr)) {
goto fail; goto fail;

View File

@ -16,8 +16,8 @@ aimePath=DEVICE\aime.txt
;highbaud=1 ;highbaud=1
[aimeio] [aimeio]
; x64 aimeio dll path. ; Uncomment this if you have custom (x64) aime implementation.
; Uncomment this if you have custom aime implementation. ; Leave empty if you want to use Segatools built-in keyboard input.
;path= ;path=
[dns] [dns]
@ -49,10 +49,10 @@ freeplay=0
; LAN Install: If multiple machines are present on the same LAN then set ; 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. ; this to 1 on exactly one machine and set this to 0 on all others.
dipsw1=1 dipsw1=1
; Monitor type: 0 = 120FPS (SP), 1 = 60FPS (CVT) ; Monitor type: 0 = 120FPS, 1 = 60FPS
dipsw2=1 dipsw2=1
; Aime reader hardware type: 0 = SP, 1 = CVT. Both dipsw2 and dipsw3 must be ; Cab type: 0 = SP, 1 = CVT. SP will enable VFD and eMoney. This setting will switch
; the same value. ; the LED 837-15093-06 COM port and the AiMe reder hardware generation as well.
dipsw3=1 dipsw3=1
[gfx] [gfx]