PAD: initial merge relatively complete, linker issues left

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-12-09 21:41:13 +01:00 committed by lightningterror
parent 913bb359a0
commit 69e837c1ea
5 changed files with 24 additions and 70 deletions

View File

@ -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()

View File

@ -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

View File

@ -30,10 +30,11 @@
#include <windowsx.h>
#else
/*
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
*/
#endif

View File

@ -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)

View File

@ -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 );