From 127ee5d30f28ea7af1141fa21f504ea592d73844 Mon Sep 17 00:00:00 2001 From: raven02 Date: Thu, 28 Feb 2013 22:36:57 +0800 Subject: [PATCH 1/3] Create flash0:/font/ if not exists --- Core/HLE/sceFont.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index f9ccf1d3d8..dfd5eae353 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -364,6 +364,9 @@ LoadedFont *GetLoadedFont(u32 handle, bool allowClosed) { void __LoadInternalFonts() { std::string fontPath = "flash0:/font/"; + if (!pspFileSystem.GetFileInfo(fontPath).exists) { + pspFileSystem.MkDir(fontPath); + } for (size_t i = 0; i < ARRAY_SIZE(fontRegistry); i++) { const FontRegistryEntry &entry = fontRegistry[i]; std::string fontFilename = fontPath + entry.fileName; From 50be9102e437777f922e828c3fb2a24faabc4abc Mon Sep 17 00:00:00 2001 From: raven02 Date: Thu, 28 Feb 2013 22:50:14 +0800 Subject: [PATCH 2/3] Fix crash when font sets not exists --- Core/HLE/sceFont.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index dfd5eae353..6e8a5b9460 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -712,6 +712,10 @@ int sceFontGetCharGlyphImage(u32 fontHandle, u32 charCode, u32 glyphImagePtr) { int buffer = Memory::Read_U32(glyphImagePtr+20); LoadedFont *font = GetLoadedFont(fontHandle, false); + if (!font) { + ERROR_LOG(HLE, "%08x is not a valid font handle!", fontHandle); + return 0; + } int altCharCode = font->GetFontLib()->GetAltCharCode(); font->GetFont()->GetPGF()->DrawCharacter(buffer, bytesPerLine, bufWidth, bufHeight, xPos64 >> 6, yPos64 >> 6, 0, 0, 8192, 8192, pixelFormat, charCode, altCharCode, FONT_PGF_CHARGLYPH); return 0; From e319e2a7c2b3676f733dd5459eaa81c7c8c5c8d1 Mon Sep 17 00:00:00 2001 From: raven02 Date: Thu, 28 Feb 2013 23:04:40 +0800 Subject: [PATCH 3/3] Minor fix --- Core/HLE/sceFont.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 6e8a5b9460..84675a295f 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -636,7 +636,7 @@ int sceFontGetFontInfo(u32 fontHandle, u32 fontInfoPtr) { if (!Memory::IsValidAddress(fontInfoPtr)) return 0; - LoadedFont * font = GetLoadedFont(fontHandle, true); + LoadedFont *font = GetLoadedFont(fontHandle, true); if (!font) return 0; PGF *pgf = font->GetFont()->GetPGF();