mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-23 02:24:38 +00:00
added sceFontStyleFrameGetScalePixel
This commit is contained in:
parent
2d839cb144
commit
6b9c790698
@ -817,6 +817,7 @@ void PS4_SYSV_ABI sceFontRenderSurfaceSetScissor(OrbisFontRenderSurface* renderS
|
|||||||
s32 PS4_SYSV_ABI sceFontRenderSurfaceSetStyleFrame(OrbisFontRenderSurface* renderSurface,
|
s32 PS4_SYSV_ABI sceFontRenderSurfaceSetStyleFrame(OrbisFontRenderSurface* renderSurface,
|
||||||
OrbisFontStyleFrame* styleFrame) {
|
OrbisFontStyleFrame* styleFrame) {
|
||||||
if (!renderSurface) {
|
if (!renderSurface) {
|
||||||
|
LOG_ERROR(Lib_Font, "Invalid Parameter");
|
||||||
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,6 +826,7 @@ s32 PS4_SYSV_ABI sceFontRenderSurfaceSetStyleFrame(OrbisFontRenderSurface* rende
|
|||||||
} else {
|
} else {
|
||||||
// Validate magic number
|
// Validate magic number
|
||||||
if (styleFrame->magic != 0xF09) {
|
if (styleFrame->magic != 0xF09) {
|
||||||
|
LOG_ERROR(Lib_Font, "Invalid magic");
|
||||||
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,21 +927,24 @@ s32 PS4_SYSV_ABI sceFontStringRefersTextCharacters() {
|
|||||||
s32 PS4_SYSV_ABI sceFontStyleFrameGetEffectSlant(OrbisFontStyleFrame* styleFrame,
|
s32 PS4_SYSV_ABI sceFontStyleFrameGetEffectSlant(OrbisFontStyleFrame* styleFrame,
|
||||||
float* slantRatio) {
|
float* slantRatio) {
|
||||||
if (!styleFrame) {
|
if (!styleFrame) {
|
||||||
printf("[ERROR] Style frame is NULL.\n");
|
LOG_ERROR(Lib_Font, "Invalid Parameter");
|
||||||
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the magic number
|
// Validate the magic number
|
||||||
if (styleFrame->magic != 0xF09) {
|
if (styleFrame->magic != 0xF09) {
|
||||||
|
LOG_ERROR(Lib_Font, "Invalid Magic");
|
||||||
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the slant effect is enabled (bit 1 in flags)
|
// Check if the slant effect is enabled (bit 1 in flags)
|
||||||
if (!(styleFrame->flags & 0x02)) {
|
if (!(styleFrame->flags & 0x02)) {
|
||||||
|
LOG_ERROR(Lib_Font, "Flag not set");
|
||||||
return ORBIS_FONT_ERROR_UNSET_PARAMETER;
|
return ORBIS_FONT_ERROR_UNSET_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!slantRatio) {
|
if (!slantRatio) {
|
||||||
|
LOG_ERROR(Lib_Font, "Invalid Parameter");
|
||||||
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -952,16 +957,19 @@ s32 PS4_SYSV_ABI sceFontStyleFrameGetEffectWeight(OrbisFontStyleFrame* fontStyle
|
|||||||
float* weightXScale, float* weightYScale,
|
float* weightXScale, float* weightYScale,
|
||||||
uint32_t* mode) {
|
uint32_t* mode) {
|
||||||
if (!fontStyleFrame) {
|
if (!fontStyleFrame) {
|
||||||
|
LOG_ERROR(Lib_Font, "Invalid Parameter");
|
||||||
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the magic number
|
// Validate the magic number
|
||||||
if (fontStyleFrame->magic != 0xF09) {
|
if (fontStyleFrame->magic != 0xF09) {
|
||||||
|
LOG_ERROR(Lib_Font, "Magic not set");
|
||||||
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the weight effect is enabled (bit 2 in flags)
|
// Check if the weight effect is enabled (bit 2 in flags)
|
||||||
if (!(fontStyleFrame->flags & 0x04)) {
|
if (!(fontStyleFrame->flags & 0x04)) {
|
||||||
|
LOG_ERROR(Lib_Font, "Flag not set");
|
||||||
return ORBIS_FONT_ERROR_UNSET_PARAMETER;
|
return ORBIS_FONT_ERROR_UNSET_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -985,8 +993,39 @@ s32 PS4_SYSV_ABI sceFontStyleFrameGetResolutionDpi() {
|
|||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceFontStyleFrameGetScalePixel() {
|
s32 PS4_SYSV_ABI sceFontStyleFrameGetScalePixel(OrbisFontStyleFrame* styleFrame, float* w,
|
||||||
LOG_ERROR(Lib_Font, "(STUBBED) called");
|
float* h) {
|
||||||
|
if (!styleFrame) {
|
||||||
|
LOG_ERROR(Lib_Font, "Invalid Parameter");
|
||||||
|
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (styleFrame->magic != 0xF09) {
|
||||||
|
LOG_ERROR(Lib_Font, "Invalid magic");
|
||||||
|
return ORBIS_FONT_ERROR_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(styleFrame->flags & 0x01)) {
|
||||||
|
LOG_ERROR(Lib_Font, "Scaling effect parameter not set");
|
||||||
|
return ORBIS_FONT_ERROR_UNSET_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if scaling is allowed
|
||||||
|
int isScalingEnabled = styleFrame->scalingFlag;
|
||||||
|
if (w) {
|
||||||
|
*w = styleFrame->scaleWidth;
|
||||||
|
if (isScalingEnabled && styleFrame->dpiX) {
|
||||||
|
*w *= ((float)styleFrame->dpiX / 72.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (h) {
|
||||||
|
*h = styleFrame->scaleHeight;
|
||||||
|
if (isScalingEnabled && styleFrame->dpiY) {
|
||||||
|
*h *= ((float)styleFrame->dpiY / 72.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,12 +40,17 @@ struct OrbisFontRenderSurface {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct OrbisFontStyleFrame {
|
struct OrbisFontStyleFrame {
|
||||||
u16 magic; // Expected to be 0xF09
|
/*0x00*/ u16 magic; // Expected to be 0xF09
|
||||||
u16 flags;
|
/*0x02*/ u16 flags;
|
||||||
//
|
/*0x04*/ s32 dpiX; // DPI scaling factor for width
|
||||||
float weightXScale; // 0x1c
|
/*0x08*/ s32 dpiY; // DPI scaling factor for height
|
||||||
float weightYScale; // 0x20
|
/*0x0c*/ s32 scalingFlag; // Indicates whether scaling is enabled
|
||||||
float slantRatio; // 0x24
|
/*0x10*/
|
||||||
|
/*0x14*/ float scaleWidth; // Width scaling factor
|
||||||
|
/*0x18*/ float scaleHeight; // Height scaling factor
|
||||||
|
/*0x1c*/ float weightXScale;
|
||||||
|
/*0x20*/ float weightYScale;
|
||||||
|
/*0x24*/ float slantRatio;
|
||||||
};
|
};
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceFontAttachDeviceCacheBuffer();
|
s32 PS4_SYSV_ABI sceFontAttachDeviceCacheBuffer();
|
||||||
@ -220,7 +225,8 @@ s32 PS4_SYSV_ABI sceFontStyleFrameGetEffectWeight(OrbisFontStyleFrame* fontStyle
|
|||||||
float* weightXScale, float* weightYScale,
|
float* weightXScale, float* weightYScale,
|
||||||
uint32_t* mode);
|
uint32_t* mode);
|
||||||
s32 PS4_SYSV_ABI sceFontStyleFrameGetResolutionDpi();
|
s32 PS4_SYSV_ABI sceFontStyleFrameGetResolutionDpi();
|
||||||
s32 PS4_SYSV_ABI sceFontStyleFrameGetScalePixel();
|
s32 PS4_SYSV_ABI sceFontStyleFrameGetScalePixel(OrbisFontStyleFrame* styleFrame, float* w,
|
||||||
|
float* h);
|
||||||
s32 PS4_SYSV_ABI sceFontStyleFrameGetScalePoint();
|
s32 PS4_SYSV_ABI sceFontStyleFrameGetScalePoint();
|
||||||
s32 PS4_SYSV_ABI sceFontStyleFrameInit();
|
s32 PS4_SYSV_ABI sceFontStyleFrameInit();
|
||||||
s32 PS4_SYSV_ABI sceFontStyleFrameSetEffectSlant();
|
s32 PS4_SYSV_ABI sceFontStyleFrameSetEffectSlant();
|
||||||
|
Loading…
Reference in New Issue
Block a user