Fix compiling with latest devkitppc

This commit is contained in:
Maschell 2023-11-17 17:08:35 +01:00
parent 86c5072674
commit c678f57156
5 changed files with 31 additions and 10 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ code550.bin
*.cbp
main_hook.h
*.layout
main_hook_elf*

3
Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM ghcr.io/wiiu-env/devkitppc:20231112
WORKDIR project

View File

@ -1,3 +1,5 @@
include $(DEVKITPPC)/base_tools
PATH := $(DEVKITPPC)/bin:$(PATH)
PREFIX ?= powerpc-eabi-
CC = $(PREFIX)gcc
@ -12,14 +14,14 @@ project := .
root := $(CURDIR)
build := $(root)/bin
sd_loader_elf := main_hook/main_hook.elf
main_hook_elf := main_hook/main_hook.elf
all: clean setup main550
main_hook.h: $(sd_loader_elf)
xxd -i $< | sed "s/unsigned/static const unsigned/g;s/loader/loader/g;s/build_//g" > $@
$(sd_loader_elf):
main_hook_elf.bin: $(main_hook_elf)
@$(bin2o)
$(main_hook_elf):
make -C main_hook
setup:
@ -28,7 +30,7 @@ setup:
main550:
make main FIRMWARE=550
main: main_hook.h
main: main_hook_elf.bin
$(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/launcher.c
$(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/gx2sploit/kexploit.c
$(AS) $(ASFLAGS) -DVER=$(FIRMWARE) -c $(project)/gx2sploit/syscalls.S
@ -40,6 +42,6 @@ main: main_hook.h
clean:
rm -rf $(build)
rm -rf main_hook.h
rm -rf code550.h
rm -rf code550.h
rm -rf main_hook_elf.h
make clean -C main_hook

View File

@ -43,6 +43,21 @@ DEVKITPPC=/opt/devkitpro/devkitPPC
The command `make` should produce a `code550.bin`, meant to be used with
[JsTypeHax](https://github.com/wiiu-env/JsTypeHax)
## Building using the Dockerfile
It's possible to use a docker image for building. This way you don't need anything installed on your host system.
```
# Build docker image (only needed once)
docker build . -t jstypehax-payload-builder
# make
docker run -it --rm -v ${PWD}:/project jstypehax-payload-builder make
# make clean
docker run -it --rm -v ${PWD}:/project jstypehax-payload-builder make clean
```
## Technical details
This payload:

View File

@ -2,7 +2,7 @@
#include "elf_abi.h"
#include "gx2sploit/kexploit.h"
#include "structs.h"
#include "main_hook.h"
#include "main_hook_elf.h"
#include "common.h"
/* Install functions */
@ -84,7 +84,7 @@ static void thread_callback(int argc, void *argv) {
private_data.coreinit_handle = coreinit_handle;
private_data.memset = p_memset;
private_data.data_elf = (unsigned char *) main_hook_main_hook_elf; // use this address as temporary to load the elf
private_data.data_elf = (unsigned char *) main_hook_elf; // use this address as temporary to load the elf
OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &functionPointer);
private_data.MEMAllocFromDefaultHeapEx = (void*(*)(unsigned int, unsigned int))*functionPointer;