USB: dialog,windows and dev9/usb conflicts fixes

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-11-05 12:41:11 +01:00 committed by refractionpcsx2
parent 1aa585e56b
commit 1881d12f61
10 changed files with 179 additions and 195 deletions

View File

@ -35,7 +35,7 @@ void SysMessageA(const char* fmt, ...)
va_start(list, fmt);
vsprintf_s(tmp, 512, fmt, list);
va_end(list);
MessageBoxA(0, tmp, "Qemu USB Msg", 0);
MessageBoxA(0, tmp, "USB Msg", 0);
}
void SysMessageW(const wchar_t* fmt, ...)
@ -46,13 +46,13 @@ void SysMessageW(const wchar_t* fmt, ...)
va_start(list, fmt);
vswprintf_s(tmp, 512, fmt, list);
va_end(list);
MessageBoxW(0, tmp, L"Qemu USB Msg", 0);
MessageBoxW(0, tmp, L"USB Msg", 0);
}
void SelChangedAPI(HWND hW, int port)
{
int sel = SendDlgItemMessage(hW, port ? IDC_COMBO_API1 : IDC_COMBO_API2, CB_GETCURSEL, 0, 0);
int devtype = SendDlgItemMessage(hW, port ? IDC_COMBO1 : IDC_COMBO2, CB_GETCURSEL, 0, 0);
int sel = SendDlgItemMessage(hW, port ? IDC_COMBO_API1_USB : IDC_COMBO_API2_USB, CB_GETCURSEL, 0, 0);
int devtype = SendDlgItemMessage(hW, port ? IDC_COMBO1_USB : IDC_COMBO2_USB, CB_GETCURSEL, 0, 0);
if (devtype == 0)
return;
devtype--;
@ -66,8 +66,8 @@ void SelChangedAPI(HWND hW, int port)
void PopulateAPIs(HWND hW, int port)
{
SendDlgItemMessage(hW, port ? IDC_COMBO_API1 : IDC_COMBO_API2, CB_RESETCONTENT, 0, 0);
int devtype = SendDlgItemMessage(hW, port ? IDC_COMBO1 : IDC_COMBO2, CB_GETCURSEL, 0, 0);
SendDlgItemMessage(hW, port ? IDC_COMBO_API1_USB : IDC_COMBO_API2_USB, CB_RESETCONTENT, 0, 0);
int devtype = SendDlgItemMessage(hW, port ? IDC_COMBO1_USB : IDC_COMBO2_USB, CB_GETCURSEL, 0, 0);
if (devtype == 0)
return;
devtype--;
@ -79,8 +79,7 @@ void PopulateAPIs(HWND hW, int port)
std::string selApi = GetSelectedAPI(std::make_pair(port, devName));
std::string var;
if (LoadSetting(nullptr, port, rd.Name(devtype), N_DEVICE_API, str_to_wstr(var)))
else
if (!LoadSetting(nullptr, port, rd.Name(devtype), N_DEVICE_API, str_to_wstr(var)))
{
if (apis.begin() != apis.end())
{
@ -95,12 +94,12 @@ void PopulateAPIs(HWND hW, int port)
auto name = dev->LongAPIName(api);
if (!name)
continue;
SendDlgItemMessageW(hW, port ? IDC_COMBO_API1 : IDC_COMBO_API2, CB_ADDSTRING, 0, (LPARAM)name);
SendDlgItemMessageW(hW, port ? IDC_COMBO_API1_USB : IDC_COMBO_API2_USB, CB_ADDSTRING, 0, (LPARAM)name);
if (api == var)
sel = i;
i++;
}
SendDlgItemMessage(hW, port ? IDC_COMBO_API1 : IDC_COMBO_API2, CB_SETCURSEL, sel, 0);
SendDlgItemMessage(hW, port ? IDC_COMBO_API1_USB : IDC_COMBO_API2_USB, CB_SETCURSEL, sel, 0);
}
BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
@ -110,12 +109,12 @@ BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
switch (uMsg)
{
case WM_INITDIALOG:
SendDlgItemMessageA(hW, IDC_BUILD_DATE, WM_SETTEXT, 0, (LPARAM)__DATE__ " " __TIME__);
SendDlgItemMessageA(hW, IDC_BUILD_DATE_USB, WM_SETTEXT, 0, (LPARAM)__DATE__ " " __TIME__);
LoadConfig();
CheckDlgButton(hW, IDC_LOGGING, conf.Log);
CheckDlgButton(hW, IDC_LOGGING_USB, conf.Log);
//Selected emulated devices.
SendDlgItemMessageA(hW, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM) "None");
SendDlgItemMessageA(hW, IDC_COMBO2, CB_ADDSTRING, 0, (LPARAM) "None");
SendDlgItemMessageA(hW, IDC_COMBO1_USB, CB_ADDSTRING, 0, (LPARAM) "None");
SendDlgItemMessageA(hW, IDC_COMBO2_USB, CB_ADDSTRING, 0, (LPARAM) "None");
{
auto& rd = RegisterDevice::instance();
@ -124,8 +123,8 @@ BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
{
i++; //jump over "None"
auto dev = rd.Device(name);
SendDlgItemMessageW(hW, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)dev->Name());
SendDlgItemMessageW(hW, IDC_COMBO2, CB_ADDSTRING, 0, (LPARAM)dev->Name());
SendDlgItemMessageW(hW, IDC_COMBO1_USB, CB_ADDSTRING, 0, (LPARAM)dev->Name());
SendDlgItemMessageW(hW, IDC_COMBO2_USB, CB_ADDSTRING, 0, (LPARAM)dev->Name());
//Port 1 aka device/player 1
if (conf.Port[1] == name)
@ -134,23 +133,23 @@ BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
if (conf.Port[0] == name)
p2 = i;
}
SendDlgItemMessage(hW, IDC_COMBO1, CB_SETCURSEL, p1, 0);
SendDlgItemMessage(hW, IDC_COMBO2, CB_SETCURSEL, p2, 0);
SendDlgItemMessage(hW, IDC_COMBO1_USB, CB_SETCURSEL, p1, 0);
SendDlgItemMessage(hW, IDC_COMBO2_USB, CB_SETCURSEL, p2, 0);
PopulateAPIs(hW, 0);
PopulateAPIs(hW, 1);
}
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1, CB_ADDSTRING, 0, (LPARAM) "Driving Force");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro (rev11.02)");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1, CB_ADDSTRING, 0, (LPARAM) "GT Force");
SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE1, CB_SETCURSEL, conf.WheelType[PLAYER_ONE_PORT], 0);
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro (rev11.02)");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_ADDSTRING, 0, (LPARAM) "GT Force");
SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_SETCURSEL, conf.WheelType[PLAYER_ONE_PORT], 0);
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2, CB_ADDSTRING, 0, (LPARAM) "Driving Force");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro (rev11.02)");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2, CB_ADDSTRING, 0, (LPARAM) "GT Force");
SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE2, CB_SETCURSEL, conf.WheelType[PLAYER_TWO_PORT], 0);
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro (rev11.02)");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_ADDSTRING, 0, (LPARAM) "GT Force");
SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_SETCURSEL, conf.WheelType[PLAYER_TWO_PORT], 0);
return TRUE;
break;
@ -160,14 +159,14 @@ BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
case CBN_SELCHANGE:
switch (LOWORD(wParam))
{
case IDC_COMBO_API1:
case IDC_COMBO_API2:
port = (LOWORD(wParam) == IDC_COMBO_API1) ? 1 : 0;
case IDC_COMBO_API1_USB:
case IDC_COMBO_API2_USB:
port = (LOWORD(wParam) == IDC_COMBO_API1_USB) ? 1 : 0;
SelChangedAPI(hW, port);
break;
case IDC_COMBO1:
case IDC_COMBO2:
port = (LOWORD(wParam) == IDC_COMBO1) ? 1 : 0;
case IDC_COMBO1_USB:
case IDC_COMBO2_USB:
port = (LOWORD(wParam) == IDC_COMBO1_USB) ? 1 : 0;
PopulateAPIs(hW, port);
break;
}
@ -175,13 +174,13 @@ BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
case BN_CLICKED:
switch (LOWORD(wParam))
{
case IDC_CONFIGURE1:
case IDC_CONFIGURE2:
case IDC_CONFIGURE1_USB:
case IDC_CONFIGURE2_USB:
{
LRESULT devtype, apitype;
port = (LOWORD(wParam) == IDC_CONFIGURE1) ? 1 : 0;
devtype = SendDlgItemMessage(hW, port ? IDC_COMBO1 : IDC_COMBO2, CB_GETCURSEL, 0, 0);
apitype = SendDlgItemMessage(hW, port ? IDC_COMBO_API1 : IDC_COMBO_API2, CB_GETCURSEL, 0, 0);
port = (LOWORD(wParam) == IDC_CONFIGURE1_USB) ? 1 : 0;
devtype = SendDlgItemMessage(hW, port ? IDC_COMBO1_USB : IDC_COMBO2_USB, CB_GETCURSEL, 0, 0);
apitype = SendDlgItemMessage(hW, port ? IDC_COMBO_API1_USB : IDC_COMBO_API2_USB, CB_GETCURSEL, 0, 0);
if (devtype > 0)
{
@ -206,19 +205,19 @@ BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
EndDialog(hW, TRUE);
return TRUE;
case IDOK:
conf.Log = IsDlgButtonChecked(hW, IDC_LOGGING);
conf.Log = IsDlgButtonChecked(hW, IDC_LOGGING_USB);
{
auto& regInst = RegisterDevice::instance();
int i;
//device type
i = SendDlgItemMessage(hW, IDC_COMBO1, CB_GETCURSEL, 0, 0);
i = SendDlgItemMessage(hW, IDC_COMBO1_USB, CB_GETCURSEL, 0, 0);
conf.Port[1] = regInst.Name(i - 1);
i = SendDlgItemMessage(hW, IDC_COMBO2, CB_GETCURSEL, 0, 0);
i = SendDlgItemMessage(hW, IDC_COMBO2_USB, CB_GETCURSEL, 0, 0);
conf.Port[0] = regInst.Name(i - 1);
}
//wheel type
conf.WheelType[PLAYER_ONE_PORT] = SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE1, CB_GETCURSEL, 0, 0);
conf.WheelType[PLAYER_TWO_PORT] = SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE2, CB_GETCURSEL, 0, 0);
conf.WheelType[PLAYER_ONE_PORT] = SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_GETCURSEL, 0, 0);
conf.WheelType[PLAYER_TWO_PORT] = SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_GETCURSEL, 0, 0);
SaveConfig();
CreateDevices();
@ -238,7 +237,7 @@ void USBconfigure()
USBsetSettingsDir();
RegisterDevice::Register();
DialogBox(hInstUSB,
MAKEINTRESOURCE(IDD_CONFIG),
MAKEINTRESOURCE(IDD_CONFIG_USB),
GetActiveWindow(),
(DLGPROC)ConfigureDlgProcUSB);
paused_core.AllowResume();

View File

@ -24,92 +24,90 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Dialog
//
IDD_DLGMSD DIALOGEX 0, 0, 316, 74
IDD_DLGMSD_USB DIALOGEX 0, 0, 316, 74
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "USB mass storage device"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,204,54,50,14
PUSHBUTTON "Cancel",IDCANCEL,258,54,50,14
GROUPBOX "Image file path",IDC_STATIC,6,6,300,36
EDITTEXT IDC_EDIT1,12,18,234,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
PUSHBUTTON "Browse",IDC_BUTTON1,252,18,50,14
GROUPBOX "Image file path",IDC_STATIC_USB,6,6,300,36
EDITTEXT IDC_EDIT1_USB,12,18,234,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
PUSHBUTTON "Browse",IDC_BUTTON1_USB,252,18,50,14
END
IDD_CONFIG DIALOGEX 0, 0, 257, 205
IDD_CONFIG_USB DIALOGEX 0, 0, 257, 205
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Qemu USB Configuration"
CAPTION "USB Configuration"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
PUSHBUTTON "Cancel",IDCANCEL,194,184,50,14
CONTROL "Enable Logging (for developer use only)",IDC_LOGGING,
CONTROL "Enable Logging (for developer use only)",IDC_LOGGING_USB,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,102,144,12
COMBOBOX IDC_COMBO1,48,17,198,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Port 1:",IDC_STATIC,19,19,23,8
COMBOBOX IDC_COMBO2,48,35,198,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Port 2:",IDC_STATIC,19,37,23,8
LTEXT "Static",IDC_BUILD_DATE,6,190,114,8
DEFPUSHBUTTON "Configure",IDC_CONFIGURE1,198,64,50,14
DEFPUSHBUTTON "Configure",IDC_CONFIGURE2,198,82,50,14
COMBOBOX IDC_COMBO1_USB,48,17,198,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Port 1:",IDC_STATIC_USB,19,19,23,8
COMBOBOX IDC_COMBO2_USB,48,35,198,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Port 2:",IDC_STATIC_USB,19,37,23,8
LTEXT "Static",IDC_BUILD_DATE_USB,6,190,114,8
DEFPUSHBUTTON "Configure",IDC_CONFIGURE1_USB,198,64,50,14
DEFPUSHBUTTON "Configure",IDC_CONFIGURE2_USB,198,82,50,14
DEFPUSHBUTTON "OK",IDOK,138,184,50,14
COMBOBOX IDC_COMBO_WHEEL_TYPE1,42,144,192,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Port 1:",IDC_STATIC,12,144,23,8
GROUPBOX "Emulated wheel",IDC_STATIC,6,132,240,48
COMBOBOX IDC_COMBO_WHEEL_TYPE2,42,162,192,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Port 2:",IDC_STATIC,12,162,23,8
GROUPBOX "Device type",IDC_STATIC,6,6,246,48
COMBOBOX IDC_COMBO_API1,48,65,144,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_API2,48,83,144,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Device API",IDC_STATIC,6,54,246,48
LTEXT "Port 1:",IDC_STATIC,18,66,23,8
LTEXT "Port 2:",IDC_STATIC,18,84,23,8
COMBOBOX IDC_COMBO_WHEEL_TYPE1_USB,42,144,192,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Port 1:",IDC_STATIC_USB,12,144,23,8
GROUPBOX "Emulated wheel",IDC_STATIC_USB,6,132,240,48
COMBOBOX IDC_COMBO_WHEEL_TYPE2_USB,42,162,192,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Port 2:",IDC_STATIC_USB,12,162,23,8
GROUPBOX "Device type",IDC_STATIC_USB,6,6,246,48
COMBOBOX IDC_COMBO_API1_USB,48,65,144,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_API2_USB,48,83,144,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Device API",IDC_STATIC_USB,6,54,246,48
LTEXT "Port 1:",IDC_STATIC_USB,18,66,23,8
LTEXT "Port 2:",IDC_STATIC_USB,18,84,23,8
END
IDD_ABOUT DIALOGEX 0, 0, 177, 106
IDD_ABOUT_USB DIALOGEX 0, 0, 177, 106
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "USBabout"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",IDOK,65,85,50,14
LTEXT "USB Driver",IDC_NAME,70,10,54,8
GROUPBOX "",IDC_STATIC,5,35,170,43
LTEXT "Author: gigaherz <gigaherz@pcsx2.net>",IDC_STATIC,20,20,141,10
LTEXT "Parts of this code were originally from the QEMU project.",IDC_STATIC,14,44,149,16
LTEXT "USB Driver",IDC_NAME_USB,70,10,54,8
GROUPBOX "",IDC_STATIC_USB,5,35,170,43
END
IDD_DLGWASAPI DIALOGEX 0, 0, 287, 230
IDD_DLGWASAPI_USB DIALOGEX 0, 0, 287, 230
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "WASAPI settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,174,210,50,14
PUSHBUTTON "Cancel",IDCANCEL,228,210,50,14
GROUPBOX "Audio Input",IDC_STATIC,6,6,270,54
LTEXT "Player 1:",IDC_STATIC,12,18,30,8
LTEXT "Player 2:",IDC_STATIC,12,36,30,8
COMBOBOX IDC_COMBO1,48,18,216,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO2,48,36,216,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "1 ms",IDC_STATIC,18,138,16,8
LTEXT "1000 ms",IDC_STATIC,240,138,28,8
GROUPBOX "Input Buffering",IDC_STATIC,6,108,270,46
CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,18,121,252,15
EDITTEXT IDC_BUFFER1,122,138,40,12,ES_AUTOHSCROLL | ES_NUMBER
GROUPBOX "Audio Output",IDC_STATIC,6,66,270,36
COMBOBOX IDC_COMBO3,48,78,216,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "1 ms",IDC_STATIC,18,186,16,8
LTEXT "1000 ms",IDC_STATIC,240,186,28,8
GROUPBOX "Output Buffering",IDC_STATIC,6,156,270,46
CONTROL "",IDC_SLIDER2,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,18,169,252,15
EDITTEXT IDC_BUFFER2,122,186,40,12,ES_AUTOHSCROLL | ES_NUMBER
GROUPBOX "Audio Input",IDC_STATIC_USB,6,6,270,54
LTEXT "Player 1:",IDC_STATIC_USB,12,18,30,8
LTEXT "Player 2:",IDC_STATIC_USB,12,36,30,8
COMBOBOX IDC_COMBO1_USB,48,18,216,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO2_USB,48,36,216,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "1 ms",IDC_STATIC_USB,18,138,16,8
LTEXT "1000 ms",IDC_STATIC_USB,240,138,28,8
GROUPBOX "Input Buffering",IDC_STATIC_USB,6,108,270,46
CONTROL "",IDC_SLIDER1_USB,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,18,121,252,15
EDITTEXT IDC_BUFFER1_USB,122,138,40,12,ES_AUTOHSCROLL | ES_NUMBER
GROUPBOX "Audio Output",IDC_STATIC_USB,6,66,270,36
COMBOBOX IDC_COMBO3_USB,48,78,216,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "1 ms",IDC_STATIC_USB,18,186,16,8
LTEXT "1000 ms",IDC_STATIC_USB,240,186,28,8
GROUPBOX "Output Buffering",IDC_STATIC_USB,6,156,270,46
CONTROL "",IDC_SLIDER2_USB,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,18,169,252,15
EDITTEXT IDC_BUFFER2_USB,122,186,40,12,ES_AUTOHSCROLL | ES_NUMBER
END
IDD_DLG_EYETOY DIALOGEX 0, 0, 309, 49
IDD_DLG_EYETOY_USB DIALOGEX 0, 0, 309, 49
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "EyeToy settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Device:",IDC_STATIC,7,8,27,8
COMBOBOX IDC_COMBO1,40,7,262,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Device:",IDC_STATIC_USB,7,8,27,8
COMBOBOX IDC_COMBO1_USB,40,7,262,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,198,28,50,14
PUSHBUTTON "Cancel",IDCANCEL,252,28,50,14
END
@ -120,22 +118,22 @@ END
// AFX_DIALOG_LAYOUT
//
IDD_DLGMIC AFX_DIALOG_LAYOUT
IDD_DLGMIC_USB AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_CONFIG AFX_DIALOG_LAYOUT
IDD_CONFIG_USB AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_DLGWASAPI AFX_DIALOG_LAYOUT
IDD_DLGWASAPI_USB AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_DLG_EYETOY AFX_DIALOG_LAYOUT
IDD_DLG_EYETOY_USB AFX_DIALOG_LAYOUT
BEGIN
0
END
@ -149,7 +147,7 @@ END
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DLGWASAPI, DIALOG
IDD_DLGWASAPI_USB, DIALOG
BEGIN
END
END

View File

@ -2,35 +2,35 @@
// Microsoft Visual C++ generated include file.
// Used by USBlinuz.rc
//
#define IDC_STATIC -1
#define IDC_CONFIGURE1 3
#define IDC_CONFIGURE2 4
#define IDD_CONFDLG 101
#define IDD_CONFIG 101
#define IDD_ABOUT 103
#define IDD_DLGMSD 106
#define IDD_DLGWASAPI 107
#define IDD_DLG_EYETOY 108
#define IDC_NAME 1000
#define IDC_LOGGING 1007
#define IDC_COMBO1 1008
#define IDC_COMBO2 1009
#define IDC_LIST1 1010
#define IDC_COMBO_API1 1010
#define IDC_COMBO3 1010
#define IDC_COMBO_FFB 1011
#define IDC_COMBO_API2 1011
#define IDC_BUTTON1 1012
#define IDC_DFP_PASS 1013
#define IDC_BUILD_DATE 1014
#define IDC_EDIT1 1015
#define IDC_COMBO_WHEEL_TYPE1 1037
#define IDC_COMBO_WHEEL_TYPE2 1038
#define IDC_SLIDER1 1039
#define IDC_BUFFER1 1040
#define IDC_COMBOMICAPI 1041
#define IDC_SLIDER2 1041
#define IDC_BUFFER2 1042
#define IDC_STATIC_USB -1
#define IDC_CONFIGURE1_USB 203
#define IDC_CONFIGURE2_USB 204
#define IDD_CONFDLG_USB 20101
#define IDD_CONFIG_USB 20101
#define IDD_ABOUT_USB 20103
#define IDD_DLGMSD_USB 20106
#define IDD_DLGWASAPI_USB 20107
#define IDD_DLG_EYETOY_USB 20108
#define IDC_NAME_USB 201000
#define IDC_LOGGING_USB 201007
#define IDC_COMBO1_USB 201008
#define IDC_COMBO2_USB 201009
#define IDC_LIST1_USB 201010
#define IDC_COMBO_API1_USB 201010
#define IDC_COMBO3_USB 201010
#define IDC_COMBO_FFB_USB 201011
#define IDC_COMBO_API2_USB 201011
#define IDC_BUTTON1_USB 201012
#define IDC_DFP_PASS_USB 201013
#define IDC_BUILD_DATE_USB 201014
#define IDC_EDIT1_USB 201015
#define IDC_COMBO_WHEEL_TYPE1_USB 201037
#define IDC_COMBO_WHEEL_TYPE2_USB 201038
#define IDC_SLIDER1_USB 201039
#define IDC_BUFFER1_USB 201040
#define IDC_COMBOMICAPI_USB 201041
#define IDC_SLIDER2_USB 201041
#define IDC_BUFFER2_USB 201042
// Next default values for new objects
//

View File

@ -216,7 +216,7 @@ void USBconfigure()
// Create the dialog window
GtkWidget* dlg = gtk_dialog_new_with_buttons(
"Qemu USB Settings", NULL, GTK_DIALOG_MODAL,
"USB Settings", NULL, GTK_DIALOG_MODAL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);

View File

@ -496,15 +496,15 @@ namespace usb_eyetoy
std::wstring selectedDevice;
LoadSetting(EyeToyWebCamDevice::TypeName(), port, APINAME, N_DEVICE, selectedDevice);
SendDlgItemMessage(hW, IDC_COMBO1, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hW, IDC_COMBO1_USB, CB_RESETCONTENT, 0, 0);
std::vector<std::wstring> devList = getDevList();
for (auto i = 0; i != devList.size(); i++)
{
SendDlgItemMessageW(hW, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)devList[i].c_str());
SendDlgItemMessageW(hW, IDC_COMBO1_USB, CB_ADDSTRING, 0, (LPARAM)devList[i].c_str());
if (selectedDevice == devList.at(i))
{
SendDlgItemMessage(hW, IDC_COMBO1, CB_SETCURSEL, i, i);
SendDlgItemMessage(hW, IDC_COMBO1_USB, CB_SETCURSEL, i, i);
}
}
return TRUE;
@ -518,7 +518,7 @@ namespace usb_eyetoy
{
INT_PTR res = RESULT_OK;
static wchar_t selectedDevice[500] = {0};
GetWindowTextW(GetDlgItem(hW, IDC_COMBO1), selectedDevice, countof(selectedDevice));
GetWindowTextW(GetDlgItem(hW, IDC_COMBO1_USB), selectedDevice, countof(selectedDevice));
port = (int)GetWindowLongPtr(hW, GWLP_USERDATA);
if (!SaveSetting<std::wstring>(EyeToyWebCamDevice::TypeName(), port, APINAME, N_DEVICE, selectedDevice))
{
@ -540,7 +540,7 @@ namespace usb_eyetoy
{
Win32Handles handles = *(Win32Handles*)data;
return DialogBoxParam(handles.hInst,
MAKEINTRESOURCE(IDD_DLG_EYETOY),
MAKEINTRESOURCE(IDD_DLG_EYETOY_USB),
handles.hWnd,
(DLGPROC)DirectShowDlgProc, port);
};

View File

@ -650,9 +650,6 @@ namespace usb_mic
pDst += samples;
samples_to_read -= samples;
}
mOutBuffer.MilliSecsSinceLastWrite(), mOutBuffer.peek_read(),
1000 * mOutBuffer.peek_read<short>() / mSamplesPerSec / mDeviceChannels);
if (!ReleaseMutex(mMutex))
return (outFrames - (samples_to_read / mDeviceChannels));
}
@ -842,7 +839,7 @@ namespace usb_mic
settings.dev_type = dev_type;
return (int)DialogBoxParam(h.hInst,
MAKEINTRESOURCE(IDD_DLGWASAPI),
MAKEINTRESOURCE(IDD_DLGWASAPI_USB),
h.hWnd,
(DLGPROC)WASAPIDlgProc, (LPARAM)&settings);
}
@ -851,28 +848,28 @@ namespace usb_mic
{
settings->sourceDevs.clear();
SendDlgItemMessage(hW, IDC_COMBO1, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hW, IDC_COMBO2, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hW, IDC_COMBO1_USB, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hW, IDC_COMBO2_USB, CB_RESETCONTENT, 0, 0);
SendDlgItemMessageW(hW, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)L"None");
SendDlgItemMessageW(hW, IDC_COMBO2, CB_ADDSTRING, 0, (LPARAM)L"None");
SendDlgItemMessageW(hW, IDC_COMBO1_USB, CB_ADDSTRING, 0, (LPARAM)L"None");
SendDlgItemMessageW(hW, IDC_COMBO2_USB, CB_ADDSTRING, 0, (LPARAM)L"None");
SendDlgItemMessage(hW, IDC_COMBO1, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hW, IDC_COMBO2, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hW, IDC_COMBO1_USB, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hW, IDC_COMBO2_USB, CB_SETCURSEL, 0, 0);
MMAudioDevice::AudioDevices(settings->sourceDevs, AUDIODIR_SOURCE);
AudioDeviceInfoList::iterator it;
int i = 0;
for (it = settings->sourceDevs.begin(); it != settings->sourceDevs.end(); ++it)
{
SendDlgItemMessageW(hW, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)it->strName.c_str());
SendDlgItemMessageW(hW, IDC_COMBO2, CB_ADDSTRING, 0, (LPARAM)it->strName.c_str());
SendDlgItemMessageW(hW, IDC_COMBO1_USB, CB_ADDSTRING, 0, (LPARAM)it->strName.c_str());
SendDlgItemMessageW(hW, IDC_COMBO2_USB, CB_ADDSTRING, 0, (LPARAM)it->strName.c_str());
i++;
if (it->strID == settings->selectedDev[0])
SendDlgItemMessage(hW, IDC_COMBO1, CB_SETCURSEL, i, i);
SendDlgItemMessage(hW, IDC_COMBO1_USB, CB_SETCURSEL, i, i);
if (it->strID == settings->selectedDev[1])
SendDlgItemMessage(hW, IDC_COMBO2, CB_SETCURSEL, i, i);
SendDlgItemMessage(hW, IDC_COMBO2_USB, CB_SETCURSEL, i, i);
}
}
@ -880,20 +877,20 @@ namespace usb_mic
{
settings->sinkDevs.clear();
SendDlgItemMessage(hW, IDC_COMBO3, CB_RESETCONTENT, 0, 0);
SendDlgItemMessageW(hW, IDC_COMBO3, CB_ADDSTRING, 0, (LPARAM)L"None");
SendDlgItemMessage(hW, IDC_COMBO3, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hW, IDC_COMBO3_USB, CB_RESETCONTENT, 0, 0);
SendDlgItemMessageW(hW, IDC_COMBO3_USB, CB_ADDSTRING, 0, (LPARAM)L"None");
SendDlgItemMessage(hW, IDC_COMBO3_USB, CB_SETCURSEL, 0, 0);
MMAudioDevice::AudioDevices(settings->sinkDevs, AUDIODIR_SINK);
AudioDeviceInfoList::iterator it;
int i = 0;
for (it = settings->sinkDevs.begin(); it != settings->sinkDevs.end(); ++it)
{
SendDlgItemMessageW(hW, IDC_COMBO3, CB_ADDSTRING, 0, (LPARAM)it->strName.c_str());
SendDlgItemMessageW(hW, IDC_COMBO3_USB, CB_ADDSTRING, 0, (LPARAM)it->strName.c_str());
i++;
if (it->strID == settings->selectedDev[2])
SendDlgItemMessage(hW, IDC_COMBO3, CB_SETCURSEL, i, i);
SendDlgItemMessage(hW, IDC_COMBO3_USB, CB_SETCURSEL, i, i);
}
}
@ -914,18 +911,18 @@ namespace usb_mic
int buffering = 50;
LoadSetting(s->dev_type, s->port, APINAME, N_BUFFER_LEN_SRC, buffering);
SendDlgItemMessage(hW, IDC_SLIDER1, TBM_SETRANGEMIN, TRUE, 1);
SendDlgItemMessage(hW, IDC_SLIDER1, TBM_SETRANGEMAX, TRUE, 1000);
SendDlgItemMessage(hW, IDC_SLIDER1, TBM_SETPOS, TRUE, buffering);
SetDlgItemInt(hW, IDC_BUFFER1, buffering, FALSE);
SendDlgItemMessage(hW, IDC_SLIDER1_USB, TBM_SETRANGEMIN, TRUE, 1);
SendDlgItemMessage(hW, IDC_SLIDER1_USB, TBM_SETRANGEMAX, TRUE, 1000);
SendDlgItemMessage(hW, IDC_SLIDER1_USB, TBM_SETPOS, TRUE, buffering);
SetDlgItemInt(hW, IDC_BUFFER1_USB, buffering, FALSE);
buffering = 50;
LoadSetting(s->dev_type, s->port, APINAME, N_BUFFER_LEN_SINK, buffering);
SendDlgItemMessage(hW, IDC_SLIDER2, TBM_SETRANGEMIN, TRUE, 1);
SendDlgItemMessage(hW, IDC_SLIDER2, TBM_SETRANGEMAX, TRUE, 1000);
SendDlgItemMessage(hW, IDC_SLIDER2, TBM_SETPOS, TRUE, buffering);
SetDlgItemInt(hW, IDC_BUFFER2, buffering, FALSE);
SendDlgItemMessage(hW, IDC_SLIDER2_USB, TBM_SETRANGEMIN, TRUE, 1);
SendDlgItemMessage(hW, IDC_SLIDER2_USB, TBM_SETRANGEMAX, TRUE, 1000);
SendDlgItemMessage(hW, IDC_SLIDER2_USB, TBM_SETPOS, TRUE, buffering);
SetDlgItemInt(hW, IDC_BUFFER2_USB, buffering, FALSE);
for (int i = 0; i < 2; i++)
{
@ -939,16 +936,16 @@ namespace usb_mic
return TRUE;
}
case WM_HSCROLL:
if ((HWND)lParam == GetDlgItem(hW, IDC_SLIDER1))
if ((HWND)lParam == GetDlgItem(hW, IDC_SLIDER1_USB))
{
int pos = SendDlgItemMessage(hW, IDC_SLIDER1, TBM_GETPOS, 0, 0);
SetDlgItemInt(hW, IDC_BUFFER1, pos, FALSE);
int pos = SendDlgItemMessage(hW, IDC_SLIDER1_USB, TBM_GETPOS, 0, 0);
SetDlgItemInt(hW, IDC_BUFFER1_USB, pos, FALSE);
break;
}
else if ((HWND)lParam == GetDlgItem(hW, IDC_SLIDER2))
else if ((HWND)lParam == GetDlgItem(hW, IDC_SLIDER2_USB))
{
int pos = SendDlgItemMessage(hW, IDC_SLIDER2, TBM_GETPOS, 0, 0);
SetDlgItemInt(hW, IDC_BUFFER2, pos, FALSE);
int pos = SendDlgItemMessage(hW, IDC_SLIDER2_USB, TBM_GETPOS, 0, 0);
SetDlgItemInt(hW, IDC_BUFFER2_USB, pos, FALSE);
break;
}
break;
@ -960,13 +957,13 @@ namespace usb_mic
{
switch (LOWORD(wParam))
{
case IDC_BUFFER1:
CHECKED_SET_MAX_INT(tmp, hW, IDC_BUFFER1, FALSE, 1, 1000);
SendDlgItemMessage(hW, IDC_SLIDER1, TBM_SETPOS, TRUE, tmp);
case IDC_BUFFER1_USB:
CHECKED_SET_MAX_INT(tmp, hW, IDC_BUFFER1_USB, FALSE, 1, 1000);
SendDlgItemMessage(hW, IDC_SLIDER1_USB, TBM_SETPOS, TRUE, tmp);
break;
case IDC_BUFFER2:
CHECKED_SET_MAX_INT(tmp, hW, IDC_BUFFER2, FALSE, 1, 1000);
SendDlgItemMessage(hW, IDC_SLIDER2, TBM_SETPOS, TRUE, tmp);
case IDC_BUFFER2_USB:
CHECKED_SET_MAX_INT(tmp, hW, IDC_BUFFER2_USB, FALSE, 1, 1000);
SendDlgItemMessage(hW, IDC_SLIDER2_USB, TBM_SETPOS, TRUE, tmp);
break;
}
}
@ -980,9 +977,9 @@ namespace usb_mic
int p[3];
s = (WASAPISettings*)GetWindowLongPtr(hW, GWLP_USERDATA);
INT_PTR res = RESULT_OK;
p[0] = SendDlgItemMessage(hW, IDC_COMBO1, CB_GETCURSEL, 0, 0);
p[1] = SendDlgItemMessage(hW, IDC_COMBO2, CB_GETCURSEL, 0, 0);
p[2] = SendDlgItemMessage(hW, IDC_COMBO3, CB_GETCURSEL, 0, 0);
p[0] = SendDlgItemMessage(hW, IDC_COMBO1_USB, CB_GETCURSEL, 0, 0);
p[1] = SendDlgItemMessage(hW, IDC_COMBO2_USB, CB_GETCURSEL, 0, 0);
p[2] = SendDlgItemMessage(hW, IDC_COMBO3_USB, CB_GETCURSEL, 0, 0);
for (int i = 0; i < 3; i++)
{
@ -999,10 +996,10 @@ namespace usb_mic
res = RESULT_FAILED;
}
if (!SaveSetting(s->dev_type, s->port, APINAME, N_BUFFER_LEN_SRC, (int32_t)SendDlgItemMessage(hW, IDC_SLIDER1, TBM_GETPOS, 0, 0)))
if (!SaveSetting(s->dev_type, s->port, APINAME, N_BUFFER_LEN_SRC, (int32_t)SendDlgItemMessage(hW, IDC_SLIDER1_USB, TBM_GETPOS, 0, 0)))
res = RESULT_FAILED;
if (!SaveSetting(s->dev_type, s->port, APINAME, N_BUFFER_LEN_SINK, (int32_t)SendDlgItemMessage(hW, IDC_SLIDER2, TBM_GETPOS, 0, 0)))
if (!SaveSetting(s->dev_type, s->port, APINAME, N_BUFFER_LEN_SINK, (int32_t)SendDlgItemMessage(hW, IDC_SLIDER2_USB, TBM_GETPOS, 0, 0)))
res = RESULT_FAILED;
EndDialog(hW, res);

View File

@ -39,7 +39,7 @@ namespace usb_msd
std::wstring var;
if (LoadSetting(MsdDevice::TypeName(), port, APINAME, N_CONFIG_PATH, var))
wcsncpy_s(buff, sizeof(buff), var.c_str(), countof(buff));
SetWindowTextW(GetDlgItem(hW, IDC_EDIT1), buff);
SetWindowTextW(GetDlgItem(hW, IDC_EDIT1_USB), buff);
return TRUE;
}
case WM_CREATE:
@ -51,7 +51,7 @@ namespace usb_msd
{
switch (LOWORD(wParam))
{
case IDC_BUTTON1:
case IDC_BUTTON1_USB:
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hW;
@ -67,13 +67,13 @@ namespace usb_msd
if (GetOpenFileName(&ofn))
{
SetWindowText(GetDlgItem(hW, IDC_EDIT1), ofn.lpstrFile);
SetWindowText(GetDlgItem(hW, IDC_EDIT1_USB), ofn.lpstrFile);
}
break;
case IDOK:
{
INT_PTR res = RESULT_OK;
GetWindowTextW(GetDlgItem(hW, IDC_EDIT1), buff, countof(buff));
GetWindowTextW(GetDlgItem(hW, IDC_EDIT1_USB), buff, countof(buff));
port = (int)GetWindowLongPtr(hW, GWLP_USERDATA);
if (!SaveSetting<std::wstring>(MsdDevice::TypeName(), port, APINAME, N_CONFIG_PATH, buff))
res = RESULT_FAILED;
@ -94,7 +94,7 @@ namespace usb_msd
{
Win32Handles handles = *(Win32Handles*)data;
return DialogBoxParam(handles.hInst,
MAKEINTRESOURCE(IDD_DLGMSD),
MAKEINTRESOURCE(IDD_DLGMSD_USB),
handles.hWnd,
(DLGPROC)MsdDlgProc, port);
}

View File

@ -721,10 +721,6 @@ namespace usb_pad
cSpring.lOffset = ff.u.condition.center * DI_FFNOMINALMAX / SHRT_MAX;
cSpring.lDeadBand = ff.u.condition.deadband * DI_FFNOMINALMAX / USHRT_MAX;
cSpring.lOffset, cSpring.lDeadBand,
cSpring.lNegativeCoefficient, cSpring.lPositiveCoefficient,
cSpring.dwNegativeSaturation, cSpring.dwPositiveSaturation);
if (g_pEffectSpring[m_port])
g_pEffectSpring[m_port]->SetParameters(&effSpring, DIEP_TYPESPECIFICPARAMS | DIEP_START);
}
@ -756,9 +752,6 @@ namespace usb_pad
cFriction.lOffset = ff.u.condition.center * DI_FFNOMINALMAX / SHRT_MAX;
cFriction.lDeadBand = ff.u.condition.deadband * DI_FFNOMINALMAX / USHRT_MAX;
cFriction.lNegativeCoefficient, cFriction.lPositiveCoefficient,
cFriction.dwNegativeSaturation);
if (g_pEffectFriction[m_port])
g_pEffectFriction[m_port]->SetParameters(&effFriction, DIEP_TYPESPECIFICPARAMS | DIEP_START);
}

View File

@ -91,7 +91,6 @@ END
IDD_DIALOG1 DIALOGEX 0, 0, 670, 309
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Qemu USB DirectInput Wheel Mod by jackun/Racer_S/EC Sim Hardware"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CTEXT "AXIS",IDC_GROUP1,6,6,186,12

View File

@ -37,10 +37,8 @@ namespace usb_pad
{
res = WriteFile(pad->mUsbHandle, buf.data(), buf.size(), &written, &pad->mOLWrite);
uint8_t* d = buf.data();
d[1], d[2], d[3], d[4], d[5], d[6], d[7]);
WaitForSingleObject(pad->mOLWrite.hEvent, 1000);
if (GetOverlappedResult(pad->mUsbHandle, &pad->mOLWrite, &written, FALSE))
}
}