Assorted Joystick fixes

Implemented use of DirectInput sliders.  They were previously lumped in with axis and then not read or used at all.

Lots of use of joystick_type == 7 or joystick_type != 7 to detect if the joystick_type was none.  Changed this to a define.

The text to enumerate the types of joysticks was contained in a numbered LPARAM sheet.  Switched to using the name listed in the joystick struct.

Joysticks with more than 32 buttons would overflow the plat_joystick_state button array.  Added overflow checks.

Added a 4 axis 4 button joystick type that Win98 can pick up as a generic 4 axis 4 button controller.
This commit is contained in:
horkthane
2020-01-16 19:23:54 -05:00
parent 9b80d4b151
commit 3a8b89af63
20 changed files with 151 additions and 51 deletions

View File

@@ -971,6 +971,7 @@ static BOOL CALLBACK
win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
wchar_t str[128];
char *joy_name;
HWND h;
int c, d;
@@ -1000,9 +1001,15 @@ win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
c = 0;
while (joystick_get_name(c)) {
SendMessage(h, CB_ADDSTRING, 0, win_get_string(2105 + c));
joy_name = joystick_get_name(c);
while (joy_name)
{
mbstowcs(str, joy_name, strlen(joy_name) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)str);
// SendMessage(h, CB_ADDSTRING, 0, win_get_string(2105 + c));
c++;
joy_name = joystick_get_name(c);
}
EnableWindow(h, TRUE);
SendMessage(h, CB_SETCURSEL, temp_joystick, 0);