From 2b4e73e885b8295613f212631842ddd1f9ddce9a Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Fri, 11 Dec 2020 20:41:20 +0100 Subject: [PATCH] PAD: windows merge relatively complete, linker issues left --- pcsx2/PAD/Windows/PAD.cpp | 36 ++++++++++++++++----------------- pcsx2/PAD/Windows/PAD.h | 5 +---- pcsx2/PAD/Windows/PADConfig.cpp | 2 +- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/pcsx2/PAD/Windows/PAD.cpp b/pcsx2/PAD/Windows/PAD.cpp index 1204d67919..5249673ceb 100644 --- a/pcsx2/PAD/Windows/PAD.cpp +++ b/pcsx2/PAD/Windows/PAD.cpp @@ -782,42 +782,40 @@ struct QueryInfo u8 response[42]; } query = {0, 0, 0, 0, 0, 0xFF, {0xF3}}; -s32 PADinit(u32 flags) +s32 PADinit() { + const u32 flags = 3; // Note: Won't load settings if already loaded. if (LoadSettings() < 0) { return -1; } int port = (flags & 3); - if (port == 3) { - if (PADinit(1) == -1) - return -1; - return PADinit(2); - } #if defined(PCSX2_DEBUG) && defined(_MSC_VER) int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); tmpFlag |= _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF; _CrtSetDbgFlag(tmpFlag); #endif + for (int i = 2; i > 0; i--) + { + port = i; + port--; - port--; + for (int slot = 0; slot < 4; slot++) + ResetPad(port, slot); + slots[port] = 0; + portInitialized[port] = 1; - for (int slot = 0; slot < 4; slot++) - ResetPad(port, slot); - slots[port] = 0; - portInitialized[port] = 1; - - query.lastByte = 1; - query.numBytes = 0; - ClearKeyQueue(); + query.lastByte = 1; + query.numBytes = 0; + ClearKeyQueue(); #ifdef __linux__ - R_ClearKeyQueue(); + R_ClearKeyQueue(); #endif - // Just in case, when resuming emulation. - ReleaseModifierKeys(); + // Just in case, when resuming emulation. + ReleaseModifierKeys(); + } - DEBUG_TEXT_OUT("LilyPad initialized\n\n"); return 0; } diff --git a/pcsx2/PAD/Windows/PAD.h b/pcsx2/PAD/Windows/PAD.h index 5a7e5c1b43..c1db5939ee 100644 --- a/pcsx2/PAD/Windows/PAD.h +++ b/pcsx2/PAD/Windows/PAD.h @@ -26,9 +26,6 @@ #include #include "PS2Edefs.h" -#include -#include - #include #include #include @@ -50,7 +47,7 @@ typedef struct void PADupdate(int pad); void PADshutdown(); -s32 PADinit(u32 flags); +s32 PADinit(); s32 PADopen(void* pDsp); void PADclose(); u8 PADstartPoll(int pad); diff --git a/pcsx2/PAD/Windows/PADConfig.cpp b/pcsx2/PAD/Windows/PADConfig.cpp index 15052a9a07..529deb0159 100644 --- a/pcsx2/PAD/Windows/PADConfig.cpp +++ b/pcsx2/PAD/Windows/PADConfig.cpp @@ -304,7 +304,7 @@ wchar_t *GetCommandStringW(u8 command, int port, int slot) static wchar_t iniFile[MAX_PATH * 2] = L"inis/LilyPad.ini"; -void CALLBACK PADsetSettingsDir(const char *dir) +void PADsetSettingsDir(const char *dir) { //swprintf_s( iniFile, L"%S", (dir==NULL) ? "inis" : dir );