mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-26 13:14:18 +01:00
71adda33e0
*Added HomebrewFiles Class NOTE 1: In settings/custompaths you can change the HomebrewPath and the standard is SD:/apps/. Our browser searches for EVERY .dol and .elf file in the directory even if its not called boot.dol. NOTE 2: Giantpune and me tested the homebrewbooting and it worked for every homebrew we tested except our own application. (a bit ironic) NOTE 3: Right now the information on the Buttons is the path to the Homebrew. This and the BootPrompt will be replaced with the XML information inside the path of the homebrew later but for now i am taking a break NOTE 4: Right now the button to the HomebrewMenu is next to WiiMenuButton and has the same image as the listgamebrowser. I didnt have any images so i took what i had and cyrex will change the images when he is back. Also there will be a no icon image added later.
56 lines
1.5 KiB
C
56 lines
1.5 KiB
C
#include <malloc.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <ogc/machine/processor.h>
|
|
#include <gccore.h>
|
|
#include <dirent.h>
|
|
#include <string.h>
|
|
|
|
#include "dolloader.h"
|
|
|
|
typedef struct _dolheader {
|
|
u32 text_pos[7];
|
|
u32 data_pos[11];
|
|
u32 text_start[7];
|
|
u32 data_start[11];
|
|
u32 text_size[7];
|
|
u32 data_size[11];
|
|
u32 bss_start;
|
|
u32 bss_size;
|
|
u32 entry_point;
|
|
} dolheader;
|
|
|
|
u32 load_dol(void *dolstart, struct __argv *argv) {
|
|
u32 i;
|
|
dolheader *dolfile;
|
|
|
|
if (dolstart) {
|
|
dolfile = (dolheader *) dolstart;
|
|
for (i = 0; i < 7; i++) {
|
|
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100)) continue;
|
|
VIDEO_WaitVSync();
|
|
ICInvalidateRange ((void *) dolfile->text_start[i],dolfile->text_size[i]);
|
|
memmove ((void *) dolfile->text_start[i],dolstart+dolfile->text_pos[i],dolfile->text_size[i]);
|
|
}
|
|
|
|
for(i = 0; i < 11; i++) {
|
|
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100)) continue;
|
|
VIDEO_WaitVSync();
|
|
memmove ((void *) dolfile->data_start[i],dolstart+dolfile->data_pos[i],dolfile->data_size[i]);
|
|
DCFlushRangeNoSync ((void *) dolfile->data_start[i],dolfile->data_size[i]);
|
|
}
|
|
|
|
memset ((void *) dolfile->bss_start, 0, dolfile->bss_size);
|
|
DCFlushRange((void *) dolfile->bss_start, dolfile->bss_size);
|
|
|
|
if (argv && argv->argvMagic == ARGV_MAGIC) {
|
|
void *new_argv = (void *)(dolfile->entry_point + 8);
|
|
memmove(new_argv, argv, sizeof(*argv));
|
|
DCFlushRange(new_argv, sizeof(*argv));
|
|
}
|
|
|
|
return dolfile->entry_point;
|
|
}
|
|
return 0;
|
|
}
|