Fix PSP memory stick availability check on real hardware
sceIoGetstat on a bare device root ("ms0:/") returns EINVAL on real
PSP hardware even when a memory stick is present - confirmed via a
diagnostic print during hardware testing. Switched to sceIoDopen/
sceIoDclose, the SDK's own documented way to probe a device root,
which real hardware handles correctly.
Also adds a temporary unconditional settings write once a save device
is selected, to confirm the write path itself works on hardware now
that availability detection is fixed.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -38,13 +38,18 @@ void saveDevicePSPCheckAvailability(savedevice_t *device) {
|
||||
|
||||
// Confirm the memory stick is actually reachable - the real save/load
|
||||
// (via sceUtilitySavedata) only reports failure once a save/load is
|
||||
// attempted, so this is checked separately up front.
|
||||
SceIoStat stat;
|
||||
if(sceIoGetstat(SAVE_DEVICE_PSP_ROOT, &stat) < 0) {
|
||||
// attempted, so this is checked separately up front. sceIoGetstat on a
|
||||
// bare device root (e.g. "ms0:/") is unreliable on real hardware -
|
||||
// confirmed returning EINVAL there even with a memory stick present -
|
||||
// so open/close the root directory instead, which is the SDK's own
|
||||
// documented way to probe a device (see sceIoDopen's doc comment).
|
||||
SceUID dir = sceIoDopen(SAVE_DEVICE_PSP_ROOT);
|
||||
if(dir < 0) {
|
||||
device->state = SAVE_DEVICE_STATE_UNAVAILABLE;
|
||||
device->reasonKey = "save.psp.no_memory_stick";
|
||||
return saveDeviceFireCallback(device);
|
||||
}
|
||||
sceIoDclose(dir);
|
||||
|
||||
device->state = SAVE_DEVICE_STATE_AVAILABLE;
|
||||
device->reasonKey = NULL;
|
||||
|
||||
Reference in New Issue
Block a user