From 2e0be1f75a8c65d1696f63e8886d34eca3a5c249 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Fri, 11 Dec 2020 04:25:21 +0100 Subject: [PATCH] PAD: add back config screen, pause core when opened --- pcsx2/PAD/Linux/PAD.cpp | 2 +- pcsx2/PAD/Linux/PAD.h | 2 +- pcsx2/PAD/Linux/ini.cpp | 8 ++++---- pcsx2/PAD/Linux/linux.cpp | 3 +++ pcsx2/System/SysCoreThread.cpp | 3 ++- pcsx2/gui/AppCoreThread.cpp | 1 + pcsx2/gui/MainFrame.cpp | 2 ++ pcsx2/gui/MainFrame.h | 1 + pcsx2/gui/MainMenuClicks.cpp | 6 ++++++ 9 files changed, 21 insertions(+), 7 deletions(-) diff --git a/pcsx2/PAD/Linux/PAD.cpp b/pcsx2/PAD/Linux/PAD.cpp index 1be97c8d83..751833a209 100644 --- a/pcsx2/PAD/Linux/PAD.cpp +++ b/pcsx2/PAD/Linux/PAD.cpp @@ -88,7 +88,7 @@ void CloseLogging() #endif } -s32 PADinit(u32 flags) +s32 PADinit() { initLogging(); diff --git a/pcsx2/PAD/Linux/PAD.h b/pcsx2/PAD/Linux/PAD.h index 11f8289ce5..f5cfc89734 100644 --- a/pcsx2/PAD/Linux/PAD.h +++ b/pcsx2/PAD/Linux/PAD.h @@ -121,7 +121,7 @@ void PADSaveConfig(); void SysMessage(char *fmt, ...); -s32 PADinit(u32 flags); +s32 PADinit(); void PADshutdown(); s32 PADopen(void *pDsp); void PADsetSettingsDir(const char *dir); diff --git a/pcsx2/PAD/Linux/ini.cpp b/pcsx2/PAD/Linux/ini.cpp index 52cd73b762..90dbb790a4 100644 --- a/pcsx2/PAD/Linux/ini.cpp +++ b/pcsx2/PAD/Linux/ini.cpp @@ -19,7 +19,7 @@ #include "keyboard.h" #include "PAD.h" -extern std::string s_strIniPath; +extern std::string s_padstrIniPath; void DefaultKeyboardValues() { @@ -43,10 +43,10 @@ void PADSaveConfig() { FILE *f; - const std::string iniFile(s_strIniPath + "OnePAD2.ini"); + const std::string iniFile(s_padstrIniPath + "PAD.ini"); f = fopen(iniFile.c_str(), "w"); if (f == NULL) { - printf("OnePAD: failed to save ini %s\n", iniFile.c_str()); + printf("PAD: failed to save ini %s\n", iniFile.c_str()); return; } @@ -75,7 +75,7 @@ void PADLoadConfig() g_conf.init(); - const std::string iniFile(s_strIniPath + "OnePAD2.ini"); + const std::string iniFile(s_padstrIniPath + "PAD.ini"); f = fopen(iniFile.c_str(), "r"); if (f == NULL) { printf("OnePAD: failed to load ini %s\n", iniFile.c_str()); diff --git a/pcsx2/PAD/Linux/linux.cpp b/pcsx2/PAD/Linux/linux.cpp index c05b740bce..92843be4d3 100644 --- a/pcsx2/PAD/Linux/linux.cpp +++ b/pcsx2/PAD/Linux/linux.cpp @@ -13,6 +13,7 @@ * If not, see . */ +#include "AppCoreThread.h" #include "GamePad.h" #include "PAD.h" #include "keyboard.h" @@ -114,8 +115,10 @@ void PADupdate(int pad) void PADconfigure() { + ScopedCoreThreadPause paused_core; PADLoadConfig(); DisplayDialog(); + paused_core.AllowResume(); return; } diff --git a/pcsx2/System/SysCoreThread.cpp b/pcsx2/System/SysCoreThread.cpp index fcbb9206a8..6547a6b3a7 100644 --- a/pcsx2/System/SysCoreThread.cpp +++ b/pcsx2/System/SysCoreThread.cpp @@ -30,6 +30,7 @@ #include "SPU2/spu2.h" #include "DEV9/DEV9.h" #include "USB/USB.h" +#include "PAD/Linux/PAD.h" #include "../DebugTools/MIPSAnalyst.h" #include "../DebugTools/SymbolMap.h" @@ -327,7 +328,7 @@ void SysCoreThread::OnResumeInThread(bool isSuspended) } FWopen(); SPU2open((void*)pDsp); - PADopen(); + PADopen((void*)pDsp); } diff --git a/pcsx2/gui/AppCoreThread.cpp b/pcsx2/gui/AppCoreThread.cpp index 84aaca7a68..a96e082560 100644 --- a/pcsx2/gui/AppCoreThread.cpp +++ b/pcsx2/gui/AppCoreThread.cpp @@ -35,6 +35,7 @@ #include "Patch.h" #include "R5900Exceptions.h" #include "Sio.h" +#include "PAD/Linux/PAD.h" #ifndef DISABLE_RECORDING #include "Recording/InputRecordingControls.h" diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 173873cf95..e8991a04e9 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -250,6 +250,7 @@ void MainEmuFrame::ConnectMenus() Bind(wxEVT_MENU, &MainEmuFrame::Menu_AudioSettings_Click, this, MenuId_Config_SPU2); Bind(wxEVT_MENU, &MainEmuFrame::Menu_NetworkSettings_Click, this, MenuId_Config_DEV9); Bind(wxEVT_MENU, &MainEmuFrame::Menu_USBSettings_Click, this, MenuId_Config_USB); + Bind(wxEVT_MENU, &MainEmuFrame::Menu_PADSettings_Click, this, MenuId_Config_PAD); Bind(wxEVT_MENU, &MainEmuFrame::Menu_GSSettings_Click, this, MenuId_Video_CoreSettings); Bind(wxEVT_MENU, &MainEmuFrame::Menu_WindowSettings_Click, this, MenuId_Video_WindowSettings); @@ -443,6 +444,7 @@ void MainEmuFrame::CreateConfigMenu() m_menuConfig.Append(MenuId_Config_SPU2, _("&Audio Settings...")); m_menuConfig.Append(MenuId_Config_DEV9, _("&Network and HDD Settings...") ); m_menuConfig.Append(MenuId_Config_USB, _("&USB Settings...")); + m_menuConfig.Append(MenuId_Config_PAD, _("&GamePad Settings...")); m_menuConfig.AppendSeparator(); diff --git a/pcsx2/gui/MainFrame.h b/pcsx2/gui/MainFrame.h index e214e7ea83..7553615442 100644 --- a/pcsx2/gui/MainFrame.h +++ b/pcsx2/gui/MainFrame.h @@ -194,6 +194,7 @@ protected: void Menu_NetworkSettings_Click(wxCommandEvent &event); void Menu_AudioSettings_Click(wxCommandEvent& event); void Menu_USBSettings_Click(wxCommandEvent& event); + void Menu_PADSettings_Click(wxCommandEvent& event); void Menu_McdSettings_Click(wxCommandEvent& event); void Menu_WindowSettings_Click(wxCommandEvent& event); void Menu_GSSettings_Click(wxCommandEvent& event); diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index c78ac7518b..cd8588c84f 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -23,6 +23,7 @@ #include "System/SysThreads.h" #include "DEV9/DEV9.h" #include "USB/USB.h" +#include "PAD/Linux/PAD.h" #include "ConsoleLogger.h" #include "MainFrame.h" @@ -70,6 +71,11 @@ void MainEmuFrame::Menu_USBSettings_Click(wxCommandEvent& event) USBconfigure(); } +void MainEmuFrame::Menu_PADSettings_Click(wxCommandEvent& event) +{ + PADconfigure(); +} + void MainEmuFrame::Menu_WindowSettings_Click(wxCommandEvent &event) { wxCommandEvent evt(pxEvt_SetSettingsPage);