swdc: updated config, fixed start.bat

This commit is contained in:
2023-09-05 00:23:17 +02:00
parent eb2eef927a
commit 80718104f6
5 changed files with 29 additions and 69 deletions

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->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);
}

View File

@ -4,18 +4,14 @@
#include <stddef.h>
#include <stdint.h>
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);

View File

@ -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;
}