aa0180571e
Renames savefile_t to saveslot_t and folds last session's standalone settings.h/.c module back in as savemeta_t, so there's one save system (SAVE.slots[] + SAVE.meta) instead of two parallel ones - while letting each platform pick its own physical format for the two concepts: - Linux now writes human-editable JSON (slot0.json, settings.json, ...) via yyjson's mutable writer API, so players can hand-fix a bad setting. - PSP folds meta into the same sceUtilitySavedata binary payload as its one save slot (SAVE_SLOT_COUNT_MAX=1 there - a future save picker will let players manage multiple named saves via the OS's own browser). - GameCube consolidates the 3 per-slot memory card files and the separate settings file into one combined card file. Also fixes two bugs surfaced while building this: the CRC finalize step seeked to a hardcoded offset (only safe for one section per file, breaks once meta+slots share a buffer), and save.c's async/sync dispatch left an unconditional fallback call that doesn't exist on PSP-only platforms. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
99 lines
3.3 KiB
C
99 lines
3.3 KiB
C
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "input/input.h"
|
|
#include "save/save.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 } },
|
|
{ .name = "circle", {
|
|
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
|
.gpButton = SDL_CONTROLLER_BUTTON_B } },
|
|
{ .name = "square", {
|
|
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
|
.gpButton = SDL_CONTROLLER_BUTTON_X } },
|
|
{ .name = "start", {
|
|
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
|
.gpButton = SDL_CONTROLLER_BUTTON_START } },
|
|
{ .name = "select", {
|
|
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
|
.gpButton = SDL_CONTROLLER_BUTTON_BACK } },
|
|
{ .name = "up", {
|
|
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
|
.gpButton = SDL_CONTROLLER_BUTTON_DPAD_UP } },
|
|
{ .name = "down", {
|
|
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
|
.gpButton = SDL_CONTROLLER_BUTTON_DPAD_DOWN } },
|
|
{ .name = "left", {
|
|
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
|
.gpButton = SDL_CONTROLLER_BUTTON_DPAD_LEFT } },
|
|
{ .name = "right", {
|
|
.type = INPUT_BUTTON_TYPE_GAMEPAD,
|
|
.gpButton = SDL_CONTROLLER_BUTTON_DPAD_RIGHT } },
|
|
{ .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 } } },
|
|
{ .name = "lstick_left", {
|
|
.type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS,
|
|
.gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = false } } },
|
|
|
|
{ .name = NULL }
|
|
};
|
|
|
|
errorret_t inputInitPSP(void) {
|
|
#define X(buttonName, buttonAction) \
|
|
inputBind(inputButtonGetByName(buttonName), buttonAction);
|
|
X("up", INPUT_ACTION_UP);
|
|
X("down", INPUT_ACTION_DOWN);
|
|
X("left", INPUT_ACTION_LEFT);
|
|
X("right", INPUT_ACTION_RIGHT);
|
|
X("accept", INPUT_ACTION_ACCEPT);
|
|
X("cancel", INPUT_ACTION_CANCEL);
|
|
X("triangle", INPUT_ACTION_CONSOLE);
|
|
X("select", INPUT_ACTION_RAGEQUIT);
|
|
X("start", INPUT_ACTION_PAUSE);
|
|
X("lstick_up", INPUT_ACTION_UP);
|
|
X("lstick_down", INPUT_ACTION_DOWN);
|
|
X("lstick_left", INPUT_ACTION_LEFT);
|
|
X("lstick_right", INPUT_ACTION_RIGHT);
|
|
#undef X
|
|
|
|
errorOk();
|
|
}
|
|
|
|
float_t inputGetDeadzoneSDL2(const inputbutton_t button) {
|
|
return saveGetMeta()->deadzone;
|
|
} |