Files
dusk/src/duskpsp/asset/assetpsp.c

40 lines
1.2 KiB
C

/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "asset/asset.h"
#include "engine/engine.h"
#include "assert/assert.h"
#include "util/string.h"
errorret_t assetInitPSP(void) {
assertTrue(ENGINE.argc >= 1, "PSP requires launch argument.");
// PSP is given either the prx OR the PBP file.
// In the format of "ms0:/PSP/GAME/DUSK/EBOOT.PBP" or "host0:/Dusk.prx"
// IF the file is the PBP file, we are loading directly on the PSP itself.
// IF the file is the .prx then we are debugging and fopen will return
// relative filepaths correctly, e.g. host0:/dusk.dsk will be on host.
// Originally I was going to allow host to read the .dsk directly but then
// I'd have to maintain two file implementations.
const char_t *pbpPath;
if(stringEndsWithCaseInsensitive(ENGINE.argv[0], ASSET_PSP_EXTENSION_PBP)) {
pbpPath = ENGINE.argv[0];
} else {
// In Debugging this would be next to host0:/Dusk.prx
pbpPath = "./EBOOT.PBP";
}
errorChain(assetInitPBP(pbpPath));
errorOk();
}
errorret_t assetDisposePSP(void) {
errorChain(assetDisposePBP());
errorOk();
}