Strip legacy save/settings systems for a unified savemanager rewrite; split uielement list out of uielement.c

Removes the per-platform save/savestream/autosave implementations, the settings UI frames, and the autosave overlay, replacing them with a savemanager.c/h + savefile.h/savedevice.h scaffold to build the new save system on top of. Also separates the concrete UI_ELEMENTS registration into uielementlist.h/.c so uielement.c only holds the generic per-element lifecycle logic.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-14 12:56:02 -05:00
parent 6c8e4d5cbd
commit 33f50a2c69
91 changed files with 402 additions and 5074 deletions
+1 -2
View File
@@ -6,7 +6,6 @@
*/
#include "input/input.h"
#include "save/save.h"
inputbuttondata_t INPUT_BUTTON_DATA[] = {
{ .name = "triangle", {
@@ -84,5 +83,5 @@ inputbuttondata_t INPUT_BUTTON_DATA[] = {
};
float_t inputGetDeadzoneSDL2(const inputbutton_t button) {
return saveGetMeta()->deadzone;
return 0.2f;
}
-11
View File
@@ -1,11 +0,0 @@
# Copyright (c) 2026 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Sources
target_sources(${DUSK_LIBRARY_TARGET_NAME}
PUBLIC
savevita.c
savestreamvita.c
)
-30
View File
@@ -1,30 +0,0 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "save/savevita.h"
#include "save/savestreamvita.h"
typedef savevita_t saveplatform_t;
typedef savestreamvita_t saveplatformstream_t;
#define saveInitPlatform saveInitVita
#define saveDisposePlatform saveDisposeVita
#define saveDeletePlatform saveDeleteVita
#define saveStreamOpenReadPlatform(stream, slot) \
saveStreamOpenReadVita(&(stream)->platform, &(stream)->found, slot)
#define saveStreamOpenWritePlatform(stream, slot) \
saveStreamOpenWriteVita(&(stream)->platform, slot)
#define saveStreamClosePlatform(stream) \
saveStreamCloseVita(&(stream)->platform)
#define saveStreamReadBytesPlatform(stream, buf, len) \
saveStreamReadBytesVita(&(stream)->platform, buf, len)
#define saveStreamWriteBytesPlatform(stream, buf, len) \
saveStreamWriteBytesVita(&(stream)->platform, buf, len)
#define saveStreamSeekPlatform(stream, pos) \
saveStreamSeekVita(&(stream)->platform, pos)
-77
View File
@@ -1,77 +0,0 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "save/save.h"
#include "save/savestreamvita.h"
errorret_t saveStreamOpenReadVita(
savestreamvita_t *p, bool_t *found, const uint8_t slot
) {
char_t path[SAVE_VITA_PATH_MAX];
snprintf(path, SAVE_VITA_PATH_MAX, SAVE_VITA_FILE_FORMAT,
SAVE_VITA_TITLE_ID, (uint32_t)slot
);
p->fd = sceIoOpen(path, SCE_O_RDONLY, 0);
*found = (p->fd >= 0);
errorOk();
}
errorret_t saveStreamOpenWriteVita(savestreamvita_t *p, const uint8_t slot) {
char_t dir[SAVE_VITA_PATH_MAX];
snprintf(dir, SAVE_VITA_PATH_MAX, SAVE_VITA_DIR_FORMAT,
SAVE_VITA_TITLE_ID, (uint32_t)slot
);
sceIoMkdir(dir, 0777);
char_t path[SAVE_VITA_PATH_MAX];
snprintf(path, SAVE_VITA_PATH_MAX, SAVE_VITA_FILE_FORMAT,
SAVE_VITA_TITLE_ID, (uint32_t)slot
);
p->fd = sceIoOpen(path, SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 0777);
if(p->fd < 0) {
errorThrow(
"Failed to open Vita save file for writing: slot %u", (uint32_t)slot
);
}
errorOk();
}
void saveStreamCloseVita(savestreamvita_t *p) {
if(p->fd >= 0) {
sceIoClose(p->fd);
p->fd = -1;
}
}
errorret_t saveStreamReadBytesVita(
savestreamvita_t *p, void *buf, const size_t len
) {
int32_t read = sceIoRead(p->fd, buf, (SceSize)len);
if(read != (int32_t)len) {
errorThrow("Unexpected end of Vita save file");
}
errorOk();
}
errorret_t saveStreamWriteBytesVita(
savestreamvita_t *p, const void *buf, const size_t len
) {
int32_t written = sceIoWrite(p->fd, buf, (SceSize)len);
if(written != (int32_t)len) {
errorThrow("Failed to write Vita save data");
}
errorOk();
}
errorret_t saveStreamSeekVita(savestreamvita_t *p, const size_t pos) {
if(sceIoLseek(p->fd, (SceOff)pos, SCE_SEEK_SET) < 0) {
errorThrow("Failed to seek in Vita save file");
}
errorOk();
}
-78
View File
@@ -1,78 +0,0 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "error/error.h"
#include <psp2/io/fcntl.h>
#include <psp2/io/stat.h>
#include <stddef.h>
typedef struct {
SceUID fd;
} savestreamvita_t;
/**
* Opens a Vita save data file for reading.
*
* @param p Stream to initialize.
* @param found Set to true if the file exists, false if it does not.
* @param slot Save slot index.
* @return An error if the open fails for a reason other than missing file.
*/
errorret_t saveStreamOpenReadVita(
savestreamvita_t *p, bool_t *found, const uint8_t slot
);
/**
* Opens a Vita save data file for writing, creating or truncating it.
* Creates the save data directory if it does not already exist.
*
* @param p Stream to initialize.
* @param slot Save slot index.
* @return An error if the file cannot be opened for writing.
*/
errorret_t saveStreamOpenWriteVita(savestreamvita_t *p, const uint8_t slot);
/**
* Closes the file descriptor held by the stream.
*
* @param p Stream to close.
*/
void saveStreamCloseVita(savestreamvita_t *p);
/**
* Reads len bytes from the stream into buf.
*
* @param p Active stream.
* @param buf Destination buffer.
* @param len Number of bytes to read.
* @return An error if fewer than len bytes are available.
*/
errorret_t saveStreamReadBytesVita(
savestreamvita_t *p, void *buf, const size_t len
);
/**
* Writes len bytes from buf into the stream.
*
* @param p Active stream.
* @param buf Source buffer.
* @param len Number of bytes to write.
* @return An error if the write fails.
*/
errorret_t saveStreamWriteBytesVita(
savestreamvita_t *p, const void *buf, const size_t len
);
/**
* Seeks to an absolute byte position within the stream.
*
* @param p Active stream.
* @param pos Target byte offset from the start of the file.
* @return An error if the seek fails.
*/
errorret_t saveStreamSeekVita(savestreamvita_t *p, const size_t pos);