From 128d18155867c3523f4c224f23ecacb8df368c37 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 28 Feb 2013 08:03:52 -0800 Subject: [PATCH 1/2] Fix crash in sceFontClose(). Still some other issues but Fieldrunners now plays again with tons of errors showing. --- Core/HLE/sceFont.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index a3ff7af981..6cc340c634 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -577,10 +577,16 @@ u32 sceFontOpenUserFile(u32 libHandle, const char *fileName, u32 mode, u32 error } int sceFontClose(u32 fontHandle) { - INFO_LOG(HLE, "sceFontClose(%x)", fontHandle); LoadedFont *font = GetLoadedFont(fontHandle, false); - FontLib *fontLib = font->GetFontLib(); - fontLib->CloseFont(font); + if (font) + { + INFO_LOG(HLE, "sceFontClose(%x)", fontHandle); + FontLib *fontLib = font->GetFontLib(); + if (fontLib) + fontLib->CloseFont(font); + } + else + ERROR_LOG(HLE, "sceFontClose(%x) - font not open?", fontHandle); return 0; } From 4249e0f6a853413d6071dd0b9f69403e562f55d7 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 28 Feb 2013 08:33:30 -0800 Subject: [PATCH 2/2] Fix shutdown crash when there are open fonts. --- Core/HLE/sceFont.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 6cc340c634..7125478ba8 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -443,7 +443,9 @@ void __FontInit() { void __FontShutdown() { for (auto iter = fontMap.begin(); iter != fontMap.end(); iter++) { - iter->second->GetFontLib()->CloseFont(iter->second); + FontLib *fontLib = iter->second->GetFontLib(); + if (fontLib) + fontLib->CloseFont(iter->second); } fontMap.clear(); for (auto iter = fontLibMap.begin(); iter != fontLibMap.end(); iter++) {