mirror of https://github.com/PCSX2/pcsx2.git
Rename keyEvent to HostKeyEvent
This commit is contained in:
parent
c234f83ca6
commit
3fdab1222b
|
@ -29,11 +29,6 @@
|
|||
#include "VUmicro.h"
|
||||
|
||||
#include "ps2/HwInternal.h"
|
||||
#ifdef _WIN32
|
||||
#include "PAD/Windows/PAD.h"
|
||||
#else
|
||||
#include "PAD/Linux/PAD.h"
|
||||
#endif
|
||||
#include "Sio.h"
|
||||
|
||||
#ifndef DISABLE_RECORDING
|
||||
|
|
|
@ -247,7 +247,7 @@ void iDumpBlock(u32 ee_pc, u32 ee_size, uptr x86_pc, u32 x86_size)
|
|||
|
||||
// handy but slow solution (system call)
|
||||
#ifdef __linux__
|
||||
wxString obj_filename = Path::Combine(g_Conf->Folders.Logs, wxString(L"objdump_tmp.o"));
|
||||
wxString obj_filename = Path::Combine(EmuConfig.Folders.Logs, wxString(L"objdump_tmp.o"));
|
||||
wxFFile objdump(obj_filename , L"wb");
|
||||
objdump.Write(x86, x86_size);
|
||||
objdump.Close();
|
||||
|
|
|
@ -658,7 +658,7 @@ uint32 GSmakeSnapshot(char* path)
|
|||
}
|
||||
}
|
||||
|
||||
void GSkeyEvent(GSKeyEventData* e)
|
||||
void GSkeyEvent(const HostKeyEvent& e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -1711,16 +1711,6 @@ struct GSPrivRegSet
|
|||
|
||||
#pragma pack(pop)
|
||||
|
||||
enum
|
||||
{
|
||||
KEYPRESS = 1,
|
||||
KEYRELEASE = 2
|
||||
};
|
||||
struct GSKeyEventData
|
||||
{
|
||||
uint32 key, type;
|
||||
};
|
||||
|
||||
// ST_WRITE is defined in libc, avoid this
|
||||
enum stateType
|
||||
{
|
||||
|
@ -1774,6 +1764,8 @@ enum class CRCHackLevel : int8
|
|||
Aggressive
|
||||
};
|
||||
|
||||
struct HostKeyEvent;
|
||||
|
||||
#ifdef ENABLE_ACCURATE_BUFFER_EMULATION
|
||||
const GSVector2i default_rt_size(2048, 2048);
|
||||
#else
|
||||
|
@ -1802,7 +1794,7 @@ void GSgifTransfer2(uint8* mem, uint32 size);
|
|||
void GSgifTransfer3(uint8* mem, uint32 size);
|
||||
void GSvsync(int field);
|
||||
uint32 GSmakeSnapshot(char* path);
|
||||
void GSkeyEvent(GSKeyEventData* e);
|
||||
void GSkeyEvent(const HostKeyEvent& e);
|
||||
int GSfreeze(FreezeAction mode, freezeData* data);
|
||||
void GSconfigure();
|
||||
int GStest();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "GSRenderer.h"
|
||||
#include "Host.h"
|
||||
#include "pcsx2/Config.h"
|
||||
#if defined(__unix__)
|
||||
#include <X11/keysym.h>
|
||||
|
@ -595,27 +596,27 @@ void GSRenderer::EndCapture()
|
|||
m_capture.EndCapture();
|
||||
}
|
||||
|
||||
void GSRenderer::KeyEvent(GSKeyEventData* e)
|
||||
void GSRenderer::KeyEvent(const HostKeyEvent& e)
|
||||
{
|
||||
#ifndef __APPLE__ // TODO: Add hotkey support on macOS
|
||||
#ifdef _WIN32
|
||||
m_shift_key = !!(::GetAsyncKeyState(VK_SHIFT) & 0x8000);
|
||||
m_control_key = !!(::GetAsyncKeyState(VK_CONTROL) & 0x8000);
|
||||
#else
|
||||
switch (e->key)
|
||||
switch (e.key)
|
||||
{
|
||||
case XK_Shift_L:
|
||||
case XK_Shift_R:
|
||||
m_shift_key = (e->type == KEYPRESS);
|
||||
m_shift_key = (e.type == HostKeyEvent::Type::KeyPressed);
|
||||
return;
|
||||
case XK_Control_L:
|
||||
case XK_Control_R:
|
||||
m_control_key = (e->type == KEYPRESS);
|
||||
m_control_key = (e.type == HostKeyEvent::Type::KeyReleased);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (e->type == KEYPRESS)
|
||||
if (e.type == HostKeyEvent::Type::KeyPressed)
|
||||
{
|
||||
|
||||
int step = m_shift_key ? -1 : 1;
|
||||
|
@ -630,7 +631,7 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
|
|||
#define VK_HOME XK_Home
|
||||
#endif
|
||||
|
||||
switch (e->key)
|
||||
switch (e.key)
|
||||
{
|
||||
case VK_F5:
|
||||
m_interlace = (m_interlace + s_interlace_nb + step) % s_interlace_nb;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "GS/GSState.h"
|
||||
#include "GS/GSCapture.h"
|
||||
|
||||
struct HostKeyEvent;
|
||||
|
||||
class GSRenderer : public GSState
|
||||
{
|
||||
GSCapture m_capture;
|
||||
|
@ -57,7 +59,7 @@ public:
|
|||
virtual void ResetDevice();
|
||||
virtual void VSync(int field);
|
||||
virtual bool MakeSnapshot(const std::string& path);
|
||||
virtual void KeyEvent(GSKeyEventData* e);
|
||||
virtual void KeyEvent(const HostKeyEvent& e);
|
||||
virtual bool CanUpscale() { return false; }
|
||||
virtual int GetUpscaleMultiplier() { return 1; }
|
||||
virtual GSVector2i GetCustomResolution() { return GSVector2i(0, 0); }
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2021 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 "common/Pcsx2Defs.h"
|
||||
|
||||
struct HostKeyEvent
|
||||
{
|
||||
enum class Type
|
||||
{
|
||||
NoEvent = 0,
|
||||
KeyPressed = 1,
|
||||
KeyReleased = 2
|
||||
};
|
||||
|
||||
Type type;
|
||||
u32 key;
|
||||
};
|
|
@ -24,11 +24,6 @@
|
|||
#include "MTVU.h"
|
||||
#include "Elfheader.h"
|
||||
#include "gui/Dialogs/ModalPopups.h"
|
||||
#ifdef _WIN32
|
||||
#include "PAD/Windows/PAD.h"
|
||||
#else
|
||||
#include "PAD/Linux/PAD.h"
|
||||
#endif
|
||||
|
||||
|
||||
// Uncomment this to enable profiling of the GS RingBufferCopy function.
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "common/pxStreams.h"
|
||||
#include "common/Console.h"
|
||||
#include "DebugTools/Debug.h"
|
||||
#include "gui/App.h"
|
||||
|
||||
#define PADdefs
|
||||
|
||||
|
|
|
@ -35,16 +35,16 @@ const u32 build = 0; // increase that with each version
|
|||
#define PAD_SAVE_STATE_VERSION ((revision << 8) | (build << 0))
|
||||
|
||||
PADconf g_conf;
|
||||
keyEvent event;
|
||||
HostKeyEvent event;
|
||||
|
||||
static keyEvent s_event;
|
||||
static HostKeyEvent s_event;
|
||||
std::string s_padstrLogPath("logs/");
|
||||
|
||||
FILE* padLog = NULL;
|
||||
|
||||
KeyStatus g_key_status;
|
||||
|
||||
MtQueue<keyEvent> g_ev_fifo;
|
||||
MtQueue<HostKeyEvent> g_ev_fifo;
|
||||
|
||||
|
||||
void __LogToConsole(const char* fmt, ...)
|
||||
|
@ -240,7 +240,7 @@ u8 PADpoll(u8 value)
|
|||
}
|
||||
|
||||
// PADkeyEvent is called every vsync (return NULL if no event)
|
||||
keyEvent* PADkeyEvent()
|
||||
HostKeyEvent* PADkeyEvent()
|
||||
{
|
||||
#ifdef SDL_BUILD
|
||||
// Take the opportunity to handle hot plugging here
|
||||
|
@ -263,7 +263,7 @@ keyEvent* PADkeyEvent()
|
|||
{
|
||||
// PAD_LOG("No events in queue, returning empty event\n");
|
||||
s_event = event;
|
||||
event.evt = 0;
|
||||
event.type = HostKeyEvent::Type::NoEvent;
|
||||
event.key = 0;
|
||||
return &s_event;
|
||||
}
|
||||
|
@ -274,14 +274,14 @@ keyEvent* PADkeyEvent()
|
|||
return &s_event;
|
||||
#else // MacOS
|
||||
s_event = event;
|
||||
event.evt = 0;
|
||||
event.type = HostKeyEvent::Type::NoEvent;
|
||||
event.key = 0;
|
||||
return &s_event;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__unix__)
|
||||
void PADWriteEvent(keyEvent& evt)
|
||||
void PADWriteEvent(HostKeyEvent& evt)
|
||||
{
|
||||
// if (evt.evt != 6) { // Skip mouse move events for logging
|
||||
// PAD_LOG("Pushing Event. Event Type: %d, Key: %d\n", evt.evt, evt.key);
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "Global.h"
|
||||
#include "Host.h"
|
||||
#include "common/mt_queue.h"
|
||||
#include "SaveState.h"
|
||||
|
||||
enum PadOptions
|
||||
{
|
||||
|
@ -32,8 +34,8 @@ enum PadOptions
|
|||
extern FILE* padLog;
|
||||
extern void initLogging();
|
||||
|
||||
extern keyEvent event;
|
||||
extern MtQueue<keyEvent> g_ev_fifo;
|
||||
extern HostKeyEvent event;
|
||||
extern MtQueue<HostKeyEvent> g_ev_fifo;
|
||||
|
||||
s32 _PADopen(void* pDsp);
|
||||
void _PADclose();
|
||||
|
@ -50,10 +52,10 @@ s32 PADsetSlot(u8 port, u8 slot);
|
|||
s32 PADfreeze(FreezeAction mode, freezeData* data);
|
||||
u8 PADstartPoll(int pad);
|
||||
u8 PADpoll(u8 value);
|
||||
keyEvent* PADkeyEvent();
|
||||
HostKeyEvent* PADkeyEvent();
|
||||
void PADupdate(int pad);
|
||||
void PADconfigure();
|
||||
|
||||
#if defined(__unix__)
|
||||
void PADWriteEvent(keyEvent& evt);
|
||||
void PADWriteEvent(HostKeyEvent& evt);
|
||||
#endif
|
||||
|
|
|
@ -20,10 +20,7 @@
|
|||
|
||||
#include "Global.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#include "common/mt_queue.h"
|
||||
extern keyEvent event;
|
||||
extern MtQueue<keyEvent> g_ev_fifo;
|
||||
#include "PAD.h"
|
||||
|
||||
/// g_key_status.press but with proper handling for analog buttons
|
||||
static void PressButton(u32 pad, u32 button)
|
||||
|
@ -117,7 +114,7 @@ static bool s_Shift = false;
|
|||
static unsigned int s_previous_mouse_x = 0;
|
||||
static unsigned int s_previous_mouse_y = 0;
|
||||
|
||||
void AnalyzeKeyEvent(keyEvent& evt)
|
||||
void AnalyzeKeyEvent(HostKeyEvent& evt)
|
||||
{
|
||||
KeySym key = (KeySym)evt.key;
|
||||
int pad = 0;
|
||||
|
@ -133,7 +130,7 @@ void AnalyzeKeyEvent(keyEvent& evt)
|
|||
}
|
||||
}
|
||||
|
||||
switch (evt.evt)
|
||||
switch (static_cast<int>(evt.type))
|
||||
{
|
||||
case KeyPress:
|
||||
// Shift F12 is not yet use by pcsx2. So keep it to grab/ungrab input
|
||||
|
@ -164,7 +161,7 @@ void AnalyzeKeyEvent(keyEvent& evt)
|
|||
|
||||
//PAD_LOG("Key pressed:%d\n", index);
|
||||
|
||||
event.evt = KEYPRESS;
|
||||
event.type = HostKeyEvent::Type::KeyPressed;
|
||||
event.key = key;
|
||||
break;
|
||||
|
||||
|
@ -175,7 +172,7 @@ void AnalyzeKeyEvent(keyEvent& evt)
|
|||
if (index != -1)
|
||||
g_key_status.release(pad, index);
|
||||
|
||||
event.evt = KEYRELEASE;
|
||||
event.type = HostKeyEvent::Type::KeyReleased;
|
||||
event.key = key;
|
||||
break;
|
||||
|
||||
|
@ -258,7 +255,7 @@ void AnalyzeKeyEvent(keyEvent& evt)
|
|||
|
||||
void UpdateKeyboardInput()
|
||||
{
|
||||
keyEvent evt = {0};
|
||||
HostKeyEvent evt = {};
|
||||
XEvent E = {0};
|
||||
|
||||
// Keyboard input send by PCSX2
|
||||
|
@ -271,7 +268,7 @@ void UpdateKeyboardInput()
|
|||
|
||||
// Change the format of the structure to be compatible with GSOpen2
|
||||
// mode (event come from pcsx2 not X)
|
||||
evt.evt = E.type;
|
||||
evt.type = static_cast<HostKeyEvent::Type>(E.type);
|
||||
switch (E.type)
|
||||
{
|
||||
case MotionNotify:
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "common/Pcsx2Defs.h"
|
||||
#include "gui/App.h"
|
||||
#include "Host.h"
|
||||
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
|||
#undef DisableScreenSaver
|
||||
#endif
|
||||
|
||||
extern void AnalyzeKeyEvent(keyEvent& evt);
|
||||
extern void AnalyzeKeyEvent(HostKeyEvent& evt);
|
||||
extern void UpdateKeyboardInput();
|
||||
extern bool PollForNewKeyboardKeys(u32& pkey);
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "InputManager.h"
|
||||
#include "KeyboardQueue.h"
|
||||
#include "PADConfig.h"
|
||||
#include "Host.h"
|
||||
|
||||
InputDeviceManager* dm = 0;
|
||||
|
||||
|
@ -235,9 +236,9 @@ void Device::CalcVirtualState()
|
|||
if (i < numPhysicalControls)
|
||||
continue;
|
||||
}
|
||||
int event = KEYPRESS;
|
||||
HostKeyEvent::Type event = HostKeyEvent::Type::KeyPressed;
|
||||
if (!(virtualControlState[index] >> 15))
|
||||
event = KEYRELEASE;
|
||||
event = HostKeyEvent::Type::KeyReleased;
|
||||
QueueKeyEvent(c->vkey, event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ static std::mutex cSection;
|
|||
// Actually points one beyond the last queued event.
|
||||
static u8 lastQueuedEvent = 0;
|
||||
static u8 nextQueuedEvent = 0;
|
||||
static keyEvent queuedEvents[EVENT_QUEUE_LEN];
|
||||
static HostKeyEvent queuedEvents[EVENT_QUEUE_LEN];
|
||||
|
||||
void QueueKeyEvent(int key, int event)
|
||||
void QueueKeyEvent(u32 key, HostKeyEvent::Type event)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(cSection);
|
||||
|
||||
|
@ -34,17 +34,17 @@ void QueueKeyEvent(int key, int event)
|
|||
// purposes when a game is killing the emulator for whatever reason.
|
||||
if (nextQueuedEvent == lastQueuedEvent ||
|
||||
queuedEvents[nextQueuedEvent].key != VK_ESCAPE ||
|
||||
queuedEvents[nextQueuedEvent].evt != KEYPRESS)
|
||||
queuedEvents[nextQueuedEvent].type != HostKeyEvent::Type::KeyPressed)
|
||||
{
|
||||
// Clear queue on escape down, bringing escape to front. May do something
|
||||
// with shift/ctrl/alt and F-keys, later.
|
||||
if (event == KEYPRESS && key == VK_ESCAPE)
|
||||
if (event == HostKeyEvent::Type::KeyPressed && key == VK_ESCAPE)
|
||||
{
|
||||
nextQueuedEvent = lastQueuedEvent;
|
||||
}
|
||||
|
||||
queuedEvents[lastQueuedEvent].key = key;
|
||||
queuedEvents[lastQueuedEvent].evt = event;
|
||||
queuedEvents[lastQueuedEvent].type = event;
|
||||
|
||||
lastQueuedEvent = (lastQueuedEvent + 1) % EVENT_QUEUE_LEN;
|
||||
// If queue wrapped around, remove last element.
|
||||
|
@ -55,7 +55,7 @@ void QueueKeyEvent(int key, int event)
|
|||
}
|
||||
}
|
||||
|
||||
int GetQueuedKeyEvent(keyEvent* event)
|
||||
int GetQueuedKeyEvent(HostKeyEvent* event)
|
||||
{
|
||||
if (lastQueuedEvent == nextQueuedEvent)
|
||||
return 0;
|
||||
|
|
|
@ -17,14 +17,16 @@
|
|||
// This entire thing isn't really needed,
|
||||
// but takes little enough effort to be safe...
|
||||
|
||||
void QueueKeyEvent(int key, int event);
|
||||
int GetQueuedKeyEvent(keyEvent* event);
|
||||
#include "Host.h"
|
||||
|
||||
void QueueKeyEvent(u32 key, HostKeyEvent::Type event);
|
||||
int GetQueuedKeyEvent(HostKeyEvent* event);
|
||||
|
||||
// Cleans up as well as clears queue.
|
||||
void ClearKeyQueue();
|
||||
|
||||
#ifdef __linux__
|
||||
void R_QueueKeyEvent(const keyEvent& event);
|
||||
int R_GetQueuedKeyEvent(keyEvent* event);
|
||||
void R_QueueKeyEvent(const HostKeyEvent& event);
|
||||
int R_GetQueuedKeyEvent(HostKeyEvent* event);
|
||||
void R_ClearKeyQueue();
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "InputManager.h"
|
||||
#include "PADConfig.h"
|
||||
#include "PAD.h"
|
||||
#include "Host.h"
|
||||
|
||||
#include "DeviceEnumerator.h"
|
||||
#ifdef _MSC_VER
|
||||
|
@ -33,6 +34,8 @@
|
|||
#include "KeyboardQueue.h"
|
||||
#include "DualShock3.h"
|
||||
|
||||
#include "gui/AppCoreThread.h"
|
||||
|
||||
#define WMA_FORCE_UPDATE (WM_APP + 0x537)
|
||||
#define FORCE_UPDATE_WPARAM ((WPARAM)0x74328943)
|
||||
#define FORCE_UPDATE_LPARAM ((LPARAM)0x89437437)
|
||||
|
@ -222,9 +225,9 @@ u8 Cap(int i)
|
|||
|
||||
inline void ReleaseModifierKeys()
|
||||
{
|
||||
QueueKeyEvent(VK_SHIFT, KEYRELEASE);
|
||||
QueueKeyEvent(VK_MENU, KEYRELEASE);
|
||||
QueueKeyEvent(VK_CONTROL, KEYRELEASE);
|
||||
QueueKeyEvent(VK_SHIFT, HostKeyEvent::Type::KeyReleased);
|
||||
QueueKeyEvent(VK_MENU, HostKeyEvent::Type::KeyReleased);
|
||||
QueueKeyEvent(VK_CONTROL, HostKeyEvent::Type::KeyReleased);
|
||||
}
|
||||
|
||||
// RefreshEnabledDevices() enables everything that can potentially
|
||||
|
@ -387,7 +390,7 @@ void ProcessButtonBinding(Binding* b, ButtonSum* sum, int value)
|
|||
unsigned int t = timeGetTime();
|
||||
if (t - LastCheck < 300)
|
||||
return;
|
||||
QueueKeyEvent(VK_TAB, KEYPRESS);
|
||||
QueueKeyEvent(VK_TAB, HostKeyEvent::Type::KeyPressed);
|
||||
LastCheck = t;
|
||||
}
|
||||
|
||||
|
@ -945,7 +948,7 @@ ExtraWndProcResult StatusWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
PrepareActivityState(LOWORD(wParam) != WA_INACTIVE);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
QueueKeyEvent(VK_ESCAPE, KEYPRESS);
|
||||
QueueKeyEvent(VK_ESCAPE, HostKeyEvent::Type::KeyPressed);
|
||||
break;
|
||||
case WM_KILLFOCUS:
|
||||
PrepareActivityState(false);
|
||||
|
@ -1463,7 +1466,7 @@ u8 PADpoll(u8 value)
|
|||
}
|
||||
}
|
||||
|
||||
keyEvent* PADkeyEvent()
|
||||
HostKeyEvent* PADkeyEvent()
|
||||
{
|
||||
// If running both pads, ignore every other call. So if two keys pressed in same interval...
|
||||
static char eventCount = 0;
|
||||
|
@ -1475,7 +1478,7 @@ keyEvent* PADkeyEvent()
|
|||
eventCount = 0;
|
||||
|
||||
Update(2, 0);
|
||||
static keyEvent ev;
|
||||
static HostKeyEvent ev;
|
||||
if (!GetQueuedKeyEvent(&ev))
|
||||
return 0;
|
||||
|
||||
|
@ -1485,7 +1488,7 @@ keyEvent* PADkeyEvent()
|
|||
if (!activeWindow)
|
||||
altDown = shiftDown = 0;
|
||||
|
||||
if (miceEnabled && (ev.key == VK_ESCAPE || (int)ev.key == -2) && ev.evt == KEYPRESS)
|
||||
if (miceEnabled && (ev.key == VK_ESCAPE || (int)ev.key == -2) && ev.type == HostKeyEvent::Type::KeyPressed)
|
||||
{
|
||||
// Disable mouse/KB hooks on escape (before going into paused mode).
|
||||
// This is a hack, since PADclose (which is called on pause) should enevtually also deactivate the
|
||||
|
@ -1507,7 +1510,7 @@ keyEvent* PADkeyEvent()
|
|||
if (ev.key == VK_LSHIFT || ev.key == VK_RSHIFT || ev.key == VK_SHIFT)
|
||||
{
|
||||
ev.key = VK_SHIFT;
|
||||
shiftDown = (ev.evt == KEYPRESS);
|
||||
shiftDown = (ev.type == HostKeyEvent::Type::KeyReleased);
|
||||
}
|
||||
else if (ev.key == VK_LCONTROL || ev.key == VK_RCONTROL)
|
||||
{
|
||||
|
@ -1516,7 +1519,7 @@ keyEvent* PADkeyEvent()
|
|||
else if (ev.key == VK_LMENU || ev.key == VK_RMENU || ev.key == VK_SHIFT)
|
||||
{
|
||||
ev.key = VK_MENU;
|
||||
altDown = (ev.evt == KEYPRESS);
|
||||
altDown = (ev.type == HostKeyEvent::Type::KeyPressed);
|
||||
}
|
||||
#endif
|
||||
return &ev;
|
||||
|
|
|
@ -33,17 +33,18 @@
|
|||
#include <mutex>
|
||||
#include <queue>
|
||||
|
||||
#include "gui/App.h"
|
||||
#include "SaveState.h"
|
||||
|
||||
typedef struct
|
||||
struct HostKeyEvent;
|
||||
|
||||
struct PadDataS
|
||||
{
|
||||
unsigned char controllerType;
|
||||
unsigned short buttonStatus;
|
||||
unsigned char rightJoyX, rightJoyY, leftJoyX, leftJoyY;
|
||||
unsigned char moveX, moveY;
|
||||
unsigned char reserved[91];
|
||||
} PadDataS;
|
||||
};
|
||||
|
||||
void PADupdate(int pad);
|
||||
void PADshutdown();
|
||||
|
@ -52,7 +53,7 @@ s32 PADopen(void* pDsp);
|
|||
void PADclose();
|
||||
u8 PADstartPoll(int pad);
|
||||
u8 PADpoll(u8 value);
|
||||
keyEvent* PADkeyEvent();
|
||||
HostKeyEvent* PADkeyEvent();
|
||||
void PADconfigure();
|
||||
s32 PADfreeze(FreezeAction mode, freezeData* data);
|
||||
s32 PADsetSlot(u8 port, u8 slot);
|
||||
|
|
|
@ -51,9 +51,9 @@ void WindowsKeyboard::UpdateKey(int vkey, int state)
|
|||
// Check for alt-F4 to avoid toggling skip mode incorrectly.
|
||||
if (vkey != VK_F4 || !(physicalControlState[VK_MENU] || physicalControlState[VK_RMENU] || physicalControlState[VK_LMENU]))
|
||||
{
|
||||
int event = KEYPRESS;
|
||||
HostKeyEvent::Type event = HostKeyEvent::Type::KeyPressed;
|
||||
if (!newState)
|
||||
event = KEYRELEASE;
|
||||
event = HostKeyEvent::Type::KeyReleased;
|
||||
QueueKeyEvent(vkey, event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,17 +33,11 @@
|
|||
#endif
|
||||
|
||||
class DisassemblyDialog;
|
||||
|
||||
#include "System.h"
|
||||
#include "System/SysThreads.h"
|
||||
struct HostKeyEvent;
|
||||
|
||||
#include "GS.h"
|
||||
|
||||
typedef struct _keyEvent
|
||||
{
|
||||
u32 key;
|
||||
u32 evt;
|
||||
} keyEvent;
|
||||
#include "System.h"
|
||||
#include "System/SysThreads.h"
|
||||
|
||||
extern uptr pDsp[2];
|
||||
|
||||
|
@ -641,7 +635,7 @@ protected:
|
|||
bool TryOpenConfigCwd();
|
||||
void CleanupOnExit();
|
||||
void OpenWizardConsole();
|
||||
void PadKeyDispatch(const keyEvent& ev);
|
||||
void PadKeyDispatch(const HostKeyEvent& ev);
|
||||
|
||||
protected:
|
||||
void HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& event) const;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "MainFrame.h"
|
||||
#include "GSFrame.h"
|
||||
#include "GS.h"
|
||||
#include "Host.h"
|
||||
#include "AppSaveStates.h"
|
||||
#include "AppGameDatabase.h"
|
||||
#include "AppAccelerators.h"
|
||||
|
@ -202,9 +203,9 @@ extern int TranslateVKToWXK( u32 keysym );
|
|||
extern int TranslateGDKtoWXK( u32 keysym );
|
||||
#endif
|
||||
|
||||
void Pcsx2App::PadKeyDispatch( const keyEvent& ev )
|
||||
void Pcsx2App::PadKeyDispatch(const HostKeyEvent& ev)
|
||||
{
|
||||
m_kevt.SetEventType( ( ev.evt == KEYPRESS ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP );
|
||||
m_kevt.SetEventType( ( ev.type == HostKeyEvent::Type::KeyPressed ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP );
|
||||
|
||||
//returns 0 for normal keys and a WXK_* value for special keys
|
||||
#ifdef __WXMSW__
|
||||
|
@ -489,7 +490,7 @@ void Pcsx2App::LogicalVsync()
|
|||
if( (wxGetApp().GetGsFramePtr() != NULL) )
|
||||
PADupdate(0);
|
||||
|
||||
while( const keyEvent* ev = PADkeyEvent() )
|
||||
while( const HostKeyEvent* ev = PADkeyEvent() )
|
||||
{
|
||||
if( ev->key == 0 ) break;
|
||||
|
||||
|
@ -498,7 +499,7 @@ void Pcsx2App::LogicalVsync()
|
|||
// sucked and we had multiple components battling for input processing. I managed to make
|
||||
// most of them go away during the plugin merge but GS still needs to process the inputs,
|
||||
// we might want to move all the input handling in a frontend-specific file in the future -- govanify
|
||||
GSkeyEvent((GSKeyEventData*)ev);
|
||||
GSkeyEvent(*ev);
|
||||
PadKeyDispatch( *ev );
|
||||
}
|
||||
}
|
||||
|
@ -540,7 +541,7 @@ void Pcsx2App::HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent&
|
|||
// When the GSFrame CoreThread is paused, so is the logical VSync
|
||||
// Meaning that we have to grab the user-input through here to potentially
|
||||
// resume emulation.
|
||||
if (const keyEvent* ev = PADkeyEvent() )
|
||||
if (const HostKeyEvent* ev = PADkeyEvent() )
|
||||
{
|
||||
if( ev->key != 0 )
|
||||
{
|
||||
|
|
|
@ -274,21 +274,21 @@ void GSPanel::OnMouseEvent( wxMouseEvent& evt )
|
|||
#if defined(__unix__)
|
||||
// HACK2: In gsopen2 there is one event buffer read by both wx/gui and pad. Wx deletes
|
||||
// the event before the pad see it. So you send key event directly to the pad.
|
||||
keyEvent event;
|
||||
HostKeyEvent event;
|
||||
// FIXME how to handle double click ???
|
||||
if (evt.ButtonDown())
|
||||
{
|
||||
event.evt = 4; // X equivalent of ButtonPress
|
||||
event.type = static_cast<HostKeyEvent::Type>(4); // X equivalent of ButtonPress
|
||||
event.key = evt.GetButton();
|
||||
}
|
||||
else if (evt.ButtonUp())
|
||||
{
|
||||
event.evt = 5; // X equivalent of ButtonRelease
|
||||
event.type = static_cast<HostKeyEvent::Type>(5); // X equivalent of ButtonRelease
|
||||
event.key = evt.GetButton();
|
||||
}
|
||||
else if (evt.Moving() || evt.Dragging())
|
||||
{
|
||||
event.evt = 6; // X equivalent of MotionNotify
|
||||
event.type = static_cast<HostKeyEvent::Type>(6); // X equivalent of MotionNotify
|
||||
long x, y;
|
||||
evt.GetPosition(&x, &y);
|
||||
|
||||
|
@ -314,7 +314,7 @@ void GSPanel::OnMouseEvent( wxMouseEvent& evt )
|
|||
else
|
||||
{
|
||||
event.key = 0;
|
||||
event.evt = 0;
|
||||
event.type = HostKeyEvent::Type::NoEvent;
|
||||
}
|
||||
|
||||
PADWriteEvent(event);
|
||||
|
@ -341,14 +341,14 @@ void GSPanel::OnKeyDownOrUp( wxKeyEvent& evt )
|
|||
#if defined(__unix__)
|
||||
// HACK2: In gsopen2 there is one event buffer read by both wx/gui and pad. Wx deletes
|
||||
// the event before the pad see it. So you send key event directly to the pad.
|
||||
keyEvent event;
|
||||
HostKeyEvent event;
|
||||
event.key = evt.GetRawKeyCode();
|
||||
if (evt.GetEventType() == wxEVT_KEY_UP)
|
||||
event.evt = 3; // X equivalent of KEYRELEASE;
|
||||
event.type = static_cast<HostKeyEvent::Type>(3); // X equivalent of KEYRELEASE;
|
||||
else if (evt.GetEventType() == wxEVT_KEY_DOWN)
|
||||
event.evt = 2; // X equivalent of KEYPRESS;
|
||||
event.type = static_cast<HostKeyEvent::Type>(2); // X equivalent of KEYPRESS;
|
||||
else
|
||||
event.evt = 0;
|
||||
event.type = HostKeyEvent::Type::NoEvent;
|
||||
|
||||
PADWriteEvent(event);
|
||||
#endif
|
||||
|
@ -424,7 +424,7 @@ void GSPanel::OnFocus( wxFocusEvent& evt )
|
|||
#if defined(__unix__)
|
||||
// HACK2: In gsopen2 there is one event buffer read by both wx/gui and pad. Wx deletes
|
||||
// the event before the pad see it. So you send key event directly to the pad.
|
||||
keyEvent event = {0, 9}; // X equivalent of FocusIn;
|
||||
HostKeyEvent event = {static_cast<HostKeyEvent::Type>(9), 0}; // X equivalent of FocusIn;
|
||||
PADWriteEvent(event);
|
||||
#endif
|
||||
//Console.Warning("GS frame > focus set");
|
||||
|
@ -440,7 +440,7 @@ void GSPanel::OnFocusLost( wxFocusEvent& evt )
|
|||
#if defined(__unix__)
|
||||
// HACK2: In gsopen2 there is one event buffer read by both wx/gui and pad. Wx deletes
|
||||
// the event before the pad see it. So you send key event directly to the pad.
|
||||
keyEvent event = {0, 10}; // X equivalent of FocusOut
|
||||
HostKeyEvent event = {static_cast<HostKeyEvent::Type>(9), 0}; // X equivalent of FocusOut
|
||||
PADWriteEvent(event);
|
||||
#endif
|
||||
//Console.Warning("GS frame > focus lost");
|
||||
|
|
|
@ -769,6 +769,7 @@
|
|||
<ClInclude Include="gui\Panels\MemoryCardPanels.h" />
|
||||
<ClInclude Include="gui\ThreadingDialogs.h" />
|
||||
<ClInclude Include="gui\wxAppWithHelpers.h" />
|
||||
<ClInclude Include="Host.h" />
|
||||
<ClInclude Include="IopGte.h" />
|
||||
<ClInclude Include="IPC.h" />
|
||||
<ClInclude Include="FW.h" />
|
||||
|
|
|
@ -2767,6 +2767,9 @@
|
|||
<ClInclude Include="MemoryCardFile.h">
|
||||
<Filter>System\Ps2\Iop</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Host.h">
|
||||
<Filter>System\Include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="windows\wxResources.rc">
|
||||
|
|
Loading…
Reference in New Issue