Compare commits

..

16 Commits

Author SHA1 Message Date
d118ef614c updated README and added "AM Daemon" window name 2024-02-22 12:12:29 +01:00
ae199502e8 fixed amfs/appdata redirects 2024-02-22 12:02:32 +01:00
e40e1dffe3 improved all segatools.ini configs 2024-02-21 21:58:44 +01:00
56e971c6a4 changed default operator buttons to F1, F2 and F3 and fixed subnets 2024-02-06 13:01:26 +01:00
3e9303e043 fgo: ups forgot to add it to Package.mk 2024-02-06 12:34:39 +01:00
451a7ec49d added VFD toggle to config 2024-02-06 12:34:11 +01:00
dae3018411 doc: added develop dongle hint 2024-01-27 23:10:59 +01:00
cadf20040c swdc: fixed dinput buttons 2024-01-17 15:52:41 +01:00
cc0b6b0953 swdc: fixed steering wheel buttons, improved start.bat 2024-01-16 17:56:24 +01:00
0affc96e3e small optimizations 2024-01-16 17:54:06 +01:00
a8bd98706f Merge pull request 'fix(netenv): Print IP addresses properly' (#4) from beerpsi/segatools:fix/print-ip-addresses-properly into develop
Reviewed-on: Dniel97/segatools#4
2024-01-08 18:26:51 +00:00
aa2184f947 Merge branch 'develop' into fix/print-ip-addresses-properly 2024-01-07 18:36:04 +00:00
d0165b1eb0 fix(netenv): Print IP addresses properly 2024-01-08 01:34:55 +07:00
477dad2667 Merge branch 'chuniio' into develop 2023-12-27 19:29:55 +01:00
63320f8456 Merge pull request 'fix chunihook' (#2) from CrazyRedMachine/segatools:chuniio into chuniio
Reviewed-on: Dniel97/segatools#2
2023-12-27 15:14:07 +00:00
926493290b fix chunihook 2023-12-26 06:47:19 -05:00
82 changed files with 1228 additions and 388 deletions

View File

@ -111,6 +111,7 @@ $(BUILD_DIR_ZIP)/swdc.zip:
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/swdchook/swdchook.dll \
$(DIST_DIR)/swdc/segatools.ini \
$(DIST_DIR)/swdc/config_hook.json \
$(DIST_DIR)/swdc/start.bat \
$(BUILD_DIR_ZIP)/swdc
$(V)cp pki/billing.pub \
@ -224,6 +225,7 @@ $(BUILD_DIR_ZIP)/segatools.zip: \
$(BUILD_DIR_ZIP)/mu3.zip \
$(BUILD_DIR_ZIP)/mai2.zip \
$(BUILD_DIR_ZIP)/cm.zip \
$(BUILD_DIR_ZIP)/fgo.zip \
CHANGELOG.md \
README.md \

View File

@ -1,33 +1,31 @@
# Segatools
Version: `2023-11-22`
Version: `2024-02-22`
Loaders and hardware emulators for SEGA games that run on the Nu and ALLS platforms.
## List of supported games
* Chunithm
* [Chunithm (Plus)](doc/chunihook.md)
* [Chunithm Air (Plus)](doc/chunihook.md)
* [Chunithm Star (Plus)](doc/chunihook.md)
* [Chunithm Amazon (Plus)](doc/chunihook.md)
* [Chunithm Crystal (Plus)](doc/chunihook.md)
* Chunithm SUN
* CHUNITHM
* up to [CHUNITHM PARADISE LOST](doc/chunihook.md)
* starting from CHUNITHM NEW!!
* Initial D
* [Initial D Arcade Stage Zero](doc/idzhook.md)
* Initial D THE ARCADE
* Hatsune Miku: Project DIVA Arcade
* up to Future Tone
* SEGA World Drivers Championship
* up to SEGA World Drivers Championship 2019
* SEGA World Drivers Championship 2019
* Fate/Grand Order
* Fate/Grand Order Arcade
* ONGEKI
* up to bright MEMORY
* O.N.G.E.K.I.
* starting from O.N.G.E.K.I.
* maimai DX
* up to maimai DX FESTiVAL PLUS
* starting from maimai DX
* Card Maker
* up to Card Maker 1.35
* Wacca
* up to WACCA Reverse
* starting from Card Maker
* WACCA
* starting from WACCA
## End-users

View File

@ -68,7 +68,7 @@ static void aime_io_config_read(
cfg->felica_path,
_countof(cfg->felica_path),
filename);
dprintf("NFC: felicaPath GetLastError %lx\n", GetLastError());
// dprintf("NFC: felicaPath GetLastError %lx\n", GetLastError());
cfg->felica_gen = GetPrivateProfileIntW(
L"aime",

View File

@ -8,6 +8,7 @@
#include "board/aime-dll.h"
#include "board/config.h"
#include "board/sg-reader.h"
#include "board/vfd.h"
#include "util/dprintf.h"
@ -71,7 +72,7 @@ void aime_config_load(struct aime_config *cfg, const wchar_t *filename)
aime_dll_config_load(&cfg->dll, filename);
cfg->enable = GetPrivateProfileIntW(L"aime", L"enable", 1, filename);
cfg->high_baudrate = GetPrivateProfileIntW(L"aime", L"highbaud", 1, filename);
cfg->high_baudrate = GetPrivateProfileIntW(L"aime", L"highBaud", 1, filename);
cfg->gen = GetPrivateProfileIntW(L"aime", L"gen", 0, filename);
}
@ -82,3 +83,11 @@ void io4_config_load(struct io4_config *cfg, const wchar_t *filename)
cfg->enable = GetPrivateProfileIntW(L"io4", L"enable", 1, filename);
}
void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename)
{
assert(cfg != NULL);
assert(filename != NULL);
cfg->enable = GetPrivateProfileIntW(L"vfd", L"enable", 1, filename);
}

View File

@ -5,6 +5,8 @@
#include "board/io4.h"
#include "board/sg-reader.h"
#include "board/vfd.h"
void aime_config_load(struct aime_config *cfg, const wchar_t *filename);
void io4_config_load(struct io4_config *cfg, const wchar_t *filename);
void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename);

View File

@ -27,14 +27,22 @@ static struct uart vfd_uart;
static uint8_t vfd_written[512];
static uint8_t vfd_readable[512];
HRESULT vfd_hook_init(unsigned int port_no)
HRESULT vfd_hook_init(const struct vfd_config *cfg, unsigned int port_no)
{
assert(cfg != NULL);
if (!cfg->enable) {
return S_FALSE;
}
uart_init(&vfd_uart, port_no);
vfd_uart.written.bytes = vfd_written;
vfd_uart.written.nbytes = sizeof(vfd_written);
vfd_uart.readable.bytes = vfd_readable;
vfd_uart.readable.nbytes = sizeof(vfd_readable);
dprintf("VFD: hook enabled.\n");
return iohook_push_handler(vfd_handle_irp);
}

View File

@ -2,4 +2,9 @@
#include <windows.h>
HRESULT vfd_hook_init(unsigned int port_no);
struct vfd_config {
bool enable;
};
HRESULT vfd_hook_init(const struct vfd_config *cfg, unsigned int port_no);

View File

@ -14,7 +14,7 @@ void carol_io_config_load(
assert(cfg != NULL);
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io3", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io3", L"service", '2', filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io3", L"coin", '3', filename);
cfg->vk_test = GetPrivateProfileIntW(L"io3", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io3", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io3", L"coin", VK_F3, filename);
}

View File

@ -39,6 +39,19 @@ const struct dll_bind_sym chuni_dll_syms[] = {
}
};
/* Helper function to determine upon dll_bind failure whether the required functions were found
NOTE: relies on symbols order declared above */
static HRESULT has_enough_symbols(uint16_t version, uint8_t count)
{
if ( version <= 0x0101 && count == 7 )
return S_OK;
if ( version >= 0x0102 && count == 9 )
return S_OK;
return E_FAIL;
}
struct chuni_dll chuni_dll;
// Copypasta DLL binding and diagnostic message boilerplate.
@ -98,16 +111,24 @@ HRESULT chuni_dll_init(const struct chuni_dll_config *cfg, HINSTANCE self)
}
sym = chuni_dll_syms;
const struct dll_bind_sym *init_sym = &sym[0];
hr = dll_bind(&chuni_dll, src, &sym, _countof(chuni_dll_syms));
if (FAILED(hr)) {
if (src != self) {
dprintf("Chunithm IO: Custom IO DLL does not provide function "
"\"%s\". Please contact your IO DLL's developer for "
"further assistance.\n",
sym->sym);
// Might still be ok depending on external dll API version
int bind_count = sym - init_sym;
if ( has_enough_symbols(chuni_dll.api_version, bind_count) == S_OK )
{
hr = S_OK;
} else {
dprintf("Chunithm IO: Custom IO DLL does not provide function "
"\"%s\". Please contact your IO DLL's developer for "
"further assistance.\n",
sym->sym);
goto end;
goto end;
}
} else {
dprintf("Internal error: could not reflect \"%s\"\n", sym->sym);
}

View File

@ -56,7 +56,7 @@ void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename)
cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename);
cfg->port_no = 0;
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaudrate", 0, filename);
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaud", 0, filename);
cfg->fw_ver = GetPrivateProfileIntW(L"led15093", L"fwVer", 0x90, filename);
cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xadf7, filename);

View File

@ -34,9 +34,9 @@ void chuni_io_config_load(
assert(filename != NULL);
// Technically it's io4 but leave this for compatibility with old configs.
cfg->vk_test = GetPrivateProfileIntW(L"io3", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io3", L"service", '2', filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io3", L"coin", '3', filename);
cfg->vk_test = GetPrivateProfileIntW(L"io3", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io3", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io3", L"coin", VK_F3, filename);
cfg->vk_ir_emu = GetPrivateProfileIntW(L"io3", L"ir", VK_SPACE, filename);
for (i = 0 ; i < 6 ; i++) {

View File

@ -96,7 +96,7 @@ void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename)
cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename);
cfg->port_no = 0;
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaudrate", 0, filename);
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaud", 0, filename);
cfg->fw_ver = GetPrivateProfileIntW(L"led15093", L"fwVer", 0x90, filename);
cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xadf7, filename);
@ -160,6 +160,7 @@ void chusan_hook_config_load(
dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename);
gfx_config_load(&cfg->gfx, filename);
vfd_config_load(&cfg->vfd, filename);
chuni_dll_config_load(&cfg->dll, filename);
slider_config_load(&cfg->slider, filename);
led15093_config_load(&cfg->led15093, filename);

View File

@ -20,6 +20,7 @@ struct chusan_hook_config {
struct dvd_config dvd;
struct io4_config io4;
struct gfx_config gfx;
struct vfd_config vfd;
struct chuni_dll_config dll;
struct slider_config slider;
struct led15093_config led15093;

View File

@ -122,7 +122,7 @@ static DWORD CALLBACK chusan_pre_startup(void)
unsigned int first_port = is_cvt ? 2 : 20;
if (!is_cvt) {
hr = vfd_hook_init(2);
hr = vfd_hook_init(&chusan_hook_cfg.vfd, 2);
if (FAILED(hr)) {
goto fail;

View File

@ -37,6 +37,7 @@ void cm_hook_config_load(
aime_config_load(&cfg->aime, filename);
dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename);
vfd_config_load(&cfg->vfd, filename);
touch_screen_config_load(&cfg->touch, filename);
cm_dll_config_load(&cfg->dll, filename);
}

View File

@ -16,6 +16,7 @@ struct cm_hook_config {
struct aime_config aime;
struct dvd_config dvd;
struct io4_config io4;
struct vfd_config vfd;
struct cm_dll_config dll;
struct touch_screen_config touch;
};

View File

@ -60,7 +60,7 @@ static DWORD CALLBACK cm_pre_startup(void)
goto fail;
}
hr = vfd_hook_init(2);
hr = vfd_hook_init(&cm_hook_cfg.vfd, 2);
if (FAILED(hr)) {
goto fail;

View File

@ -16,7 +16,7 @@ void cm_io_config_load(
assert(cfg != NULL);
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", '2', filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", '3', filename);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", VK_F3, filename);
}

View File

@ -1,23 +1,56 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=
; Insert the path to the game Option directory here (contains Axxx directories)
; Insert the path to the game Option directory here (contains MOV1, PAR0,
; PAR1, RES0 and RES1 directories)
option=
; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1
aimePath=DEVICE\aime.txt
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected.
default=127.0.0.1
[netenv]
; Simulate an ideal LAN environment.
; Simulate an ideal LAN environment. This may interfere with head-to-head play.
; Chunithm is extremely picky about its LAN environment, so leaving this
; setting enabled is strongly recommended.
enable=1
; The final octet of the local host's IP address on the virtualized subnet (so,
; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the
; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[gpio]
; Emulated Nu DIP switch for Distribution Server setting.
;
; 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
[keychip]
@ -26,6 +59,10 @@ dipsw1=1
; that subnet must start with 192.168.
subnet=192.168.126.0
; -----------------------------------------------------------------------------
; Misc. hooks settings
; -----------------------------------------------------------------------------
[gfx]
; Force the game to run windowed.
windowed=1
@ -34,15 +71,31 @@ framed=1
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
monitor=0
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
; -----------------------------------------------------------------------------
; Input settings
; -----------------------------------------------------------------------------
; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal
; (not prefixed with 0x) virtual-key codes, a list of which can be found here:
;
; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
;
; This is, admittedly, not the most user-friendly configuration method in the
; world. An improved solution will be provided later.
[io3]
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72

View File

@ -1,3 +1,7 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=
@ -8,6 +12,20 @@ option=
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1
aimePath=DEVICE\aime.txt
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected.
@ -18,6 +36,14 @@ default=127.0.0.1
; Chunithm is extremely picky about its LAN environment, so leaving this
; setting enabled is strongly recommended.
enable=1
; The final octet of the local host's IP address on the virtualized subnet (so,
; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the
; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
@ -25,6 +51,10 @@ enable=1
; that subnet must start with 192.168.
subnet=192.168.139.0
; -----------------------------------------------------------------------------
; Misc. hooks settings
; -----------------------------------------------------------------------------
[gfx]
; Force the game to run windowed.
windowed=1
@ -33,6 +63,10 @@ framed=1
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
monitor=0
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
@ -43,6 +77,10 @@ path=
; Leave empty if you want to use Segatools built-in keyboard input.
path=
; -----------------------------------------------------------------------------
; LED settings
; -----------------------------------------------------------------------------
[led15093]
; Enable emulation of the 15093-06 controlled lights, which handle the air tower
; RGBs and the rear LED panel (billboard) on the cabinet.
@ -97,12 +135,12 @@ controllerLedOutputSerial=0
; world. An improved solution will be provided later.
[io3]
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
; Set to 0 for enable separate ir control. Deafult is space key.
ir=0x20

View File

@ -1,3 +1,7 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=
@ -8,17 +12,26 @@ option=
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Enable aime reader emulation.
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1
aimePath=DEVICE\aime.txt
; Enable high baud rate.
;highbaud=1
;highBaud=1
[aimeio]
; Uncomment this if you have custom (x64) aime implementation.
; Leave empty if you want to use Segatools built-in keyboard input.
;path=
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
@ -30,6 +43,14 @@ default=127.0.0.1
; Chunithm is extremely picky about its LAN environment, so leaving this
; setting enabled is strongly recommended.
enable=1
; The final octet of the local host's IP address on the virtualized subnet (so,
; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the
; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
@ -55,6 +76,10 @@ dipsw2=1
; the LED 837-15093-06 COM port and the AiMe reder hardware generation as well.
dipsw3=1
; -----------------------------------------------------------------------------
; Misc. hooks settings
; -----------------------------------------------------------------------------
[gfx]
; Force the game to run windowed.
windowed=1
@ -63,6 +88,15 @@ framed=0
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
monitor=0
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL (x64) enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
[chuniio]
; Uncomment this if you have custom chuniio implementation comprised of a single 32bit DLL.
; (will use chu2to3 engine internally)
@ -73,6 +107,10 @@ monitor=0
;path32=
;path64=
; -----------------------------------------------------------------------------
; LED settings
; -----------------------------------------------------------------------------
[led15093]
; Enable emulation of the 15093-06 controlled lights, which handle the air tower
; RGBs and the rear LED panel (billboard) on the cabinet.
@ -127,12 +165,12 @@ controllerLedOutputSerial=0
; world. An improved solution will be provided later.
[io3]
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
; Set to 0 for enable separate ir control. Deafult is space key.
ir=0x20

View File

@ -2,8 +2,9 @@
pushd %~dp0
start /min inject_x64 -d -k chusanhook_x64.dll amdaemon.exe -c config_common.json config_server.json config_client.json config_cvt.json config_sp.json config_hook.json
start "AM Daemon" /min inject_x64 -d -k chusanhook_x64.dll amdaemon.exe -c config_common.json config_server.json config_client.json config_cvt.json config_sp.json config_hook.json
inject_x86 -d -k chusanhook_x86.dll chusanApp.exe
taskkill /f /im amdaemon.exe > nul 2>&1
echo.

49
dist/cm/segatools.ini vendored
View File

@ -1,3 +1,7 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=
@ -8,11 +12,25 @@ option=
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Enable aime reader emulation.
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1
aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected.
@ -24,6 +42,10 @@ default=127.0.0.1
; setting enabled is recommended.
enable=1
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
; If you disable netenv then you must set this to your LAN's IP subnet, and
@ -38,10 +60,23 @@ enable=1
; this to 0 on exactly one machine and set this to 1 on all others.
dipsw1=0
; -----------------------------------------------------------------------------
; Misc. hooks settings
; -----------------------------------------------------------------------------
[touch]
; Enable/Disable WinTouch emulation
enable=0
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
; -----------------------------------------------------------------------------
; Input settings
; -----------------------------------------------------------------------------
@ -55,9 +90,9 @@ enable=0
; world. An improved solution will be provided later.
[io4]
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72

2
dist/cm/start.bat vendored
View File

@ -2,7 +2,7 @@
pushd %~dp0
start /min inject -d -k cmhook.dll amdaemon.exe -c config_common.json config_server.json config_client.json config_hook.json
start "AM Daemon" /min inject -d -k cmhook.dll amdaemon.exe -c config_common.json config_server.json config_client.json config_hook.json
inject -d -k cmhook.dll CardMaker.exe -screen-fullscreen 0 -popupwindow -screen-width 1080 -screen-height 1920
taskkill /f /im amdaemon.exe > nul 2>&1

100
dist/cxb/segatools.ini vendored
View File

@ -1,3 +1,7 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Make sure theses are full paths and not relative or you will have a bad time
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
@ -9,6 +13,27 @@ option=
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Aime reader emulation
; CXB is stupid, so we have to make the paths go back one
enable=1
aimePath=../DEVICE/aime.txt
felicaPath=../DEVICE/felica.txt
[led]
; Emulation for the LED board. Currently it's just dummy responses,
; but if somebody wants to make their keyboard or whatever light
; up with the game they can
enable=1
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected.
@ -20,30 +45,19 @@ default=127.0.0.1
; setting enabled is strongly recommended.
enable=1
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168.
subnet=192.168.100.0
subnet=192.168.150.0
billingCa=../DEVICE/ca.crt
billingPub=../DEVICE/billing.pub
billingType=2
[gfx]
; Force the game to run windowed.
windowed=1
; Add a frame to the game window if running windowed.
framed=1
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
monitor=0
[aime]
; Aime reader emulation
; CXB is stupid, so we have to make the paths go back one
enable=1
aimePath=../DEVICE/aime.txt
felicaPath=../DEVICE/felica.txt
[eeprom]
; See above
path=../DEVICE/eeprom.bin
@ -52,21 +66,53 @@ path=../DEVICE/eeprom.bin
; See above
path=../DEVICE/sram.bin
[led]
; Emulation for the LED board. Currently it's just dummy responses,
; but if somebody wants to make their keyboard or whatever light
; up with the game they can
enable=1
; -----------------------------------------------------------------------------
; Misc. hooks settings
; -----------------------------------------------------------------------------
[gfx]
; Force the game to run windowed.
windowed=1
; Add a frame to the game window if running windowed.
framed=1
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
monitor=0
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
[cxbio]
; To use a custom crossbeats REV. DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
; -----------------------------------------------------------------------------
; Input settings
; -----------------------------------------------------------------------------
; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal
; (not prefixed with 0x) virtual-key codes, a list of which can be found here:
;
; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
;
; This is, admittedly, not the most user-friendly configuration method in the
; world. An improved solution will be provided later.
[revio]
; Enable emulation of the rev IO board
enabe=1
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
; Menu up key. Default is up arrow.
up=0x26
; Menu down key. Default is down arrow.

View File

@ -1,3 +1,7 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=
@ -8,6 +12,20 @@ option=
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1
aimePath=DEVICE\aime.txt
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected.
@ -19,14 +37,56 @@ default=127.0.0.1
; setting enabled is strongly recommended.
enable=1
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[gpio]
; Emulated Nu DIP switch for Distribution Server setting.
;
; 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
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168.
subnet=192.168.150.0
subnet=192.168.78.0
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
[divaio]
; To use a custom Project DIVA Arcade IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in gamepad/wheel input.
path=
; -----------------------------------------------------------------------------
; Input settings
; -----------------------------------------------------------------------------
; Keyboard bindings are specified as hexadecimal (prefixed with 0x) or decimal
; (not prefixed with 0x) virtual-key codes, a list of which can be found here:
;
; https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
;
; This is, admittedly, not the most user-friendly configuration method in the
; world. An improved solution will be provided later.
[io3]
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
[slider]
cell1=0x51

104
dist/fgo/segatools.ini vendored
View File

@ -1,3 +1,7 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=
@ -8,11 +12,41 @@ option=
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Controls emulation of the Aime card reader assembly.
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1
aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
[deckReader]
; 837-15345 RFID deck reader emulation setting.
enable=1
[ftdi]
; FTDI serial to usb adapter emulation for CABINET LED.
enable=1
; COM port number where the LED board is connected to.
portNo=17
[led15093]
; 837-15093-06 LED board emulation setting.
enable=1
; COM port number for the LED board. Has to be the same as the FTDI port.
portNo=17
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected.
@ -23,17 +57,33 @@ default=127.0.0.1
; SEGA games are somewhat picky about their LAN environment, so leaving this
; setting enabled is recommended.
enable=1
; The final octet of the local host's IP address on the virtualized subnet (so,
; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the
; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168.
subnet=192.168.172.0
subnet=192.168.167.0
[gpio]
; ALLS DIP switches.
enable=1
; Enable freeplay mode. This will disable the coin slot and set the game to
; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not
; allow you to start a game in freeplay mode.
freeplay=0
; -----------------------------------------------------------------------------
; Misc. hook settings
; -----------------------------------------------------------------------------
[touch]
; WinTouch emulation setting.
@ -51,21 +101,19 @@ printerOutPath="DEVICE\print"
; Rotate all printed images by 180 degrees.
rotate180=1
[deckReader]
; 837-15345 RFID deck reader emulation setting.
enable=1
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[ftdi]
; FTDI serial to usb adapter emulation for CABINET LED.
enable=1
; COM port number where the LED board is connected to.
portNo=17
[aimeio]
; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
[led15093]
; 837-15093-06 LED board emulation setting.
enable=1
; COM port number for the LED board. Has to be the same as the FTDI port.
portNo=17
[fgoio]
; To use a custom Fate/Grand Order Arcade IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in gamepad input.
path=
; -----------------------------------------------------------------------------
; Input settings
@ -87,3 +135,27 @@ test=0x31
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; .·:'''''''''''''''''''''''''''''''''''''''''''''':·.
; : : ______ / \ [] : :
; : : | | _____ \ / Coin : :
; : : |______| { (0) } /--\ Attack. : :
; : : DECK \ / / \ : :
; : : | | > < : :
; : : | | \ / ___ : :
; : : | | \--/ | | : :
; : : JOY Noble. | | : :
; : : |___| : :
; : : AIME. : :
; '·:..............................................:·'
;
; Only XInput is currently supported.
; Controller Button
; -------------------------------------------------------
; Left Stick Joystick
; Left Stick Click Reset Camera
; Left Trigger Dash
; Left Shoulder Switch Target
; A/B Attack
; X/Y Noble Phantasm

View File

@ -1,18 +1,30 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=
; Insert the path to the game Option directory here (contains OPxx directories)
; Insert the path to the game Option directory here (contains MVxx directories)
option=
; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Controls emulation of the Aime card reader assembly.
enable=1
aimePath=DEVICE\aime.txt
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected.
@ -24,6 +36,10 @@ default=127.0.0.1
; setting enabled is recommended.
enable=1
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
; If you disable netenv then you must set this to your LAN's IP subnet, and
@ -59,13 +75,17 @@ dipsw3=0
dipsw4=0
dipsw5=0
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
[idacio]
; To use a custom Initial D The Arcade IO DLL enter its path here.
; To use a custom Initial D THE ARCADE IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in gamepad/wheel input.
path=
@ -82,12 +102,12 @@ path=
; world. An improved solution will be provided later.
[io4]
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
; Input API selection for IO4 input emulator.
; Set "xinput" to use a gamepad and "dinput" to use a steering wheel.
@ -106,6 +126,22 @@ mode=xinput
restrict=128
[xinput]
; XInput bindings
;
; Left Stick Steering
; Right Stick (Steering) when "singleStickSteering" is disabled
; Left Trigger Brake
; Right Trigger Accelerator
; Left Stick Click Left (used for Time Up)
; Right Stick Click Right (used for Time Up)
; Left Shoulder Shift Down
; Right Shoulder Shift Up
; Start/A Start
; Back/B View Change
; X Shift Up
; Y Shift Down
; D-Pad D-Pad
; Left and right thumbsticks are mapped to left and right dpad buttons.
; Press both thumbsticks to trigger "Time Up" and exit the course.
; Automatically reset the simulated shifter to Neutral when XInput Start is

2
dist/idac/start.bat vendored
View File

@ -39,7 +39,7 @@ config_seat_single_ex.json ^
config_seat_single_jp.json ^
config_hook.json
start /min inject -d -k idachook.dll amdaemon.exe -c %AMDAEMON_CFG%
start "AM Daemon" /min inject -d -k idachook.dll amdaemon.exe -c %AMDAEMON_CFG%
inject -d -k idachook.dll ..\WindowsNoEditor\GameProject.exe -culture=en launch=Cabinet ABSLOG="..\..\..\..\..\Userdata\GameProject.log" -Master -UserDir="..\..\..\Userdata" -NotInstalled -UNATTENDED
taskkill /f /im amdaemon.exe > nul 2>&1

View File

@ -1,3 +1,7 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=
@ -8,6 +12,10 @@ option=
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Controls emulation of the Aime card reader assembly.
enable=1
@ -16,11 +24,36 @@ aimePath=DEVICE\aime.txt
felicaGen=0
aimeGen=1
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected.
default=127.0.0.1
[netenv]
; Simulate an ideal LAN environment. This may interfere with head-to-head play.
; SEGA games are somewhat picky about their LAN environment, so leaving this
; setting enabled is recommended.
enable=1
; The final octet of the local host's IP address on the virtualized subnet
; (so, if the keychip subnet is 192.168.32.0 and this value is set to 11,
; then the local host's virtualized LAN IP is 192.168.32.11).
; Needed for in store battle, one needs to set it to 12.
;addrSuffix=12
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168.
subnet=192.168.158.0
[ds]
; Region code on the emulated AMEX board DS EEPROM.
; 1: Japan
@ -29,23 +62,16 @@ default=127.0.0.1
; NOTE: Changing this setting causes a factory reset.
region=4
[netenv]
; Simulate an ideal LAN environment. This may interfere with head-to-head play.
; SEGA games are somewhat picky about their LAN environment, so leaving this
; setting enabled is recommended.
enable=1
[gpio]
; Emulated Nu DIP switch for Distribution Server setting.
;
; 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
; The final octet of the local host's IP address on the virtualized subnet
; (so, if the keychip subnet is 192.168.32.0 and this value is set to 11,
; then the local host's virtualized LAN IP is 192.168.32.11).
; Needed for in store battle, one needs to set it to 12.
;addrSuffix=12
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168.
subnet=192.168.158.0
; -----------------------------------------------------------------------------
; Misc. hooks settings
; -----------------------------------------------------------------------------
[gfx]
; Enables the graphics hook. This is required for some Initial D Zero versions
@ -58,12 +84,9 @@ framed=1
; Select the monitor to run the game on. (Fullscreen only, 0=primary screen)
monitor=0
[gpio]
; Emulated Nu DIP switch for Distribution Server setting.
;
; 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
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL enter its path here.
@ -88,12 +111,12 @@ path=
; world. An improved solution will be provided later.
[io3]
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
; Input API selection for JVS input emulator.
; Set "xinput" to use a gamepad and "dinput" to use a steering wheel.
@ -112,6 +135,20 @@ mode=xinput
restrict=97
[xinput]
; XInput bindings
;
; Left Stick Steering
; Right Stick (Steering) when "singleStickSteering" is disabled
; Left Trigger Brake
; Right Trigger Accelerator
; Left Shoulder Shift Down
; Right Shoulder Shift Up
; Start/A Start
; Back/B View Change
; X Shift Up
; Y Shift Down
; D-Pad D-Pad
; Automatically reset the simulated shifter to Neutral when XInput Start is
; pressed (e.g. when navigating menus between races).
autoNeutral=1

View File

@ -1,18 +1,36 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=
; Insert the path to the game Option directory here (contains Axxx, Bxxx directories)
; Insert the path to the game Option directory here (contains Axxx directories)
option=
; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Enable aime reader emulation.
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1
aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected.
@ -23,12 +41,20 @@ default=127.0.0.1
; SEGA games are somewhat picky about its LAN environment, so leaving this
; setting enabled is recommended.
enable=1
; The final octet of the local host's IP address on the virtualized subnet (so,
; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the
; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
; If you disable netenv then you must set this to your LAN's IP subnet, and
; that subnet must start with 192.168.
subnet=192.168.100.0
subnet=192.168.172.0
[gpio]
; ALLS DIP switches.
@ -43,6 +69,20 @@ freeplay=0
; this to 1 on exactly one machine and set this to 0 on all others.
dipsw1=1
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
[mai2io]
; To use a custom maimai DX IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
; -----------------------------------------------------------------------------
; Input settings
; -----------------------------------------------------------------------------
@ -56,12 +96,12 @@ dipsw1=1
; world. An improved solution will be provided later.
[io4]
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
; Key bindings for buttons around screen. The default key map, depicted
; in clockwise order, is as follows:

2
dist/mai2/start.bat vendored
View File

@ -2,7 +2,7 @@
pushd %~dp0
start /min inject -d -k mai2hook.dll amdaemon.exe -f -c config_common.json config_server.json config_client.json
start "AM Daemon" /min inject -d -k mai2hook.dll amdaemon.exe -f -c config_common.json config_server.json config_client.json
inject -d -k mai2hook.dll sinmai -screen-fullscreen 0
taskkill /f /im amdaemon.exe > nul 2>&1

View File

@ -1,11 +1,35 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=amfs
amfs=
; Insert the path to the game Option directory here (contains Axxx directories)
option=
; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=appdata
option=option
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1
aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
@ -17,6 +41,14 @@ default=127.0.0.1
; SEGA games are somewhat picky about their LAN environment, so leaving this
; setting enabled is recommended.
enable=1
; The final octet of the local host's IP address on the virtualized subnet (so,
; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the
; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
@ -24,9 +56,6 @@ enable=1
; that subnet must start with 192.168.
subnet=192.168.174.0
[gfx]
enable=1
[gpio]
; ALLS DIP switches.
enable=1
@ -40,6 +69,35 @@ freeplay=0
; this to 1 on exactly one machine and set this to 0 on all others.
dipsw1=1
; -----------------------------------------------------------------------------
; Misc. hook settings
; -----------------------------------------------------------------------------
[gfx]
enable=1
; Hooks related to the touch boards
[touch]
enable=1
; Hooks related to the LED board (codenamed Elisabeth)
[elisabeth]
enable=1
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
[mercuryio]
; To use a custom WACCA IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
; -----------------------------------------------------------------------------
; Input settings
; -----------------------------------------------------------------------------
@ -53,26 +111,14 @@ dipsw1=1
; world. An improved solution will be provided later.
[io4]
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
; Volume up virtual-key code. Default is the "UP" key.
volup=0x26
; Volume down virtual-key code. Default is the "DOWN" key.
voldown=0x28
; Hooks related to the touch boards
[touch]
enable=1
; Hooks related to the LED board (codenamed Elisabeth)
[elisabeth]
enable=1
;[mercuryio]
; Use mercuryio.dll
;path=mercuryio.dll

View File

@ -4,10 +4,10 @@ pushd %~dp0
taskkill /f /im amdaemon.exe > nul 2>&1
REM USA
REM start inject -d -k mercuryhook.dll amdaemon.exe -f -c config.json config_lan_install_client.json config_lan_install_server.json config_video_clone.json config_video_dual.json config_video_clone_flip.json config_video_dual_flip.json config_region_exp.json config_region_chn.json config_region_usa.json
start "AM Daemon" /min inject -d -k mercuryhook.dll amdaemon.exe -f -c config.json config_lan_install_client.json config_lan_install_server.json config_video_clone.json config_video_dual.json config_video_clone_flip.json config_video_dual_flip.json config_region_exp.json config_region_chn.json config_region_usa.json
REM JP
start inject -d -k mercuryhook.dll amdaemon.exe -f -c config.json config_lan_install_client.json config_lan_install_server.json config_video_clone.json config_video_dual.json config_video_clone_flip.json config_video_dual_flip.json config_region_exp.json config_region_chn.json config_region_jpn.json
start "AM Daemon" /min inject -d -k mercuryhook.dll amdaemon.exe -f -c config.json config_lan_install_client.json config_lan_install_server.json config_video_clone.json config_video_dual.json config_video_clone_flip.json config_video_dual_flip.json config_region_exp.json config_region_chn.json config_region_jpn.json
inject -d -k mercuryhook.dll ../WindowsNoEditor/Mercury/Binaries/Win64/Mercury-Win64-Shipping.exe
taskkill /f /im amdaemon.exe > nul 2>&1

View File

@ -1,3 +1,7 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=
@ -8,11 +12,25 @@ option=
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Controls emulation of the Aime card reader assembly.
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1
aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected.
@ -24,6 +42,10 @@ default=127.0.0.1
; setting enabled is recommended.
enable=1
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
; If you disable netenv then you must set this to your LAN's IP subnet, and
@ -43,12 +65,26 @@ freeplay=0
; this to 1 on exactly one machine and set this to 0 on all others.
dipsw1=1
; -----------------------------------------------------------------------------
; Misc. hook settings
; -----------------------------------------------------------------------------
[gfx]
enable=1
[led15093]
; 837-15093-06 LED board emulation setting.
enable=1
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard input.
path=
[fgoio]
; To use a custom O.N.G.E.K.I. IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard/gamepad input.
path=
; -----------------------------------------------------------------------------
; Input settings
@ -63,28 +99,43 @@ enable=1
; world. An improved solution will be provided later.
[io4]
; Input API selection for JVS input emulator.
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
; Set "1" to enable mouse lever emulation, "0" to use XInput
mouse=1
; XInput input bindings
;
; Left Stick Lever
; Left Trigger Lever (move to the left)
; Right Trigger Lever (move to the right)
; Left Left red button
; Up Left green button
; Right Left blue button
; Left Shoulder Left side button
; Right Shoulder Right side button
; X Right red button
; Y Right green button
; A Right blue button
; Back Left menu button
; Start Right menu button
; Keyboard input bindings
left1=0x41 ; A
left2=0x53 ; S
left3=0x44 ; D
left2=0x53 ; S
left3=0x44 ; D
leftSide=0x01 ; Mouse Left
rightSide=0x02 ; Mouse Right
leftSide=0x01 ; Mouse Left
rightSide=0x02 ; Mouse Right
right1=0x4A ; J
right1=0x4B ; K
right3=0x4C ; L
right3=0x4C ; L
leftMenu=0x55 ; U
rightMenu=0x4F ; O
leftMenu=0x55 ; U
rightMenu=0x4F ; O

2
dist/mu3/start.bat vendored
View File

@ -2,7 +2,7 @@
pushd %~dp0
start /min inject -d -k mu3hook.dll amdaemon.exe -f -c config_common.json config_server.json config_client.json
start "AM Daemon" /min inject -d -k mu3hook.dll amdaemon.exe -f -c config_common.json config_server.json config_client.json
inject -d -k mu3hook.dll mu3 -screen-fullscreen 0 -popupwindow -screen-width 1080 -screen-height 1920
taskkill /f /im amdaemon.exe > nul 2>&1

6
dist/swdc/config_hook.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"emoney" :
{
"enable" : false
}
}

View File

@ -1,18 +1,36 @@
; -----------------------------------------------------------------------------
; Path settings
; -----------------------------------------------------------------------------
[vfs]
; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
amfs=
; Insert the path to the game Option directory here (contains OPxx directories)
; Insert the path to the game Option directory here (contains Axxx directories)
option=
; Create an empty directory somewhere and insert the path here.
; This directory may be shared between multiple SEGA games.
; NOTE: This has nothing to do with Windows %APPDATA%.
appdata=
appdata=appdata
; -----------------------------------------------------------------------------
; Device settings
; -----------------------------------------------------------------------------
[aime]
; Controls emulation of the Aime card reader assembly.
; Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
; reader.
enable=1
aimePath=DEVICE\aime.txt
[vfd]
; Enable VFD emulation (currently just stubbed). Disable to use a real VFD
; GP1232A02A FUTABA assembly.
enable=1
; -----------------------------------------------------------------------------
; Network settings
; -----------------------------------------------------------------------------
[dns]
; Insert the hostname or IP address of the server you wish to use here.
; Note that 127.0.0.1, localhost etc are specifically rejected.
@ -23,12 +41,33 @@ default=127.0.0.1
; SEGA games are somewhat picky about their LAN environment, so leaving this
; setting enabled is recommended.
enable=1
; The final octet of the local host's IP address on the virtualized subnet (so,
; if the keychip subnet is `192.168.32.0` and this value is set to `11`, then the
; local host's virtualized LAN IP is `192.168.32.11`).
addrSuffix=11
; -----------------------------------------------------------------------------
; Board settings
; -----------------------------------------------------------------------------
[keychip]
; The /24 LAN subnet that the emulated keychip will tell the game to expect.
; You must set this to your LAN's IP subnet, and that subnet must start with 192.168,
; in order to find the MAIN cabinet.
subnet=192.168.100.0
subnet=192.168.160.0
[gpio]
; ALLS DIP switches.
enable=1
; Enable freeplay mode. This will disable the coin slot and set the game to
; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not
; allow you to start a game in freeplay mode.
freeplay=0´
; -----------------------------------------------------------------------------
; Custom IO settings
; -----------------------------------------------------------------------------
[aimeio]
; To use a custom card reader IO DLL enter its path here.
@ -40,15 +79,6 @@ path=
; Leave empty if you want to use Segatools built-in gamepad/wheel input.
path=
[gpio]
; ALLS DIP switches.
enable=1
; Enable freeplay mode. This will disable the coin slot and set the game to
; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not
; allow you to start a game in freeplay mode.
freeplay=0
; -----------------------------------------------------------------------------
; Input settings
; -----------------------------------------------------------------------------
@ -62,12 +92,12 @@ freeplay=0
; world. An improved solution will be provided later.
[io4]
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
; Input API selection for IO4 input emulator.
; Set "xinput" to use a gamepad and "dinput" to use a steering wheel.
@ -86,6 +116,22 @@ mode=xinput
restrict=128
[xinput]
; XInput bindings
;
; Left Stick Steering
; Right Stick (Steering) when "singleStickSteering" is disabled
; Left Trigger Brake
; Right Trigger Accelerator
; Left Shoulder Left Paddle
; Right Shoulder Right Paddle
; Start Start
; Back View Change
; A Green (Wheel)
; B Red (Wheel)
; X Blue (Wheel)
; Y Yellow (Wheel)
; D-Pad D-Pad
; Use the left thumbstick for steering instead of both on XInput Controllers.
; Not recommended as it will not give you the precision needed for this game.
singleStickSteering=1

36
dist/swdc/start.bat vendored
View File

@ -2,12 +2,36 @@
pushd %~dp0
rem Matching Server
start /min ..\..\..\Tools\tdrserver.exe
REM start /min inject -d -k swdchook.dll amdaemon.exe -c config.json config_LanClient.json config_MiniCabinet.json config_hook.json
start /min inject -d -k swdchook.dll amdaemon.exe -c config.json config_LanServer.json config_MiniCabinet.json
REM Valid -launch parameters are "PC", "Cabinet" and "MiniCabinet
inject -d -k swdchook.dll ..\Todoroki\Binaries\Win64\Todoroki-Win64-Shipping.exe -launch=MiniCabinet -ABSLOG="..\..\..\..\..\Userdata\Todoroki.log" -UserDir="..\..\..\Userdata" -NotInstalled -UNATTENDED
REM Root directory
set ROOT_DIR=WindowsNoEditor
rem Matching Server paths
set MATCHING_SERVER_FILE_NAME=tdrserver.exe
set MATCHING_SERVER_PATH=..\Tools\%MATCHING_SERVER_FILE_NAME%
rem AM Daemon paths
set DAEMON_DIR=%ROOT_DIR%\AMDaemon
set DAEMON_CONFIG_PATH=%DAEMON_DIR%\config.json
rem Make sure to use appdata=appdata in segatools.ini
set DAEMON_CHECK_LAN_SERVER_PATH=appdata\SDDS\LanServer.dat
rem Check if LanServer.dat is present
if exist "%DAEMON_CHECK_LAN_SERVER_PATH%" (
set DAEMON_LAN_CONFIG_PATH=%DAEMON_DIR%\config_LanServer.json
start "matching_server" /min %MATCHING_SERVER_PATH%
) else (
set DAEMON_LAN_CONFIG_PATH=%DAEMON_DIR%\config_LanClient.json
)
start "AM Daemon" /min inject -d -k swdchook.dll "%DAEMON_DIR%\amdaemon.exe" -c %DAEMON_CONFIG_PATH% -c %DAEMON_LAN_CONFIG_PATH% config_hook.json
REM Launch Todoroki
set APP_EXE_DIR=WindowsNoEditor\Todoroki\Binaries\Win64
set APP_EXE_PATH=%APP_EXE_DIR%\Todoroki-Win64-Shipping.exe
REM Valid -launch parameters are "Cabinet" or "MiniCabinet"
inject -d -k swdchook.dll "%APP_EXE_PATH%" -launch="MiniCabinet" -ABSLOG="..\Userdata\Todoroki.log" -UserDir="..\Userdata" -NotInstalled -UNATTENDED
taskkill /f /im amdaemon.exe > nul 2>&1
taskkill /f /im tdrserver.exe > nul 2>&1

View File

@ -27,9 +27,9 @@ void diva_io_config_load(
assert(cfg != NULL);
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io3", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io3", L"service", '2', filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io3", L"coin", '3', filename);
cfg->vk_test = GetPrivateProfileIntW(L"io3", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io3", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io3", L"coin", VK_F3, filename);
for (i = 0 ; i < _countof(cfg->vk_buttons) ; i++) {
swprintf_s(key, _countof(key), L"key%i", i + 1);

View File

@ -31,7 +31,7 @@ Default: `1`
Enable Aime card reader assembly emulation. Disable to use a real SEGA Aime
reader (COM port number varies by game).
### `highbaud`
### `highBaud`
Default: `1`
@ -84,6 +84,17 @@ emulates an IC card in its proximity. A variety of different IC cards can be
emulated; the exact choice of card that is emulated depends on the presence or
absence of the configured card ID files.
## `[vfd]`
Controls emulation of the VFD GP1232A02A FUTABA assembly.
### `enable`
Default: `1`
Enable VFD emulation (currently just stubbed). Disable to use a real VFD
GP1232A02A FUTABA assembly (COM port number varies by game).
## `[amvideo]`
Controls the `amvideo.dll` stub built into Segatools. This is a DLL that is
@ -396,8 +407,8 @@ is an issue. Billing types are:
Default: `0x64`
An 8-bit bitfield of unclear meaning. The least significant bit indicates a
developer dongle, I think? Changing this doesn't seem to have any effect on
anything other than Project DIVA.
developer dongle. Changing this doesn't seem to have any effect on
anything other than SEGA AM2 games.
Other values observed in the wild:

View File

@ -48,7 +48,7 @@ void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename)
cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename);
cfg->port_no = GetPrivateProfileIntW(L"led15093", L"portNo", 0, filename);
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaudrate", 0, filename);
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaud", 0, filename);
cfg->fw_ver = GetPrivateProfileIntW(L"led15093", L"fwVer", 0xA0, filename);
cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xAA53, filename);
@ -116,6 +116,7 @@ void fgo_hook_config_load(
aime_config_load(&cfg->aime, filename);
dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename);
vfd_config_load(&cfg->vfd, filename);
touch_screen_config_load(&cfg->touch, filename);
printer_config_load(&cfg->printer, filename);
fgo_deck_config_load(&cfg->deck, filename);

View File

@ -20,6 +20,7 @@ struct fgo_hook_config {
struct aime_config aime;
struct dvd_config dvd;
struct io4_config io4;
struct vfd_config vfd;
struct touch_screen_config touch;
struct printer_config printer;
struct deck_config deck;

View File

@ -67,7 +67,7 @@ static DWORD CALLBACK fgo_pre_startup(void)
goto fail;
}
hr = vfd_hook_init(1);
hr = vfd_hook_init(&fgo_hook_cfg.vfd, 1);
if (FAILED(hr)) {
goto fail;

View File

@ -11,7 +11,7 @@ struct fgo_dll {
void (*get_opbtns)(uint8_t *opbtn);
void (*get_gamebtns)(uint8_t *gamebtn);
void (*get_analogs)(int16_t *stick_x, int16_t *stick_y);
HRESULT (*led_init)();
HRESULT (*led_init)(void);
void (*led_set_leds)(uint8_t board, uint8_t *rgb);
};

View File

@ -14,7 +14,7 @@ void fgo_io_config_load(
assert(cfg != NULL);
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", '2', filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", '3', filename);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", VK_F3, filename);
}

View File

@ -67,11 +67,11 @@ HRESULT fgo_io_poll(void)
fgo_gamebtn |= FGO_IO_GAMEBTN_TARGET;
}
if (xb & XINPUT_GAMEPAD_A) {
if (xb & XINPUT_GAMEPAD_A || xb & XINPUT_GAMEPAD_B) {
fgo_gamebtn |= FGO_IO_GAMEBTN_ATTACK;
}
if (xb & XINPUT_GAMEPAD_Y) {
if (xb & XINPUT_GAMEPAD_Y || xb & XINPUT_GAMEPAD_X) {
fgo_gamebtn |= FGO_IO_GAMEBTN_NOBLE_PHANTASHM;
}
@ -142,7 +142,6 @@ void fgo_io_get_analogs(int16_t *stick_x, int16_t *stick_y)
HRESULT fgo_io_led_init(void)
{
// return 0;
return S_OK;
}

View File

@ -12,9 +12,6 @@ const struct dll_bind_sym idac_dll_syms[] = {
{
.sym = "idac_io_init",
.off = offsetof(struct idac_dll, init),
}, {
.sym = "idac_io_poll",
.off = offsetof(struct idac_dll, poll),
}, {
.sym = "idac_io_get_opbtns",
.off = offsetof(struct idac_dll, get_opbtns),

View File

@ -7,7 +7,6 @@
struct idac_dll {
uint16_t api_version;
HRESULT (*init)(void);
HRESULT (*poll)(void);
void (*get_opbtns)(uint8_t *opbtn);
void (*get_gamebtns)(uint8_t *gamebtn);
void (*get_shifter)(uint8_t *gear);

View File

@ -57,7 +57,6 @@ static HRESULT idac_io4_poll(void *ctx, struct io4_state *state)
struct idac_io_analog_state analog_state;
HRESULT hr;
assert(idac_dll.poll != NULL);
assert(idac_dll.get_opbtns != NULL);
assert(idac_dll.get_gamebtns != NULL);
assert(idac_dll.get_analogs != NULL);
@ -65,13 +64,6 @@ static HRESULT idac_io4_poll(void *ctx, struct io4_state *state)
memset(state, 0, sizeof(*state));
memset(&analog_state, 0, sizeof(analog_state));
hr = idac_dll.poll();
if (FAILED(hr)) {
return hr;
}
opbtn = 0;
gamebtn = 0;
gear = 0;

View File

@ -124,9 +124,9 @@ void idac_io_config_load(struct idac_io_config *cfg, const wchar_t *filename)
assert(cfg != NULL);
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", '2', filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", '3', filename);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", VK_F3, filename);
cfg->restrict_ = GetPrivateProfileIntW(L"io4", L"restrict", 128, filename);
GetPrivateProfileStringW(

View File

@ -2,7 +2,6 @@ LIBRARY idacio
EXPORTS
idac_io_init
idac_io_poll
idac_io_get_opbtns
idac_io_get_gamebtns
idac_io_get_shifter

View File

@ -56,13 +56,6 @@ uint16_t idac_io_get_api_version(void);
HRESULT idac_io_init(void);
/* Send any queued outputs (of which there are currently none, though this may
change in subsequent API versions) and retrieve any new inputs.
Minimum API version: 0x0100 */
HRESULT idac_io_poll(void);
/* Get the state of the cabinet's operator buttons as of the last poll. See
IDAC_IO_OPBTN enum above: this contains bit mask definitions for button
states returned in *opbtn. All buttons are active-high.
@ -93,7 +86,7 @@ void idac_io_get_analogs(struct idac_io_analog_state *out);
/* Poll the current position of the six-speed shifter and return it via the
gear out parameter. Valid values are 0 for neutral and 1-6 for gears 1-6.
idzhook internally translates this gear position value into the correct
idachook internally translates this gear position value into the correct
combination of Gear Left, Gear Right, Gear Up, Gear Down buttons that the
game will then interpret as the current position of the gear lever.

View File

@ -121,9 +121,10 @@ void idz_io_config_load(struct idz_io_config *cfg, const wchar_t *filename)
assert(cfg != NULL);
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io3", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io3", L"service", '2', filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io3", L"coin", '3', filename);
/* Technically it's io4 */
cfg->vk_test = GetPrivateProfileIntW(L"io3", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io3", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io3", L"coin", VK_F3, filename);
cfg->restrict_ = GetPrivateProfileIntW(L"io3", L"restrict", 97, filename);
GetPrivateProfileStringW(

View File

@ -37,5 +37,6 @@ void mai2_hook_config_load(
aime_config_load(&cfg->aime, filename);
dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename);
vfd_config_load(&cfg->vfd, filename);
mai2_dll_config_load(&cfg->dll, filename);
}

View File

@ -15,6 +15,7 @@ struct mai2_hook_config {
struct aime_config aime;
struct dvd_config dvd;
struct io4_config io4;
struct vfd_config vfd;
struct mai2_dll_config dll;
};

View File

@ -57,7 +57,7 @@ static DWORD CALLBACK mai2_pre_startup(void)
goto fail;
}
hr = vfd_hook_init(2);
hr = vfd_hook_init(&mai2_hook_cfg.vfd, 2);
if (FAILED(hr)) {
goto fail;

View File

@ -24,9 +24,9 @@ void mai2_io_config_load(
assert(cfg != NULL);
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", '2', filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", '3', filename);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", VK_F3, filename);
for (i = 0 ; i < 9 ; i++) {
swprintf_s(key, _countof(key), L"1p_btn%i", i + 1);

View File

@ -68,6 +68,7 @@ void mercury_hook_config_load(
dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename);
gfx_config_load(&cfg->gfx, filename);
vfd_config_load(&cfg->vfd, filename);
mercury_dll_config_load(&cfg->dll, filename);
touch_config_load(&cfg->touch, filename);
elisabeth_config_load(&cfg->elisabeth, filename);

View File

@ -19,6 +19,7 @@ struct mercury_hook_config {
struct dvd_config dvd;
struct io4_config io4;
struct gfx_config gfx;
struct vfd_config vfd;
struct mercury_dll_config dll;
struct touch_config touch;
struct elisabeth_config elisabeth;

View File

@ -64,7 +64,7 @@ static DWORD CALLBACK mercury_pre_startup(void)
goto fail;
}
hr = vfd_hook_init(2);
hr = vfd_hook_init(&mercury_hook_cfg.vfd, 2);
if (FAILED(hr)) {
goto fail;

View File

@ -27,11 +27,11 @@ void mercury_io_config_load(
assert(cfg != NULL);
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", 0x2D, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", 0x2E, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", 0x24, filename);
cfg->vk_vol_up = GetPrivateProfileIntW(L"io4", L"volup", 0x26, filename);
cfg->vk_vol_down = GetPrivateProfileIntW(L"io4", L"voldown", 0x28, filename);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", VK_F3, filename);
cfg->vk_vol_up = GetPrivateProfileIntW(L"io4", L"volup", VK_UP, filename);
cfg->vk_vol_down = GetPrivateProfileIntW(L"io4", L"voldown", VK_DOWN, filename);
for (i = 0 ; i < 240 ; i++) {
swprintf_s(key, _countof(key), L"cell%i", i + 1);

View File

@ -40,5 +40,6 @@ void mu3_hook_config_load(
dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename);
gfx_config_load(&cfg->gfx, filename);
vfd_config_load(&cfg->vfd, filename);
mu3_dll_config_load(&cfg->dll, filename);
}

View File

@ -20,6 +20,7 @@ struct mu3_hook_config {
struct io4_config io4;
struct gfx_config gfx;
// struct led15093_config led15093;
struct vfd_config vfd;
struct mu3_dll_config dll;
};

View File

@ -76,7 +76,7 @@ static DWORD CALLBACK mu3_pre_startup(void)
goto fail;
}
hr = vfd_hook_init(2);
hr = vfd_hook_init(&mu3_hook_cfg.vfd, 2);
if (FAILED(hr)) {
goto fail;

View File

@ -14,9 +14,9 @@ void mu3_io_config_load(
assert(cfg != NULL);
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", '2', filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", '3', filename);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", VK_F3, filename);
cfg->use_mouse = GetPrivateProfileIntW(L"io4", L"mouse", 0, filename);

View File

@ -1,5 +1,4 @@
#include <windows.h>
#include <wincrypt.h>
#include <iphlpapi.h>
#include <stddef.h>
@ -372,9 +371,12 @@ static uint32_t WINAPI hook_GetBestRoute(
return ERROR_INVALID_PARAMETER;
}
dprintf("Netenv: GetBestRoute ip4 %x -> ip4 %x\n",
(int) _byteswap_ulong(src_ip),
(int) _byteswap_ulong(dest_ip));
uint32_t src_addr = _byteswap_ulong(src_ip);
uint32_t dest_addr = _byteswap_ulong(dest_ip);
dprintf("Netenv: GetBestRoute ip4 %u.%u.%u.%u -> ip4 %u.%u.%u.%u\n",
(src_addr >> 24) & 0xff, (src_addr >> 16) & 0xff, (src_addr >> 8) & 0xff, src_addr & 0xff,
(dest_addr >> 24) & 0xff, (dest_addr >> 16) & 0xff, (dest_addr >> 8) & 0xff, dest_addr & 0xff);
memset(route, 0, sizeof(*route));
@ -469,8 +471,10 @@ static uint32_t WINAPI hook_IcmpSendEcho2(
return 0;
}
dprintf("Netenv: Virtualized ICMP Ping to ip4 %x\n",
(int) _byteswap_ulong(DestinationAddress));
uint32_t addr = _byteswap_ulong(DestinationAddress);
dprintf("Netenv: Virtualized ICMP Ping to ip4 %u.%u.%u.%u\n",
(addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
pong = (ICMP_ECHO_REPLY *) ReplyBuffer;
memset(pong, 0, sizeof(*pong));

View File

@ -466,10 +466,10 @@ static HRESULT vfs_path_hook_option(
static HRESULT vfs_reg_read_amfs(void *bytes, uint32_t *nbytes)
{
return reg_hook_read_wstr(bytes, nbytes, vfs_config.amfs); // seems to be busted?
return reg_hook_read_wstr(bytes, nbytes, L"E:\\");
}
static HRESULT vfs_reg_read_appdata(void *bytes, uint32_t *nbytes)
{
return reg_hook_read_wstr(bytes, nbytes, vfs_config.appdata);
return reg_hook_read_wstr(bytes, nbytes, L"Y:\\");
}

View File

@ -283,7 +283,7 @@ Enable keychip emulation. Disable to use a real keychip.
Default: `A69E-01A88888888`
Keychip serial number. Keychip serials observed in the wild follow this
pattern: `A6xE-01Ayyyyyyyy`.
pattern: `A\d{2}(E01|X20)[ABCDU]\d{8}`.
### `gameId`

View File

@ -42,6 +42,7 @@ void swdc_hook_config_load(
zinput_config_load(&cfg->zinput, filename);
dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename);
vfd_config_load(&cfg->vfd, filename);
}
void zinput_config_load(struct zinput_config *cfg, const wchar_t *filename)

View File

@ -17,6 +17,7 @@ struct swdc_hook_config {
struct aime_config aime;
struct dvd_config dvd;
struct io4_config io4;
struct vfd_config vfd;
struct swdc_dll_config dll;
struct zinput_config zinput;
};

View File

@ -16,7 +16,6 @@
#include "swdchook/config.h"
#include "swdchook/swdc-dll.h"
#include "swdchook/io4.h"
#include "swdchook/zinput.h"
#include "platform/platform.h"
@ -39,7 +38,6 @@ static DWORD CALLBACK swdc_pre_startup(void)
/* Hook Win32 APIs */
serial_hook_init();
zinput_hook_init(&swdc_hook_cfg.zinput, swdc_hook_mod);
dvd_hook_init(&swdc_hook_cfg.dvd, swdc_hook_mod);
/* Initialize emulation hooks */
@ -54,30 +52,34 @@ static DWORD CALLBACK swdc_pre_startup(void)
goto fail;
}
hr = swdc_dll_init(&swdc_hook_cfg.dll, swdc_hook_mod);
if (FAILED(hr)) {
goto fail;
}
hr = sg_reader_hook_init(&swdc_hook_cfg.aime, 3, 3, swdc_hook_mod);
if (FAILED(hr)) {
goto fail;
}
hr = vfd_hook_init(4);
hr = vfd_hook_init(&swdc_hook_cfg.vfd, 4);
if (FAILED(hr)) {
return hr;
}
hr = swdc_dll_init(&swdc_hook_cfg.dll, swdc_hook_mod);
if (FAILED(hr)) {
goto fail;
}
hr = swdc_io4_hook_init(&swdc_hook_cfg.io4);
if (FAILED(hr)) {
goto fail;
}
/* Hook external DLL APIs */
zinput_hook_init(&swdc_hook_cfg.zinput);
/* Initialize debug helpers */
spike_hook_init(L".\\segatools.ini");

View File

@ -6,9 +6,13 @@
#include "board/io4.h"
#include "util/dprintf.h"
#include "swdchook/swdc-dll.h"
#include "util/dprintf.h"
static HANDLE mmf;
static HRESULT init_mmf(void);
static void swdc_set_gamebtns(uint16_t value);
static HRESULT swdc_io4_poll(void *ctx, struct io4_state *state);
static uint16_t coins;
@ -17,8 +21,7 @@ static const struct io4_ops swdc_io4_ops = {
.poll = swdc_io4_poll,
};
HRESULT swdc_io4_hook_init(const struct io4_config *cfg)
{
HRESULT swdc_io4_hook_init(const struct io4_config *cfg) {
HRESULT hr;
assert(swdc_dll.init != NULL);
@ -29,30 +32,54 @@ HRESULT swdc_io4_hook_init(const struct io4_config *cfg)
return hr;
}
hr = init_mmf();
if (FAILED(hr)) {
return hr;
}
return swdc_dll.init();
}
static HRESULT swdc_io4_poll(void *ctx, struct io4_state *state)
{
// Function to initialize the memory-mapped file
static HRESULT init_mmf(void) {
mmf = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 2, "SWDCButton");
if (mmf == NULL) {
return S_FALSE;
}
swdc_set_gamebtns(0);
return S_OK;
}
void swdc_set_gamebtns(uint16_t value) {
// WaitForSingleObject(mutex, INFINITE);
// Update the memory-mapped file
LPVOID mmf_view = MapViewOfFile(mmf, FILE_MAP_ALL_ACCESS, 0, 0, 2);
if (mmf_view != NULL) {
uint16_t* ptr = (uint16_t*)mmf_view;
*ptr = value;
UnmapViewOfFile(mmf_view);
}
// ReleaseMutex(mutex);
}
static HRESULT swdc_io4_poll(void *ctx, struct io4_state *state) {
uint8_t opbtn;
uint16_t gamebtn;
struct swdc_io_analog_state analog_state;
HRESULT hr;
assert(swdc_dll.poll != NULL);
assert(swdc_dll.get_opbtns != NULL);
assert(swdc_dll.get_gamebtns != NULL);
assert(swdc_dll.get_analogs != NULL);
memset(state, 0, sizeof(*state));
memset(&analog_state, 0, sizeof(analog_state));
hr = swdc_dll.poll();
if (FAILED(hr)) {
return hr;
}
opbtn = 0;
gamebtn = 0;
@ -99,7 +126,17 @@ static HRESULT swdc_io4_poll(void *ctx, struct io4_state *state)
state->buttons[0] |= 1 << 2;
}
/* Update steering wheel buttons */
/*
Update steering wheel buttons
Those are connected to the SEGA 838-15415 INDICATOR BD MAIN
USB board which is not emulated for now. So those buttons
are hooked to the built-in XInput support.
*/
/* Instead update gamebtns for the file mapping */
swdc_set_gamebtns(gamebtn);
if (gamebtn & SWDC_IO_GAMEBTN_STEERING_BLUE) {
state->buttons[1] |= 1 << 15;

View File

@ -12,9 +12,6 @@ const struct dll_bind_sym swdc_dll_syms[] = {
{
.sym = "swdc_io_init",
.off = offsetof(struct swdc_dll, init),
}, {
.sym = "swdc_io_poll",
.off = offsetof(struct swdc_dll, poll),
}, {
.sym = "swdc_io_get_opbtns",
.off = offsetof(struct swdc_dll, get_opbtns),

View File

@ -7,7 +7,6 @@
struct swdc_dll {
uint16_t api_version;
HRESULT (*init)(void);
HRESULT (*poll)(void);
void (*get_opbtns)(uint8_t *opbtn);
void (*get_gamebtns)(uint16_t *gamebtn);
void (*get_analogs)(struct swdc_io_analog_state *out);

View File

@ -13,7 +13,6 @@ EXPORTS
amDllVideoSetResolution @3
swdc_io_get_api_version
swdc_io_init
swdc_io_poll
swdc_io_get_opbtns
swdc_io_get_gamebtns
swdc_io_get_analogs

View File

@ -1,31 +1,61 @@
#include <windows.h>
#include <xinput.h>
#include <shlwapi.h>
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <xinput.h>
#include "board/io4.h"
#include "hook/table.h"
#include "util/dprintf.h"
#include "util/lib.h"
#include "swdchook/config.h"
#include "swdchook/zinput.h"
#include "hook/table.h"
static struct zinput_config zinput_config;
static bool zinput_hook_initted;
static bool zinput_controller_init = false;
#include "util/dprintf.h"
static HRESULT init_mmf(void);
static HANDLE mmf;
static uint16_t* swdc_gamebtn;
/* Hooked functions */
DWORD WINAPI hook_XInputGetState(DWORD dwUserIndex, XINPUT_STATE *pState);
DWORD WINAPI hook_XInputSetState(DWORD dwUserIndex, XINPUT_VIBRATION *pVibration);
// Not needed for now?
DWORD WINAPI hook_XInputGetCapabilities(DWORD dwUserIndex, DWORD dwFlags, XINPUT_CAPABILITIES *pCapabilities);
static const struct hook_symbol zinput_hook_syms[] = {
// Yup SEGA imports XInput functions via ordinal. FUN!
static struct hook_symbol zinput_hook_syms[] = {
{
.name = "XInputGetState",
.patch = hook_XInputGetState,
.link = NULL
.name = "XInputGetState",
.ordinal = 0x0002,
.patch = hook_XInputGetState,
.link = NULL
}, {
.name = "XInputSetState",
.ordinal = 0x0003,
.patch = hook_XInputSetState,
.link = NULL
}, {
// Not needed for now?
.name = "XInputGetCapabilities",
.patch = hook_XInputGetCapabilities,
.link = NULL
},
};
static struct zinput_config zinput_config;
static bool zinput_hook_initted;
void zinput_hook_init(struct zinput_config *cfg, HINSTANCE self)
void zinput_hook_init(struct zinput_config *cfg)
{
wchar_t *module_path;
wchar_t *file_name;
assert(cfg != NULL);
if (!cfg->enable) {
@ -36,45 +66,149 @@ void zinput_hook_init(struct zinput_config *cfg, HINSTANCE self)
return;
}
memcpy(&zinput_config, cfg, sizeof(*cfg));
hook_table_apply(
NULL,
"XINPUT9_1_0.dll",
zinput_hook_syms,
_countof(zinput_hook_syms));
module_path = module_file_name(NULL);
if (module_path != NULL) {
file_name = PathFindFileNameW(module_path);
free(module_path);
module_path = NULL;
_wcslwr(file_name);
if (wcsstr(file_name, L"amdaemon") != NULL) {
// dprintf("Executable filename contains 'amdaemon', disabling zinput\n");
return;
}
}
hook_table_apply(
NULL,
"XINPUT1_1.dll",
zinput_hook_syms,
_countof(zinput_hook_syms));
NULL,
"XINPUT1_3.dll",
zinput_hook_syms,
_countof(zinput_hook_syms));
hook_table_apply(
NULL,
"XINPUT1_2.dll",
zinput_hook_syms,
_countof(zinput_hook_syms));
hook_table_apply(
NULL,
"XINPUT1_3.dll",
zinput_hook_syms,
_countof(zinput_hook_syms));
hook_table_apply(
NULL,
"XINPUT1_4.dll",
zinput_hook_syms,
_countof(zinput_hook_syms));
if (FAILED(init_mmf())) {
return;
}
zinput_hook_initted = true;
dprintf("ZInput: Blocking built-in XInput support\n");
dprintf("ZInput: Hooking built-in XInput support\n");
}
DWORD WINAPI hook_XInputGetState(DWORD dwUserIndex, XINPUT_STATE *pState)
{
bool zinput_connect_controller(bool enable) {
zinput_controller_init = enable;
dprintf("zinput_connect_controller\n");
return true;
}
static HRESULT init_mmf(void) {
// Create or open memory-mapped file
mmf = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 2, "SWDCButton");
if (mmf == NULL) {
return S_FALSE;
}
// Map the memory-mapped file
swdc_gamebtn = (uint16_t*)MapViewOfFile(mmf, FILE_MAP_ALL_ACCESS, 0, 0, 2);
return S_OK;
}
DWORD WINAPI hook_XInputGetCapabilities(DWORD dwUserIndex, DWORD dwFlags, XINPUT_CAPABILITIES *pCapabilities) {
// dprintf("ZInput: XInputGetCapabilities hook hit\n");
if (!zinput_controller_init) {
zinput_connect_controller(true);
}
if (dwFlags > XINPUT_FLAG_GAMEPAD) {
return ERROR_BAD_ARGUMENTS;
}
if (zinput_controller_init && dwUserIndex == 0) {
pCapabilities->Flags = XINPUT_CAPS_VOICE_SUPPORTED;
pCapabilities->Type = XINPUT_DEVTYPE_GAMEPAD;
pCapabilities->SubType = XINPUT_DEVSUBTYPE_GAMEPAD;
pCapabilities->Gamepad.wButtons = 0xF3FF;
pCapabilities->Gamepad.bLeftTrigger = 0xFF;
pCapabilities->Gamepad.bRightTrigger = 0xFF;
pCapabilities->Gamepad.sThumbLX = (SHORT)0xFFC0;
pCapabilities->Gamepad.sThumbLY = (SHORT)0xFFC0;
pCapabilities->Gamepad.sThumbRX = (SHORT)0xFFC0;
pCapabilities->Gamepad.sThumbRY = (SHORT)0xFFC0;
pCapabilities->Vibration.wLeftMotorSpeed = 0xFF;
pCapabilities->Vibration.wRightMotorSpeed = 0xFF;
return ERROR_SUCCESS;
} else {
return ERROR_DEVICE_NOT_CONNECTED;
}
}
DWORD WINAPI hook_XInputGetState(DWORD dwUserIndex, XINPUT_STATE *pState) {
// dprintf("ZInput: XInputGetState hook hit\n");
return ERROR_SUCCESS;
if (!zinput_controller_init) {
zinput_connect_controller(true);
}
if (zinput_controller_init && dwUserIndex == 0) {
XINPUT_GAMEPAD gamepad_state = {0};
gamepad_state.wButtons = 0;
/* Read filemapping for for the gamebtns */
if (*swdc_gamebtn & SWDC_IO_GAMEBTN_STEERING_PADDLE_LEFT) {
gamepad_state.wButtons |= XINPUT_GAMEPAD_LEFT_SHOULDER;
}
if (*swdc_gamebtn & SWDC_IO_GAMEBTN_STEERING_PADDLE_RIGHT) {
gamepad_state.wButtons |= XINPUT_GAMEPAD_RIGHT_SHOULDER;
}
if (*swdc_gamebtn & SWDC_IO_GAMEBTN_STEERING_BLUE) {
gamepad_state.wButtons |= XINPUT_GAMEPAD_X;
}
if (*swdc_gamebtn & SWDC_IO_GAMEBTN_STEERING_RED) {
gamepad_state.wButtons |= XINPUT_GAMEPAD_B;
}
if (*swdc_gamebtn & SWDC_IO_GAMEBTN_STEERING_GREEN) {
gamepad_state.wButtons |= XINPUT_GAMEPAD_A;
}
if (*swdc_gamebtn & SWDC_IO_GAMEBTN_STEERING_YELLOW) {
gamepad_state.wButtons |= XINPUT_GAMEPAD_Y;
}
if (pState->dwPacketNumber == UINT_MAX)
pState->dwPacketNumber = 0;
else
pState->dwPacketNumber++;
pState->Gamepad = gamepad_state;
return ERROR_SUCCESS;
} else {
return ERROR_DEVICE_NOT_CONNECTED;
}
}
DWORD WINAPI hook_XInputSetState(DWORD dwUserIndex, XINPUT_VIBRATION *pVibration) {
// dprintf("ZInput: XInputSetState hook hit\n");
if (!zinput_controller_init) {
zinput_connect_controller(true);
}
if (zinput_controller_init && dwUserIndex == 0) {
return ERROR_SUCCESS;
} else {
return ERROR_DEVICE_NOT_CONNECTED;
}
}

View File

@ -8,4 +8,4 @@ struct zinput_config {
bool enable;
};
void zinput_hook_init(struct zinput_config *cfg, HINSTANCE self);
void zinput_hook_init(struct zinput_config *cfg);

View File

@ -112,9 +112,9 @@ void swdc_io_config_load(struct swdc_io_config *cfg, const wchar_t *filename)
assert(cfg != NULL);
assert(filename != NULL);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", '2', filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", '3', filename);
cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", VK_F1, filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", VK_F2, filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", VK_F3, filename);
cfg->restrict_ = GetPrivateProfileIntW(L"io4", L"restrict", 128, filename);
GetPrivateProfileStringW(

View File

@ -28,9 +28,6 @@ static BOOL CALLBACK swdc_di_enum_callback(
static BOOL CALLBACK swdc_di_enum_callback_pedals(
const DIDEVICEINSTANCEW *dev,
void *ctx);
static BOOL CALLBACK swdc_di_enum_callback_shifter(
const DIDEVICEINSTANCEW *dev,
void *ctx);
static void swdc_di_get_buttons(uint16_t *gamebtn_out);
static uint8_t swdc_di_decode_pov(DWORD pov);
static void swdc_di_get_analogs(struct swdc_io_analog_state *out);
@ -411,7 +408,7 @@ static BOOL CALLBACK swdc_di_enum_callback_pedals(
static void swdc_di_get_buttons(uint16_t *gamebtn_out)
{
union swdc_di_state state;
uint8_t gamebtn;
uint16_t gamebtn;
HRESULT hr;
assert(gamebtn_out != NULL);

View File

@ -2,7 +2,6 @@ LIBRARY swdcio
EXPORTS
swdc_io_init
swdc_io_poll
swdc_io_get_opbtns
swdc_io_get_gamebtns
swdc_io_get_analogs

View File

@ -55,7 +55,7 @@ struct swdc_io_analog_state {
uint16_t swdc_io_get_api_version(void);
/* Initialize the IO DLL. This is the second function that will be called on
your DLL, after mu3_io_get_api_version.
your DLL, after SWDC_io_get_api_version.
All subsequent calls to this API may originate from arbitrary threads.
@ -63,15 +63,8 @@ uint16_t swdc_io_get_api_version(void);
HRESULT swdc_io_init(void);
/* Send any queued outputs (of which there are currently none, though this may
change in subsequent API versions) and retrieve any new inputs.
Minimum API version: 0x0100 */
HRESULT swdc_io_poll(void);
/* Get the state of the cabinet's operator buttons as of the last poll. See
MU3_IO_OPBTN enum above: this contains bit mask definitions for button
SWDC_IO_OPBTN enum above: this contains bit mask definitions for button
states returned in *opbtn. All buttons are active-high.
Minimum API version: 0x0100 */
@ -79,7 +72,7 @@ HRESULT swdc_io_poll(void);
void swdc_io_get_opbtns(uint8_t *opbtn);
/* Get the state of the cabinet's gameplay buttons as of the last poll. See
MU3_IO_GAMEBTN enum above for bit mask definitions. Inputs are split into
SWDC_IO_GAMEBTN enum above for bit mask definitions. Inputs are split into
a left hand side set of inputs and a right hand side set of inputs: the bit
mappings are the same in both cases.