USB: windows support!

This commit is contained in:
GovanifY 2020-11-04 14:26:46 +01:00 committed by refractionpcsx2
parent 92be17986f
commit 9eb78a0a19
33 changed files with 83 additions and 119 deletions

View File

@ -354,8 +354,8 @@ set(pcsx2USBSources
USB/usb-eyetoy/jo_mpeg.cpp
USB/usb-eyetoy/usb-eyetoy-webcam.cpp
USB/usb-hid/usb-hid.cpp
USB/shared/shared.cpp
USB/shared/inifile.cpp
USB/shared/shared_usb.cpp
USB/shared/inifile_usb.cpp
USB/shared/ringbuffer.cpp
USB/icon_buzz_24.cpp
USB/usb-msd/usb-msd-gtk.cpp
@ -417,8 +417,8 @@ set(pcsx2USBHeaders
USB/usb-hid/hidproxy.h
USB/usb-hid/usb-hid.h
USB/usb-hid/noop.h
USB/shared/shared.h
USB/shared/inifile.h
USB/shared/shared_usb.h
USB/shared/inifile_usb.h
USB/shared/ringbuffer.h
USB/linux/ini.h
USB/linux/actualfile.h

View File

@ -25,7 +25,7 @@
#include "osdebugout.h"
#include "qemu-usb/USBinternal.h"
#include "qemu-usb/desc.h"
#include "shared/shared.h"
#include "shared/shared_usb.h"
#include "deviceproxy.h"
#define PSXCLK 36864000 /* 36.864 Mhz */

View File

@ -17,13 +17,14 @@
#include "AppCoreThread.h"
#include "../USB.h"
#include "resource.h"
#include "Config.h"
#include "Config_usb.h"
#include "../deviceproxy.h"
#include "../usb-pad/padproxy.h"
#include "../usb-mic/audiodeviceproxy.h"
#include "../configuration.h"
#include "../shared/inifile_usb.h"
HINSTANCE hInst;
HINSTANCE hInstUSB;
extern bool configChanged;
void SysMessageA(const char* fmt, ...)
@ -79,7 +80,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, var))
if (LoadSetting(nullptr, port, rd.Name(devtype), N_DEVICE_API, str_to_wstr(var)))
OSDebugOut(L"Current API: %S\n", var.c_str());
else
{
@ -104,7 +105,7 @@ void PopulateAPIs(HWND hW, int port)
SendDlgItemMessage(hW, port ? IDC_COMBO_API1 : IDC_COMBO_API2, CB_SETCURSEL, sel, 0);
}
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
int port;
@ -196,7 +197,7 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (it == list.end())
break;
std::string api = *it;
Win32Handles handles(hInst, hW);
Win32Handles handles(hInstUSB, hW);
if (device->Configure(port, api, &handles) == RESULT_FAILED)
SysMessage(TEXT("Some settings may not have been saved!\n"));
}
@ -233,50 +234,13 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
return FALSE;
}
EXPORT_C_(BOOL)
AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
EndDialog(hW, FALSE);
return TRUE;
}
}
return FALSE;
}
void USBconfigure()
{
ScopedCoreThreadPause paused_core;
RegisterDevice::Register();
DialogBox(hInst,
DialogBox(hInstUSB,
MAKEINTRESOURCE(IDD_CONFIG),
GetActiveWindow(),
(DLGPROC)ConfigureDlgProc);
(DLGPROC)ConfigureDlgProcUSB);
paused_core.AllowResume();
}
EXPORT_C_(void)
USBabout()
{
DialogBox(hInst,
MAKEINTRESOURCE(IDD_ABOUT),
GetActiveWindow(),
(DLGPROC)AboutDlgProc);
}
BOOL APIENTRY DllMain(HANDLE hModule,
DWORD dwReason,
LPVOID lpReserved)
{
hInst = (HINSTANCE)hModule;
return TRUE;
}

View File

@ -17,7 +17,7 @@
#include "osdebugout.h"
#include "deviceproxy.h"
#include "configuration.h"
#include "shared/inifile.h"
#include "shared/inifile_usb.h"
#include "platcompat.h"
#include <map>
#include <vector>

View File

@ -14,7 +14,7 @@
*/
#include "PrecompiledHeader.h"
#include "inifile.h"
#include "inifile_usb.h"
#include <algorithm>
#include <iostream>
#include <fstream>

View File

@ -14,7 +14,7 @@
*/
#include "PrecompiledHeader.h"
#include "rawinput.h"
#include "rawinput_usb.h"
#include <cstdio>
#include <vector>
#include <algorithm>

View File

@ -14,11 +14,11 @@
*/
#include "PrecompiledHeader.h"
#include "shared.h"
#include "shared_usb.h"
#include <stdexcept>
#if defined(BUILD_RAW)
#include "rawinput.h"
#include "rawinput_usb.h"
#endif
namespace shared

View File

@ -19,7 +19,7 @@
#include "usb-eyetoy-webcam.h"
#include "jo_mpeg.h"
#include "../Win32/Config.h"
#include "../Win32/Config_usb.h"
#include "../Win32/resource.h"
namespace usb_eyetoy

View File

@ -19,7 +19,7 @@
#include "usb-eyetoy-webcam.h"
#include "ov519.h"
#include "../qemu-usb/desc.h"
#include "../shared/inifile.h"
#include "../shared/inifile_usb.h"
namespace usb_eyetoy
{

View File

@ -15,7 +15,7 @@
#include "PrecompiledHeader.h"
#include "rawinput.h"
#include "../../Win32/Config.h"
#include "../../Win32/Config_usb.h"
#include "../../qemu-usb/input-keymap.h"
#include "../../qemu-usb/input-keymap-win32-to-qcode.h"

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../shared/rawinput.h"
#include "../../shared/rawinput_usb.h"
#include "../hidproxy.h"
#include "../usb-hid.h"

View File

@ -29,7 +29,7 @@
#include "../qemu-usb/desc.h"
#include "usb-hid.h"
#include "../osdebugout.h"
#include "../shared/inifile.h"
#include "../shared/inifile_usb.h"
#define CONTAINER_OF(p, type, field) ((type*)((char*)p - ((ptrdiff_t) & ((type*)0)->field)))

View File

@ -22,7 +22,7 @@
#include <functiondiscoverykeys_devpkey.h>
#include <process.h>
#include "audiodev-wasapi.h"
#include "../Win32/Config.h"
#include "../Win32/Config_usb.h"
#include "../Win32/resource.h"
#define SafeRelease(x) \

View File

@ -27,7 +27,7 @@
#include "PrecompiledHeader.h"
#include "../qemu-usb/vl.h"
#include "../qemu-usb/desc.h"
#include "../shared/inifile.h"
#include "../shared/inifile_usb.h"
#include <assert.h>
#include "audio.h"

View File

@ -17,7 +17,7 @@
#include "usb-mic-singstar.h"
#include "audio.h"
#include "../qemu-usb/desc.h"
#include "../shared/inifile.h"
#include "../shared/inifile_usb.h"
namespace usb_mic
{

View File

@ -28,7 +28,7 @@
#include "../qemu-usb/vl.h"
#include "../qemu-usb/desc.h"
#include "usb-mic-singstar.h"
#include "../shared/inifile.h"
#include "../shared/inifile_usb.h"
#include <assert.h>
static FILE* file = NULL;

View File

@ -16,7 +16,7 @@
#include "PrecompiledHeader.h"
#include <commdlg.h>
#include "usb-msd.h"
#include "../Win32/Config.h"
#include "../Win32/Config_usb.h"
#include "../Win32/resource.h"
namespace usb_msd

View File

@ -28,7 +28,7 @@
#include "versionproxy.h"
#include "usb-pad-dx.h"
#include "../../shared/inifile.h"
#include "../../shared/inifile_usb.h"
namespace usb_pad
{

View File

@ -14,7 +14,7 @@
*/
#include "../padproxy.h"
#include "../../Win32/Config.h"
#include "../../Win32/Config_usb.h"
namespace usb_pad
{

View File

@ -15,7 +15,7 @@
#include "PrecompiledHeader.h"
#include "../../USB.h"
#include "../../Win32/Config.h"
#include "../../Win32/Config_usb.h"
#include "usb-pad-raw.h"
namespace usb_pad

View File

@ -20,7 +20,7 @@
#include <atomic>
#include "../padproxy.h"
#include "../usb-pad.h"
#include "../../shared/rawinput.h"
#include "../../shared/rawinput_usb.h"
#include "../../readerwriterqueue/readerwriterqueue.h"
namespace usb_pad

View File

@ -17,7 +17,7 @@
#include "padproxy.h"
#include "usb-pad.h"
#include "../qemu-usb/desc.h"
#include "../shared/inifile.h"
#include "../shared/inifile_usb.h"
namespace usb_pad
{

View File

@ -18,7 +18,7 @@
#include "usb-pad.h"
#include "../qemu-usb/desc.h"
#include "../usb-mic/usb-mic-singstar.h"
#include "../shared/inifile.h"
#include "../shared/inifile_usb.h"
namespace usb_pad
{

View File

@ -364,26 +364,26 @@
<ClCompile Include="..\..\USB\qemu-usb\usb-ohci.cpp" />
<ClCompile Include="..\..\USB\qemu-usb\vl.cpp" />
<ClCompile Include="..\..\USB\shared\hidapi.cpp" />
<ClCompile Include="..\..\USB\shared\inifile.cpp" />
<ClCompile Include="..\..\USB\shared\rawinput.cpp" />
<ClCompile Include="..\..\USB\shared\inifile_usb.cpp" />
<ClCompile Include="..\..\USB\shared\rawinput_usb.cpp" />
<ClCompile Include="..\..\USB\shared\ringbuffer.cpp" />
<ClCompile Include="..\..\USB\shared\shared.cpp" />
<ClCompile Include="..\..\USB\usb-eyetoy\api_init_win32.cpp" />
<ClCompile Include="..\..\USB\shared\shared_usb.cpp" />
<ClCompile Include="..\..\USB\usb-eyetoy\api_init_win32_eyetoy.cpp" />
<ClCompile Include="..\..\USB\usb-eyetoy\cam-windows.cpp" />
<ClCompile Include="..\..\USB\usb-eyetoy\jo_mpeg.cpp" />
<ClCompile Include="..\..\USB\usb-eyetoy\jpgd\jpgd.cpp" />
<ClCompile Include="..\..\USB\usb-eyetoy\usb-eyetoy-webcam.cpp" />
<ClCompile Include="..\..\USB\usb-hid\api_init_win32.cpp" />
<ClCompile Include="..\..\USB\usb-hid\api_init_win32_hid.cpp" />
<ClCompile Include="..\..\USB\usb-hid\raw\rawinput.cpp" />
<ClCompile Include="..\..\USB\usb-hid\usb-hid.cpp" />
<ClCompile Include="..\..\USB\usb-mic\api_init_win32.cpp" />
<ClCompile Include="..\..\USB\usb-mic\api_init_win32_mic.cpp" />
<ClCompile Include="..\..\USB\usb-mic\audiodev-wasapi.cpp" />
<ClCompile Include="..\..\USB\usb-mic\usb-headset.cpp" />
<ClCompile Include="..\..\USB\usb-mic\usb-mic-logitech.cpp" />
<ClCompile Include="..\..\USB\usb-mic\usb-mic-singstar.cpp" />
<ClCompile Include="..\..\USB\usb-msd\usb-msd-win32.cpp" />
<ClCompile Include="..\..\USB\usb-msd\usb-msd.cpp" />
<ClCompile Include="..\..\USB\usb-pad\api_init_win32.cpp" />
<ClCompile Include="..\..\USB\usb-pad\api_init_win32_pad.cpp" />
<ClCompile Include="..\..\USB\usb-pad\dx\dinput-config.cpp" />
<ClCompile Include="..\..\USB\usb-pad\dx\dinput.cpp" />
<ClCompile Include="..\..\USB\usb-pad\dx\usb-pad-dx.cpp" />
@ -394,7 +394,7 @@
<ClCompile Include="..\..\USB\usb-pad\usb-pad.cpp" />
<ClCompile Include="..\..\USB\usb-pad\usb-seamic.cpp" />
<ClCompile Include="..\..\USB\USB.cpp" />
<ClCompile Include="..\..\USB\Win32\Config.cpp" />
<ClCompile Include="..\..\USB\Win32\Config_usb.cpp" />
<ClCompile Include="..\..\Utilities\FileUtils.cpp" />
<ClCompile Include="..\..\Dump.cpp" />
<ClCompile Include="..\..\x86\iMisc.cpp" />
@ -681,10 +681,10 @@
<ClInclude Include="..\..\USB\readerwriterqueue\atomicops.h" />
<ClInclude Include="..\..\USB\readerwriterqueue\readerwriterqueue.h" />
<ClInclude Include="..\..\USB\shared\hidapi.h" />
<ClInclude Include="..\..\USB\shared\inifile.h" />
<ClInclude Include="..\..\USB\shared\rawinput.h" />
<ClInclude Include="..\..\USB\shared\inifile_usb.h" />
<ClInclude Include="..\..\USB\shared\rawinput_usb.h" />
<ClInclude Include="..\..\USB\shared\ringbuffer.h" />
<ClInclude Include="..\..\USB\shared\shared.h" />
<ClInclude Include="..\..\USB\shared\shared_usb.h" />
<ClInclude Include="..\..\USB\usb-eyetoy\cam-windows.h" />
<ClInclude Include="..\..\USB\usb-eyetoy\jo_mpeg.h" />
<ClInclude Include="..\..\USB\usb-eyetoy\jpgd\jpgd.h" />
@ -713,7 +713,7 @@
<ClInclude Include="..\..\USB\usb-pad\raw\usb-pad-raw.h" />
<ClInclude Include="..\..\USB\usb-pad\usb-pad.h" />
<ClInclude Include="..\..\USB\USB.h" />
<ClInclude Include="..\..\USB\Win32\Config.h" />
<ClInclude Include="..\..\USB\Win32\Config_usb.h" />
<ClInclude Include="..\..\USB\Win32\resource.h" />
<ClInclude Include="..\..\Utilities\AsciiFile.h" />
<ClInclude Include="..\..\Elfheader.h" />

View File

@ -1150,30 +1150,9 @@
<ClCompile Include="..\..\USB\usb-hid\usb-hid.cpp">
<Filter>System\Ps2\USB\usb-hid</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\shared\inifile.cpp">
<Filter>System\Ps2\USB\shared</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\shared\ringbuffer.cpp">
<Filter>System\Ps2\USB\shared</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\shared\shared.cpp">
<Filter>System\Ps2\USB\shared</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\usb-eyetoy\api_init_win32.cpp">
<Filter>System\Ps2\USB\usb-eyetoy</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\usb-hid\api_init_win32.cpp">
<Filter>System\Ps2\USB\usb-hid</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\usb-mic\api_init_win32.cpp">
<Filter>System\Ps2\USB\usb-mic</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\usb-pad\api_init_win32.cpp">
<Filter>System\Ps2\USB\usb-pad</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\Win32\Config.cpp">
<Filter>System\Ps2\USB\Win32</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\usb-mic\audiodev-wasapi.cpp">
<Filter>System\Ps2\USB\usb-mic</Filter>
</ClCompile>
@ -1183,9 +1162,6 @@
<ClCompile Include="..\..\USB\shared\hidapi.cpp">
<Filter>System\Ps2\USB\shared</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\shared\rawinput.cpp">
<Filter>System\Ps2\USB\shared</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\qemu-usb\input-keymap-win32-to-qcode.cpp">
<Filter>System\Ps2\USB\qemu-usb</Filter>
</ClCompile>
@ -1210,6 +1186,30 @@
<ClCompile Include="..\..\USB\usb-pad\raw\usb-pad-raw.cpp">
<Filter>System\Ps2\USB\usb-pad\raw</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\usb-pad\api_init_win32_pad.cpp">
<Filter>System\Ps2\USB\usb-pad</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\usb-mic\api_init_win32_mic.cpp">
<Filter>System\Ps2\USB\usb-mic</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\usb-hid\api_init_win32_hid.cpp">
<Filter>System\Ps2\USB\usb-hid</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\usb-eyetoy\api_init_win32_eyetoy.cpp">
<Filter>System\Ps2\USB\usb-eyetoy</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\Win32\Config_usb.cpp">
<Filter>System\Ps2\USB\Win32</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\shared\shared_usb.cpp">
<Filter>System\Ps2\USB\shared</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\shared\inifile_usb.cpp">
<Filter>System\Ps2\USB\shared</Filter>
</ClCompile>
<ClCompile Include="..\..\USB\shared\rawinput_usb.cpp">
<Filter>System\Ps2\USB\shared</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Patch.h">
@ -1866,18 +1866,9 @@
<ClInclude Include="..\..\USB\usb-hid\usb-hid.h">
<Filter>System\Ps2\USB\usb-hid</Filter>
</ClInclude>
<ClInclude Include="..\..\USB\shared\inifile.h">
<Filter>System\Ps2\USB\shared</Filter>
</ClInclude>
<ClInclude Include="..\..\USB\shared\ringbuffer.h">
<Filter>System\Ps2\USB\shared</Filter>
</ClInclude>
<ClInclude Include="..\..\USB\shared\shared.h">
<Filter>System\Ps2\USB\shared</Filter>
</ClInclude>
<ClInclude Include="..\..\USB\Win32\Config.h">
<Filter>System\Ps2\USB\Win32</Filter>
</ClInclude>
<ClInclude Include="..\..\USB\Win32\resource.h">
<Filter>System\Ps2\USB\Win32</Filter>
</ClInclude>
@ -1887,9 +1878,6 @@
<ClInclude Include="..\..\USB\shared\hidapi.h">
<Filter>System\Ps2\USB\shared</Filter>
</ClInclude>
<ClInclude Include="..\..\USB\shared\rawinput.h">
<Filter>System\Ps2\USB\shared</Filter>
</ClInclude>
<ClInclude Include="..\..\USB\qemu-usb\input-keymap-win32-to-qcode.h">
<Filter>System\Ps2\USB\qemu-usb</Filter>
</ClInclude>
@ -1914,6 +1902,18 @@
<ClInclude Include="..\..\USB\usb-pad\raw\usb-pad-raw.h">
<Filter>System\Ps2\USB\usb-pad\raw</Filter>
</ClInclude>
<ClInclude Include="..\..\USB\Win32\Config_usb.h">
<Filter>System\Ps2\USB\Win32</Filter>
</ClInclude>
<ClInclude Include="..\..\USB\shared\shared_usb.h">
<Filter>System\Ps2\USB\shared</Filter>
</ClInclude>
<ClInclude Include="..\..\USB\shared\inifile_usb.h">
<Filter>System\Ps2\USB\shared</Filter>
</ClInclude>
<ClInclude Include="..\..\USB\shared\rawinput_usb.h">
<Filter>System\Ps2\USB\shared</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\wxResources.rc">