From c678f57156af09255810f7c5b2e58ae28a8f0b5f Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 17 Nov 2023 17:08:35 +0100 Subject: [PATCH] Fix compiling with latest devkitppc --- .gitignore | 1 + Dockerfile | 3 +++ Makefile | 18 ++++++++++-------- README.md | 15 +++++++++++++++ launcher.c | 4 ++-- 5 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 Dockerfile diff --git a/.gitignore b/.gitignore index aef5621..7d6f3e8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ code550.bin *.cbp main_hook.h *.layout +main_hook_elf* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1b1e606 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM ghcr.io/wiiu-env/devkitppc:20231112 + +WORKDIR project \ No newline at end of file diff --git a/Makefile b/Makefile index ec38a74..e3e2a56 100644 --- a/Makefile +++ b/Makefile @@ -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 \ No newline at end of file diff --git a/README.md b/README.md index 24c1d6b..db95242 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/launcher.c b/launcher.c index 7ebee19..5e891ee 100644 --- a/launcher.c +++ b/launcher.c @@ -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;