diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 7425ec2603..6a756155b6 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -1996,7 +1996,9 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o EMULATOR_DEVCTL__GET_ASPECT_RATIO, EMULATOR_DEVCTL__GET_SCALE, EMULATOR_DEVCTL__GET_LTRIGGER, - EMULATOR_DEVCTL__GET_RTRIGGER + EMULATOR_DEVCTL__GET_RTRIGGER, + EMULATOR_DEVCTL__GET_VKEY, + EMULATOR_DEVCTL__GET_MOUSE }; switch (cmd) { @@ -2066,10 +2068,30 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o } return 0; case EMULATOR_DEVCTL__GET_LTRIGGER: - //To-do + if (Memory::IsValidAddress(outPtr)) { + extern float PluginDataLT; + Memory::Write_Float(PluginDataLT, outPtr); + } return 0; case EMULATOR_DEVCTL__GET_RTRIGGER: - //To-do + if (Memory::IsValidAddress(outPtr)) { + extern float PluginDataRT; + Memory::Write_Float(PluginDataRT, outPtr); + } + return 0; + case EMULATOR_DEVCTL__GET_VKEY: + if (Memory::IsValidAddress(outPtr)) { + extern std::map PluginDataKeys; + Memory::Write_U8(PluginDataKeys[argAddr], outPtr); + } + return 0; + case EMULATOR_DEVCTL__GET_MOUSE: + if (Memory::IsValidAddress(outPtr)) { + extern float g_mouseDeltaX; + extern float g_mouseDeltaY; + Memory::Write_Float(g_mouseDeltaX, outPtr); + Memory::Write_Float(g_mouseDeltaY, outPtr + 4); + } return 0; } diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 055d1ead17..fb03914a17 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -141,6 +141,12 @@ #include #endif +float PluginDataLT; +float PluginDataRT; +float PluginDataMouseX; +float PluginDataMouseY; +std::map PluginDataKeys; + ScreenManager *screenManager; std::string config_filename; @@ -1334,7 +1340,13 @@ bool NativeKey(const KeyInput &key) { #endif bool retval = false; if (screenManager) + { + if (key.deviceId == DEVICE_ID_KEYBOARD || key.deviceId == DEVICE_ID_MOUSE) + { + PluginDataKeys[key.keyCode] = (key.flags & KEY_DOWN) ? 1 : 0; + } retval = screenManager->key(key); + } return retval; } @@ -1355,6 +1367,11 @@ bool NativeAxis(const AxisInput &axis) { if (g_Config.iTiltInputType == TILT_NULL) { // if tilt events are disabled, then run it through the usual way. if (screenManager) { + if (axis.axisId == JOYSTICK_AXIS_LTRIGGER) + PluginDataLT = axis.value; + else if (axis.axisId == JOYSTICK_AXIS_RTRIGGER) + PluginDataRT = axis.value; + return screenManager->axis(axis); } else { return false; @@ -1430,6 +1447,10 @@ bool NativeAxis(const AxisInput &axis) { return false; default: + if (axis.axisId == JOYSTICK_AXIS_LTRIGGER) + PluginDataLT = axis.value; + else if (axis.axisId == JOYSTICK_AXIS_RTRIGGER) + PluginDataRT = axis.value; // Don't take over completely! return screenManager->axis(axis); }