Fixed joystick configuration and axis, buttons, etc. values;

The Open/Save dialog code now sets a variable to indicate which extension filter index the user has selected.
This commit is contained in:
OBattler
2018-01-21 21:39:52 +01:00
parent 50bb92fcbe
commit 29e662bfe3
8 changed files with 45 additions and 34 deletions

View File

@@ -87,10 +87,10 @@ joystick_if_t joystick_ch_flightstick_pro =
ch_flightstick_pro_write,
ch_flightstick_pro_read_axis,
ch_flightstick_pro_a0_over,
1,
3,
4,
1,
1,
{"X axis", "Y axis", "Throttle"},
{"Button 1", "Button 2", "Button 3", "Button 4"},
{"POV"}

View File

@@ -171,8 +171,8 @@ joystick_if_t joystick_standard =
joystick_standard_a0_over,
2,
2,
2,
0,
2,
{"X axis", "Y axis"},
{"Button 1", "Button 2"}
};
@@ -185,10 +185,10 @@ joystick_if_t joystick_standard_4button =
joystick_standard_write,
joystick_standard_read_axis_4button,
joystick_standard_a0_over,
1,
2,
4,
0,
1,
{"X axis", "Y axis"},
{"Button 1", "Button 2", "Button 3", "Button 4"}
};
@@ -201,10 +201,10 @@ joystick_if_t joystick_standard_6button =
joystick_standard_write,
joystick_standard_read_axis_6button,
joystick_standard_a0_over,
1,
2,
6,
0,
1,
{"X axis", "Y axis"},
{"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6"}
};
@@ -217,10 +217,10 @@ joystick_if_t joystick_standard_8button =
joystick_standard_write,
joystick_standard_read_axis_8button,
joystick_standard_a0_over,
1,
2,
8,
0,
1,
{"X axis", "Y axis"},
{"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6", "Button 7", "Button 8"}
};

View File

@@ -244,10 +244,10 @@ joystick_if_t joystick_sw_pad =
sw_write,
sw_read_axis,
sw_a0_over,
4,
2,
10,
0,
4,
{"X axis", "Y axis"},
{"A", "B", "C", "X", "Y", "Z", "L", "R", "Start", "M"}
};

View File

@@ -86,10 +86,10 @@ joystick_if_t joystick_tm_fcs =
tm_fcs_write,
tm_fcs_read_axis,
tm_fcs_a0_over,
1,
2,
4,
1,
1,
{"X axis", "Y axis"},
{"Button 1", "Button 2", "Button 3", "Button 4"},
{"POV"}

View File

@@ -8,15 +8,15 @@
*
* Platform support defintions for Win32.
*
* Version: @(#)win.h 1.0.13 2017/12/15
* Version: @(#)win.h 1.0.14 2018/01/21
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016,2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2017,2018 Fred N. van Kempen.
*/
#ifndef PLAT_WIN_H
# define PLAT_WIN_H
@@ -63,6 +63,8 @@ extern int status_is_open;
extern char openfilestring[260];
extern WCHAR wopenfilestring[260];
extern uint8_t filterindex;
#ifdef __cplusplus
extern "C" {
@@ -94,7 +96,7 @@ extern intptr_t fdd_type_to_icon(int type);
#ifdef EMU_DEVICE_H
extern uint8_t deviceconfig_open(HWND hwnd, device_t *device);
#endif
extern void joystickconfig_open(HWND hwnd, int joy_nr, int type);
extern uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type);
extern int getfile(HWND hwnd, char *f, char *fn);
extern int getsfile(HWND hwnd, char *f, char *fn);

View File

@@ -8,13 +8,13 @@
*
* Several dialogs for the application.
*
* Version: @(#)win_dialog.c 1.0.7 2017/12/28
* Version: @(#)win_dialog.c 1.0.8 2018/01/21
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016,2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2017,2018 Fred N. van Kempen.
*/
#define UNICODE
#include <windows.h>
@@ -35,6 +35,7 @@
WCHAR path[MAX_PATH];
WCHAR wopenfilestring[260];
char openfilestring[260];
uint8_t filterindex = 0;
static int CALLBACK
@@ -196,6 +197,7 @@ file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, int save)
if (r) {
wcstombs(openfilestring, wopenfilestring, sizeof(openfilestring));
filterindex = ofn.nFilterIndex;
// pclog("File dialog return true\n");
return(0);

View File

@@ -21,6 +21,8 @@ static int joystick_config_type;
#define AXIS_STRINGS_MAX 3
static char *axis_strings[AXIS_STRINGS_MAX] = {"X Axis", "Y Axis", "Z Axis"};
static uint8_t joystickconfig_changed = 0;
static void rebuild_axis_button_selections(HWND hdlg)
{
@@ -271,7 +273,11 @@ joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
}
}
}
joystickconfig_changed = 1;
EndDialog(hdlg, 0);
return TRUE;
case IDCANCEL:
joystickconfig_changed = 0;
EndDialog(hdlg, 0);
return TRUE;
}
@@ -280,7 +286,7 @@ joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
return FALSE;
}
void joystickconfig_open(HWND hwnd, int joy_nr, int type)
uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type)
{
uint16_t *data_block = malloc(16384);
uint16_t *data;
@@ -289,6 +295,8 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
int y = 10;
int id = IDC_CONFIG_BASE;
int c;
joystickconfig_changed = 0;
joystick_nr = joy_nr;
joystick_config_type = type;
@@ -546,4 +554,6 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
DialogBoxIndirect(hinstance, dlg, hwnd, joystickconfig_dlgproc);
free(data_block);
return joystickconfig_changed;
}

View File

@@ -8,7 +8,7 @@
*
* Windows 86Box Settings dialog handler.
*
* Version: @(#)win_settings.c 1.0.29 2018/01/19
* Version: @(#)win_settings.c 1.0.30 2018/01/21
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -1030,44 +1030,41 @@ win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
break;
case IDC_COMBO_JOYSTICK:
if (HIWORD(wParam) == CBN_SELCHANGE)
{
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_JOY1);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY2);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 2) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY3);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 3) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY4);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 4) ? TRUE : FALSE);
}
h = GetDlgItem(hdlg, IDC_JOY1);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 1) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY2);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 2) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY3);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 3) ? TRUE : FALSE);
h = GetDlgItem(hdlg, IDC_JOY4);
EnableWindow(h, (joystick_get_max_joysticks(temp_joystick) >= 4) ? TRUE : FALSE);
break;
case IDC_JOY1:
h = GetDlgItem(hdlg, IDC_COMBO_JOY);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
joystickconfig_open(hdlg, 0, temp_joystick);
temp_deviceconfig |= joystickconfig_open(hdlg, 0, temp_joystick);
break;
case IDC_JOY2:
h = GetDlgItem(hdlg, IDC_COMBO_JOY);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
joystickconfig_open(hdlg, 1, temp_joystick);
temp_deviceconfig |= joystickconfig_open(hdlg, 1, temp_joystick);
break;
case IDC_JOY3:
h = GetDlgItem(hdlg, IDC_COMBO_JOY);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
joystickconfig_open(hdlg, 2, temp_joystick);
temp_deviceconfig |= joystickconfig_open(hdlg, 2, temp_joystick);
break;
case IDC_JOY4:
h = GetDlgItem(hdlg, IDC_COMBO_JOY);
temp_joystick = SendMessage(h, CB_GETCURSEL, 0, 0);
joystickconfig_open(hdlg, 3, temp_joystick);
temp_deviceconfig |= joystickconfig_open(hdlg, 3, temp_joystick);
break;
}
return FALSE;