mirror of
https://gitea.tendokyu.moe/TeamTofuShop/segatools.git
synced 2026-09-22 22:37:59 +03:00
idac: allow changing up and down for custom boards
This commit is contained in:
@@ -60,6 +60,8 @@ void idac_di_config_load(struct idac_di_config *cfg, const wchar_t *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->shift_dn = GetPrivateProfileIntW(L"dinput", L"shiftDn", 0, filename);
|
||||
cfg->shift_up = GetPrivateProfileIntW(L"dinput", L"shiftUp", 0, filename);
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ struct idac_di_config {
|
||||
uint8_t view_chg;
|
||||
uint8_t left;
|
||||
uint8_t right;
|
||||
uint8_t up;
|
||||
uint8_t down;
|
||||
uint8_t shift_dn;
|
||||
uint8_t shift_up;
|
||||
uint8_t gear[6];
|
||||
|
||||
@@ -71,6 +71,8 @@ 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_gear[6];
|
||||
static bool idac_di_use_pedals;
|
||||
static bool idac_di_reverse_brake_axis;
|
||||
@@ -247,6 +249,16 @@ 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);
|
||||
|
||||
@@ -282,6 +294,8 @@ static HRESULT idac_di_config_apply(const struct idac_di_config *cfg)
|
||||
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: 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);
|
||||
@@ -317,6 +331,8 @@ static HRESULT idac_di_config_apply(const struct idac_di_config *cfg)
|
||||
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_shift_dn = cfg->shift_dn;
|
||||
idac_di_shift_up = cfg->shift_up;
|
||||
idac_di_reverse_brake_axis = cfg->reverse_brake_axis;
|
||||
@@ -480,6 +496,14 @@ static void idac_di_get_buttons(uint8_t *gamebtn_out)
|
||||
gamebtn |= IDAC_IO_GAMEBTN_RIGHT;
|
||||
}
|
||||
|
||||
if (idac_di_up && state.st.rgbButtons[idac_di_up - 1]) {
|
||||
gamebtn |= IDAC_IO_GAMEBTN_UP;
|
||||
}
|
||||
|
||||
if (idac_di_down && state.st.rgbButtons[idac_di_down - 1]) {
|
||||
gamebtn |= IDAC_IO_GAMEBTN_DOWN;
|
||||
}
|
||||
|
||||
*gamebtn_out = gamebtn;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user