swdc: updated config, fixed start.bat

This commit is contained in:
Dniel97 2023-09-05 00:23:17 +02:00
parent eb2eef927a
commit 80718104f6
Signed by untrusted user: Dniel97
GPG Key ID: 6180B3C768FB2E08
5 changed files with 29 additions and 69 deletions

View File

@ -90,7 +90,7 @@ restrict=128
[dinput] [dinput]
; Name of the DirectInput wheel to use (or any text that occurs in its name) ; 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. ; If this is left blank then the first DirectInput device will be used.
deviceName= deviceName=
@ -99,22 +99,21 @@ deviceName=
; X, Y, Z, RX, RY, RZ, U, V ; X, Y, Z, RX, RY, RZ, U, V
; ;
; (U and V are old names for Slider 1 and Slider 2). ; (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 brakeAxis=RZ
accelAxis=Y accelAxis=Y
; DirectInput button numbers to map to menu inputs. Note that buttons are ; DirectInput button numbers to map to menu inputs. Note that buttons are
; numbered from 1; some software numbers buttons from 0. ; numbered from 1; some software numbers buttons from 0.
start=3 start=1
viewChg=10 viewChg=2
; Button mappings for the steering wheel paddles. Note shiftDn is the ; Button mappings for the steering wheel paddles.
; left paddle and shiftUp is the right paddle. paddleLeft=6
shiftDn=1 paddleRight=5
shiftUp=2
; Button mappings for the steering wheel buttons. ; Button mappings for the steering wheel buttons.
wheelGreen=4 wheelRed=7
wheelRed=5 wheelBlue=8
wheelBlue=6 wheelYellow=9
wheelYellow=7 wheelGreen=10
; Invert the accelerator and or brake axis ; Invert the accelerator and or brake axis
; (Needed when using DirectInput for the Dualshock 4 for example) ; (Needed when using DirectInput for the Dualshock 4 for example)
reverseAccelAxis=0 reverseAccelAxis=0

18
dist/swdc/start.bat vendored
View File

@ -2,28 +2,12 @@
pushd %~dp0 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 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 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 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 taskkill /f /im amdaemon.exe > nul 2>&1
REM unmount the APP_DIR
subst Y: /d > nul 2>&1
echo. echo.
echo Game processes have terminated echo Game processes have terminated
pause pause

View File

@ -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->start = GetPrivateProfileIntW(L"dinput", L"start", 0, filename);
cfg->view_chg = GetPrivateProfileIntW(L"dinput", L"viewChg", 0, filename); cfg->view_chg = GetPrivateProfileIntW(L"dinput", L"viewChg", 0, filename);
cfg->shift_dn = GetPrivateProfileIntW(L"dinput", L"shiftDn", 0, filename); cfg->paddle_left = GetPrivateProfileIntW(L"dinput", L"paddleLeft", 0, filename);
cfg->shift_up = GetPrivateProfileIntW(L"dinput", L"shiftUp", 0, filename); cfg->paddle_right = GetPrivateProfileIntW(L"dinput", L"paddleRight", 0, filename);
cfg->wheel_green = GetPrivateProfileIntW(L"dinput", L"wheelGreen", 0, filename); cfg->wheel_green = GetPrivateProfileIntW(L"dinput", L"wheelGreen", 0, filename);
cfg->wheel_red = GetPrivateProfileIntW(L"dinput", L"wheelRed", 0, filename); cfg->wheel_red = GetPrivateProfileIntW(L"dinput", L"wheelRed", 0, filename);
cfg->wheel_blue = GetPrivateProfileIntW(L"dinput", L"wheelBlue", 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_test = GetPrivateProfileIntW(L"io4", L"test", '1', filename);
cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", '2', filename); cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", '2', filename);
cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", '3', 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( GetPrivateProfileStringW(
L"io4", L"io4",
@ -109,21 +109,6 @@ void swdc_io_config_load(struct swdc_io_config *cfg, const wchar_t *filename)
_countof(cfg->mode), _countof(cfg->mode),
filename); filename);
swdc_shifter_config_load(&cfg->shifter, filename);
swdc_di_config_load(&cfg->di, filename); swdc_di_config_load(&cfg->di, filename);
swdc_xi_config_load(&cfg->xi, 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);
}

View File

@ -4,18 +4,14 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
struct swdc_shifter_config {
bool auto_neutral;
};
struct swdc_di_config { struct swdc_di_config {
wchar_t device_name[64]; wchar_t device_name[64];
wchar_t brake_axis[16]; wchar_t brake_axis[16];
wchar_t accel_axis[16]; wchar_t accel_axis[16];
uint8_t start; uint8_t start;
uint8_t view_chg; uint8_t view_chg;
uint8_t shift_dn; uint8_t paddle_left;
uint8_t shift_up; uint8_t paddle_right;
uint8_t wheel_green; uint8_t wheel_green;
uint8_t wheel_red; uint8_t wheel_red;
uint8_t wheel_blue; uint8_t wheel_blue;
@ -37,7 +33,6 @@ struct swdc_io_config {
uint8_t vk_coin; uint8_t vk_coin;
wchar_t mode[8]; wchar_t mode[8];
int restrict_; int restrict_;
struct swdc_shifter_config shifter;
struct swdc_di_config di; struct swdc_di_config di;
struct swdc_xi_config xi; 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_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_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_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);

View File

@ -55,8 +55,8 @@ static IDirectInputDevice8W *swdc_di_dev;
static IDirectInputEffect *swdc_di_fx; static IDirectInputEffect *swdc_di_fx;
static size_t swdc_di_off_brake; static size_t swdc_di_off_brake;
static size_t swdc_di_off_accel; static size_t swdc_di_off_accel;
static uint8_t swdc_di_shift_dn; static uint8_t swdc_di_paddle_left;
static uint8_t swdc_di_shift_up; static uint8_t swdc_di_paddle_right;
static uint8_t swdc_di_view_chg; static uint8_t swdc_di_view_chg;
static uint8_t swdc_di_start; static uint8_t swdc_di_start;
static uint8_t swdc_di_wheel_green; 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; return E_INVALIDARG;
} }
if (cfg->shift_dn > 32) { if (cfg->paddle_left > 32) {
dprintf("Wheel: Invalid shift down button: %i\n", cfg->shift_dn); dprintf("Wheel: Invalid left paddle button: %i\n", cfg->paddle_left);
return E_INVALIDARG; return E_INVALIDARG;
} }
if (cfg->shift_up > 32) { if (cfg->paddle_right > 32) {
dprintf("Wheel: Invalid shift up button: %i\n", cfg->shift_up); dprintf("Wheel: Invalid right paddle button: %i\n", cfg->paddle_right);
return E_INVALIDARG; 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: Accel axis . . . . . . : %S\n", accel_axis->name);
dprintf("Wheel: Start button . . . . . : %i\n", cfg->start); dprintf("Wheel: Start button . . . . . : %i\n", cfg->start);
dprintf("Wheel: View Change button . . : %i\n", cfg->view_chg); dprintf("Wheel: View Change button . . : %i\n", cfg->view_chg);
dprintf("Wheel: Shift Down button . . : %i\n", cfg->shift_dn); dprintf("Wheel: Paddle Left button . . : %i\n", cfg->paddle_left);
dprintf("Wheel: Shift Up button . . . : %i\n", cfg->shift_up); dprintf("Wheel: Paddle Right button . : %i\n", cfg->paddle_right);
dprintf("Wheel: Steering Green button : %i\n", cfg->wheel_green); dprintf("Wheel: Steering Green button : %i\n", cfg->wheel_green);
dprintf("Wheel: Steering Red button . : %i\n", cfg->wheel_red); dprintf("Wheel: Steering Red button . : %i\n", cfg->wheel_red);
dprintf("Wheel: Steering Blue button . : %i\n", cfg->wheel_blue); 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_off_accel = accel_axis->off;
swdc_di_start = cfg->start; swdc_di_start = cfg->start;
swdc_di_view_chg = cfg->view_chg; swdc_di_view_chg = cfg->view_chg;
swdc_di_shift_dn = cfg->shift_dn; swdc_di_paddle_left = cfg->paddle_left;
swdc_di_shift_up = cfg->shift_up; swdc_di_paddle_right = cfg->paddle_right;
swdc_di_wheel_green = cfg->wheel_green; swdc_di_wheel_green = cfg->wheel_green;
swdc_di_wheel_red = cfg->wheel_red; swdc_di_wheel_red = cfg->wheel_red;
swdc_di_wheel_blue = cfg->wheel_blue; 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; 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; 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; gamebtn |= SWDC_IO_GAMEBTN_STEERING_PADDLE_RIGHT;
} }