From 57b870cf437efa0935bb011a1158af7e0d311752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 8 Nov 2026 11:41:08 +0100 Subject: [PATCH] Modules: Write 0 to the status when starting a module with no entry sceKernelStartModule left the status word untouched for a module without module_start, so the caller read whatever was on its stack. The PSP writes 0 there (modules/nostart). R-Type Tactics loads the libfont.prx on its disc after its LoadExec and gives up on its fonts when that status is negative (0xDEADBEEF from the stack fill), then crashes writing through a pointer it never set. This only showed once the disc's libfont became the default over our HLE sceFont. Co-Authored-By: Claude Opus 5.5 --- Core/HLE/sceKernelModule.cpp | 4 ++++ pspautotests | 2 +- test.py | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 40abb0bf55..ad92eed4dd 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -3312,6 +3312,10 @@ int __KernelStartModule(SceUID moduleId, u32 argsize, u32 argAddr, u32 returnVal } else if (entryAddr == 0 || entryAddr == (u32)-1) { INFO_LOG(Log::sceModule, "__KernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x): no entry address", moduleId, argsize, argAddr, returnValueAddr); module->nm.status = MODULE_STATUS_STARTED; + // The status is still set to 0 (modules/nostart). R-Type Tactics gives up on its fonts otherwise. + if (returnValueAddr) { + Memory::WriteOrException_U32(0, returnValueAddr); + } } else { ERROR_LOG(Log::sceModule, "__KernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x): invalid entry address", moduleId, argsize, argAddr, returnValueAddr); return -1; diff --git a/pspautotests b/pspautotests index 33e5d3876c..3ccc35c76b 160000 --- a/pspautotests +++ b/pspautotests @@ -1 +1 @@ -Subproject commit 33e5d3876c72fab5cfa98e48d2b81a856770d6e0 +Subproject commit 3ccc35c76b045824d3ba4ed17839df3f1711bf8e diff --git a/test.py b/test.py index 23b220c421..aa861faabc 100755 --- a/test.py +++ b/test.py @@ -360,6 +360,7 @@ tests_good = [ "modules/cutrel/kernel/cutrel", "modules/idlist/idlist", "modules/loadrace/loadrace", + "modules/nostart/nostart", "modules/startoptions/startoptions", "modules/unresolved/unresolved", "net/inet/blocking",