diff --git a/.envrc b/.envrc index 6a4409c..58d95be 100644 --- a/.envrc +++ b/.envrc @@ -2,4 +2,7 @@ if ! has box_direnv_version || ! box_direnv_version 0.1.0; then source_url "https://raw.githubusercontent.com/thesola10/box-direnv/0.1.0/direnvrc" "sha256-pznp4/w7UzNAqreaLuGgq4/CTFjMedC376xnIWr5s+U=" fi +source .env +export ARKROOT + use distrobox diff --git a/Makefile b/Makefile index d4cc1bb..c5e8c6e 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,33 @@ -TARGET = xdelta_umd -OBJS = main.o -LIBS = -CFLAGS = -O2 -G0 -Wall -std=c99 -DCUSTOM_PATH -# -DKPRINTF_ENABLED -CXXFLAGS = $(CFLAGS) -ASFLAGS = $(CFLAGS) - -USE_KERNEL_LIBC = 1 -USE_KERNEL_LIBS = 1 - -PSP_FW_VERSION = 500 -PSPSDK = $(shell psp-config --pspsdk-path) -include $(PSPSDK)/lib/build_prx.mak +TARGET = umd_livepatch +C_OBJS = main.o +OBJS = $(C_OBJS) imports.o +all: $(TARGET).prx +INCDIR = $(ARKROOT)/common/include $(ARKROOT)/core/systemctrl/include +CFLAGS = -std=c99 -Os -G0 -Wall + +ifdef DEBUG +CFLAGS += -DDEBUG=$(DEBUG) +endif + +LDFLAGS = -nostartfiles -L . +LIBS = -lpspsystemctrl_kernel + +PSP_FW_VERSION = 660 + +PRX_EXPORTS = exports.exp + +BUILD_PRX=1 +USE_KERNEL_LIBS=1 +USE_KERNEL_LIBC=1 + +include $(ARKROOT)/common/make/global.mak +PSPSDK = $(shell psp-config --pspsdk-path) + +libpspsystemctrl_kernel.a: + $(MAKE) -C $(ARKROOT)/libs/SystemCtrlForKernel + cp $(ARKROOT)/libs/SystemCtrlForKernel/libpspsystemctrl_kernel.a . + +$(TARGET).prx:: libpspsystemctrl_kernel.a + +include $(PSPSDK)/lib/build.mak +include $(ARKROOT)/common/make/beauty.mak diff --git a/exports.exp b/exports.exp new file mode 100644 index 0000000..646ee62 --- /dev/null +++ b/exports.exp @@ -0,0 +1,22 @@ +# Define the exports for the prx +PSP_BEGIN_EXPORTS + +PSP_EXPORT_START(syslib, 0, 0x8000) +PSP_EXPORT_FUNC_HASH(module_start) +PSP_EXPORT_FUNC_HASH(module_stop) +PSP_EXPORT_VAR_HASH(module_info) +PSP_EXPORT_END + +# Voluntary collision with Inferno to prevent conflicts +PSP_EXPORT_START(inferno_driver, 0x0011, 0x0001) +# inferno_driver_CF8299BE +PSP_EXPORT_FUNC(infernoSetDiscType) +# inferno_driver_C0736FD6 +PSP_EXPORT_FUNC(infernoCacheSetPolicy) +# inferno_driver_8CDE7F95 +PSP_EXPORT_FUNC(infernoCacheInit) +# inferno_driver_B6522E93 +PSP_EXPORT_FUNC(infernoSetUmdDelay) +PSP_EXPORT_END + +PSP_END_EXPORTS diff --git a/imports.S b/imports.S new file mode 100644 index 0000000..b754e35 --- /dev/null +++ b/imports.S @@ -0,0 +1,9 @@ + .set noreorder + +#include "pspstub.s" + + STUB_START "SysMemForKernel",0x00000011,0x00050005 + STUB_FUNC 0xC7E57B9C,sceKernelSetQTGP3 + STUB_FUNC 0xFC114573,sceKernelGetCompiledSdkVersion + STUB_FUNC 0xCF4DE78C,sceKernelGetUIDcontrolBlock + STUB_END diff --git a/main.c b/main.c index fafc45c..b4c6854 100644 --- a/main.c +++ b/main.c @@ -29,4 +29,15 @@ int module_start(SceSize argc, void *argp) #endif } +int module_stop(void) +{ + Kprintf("Unloading UMD Livepatch."); +} + + +void infernoSetDiscType(void) {} +void infernoCacheSetPolicy(void) {} +void infernoCacheInit(void) {} +void infernoSetUmdDelay(void) {} + // vim: ft=c.doxygen