mirror of https://github.com/PCSX2/pcsx2.git
PAD: Call one joint pad header in most of pcsx2, not two. (#4985)
Add Gamepad.h Cleanup. Remove the Windows version of PAD.h as well. Update CMakeLists.txt Revert language changes.
This commit is contained in:
parent
eee51828cb
commit
b8a2cd1b06
|
@ -492,7 +492,7 @@ if(WIN32)
|
|||
)
|
||||
|
||||
set(pcsx2PADHeaders
|
||||
PAD/Windows/PAD.h
|
||||
PAD/Gamepad.h
|
||||
PAD/Windows/PADConfig.h
|
||||
PAD/Windows/DeviceEnumerator.h
|
||||
PAD/Windows/Diagnostics.h
|
||||
|
@ -557,12 +557,12 @@ else(WIN32)
|
|||
PAD/Linux/wx_dialog/GamepadConfiguration.cpp
|
||||
PAD/Linux/wx_dialog/JoystickConfiguration.cpp
|
||||
PAD/Linux/Config.cpp
|
||||
PAD/Linux/linux.cpp
|
||||
${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.cpp
|
||||
)
|
||||
|
||||
# PAD/Linux headers
|
||||
set(pcsx2PADHeaders
|
||||
PAD/Gamepad.h
|
||||
PAD/Linux/bitwise.h
|
||||
PAD/Linux/Config.h
|
||||
PAD/Linux/Device.h
|
||||
|
@ -571,7 +571,6 @@ else(WIN32)
|
|||
PAD/Linux/SDL/joystick.h
|
||||
PAD/Linux/keyboard.h
|
||||
PAD/Linux/KeyStatus.h
|
||||
PAD/Linux/PAD.h
|
||||
PAD/Linux/state_management.h
|
||||
PAD/Linux/wx_dialog/opPanel.h
|
||||
PAD/Linux/wx_dialog/GamepadConfiguration.h
|
||||
|
|
|
@ -15,49 +15,22 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Global.h"
|
||||
#include "Host.h"
|
||||
#include "common/mt_queue.h"
|
||||
#include "common/WindowInfo.h"
|
||||
#include "SaveState.h"
|
||||
|
||||
enum PadOptions
|
||||
{
|
||||
PADOPTION_FORCEFEEDBACK = 0x1,
|
||||
PADOPTION_REVERSELX = 0x2,
|
||||
PADOPTION_REVERSELY = 0x4,
|
||||
PADOPTION_REVERSERX = 0x8,
|
||||
PADOPTION_REVERSERY = 0x10,
|
||||
PADOPTION_MOUSE_L = 0x20,
|
||||
PADOPTION_MOUSE_R = 0x40,
|
||||
};
|
||||
|
||||
struct WindowInfo;
|
||||
|
||||
extern FILE* padLog;
|
||||
extern void initLogging();
|
||||
|
||||
extern HostKeyEvent event;
|
||||
extern MtQueue<HostKeyEvent> g_ev_fifo;
|
||||
|
||||
s32 _PADopen(const WindowInfo& wi);
|
||||
void _PADclose();
|
||||
void PADsetMode(int pad, int mode);
|
||||
|
||||
void SysMessage(char* fmt, ...);
|
||||
#include "Host.h"
|
||||
|
||||
s32 PADinit();
|
||||
void PADshutdown();
|
||||
s32 PADopen(const WindowInfo& wi);
|
||||
void PADsetLogDir(const char* dir);
|
||||
void PADupdate(int pad);
|
||||
void PADclose();
|
||||
s32 PADsetSlot(u8 port, u8 slot);
|
||||
s32 PADfreeze(FreezeAction mode, freezeData* data);
|
||||
u8 PADstartPoll(int pad);
|
||||
u8 PADpoll(u8 value);
|
||||
HostKeyEvent* PADkeyEvent();
|
||||
void PADupdate(int pad);
|
||||
void PADconfigure();
|
||||
s32 PADfreeze(FreezeAction mode, freezeData* data);
|
||||
s32 PADsetSlot(u8 port, u8 slot);
|
||||
|
||||
#if defined(__unix__)
|
||||
void PADWriteEvent(HostKeyEvent& evt);
|
||||
#endif
|
||||
#endif
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "common/pxStreams.h"
|
||||
#include "common/Console.h"
|
||||
#include "common/mt_queue.h"
|
||||
#include "DebugTools/Debug.h"
|
||||
|
||||
#define PADdefs
|
||||
|
@ -95,6 +96,17 @@ static const std::array<gamePadValues, MAX_KEYS> all_keys =
|
|||
PAD_R_LEFT // Right joystick (Left) ←
|
||||
};
|
||||
|
||||
enum PadOptions
|
||||
{
|
||||
PADOPTION_FORCEFEEDBACK = 0x1,
|
||||
PADOPTION_REVERSELX = 0x2,
|
||||
PADOPTION_REVERSELY = 0x4,
|
||||
PADOPTION_REVERSERX = 0x8,
|
||||
PADOPTION_REVERSERY = 0x10,
|
||||
PADOPTION_MOUSE_L = 0x20,
|
||||
PADOPTION_MOUSE_R = 0x40,
|
||||
};
|
||||
|
||||
static bool IsAnalogKey(int index)
|
||||
{
|
||||
return ((index >= PAD_L_UP) && (index <= PAD_R_LEFT));
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "common/WindowInfo.h"
|
||||
|
||||
#include "keyboard.h"
|
||||
#include "PAD.h"
|
||||
#include "../Gamepad.h"
|
||||
#include "state_management.h"
|
||||
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
|
@ -33,6 +33,14 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "gui/AppCoreThread.h"
|
||||
#include "wx_dialog/dialog.h"
|
||||
|
||||
#ifndef __APPLE__
|
||||
Display* GSdsp;
|
||||
Window GSwin;
|
||||
#endif
|
||||
|
||||
const u32 revision = 3;
|
||||
const u32 build = 0; // increase that with each version
|
||||
#define PAD_SAVE_STATE_VERSION ((revision << 8) | (build << 0))
|
||||
|
@ -122,22 +130,20 @@ s32 PADopen(const WindowInfo& wi)
|
|||
#if defined(__unix__) || defined(__APPLE__)
|
||||
EnumerateDevices();
|
||||
#endif
|
||||
return _PADopen(wi);
|
||||
}
|
||||
#ifndef __APPLE__
|
||||
if (wi.type != WindowInfo::Type::X11)
|
||||
return -1;
|
||||
|
||||
void PADsetLogDir(const char* dir)
|
||||
{
|
||||
// Get the path to the log directory.
|
||||
s_padstrLogPath = (dir == NULL) ? "logs/" : dir;
|
||||
GSdsp = static_cast<Display*>(wi.display_connection);
|
||||
GSwin = reinterpret_cast<Window>(wi.window_handle);
|
||||
#endif
|
||||
|
||||
// Reload the log file after updated the path
|
||||
CloseLogging();
|
||||
initLogging();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PADclose()
|
||||
{
|
||||
_PADclose();
|
||||
device_manager.devices.clear();
|
||||
}
|
||||
|
||||
s32 PADsetSlot(u8 port, u8 slot)
|
||||
|
@ -292,3 +298,33 @@ void PADWriteEvent(HostKeyEvent& evt)
|
|||
g_ev_fifo.push(evt);
|
||||
}
|
||||
#endif
|
||||
|
||||
void PADupdate(int pad)
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
// Gamepad inputs don't count as an activity. Therefore screensaver will
|
||||
// be fired after a couple of minute.
|
||||
// Emulate an user activity
|
||||
static int count = 0;
|
||||
count++;
|
||||
if ((count & 0xFFF) == 0)
|
||||
{
|
||||
// 1 call every 4096 Vsync is enough
|
||||
XResetScreenSaver(GSdsp);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Actually PADupdate is always call with pad == 0. So you need to update both
|
||||
// pads -- Gregory
|
||||
device_manager.Update();
|
||||
}
|
||||
|
||||
void PADconfigure()
|
||||
{
|
||||
ScopedCoreThreadPause paused_core;
|
||||
PADLoadConfig();
|
||||
|
||||
DisplayDialog();
|
||||
paused_core.AllowResume();
|
||||
return;
|
||||
}
|
|
@ -20,7 +20,10 @@
|
|||
|
||||
#include "Global.h"
|
||||
#include "keyboard.h"
|
||||
#include "PAD.h"
|
||||
#include "../Gamepad.h"
|
||||
|
||||
extern HostKeyEvent event;
|
||||
extern MtQueue<HostKeyEvent> g_ev_fifo;
|
||||
|
||||
/// g_key_status.press but with proper handling for analog buttons
|
||||
static void PressButton(u32 pad, u32 button)
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "gui/AppCoreThread.h"
|
||||
#include "common/WindowInfo.h"
|
||||
|
||||
#include "Global.h"
|
||||
#include "Device.h"
|
||||
#include "keyboard.h"
|
||||
#include "state_management.h"
|
||||
|
||||
#include "wx_dialog/dialog.h"
|
||||
|
||||
#ifndef __APPLE__
|
||||
Display* GSdsp;
|
||||
Window GSwin;
|
||||
#endif
|
||||
|
||||
static void SysMessage(const char* fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char msg[512];
|
||||
|
||||
va_start(list, fmt);
|
||||
vsprintf(msg, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
if (msg[strlen(msg) - 1] == '\n')
|
||||
msg[strlen(msg) - 1] = 0;
|
||||
|
||||
wxMessageDialog dialog(nullptr, msg, "Info", wxOK);
|
||||
dialog.ShowModal();
|
||||
}
|
||||
|
||||
s32 _PADopen(const WindowInfo& wi)
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
if (wi.type != WindowInfo::Type::X11)
|
||||
return -1;
|
||||
|
||||
GSdsp = static_cast<Display*>(wi.display_connection);
|
||||
GSwin = reinterpret_cast<Window>(wi.window_handle);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _PADclose()
|
||||
{
|
||||
device_manager.devices.clear();
|
||||
}
|
||||
|
||||
void PADupdate(int pad)
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
// Gamepad inputs don't count as an activity. Therefore screensaver will
|
||||
// be fired after a couple of minute.
|
||||
// Emulate an user activity
|
||||
static int count = 0;
|
||||
count++;
|
||||
if ((count & 0xFFF) == 0 && GSdsp)
|
||||
{
|
||||
// 1 call every 4096 Vsync is enough
|
||||
XResetScreenSaver(GSdsp);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Actually PADupdate is always call with pad == 0. So you need to update both
|
||||
// pads -- Gregory
|
||||
device_manager.Update();
|
||||
}
|
||||
|
||||
void PADconfigure()
|
||||
{
|
||||
ScopedCoreThreadPause paused_core;
|
||||
PADLoadConfig();
|
||||
|
||||
DisplayDialog();
|
||||
paused_core.AllowResume();
|
||||
return;
|
||||
}
|
|
@ -15,7 +15,27 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "PAD.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/filename.h>
|
||||
#include "common/pxStreams.h"
|
||||
#include "common/Console.h"
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
|
||||
#include "../Gamepad.h"
|
||||
|
||||
struct HostKeyEvent;
|
||||
|
||||
#ifdef __linux__
|
||||
// Seriously why there is no standard
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "resource_pad.h"
|
||||
#include "InputManager.h"
|
||||
#include "PADConfig.h"
|
||||
#include "PAD.h"
|
||||
#include "Host.h"
|
||||
|
||||
#include "DeviceEnumerator.h"
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/filename.h>
|
||||
#include "common/pxStreams.h"
|
||||
#include "common/Console.h"
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
|
||||
#include "SaveState.h"
|
||||
|
||||
struct HostKeyEvent;
|
||||
struct WindowInfo;
|
||||
|
||||
struct PadDataS
|
||||
{
|
||||
unsigned char controllerType;
|
||||
unsigned short buttonStatus;
|
||||
unsigned char rightJoyX, rightJoyY, leftJoyX, leftJoyY;
|
||||
unsigned char moveX, moveY;
|
||||
unsigned char reserved[91];
|
||||
};
|
||||
|
||||
void PADupdate(int pad);
|
||||
void PADshutdown();
|
||||
s32 PADinit();
|
||||
s32 PADopen(const WindowInfo& wi);
|
||||
void PADclose();
|
||||
u8 PADstartPoll(int pad);
|
||||
u8 PADpoll(u8 value);
|
||||
HostKeyEvent* PADkeyEvent();
|
||||
#ifndef PCSX2_CORE
|
||||
void PADconfigure();
|
||||
#endif
|
||||
s32 PADfreeze(FreezeAction mode, freezeData* data);
|
||||
s32 PADsetSlot(u8 port, u8 slot);
|
||||
void PADsetSettingsDir(const char* dir);
|
|
@ -26,7 +26,6 @@
|
|||
#include "KeyboardQueue.h"
|
||||
#include "WndProcEater.h"
|
||||
#include "DualShock3.h"
|
||||
#include "PAD.h"
|
||||
|
||||
// Needed to know if raw input is available. It requires XP or higher.
|
||||
#include "PADRawInput.h"
|
||||
|
|
|
@ -36,11 +36,7 @@
|
|||
#include "common/StringUtil.h"
|
||||
#include "SPU2/spu2.h"
|
||||
#include "USB/USB.h"
|
||||
#ifdef _WIN32
|
||||
#include "PAD/Windows/PAD.h"
|
||||
#else
|
||||
#include "PAD/Linux/PAD.h"
|
||||
#endif
|
||||
#include "PAD/Gamepad.h"
|
||||
|
||||
#include <wx/wfstream.h>
|
||||
|
||||
|
|
|
@ -19,11 +19,7 @@
|
|||
#include "Common.h"
|
||||
#include "Sio.h"
|
||||
#include "sio_internal.h"
|
||||
#ifdef _WIN32
|
||||
#include "PAD/Windows/PAD.h"
|
||||
#else
|
||||
#include "PAD/Linux/PAD.h"
|
||||
#endif
|
||||
#include "PAD/Gamepad.h"
|
||||
|
||||
#ifndef DISABLE_RECORDING
|
||||
# include "Recording/InputRecording.h"
|
||||
|
|
|
@ -34,11 +34,7 @@ extern WindowInfo g_gs_window_info;
|
|||
#include "DEV9/DEV9.h"
|
||||
#include "USB/USB.h"
|
||||
#include "MemoryCardFile.h"
|
||||
#ifdef _WIN32
|
||||
#include "PAD/Windows/PAD.h"
|
||||
#else
|
||||
#include "PAD/Linux/PAD.h"
|
||||
#endif
|
||||
#include "PAD/Gamepad.h"
|
||||
|
||||
#include "DebugTools/MIPSAnalyst.h"
|
||||
#include "DebugTools/SymbolMap.h"
|
||||
|
|
|
@ -22,11 +22,7 @@
|
|||
#include "AppSaveStates.h"
|
||||
#include "AppGameDatabase.h"
|
||||
#include "AppAccelerators.h"
|
||||
#ifdef _WIN32
|
||||
#include "PAD/Windows/PAD.h"
|
||||
#else
|
||||
#include "PAD/Linux/PAD.h"
|
||||
#endif
|
||||
#include "PAD/Gamepad.h"
|
||||
|
||||
#include "ps2/BiosTools.h"
|
||||
|
||||
|
|
|
@ -23,11 +23,7 @@
|
|||
#include "GS/GS.h"
|
||||
#include "MainFrame.h"
|
||||
#include "MSWstuff.h"
|
||||
#ifdef _WIN32
|
||||
#include "PAD/Windows/PAD.h"
|
||||
#else
|
||||
#include "PAD/Linux/PAD.h"
|
||||
#endif
|
||||
#include "PAD/Gamepad.h"
|
||||
|
||||
#include "gui/Dialogs/ModalPopups.h"
|
||||
|
||||
|
|
|
@ -23,11 +23,7 @@
|
|||
#include "System/SysThreads.h"
|
||||
#include "DEV9/DEV9.h"
|
||||
#include "USB/USB.h"
|
||||
#ifdef _WIN32
|
||||
#include "PAD/Windows/PAD.h"
|
||||
#else
|
||||
#include "PAD/Linux/PAD.h"
|
||||
#endif
|
||||
#include "PAD/Gamepad.h"
|
||||
|
||||
#include "ConsoleLogger.h"
|
||||
#include "MainFrame.h"
|
||||
|
|
|
@ -24,11 +24,7 @@
|
|||
#include "common/pxStreams.h"
|
||||
#include "SPU2/spu2.h"
|
||||
#include "USB/USB.h"
|
||||
#ifdef _WIN32
|
||||
#include "PAD/Windows/PAD.h"
|
||||
#else
|
||||
#include "PAD/Linux/PAD.h"
|
||||
#endif
|
||||
#include "PAD/Gamepad.h"
|
||||
|
||||
#include "ConsoleLogger.h"
|
||||
|
||||
|
|
|
@ -772,7 +772,7 @@
|
|||
<ClInclude Include="FW.h" />
|
||||
<ClInclude Include="MemoryCardFile.h" />
|
||||
<ClInclude Include="MemoryCardFolder.h" />
|
||||
<ClInclude Include="PAD\Windows\PAD.h" />
|
||||
<ClInclude Include="PAD\Gamepad.h" />
|
||||
<ClInclude Include="PAD\Windows\PADConfig.h" />
|
||||
<ClInclude Include="PAD\Windows\DeviceEnumerator.h" />
|
||||
<ClInclude Include="PAD\Windows\Diagnostics.h" />
|
||||
|
|
|
@ -2481,9 +2481,6 @@
|
|||
<ClInclude Include="PAD\Windows\PADRawInput.h">
|
||||
<Filter>System\Ps2\PAD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PAD\Windows\PAD.h">
|
||||
<Filter>System\Ps2\PAD</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PAD\Windows\resource_pad.h">
|
||||
<Filter>System\Ps2\PAD</Filter>
|
||||
</ClInclude>
|
||||
|
@ -2749,6 +2746,9 @@
|
|||
<ClInclude Include="gui\pxStaticText.h">
|
||||
<Filter>AppHost</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PAD\Gamepad.h">
|
||||
<Filter>System\Ps2\PAD</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="windows\wxResources.rc">
|
||||
|
|
Loading…
Reference in New Issue