mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
Merge pull request #9978 from LunaMoo/ctrl_extra
Add more PSP keys(for some homebrew and cwcheats)
This commit is contained in:
commit
ce21642a61
@ -664,6 +664,15 @@ const KeyMap_IntStrPair psp_button_names[] = {
|
|||||||
|
|
||||||
{VIRTKEY_AXIS_SWAP, "AxisSwap"},
|
{VIRTKEY_AXIS_SWAP, "AxisSwap"},
|
||||||
{VIRTKEY_DEVMENU, "DevMenu"},
|
{VIRTKEY_DEVMENU, "DevMenu"},
|
||||||
|
|
||||||
|
{CTRL_HOME, "Home"},
|
||||||
|
{CTRL_HOLD, "Hold"},
|
||||||
|
{CTRL_WLAN, "Wlan"},
|
||||||
|
{CTRL_REMOTE_HOLD, "Remote hold"},
|
||||||
|
{CTRL_VOL_UP, "Vol +"},
|
||||||
|
{CTRL_VOL_DOWN, "Vol -"},
|
||||||
|
{CTRL_SCREEN, "Screen"},
|
||||||
|
{CTRL_NOTE, "Note"},
|
||||||
};
|
};
|
||||||
|
|
||||||
const int AXIS_BIND_NKCODE_START = 4000;
|
const int AXIS_BIND_NKCODE_START = 4000;
|
||||||
|
@ -29,28 +29,28 @@
|
|||||||
#define KEYMAP_ERROR_UNKNOWN_KEY 0
|
#define KEYMAP_ERROR_UNKNOWN_KEY 0
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
VIRTKEY_FIRST = 0x10000,
|
VIRTKEY_FIRST = 0x40000001,
|
||||||
VIRTKEY_AXIS_X_MIN = 0x10000,
|
VIRTKEY_AXIS_X_MIN = 0x40000001,
|
||||||
VIRTKEY_AXIS_Y_MIN = 0x10001,
|
VIRTKEY_AXIS_Y_MIN = 0x40000002,
|
||||||
VIRTKEY_AXIS_X_MAX = 0x10002,
|
VIRTKEY_AXIS_X_MAX = 0x40000003,
|
||||||
VIRTKEY_AXIS_Y_MAX = 0x10003,
|
VIRTKEY_AXIS_Y_MAX = 0x40000004,
|
||||||
VIRTKEY_RAPID_FIRE = 0x10004,
|
VIRTKEY_RAPID_FIRE = 0x40000005,
|
||||||
VIRTKEY_UNTHROTTLE = 0x10005,
|
VIRTKEY_UNTHROTTLE = 0x40000006,
|
||||||
VIRTKEY_PAUSE = 0x10006,
|
VIRTKEY_PAUSE = 0x40000007,
|
||||||
VIRTKEY_SPEED_TOGGLE = 0x10007,
|
VIRTKEY_SPEED_TOGGLE = 0x40000008,
|
||||||
VIRTKEY_AXIS_RIGHT_X_MIN = 0x10008,
|
VIRTKEY_AXIS_RIGHT_X_MIN = 0x40000009,
|
||||||
VIRTKEY_AXIS_RIGHT_Y_MIN = 0x10009,
|
VIRTKEY_AXIS_RIGHT_Y_MIN = 0x4000000a,
|
||||||
VIRTKEY_AXIS_RIGHT_X_MAX = 0x1000a,
|
VIRTKEY_AXIS_RIGHT_X_MAX = 0x4000000b,
|
||||||
VIRTKEY_AXIS_RIGHT_Y_MAX = 0x1000b,
|
VIRTKEY_AXIS_RIGHT_Y_MAX = 0x4000000c,
|
||||||
VIRTKEY_REWIND = 0x1000c,
|
VIRTKEY_REWIND = 0x4000000d,
|
||||||
VIRTKEY_SAVE_STATE = 0x1000d,
|
VIRTKEY_SAVE_STATE = 0x4000000e,
|
||||||
VIRTKEY_LOAD_STATE = 0x1000e,
|
VIRTKEY_LOAD_STATE = 0x4000000f,
|
||||||
VIRTKEY_NEXT_SLOT = 0x1000f,
|
VIRTKEY_NEXT_SLOT = 0x40000010,
|
||||||
VIRTKEY_TOGGLE_FULLSCREEN = 0x10010,
|
VIRTKEY_TOGGLE_FULLSCREEN = 0x40000011,
|
||||||
VIRTKEY_ANALOG_LIGHTLY = 0x10011,
|
VIRTKEY_ANALOG_LIGHTLY = 0x40000012,
|
||||||
VIRTKEY_AXIS_SWAP = 0x10012,
|
VIRTKEY_AXIS_SWAP = 0x40000013,
|
||||||
VIRTKEY_DEVMENU = 0x10013,
|
VIRTKEY_DEVMENU = 0x40000014,
|
||||||
VIRTKEY_FRAME_ADVANCE = 0x10014,
|
VIRTKEY_FRAME_ADVANCE = 0x40000015,
|
||||||
VIRTKEY_LAST,
|
VIRTKEY_LAST,
|
||||||
VIRTKEY_COUNT = VIRTKEY_LAST - VIRTKEY_FIRST
|
VIRTKEY_COUNT = VIRTKEY_LAST - VIRTKEY_FIRST
|
||||||
};
|
};
|
||||||
|
@ -207,6 +207,8 @@ static int __CtrlReadSingleBuffer(PSPPointer<_ctrl_data> data, bool negative)
|
|||||||
*data = ctrlBufs[ctrlBufRead];
|
*data = ctrlBufs[ctrlBufRead];
|
||||||
ctrlBufRead = (ctrlBufRead + 1) % NUM_CTRL_BUFFERS;
|
ctrlBufRead = (ctrlBufRead + 1) % NUM_CTRL_BUFFERS;
|
||||||
|
|
||||||
|
// Mask out buttons games aren't allowed to see.
|
||||||
|
data->buttons &= CTRL_MASK_USER;
|
||||||
if (negative)
|
if (negative)
|
||||||
data->buttons = ~data->buttons;
|
data->buttons = ~data->buttons;
|
||||||
|
|
||||||
@ -500,24 +502,28 @@ static int sceCtrlPeekBufferNegative(u32 ctrlDataPtr, u32 nBufs)
|
|||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sceCtrlPeekLatch(u32 latchDataPtr)
|
void __CtrlWriteUserLatch(CtrlLatch *userLatch) {
|
||||||
{
|
*userLatch = latch;
|
||||||
DEBUG_LOG(SCECTRL, "sceCtrlPeekLatch(%08x)", latchDataPtr);
|
userLatch->btnBreak &= CTRL_MASK_USER;
|
||||||
|
userLatch->btnMake &= CTRL_MASK_USER;
|
||||||
if (Memory::IsValidAddress(latchDataPtr))
|
userLatch->btnPress &= CTRL_MASK_USER;
|
||||||
Memory::WriteStruct(latchDataPtr, &latch);
|
userLatch->btnRelease &= CTRL_MASK_USER;
|
||||||
|
|
||||||
return ctrlLatchBufs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sceCtrlReadLatch(u32 latchDataPtr)
|
static u32 sceCtrlPeekLatch(u32 latchDataPtr) {
|
||||||
{
|
auto userLatch = PSPPointer<CtrlLatch>::Create(latchDataPtr);
|
||||||
DEBUG_LOG(SCECTRL, "sceCtrlReadLatch(%08x)", latchDataPtr);
|
if (userLatch.IsValid()) {
|
||||||
|
__CtrlWriteUserLatch(userLatch);
|
||||||
|
}
|
||||||
|
return hleLogSuccessI(SCECTRL, ctrlLatchBufs);
|
||||||
|
}
|
||||||
|
|
||||||
if (Memory::IsValidAddress(latchDataPtr))
|
static u32 sceCtrlReadLatch(u32 latchDataPtr) {
|
||||||
Memory::WriteStruct(latchDataPtr, &latch);
|
auto userLatch = PSPPointer<CtrlLatch>::Create(latchDataPtr);
|
||||||
|
if (userLatch.IsValid()) {
|
||||||
return __CtrlResetLatch();
|
__CtrlWriteUserLatch(userLatch);
|
||||||
|
}
|
||||||
|
return hleLogSuccessI(SCECTRL, __CtrlResetLatch());
|
||||||
}
|
}
|
||||||
|
|
||||||
static const HLEFunction sceCtrl[] =
|
static const HLEFunction sceCtrl[] =
|
||||||
@ -531,8 +537,8 @@ static const HLEFunction sceCtrl[] =
|
|||||||
{0X3A622550, &WrapI_UU<sceCtrlPeekBufferPositive>, "sceCtrlPeekBufferPositive", 'i', "xx"},
|
{0X3A622550, &WrapI_UU<sceCtrlPeekBufferPositive>, "sceCtrlPeekBufferPositive", 'i', "xx"},
|
||||||
{0XC152080A, &WrapI_UU<sceCtrlPeekBufferNegative>, "sceCtrlPeekBufferNegative", 'i', "xx"},
|
{0XC152080A, &WrapI_UU<sceCtrlPeekBufferNegative>, "sceCtrlPeekBufferNegative", 'i', "xx"},
|
||||||
{0X60B81F86, &WrapI_UU<sceCtrlReadBufferNegative>, "sceCtrlReadBufferNegative", 'i', "xx"},
|
{0X60B81F86, &WrapI_UU<sceCtrlReadBufferNegative>, "sceCtrlReadBufferNegative", 'i', "xx"},
|
||||||
{0XB1D0E5CD, &WrapU_U<sceCtrlPeekLatch>, "sceCtrlPeekLatch", 'x', "x" },
|
{0XB1D0E5CD, &WrapU_U<sceCtrlPeekLatch>, "sceCtrlPeekLatch", 'i', "x" },
|
||||||
{0X0B588501, &WrapU_U<sceCtrlReadLatch>, "sceCtrlReadLatch", 'x', "x" },
|
{0X0B588501, &WrapU_U<sceCtrlReadLatch>, "sceCtrlReadLatch", 'i', "x" },
|
||||||
{0X348D99D4, nullptr, "sceCtrlSetSuspendingExtraSamples", '?', "" },
|
{0X348D99D4, nullptr, "sceCtrlSetSuspendingExtraSamples", '?', "" },
|
||||||
{0XAF5960F3, nullptr, "sceCtrlGetSuspendingExtraSamples", '?', "" },
|
{0XAF5960F3, nullptr, "sceCtrlGetSuspendingExtraSamples", '?', "" },
|
||||||
{0XA68FD260, nullptr, "sceCtrlClearRapidFire", '?', "" },
|
{0XA68FD260, nullptr, "sceCtrlClearRapidFire", '?', "" },
|
||||||
|
@ -40,7 +40,25 @@ const int CTRL_STICK_RIGHT = 1;
|
|||||||
#define CTRL_LTRIGGER 0x0100
|
#define CTRL_LTRIGGER 0x0100
|
||||||
#define CTRL_RTRIGGER 0x0200
|
#define CTRL_RTRIGGER 0x0200
|
||||||
|
|
||||||
#define CTRL_ALL_BUTTONS 0xF3F9
|
// System-ish buttons. Not generally used by games.
|
||||||
|
#define CTRL_HOME 0x00010000
|
||||||
|
#define CTRL_HOLD 0x00020000
|
||||||
|
#define CTRL_WLAN 0x00040000
|
||||||
|
#define CTRL_REMOTE_HOLD 0x00080000
|
||||||
|
#define CTRL_VOL_UP 0x00100000
|
||||||
|
#define CTRL_VOL_DOWN 0x00200000
|
||||||
|
#define CTRL_SCREEN 0x00400000
|
||||||
|
#define CTRL_NOTE 0x00800000
|
||||||
|
#define CTRL_DISC 0x01000000
|
||||||
|
#define CTRL_MEMSTICK 0x02000000
|
||||||
|
#define CTRL_FORWARD 0x10000000
|
||||||
|
#define CTRL_BACK 0x20000000
|
||||||
|
#define CTRL_PLAYPAUSE 0x40000000
|
||||||
|
|
||||||
|
#define CTRL_MASK_DPAD (CTRL_UP | CTRL_DOWN | CTRL_LEFT | CTRL_RIGHT)
|
||||||
|
#define CTRL_MASK_ACTION (CTRL_SQUARE | CTRL_TRIANGLE | CTRL_CIRCLE | CTRL_CROSS)
|
||||||
|
#define CTRL_MASK_TRIGGER (CTRL_LTRIGGER | CTRL_RTRIGGER)
|
||||||
|
#define CTRL_MASK_USER (CTRL_MASK_DPAD | CTRL_MASK_ACTION | CTRL_START | CTRL_SELECT | CTRL_MASK_TRIGGER | CTRL_HOME | CTRL_HOLD | CTRL_WLAN | CTRL_REMOTE_HOLD | CTRL_VOL_UP | CTRL_VOL_DOWN | CTRL_SCREEN | CTRL_NOTE)
|
||||||
|
|
||||||
void __CtrlInit();
|
void __CtrlInit();
|
||||||
void __CtrlDoState(PointerWrap &p);
|
void __CtrlDoState(PointerWrap &p);
|
||||||
|
Loading…
Reference in New Issue
Block a user