mirror of
https://gitea.tendokyu.moe/Hay1tsme/segatools.git
synced 2026-08-27 06:14:32 -05:00
idz, swdc: add up/down/left/right DInput button config
This commit is contained in:
8
dist/idz/segatools.ini
vendored
8
dist/idz/segatools.ini
vendored
@@ -230,6 +230,14 @@ accelAxis=Y
|
||||
; numbered from 1; some software numbers buttons from 0.
|
||||
start=1
|
||||
viewChg=2
|
||||
; DPad is already emulated, but in order to trigger "Time Up" and exit the
|
||||
; course you need to press both left and right on the DPad at the same time.
|
||||
; This is not possible on most devices, so we set the left and right button again.
|
||||
left=7
|
||||
right=8
|
||||
; Additional mapping for up and down buttons in DPad.
|
||||
up=4
|
||||
down=3
|
||||
; Button mappings for the simulated six-speed shifter.
|
||||
shiftDn=5
|
||||
shiftUp=6
|
||||
|
||||
5
dist/swdc/segatools.ini
vendored
5
dist/swdc/segatools.ini
vendored
@@ -187,6 +187,11 @@ accelAxis=Y
|
||||
; numbered from 1; some software numbers buttons from 0.
|
||||
start=1
|
||||
viewChg=2
|
||||
; DPad is already emulated, but some wheels use buttons rather than a DPad.
|
||||
up=4
|
||||
down=3
|
||||
left=7
|
||||
right=8
|
||||
; Button mappings for the steering wheel paddles.
|
||||
paddleLeft=6
|
||||
paddleRight=5
|
||||
|
||||
@@ -58,10 +58,10 @@ void idac_di_config_load(struct idac_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->left = GetPrivateProfileIntW(L"dinput", L"left", 0, filename);
|
||||
cfg->right = GetPrivateProfileIntW(L"dinput", L"right", 0, filename);
|
||||
cfg->up = GetPrivateProfileIntW(L"dinput", L"up", 0, filename);
|
||||
cfg->down = GetPrivateProfileIntW(L"dinput", L"down", 0, filename);
|
||||
cfg->left = GetPrivateProfileIntW(L"dinput", L"left", 0, filename);
|
||||
cfg->right = GetPrivateProfileIntW(L"dinput", L"right", 0, filename);
|
||||
cfg->shift_dn = GetPrivateProfileIntW(L"dinput", L"shiftDn", 0, filename);
|
||||
cfg->shift_up = GetPrivateProfileIntW(L"dinput", L"shiftUp", 0, filename);
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ struct idac_di_config {
|
||||
wchar_t accel_axis[16];
|
||||
uint8_t start;
|
||||
uint8_t view_chg;
|
||||
uint8_t left;
|
||||
uint8_t right;
|
||||
uint8_t up;
|
||||
uint8_t down;
|
||||
uint8_t left;
|
||||
uint8_t right;
|
||||
uint8_t shift_dn;
|
||||
uint8_t shift_up;
|
||||
uint8_t gear[6];
|
||||
|
||||
@@ -69,10 +69,10 @@ static uint8_t idac_di_shift_dn;
|
||||
static uint8_t idac_di_shift_up;
|
||||
static uint8_t idac_di_view_chg;
|
||||
static uint8_t idac_di_start;
|
||||
static uint8_t idac_di_left;
|
||||
static uint8_t idac_di_right;
|
||||
static uint8_t idac_di_up;
|
||||
static uint8_t idac_di_down;
|
||||
static uint8_t idac_di_left;
|
||||
static uint8_t idac_di_right;
|
||||
static uint8_t idac_di_gear[6];
|
||||
static bool idac_di_use_pedals;
|
||||
static bool idac_di_reverse_brake_axis;
|
||||
@@ -237,6 +237,18 @@ static HRESULT idac_di_config_apply(const struct idac_di_config *cfg)
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->up > 32) {
|
||||
dprintf("Wheel: Invalid up button: %i\n", cfg->up);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->down > 32) {
|
||||
dprintf("Wheel: Invalid down button: %i\n", cfg->down);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->left > 32) {
|
||||
dprintf("Wheel: Invalid left button: %i\n", cfg->left);
|
||||
|
||||
@@ -249,16 +261,6 @@ static HRESULT idac_di_config_apply(const struct idac_di_config *cfg)
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->up > 32) {
|
||||
dprintf("Wheel: Invalid up button: %i\n", cfg->up);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->down > 32) {
|
||||
dprintf("Wheel: Invalid down button: %i\n", cfg->down);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->shift_dn > 32) {
|
||||
dprintf("Wheel: Invalid shift down button: %i\n", cfg->shift_dn);
|
||||
|
||||
@@ -292,10 +294,10 @@ static HRESULT idac_di_config_apply(const struct idac_di_config *cfg)
|
||||
}
|
||||
dprintf("Wheel: Start button . . . : %i\n", cfg->start);
|
||||
dprintf("Wheel: View Change button : %i\n", cfg->view_chg);
|
||||
dprintf("Wheel: Left button . . . . : %i\n", cfg->left);
|
||||
dprintf("Wheel: Right button . . . : %i\n", cfg->right);
|
||||
dprintf("Wheel: Up button . . . . . : %i\n", cfg->up);
|
||||
dprintf("Wheel: Down button . . . : %i\n", cfg->down);
|
||||
dprintf("Wheel: Left button . . . . : %i\n", cfg->left);
|
||||
dprintf("Wheel: Right button . . . : %i\n", cfg->right);
|
||||
dprintf("Wheel: Shift Down button . : %i\n", cfg->shift_dn);
|
||||
dprintf("Wheel: Shift Up button . . : %i\n", cfg->shift_up);
|
||||
dprintf("Wheel: Reverse Brake Axis : %i\n", cfg->reverse_brake_axis);
|
||||
@@ -329,10 +331,10 @@ static HRESULT idac_di_config_apply(const struct idac_di_config *cfg)
|
||||
idac_di_off_accel = accel_axis->off;
|
||||
idac_di_start = cfg->start;
|
||||
idac_di_view_chg = cfg->view_chg;
|
||||
idac_di_left = cfg->left;
|
||||
idac_di_right = cfg->right;
|
||||
idac_di_up = cfg->up;
|
||||
idac_di_down = cfg->down;
|
||||
idac_di_left = cfg->left;
|
||||
idac_di_right = cfg->right;
|
||||
idac_di_shift_dn = cfg->shift_dn;
|
||||
idac_di_shift_up = cfg->shift_up;
|
||||
idac_di_reverse_brake_axis = cfg->reverse_brake_axis;
|
||||
@@ -488,14 +490,6 @@ static void idac_di_get_buttons(uint8_t *gamebtn_out)
|
||||
gamebtn |= IDAC_IO_GAMEBTN_VIEW_CHANGE;
|
||||
}
|
||||
|
||||
if (idac_di_left && state.st.rgbButtons[idac_di_left - 1]) {
|
||||
gamebtn |= IDAC_IO_GAMEBTN_LEFT;
|
||||
}
|
||||
|
||||
if (idac_di_right && state.st.rgbButtons[idac_di_right - 1]) {
|
||||
gamebtn |= IDAC_IO_GAMEBTN_RIGHT;
|
||||
}
|
||||
|
||||
if (idac_di_up && state.st.rgbButtons[idac_di_up - 1]) {
|
||||
gamebtn |= IDAC_IO_GAMEBTN_UP;
|
||||
}
|
||||
@@ -504,6 +498,14 @@ static void idac_di_get_buttons(uint8_t *gamebtn_out)
|
||||
gamebtn |= IDAC_IO_GAMEBTN_DOWN;
|
||||
}
|
||||
|
||||
if (idac_di_left && state.st.rgbButtons[idac_di_left - 1]) {
|
||||
gamebtn |= IDAC_IO_GAMEBTN_LEFT;
|
||||
}
|
||||
|
||||
if (idac_di_right && state.st.rgbButtons[idac_di_right - 1]) {
|
||||
gamebtn |= IDAC_IO_GAMEBTN_RIGHT;
|
||||
}
|
||||
|
||||
*gamebtn_out = gamebtn;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,10 @@ void idz_di_config_load(struct idz_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->up = GetPrivateProfileIntW(L"dinput", L"up", 0, filename);
|
||||
cfg->down = GetPrivateProfileIntW(L"dinput", L"down", 0, filename);
|
||||
cfg->left = GetPrivateProfileIntW(L"dinput", L"left", 0, filename);
|
||||
cfg->right = GetPrivateProfileIntW(L"dinput", L"right", 0, filename);
|
||||
cfg->shift_dn = GetPrivateProfileIntW(L"dinput", L"shiftDn", 0, filename);
|
||||
cfg->shift_up = GetPrivateProfileIntW(L"dinput", L"shiftUp", 0, filename);
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@ struct idz_di_config {
|
||||
wchar_t accel_axis[16];
|
||||
uint8_t start;
|
||||
uint8_t view_chg;
|
||||
uint8_t up;
|
||||
uint8_t down;
|
||||
uint8_t left;
|
||||
uint8_t right;
|
||||
uint8_t shift_dn;
|
||||
uint8_t shift_up;
|
||||
uint8_t gear[6];
|
||||
|
||||
@@ -76,6 +76,10 @@ static uint8_t idz_di_shift_dn;
|
||||
static uint8_t idz_di_shift_up;
|
||||
static uint8_t idz_di_view_chg;
|
||||
static uint8_t idz_di_start;
|
||||
static uint8_t idz_di_up;
|
||||
static uint8_t idz_di_down;
|
||||
static uint8_t idz_di_left;
|
||||
static uint8_t idz_di_right;
|
||||
static uint8_t idz_di_gear[6];
|
||||
static bool idz_di_use_pedals;
|
||||
static bool idz_di_reverse_brake_axis;
|
||||
@@ -276,6 +280,30 @@ static HRESULT idz_di_config_apply(const struct idz_di_config *cfg)
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->up > 32) {
|
||||
dprintf("Wheel: Invalid up button: %i\n", cfg->up);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->down > 32) {
|
||||
dprintf("Wheel: Invalid down button: %i\n", cfg->down);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->left > 32) {
|
||||
dprintf("Wheel: Invalid left button: %i\n", cfg->left);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->right > 32) {
|
||||
dprintf("Wheel: Invalid right button: %i\n", cfg->right);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->shift_dn > 32) {
|
||||
dprintf("Wheel: Invalid shift down button: %i\n", cfg->shift_dn);
|
||||
|
||||
@@ -309,6 +337,10 @@ static HRESULT idz_di_config_apply(const struct idz_di_config *cfg)
|
||||
}
|
||||
dprintf("Wheel: Start button . . . : %i\n", cfg->start);
|
||||
dprintf("Wheel: View Change button : %i\n", cfg->view_chg);
|
||||
dprintf("Wheel: Up button . . . . . : %i\n", cfg->up);
|
||||
dprintf("Wheel: Down button . . . : %i\n", cfg->down);
|
||||
dprintf("Wheel: Left button . . . . : %i\n", cfg->left);
|
||||
dprintf("Wheel: Right button . . . : %i\n", cfg->right);
|
||||
dprintf("Wheel: Shift Down button . : %i\n", cfg->shift_dn);
|
||||
dprintf("Wheel: Shift Up button . . : %i\n", cfg->shift_up);
|
||||
dprintf("Wheel: Reverse Brake Axis : %i\n", cfg->reverse_brake_axis);
|
||||
@@ -341,6 +373,10 @@ static HRESULT idz_di_config_apply(const struct idz_di_config *cfg)
|
||||
idz_di_off_brake = brake_axis->off;
|
||||
idz_di_off_accel = accel_axis->off;
|
||||
idz_di_start = cfg->start;
|
||||
idz_di_up = cfg->up;
|
||||
idz_di_down = cfg->down;
|
||||
idz_di_left = cfg->left;
|
||||
idz_di_right = cfg->right;
|
||||
idz_di_view_chg = cfg->view_chg;
|
||||
idz_di_shift_dn = cfg->shift_dn;
|
||||
idz_di_shift_up = cfg->shift_up;
|
||||
@@ -497,6 +533,22 @@ static void idz_di_jvs_read_buttons(uint8_t *gamebtn_out)
|
||||
gamebtn |= IDZ_IO_GAMEBTN_VIEW_CHANGE;
|
||||
}
|
||||
|
||||
if (idz_di_up && state.st.rgbButtons[idz_di_up - 1]) {
|
||||
gamebtn |= IDZ_IO_GAMEBTN_UP;
|
||||
}
|
||||
|
||||
if (idz_di_down && state.st.rgbButtons[idz_di_down - 1]) {
|
||||
gamebtn |= IDZ_IO_GAMEBTN_DOWN;
|
||||
}
|
||||
|
||||
if (idz_di_left && state.st.rgbButtons[idz_di_left - 1]) {
|
||||
gamebtn |= IDZ_IO_GAMEBTN_LEFT;
|
||||
}
|
||||
|
||||
if (idz_di_right && state.st.rgbButtons[idz_di_right - 1]) {
|
||||
gamebtn |= IDZ_IO_GAMEBTN_RIGHT;
|
||||
}
|
||||
|
||||
*gamebtn_out = gamebtn;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ 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->up = GetPrivateProfileIntW(L"dinput", L"up", 0, filename);
|
||||
cfg->down = GetPrivateProfileIntW(L"dinput", L"down", 0, filename);
|
||||
cfg->left = GetPrivateProfileIntW(L"dinput", L"left", 0, filename);
|
||||
cfg->right = GetPrivateProfileIntW(L"dinput", L"right", 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);
|
||||
|
||||
@@ -11,6 +11,10 @@ struct swdc_di_config {
|
||||
wchar_t accel_axis[16];
|
||||
uint8_t start;
|
||||
uint8_t view_chg;
|
||||
uint8_t up;
|
||||
uint8_t down;
|
||||
uint8_t left;
|
||||
uint8_t right;
|
||||
uint8_t paddle_left;
|
||||
uint8_t paddle_right;
|
||||
uint8_t wheel_green;
|
||||
|
||||
@@ -61,6 +61,10 @@ 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_up;
|
||||
static uint8_t swdc_di_down;
|
||||
static uint8_t swdc_di_left;
|
||||
static uint8_t swdc_di_right;
|
||||
static uint8_t swdc_di_wheel_green;
|
||||
static uint8_t swdc_di_wheel_red;
|
||||
static uint8_t swdc_di_wheel_blue;
|
||||
@@ -202,6 +206,30 @@ static HRESULT swdc_di_config_apply(const struct swdc_di_config *cfg)
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->up > 32) {
|
||||
dprintf("Wheel: Invalid up button: %i\n", cfg->up);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->down > 32) {
|
||||
dprintf("Wheel: Invalid down button: %i\n", cfg->down);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->left > 32) {
|
||||
dprintf("Wheel: Invalid left button: %i\n", cfg->left);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->right > 32) {
|
||||
dprintf("Wheel: Invalid right button: %i\n", cfg->right);
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (cfg->paddle_left > 32) {
|
||||
dprintf("Wheel: Invalid left paddle button: %i\n", cfg->paddle_left);
|
||||
|
||||
@@ -249,6 +277,10 @@ static HRESULT swdc_di_config_apply(const struct swdc_di_config *cfg)
|
||||
}
|
||||
dprintf("Wheel: Start button . . . . . : %i\n", cfg->start);
|
||||
dprintf("Wheel: View Change button . . : %i\n", cfg->view_chg);
|
||||
dprintf("Wheel: Up button . . . . . . : %i\n", cfg->up);
|
||||
dprintf("Wheel: Down button . . . . . : %i\n", cfg->down);
|
||||
dprintf("Wheel: Left button . . . . . : %i\n", cfg->left);
|
||||
dprintf("Wheel: Right button . . . . : %i\n", cfg->right);
|
||||
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);
|
||||
@@ -272,6 +304,10 @@ 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_up = cfg->up;
|
||||
swdc_di_down = cfg->down;
|
||||
swdc_di_left = cfg->left;
|
||||
swdc_di_right = cfg->right;
|
||||
swdc_di_paddle_left = cfg->paddle_left;
|
||||
swdc_di_paddle_right = cfg->paddle_right;
|
||||
swdc_di_wheel_green = cfg->wheel_green;
|
||||
@@ -399,6 +435,22 @@ static void swdc_di_get_buttons(uint16_t *gamebtn_out)
|
||||
gamebtn |= SWDC_IO_GAMEBTN_VIEW_CHANGE;
|
||||
}
|
||||
|
||||
if (swdc_di_up && state.st.rgbButtons[swdc_di_up - 1]) {
|
||||
gamebtn |= SWDC_IO_GAMEBTN_UP;
|
||||
}
|
||||
|
||||
if (swdc_di_down && state.st.rgbButtons[swdc_di_down - 1]) {
|
||||
gamebtn |= SWDC_IO_GAMEBTN_DOWN;
|
||||
}
|
||||
|
||||
if (swdc_di_left && state.st.rgbButtons[swdc_di_left - 1]) {
|
||||
gamebtn |= SWDC_IO_GAMEBTN_LEFT;
|
||||
}
|
||||
|
||||
if (swdc_di_right && state.st.rgbButtons[swdc_di_right - 1]) {
|
||||
gamebtn |= SWDC_IO_GAMEBTN_RIGHT;
|
||||
}
|
||||
|
||||
if (swdc_di_paddle_left && state.st.rgbButtons[swdc_di_paddle_left - 1]) {
|
||||
gamebtn |= SWDC_IO_GAMEBTN_STEERING_PADDLE_LEFT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user