PS consoles: Use more natural button bindings

This commit is contained in:
UnknownShadow200 2024-06-30 23:04:36 +10:00
parent ede1a368f5
commit 8b2f1aec5b
22 changed files with 162 additions and 121 deletions

View file

@ -189,6 +189,7 @@ static void ClearTouches(void) { }
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J",\
"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",\
"U", "V", "W", "X", "Y", "Z"
#define Pad_Names \
"PAD_A", "PAD_B", "PAD_X", "PAD_Y", "PAD_L", "PAD_R", \
"PAD_Z", "PAD_C", "PAD_D", \
@ -197,6 +198,14 @@ static void ClearTouches(void) { }
"PAD_LSTICK", "PAD_RSTICK", \
"PAD_CLEFT", "PAD_CRIGHT", "PAD_CUP", "PAD_CDOWN"
#define Pad_DisplayNames \
"A", "B", "X", "Y", "L", "R", \
"Z", "C", "D", \
"LEFT", "RIGHT", "UP", "DOWN", \
"START", "SELECT", "ZL", "ZR", \
"LSTICK", "RSTICK", \
"CLEFT", "CRIGHT", "CUP", "CDOWN"
/* Names for each input button when stored to disc */
static const char* const storageNames[INPUT_COUNT] = {
"None",
@ -259,7 +268,7 @@ const char* const Input_DisplayNames[INPUT_COUNT] = {
"BROWSERPREV", "BROWSERNEXT", "BROWSERREFRESH", "BROWSERSTOP", "BROWSERSEARCH", "BROWSERFAVORITES", "BROWSERHOME",
"LAUNCHMAIL", "LAUNCHMEDIA", "LAUNCHAPP1", "LAUNCHCALC",
Pad_Names
Pad_DisplayNames
};
void Input_SetPressed(int key) {
@ -387,13 +396,13 @@ BindReleased Bind_OnReleased[BIND_COUNT];
const BindMapping PadBind_Defaults[BIND_COUNT] = {
{ CCPAD_UP, 0 }, { CCPAD_DOWN, 0 }, /* BIND_FORWARD, BIND_BACK */
{ CCPAD_LEFT, 0 }, { CCPAD_RIGHT, 0 }, /* BIND_LEFT, BIND_RIGHT */
{ CCPAD_A, 0 }, { 0, 0 }, /* BIND_JUMP, BIND_RESPAWN */
{ CCPAD_START, 0 }, { CCPAD_Y, 0 }, /* BIND_SET_SPAWN, BIND_CHAT */
{ CCPAD_X, 0 }, { 0, 0 }, /* BIND_INVENTORY, BIND_FOG */
{ CCPAD_1, 0 }, { 0, 0 }, /* BIND_JUMP, BIND_RESPAWN */
{ CCPAD_START, 0 }, { CCPAD_4, 0 }, /* BIND_SET_SPAWN, BIND_CHAT */
{ CCPAD_3, 0 }, { 0, 0 }, /* BIND_INVENTORY, BIND_FOG */
{ CCPAD_START, 0 }, { 0, 0 }, /* BIND_SEND_CHAT, BIND_TABLIST */
{ CCPAD_B, CCPAD_L},{ CCPAD_B, CCPAD_X},/* BIND_SPEED, BIND_NOCLIP */
{ CCPAD_B, CCPAD_R }, /* BIND_FLY */
{CCPAD_B,CCPAD_UP},{CCPAD_B,CCPAD_DOWN},/* BIND_FLY_UP, BIND_FLY_DOWN */
{ CCPAD_2, CCPAD_L},{ CCPAD_2, CCPAD_3},/* BIND_SPEED, BIND_NOCLIP */
{ CCPAD_2, CCPAD_R }, /* BIND_FLY */
{CCPAD_2,CCPAD_UP},{CCPAD_2,CCPAD_DOWN},/* BIND_FLY_UP, BIND_FLY_DOWN */
{ 0, 0 }, { 0, 0 }, /* BIND_EXT_INPUT, BIND_HIDE_FPS */
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, /* BIND_SCREENSHOT, BIND_FULLSCREEN, BIND_THIRD_PERSON, BIND_HIDE_GUI */
{ 0, 0 }, { 0, 0 }, { 0, 0 }, /* BIND_AXIS_LINES, BIND_ZOOM_SCROLL, BIND_HALF_SPEED */
@ -568,7 +577,7 @@ static void KeyBind_Init(void) {
/*########################################################################################################################*
*---------------------------------------------------------Gamepad---------------------------------------------------------*
*#########################################################################################################################*/
#define GAMEPAD_BEG_BTN CCPAD_A
#define GAMEPAD_BEG_BTN CCPAD_1
#define GAMEPAD_BTN_COUNT (INPUT_COUNT - GAMEPAD_BEG_BTN)
int Gamepad_AxisBehaviour[2] = { AXIS_BEHAVIOUR_MOVEMENT, AXIS_BEHAVIOUR_CAMERA };

View file

@ -52,8 +52,9 @@ enum InputButtons {
CCKEY_BROWSER_PREV, CCKEY_BROWSER_NEXT, CCKEY_BROWSER_REFRESH, CCKEY_BROWSER_STOP, CCKEY_BROWSER_SEARCH, CCKEY_BROWSER_FAVORITES, CCKEY_BROWSER_HOME,
CCKEY_LAUNCH_MAIL, CCKEY_LAUNCH_MEDIA, CCKEY_LAUNCH_APP1, CCKEY_LAUNCH_CALC,
CCPAD_A, CCPAD_B, CCPAD_X, CCPAD_Y, CCPAD_L, CCPAD_R,
CCPAD_Z, CCPAD_C, CCPAD_D,
CCPAD_1, CCPAD_2, CCPAD_3, CCPAD_4, /* Primary buttons (e.g. A, B, X, Y) */
CCPAD_L, CCPAD_R,
CCPAD_5, CCPAD_6, CCPAD_7, /* Secondary buttons (e.g. Z, C, D) */
CCPAD_LEFT, CCPAD_RIGHT, CCPAD_UP, CCPAD_DOWN,
CCPAD_START, CCPAD_SELECT, CCPAD_ZL, CCPAD_ZR,
CCPAD_LSTICK, CCPAD_RSTICK,
@ -64,7 +65,7 @@ enum InputButtons {
INPUT_CLIPBOARD_COPY = 1001,
INPUT_CLIPBOARD_PASTE = 1002
};
#define Input_IsPadButton(btn) ((btn) >= CCPAD_A && (btn) < INPUT_COUNT)
#define Input_IsPadButton(btn) ((btn) >= CCPAD_1 && (btn) < INPUT_COUNT)
extern const char* const Input_DisplayNames[INPUT_COUNT];
@ -101,7 +102,7 @@ void Input_Clear(void);
#define Input_IsLeftButton(btn) ((btn) == CCKEY_LEFT || (btn) == CCPAD_LEFT)
#define Input_IsRightButton(btn) ((btn) == CCKEY_RIGHT || (btn) == CCPAD_RIGHT)
#define Input_IsEnterButton(btn) ((btn) == CCKEY_ENTER || (btn) == CCPAD_START || (btn) == CCKEY_KP_ENTER || (btn) == CCPAD_A)
#define Input_IsEnterButton(btn) ((btn) == CCKEY_ENTER || (btn) == CCPAD_START || (btn) == CCKEY_KP_ENTER || (btn) == CCPAD_1)
#define Input_IsPauseButton(btn) ((btn) == CCKEY_ESCAPE || (btn) == CCPAD_START || (btn) == CCKEY_PAUSE)
#define Input_IsEscapeButton(btn) ((btn) == CCKEY_ESCAPE || (btn) == CCPAD_SELECT)

View file

@ -253,13 +253,13 @@ static void VirtualKeyboard_ProcessDown(void* obj, int key, cc_bool was) {
if (deltaX || deltaY) {
VirtualKeyboard_Scroll(deltaX, deltaY);
} else if (key == CCPAD_START || key == CCPAD_A) {
} else if (key == CCPAD_START || key == CCPAD_1) {
VirtualKeyboard_ClickSelected();
} else if (key == CCPAD_SELECT || key == CCPAD_B) {
} else if (key == CCPAD_SELECT || key == CCPAD_2) {
VirtualKeyboard_Close();
} else if (key == CCPAD_X) {
} else if (key == CCPAD_3) {
VirtualKeyboard_Backspace();
} else if (key == CCPAD_Y) {
} else if (key == CCPAD_4) {
VirtualKeyboard_AppendChar('@');
} else if (key == CCPAD_L) {
VirtualKeyboard_AppendChar(' ');

View file

@ -139,10 +139,10 @@ static void HandleButtons(u32 mods) {
Gamepad_SetButton(0, CCPAD_L, mods & KEY_L);
Gamepad_SetButton(0, CCPAD_R, mods & KEY_R);
Gamepad_SetButton(0, CCPAD_A, mods & KEY_A);
Gamepad_SetButton(0, CCPAD_B, mods & KEY_B);
Gamepad_SetButton(0, CCPAD_X, mods & KEY_X);
Gamepad_SetButton(0, CCPAD_Y, mods & KEY_Y);
Gamepad_SetButton(0, CCPAD_1, mods & KEY_A);
Gamepad_SetButton(0, CCPAD_2, mods & KEY_B);
Gamepad_SetButton(0, CCPAD_3, mods & KEY_X);
Gamepad_SetButton(0, CCPAD_4, mods & KEY_Y);
Gamepad_SetButton(0, CCPAD_START, mods & KEY_START);
Gamepad_SetButton(0, CCPAD_SELECT, mods & KEY_SELECT);

View file

@ -86,10 +86,10 @@ static int MapNativeKey(int code) {
case AKEYCODE_DPAD_LEFT: return CCPAD_LEFT;
case AKEYCODE_DPAD_RIGHT: return CCPAD_RIGHT;
case AKEYCODE_BUTTON_A: return CCPAD_A;
case AKEYCODE_BUTTON_B: return CCPAD_B;
case AKEYCODE_BUTTON_X: return CCPAD_X;
case AKEYCODE_BUTTON_Y: return CCPAD_Y;
case AKEYCODE_BUTTON_A: return CCPAD_1;
case AKEYCODE_BUTTON_B: return CCPAD_2;
case AKEYCODE_BUTTON_X: return CCPAD_3;
case AKEYCODE_BUTTON_Y: return CCPAD_4;
case AKEYCODE_BUTTON_L1: return CCPAD_L;
case AKEYCODE_BUTTON_R1: return CCPAD_R;

View file

@ -227,10 +227,10 @@ void Gamepads_Init(void) {
}
static void HandleButtons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_A, mods & CONT_A);
Gamepad_SetButton(port, CCPAD_B, mods & CONT_B);
Gamepad_SetButton(port, CCPAD_X, mods & CONT_X);
Gamepad_SetButton(port, CCPAD_Y, mods & CONT_Y);
Gamepad_SetButton(port, CCPAD_1, mods & CONT_A);
Gamepad_SetButton(port, CCPAD_2, mods & CONT_B);
Gamepad_SetButton(port, CCPAD_3, mods & CONT_X);
Gamepad_SetButton(port, CCPAD_4, mods & CONT_Y);
Gamepad_SetButton(port, CCPAD_START, mods & CONT_START);
Gamepad_SetButton(port, CCPAD_SELECT, mods & CONT_D);
@ -241,9 +241,9 @@ static void HandleButtons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_DOWN, mods & CONT_DPAD_DOWN);
// Buttons not on standard controller
Gamepad_SetButton(port, CCPAD_C, mods & CONT_C);
Gamepad_SetButton(port, CCPAD_D, mods & CONT_D);
Gamepad_SetButton(port, CCPAD_Z, mods & CONT_Z);
Gamepad_SetButton(port, CCPAD_6, mods & CONT_C);
Gamepad_SetButton(port, CCPAD_7, mods & CONT_D);
Gamepad_SetButton(port, CCPAD_5, mods & CONT_Z);
Gamepad_SetButton(port, CCPAD_CLEFT, mods & CONT_DPAD2_LEFT);
Gamepad_SetButton(port, CCPAD_CRIGHT, mods & CONT_DPAD2_RIGHT);
Gamepad_SetButton(port, CCPAD_CUP, mods & CONT_DPAD2_UP);

View file

@ -123,10 +123,10 @@ static void ProcessPAD_Buttons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_L, mods & PAD_TRIGGER_L);
Gamepad_SetButton(port, CCPAD_R, mods & PAD_TRIGGER_R);
Gamepad_SetButton(port, CCPAD_A, mods & PAD_BUTTON_A);
Gamepad_SetButton(port, CCPAD_B, mods & PAD_BUTTON_B);
Gamepad_SetButton(port, CCPAD_X, mods & PAD_BUTTON_X);
Gamepad_SetButton(port, CCPAD_Y, mods & PAD_BUTTON_Y);
Gamepad_SetButton(port, CCPAD_1, mods & PAD_BUTTON_A);
Gamepad_SetButton(port, CCPAD_2, mods & PAD_BUTTON_B);
Gamepad_SetButton(port, CCPAD_3, mods & PAD_BUTTON_X);
Gamepad_SetButton(port, CCPAD_4, mods & PAD_BUTTON_Y);
Gamepad_SetButton(port, CCPAD_START, mods & PAD_BUTTON_START);
Gamepad_SetButton(port, CCPAD_SELECT, mods & PAD_TRIGGER_Z);
@ -320,9 +320,9 @@ static void ProcessWPAD_Buttons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_L, mods & WPAD_BUTTON_1);
Gamepad_SetButton(port, CCPAD_R, mods & WPAD_BUTTON_2);
Gamepad_SetButton(port, CCPAD_A, mods & WPAD_BUTTON_A);
Gamepad_SetButton(port, CCPAD_B, mods & WPAD_BUTTON_B);
Gamepad_SetButton(port, CCPAD_X, mods & WPAD_BUTTON_PLUS);
Gamepad_SetButton(port, CCPAD_1, mods & WPAD_BUTTON_A);
Gamepad_SetButton(port, CCPAD_2, mods & WPAD_BUTTON_B);
Gamepad_SetButton(port, CCPAD_3, mods & WPAD_BUTTON_PLUS);
Gamepad_SetButton(port, CCPAD_START, mods & WPAD_BUTTON_HOME);
Gamepad_SetButton(port, CCPAD_SELECT, mods & WPAD_BUTTON_MINUS);
@ -340,9 +340,9 @@ static void ProcessNunchuck_Game(int port, int mods, float delta) {
Gamepad_SetButton(port, CCPAD_L, mods & WPAD_NUNCHUK_BUTTON_C);
Gamepad_SetButton(port, CCPAD_R, mods & WPAD_NUNCHUK_BUTTON_Z);
Gamepad_SetButton(port, CCPAD_A, mods & WPAD_BUTTON_A);
Gamepad_SetButton(port, CCPAD_Y, mods & WPAD_BUTTON_1);
Gamepad_SetButton(port, CCPAD_X, mods & WPAD_BUTTON_2);
Gamepad_SetButton(port, CCPAD_1, mods & WPAD_BUTTON_A);
Gamepad_SetButton(port, CCPAD_4, mods & WPAD_BUTTON_1);
Gamepad_SetButton(port, CCPAD_3, mods & WPAD_BUTTON_2);
Gamepad_SetButton(port, CCPAD_START, mods & WPAD_BUTTON_HOME);
Gamepad_SetButton(port, CCPAD_SELECT, mods & WPAD_BUTTON_MINUS);
@ -384,10 +384,10 @@ static void ProcessClassicButtons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_L, mods & CLASSIC_CTRL_BUTTON_FULL_L);
Gamepad_SetButton(port, CCPAD_R, mods & CLASSIC_CTRL_BUTTON_FULL_R);
Gamepad_SetButton(port, CCPAD_A, mods & CLASSIC_CTRL_BUTTON_A);
Gamepad_SetButton(port, CCPAD_B, mods & CLASSIC_CTRL_BUTTON_B);
Gamepad_SetButton(port, CCPAD_X, mods & CLASSIC_CTRL_BUTTON_X);
Gamepad_SetButton(port, CCPAD_Y, mods & CLASSIC_CTRL_BUTTON_Y);
Gamepad_SetButton(port, CCPAD_1, mods & CLASSIC_CTRL_BUTTON_A);
Gamepad_SetButton(port, CCPAD_2, mods & CLASSIC_CTRL_BUTTON_B);
Gamepad_SetButton(port, CCPAD_3, mods & CLASSIC_CTRL_BUTTON_X);
Gamepad_SetButton(port, CCPAD_4, mods & CLASSIC_CTRL_BUTTON_Y);
Gamepad_SetButton(port, CCPAD_START, mods & CLASSIC_CTRL_BUTTON_PLUS);
Gamepad_SetButton(port, CCPAD_SELECT, mods & CLASSIC_CTRL_BUTTON_MINUS);

View file

@ -41,9 +41,9 @@ void Window_Init(void) {
// change defaults to make more sense for N64
BindMapping* binds = (BindMapping*)PadBind_Defaults;
BindMapping_Set(&binds[BIND_JUMP], CCPAD_A, 0);
BindMapping_Set(&binds[BIND_INVENTORY], CCPAD_B, 0);
BindMapping_Set(&binds[BIND_PLACE_BLOCK], CCPAD_Z, 0);
BindMapping_Set(&binds[BIND_JUMP], CCPAD_1, 0);
BindMapping_Set(&binds[BIND_INVENTORY], CCPAD_2, 0);
BindMapping_Set(&binds[BIND_PLACE_BLOCK], CCPAD_5, 0);
BindMapping_Set(&binds[BIND_HOTBAR_RIGHT], CCPAD_L, 0);
BindMapping_Set(&binds[BIND_DELETE_BLOCK], CCPAD_R, 0);
@ -106,9 +106,9 @@ static void HandleButtons(int port, joypad_buttons_t btns) {
Gamepad_SetButton(port, CCPAD_L, btns.l);
Gamepad_SetButton(port, CCPAD_R, btns.r);
Gamepad_SetButton(port, CCPAD_A, btns.a);
Gamepad_SetButton(port, CCPAD_B, btns.b);
Gamepad_SetButton(port, CCPAD_Z, btns.z);
Gamepad_SetButton(port, CCPAD_1, btns.a);
Gamepad_SetButton(port, CCPAD_2, btns.b);
Gamepad_SetButton(port, CCPAD_5, btns.z);
Gamepad_SetButton(port, CCPAD_START, btns.start);

View file

@ -238,10 +238,10 @@ void Gamepads_Process(float delta) {
Gamepad_SetButton(0, CCPAD_L, mods & KEY_L);
Gamepad_SetButton(0, CCPAD_R, mods & KEY_R);
Gamepad_SetButton(0, CCPAD_A, mods & KEY_A);
Gamepad_SetButton(0, CCPAD_B, mods & KEY_B);
Gamepad_SetButton(0, CCPAD_X, mods & KEY_X);
Gamepad_SetButton(0, CCPAD_Y, mods & KEY_Y);
Gamepad_SetButton(0, CCPAD_1, mods & KEY_A);
Gamepad_SetButton(0, CCPAD_2, mods & KEY_B);
Gamepad_SetButton(0, CCPAD_3, mods & KEY_X);
Gamepad_SetButton(0, CCPAD_4, mods & KEY_Y);
Gamepad_SetButton(0, CCPAD_START, mods & KEY_START);
Gamepad_SetButton(0, CCPAD_SELECT, mods & KEY_SELECT);

View file

@ -101,6 +101,11 @@ void Gamepads_Init(void) {
pad_buff[1][0] = pad_buff[1][1] = 0xff;
StartPAD();
ChangeClearPAD(0);
Input_DisplayNames[CCPAD_1] = "CIRCLE";
Input_DisplayNames[CCPAD_2] = "CROSS";
Input_DisplayNames[CCPAD_3] = "SQUARE";
Input_DisplayNames[CCPAD_4] = "TRIANGLE";
}
static void HandleButtons(int port, int buttons) {
@ -108,10 +113,10 @@ static void HandleButtons(int port, int buttons) {
// So just flip the bits to make more sense
buttons = ~buttons;
Gamepad_SetButton(port, CCPAD_A, buttons & PAD_TRIANGLE);
Gamepad_SetButton(port, CCPAD_B, buttons & PAD_SQUARE);
Gamepad_SetButton(port, CCPAD_X, buttons & PAD_CROSS);
Gamepad_SetButton(port, CCPAD_Y, buttons & PAD_CIRCLE);
Gamepad_SetButton(port, CCPAD_1, buttons & PAD_CIRCLE);
Gamepad_SetButton(port, CCPAD_2, buttons & PAD_CROSS);
Gamepad_SetButton(port, CCPAD_3, buttons & PAD_SQUARE);
Gamepad_SetButton(port, CCPAD_4, buttons & PAD_TRIANGLE);
Gamepad_SetButton(port, CCPAD_START, buttons & PAD_START);
Gamepad_SetButton(port, CCPAD_SELECT, buttons & PAD_SELECT);

View file

@ -191,6 +191,11 @@ void Gamepads_Init(void) {
padInit(0);
padPortOpen(0, 0, padBuf0);
padPortOpen(1, 0, padBuf1);
Input_DisplayNames[CCPAD_1] = "CIRCLE";
Input_DisplayNames[CCPAD_2] = "CROSS";
Input_DisplayNames[CCPAD_3] = "SQUARE";
Input_DisplayNames[CCPAD_4] = "TRIANGLE";
}
static void HandleButtons(int port, int buttons) {
@ -199,10 +204,10 @@ static void HandleButtons(int port, int buttons) {
buttons = buttons ^ 0xFFFF;
//Platform_Log1("BUTTONS: %h", &buttons);
Gamepad_SetButton(port, CCPAD_A, buttons & PAD_TRIANGLE);
Gamepad_SetButton(port, CCPAD_B, buttons & PAD_SQUARE);
Gamepad_SetButton(port, CCPAD_X, buttons & PAD_CROSS);
Gamepad_SetButton(port, CCPAD_Y, buttons & PAD_CIRCLE);
Gamepad_SetButton(port, CCPAD_1, buttons & PAD_CIRCLE);
Gamepad_SetButton(port, CCPAD_2, buttons & PAD_CROSS);
Gamepad_SetButton(port, CCPAD_3, buttons & PAD_SQUARE);
Gamepad_SetButton(port, CCPAD_4, buttons & PAD_TRIANGLE);
Gamepad_SetButton(port, CCPAD_START, buttons & PAD_START);
Gamepad_SetButton(port, CCPAD_SELECT, buttons & PAD_SELECT);

View file

@ -277,14 +277,19 @@ void Window_DisableRawMouse(void) { Input.RawMode = false; }
void Gamepads_Init(void) {
Input.Sources |= INPUT_SOURCE_GAMEPAD;
ioPadInit(MAX_PORT_NUM);
Input_DisplayNames[CCPAD_1] = "CIRCLE";
Input_DisplayNames[CCPAD_2] = "CROSS";
Input_DisplayNames[CCPAD_3] = "SQUARE";
Input_DisplayNames[CCPAD_4] = "TRIANGLE";
}
static void HandleButtons(int port, padData* data) {
//Platform_Log2("BUTTONS: %h (%h)", &data->button[2], &data->button[0]);
Gamepad_SetButton(port, CCPAD_A, data->BTN_TRIANGLE);
Gamepad_SetButton(port, CCPAD_B, data->BTN_SQUARE);
Gamepad_SetButton(port, CCPAD_X, data->BTN_CROSS);
Gamepad_SetButton(port, CCPAD_Y, data->BTN_CIRCLE);
Gamepad_SetButton(port, CCPAD_1, data->BTN_CIRCLE);
Gamepad_SetButton(port, CCPAD_2, data->BTN_CROSS);
Gamepad_SetButton(port, CCPAD_3, data->BTN_SQUARE);
Gamepad_SetButton(port, CCPAD_4, data->BTN_TRIANGLE);
Gamepad_SetButton(port, CCPAD_START, data->BTN_START);
Gamepad_SetButton(port, CCPAD_SELECT, data->BTN_SELECT);

View file

@ -89,16 +89,21 @@ void Gamepads_Init(void) {
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
Input_DisplayNames[CCPAD_1] = "CIRCLE";
Input_DisplayNames[CCPAD_2] = "CROSS";
Input_DisplayNames[CCPAD_3] = "SQUARE";
Input_DisplayNames[CCPAD_4] = "TRIANGLE";
}
static void HandleButtons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_L, mods & PSP_CTRL_LTRIGGER);
Gamepad_SetButton(port, CCPAD_R, mods & PSP_CTRL_RTRIGGER);
Gamepad_SetButton(port, CCPAD_A, mods & PSP_CTRL_TRIANGLE);
Gamepad_SetButton(port, CCPAD_B, mods & PSP_CTRL_SQUARE);
Gamepad_SetButton(port, CCPAD_X, mods & PSP_CTRL_CROSS);
Gamepad_SetButton(port, CCPAD_Y, mods & PSP_CTRL_CIRCLE);
Gamepad_SetButton(port, CCPAD_1, mods & PSP_CTRL_CIRCLE);
Gamepad_SetButton(port, CCPAD_2, mods & PSP_CTRL_CROSS);
Gamepad_SetButton(port, CCPAD_3, mods & PSP_CTRL_SQUARE);
Gamepad_SetButton(port, CCPAD_4, mods & PSP_CTRL_TRIANGLE);
Gamepad_SetButton(port, CCPAD_START, mods & PSP_CTRL_START);
Gamepad_SetButton(port, CCPAD_SELECT, mods & PSP_CTRL_SELECT);

View file

@ -141,13 +141,18 @@ void Gamepads_Init(void) {
Input.Sources |= INPUT_SOURCE_GAMEPAD;
sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG);
Input_DisplayNames[CCPAD_1] = "CIRCLE";
Input_DisplayNames[CCPAD_2] = "CROSS";
Input_DisplayNames[CCPAD_3] = "SQUARE";
Input_DisplayNames[CCPAD_4] = "TRIANGLE";
}
static void HandleButtons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_A, mods & SCE_CTRL_TRIANGLE);
Gamepad_SetButton(port, CCPAD_B, mods & SCE_CTRL_SQUARE);
Gamepad_SetButton(port, CCPAD_X, mods & SCE_CTRL_CROSS);
Gamepad_SetButton(port, CCPAD_Y, mods & SCE_CTRL_CIRCLE);
Gamepad_SetButton(port, CCPAD_1, mods & SCE_CTRL_CIRCLE);
Gamepad_SetButton(port, CCPAD_2, mods & SCE_CTRL_CROSS);
Gamepad_SetButton(port, CCPAD_3, mods & SCE_CTRL_SQUARE);
Gamepad_SetButton(port, CCPAD_4, mods & SCE_CTRL_TRIANGLE);
Gamepad_SetButton(port, CCPAD_START, mods & SCE_CTRL_START);
Gamepad_SetButton(port, CCPAD_SELECT, mods & SCE_CTRL_SELECT);

View file

@ -487,10 +487,10 @@ void Gamepads_Init(void) {
static void ProcessGamepadButtons(int port) {
SDL_GameController* gp = controllers[port];
Gamepad_SetButton(port, CCPAD_A, SDL_GameControllerGetButton(gp, SDL_CONTROLLER_BUTTON_A));
Gamepad_SetButton(port, CCPAD_B, SDL_GameControllerGetButton(gp, SDL_CONTROLLER_BUTTON_B));
Gamepad_SetButton(port, CCPAD_X, SDL_GameControllerGetButton(gp, SDL_CONTROLLER_BUTTON_X));
Gamepad_SetButton(port, CCPAD_Y, SDL_GameControllerGetButton(gp, SDL_CONTROLLER_BUTTON_Y));
Gamepad_SetButton(port, CCPAD_1, SDL_GameControllerGetButton(gp, SDL_CONTROLLER_BUTTON_A));
Gamepad_SetButton(port, CCPAD_2, SDL_GameControllerGetButton(gp, SDL_CONTROLLER_BUTTON_B));
Gamepad_SetButton(port, CCPAD_3, SDL_GameControllerGetButton(gp, SDL_CONTROLLER_BUTTON_X));
Gamepad_SetButton(port, CCPAD_4, SDL_GameControllerGetButton(gp, SDL_CONTROLLER_BUTTON_Y));
Gamepad_SetButton(port, CCPAD_ZL, SDL_GameControllerGetAxis( gp, SDL_CONTROLLER_AXIS_TRIGGERLEFT ) > 8000);
Gamepad_SetButton(port, CCPAD_ZR, SDL_GameControllerGetAxis( gp, SDL_CONTROLLER_AXIS_TRIGGERRIGHT) > 8000);

View file

@ -520,10 +520,10 @@ void Gamepads_Init(void) {
static void ProcessGamepadButtons(int port) {
SDL_Gamepad* gp = controllers[port];
Gamepad_SetButton(port, CCPAD_A, SDL_GetGamepadButton(gp, SDL_GAMEPAD_BUTTON_SOUTH));
Gamepad_SetButton(port, CCPAD_B, SDL_GetGamepadButton(gp, SDL_GAMEPAD_BUTTON_EAST));
Gamepad_SetButton(port, CCPAD_X, SDL_GetGamepadButton(gp, SDL_GAMEPAD_BUTTON_WEST));
Gamepad_SetButton(port, CCPAD_Y, SDL_GetGamepadButton(gp, SDL_GAMEPAD_BUTTON_NORTH));
Gamepad_SetButton(port, CCPAD_1, SDL_GetGamepadButton(gp, SDL_GAMEPAD_BUTTON_SOUTH));
Gamepad_SetButton(port, CCPAD_2, SDL_GetGamepadButton(gp, SDL_GAMEPAD_BUTTON_EAST));
Gamepad_SetButton(port, CCPAD_3, SDL_GetGamepadButton(gp, SDL_GAMEPAD_BUTTON_WEST));
Gamepad_SetButton(port, CCPAD_4, SDL_GetGamepadButton(gp, SDL_GAMEPAD_BUTTON_NORTH));
Gamepad_SetButton(port, CCPAD_ZL, SDL_GetGamepadAxis( gp, SDL_GAMEPAD_AXIS_LEFT_TRIGGER ) > 8000);
Gamepad_SetButton(port, CCPAD_ZR, SDL_GetGamepadAxis( gp, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER) > 8000);

View file

@ -97,15 +97,21 @@ void Window_DisableRawMouse(void) { Input.RawMode = false; }
void Gamepads_Init(void) {
Input.Sources |= INPUT_SOURCE_GAMEPAD;
smpc_peripheral_init();
Input_DisplayNames[CCPAD_1] = "A";
Input_DisplayNames[CCPAD_2] = "B";
Input_DisplayNames[CCPAD_3] = "C";
Input_DisplayNames[CCPAD_4] = "X";
Input_DisplayNames[CCPAD_5] = "Y";
}
static void ProcessButtons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_A, mods & PERIPHERAL_DIGITAL_A);
Gamepad_SetButton(port, CCPAD_B, mods & PERIPHERAL_DIGITAL_B);
Gamepad_SetButton(port, CCPAD_X, mods & PERIPHERAL_DIGITAL_C);
Gamepad_SetButton(port, CCPAD_1, mods & PERIPHERAL_DIGITAL_A);
Gamepad_SetButton(port, CCPAD_2, mods & PERIPHERAL_DIGITAL_B);
Gamepad_SetButton(port, CCPAD_3, mods & PERIPHERAL_DIGITAL_C);
Gamepad_SetButton(port, CCPAD_Y, mods & PERIPHERAL_DIGITAL_X);
Gamepad_SetButton(port, CCPAD_Z, mods & PERIPHERAL_DIGITAL_Y);
Gamepad_SetButton(port, CCPAD_4, mods & PERIPHERAL_DIGITAL_X);
Gamepad_SetButton(port, CCPAD_5, mods & PERIPHERAL_DIGITAL_Y);
Gamepad_SetButton(port, CCPAD_L, mods & PERIPHERAL_DIGITAL_L);
Gamepad_SetButton(port, CCPAD_R, mods & PERIPHERAL_DIGITAL_R);

View file

@ -156,10 +156,10 @@ static void HandleButtons(int port, u64 mods) {
Gamepad_SetButton(port, CCPAD_L, mods & HidNpadButton_L);
Gamepad_SetButton(port, CCPAD_R, mods & HidNpadButton_R);
Gamepad_SetButton(port, CCPAD_A, mods & HidNpadButton_A);
Gamepad_SetButton(port, CCPAD_B, mods & HidNpadButton_B);
Gamepad_SetButton(port, CCPAD_X, mods & HidNpadButton_X);
Gamepad_SetButton(port, CCPAD_Y, mods & HidNpadButton_Y);
Gamepad_SetButton(port, CCPAD_1, mods & HidNpadButton_A);
Gamepad_SetButton(port, CCPAD_2, mods & HidNpadButton_B);
Gamepad_SetButton(port, CCPAD_3, mods & HidNpadButton_X);
Gamepad_SetButton(port, CCPAD_4, mods & HidNpadButton_Y);
Gamepad_SetButton(port, CCPAD_START, mods & HidNpadButton_Plus);
Gamepad_SetButton(port, CCPAD_SELECT, mods & HidNpadButton_Minus);

View file

@ -577,10 +577,10 @@ void Gamepads_Init(void) { }
static void ProcessGamepadButtons(int port, EmscriptenGamepadEvent* ev) {
int numButtons = ev->numButtons;
Gamepad_SetButton(port, CCPAD_A, GetGamepadButton(0));
Gamepad_SetButton(port, CCPAD_B, GetGamepadButton(1));
Gamepad_SetButton(port, CCPAD_X, GetGamepadButton(2));
Gamepad_SetButton(port, CCPAD_Y, GetGamepadButton(3));
Gamepad_SetButton(port, CCPAD_1, GetGamepadButton(0));
Gamepad_SetButton(port, CCPAD_2, GetGamepadButton(1));
Gamepad_SetButton(port, CCPAD_3, GetGamepadButton(2));
Gamepad_SetButton(port, CCPAD_4, GetGamepadButton(3));
Gamepad_SetButton(port, CCPAD_ZL, GetGamepadButton(4));
Gamepad_SetButton(port, CCPAD_ZR, GetGamepadButton(5));

View file

@ -177,9 +177,9 @@ static void ProcessKPadButtons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_L, mods & WPAD_BUTTON_1);
Gamepad_SetButton(port, CCPAD_R, mods & WPAD_BUTTON_2);
Gamepad_SetButton(port, CCPAD_A, mods & WPAD_BUTTON_A);
Gamepad_SetButton(port, CCPAD_B, mods & WPAD_BUTTON_B);
Gamepad_SetButton(port, CCPAD_X, mods & WPAD_BUTTON_PLUS);
Gamepad_SetButton(port, CCPAD_1, mods & WPAD_BUTTON_A);
Gamepad_SetButton(port, CCPAD_2, mods & WPAD_BUTTON_B);
Gamepad_SetButton(port, CCPAD_3, mods & WPAD_BUTTON_PLUS);
Gamepad_SetButton(port, CCPAD_START, mods & WPAD_BUTTON_HOME);
Gamepad_SetButton(port, CCPAD_SELECT, mods & WPAD_BUTTON_MINUS);
@ -201,14 +201,14 @@ static void ProcessClassicButtons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_ZL, mods & WPAD_CLASSIC_BUTTON_ZL);
Gamepad_SetButton(port, CCPAD_ZR, mods & WPAD_CLASSIC_BUTTON_ZR);
Gamepad_SetButton(port, CCPAD_A, mods & WPAD_CLASSIC_BUTTON_A);
Gamepad_SetButton(port, CCPAD_B, mods & WPAD_CLASSIC_BUTTON_B);
Gamepad_SetButton(port, CCPAD_X, mods & WPAD_CLASSIC_BUTTON_X);
Gamepad_SetButton(port, CCPAD_Y, mods & WPAD_CLASSIC_BUTTON_Y);
Gamepad_SetButton(port, CCPAD_1, mods & WPAD_CLASSIC_BUTTON_A);
Gamepad_SetButton(port, CCPAD_2, mods & WPAD_CLASSIC_BUTTON_B);
Gamepad_SetButton(port, CCPAD_3, mods & WPAD_CLASSIC_BUTTON_X);
Gamepad_SetButton(port, CCPAD_4, mods & WPAD_CLASSIC_BUTTON_Y);
Gamepad_SetButton(port, CCPAD_START, mods & WPAD_CLASSIC_BUTTON_HOME);
Gamepad_SetButton(port, CCPAD_SELECT, mods & WPAD_CLASSIC_BUTTON_MINUS);
Gamepad_SetButton(port, CCPAD_Z, mods & WPAD_CLASSIC_BUTTON_PLUS);
Gamepad_SetButton(port, CCPAD_5, mods & WPAD_CLASSIC_BUTTON_PLUS);
Gamepad_SetButton(port, CCPAD_LEFT, mods & WPAD_CLASSIC_BUTTON_LEFT);
Gamepad_SetButton(port, CCPAD_RIGHT, mods & WPAD_CLASSIC_BUTTON_RIGHT);
@ -222,14 +222,14 @@ static void ProcessProButtons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_ZL, mods & WPAD_PRO_TRIGGER_ZL);
Gamepad_SetButton(port, CCPAD_ZR, mods & WPAD_PRO_TRIGGER_ZR);
Gamepad_SetButton(port, CCPAD_A, mods & WPAD_PRO_BUTTON_A);
Gamepad_SetButton(port, CCPAD_B, mods & WPAD_PRO_BUTTON_B);
Gamepad_SetButton(port, CCPAD_X, mods & WPAD_PRO_BUTTON_X);
Gamepad_SetButton(port, CCPAD_Y, mods & WPAD_PRO_BUTTON_Y);
Gamepad_SetButton(port, CCPAD_1, mods & WPAD_PRO_BUTTON_A);
Gamepad_SetButton(port, CCPAD_2, mods & WPAD_PRO_BUTTON_B);
Gamepad_SetButton(port, CCPAD_3, mods & WPAD_PRO_BUTTON_X);
Gamepad_SetButton(port, CCPAD_4, mods & WPAD_PRO_BUTTON_Y);
Gamepad_SetButton(port, CCPAD_START, mods & WPAD_PRO_BUTTON_HOME);
Gamepad_SetButton(port, CCPAD_SELECT, mods & WPAD_PRO_BUTTON_MINUS);
Gamepad_SetButton(port, CCPAD_Z, mods & WPAD_PRO_BUTTON_PLUS);
Gamepad_SetButton(port, CCPAD_5, mods & WPAD_PRO_BUTTON_PLUS);
Gamepad_SetButton(port, CCPAD_LSTICK, mods & WPAD_PRO_BUTTON_STICK_L);
Gamepad_SetButton(port, CCPAD_RSTICK, mods & WPAD_PRO_BUTTON_STICK_R);
@ -280,10 +280,10 @@ static void ProcessVpadButtons(int port, int mods) {
Gamepad_SetButton(port, CCPAD_ZL, mods & VPAD_BUTTON_ZL);
Gamepad_SetButton(port, CCPAD_ZR, mods & VPAD_BUTTON_ZR);
Gamepad_SetButton(port, CCPAD_A, mods & VPAD_BUTTON_A);
Gamepad_SetButton(port, CCPAD_B, mods & VPAD_BUTTON_B);
Gamepad_SetButton(port, CCPAD_X, mods & VPAD_BUTTON_X);
Gamepad_SetButton(port, CCPAD_Y, mods & VPAD_BUTTON_Y);
Gamepad_SetButton(port, CCPAD_1, mods & VPAD_BUTTON_A);
Gamepad_SetButton(port, CCPAD_2, mods & VPAD_BUTTON_B);
Gamepad_SetButton(port, CCPAD_3, mods & VPAD_BUTTON_X);
Gamepad_SetButton(port, CCPAD_4, mods & VPAD_BUTTON_Y);
Gamepad_SetButton(port, CCPAD_START, mods & VPAD_BUTTON_PLUS);
Gamepad_SetButton(port, CCPAD_SELECT, mods & VPAD_BUTTON_MINUS);

View file

@ -153,10 +153,10 @@ static void HandleButtons(int port, xid_gamepad_in* gp) {
Gamepad_SetButton(port, CCPAD_ZL, gp->white > 0x7F);
Gamepad_SetButton(port, CCPAD_ZR, gp->black > 0x7F);
Gamepad_SetButton(port, CCPAD_A, gp->a > 0x7F);
Gamepad_SetButton(port, CCPAD_B, gp->b > 0x7F);
Gamepad_SetButton(port, CCPAD_X, gp->x > 0x7F);
Gamepad_SetButton(port, CCPAD_Y, gp->y > 0x7F);
Gamepad_SetButton(port, CCPAD_1, gp->a > 0x7F);
Gamepad_SetButton(port, CCPAD_2, gp->b > 0x7F);
Gamepad_SetButton(port, CCPAD_3, gp->x > 0x7F);
Gamepad_SetButton(port, CCPAD_4, gp->y > 0x7F);
Gamepad_SetButton(port, CCPAD_START, mods & XINPUT_GAMEPAD_START);
Gamepad_SetButton(port, CCPAD_SELECT, mods & XINPUT_GAMEPAD_BACK);

View file

@ -108,10 +108,10 @@ static void HandleButtons(int port, struct controller_data_s* pad) {
Gamepad_SetButton(port, CCPAD_LSTICK, pad->lt > 100);
Gamepad_SetButton(port, CCPAD_RSTICK, pad->rt > 100);
Gamepad_SetButton(port, CCPAD_A, pad->a);
Gamepad_SetButton(port, CCPAD_B, pad->b);
Gamepad_SetButton(port, CCPAD_X, pad->x);
Gamepad_SetButton(port, CCPAD_Y, pad->y);
Gamepad_SetButton(port, CCPAD_1, pad->a);
Gamepad_SetButton(port, CCPAD_2, pad->b);
Gamepad_SetButton(port, CCPAD_3, pad->x);
Gamepad_SetButton(port, CCPAD_4, pad->y);
Gamepad_SetButton(port, CCPAD_START, pad->start);
Gamepad_SetButton(port, CCPAD_SELECT, pad->back);