Joystick code improvements
This commit is contained in:
@@ -98,8 +98,6 @@ joystick_add_button(raw_joystick_t *rawjoy, plat_joystick_t *joy, USAGE usage)
|
||||
void
|
||||
joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS prop)
|
||||
{
|
||||
LONG center;
|
||||
|
||||
if (joy->nr_axes >= 8)
|
||||
return;
|
||||
|
||||
@@ -139,14 +137,11 @@ joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS
|
||||
* Some joysticks will send -1 in LogicalMax, like Xbox Controllers
|
||||
* so we need to mask that to appropriate value (instead of 0xFFFFFFFF)
|
||||
*/
|
||||
rawjoy->axis[joy->nr_axes].max = prop->LogicalMax & ((1 << prop->BitSize) - 1);
|
||||
rawjoy->axis[joy->nr_axes].max = prop->LogicalMax & ((1ULL << prop->BitSize) - 1);
|
||||
}
|
||||
rawjoy->axis[joy->nr_axes].min = prop->LogicalMin;
|
||||
|
||||
center = (rawjoy->axis[joy->nr_axes].max - rawjoy->axis[joy->nr_axes].min + 1) / 2;
|
||||
|
||||
if (center != 0x00)
|
||||
joy->nr_axes++;
|
||||
joy->nr_axes++;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -450,7 +445,7 @@ joystick_process(void)
|
||||
{
|
||||
int d;
|
||||
|
||||
if (joystick_type == 7)
|
||||
if (joystick_type == JS_TYPE_NONE)
|
||||
return;
|
||||
|
||||
for (int c = 0; c < joystick_get_max_joysticks(joystick_type); c++) {
|
||||
|
||||
@@ -1349,10 +1349,10 @@ static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
wchar_t str[128];
|
||||
char *joy_name;
|
||||
int c;
|
||||
int d;
|
||||
wchar_t str[128];
|
||||
const char *joy_name;
|
||||
int c;
|
||||
int d;
|
||||
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
@@ -1408,7 +1408,7 @@ win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case IDC_COMBO_JOYSTICK:
|
||||
temp_joystick = settings_get_cur_sel(hdlg, IDC_COMBO_JOYSTICK);
|
||||
|
||||
for (c = 0; c < 4; c++)
|
||||
for (c = 0; c < MAX_JOYSTICKS; c++)
|
||||
settings_enable_window(hdlg, IDC_JOY1 + c, joystick_get_max_joysticks(temp_joystick) > c);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user