HLE: Pass the MIPSState to syscalls and their implementations

HLEFunc and ReplaceFunc now take the MIPSState they run on. The dispatch
paths (both interpreters and every JIT backend) pass in the state they
belong to, and CallSyscall*, hleFinishSyscall and the HLE mips call
machinery use it instead of currentMIPS.

The wrappers in FunctionWrappers.h take the function as `auto` and call it
through HLECall, which also accepts an implementation with an extra leading
MIPSState * parameter and passes the state to it. Any other signature still
fails to compile, as before. PARAM/RETURN now refer to a local `mips`.

The HLE functions (and replacement functions) that used currentMIPS now take
the state that way. Callers outside a syscall's own frame - CoreTiming
events, the adhoc matching thread, dialogs, PPGe, the debugger UIs - pass
currentMIPS or &mipsr4k explicitly. The kernel's thread internals still use
currentMIPS.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-20 15:45:14 +02:00
1 parent 394c05f414
commit 7dd1475ed7
52 files changed
+1138 -1083

No files matched your search

+4 -4
View File
@@ -321,8 +321,8 @@ int sceHttpSetResolveRetry(int id, int retryCount) {
return hleLogDebug(Log::sceNet, 0);
}
static int sceHttpInit(int poolSize) {
WARN_LOG(Log::sceNet, "UNTESTED sceHttpInit(%i) at %08x", poolSize, currentMIPS->pc);
static int sceHttpInit(MIPSState *mips, int poolSize) {
WARN_LOG(Log::sceNet, "UNTESTED sceHttpInit(%i) at %08x", poolSize, mips->pc);
if (httpInited)
return hleLogError(Log::sceNet, SCE_HTTP_ERROR_ALREADY_INITED, "http already inited");
@@ -675,8 +675,8 @@ static int sceHttpLoadSystemCookie() {
}
// PSP Browser seems to set userAgent to 0 and later set the User-Agent header using sceHttpAddExtraHeader
static int sceHttpCreateTemplate(const char *userAgent, int httpVer, int autoProxyConf) {
WARN_LOG(Log::sceNet, "UNTESTED sceHttpCreateTemplate(%s, %d, %d) at %08x", safe_string(userAgent), httpVer, autoProxyConf, currentMIPS->pc);
static int sceHttpCreateTemplate(MIPSState *mips, const char *userAgent, int httpVer, int autoProxyConf) {
WARN_LOG(Log::sceNet, "UNTESTED sceHttpCreateTemplate(%s, %d, %d) at %08x", safe_string(userAgent), httpVer, autoProxyConf, mips->pc);
// Reporting to find more games to be tested
WARN_LOG_REPORT_ONCE(sceHttpCreateTemplate, Log::sceNet, "UNTESTED sceHttpCreateTemplate(%s, %d, %d)", safe_string(userAgent), httpVer, autoProxyConf);
std::lock_guard<std::mutex> guard(httpLock);