Skip to content

Commit

Permalink
PAD: initial merge relatively complete, linker issues left
Browse files Browse the repository at this point in the history
  • Loading branch information
GovanifY authored and lightningterror committed Dec 17, 2020
1 parent 913bb35 commit 69e837c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 70 deletions.
19 changes: 19 additions & 0 deletions cmake/Pcsx2Utils.cmake
Expand Up @@ -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()
6 changes: 3 additions & 3 deletions pcsx2/CMakeLists.txt
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pcsx2/PAD/Linux/PAD.h
Expand Up @@ -30,10 +30,11 @@
#include <windowsx.h>

#else

/*
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
*/

#endif

Expand Down
24 changes: 0 additions & 24 deletions pcsx2/gui/MainMenuClicks.cpp
Expand Up @@ -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)
Expand Down
42 changes: 0 additions & 42 deletions pcsx2/gui/Panels/PluginSelectorPanel.cpp
Expand Up @@ -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 );

Expand Down

0 comments on commit 69e837c

Please sign in to comment.