From 67fcdc0f4a53fee0339bdd076e571e0f68dcea59 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 28 Feb 2014 21:29:41 -0800 Subject: [PATCH] Reflect font altCharCode in psp mem for tests. Makes it easier to be sure it's working right. Not completely impossible a game will check it... but hopefully not. --- Core/HLE/sceFont.cpp | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 9a9f79e561..5d74d38df2 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -370,6 +370,7 @@ public: } FontLib(u32 paramPtr, u32 errorCodePtr) : fontHRes_(128.0f), fontVRes_(128.0f), altCharCode_(0x5F) { + nfl_ = 0; Memory::ReadStruct(paramPtr, ¶ms_); if (params_.numFonts > 9) { params_.numFonts = 9; @@ -416,17 +417,17 @@ public: // Let's write out the native struct to make tests easier. // It's possible games may depend on this staying in ram, e.g. copying it, we may move to that. - auto nfl = PSPPointer::Create(allocatedAddr); - nfl->params = params_; - nfl->fontInfo1 = allocatedAddr + 0x4C; - nfl->fontInfo2 = allocatedAddr + 0x4C + params_.numFonts * 0x4C; - nfl->unk1 = 0; - nfl->unk2 = 0; - nfl->hRes = fontHRes_; - nfl->vRes = fontVRes_; - nfl->internalFontCount = (u32)internalFonts.size(); - nfl->internalFontInfo = allocatedAddr + 0x4C + params_.numFonts * 0x4C + params_.numFonts * 0x230; - nfl->altCharCode = altCharCode_; + nfl_ = allocatedAddr; + nfl_->params = params_; + nfl_->fontInfo1 = allocatedAddr + 0x4C; + nfl_->fontInfo2 = allocatedAddr + 0x4C + params_.numFonts * 0x4C; + nfl_->unk1 = 0; + nfl_->unk2 = 0; + nfl_->hRes = fontHRes_; + nfl_->vRes = fontVRes_; + nfl_->internalFontCount = (u32)internalFonts.size(); + nfl_->internalFontInfo = allocatedAddr + 0x4C + params_.numFonts * 0x4C + params_.numFonts * 0x230; + nfl_->altCharCode = altCharCode_; } u32 handle() const { return handle_; } @@ -435,12 +436,20 @@ public: void SetResolution(float hres, float vres) { fontHRes_ = hres; fontVRes_ = vres; + if (nfl_.IsValid()) { + nfl_->hRes = hres; + nfl_->vRes = vres; + } } float FontHRes() const { return fontHRes_; } float FontVRes() const { return fontVRes_; } - void SetAltCharCode(int charCode) { altCharCode_ = charCode; } + void SetAltCharCode(int charCode) { + altCharCode_ = charCode; + if (nfl_.IsValid()) + nfl_->altCharCode = charCode; + } int GetFontHandle(int index) { return fonts_[index]; @@ -482,7 +491,7 @@ public: } void DoState(PointerWrap &p) { - auto s = p.Section("FontLib", 1); + auto s = p.Section("FontLib", 1, 2); if (!s) return; @@ -494,6 +503,11 @@ public: p.Do(fileFontHandle_); p.Do(handle_); p.Do(altCharCode_); + if (s >= 2) { + p.Do(nfl_); + } else { + nfl_ = 0; + } } void SetFileFontHandle(u32 handle) { @@ -512,6 +526,7 @@ private: int fileFontHandle_; int handle_; int altCharCode_; + PSPPointer nfl_; DISALLOW_COPY_AND_ASSIGN(FontLib); };