Merge pull request #16848 from sum2012/font-log

Add more logging in sceFontFindOptimumFont
This commit is contained in:
Henrik Rydgård
2023-01-25 22:48:08 +01:00
committed by GitHub

View File

@@ -1152,26 +1152,21 @@ 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);
// Find the first nearest match for H/V, OR the last exact match for others.
@@ -1209,10 +1204,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, "");
}
}