added code for dolelf files

This commit is contained in:
naythan 2023-02-07 15:44:16 -06:00
parent a0a24c72de
commit 0150a7863e
7 changed files with 99 additions and 32 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

@ -33,6 +33,9 @@ typedef struct {
/* Filestat */ /* Filestat */
bool isdir; bool isdir;
bool isdol;
bool iself;
bool iswad;
size_t fsize; size_t fsize;
} fatFile; } fatFile;

View File

@ -12,7 +12,7 @@
#define CONSOLE_XCOORD 70 #define CONSOLE_XCOORD 70
#define CONSOLE_YCOORD 118 #define CONSOLE_YCOORD 118
#define CONSOLE_WIDTH 502 #define CONSOLE_WIDTH 502
#define CONSOLE_HEIGHT 320 #define CONSOLE_HEIGHT 300
bool file_exists(const char * filename) bool file_exists(const char * filename)
{ {

View File

@ -28,7 +28,7 @@ static void disable_memory_protection() {
static u32 apply_patch(char *name, const u8 *old, u32 old_size, const u8 *patch, u32 patch_size, u32 patch_offset) { static u32 apply_patch(char *name, const u8 *old, u32 old_size, const u8 *patch, u32 patch_size, u32 patch_offset) {
u8 *ptr_start = (u8*)*((u32*)0x80003134), *ptr_end = (u8*)0x94000000; u8 *ptr_start = (u8*)*((u32*)0x80003134), *ptr_end = (u8*)0x94000000;
u32 found = 0; u32 found = 0;
printf(" Patching %-30s", name); // printf(" Patching %-30s", name);
u8 *location = NULL; u8 *location = NULL;
while (ptr_start < (ptr_end - patch_size)) { while (ptr_start < (ptr_end - patch_size)) {
if (!memcmp(ptr_start, old, old_size)) { if (!memcmp(ptr_start, old, old_size)) {
@ -44,10 +44,10 @@ static u32 apply_patch(char *name, const u8 *old, u32 old_size, const u8 *patch,
} }
ptr_start++; ptr_start++;
} }
if (found) // if (found)
printf(" patched\n"); // printf(" patched\n");
else // else
printf(" not patched\n"); // printf(" not patched\n");
return found; return found;
} }
/* /*

View File

@ -20,6 +20,7 @@
#include <ogc/pad.h> #include <ogc/pad.h>
#include "globals.h" #include "globals.h"
#include "iospatch.h" #include "iospatch.h"
#include "appboot.h"
/* FAT device list */ /* FAT device list */
//static fatDevice fdevList[] = { //static fatDevice fdevList[] = {
@ -29,7 +30,6 @@ fatDevice fdevList[] = {
{ "usb2", "USB 2.0 Mass Storage Device", &__io_wiiums }, { "usb2", "USB 2.0 Mass Storage Device", &__io_wiiums },
{ "gcsda", "SD Gecko (Slot A)", &__io_gcsda }, { "gcsda", "SD Gecko (Slot A)", &__io_gcsda },
{ "gcsdb", "SD Gecko (Slot B)", &__io_gcsdb }, { "gcsdb", "SD Gecko (Slot B)", &__io_gcsdb },
//{ "smb", "SMB share", NULL },
}; };
/* NAND device list */ /* NAND device list */
@ -159,6 +159,9 @@ s32 __Menu_RetrieveList(char *inPath, fatFile **outbuf, u32 *outlen)
{ {
bool addFlag = false; bool addFlag = false;
bool isdir = false; bool isdir = false;
bool isdol = false;
bool iself = false;
bool iswad = false;
size_t fsize = 0; size_t fsize = 0;
snprintf(gFileName, MAX_FILE_PATH_LEN, "%s/%s", inPath, ent->d_name); snprintf(gFileName, MAX_FILE_PATH_LEN, "%s/%s", inPath, ent->d_name);
@ -180,6 +183,19 @@ s32 __Menu_RetrieveList(char *inPath, fatFile **outbuf, u32 *outlen)
{ {
fsize = __GetFileSizeBytes(gFileName); fsize = __GetFileSizeBytes(gFileName);
addFlag = true; addFlag = true;
iswad = true;
}
if(!strcasecmp(ent->d_name+strlen(ent->d_name)-4, ".dol"))
{
fsize = __GetFileSizeBytes(gFileName);
addFlag = true;
isdol = true;
}
if(!strcasecmp(ent->d_name+strlen(ent->d_name)-4, ".elf"))
{
fsize = __GetFileSizeBytes(gFileName);
addFlag = true;
iself = true;
} }
} }
} }
@ -194,7 +210,9 @@ s32 __Menu_RetrieveList(char *inPath, fatFile **outbuf, u32 *outlen)
/* File stats */ /* File stats */
file->isdir = isdir; file->isdir = isdir;
file->fsize = fsize; file->fsize = fsize;
file->isdol = isdol;
file->iself = iself;
file->iswad = iswad;
} }
} }
@ -385,7 +403,7 @@ void Menu_FatDevice(void)
extern bool skipRegionSafetyCheck; extern bool skipRegionSafetyCheck;
skipRegionSafetyCheck = true; skipRegionSafetyCheck = true;
printf("[+] Disabled SM region checks\n"); printf("[+] Disabled SM region checks\n");
sleep(2); sleep(3);
} }
break; break;
} }
@ -408,7 +426,7 @@ void Menu_FatDevice(void)
goto err; goto err;
} else } else
printf(" OK!\n"); printf(" OK!\n");
sleep(2);
return; return;
err: err:
@ -690,8 +708,8 @@ int Menu_FileOperations(fatFile *file, char *inFilePath)
void Menu_WadManage(fatFile *file, char *inFilePath) void Menu_WadManage(fatFile *file, char *inFilePath)
{ {
FILE *fp = NULL; FILE *fp = NULL;
//char filepath[128]; //char filepath[256];
f32 filesize; f32 filesize;
u32 mode = 0; u32 mode = 0;
@ -702,16 +720,28 @@ void Menu_WadManage(fatFile *file, char *inFilePath)
for (;;) { for (;;) {
/* Clear console */ /* Clear console */
Con_Clear(); Con_Clear();
if(file->iswad) {
printf("[+] WAD Filename : %s\n", file->filename); printf("[+] WAD Filename : %s\n", file->filename);
printf(" WAD Filesize : %.2f MB\n\n\n", filesize); printf(" WAD Filesize : %.2f MB\n\n\n", filesize);
printf("[+] Select action: < %s WAD >\n\n", (!mode) ? "Install" : "Uninstall"); printf("[+] Select action: < %s WAD >\n\n", (!mode) ? "Install" : "Uninstall");
printf(" Press LEFT/RIGHT to change selected action.\n\n"); printf(" Press LEFT/RIGHT to change selected action.\n\n");
printf(" Press A to continue.\n");
printf(" Press A to continue.\n"); }
else {
if(file->isdol) {
printf("[+] DOL Filename : %s\n", file->filename);
printf(" DOL Filesize : %.2f MB\n\n\n", filesize);
printf(" Press A to launch DOL.\n");
}
if(file->iself) {
printf("[+] ELF Filename : %s\n", file->filename);
printf(" ELF Filesize : %.2f MB\n\n\n", filesize);
printf(" Press A to launch ELF.\n");
}
}
printf(" Press B to go back to the menu.\n\n"); printf(" Press B to go back to the menu.\n\n");
u32 buttons = WaitButtons(); u32 buttons = WaitButtons();
@ -738,7 +768,7 @@ void Menu_WadManage(fatFile *file, char *inFilePath)
/* Generate filepath */ /* Generate filepath */
// sprintf(filepath, "%s:" WAD_DIRECTORY "/%s", fdev->mount, file->filename); // sprintf(filepath, "%s:" WAD_DIRECTORY "/%s", fdev->mount, file->filename);
sprintf(gTmpFilePath, "%s/%s", inFilePath, file->filename); // wiiNinja sprintf(gTmpFilePath, "%s/%s", inFilePath, file->filename); // wiiNinja
if(file->iswad) {
/* Open WAD */ /* Open WAD */
fp = fopen(gTmpFilePath, "rb"); fp = fopen(gTmpFilePath, "rb");
if (!fp) { if (!fp) {
@ -756,7 +786,15 @@ void Menu_WadManage(fatFile *file, char *inFilePath)
else else
Wad_Uninstall(fp); Wad_Uninstall(fp);
WiiLightControl (WII_LIGHT_OFF); WiiLightControl (WII_LIGHT_OFF);
}
else {
printf("launch dol/elf here \n");
if(LoadApp(inFilePath)) {
LaunchApp();
}
return;
}
out: out:
/* Close file */ /* Close file */
if (fp) if (fp)
@ -852,9 +890,9 @@ getList:
index = cnt-30; index = cnt-30;
else else
index = 0; index = 0;
printf("[+] WAD files on [%s]:\n\n", tmpPath+index); printf("[+] Files on [%s]:\n\n", tmpPath+index);
/* Print entries */ /* Print entries */
for (cnt = start; cnt < fileCnt; cnt++) for (cnt = start; cnt < fileCnt; cnt++)
{ {
@ -872,19 +910,27 @@ getList:
//printf("\t%2s %s (%.2f MB)\n", (cnt == selected) ? ">>" : " ", file->filename, filesize); //printf("\t%2s %s (%.2f MB)\n", (cnt == selected) ? ">>" : " ", file->filename, filesize);
if (file->isdir) // wiiNinja if (file->isdir) // wiiNinja
printf("\t%2s [%s]\n", (cnt == selected) ? ">>" : " ", str); printf("\t%2s [%s]\n", (cnt == selected) ? ">>" : " ", str);
else else {
printf("\t%2s%s%s (%.2f MB)\n", (cnt == selected) ? ">>" : " ", (file->install == 1) ? "+" : ((file->install == 2) ? "-" : " "), str, filesize); if(file->iswad)
printf("\t%2s%s%s (%.2f MB)\n", (cnt == selected) ? ">>" : " ", (file->install == 1) ? "+" : ((file->install == 2) ? "-" : " "), str, filesize);
else
printf("\t%2s %s (%.2f MB)\n", (cnt == selected) ? ">>" : " ", str, filesize);
}
} }
printf("\n"); printf("\n");
fatFile *file = &fileList[selected];
if(file->iswad)
printf("[+] Press A to (un)install."); printf("[+] Press A to (un)install.");
else if(file->isdol || file->iself)
printf("[+] Press A to launch dol/elf.");
else if(file->isdir)
printf("[+] Press A to Enter directory.");
if(gDirLevel>1) if(gDirLevel>1)
printf(" Press B to go up-level DIR.\n"); printf(" Press B to go up-level DIR.\n");
else else
printf(" Press B to select a device.\n"); printf(" Press B to select a device.\n");
printf(" Use +/X and -/Y to (un)mark. Press 1/Z/ZR for delete menu."); if(file->iswad) printf(" Use +/X and -/Y to (un)mark. Press 1/Z/ZR for delete menu.");
/** Controls **/ /** Controls **/
u32 buttons = WaitButtons(); u32 buttons = WaitButtons();
@ -918,7 +964,7 @@ getList:
/* HOME button */ /* HOME button */
if (buttons & WPAD_BUTTON_HOME) if (buttons & WPAD_BUTTON_HOME)
Restart(); Restart();
if(file->iswad) {
/* Plus Button - Leathl */ /* Plus Button - Leathl */
if (buttons & WPAD_BUTTON_PLUS) if (buttons & WPAD_BUTTON_PLUS)
{ {
@ -1031,6 +1077,7 @@ getList:
} }
} }
}
/* 1 Button - Leathl */ /* 1 Button - Leathl */
if (buttons & WPAD_BUTTON_1) if (buttons & WPAD_BUTTON_1)
{ {
@ -1158,8 +1205,6 @@ err:
/* Wait for button */ /* Wait for button */
WaitButtons(); WaitButtons();
} }
void Menu_Loop(void) void Menu_Loop(void)
{ {
u8 iosVersion; u8 iosVersion;

BIN
yawmME/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

19
yawmME/meta.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="1">
<name>yawmME</name>
<version>1.0</version>
<coder>various</coder>
<short_description>Install\Uninstall WADs Launch apps</short_description>
<long_description>Press the "A" key to (un)install WADs or Launch .dol/.elf files .
If no files are selected for batch (un)installation, the normal individual (un)installation menu appears.
If at least one file is selected, the batch (un)installation menu appears.
Press the "+" button to add\remove the selected WAD to the batch installer list
Press the "-" button to add\remove the selected WAD to batch uninstaller list
Press the "1" key to enter the extension menu
A "+" before the name means the WAD will be installed
A "-" before the name means the WAD will be uninstalled</long_description>
<ahb_access/>
</app>