mirror of
https://github.com/modmii/YAWM-ModMii-Edition.git
synced 2024-11-24 17:16:54 +01:00
File management improvements
This commit is contained in:
parent
7d13d45861
commit
2d6c458083
@ -32,6 +32,7 @@ u32 appIos = 0;
|
||||
|
||||
#define MEM2PROT 0x0D8B420A
|
||||
#define ESMODULESTART (u16*)0x939F0000
|
||||
#define MB_SIZE 1048576.0
|
||||
|
||||
static const u16 ticket[] = {
|
||||
0x685B, // ldr r3,[r3,#4] ; get TMD pointer
|
||||
@ -64,7 +65,7 @@ static bool patchahbprot(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool LoadApp(const char* path)
|
||||
bool LoadApp(const char* path, const char* filename)
|
||||
{
|
||||
Con_Clear();
|
||||
|
||||
@ -88,6 +89,8 @@ bool LoadApp(const char* path)
|
||||
*(vu32*)0x91000000 = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
// This causes crashes when XML nodes are empty
|
||||
struct MetaData* appData = LoadMetaData(currentPath);
|
||||
|
||||
if (appData)
|
||||
@ -100,19 +103,14 @@ bool LoadApp(const char* path)
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
*/
|
||||
|
||||
snprintf(currentPath, sizeof(currentPath), "%s/boot.dol", path);
|
||||
snprintf(currentPath, sizeof(currentPath), "%s/%s", path, filename);
|
||||
|
||||
FILE* f = fopen(currentPath, "rb");
|
||||
|
||||
if (f == NULL)
|
||||
{
|
||||
snprintf(currentPath, sizeof(currentPath), "%s/boot.elf", path);
|
||||
f = fopen(currentPath, "rb");
|
||||
|
||||
if (f == NULL)
|
||||
return false;
|
||||
}
|
||||
|
||||
printf("-> Load: %s\n", currentPath);
|
||||
|
||||
@ -135,7 +133,8 @@ bool LoadApp(const char* path)
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("-> App size: 0x%X\n\n", appSize);
|
||||
f32 filesize = (appSize / MB_SIZE);
|
||||
printf("-> App size: %.2f MB\n\n", filesize);
|
||||
}
|
||||
|
||||
DCFlushRange(appBuffer, appSize);
|
||||
|
@ -16,7 +16,7 @@ typedef struct _dolhdr
|
||||
u32 entrypoint;
|
||||
} dolhdr;
|
||||
|
||||
bool LoadApp(const char* path);
|
||||
bool LoadApp(const char* path, const char* filename);
|
||||
u8* GetApp(u32* size);
|
||||
void LaunchApp(void);
|
||||
void SetIos(int ios);
|
||||
|
@ -664,11 +664,23 @@ int Menu_FileOperations(fatFile *file, char *inFilePath)
|
||||
{
|
||||
Con_Clear();
|
||||
|
||||
if(file->iswad) {
|
||||
printf("[+] WAD Filename : %s\n", file->filename);
|
||||
printf(" WAD Filesize : %.2f MB\n\n\n", filesize);
|
||||
|
||||
|
||||
printf("[+] Select action: < %s WAD >\n\n", "Delete"); //There's yet nothing else than delete
|
||||
}
|
||||
else if(file->isdol) {
|
||||
printf("[+] DOL Filename : %s\n", file->filename);
|
||||
printf(" DOL Filesize : %.2f MB\n\n\n", filesize);
|
||||
printf("[+] Select action: < %s DOL >\n\n", "Delete");
|
||||
}
|
||||
else if(file->iself) {
|
||||
printf("[+] ELF Filename : %s\n", file->filename);
|
||||
printf(" ELF Filesize : %.2f MB\n\n\n", filesize);
|
||||
printf("[+] Select action: < %s ELF >\n\n", "Delete");
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
printf(" Press LEFT/RIGHT to change selected action.\n\n");
|
||||
|
||||
@ -790,7 +802,7 @@ void Menu_WadManage(fatFile *file, char *inFilePath)
|
||||
else {
|
||||
printf("launch dol/elf here \n");
|
||||
|
||||
if(LoadApp(inFilePath)) {
|
||||
if(LoadApp(inFilePath, file->filename)) {
|
||||
LaunchApp();
|
||||
}
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user