Added PSP Accept/Cance
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
|
||||
#include "input/input.h"
|
||||
|
||||
// #define INPUT_PSP_GAMEPAD_BUTTON_ACCEPT INPUT_SDL2_GAMEPAD_BUTTON_CUSTOM
|
||||
// #define INPUT_PSP_GAMEPAD_BUTTON_CANCEL INPUT_SDL2_GAMEPAD_BUTTON_CUSTOM
|
||||
|
||||
inputbuttondata_t INPUT_BUTTON_DATA[] = {
|
||||
{ .name = "triangle", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_Y } },
|
||||
{ .name = "cross", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_A } },
|
||||
@@ -21,6 +24,10 @@ inputbuttondata_t INPUT_BUTTON_DATA[] = {
|
||||
{ .name = "l", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_LEFTSHOULDER } },
|
||||
{ .name = "r", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER } },
|
||||
|
||||
// Refer to systempsp.c for some extra info.
|
||||
{ .name = "accept", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_A } },
|
||||
{ .name = "cancel", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_B } },
|
||||
|
||||
{ .name = "lstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = true } } },
|
||||
{ .name = "lstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = false } } },
|
||||
{ .name = "lstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = true } } },
|
||||
|
||||
@@ -36,7 +36,7 @@ typedef struct {
|
||||
void (*onFailed)(errorret_t error, void *user);
|
||||
|
||||
// Used during disconnecting
|
||||
void *onCompelteUser;
|
||||
void *onCompleteUser;
|
||||
void (*onComplete)(void *user);
|
||||
} networkpsp_t;
|
||||
|
||||
|
||||
@@ -8,4 +8,5 @@
|
||||
#pragma once
|
||||
#include "system/systempsp.h"
|
||||
|
||||
#define systemInitPlatform systemInitPSP
|
||||
#define systemGetActiveDialogTypePlatform systemGetActiveDialogTypePSP
|
||||
@@ -6,10 +6,45 @@
|
||||
*/
|
||||
|
||||
#include "systempsp.h"
|
||||
#include "input/input.h"
|
||||
#include "util/string.h"
|
||||
#include "assert/assert.h"
|
||||
|
||||
errorret_t systemInitPSP() {
|
||||
// Bind ACCEPT and CANCEL binds.
|
||||
inputbuttondata_t *buttonCross, *buttonCircle, *buttonAccept, *buttonCancel;
|
||||
|
||||
inputbuttondata_t *i = INPUT_BUTTON_DATA;
|
||||
while(i->name) {
|
||||
if(stringCompare(i->name, "cross")) {
|
||||
buttonCross = i;
|
||||
} else if(stringCompare(i->name, "circle")) {
|
||||
buttonCircle = i;
|
||||
} else if(stringCompare(i->name, "accept")) {
|
||||
buttonAccept = i;
|
||||
} else if(stringCompare(i->name, "cancel")) {
|
||||
buttonCancel = i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
assertNotNull(buttonCross, "Cross button not found!");
|
||||
assertNotNull(buttonCircle, "Circle button not found!");
|
||||
assertNotNull(buttonAccept, "Accept button not found!");
|
||||
assertNotNull(buttonCancel, "Cancel button not found!");
|
||||
|
||||
if(systemPSPGetCrossButtonSetting() == PSP_UTILITY_ACCEPT_CROSS) {
|
||||
buttonAccept->button.gpButton = buttonCross->button.gpButton;
|
||||
buttonCancel->button.gpButton = buttonCircle->button.gpButton;
|
||||
} else {
|
||||
buttonAccept->button.gpButton = buttonCircle->button.gpButton;
|
||||
buttonCancel->button.gpButton = buttonCross->button.gpButton;
|
||||
}
|
||||
|
||||
errorOk();
|
||||
}
|
||||
|
||||
systemdialogtype_t systemGetActiveDialogTypePSP() {
|
||||
|
||||
|
||||
return SYSTEM_DIALOG_TYPE_NONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,13 @@
|
||||
#include "system/system.h"
|
||||
#include <psputility.h>
|
||||
|
||||
/**
|
||||
* Initializes the PSP system module.
|
||||
*
|
||||
* @return Error code indicating success or failure.
|
||||
*/
|
||||
errorret_t systemInitPSP(void);
|
||||
|
||||
/**
|
||||
* Returns which PSP system dialog is currently open (if any).
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user