Merge branch 'master' into Font-ltn12-hack
This commit is contained in:
commit
731d9b6d59
1120 changed files with 105910 additions and 41722 deletions
|
@ -317,7 +317,8 @@ public:
|
|||
|
||||
int numInternalFonts = (int)internalFonts.size();
|
||||
Do(p, numInternalFonts);
|
||||
if (numInternalFonts != (int)internalFonts.size()) {
|
||||
// It's okay if numInternalFonts was zero and we've now loaded them.
|
||||
if (numInternalFonts != (int)internalFonts.size() && numInternalFonts != 0) {
|
||||
ERROR_LOG(SCEFONT, "Unable to load state: different internal font count.");
|
||||
p.SetError(p.ERROR_FAILURE);
|
||||
return;
|
||||
|
@ -329,6 +330,11 @@ public:
|
|||
if (internalFont == -1) {
|
||||
Do(p, font_);
|
||||
} else if (p.mode == p.MODE_READ) {
|
||||
if (internalFont < 0 || internalFont >= (int)internalFonts.size()) {
|
||||
ERROR_LOG(SCEFONT, "Unable to load state: unexpected internal font index.");
|
||||
p.SetError(p.ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
font_ = internalFonts[internalFont];
|
||||
}
|
||||
Do(p, handle_);
|
||||
|
@ -885,12 +891,12 @@ static void __LoadInternalFonts() {
|
|||
bool bufferRead = false;
|
||||
|
||||
std::string fontFilename = gameFontPath + entry.fileName;
|
||||
bufferRead = pspFileSystem.ReadEntireFile(fontFilename, buffer) >= 0;
|
||||
bufferRead = pspFileSystem.ReadEntireFile(fontFilename, buffer, true) >= 0;
|
||||
|
||||
if (!bufferRead) {
|
||||
// No game font, let's try override path.
|
||||
fontFilename = fontOverridePath + entry.fileName;
|
||||
bufferRead = pspFileSystem.ReadEntireFile(fontFilename, buffer) >= 0;
|
||||
bufferRead = pspFileSystem.ReadEntireFile(fontFilename, buffer, true) >= 0;
|
||||
}
|
||||
|
||||
if (!bufferRead) {
|
||||
|
@ -947,11 +953,18 @@ void __FontShutdown() {
|
|||
}
|
||||
|
||||
void __FontDoState(PointerWrap &p) {
|
||||
auto s = p.Section("sceFont", 1, 2);
|
||||
auto s = p.Section("sceFont", 1, 3);
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
__LoadInternalFonts();
|
||||
bool needInternalFonts = true;
|
||||
if (s >= 3) {
|
||||
// If we loaded internal fonts, we need to load them when loading the state.
|
||||
needInternalFonts = !internalFonts.empty();
|
||||
Do(p, needInternalFonts);
|
||||
}
|
||||
if (needInternalFonts)
|
||||
__LoadInternalFonts();
|
||||
|
||||
Do(p, fontLibList);
|
||||
Do(p, fontLibMap);
|
||||
|
@ -1139,27 +1152,23 @@ static int sceFontClose(u32 fontHandle) {
|
|||
static int sceFontFindOptimumFont(u32 libHandle, u32 fontStylePtr, u32 errorCodePtr) {
|
||||
auto errorCode = PSPPointer<s32_le>::Create(errorCodePtr);
|
||||
if (!errorCode.IsValid()) {
|
||||
ERROR_LOG_REPORT(SCEFONT, "sceFontFindOptimumFont(%08x, %08x, %08x): invalid error address", libHandle, fontStylePtr, errorCodePtr);
|
||||
return SCE_KERNEL_ERROR_INVALID_ARGUMENT;
|
||||
return hleReportError(SCEFONT, SCE_KERNEL_ERROR_INVALID_ARGUMENT, "invalid error address");
|
||||
}
|
||||
|
||||
FontLib *fontLib = GetFontLib(libHandle);
|
||||
if (!fontLib) {
|
||||
ERROR_LOG_REPORT(SCEFONT, "sceFontFindOptimumFont(%08x, %08x, %08x): invalid font lib", libHandle, fontStylePtr, errorCodePtr);
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
return 0;
|
||||
return hleReportError(SCEFONT, 0, "invalid font lib");
|
||||
}
|
||||
|
||||
if (!Memory::IsValidAddress(fontStylePtr)) {
|
||||
ERROR_LOG_REPORT(SCEFONT, "sceFontFindOptimumFont(%08x, %08x, %08x): invalid style address", libHandle, fontStylePtr, errorCodePtr);
|
||||
// Yes, actually. Must've been a typo in the library.
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
return 0;
|
||||
return hleReportError(SCEFONT, 0, "invalid style address");
|
||||
}
|
||||
|
||||
DEBUG_LOG(SCEFONT, "sceFontFindOptimumFont(%08x, %08x, %08x)", libHandle, fontStylePtr, errorCodePtr);
|
||||
|
||||
auto requestedStyle = PSPPointer<const PGFFontStyle>::Create(fontStylePtr);
|
||||
DEBUG_LOG(SCEFONT, "requestedStyle fontAttributes %i,fontCountry %i,fontExpire %i,fontFamily %i,fontFileName %s,fontH %f,fontHRes %f,fontLanguage %i,fontName %s,fontRegion %i,fontStyle %i,fontStyleSub %i,fontV %f,fontVRes %f,fontWeight %f", requestedStyle->fontAttributes, requestedStyle->fontCountry, requestedStyle->fontExpire, requestedStyle->fontFamily, requestedStyle->fontFileName, requestedStyle->fontH, requestedStyle->fontHRes, requestedStyle->fontLanguage, requestedStyle->fontName, requestedStyle->fontRegion, requestedStyle->fontStyle, requestedStyle->fontStyleSub, requestedStyle->fontV, requestedStyle->fontVRes, requestedStyle->fontWeight);
|
||||
|
||||
// Find the first nearest match for H/V, OR the last exact match for others.
|
||||
float hRes = requestedStyle->fontHRes > 0.0f ? (float)requestedStyle->fontHRes : fontLib->FontHRes();
|
||||
|
@ -1209,10 +1218,10 @@ static int sceFontFindOptimumFont(u32 libHandle, u32 fontStylePtr, u32 errorCode
|
|||
}
|
||||
if (optimumFont) {
|
||||
*errorCode = 0;
|
||||
return GetInternalFontIndex(optimumFont);
|
||||
return hleLogSuccessInfoX(SCEFONT, GetInternalFontIndex(optimumFont) ,"");
|
||||
} else {
|
||||
*errorCode = 0;
|
||||
return 0;
|
||||
return hleLogSuccessInfoX(SCEFONT, 0, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1240,6 +1249,7 @@ static int sceFontFindFont(u32 libHandle, u32 fontStylePtr, u32 errorCodePtr) {
|
|||
DEBUG_LOG(SCEFONT, "sceFontFindFont(%x, %x, %x)", libHandle, fontStylePtr, errorCodePtr);
|
||||
|
||||
auto requestedStyle = PSPPointer<const PGFFontStyle>::Create(fontStylePtr);
|
||||
DEBUG_LOG(SCEFONT, "requestedStyle fontAttributes %i,fontCountry %i,fontExpire %i,fontFamily %i,fontFileName %s,fontH %f,fontHRes %f,fontLanguage %i,fontName %s,fontRegion %i,fontStyle %i,fontStyleSub %i,fontV %f,fontVRes %f,fontWeight %f", requestedStyle->fontAttributes, requestedStyle->fontCountry, requestedStyle->fontExpire, requestedStyle->fontFamily, requestedStyle->fontFileName, requestedStyle->fontH, requestedStyle->fontHRes, requestedStyle->fontLanguage, requestedStyle->fontName, requestedStyle->fontRegion, requestedStyle->fontStyle, requestedStyle->fontStyleSub, requestedStyle->fontV, requestedStyle->fontVRes, requestedStyle->fontWeight);
|
||||
|
||||
// Find the closest exact match for the fields specified.
|
||||
float hRes = requestedStyle->fontHRes > 0.0f ? (float)requestedStyle->fontHRes : fontLib->FontHRes();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue