From 69e837c1ea89cce3e6d36352acfc04c55565c385 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Wed, 9 Dec 2020 21:41:13 +0100 Subject: [PATCH] PAD: initial merge relatively complete, linker issues left --- cmake/Pcsx2Utils.cmake | 19 +++++++++++ pcsx2/CMakeLists.txt | 6 ++-- pcsx2/PAD/Linux/PAD.h | 3 +- pcsx2/gui/MainMenuClicks.cpp | 24 -------------- pcsx2/gui/Panels/PluginSelectorPanel.cpp | 42 ------------------------ 5 files changed, 24 insertions(+), 70 deletions(-) diff --git a/cmake/Pcsx2Utils.cmake b/cmake/Pcsx2Utils.cmake index 548ce5f93c..8a33c62854 100644 --- a/cmake/Pcsx2Utils.cmake +++ b/cmake/Pcsx2Utils.cmake @@ -180,3 +180,22 @@ macro(add_custom_glib_res out xml prefix) --c-name ${prefix} "${RESOURCE_DIR}/${xml}" --target=${out}.cpp DEPENDS res/${xml} ${RESOURCE_FILES}) endmacro() + +# Helper macro to generate resources on linux (based on glib) +macro(add_custom_glib out xml prefix) + set(RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + set(RESOURCE_FILES "${ARGN}") + # Note: trying to combine --generate-source and --generate-header doesn't work. + # It outputs whichever one comes last into the file named by the first + add_custom_command( + OUTPUT ${out}.h + COMMAND glib-compile-resources --sourcedir "${RESOURCE_DIR}" --generate-header + --c-name ${prefix} "${RESOURCE_DIR}/${xml}" --target=${out}.h + DEPENDS res/${xml} ${RESOURCE_FILES}) + + add_custom_command( + OUTPUT ${out}.cpp + COMMAND glib-compile-resources --sourcedir "${RESOURCE_DIR}" --generate-source + --c-name ${prefix} "${RESOURCE_DIR}/${xml}" --target=${out}.cpp + DEPENDS res/${xml} ${RESOURCE_FILES}) +endmacro() diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 8a58ae2e5d..cfb742ee37 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -468,11 +468,11 @@ foreach(result_file IN ITEMS COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${PADImg}/${result_file}.png" "${PADImgHeader}/${result_file}" ) endforeach() -add_custom_glib_res("PAD/Linux/resources" "PAD/Linux/res/PAD-res.xml" "PAD_res" PAD/Linux/res/game_controller_db.txt) +add_custom_glib("PAD/Linux/resources" "PAD/Linux/res/PAD-res.xml" "PAD_res" PAD/Linux/res/game_controller_db.txt) # PAD/Linux sources -set(pcsx2PAD/LinuxSources +set(pcsx2PADSources PAD/Linux/controller.cpp PAD/Linux/GamePad.cpp PAD/Linux/SDL/joystick.cpp @@ -490,7 +490,7 @@ set(pcsx2PAD/LinuxSources ) # PAD/Linux headers -set(pcsx2PAD/LinuxHeaders +set(pcsx2PADHeaders PAD/Linux/bitwise.h PAD/Linux/controller.h PAD/Linux/GamePad.h diff --git a/pcsx2/PAD/Linux/PAD.h b/pcsx2/PAD/Linux/PAD.h index 902c2be18a..744b5569c5 100644 --- a/pcsx2/PAD/Linux/PAD.h +++ b/pcsx2/PAD/Linux/PAD.h @@ -30,10 +30,11 @@ #include #else - +/* #include #include #include +*/ #endif diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index a1cf531acd..c78ac7518b 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -771,31 +771,7 @@ void MainEmuFrame::Menu_ConfigPlugin_Click(wxCommandEvent& event) wxWindowDisabler disabler; ScopedCoreThreadPause paused_core(new SysExecEvent_SaveSinglePlugin(pid)); -#ifndef DISABLE_RECORDING - if (pid == PluginId_PAD) - { - // The recording features involve pausing emulation, and can be resumed ideally via key-bindings. - // - // However, since the PAD plugin is used to do so, if it's closed then there is nothing to read - // the keybind resulting producing an unrecovable state. - // - // If the CoreThread is paused prior to opening the PAD plugin settings then when the settings - // are closed the PAD will not re-open. To avoid this, we resume emulation prior to the plugins - // configuration handler doing so. - if (g_Conf->EmuOptions.EnableRecordingTools && g_InputRecordingControls.IsPaused()) - { - g_InputRecordingControls.Resume(); - GetCorePlugins().Configure(pid); - g_InputRecordingControls.Pause(); - } - else - GetCorePlugins().Configure(pid); - } - else - GetCorePlugins().Configure(pid); -#else GetCorePlugins().Configure(pid); -#endif } void MainEmuFrame::Menu_Debug_Open_Click(wxCommandEvent& event) diff --git a/pcsx2/gui/Panels/PluginSelectorPanel.cpp b/pcsx2/gui/Panels/PluginSelectorPanel.cpp index bb62ca7b69..6ef3d431d4 100644 --- a/pcsx2/gui/Panels/PluginSelectorPanel.cpp +++ b/pcsx2/gui/Panels/PluginSelectorPanel.cpp @@ -700,48 +700,6 @@ void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt ) else if( index_sse2 >= 0 ) m_ComponentBoxes->Get(pid).SetSelection( index_sse2 ); else m_ComponentBoxes->Get(pid).SetSelection( 0 ); } - else if (pid == PluginId_PAD) - { - int count = (int)m_ComponentBoxes->Get(pid).GetCount(); - - int index_lilypad = -1; - int index_onepad = -1; - int index_onepad_legacy = -1; - - for( int i = 0; i < count; i++ ) - { - auto str = m_ComponentBoxes->Get(pid).GetString(i).Lower(); - - if (str.Contains("lilypad")) index_lilypad = i; - if (str.Contains("onepad")) - { - if (str.Contains("legacy")) - index_onepad_legacy = i; - else - index_onepad = i; - } - } - - #ifdef _WIN32 - if (index_lilypad >= 0) - m_ComponentBoxes->Get(pid).SetSelection(index_lilypad); - /* else if (index_onepad >= 0) - m_ComponentBoxes->Get(pid).SetSelection(index_onepad); - else if (index_onepad_legacy >= 0) - m_ComponentBoxes->Get(pid).SetSelection(index_onepad_legacy); */ - else - m_ComponentBoxes->Get(pid).SetSelection(0); - #else - if (index_onepad >= 0) - m_ComponentBoxes->Get(pid).SetSelection(index_onepad); - else if (index_onepad_legacy >= 0) - m_ComponentBoxes->Get(pid).SetSelection(index_onepad_legacy); - else if (index_lilypad >= 0) - m_ComponentBoxes->Get(pid).SetSelection(index_lilypad); - else - m_ComponentBoxes->Get(pid).SetSelection(0); - #endif - } else m_ComponentBoxes->Get(pid).SetSelection( 0 );