Add proper error message when sd card or payload.elf is missing.

Fix comment
This commit is contained in:
orboditilt 2019-01-13 15:54:44 +01:00
parent d05b631977
commit c0db699b68
3 changed files with 8 additions and 5 deletions

View File

@ -11,6 +11,7 @@ extern "C" {
#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x0102A3B4)
#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x0102B828)
#define OSFatal ((void (*)(char* msg))0x01031618)
#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x0102F160)
#define ADDRESS_OSTitle_main_entry_ptr 0x1005E040
#define ADDRESS_main_entry_hook 0x0101c56c

View File

@ -29,16 +29,18 @@ static int32_t LoadFileToMem(private_data_t *private_data, const char *filepath,
int32_t status = private_data->FSGetMountSource(pClient, pCmd, 0, tempPath, -1);
if (status != 0) {
OSFatal("FSGetMountSource failed.");
OSFatal("FSGetMountSource failed. Please insert a FAT32 formatted sd card.");
}
status = private_data->FSMount(pClient, pCmd, tempPath, mountPath, FS_MAX_MOUNTPATH_SIZE, -1);
if(status != 0) {
OSFatal("SD mount failed.");
OSFatal("SD mount failed. Please insert a FAT32 formatted sd card.");
}
status = private_data->FSOpenFile(pClient, pCmd, filepath, "r", &iFd, -1);
if(status != 0) {
OSFatal("FSOpenFile failed.");
char buf[0x255];
__os_snprintf(buf,0x254,"FSOpenFile failed. File missing %s",filepath);
OSFatal(buf);
}
FSStat stat;

View File

@ -9,14 +9,14 @@ static void SCSetupIBAT4DBAT5() {
asm volatile("eieio; isync");
// Give our and the kernel full execution rights.
// VA: 00000000..00800000 PA: 30000000..30800000 with r/w for user and supervisor
// 00800000-01000000 => 30800000-31000000 (read/write, user/supervisor)
unsigned int ibat4u = 0x008000FF;
unsigned int ibat4l = 0x30800012;
asm volatile("mtspr 560, %0" : : "r" (ibat4u));
asm volatile("mtspr 561, %0" : : "r" (ibat4l));
// Give our and the kernel full data access rights.
// VA: 00000000..00800000 PA: 30000000..30800000 with r/w for user and supervisor
// 00800000-01000000 => 30800000-31000000 (read/write, user/supervisor)
unsigned int dbat5u = ibat4u;
unsigned int dbat5l = ibat4l;
asm volatile("mtspr 570, %0" : : "r" (dbat5u));