Skip to content

Commit

Permalink
Use my DOL relocation stub
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Jul 17, 2022
1 parent 4e6bf6d commit 6170f76
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 488 deletions.
20 changes: 12 additions & 8 deletions source/main.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <sdcard/gcsd.h>
#include <string.h>
#include <malloc.h>
#include <unistd.h>
#include <ogc/lwp_watchdog.h>
#include <fcntl.h>
#include "sidestep.h"
#include "ffshim.h"
#include "fatfs/ff.h"

#include "stub.h"
#define STUB_ADDR 0x80001000
#define STUB_STACK 0x80003000

u8 *dol = NULL;

void dol_alloc(int size)
Expand All @@ -24,12 +28,6 @@ void dol_alloc(int size)
return;
}

if (size >= (AR_GetSize() - (64 * 1024)))
{
kprintf("DOL too big\n");
return;
}

dol = (u8 *) memalign(32, size);

if (!dol)
Expand Down Expand Up @@ -223,7 +221,13 @@ int main()
load:
if (dol)
{
DOLtoARAM(dol, 0, NULL);
memcpy((void *) STUB_ADDR, stub, stub_size);
DCStoreRange((void *) STUB_ADDR, stub_size);

SYS_ResetSystem(SYS_SHUTDOWN, 0, FALSE);
SYS_SwitchFiber((intptr_t) dol, 0,
(intptr_t) NULL, 0,
STUB_ADDR, STUB_STACK);
}

// If we reach here, all attempts to load a DOL failed
Expand Down
324 changes: 0 additions & 324 deletions source/sidestep.c

This file was deleted.

Loading

0 comments on commit 6170f76

Please sign in to comment.