mirror of
https://github.com/modmii/YAWM-ModMii-Edition.git
synced 2024-11-25 01:26:53 +01:00
Correctly boot ELF files
This commit is contained in:
parent
2d6c458083
commit
5f2414755e
@ -14,8 +14,6 @@
|
||||
#include "iospatch.h"
|
||||
#include "video.h"
|
||||
|
||||
extern void __exception_closeall();
|
||||
|
||||
struct __argv arguments;
|
||||
char* m_argv[256];
|
||||
|
||||
@ -179,11 +177,6 @@ void LaunchApp(void)
|
||||
|
||||
printf("-> And we're outta here!\n");
|
||||
|
||||
*(vu32*)0x800000F8 = 0x0E7BE2C0; // Bus Speed
|
||||
*(vu32*)0x800000FC = 0x2B73A840; // CPU Speed
|
||||
|
||||
//SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
|
||||
__exception_closeall();
|
||||
entry();
|
||||
|
||||
printf("--> Well.. this shouldn't happen\n");
|
||||
|
@ -5,10 +5,11 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <ogc/machine/processor.h>
|
||||
|
||||
#include "loader.h"
|
||||
|
||||
extern void __exception_setreload(int t);
|
||||
extern void __exception_closeall();
|
||||
static void* xfb = NULL;
|
||||
static GXRModeObj* rmode = NULL;
|
||||
|
||||
@ -36,6 +37,16 @@ void VideoInit(void)
|
||||
printf("\x1b[2;0H");
|
||||
}
|
||||
|
||||
bool IsDollZ(const u8* buffer)
|
||||
{
|
||||
return (buffer[0x100] == 0x3C);
|
||||
}
|
||||
|
||||
bool IsSpecialELF(const u8* buffer)
|
||||
{
|
||||
return (read32((u32)buffer) == 0x7F454C46 && buffer[0x24] == 0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
VideoInit();
|
||||
@ -66,6 +77,8 @@ int main(void)
|
||||
DCFlushRange(&execPtr[0x20], 1);
|
||||
}
|
||||
|
||||
if (!IsDollZ(buffer) && !IsSpecialELF(buffer))
|
||||
{
|
||||
u32 argumentsSize = *(vu32*)0x91000000;
|
||||
if (argumentsSize > 0)
|
||||
{
|
||||
@ -82,7 +95,13 @@ int main(void)
|
||||
DCFlushRange(&ptr[2], 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
|
||||
u32 level = IRQ_Disable();
|
||||
__exception_closeall();
|
||||
entry();
|
||||
IRQ_Restore(level);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user