From 80718104f6c2de9f42426cc27e5765f59b6ad592 Mon Sep 17 00:00:00 2001 From: Dniel97 Date: Tue, 5 Sep 2023 00:23:17 +0200 Subject: [PATCH] swdc: updated config, fixed start.bat --- dist/swdc/segatools.ini | 23 +++++++++++------------ dist/swdc/start.bat | 18 +----------------- swdcio/config.c | 21 +++------------------ swdcio/config.h | 12 ++---------- swdcio/di.c | 24 ++++++++++++------------ 5 files changed, 29 insertions(+), 69 deletions(-) diff --git a/dist/swdc/segatools.ini b/dist/swdc/segatools.ini index 2f3ca91..4f2ff03 100644 --- a/dist/swdc/segatools.ini +++ b/dist/swdc/segatools.ini @@ -90,7 +90,7 @@ restrict=128 [dinput] ; Name of the DirectInput wheel to use (or any text that occurs in its name) -; Example: TMX +; Example: G29 ; ; If this is left blank then the first DirectInput device will be used. deviceName= @@ -99,22 +99,21 @@ deviceName= ; X, Y, Z, RX, RY, RZ, U, V ; ; (U and V are old names for Slider 1 and Slider 2). -; The examples below are valid for a Thrustmaster TMX. +; The examples below are valid for a Logitech G29. brakeAxis=RZ accelAxis=Y ; DirectInput button numbers to map to menu inputs. Note that buttons are ; numbered from 1; some software numbers buttons from 0. -start=3 -viewChg=10 -; Button mappings for the steering wheel paddles. Note shiftDn is the -; left paddle and shiftUp is the right paddle. -shiftDn=1 -shiftUp=2 +start=1 +viewChg=2 +; Button mappings for the steering wheel paddles. +paddleLeft=6 +paddleRight=5 ; Button mappings for the steering wheel buttons. -wheelGreen=4 -wheelRed=5 -wheelBlue=6 -wheelYellow=7 +wheelRed=7 +wheelBlue=8 +wheelYellow=9 +wheelGreen=10 ; Invert the accelerator and or brake axis ; (Needed when using DirectInput for the Dualshock 4 for example) reverseAccelAxis=0 diff --git a/dist/swdc/start.bat b/dist/swdc/start.bat index b06b6e0..526cfdc 100644 --- a/dist/swdc/start.bat +++ b/dist/swdc/start.bat @@ -2,28 +2,12 @@ pushd %~dp0 -REM set the APP_DIR to the Y drive -set APP_DIR=Y:\SWDC - -REM create the APP_DIR if it doesn't exist and redirect it to the TEMP folder -if not exist "%APP_DIR%" ( - subst Y: %TEMP% - REM timeout /t 1 - if not exist "%APP_DIR%" ( - mkdir "%APP_DIR%" - ) -) - -echo Mounted the Y:\ drive to the %TEMP%\SWDC folder - 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 config_hook.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 taskkill /f /im amdaemon.exe > nul 2>&1 -REM unmount the APP_DIR -subst Y: /d > nul 2>&1 - echo. echo Game processes have terminated pause \ No newline at end of file diff --git a/swdcio/config.c b/swdcio/config.c index 770240f..6fdd659 100644 --- a/swdcio/config.c +++ b/swdcio/config.c @@ -42,8 +42,8 @@ void swdc_di_config_load(struct swdc_di_config *cfg, const wchar_t *filename) cfg->start = GetPrivateProfileIntW(L"dinput", L"start", 0, filename); cfg->view_chg = GetPrivateProfileIntW(L"dinput", L"viewChg", 0, filename); - cfg->shift_dn = GetPrivateProfileIntW(L"dinput", L"shiftDn", 0, filename); - cfg->shift_up = GetPrivateProfileIntW(L"dinput", L"shiftUp", 0, filename); + cfg->paddle_left = GetPrivateProfileIntW(L"dinput", L"paddleLeft", 0, filename); + cfg->paddle_right = GetPrivateProfileIntW(L"dinput", L"paddleRight", 0, filename); cfg->wheel_green = GetPrivateProfileIntW(L"dinput", L"wheelGreen", 0, filename); cfg->wheel_red = GetPrivateProfileIntW(L"dinput", L"wheelRed", 0, filename); cfg->wheel_blue = GetPrivateProfileIntW(L"dinput", L"wheelBlue", 0, filename); @@ -99,7 +99,7 @@ void swdc_io_config_load(struct swdc_io_config *cfg, const wchar_t *filename) 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->restrict_ = GetPrivateProfileIntW(L"io4", L"restrict", 97, filename); + cfg->restrict_ = GetPrivateProfileIntW(L"io4", L"restrict", 128, filename); GetPrivateProfileStringW( L"io4", @@ -109,21 +109,6 @@ void swdc_io_config_load(struct swdc_io_config *cfg, const wchar_t *filename) _countof(cfg->mode), filename); - swdc_shifter_config_load(&cfg->shifter, filename); swdc_di_config_load(&cfg->di, filename); swdc_xi_config_load(&cfg->xi, filename); } - -void swdc_shifter_config_load( - struct swdc_shifter_config *cfg, - const wchar_t *filename) -{ - assert(cfg != NULL); - assert(filename != NULL); - - cfg->auto_neutral = GetPrivateProfileIntW( - L"io4", - L"autoNeutral", - 0, - filename); -} diff --git a/swdcio/config.h b/swdcio/config.h index 1b09380..c878d58 100644 --- a/swdcio/config.h +++ b/swdcio/config.h @@ -4,18 +4,14 @@ #include #include -struct swdc_shifter_config { - bool auto_neutral; -}; - struct swdc_di_config { wchar_t device_name[64]; wchar_t brake_axis[16]; wchar_t accel_axis[16]; uint8_t start; uint8_t view_chg; - uint8_t shift_dn; - uint8_t shift_up; + uint8_t paddle_left; + uint8_t paddle_right; uint8_t wheel_green; uint8_t wheel_red; uint8_t wheel_blue; @@ -37,7 +33,6 @@ struct swdc_io_config { uint8_t vk_coin; wchar_t mode[8]; int restrict_; - struct swdc_shifter_config shifter; struct swdc_di_config di; struct swdc_xi_config xi; }; @@ -45,6 +40,3 @@ struct swdc_io_config { void swdc_di_config_load(struct swdc_di_config *cfg, const wchar_t *filename); void swdc_xi_config_load(struct swdc_xi_config *cfg, const wchar_t *filename); void swdc_io_config_load(struct swdc_io_config *cfg, const wchar_t *filename); -void swdc_shifter_config_load( - struct swdc_shifter_config *cfg, - const wchar_t *filename); diff --git a/swdcio/di.c b/swdcio/di.c index 0fd0118..2fc7bc1 100644 --- a/swdcio/di.c +++ b/swdcio/di.c @@ -55,8 +55,8 @@ static IDirectInputDevice8W *swdc_di_dev; static IDirectInputEffect *swdc_di_fx; static size_t swdc_di_off_brake; static size_t swdc_di_off_accel; -static uint8_t swdc_di_shift_dn; -static uint8_t swdc_di_shift_up; +static uint8_t swdc_di_paddle_left; +static uint8_t swdc_di_paddle_right; static uint8_t swdc_di_view_chg; static uint8_t swdc_di_start; static uint8_t swdc_di_wheel_green; @@ -205,14 +205,14 @@ static HRESULT swdc_di_config_apply(const struct swdc_di_config *cfg) return E_INVALIDARG; } - if (cfg->shift_dn > 32) { - dprintf("Wheel: Invalid shift down button: %i\n", cfg->shift_dn); + if (cfg->paddle_left > 32) { + dprintf("Wheel: Invalid left paddle button: %i\n", cfg->paddle_left); return E_INVALIDARG; } - if (cfg->shift_up > 32) { - dprintf("Wheel: Invalid shift up button: %i\n", cfg->shift_up); + if (cfg->paddle_right > 32) { + dprintf("Wheel: Invalid right paddle button: %i\n", cfg->paddle_right); return E_INVALIDARG; } @@ -250,8 +250,8 @@ static HRESULT swdc_di_config_apply(const struct swdc_di_config *cfg) dprintf("Wheel: Accel axis . . . . . . : %S\n", accel_axis->name); dprintf("Wheel: Start button . . . . . : %i\n", cfg->start); dprintf("Wheel: View Change button . . : %i\n", cfg->view_chg); - dprintf("Wheel: Shift Down button . . : %i\n", cfg->shift_dn); - dprintf("Wheel: Shift Up button . . . : %i\n", cfg->shift_up); + dprintf("Wheel: Paddle Left button . . : %i\n", cfg->paddle_left); + dprintf("Wheel: Paddle Right button . : %i\n", cfg->paddle_right); dprintf("Wheel: Steering Green button : %i\n", cfg->wheel_green); dprintf("Wheel: Steering Red button . : %i\n", cfg->wheel_red); dprintf("Wheel: Steering Blue button . : %i\n", cfg->wheel_blue); @@ -264,8 +264,8 @@ static HRESULT swdc_di_config_apply(const struct swdc_di_config *cfg) swdc_di_off_accel = accel_axis->off; swdc_di_start = cfg->start; swdc_di_view_chg = cfg->view_chg; - swdc_di_shift_dn = cfg->shift_dn; - swdc_di_shift_up = cfg->shift_up; + swdc_di_paddle_left = cfg->paddle_left; + swdc_di_paddle_right = cfg->paddle_right; swdc_di_wheel_green = cfg->wheel_green; swdc_di_wheel_red = cfg->wheel_red; swdc_di_wheel_blue = cfg->wheel_blue; @@ -344,11 +344,11 @@ static void swdc_di_get_buttons(uint16_t *gamebtn_out) gamebtn |= SWDC_IO_GAMEBTN_VIEW_CHANGE; } - if (swdc_di_shift_dn && state.st.rgbButtons[swdc_di_shift_dn - 1]) { + if (swdc_di_paddle_left && state.st.rgbButtons[swdc_di_paddle_left - 1]) { gamebtn |= SWDC_IO_GAMEBTN_STEERING_PADDLE_LEFT; } - if (swdc_di_shift_up && state.st.rgbButtons[swdc_di_shift_up - 1]) { + if (swdc_di_paddle_right && state.st.rgbButtons[swdc_di_paddle_right - 1]) { gamebtn |= SWDC_IO_GAMEBTN_STEERING_PADDLE_RIGHT; }