1
0
mirror of https://gitea.tendokyu.moe/Dniel97/segatools.git synced 2025-03-04 08:54:28 +01:00

idac, tokyo: improve dipsw cabinet id config

This commit is contained in:
Dniel97 2025-03-02 00:36:13 +01:00
parent e850346b79
commit 27116a7a41
No known key found for this signature in database
GPG Key ID: DE105D481972329C
3 changed files with 40 additions and 4 deletions

View File

@ -26,19 +26,24 @@
#include <stdlib.h>
#include <windows.h>
#include "amex/amex.h"
#include "board/sg-reader.h"
#include "board/vfd.h"
#include "chuniio/chuniio.h"
#include "chusanhook/config.h"
#include "chusanhook/io4.h"
#include "chusanhook/slider.h"
#include "gfxhook/d3d9.h"
#include "gfxhook/gfx.h"
#include "hook/process.h"
#include "hooklib/serial.h"
#include "hooklib/spike.h"
#include "platform/platform.h"
#include "util/dprintf.h"
#include "util/env.h"
@ -96,7 +101,10 @@ static DWORD CALLBACK chusan_pre_startup(void) {
memcpy(chusan_hook_cfg.platform.system.dipsw_config, new_dipsw_config,
sizeof(new_dipsw_config));
hr = platform_hook_init(&chusan_hook_cfg.platform, "SDHD", "ACA2",
hr = platform_hook_init(
&chusan_hook_cfg.platform,
"SDHD",
"ACA2",
chusan_hook_mod);
if (FAILED(hr)) {

View File

@ -82,13 +82,21 @@ static DWORD CALLBACK idac_pre_startup(void)
goto fail;
}
bool *dipsw = &idac_hook_cfg.platform.system.dipsw[0];
bool is_swdc_cvt = dipsw[1];
if (!dipsw[2]) {
// the next two bit are the seat number most significant bit first
dprintf("System: Seat Number: %d\n", ((dipsw[4] << 1) | dipsw[3]) + 1);
}
hr = idac_dll_init(&idac_hook_cfg.dll, idac_hook_mod);
if (FAILED(hr)) {
goto fail;
}
hr = sg_reader_hook_init(&idac_hook_cfg.aime, 3, 3, idac_hook_mod);
hr = sg_reader_hook_init(&idac_hook_cfg.aime, 3, is_swdc_cvt ? 3 : 2, idac_hook_mod);
if (FAILED(hr)) {
goto fail;

View File

@ -70,6 +70,26 @@ static DWORD CALLBACK tokyo_pre_startup(void)
goto fail;
}
bool *dipsw = &tokyo_hook_cfg.platform.system.dipsw[0];
unsigned int cabinet_id = 0;
if (dipsw[0] == 1 && dipsw[1] == 0 && dipsw[2] == 0) {
cabinet_id = 1; // Server 1
} else if (dipsw[0] == 0 && dipsw[1] == 1 && dipsw[2] == 0) {
cabinet_id = 2; // Client 2
} else if (dipsw[0] == 0 && dipsw[1] == 0 && dipsw[2] == 1) {
cabinet_id = 3; // Client 3
} else if (dipsw[0] == 0 && dipsw[1] == 1 && dipsw[2] == 1) {
cabinet_id = 4; // Client 4
} else {
dprintf("Error: Invalid dip switch configuration!\n");
}
// Print the correct Cabinet ID if valid
if (cabinet_id > 0) {
dprintf("System: Cabinet ID %d\n", cabinet_id);
}
hr = tokyo_dll_init(&tokyo_hook_cfg.dll, tokyo_hook_mod);
if (FAILED(hr)) {