Default Wii saves to SD card, store saves next to dusk.dsk/EBOOT.PBP
Wii NAND save storage is blocked by Dolphin's IOS ticket-rights check for homebrew (documented earlier this session as a known, non-code limitation), so Wii now defaults DUSK_SAVE_WII_METHOD to SD instead of NAND. Also: asset_t gains ASSET.baseDirectory, populated by each platform's asset loader with the real directory dusk.dsk was opened from (or, on PSP, the directory EBOOT.PBP itself lives in, since dusk.dsk is embedded inside it). Wii SD and PSP now write their single combined save file directly into that directory instead of a separate hardcoded path, and no longer need to create it (it's already known to exist). Linux now uses a `saves/` subdirectory of that same directory instead of ~/.dusk/saves, since it keeps multiple files (settings + one per slot). Wii NAND and GameCube/Wii memory-card storage are unaffected - neither has a real filesystem-path concept this applies to. Built and verified on Linux, PSP (Docker), GameCube (Docker) and Wii (Docker) - confirmed via the compiler invocation that Wii now compiles with DUSK_SAVE_WII_METHOD_SD. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -83,6 +83,13 @@ errorret_t assetInitLinux(void) {
|
||||
continue;
|
||||
}
|
||||
opened = true;
|
||||
|
||||
// Save devices with a real filesystem path (Linux) reuse this as
|
||||
// their base directory - see ASSET.baseDirectory's own comment.
|
||||
stringCopy(ASSET.baseDirectory, searchPath, ASSET_BASE_DIRECTORY_MAX);
|
||||
char_t *lastSlash = stringFindLastChar(ASSET.baseDirectory, '/');
|
||||
if(lastSlash != NULL) *lastSlash = '\0';
|
||||
|
||||
break;// Found!
|
||||
} while(*(++path) != NULL);
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#include "save/saveslot.h"
|
||||
#include "save/savesettings.h"
|
||||
#include "save/savejson.h"
|
||||
#include "asset/asset.h"
|
||||
#include "assert/assert.h"
|
||||
#include "util/mkdirp.h"
|
||||
#include "util/string.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
errorret_t saveDeviceLinuxInit(savedevice_t *device) {
|
||||
assertNotNull(device, "device cannot be null");
|
||||
@@ -37,17 +37,15 @@ void saveDeviceLinuxCheckAvailability(savedevice_t *device) {
|
||||
"Device state incorrect?"
|
||||
);
|
||||
|
||||
// Resolve the save directory.
|
||||
// Resolve the save directory - can't actually fail (just a
|
||||
// stringFormat), unlike when this derived from $HOME, but this function
|
||||
// returns void (via saveDeviceFireCallback below) rather than
|
||||
// errorret_t, so there's no return-early errorChain to use here.
|
||||
char_t directory[SAVE_DEVICE_LINUX_PATH_MAX];
|
||||
errorret_t directoryResult = saveDeviceLinuxGetDirectory(
|
||||
directory, sizeof(directory)
|
||||
);
|
||||
if(errorIsNotOk(directoryResult)) {
|
||||
errorCatch(errorPrint(directoryResult));
|
||||
device->state = SAVE_DEVICE_STATE_UNAVAILABLE;
|
||||
device->reasonKey = "save.linux.no_home";
|
||||
return saveDeviceFireCallback(device);
|
||||
}
|
||||
if(errorIsNotOk(directoryResult)) errorCatch(errorPrint(directoryResult));
|
||||
|
||||
// Mkdirp the save directory.
|
||||
int mkdirpResult = mkdirp(directory, 0700);
|
||||
@@ -66,10 +64,10 @@ void saveDeviceLinuxCheckAvailability(savedevice_t *device) {
|
||||
errorret_t saveDeviceLinuxGetDirectory(char_t *dest, const size_t destSize) {
|
||||
assertNotNull(dest, "dest cannot be null");
|
||||
|
||||
const char_t *home = getenv("HOME");
|
||||
if(home == NULL) errorThrow("HOME environment variable is not set");
|
||||
|
||||
stringFormat(dest, destSize, "%s/%s", home, SAVE_DEVICE_LINUX_DIRECTORY_NAME);
|
||||
stringFormat(
|
||||
dest, destSize, "%s/%s",
|
||||
ASSET.baseDirectory, SAVE_DEVICE_LINUX_SAVES_SUBDIR_NAME
|
||||
);
|
||||
errorOk();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
#pragma once
|
||||
#include "error/error.h"
|
||||
|
||||
#define SAVE_DEVICE_LINUX_DIRECTORY_NAME ".dusk/saves"
|
||||
// Subdirectory of ASSET.baseDirectory (the directory dusk.dsk was found
|
||||
// in - see its own comment) saves are kept in - a subdirectory, unlike
|
||||
// the other platforms' single combined-blob file, since Linux keeps
|
||||
// settings and each save slot as their own separate file.
|
||||
#define SAVE_DEVICE_LINUX_SAVES_SUBDIR_NAME "saves"
|
||||
#define SAVE_DEVICE_LINUX_SETTINGS_FILENAME "settings.json"
|
||||
#define SAVE_DEVICE_LINUX_SLOT_FILENAME_FORMAT "slot%u.json"
|
||||
#define SAVE_DEVICE_LINUX_PATH_MAX FILENAME_MAX
|
||||
|
||||
Reference in New Issue
Block a user