From 20dd7db3511a72995e1bb04eca59b4752e3f6f51 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 29 Jun 2020 19:37:55 -0700 Subject: [PATCH 1/2] SaveState: Make sure to default init net data. Otherwise, we may crash when loading a save state. --- Core/HLE/proAdhoc.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Core/HLE/proAdhoc.h b/Core/HLE/proAdhoc.h index dedf1d699287..90f5dfe4dccb 100644 --- a/Core/HLE/proAdhoc.h +++ b/Core/HLE/proAdhoc.h @@ -778,11 +778,10 @@ class AfterMatchingMipsCall : public PSPAction { } void run(MipsCall &call) override; void SetContextID(u32 ContextID, u32 eventId); - void SetContext(SceNetAdhocMatchingContext *Context, u32 eventId) { context = Context; EventID = eventId; } private: - u32 EventID; - SceNetAdhocMatchingContext *context; + u32 EventID = 0; + SceNetAdhocMatchingContext *context = nullptr; }; extern int actionAfterMatchingMipsCall; From e6b42f392144aa96055fdf8b11b422280b0659e2 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 29 Jun 2020 19:40:54 -0700 Subject: [PATCH 2/2] SaveState: Prevent edge case on old save state. If we load an old save state and it errors, could crash. --- Core/HLE/sceFont.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 1e1300858d5d..0bb70b5bfbaf 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -361,6 +361,8 @@ class PostAllocCallback : public PSPAction { p.Do(fontLibID_); if (s >= 2) { p.Do(errorCodePtr_); + } else { + errorCodePtr_ = 0; } } void run(MipsCall &call) override; @@ -721,7 +723,8 @@ void PostAllocCallback::run(MipsCall &call) { u32 v0 = currentMIPS->r[MIPS_REG_V0]; if (v0 == 0) { // TODO: Who deletes fontLib? - Memory::Write_U32(ERROR_FONT_OUT_OF_MEMORY, errorCodePtr_); + if (errorCodePtr_) + Memory::Write_U32(ERROR_FONT_OUT_OF_MEMORY, errorCodePtr_); call.setReturnValue(0); } else { FontLib *fontLib = fontLibList[fontLibID_];