mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-29 22:20:48 +00:00
cellFont cleanup
This commit is contained in:
parent
45dda65ce9
commit
7b0b0440ef
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
extern Module cellFont;
|
extern Module cellFont;
|
||||||
|
|
||||||
CCellFontInternal* s_fontInternalInstance = nullptr;
|
CellFontInternal* s_fontInternalInstance = nullptr;
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
s32 cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr<CellFontConfig> config)
|
s32 cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr<CellFontConfig> config)
|
||||||
@ -16,11 +16,19 @@ s32 cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr<CellFontConfig> co
|
|||||||
cellFont.Warning("cellFontInitializeWithRevision(revisionFlags=0x%llx, config=*0x%x)", revisionFlags, config);
|
cellFont.Warning("cellFontInitializeWithRevision(revisionFlags=0x%llx, config=*0x%x)", revisionFlags, config);
|
||||||
|
|
||||||
if (s_fontInternalInstance->m_bInitialized)
|
if (s_fontInternalInstance->m_bInitialized)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_ALREADY_INITIALIZED;
|
return CELL_FONT_ERROR_ALREADY_INITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
if (config->FileCache.size < 24)
|
if (config->FileCache.size < 24)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
if (config->flags != 0)
|
if (config->flags != 0)
|
||||||
cellFont.Warning("cellFontInitializeWithRevision: Unknown flags (0x%x)", config->flags);
|
{
|
||||||
|
cellFont.Error("cellFontInitializeWithRevision: Unknown flags (0x%x)", config->flags);
|
||||||
|
}
|
||||||
|
|
||||||
s_fontInternalInstance->m_buffer_addr = config->FileCache.buffer_addr;
|
s_fontInternalInstance->m_buffer_addr = config->FileCache.buffer_addr;
|
||||||
s_fontInternalInstance->m_buffer_size = config->FileCache.size;
|
s_fontInternalInstance->m_buffer_size = config->FileCache.size;
|
||||||
@ -43,6 +51,7 @@ s32 cellFontInit(PPUThread& CPU, vm::ptr<CellFontConfig> config)
|
|||||||
vm::stackvar<be_t<u64>> revisionFlags(CPU);
|
vm::stackvar<be_t<u64>> revisionFlags(CPU);
|
||||||
revisionFlags.value() = 0;
|
revisionFlags.value() = 0;
|
||||||
cellFontGetRevisionFlags(revisionFlags);
|
cellFontGetRevisionFlags(revisionFlags);
|
||||||
|
|
||||||
return cellFontInitializeWithRevision(revisionFlags.value(), config);
|
return cellFontInitializeWithRevision(revisionFlags.value(), config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,9 +60,12 @@ s32 cellFontEnd()
|
|||||||
cellFont.Warning("cellFontEnd()");
|
cellFont.Warning("cellFontEnd()");
|
||||||
|
|
||||||
if (!s_fontInternalInstance->m_bInitialized)
|
if (!s_fontInternalInstance->m_bInitialized)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_UNINITIALIZED;
|
return CELL_FONT_ERROR_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
s_fontInternalInstance->m_bInitialized = false;
|
s_fontInternalInstance->m_bInitialized = false;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +80,9 @@ s32 cellFontOpenFontMemory(vm::ptr<CellFontLibrary> library, u32 fontAddr, u32 f
|
|||||||
cellFont.Warning("cellFontOpenFontMemory(library=*0x%x, fontAddr=0x%x, fontSize=%d, subNum=%d, uniqueId=%d, font=*0x%x)", library, fontAddr, fontSize, subNum, uniqueId, font);
|
cellFont.Warning("cellFontOpenFontMemory(library=*0x%x, fontAddr=0x%x, fontSize=%d, subNum=%d, uniqueId=%d, font=*0x%x)", library, fontAddr, fontSize, subNum, uniqueId, font);
|
||||||
|
|
||||||
if (!s_fontInternalInstance->m_bInitialized)
|
if (!s_fontInternalInstance->m_bInitialized)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_UNINITIALIZED;
|
return CELL_FONT_ERROR_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
font->stbfont = (stbtt_fontinfo*)((u8*)&(font->stbfont) + sizeof(void*)); // hack: use next bytes of the struct
|
font->stbfont = (stbtt_fontinfo*)((u8*)&(font->stbfont) + sizeof(void*)); // hack: use next bytes of the struct
|
||||||
|
|
||||||
@ -78,6 +92,7 @@ s32 cellFontOpenFontMemory(vm::ptr<CellFontLibrary> library, u32 fontAddr, u32 f
|
|||||||
font->renderer_addr = 0;
|
font->renderer_addr = 0;
|
||||||
font->fontdata_addr = fontAddr;
|
font->fontdata_addr = fontAddr;
|
||||||
font->origin = CELL_FONT_OPEN_MEMORY;
|
font->origin = CELL_FONT_OPEN_MEMORY;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,13 +102,16 @@ s32 cellFontOpenFontFile(vm::ptr<CellFontLibrary> library, vm::cptr<char> fontPa
|
|||||||
|
|
||||||
vfsFile f(fontPath.get_ptr());
|
vfsFile f(fontPath.get_ptr());
|
||||||
if (!f.IsOpened())
|
if (!f.IsOpened())
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_FONT_OPEN_FAILED;
|
return CELL_FONT_ERROR_FONT_OPEN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
u32 fileSize = (u32)f.GetSize();
|
u32 fileSize = (u32)f.GetSize();
|
||||||
u32 bufferAddr = vm::alloc(fileSize, vm::main); // Freed in cellFontCloseFont
|
u32 bufferAddr = vm::alloc(fileSize, vm::main); // Freed in cellFontCloseFont
|
||||||
f.Read(vm::get_ptr<void>(bufferAddr), fileSize);
|
f.Read(vm::get_ptr<void>(bufferAddr), fileSize);
|
||||||
s32 ret = cellFontOpenFontMemory(library, bufferAddr, fileSize, subNum, uniqueId, font);
|
s32 ret = cellFontOpenFontMemory(library, bufferAddr, fileSize, subNum, uniqueId, font);
|
||||||
font->origin = CELL_FONT_OPEN_FONT_FILE;
|
font->origin = CELL_FONT_OPEN_FONT_FILE;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,9 +120,14 @@ s32 cellFontOpenFontset(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::pt
|
|||||||
cellFont.Warning("cellFontOpenFontset(library=*0x%x, fontType=*0x%x, font=*0x%x)", library, fontType, font);
|
cellFont.Warning("cellFontOpenFontset(library=*0x%x, fontType=*0x%x, font=*0x%x)", library, fontType, font);
|
||||||
|
|
||||||
if (!s_fontInternalInstance->m_bInitialized)
|
if (!s_fontInternalInstance->m_bInitialized)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_UNINITIALIZED;
|
return CELL_FONT_ERROR_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
if (fontType->map != CELL_FONT_MAP_UNICODE)
|
if (fontType->map != CELL_FONT_MAP_UNICODE)
|
||||||
|
{
|
||||||
cellFont.Warning("cellFontOpenFontset: Only Unicode is supported");
|
cellFont.Warning("cellFontOpenFontset: Only Unicode is supported");
|
||||||
|
}
|
||||||
|
|
||||||
std::string file;
|
std::string file;
|
||||||
switch((u32)fontType->type)
|
switch((u32)fontType->type)
|
||||||
@ -176,6 +199,7 @@ s32 cellFontOpenFontset(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::pt
|
|||||||
memcpy(f.get_ptr(), file.c_str(), file.size() + 1);
|
memcpy(f.get_ptr(), file.c_str(), file.size() + 1);
|
||||||
s32 ret = cellFontOpenFontFile(library, f, 0, 0, font); //TODO: Find the correct values of subNum, uniqueId
|
s32 ret = cellFontOpenFontFile(library, f, 0, 0, font); //TODO: Find the correct values of subNum, uniqueId
|
||||||
font->origin = CELL_FONT_OPEN_FONTSET;
|
font->origin = CELL_FONT_OPEN_FONTSET;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,10 +225,12 @@ s32 cellFontSetFontOpenMode(u32 openMode)
|
|||||||
|
|
||||||
s32 cellFontCreateRenderer(vm::ptr<CellFontLibrary> library, vm::ptr<CellFontRendererConfig> config, vm::ptr<CellFontRenderer> Renderer)
|
s32 cellFontCreateRenderer(vm::ptr<CellFontLibrary> library, vm::ptr<CellFontRendererConfig> config, vm::ptr<CellFontRenderer> Renderer)
|
||||||
{
|
{
|
||||||
cellFont.Warning("cellFontCreateRenderer(library=*0x%x, config=*0x%x, Renderer=*0x%x)", library, config, Renderer);
|
cellFont.Todo("cellFontCreateRenderer(library=*0x%x, config=*0x%x, Renderer=*0x%x)", library, config, Renderer);
|
||||||
|
|
||||||
if (!s_fontInternalInstance->m_bInitialized)
|
if (!s_fontInternalInstance->m_bInitialized)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_UNINITIALIZED;
|
return CELL_FONT_ERROR_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
//Write data in Renderer
|
//Write data in Renderer
|
||||||
|
|
||||||
@ -222,7 +248,9 @@ void cellFontRenderSurfaceInit(vm::ptr<CellFontRenderSurface> surface, vm::ptr<v
|
|||||||
surface->height = h;
|
surface->height = h;
|
||||||
|
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
|
{
|
||||||
surface->buffer_addr = vm::alloc(bufferWidthByte * h, vm::main); // TODO: Huge memory leak
|
surface->buffer_addr = vm::alloc(bufferWidthByte * h, vm::main); // TODO: Huge memory leak
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cellFontRenderSurfaceSetScissor(vm::ptr<CellFontRenderSurface> surface, s32 x0, s32 y0, s32 w, s32 h)
|
void cellFontRenderSurfaceSetScissor(vm::ptr<CellFontRenderSurface> surface, s32 x0, s32 y0, s32 w, s32 h)
|
||||||
@ -241,6 +269,7 @@ s32 cellFontSetScalePixel(vm::ptr<CellFont> font, float w, float h)
|
|||||||
|
|
||||||
font->scale_x = w;
|
font->scale_x = w;
|
||||||
font->scale_y = h;
|
font->scale_y = h;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,6 +284,7 @@ s32 cellFontGetHorizontalLayout(vm::ptr<CellFont> font, vm::ptr<CellFontHorizont
|
|||||||
layout->baseLineY = ascent * scale;
|
layout->baseLineY = ascent * scale;
|
||||||
layout->lineHeight = (ascent-descent+lineGap) * scale;
|
layout->lineHeight = (ascent-descent+lineGap) * scale;
|
||||||
layout->effectHeight = lineGap * scale;
|
layout->effectHeight = lineGap * scale;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,9 +293,12 @@ s32 cellFontBindRenderer(vm::ptr<CellFont> font, vm::ptr<CellFontRenderer> rende
|
|||||||
cellFont.Warning("cellFontBindRenderer(font=*0x%x, renderer=*0x%x)", font, renderer);
|
cellFont.Warning("cellFontBindRenderer(font=*0x%x, renderer=*0x%x)", font, renderer);
|
||||||
|
|
||||||
if (font->renderer_addr)
|
if (font->renderer_addr)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_RENDERER_ALREADY_BIND;
|
return CELL_FONT_ERROR_RENDERER_ALREADY_BIND;
|
||||||
|
}
|
||||||
|
|
||||||
font->renderer_addr = renderer.addr();
|
font->renderer_addr = renderer.addr();
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,9 +307,12 @@ s32 cellFontUnbindRenderer(vm::ptr<CellFont> font)
|
|||||||
cellFont.Warning("cellFontBindRenderer(font=*0x%x)", font);
|
cellFont.Warning("cellFontBindRenderer(font=*0x%x)", font);
|
||||||
|
|
||||||
if (!font->renderer_addr)
|
if (!font->renderer_addr)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
||||||
|
}
|
||||||
|
|
||||||
font->renderer_addr = 0;
|
font->renderer_addr = 0;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,10 +324,12 @@ s32 cellFontDestroyRenderer()
|
|||||||
|
|
||||||
s32 cellFontSetupRenderScalePixel(vm::ptr<CellFont> font, float w, float h)
|
s32 cellFontSetupRenderScalePixel(vm::ptr<CellFont> font, float w, float h)
|
||||||
{
|
{
|
||||||
cellFont.Log("cellFontSetupRenderScalePixel(font=*0x%x, w=%f, h=%f)", font, w, h);
|
cellFont.Todo("cellFontSetupRenderScalePixel(font=*0x%x, w=%f, h=%f)", font, w, h);
|
||||||
|
|
||||||
if (!font->renderer_addr)
|
if (!font->renderer_addr)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: ?
|
// TODO: ?
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
@ -299,10 +337,12 @@ s32 cellFontSetupRenderScalePixel(vm::ptr<CellFont> font, float w, float h)
|
|||||||
|
|
||||||
s32 cellFontGetRenderCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontGlyphMetrics> metrics)
|
s32 cellFontGetRenderCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontGlyphMetrics> metrics)
|
||||||
{
|
{
|
||||||
cellFont.Log("cellFontGetRenderCharGlyphMetrics(font=*0x%x, code=0x%x, metrics=*0x%x)", font, code, metrics);
|
cellFont.Todo("cellFontGetRenderCharGlyphMetrics(font=*0x%x, code=0x%x, metrics=*0x%x)", font, code, metrics);
|
||||||
|
|
||||||
if (!font->renderer_addr)
|
if (!font->renderer_addr)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: ?
|
// TODO: ?
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
@ -313,13 +353,19 @@ s32 cellFontRenderCharGlyphImage(vm::ptr<CellFont> font, u32 code, vm::ptr<CellF
|
|||||||
cellFont.Log("cellFontRenderCharGlyphImage(font=*0x%x, code=0x%x, surface=*0x%x, x=%f, y=%f, metrics=*0x%x, trans=*0x%x)", font, code, surface, x, y, metrics, transInfo);
|
cellFont.Log("cellFontRenderCharGlyphImage(font=*0x%x, code=0x%x, surface=*0x%x, x=%f, y=%f, metrics=*0x%x, trans=*0x%x)", font, code, surface, x, y, metrics, transInfo);
|
||||||
|
|
||||||
if (!font->renderer_addr)
|
if (!font->renderer_addr)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
||||||
|
}
|
||||||
|
|
||||||
// Render the character
|
// Render the character
|
||||||
s32 width, height, xoff, yoff;
|
s32 width, height, xoff, yoff;
|
||||||
float scale = stbtt_ScaleForPixelHeight(font->stbfont, font->scale_y);
|
float scale = stbtt_ScaleForPixelHeight(font->stbfont, font->scale_y);
|
||||||
unsigned char* box = stbtt_GetCodepointBitmap(font->stbfont, scale, scale, code, &width, &height, &xoff, &yoff);
|
unsigned char* box = stbtt_GetCodepointBitmap(font->stbfont, scale, scale, code, &width, &height, &xoff, &yoff);
|
||||||
if (!box) return CELL_OK;
|
|
||||||
|
if (!box)
|
||||||
|
{
|
||||||
|
return CELL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the baseLineY value
|
// Get the baseLineY value
|
||||||
s32 baseLineY;
|
s32 baseLineY;
|
||||||
@ -329,16 +375,18 @@ s32 cellFontRenderCharGlyphImage(vm::ptr<CellFont> font, u32 code, vm::ptr<CellF
|
|||||||
|
|
||||||
// Move the rendered character to the surface
|
// Move the rendered character to the surface
|
||||||
unsigned char* buffer = vm::get_ptr<unsigned char>(surface->buffer_addr);
|
unsigned char* buffer = vm::get_ptr<unsigned char>(surface->buffer_addr);
|
||||||
for (u32 ypos = 0; ypos < (u32)height; ypos++){
|
for (u32 ypos = 0; ypos < (u32)height; ypos++)
|
||||||
|
{
|
||||||
if ((u32)y + ypos + yoff + baseLineY >= surface->height)
|
if ((u32)y + ypos + yoff + baseLineY >= surface->height)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (u32 xpos = 0; xpos < (u32)width; xpos++){
|
for (u32 xpos = 0; xpos < (u32)width; xpos++)
|
||||||
|
{
|
||||||
if ((u32)x + xpos >= surface->width)
|
if ((u32)x + xpos >= surface->width)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// TODO: There are some oddities in the position of the character in the final buffer
|
// TODO: There are some oddities in the position of the character in the final buffer
|
||||||
buffer[((int)y + ypos + yoff + baseLineY)*surface->width + (int)x+xpos] = box[ypos*width + xpos];
|
buffer[((s32)y + ypos + yoff + baseLineY)*surface->width + (s32)x + xpos] = box[ypos * width + xpos];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stbtt_FreeBitmap(box, 0);
|
stbtt_FreeBitmap(box, 0);
|
||||||
@ -356,9 +404,12 @@ s32 cellFontSetEffectSlant(vm::ptr<CellFont> font, float slantParam)
|
|||||||
cellFont.Log("cellFontSetEffectSlant(font=*0x%x, slantParam=%f)", font, slantParam);
|
cellFont.Log("cellFontSetEffectSlant(font=*0x%x, slantParam=%f)", font, slantParam);
|
||||||
|
|
||||||
if (slantParam < -1.0 || slantParam > 1.0)
|
if (slantParam < -1.0 || slantParam > 1.0)
|
||||||
|
{
|
||||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
font->slant = slantParam;
|
font->slant = slantParam;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,6 +418,7 @@ s32 cellFontGetEffectSlant(vm::ptr<CellFont> font, vm::ptr<float> slantParam)
|
|||||||
cellFont.Warning("cellFontSetEffectSlant(font=*0x%x, slantParam=*0x%x)", font, slantParam);
|
cellFont.Warning("cellFontSetEffectSlant(font=*0x%x, slantParam=*0x%x)", font, slantParam);
|
||||||
|
|
||||||
*slantParam = font->slant;
|
*slantParam = font->slant;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,14 +437,16 @@ s32 cellFontCloseFont(vm::ptr<CellFont> font)
|
|||||||
if (font->origin == CELL_FONT_OPEN_FONTSET ||
|
if (font->origin == CELL_FONT_OPEN_FONTSET ||
|
||||||
font->origin == CELL_FONT_OPEN_FONT_FILE ||
|
font->origin == CELL_FONT_OPEN_FONT_FILE ||
|
||||||
font->origin == CELL_FONT_OPEN_MEMORY)
|
font->origin == CELL_FONT_OPEN_MEMORY)
|
||||||
|
{
|
||||||
vm::dealloc(font->fontdata_addr, vm::main);
|
vm::dealloc(font->fontdata_addr, vm::main);
|
||||||
|
}
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 cellFontGetCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontGlyphMetrics> metrics)
|
s32 cellFontGetCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontGlyphMetrics> metrics)
|
||||||
{
|
{
|
||||||
cellFont.Log("cellFontGetCharGlyphMetrics(font=*0x%x, code=0x%x, metrics=*0x%x)", font, code, metrics);
|
cellFont.Warning("cellFontGetCharGlyphMetrics(font=*0x%x, code=0x%x, metrics=*0x%x)", font, code, metrics);
|
||||||
|
|
||||||
s32 x0, y0, x1, y1;
|
s32 x0, y0, x1, y1;
|
||||||
s32 advanceWidth, leftSideBearing;
|
s32 advanceWidth, leftSideBearing;
|
||||||
@ -409,6 +463,7 @@ s32 cellFontGetCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFo
|
|||||||
metrics->Vertical.bearingX = 0.f;
|
metrics->Vertical.bearingX = 0.f;
|
||||||
metrics->Vertical.bearingY = 0.f;
|
metrics->Vertical.bearingY = 0.f;
|
||||||
metrics->Vertical.advance = 0.f;
|
metrics->Vertical.advance = 0.f;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,9 +473,20 @@ s32 cellFontGraphicsSetFontRGBA()
|
|||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 cellFontOpenFontsetOnMemory()
|
s32 cellFontOpenFontsetOnMemory(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::ptr<CellFontType> fontType, vm::ptr<CellFont> font)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED_FUNC(cellFont);
|
cellFont.Todo("cellFontOpenFontsetOnMemory()");
|
||||||
|
|
||||||
|
if (!s_fontInternalInstance->m_bInitialized)
|
||||||
|
{
|
||||||
|
return CELL_FONT_ERROR_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fontType->map != CELL_FONT_MAP_UNICODE)
|
||||||
|
{
|
||||||
|
cellFont.Warning("cellFontOpenFontset: Only Unicode is supported");
|
||||||
|
}
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,7 +632,7 @@ s32 cellFontGetCharGlyphMetricsVertical()
|
|||||||
|
|
||||||
Module cellFont("cellFont", []()
|
Module cellFont("cellFont", []()
|
||||||
{
|
{
|
||||||
s_fontInternalInstance = new CCellFontInternal();
|
s_fontInternalInstance = new CellFontInternal();
|
||||||
|
|
||||||
cellFont.on_stop = []()
|
cellFont.on_stop = []()
|
||||||
{
|
{
|
||||||
|
@ -50,74 +50,75 @@ struct CellFontMemoryInterface
|
|||||||
// Font Set Types
|
// Font Set Types
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN = 0x00000000,
|
CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN = 0x00000000,
|
||||||
CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN = 0x00000001,
|
CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN = 0x00000001,
|
||||||
CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN = 0x00000002,
|
CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN = 0x00000002,
|
||||||
CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN2 = 0x00000018,
|
CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN2 = 0x00000018,
|
||||||
CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN2 = 0x00000019,
|
CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN2 = 0x00000019,
|
||||||
CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN2 = 0x0000001a,
|
CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN2 = 0x0000001a,
|
||||||
CELL_FONT_TYPE_MATISSE_SERIF_LATIN = 0x00000020,
|
CELL_FONT_TYPE_MATISSE_SERIF_LATIN = 0x00000020,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_JAPANESE = 0x00000008,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_JAPANESE = 0x00000008,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_LIGHT_JAPANESE = 0x00000009,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_LIGHT_JAPANESE = 0x00000009,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_BOLD_JAPANESE = 0x0000000a,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_BOLD_JAPANESE = 0x0000000a,
|
||||||
CELL_FONT_TYPE_YD_GOTHIC_KOREAN = 0x0000000c,
|
CELL_FONT_TYPE_YD_GOTHIC_KOREAN = 0x0000000c,
|
||||||
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN = 0x00000040,
|
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN = 0x00000040,
|
||||||
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN2 = 0x00000041,
|
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN2 = 0x00000041,
|
||||||
CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND = 0x00000043,
|
CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND = 0x00000043,
|
||||||
CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND_LATIN2 = 0x00000044,
|
CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND_LATIN2 = 0x00000044,
|
||||||
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_JAPANESE = 0x00000048,
|
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_JAPANESE = 0x00000048,
|
||||||
|
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_JP_SET = 0x00000100,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_JP_SET = 0x00000100,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_LATIN_SET = 0x00000101,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_LATIN_SET = 0x00000101,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_SET = 0x00000104,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_SET = 0x00000104,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_SET = 0x00000204,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_SET = 0x00000204,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_SET = 0x00000201,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_SET = 0x00000201,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_SET = 0x00000108,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_SET = 0x00000108,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_RODIN_SET = 0x00000109,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_RODIN_SET = 0x00000109,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_RODIN2_SET = 0x00000209,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_RODIN2_SET = 0x00000209,
|
||||||
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_TCH_SET = 0x0000010a,
|
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_TCH_SET = 0x0000010a,
|
||||||
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN_TCH_SET = 0x0000010b,
|
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN_TCH_SET = 0x0000010b,
|
||||||
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN2_TCH_SET = 0x0000020b,
|
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN2_TCH_SET = 0x0000020b,
|
||||||
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_SCH_SET = 0x0000010c,
|
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_SCH_SET = 0x0000010c,
|
||||||
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN_SCH_SET = 0x0000010d,
|
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN_SCH_SET = 0x0000010d,
|
||||||
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN2_SCH_SET = 0x0000020d,
|
CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN2_SCH_SET = 0x0000020d,
|
||||||
|
|
||||||
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_RSANS_SET = 0x00300104,
|
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_RSANS_SET = 0x00300104,
|
||||||
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_RSANS_SET = 0x00300105,
|
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_RSANS_SET = 0x00300105,
|
||||||
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_JP_SET = 0x00300107,
|
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_JP_SET = 0x00300107,
|
||||||
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_YG_DFHEI5_RSANS_SET = 0x00300109,
|
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_YG_DFHEI5_RSANS_SET = 0x00300109,
|
||||||
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS_SET = 0x0030010F,
|
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS_SET = 0x0030010F,
|
||||||
CELL_FONT_TYPE_VAGR_SEURAT_CAPIE_MARU_GOTHIC_RSANS_SET = 0x00300124,
|
CELL_FONT_TYPE_VAGR_SEURAT_CAPIE_MARU_GOTHIC_RSANS_SET = 0x00300124,
|
||||||
CELL_FONT_TYPE_VAGR_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS_SET = 0x00300129,
|
CELL_FONT_TYPE_VAGR_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS_SET = 0x00300129,
|
||||||
|
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_LIGHT_SET = 0x00040100,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_LIGHT_SET = 0x00040100,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN_LIGHT_SET = 0x00040101,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN_LIGHT_SET = 0x00040101,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_LIGHT_SET = 0x00040201,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_LIGHT_SET = 0x00040201,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_LIGHT_SET = 0x00040104,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_LIGHT_SET = 0x00040104,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_LIGHT_SET = 0x00040204,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_LIGHT_SET = 0x00040204,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_BOLD_SET = 0x00070100,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_BOLD_SET = 0x00070100,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN_BOLD_SET = 0x00070101,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN_BOLD_SET = 0x00070101,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_BOLD_SET = 0x00070201,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_BOLD_SET = 0x00070201,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_BOLD_SET = 0x00070104,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_BOLD_SET = 0x00070104,
|
||||||
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_BOLD_SET = 0x00070204,
|
CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_BOLD_SET = 0x00070204,
|
||||||
|
|
||||||
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_RSANS2_SET = 0x00300204,
|
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_RSANS2_SET = 0x00300204,
|
||||||
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_RSANS2_SET = 0x00300205,
|
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_RSANS2_SET = 0x00300205,
|
||||||
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET = 0x00300209,
|
CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET = 0x00300209,
|
||||||
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET = 0x0030020F,
|
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET = 0x0030020F,
|
||||||
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_VAGR2_SET = 0x00300229,
|
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_VAGR2_SET = 0x00300229,
|
||||||
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_VAGR2_SET = 0x00300224,
|
CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_VAGR2_SET = 0x00300224,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CELL_FONT_MAP_FONT = 0,
|
CELL_FONT_MAP_FONT = 0,
|
||||||
CELL_FONT_MAP_UNICODE = 1,
|
CELL_FONT_MAP_UNICODE = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CellFontConfig
|
struct CellFontConfig
|
||||||
{
|
{
|
||||||
struct {
|
struct
|
||||||
|
{
|
||||||
be_t<u32> buffer_addr;
|
be_t<u32> buffer_addr;
|
||||||
be_t<u32> size;
|
be_t<u32> size;
|
||||||
} FileCache;
|
} FileCache;
|
||||||
@ -166,15 +167,21 @@ struct CellFontType
|
|||||||
struct CellFontInitGraphicsConfigGcm
|
struct CellFontInitGraphicsConfigGcm
|
||||||
{
|
{
|
||||||
be_t<u32> configType;
|
be_t<u32> configType;
|
||||||
struct {
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
be_t<u32> address;
|
be_t<u32> address;
|
||||||
be_t<u32> size;
|
be_t<u32> size;
|
||||||
} GraphicsMemory;
|
} GraphicsMemory;
|
||||||
struct {
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
be_t<u32> address;
|
be_t<u32> address;
|
||||||
be_t<u32> size;
|
be_t<u32> size;
|
||||||
} MappedMainMemory;
|
} MappedMainMemory;
|
||||||
struct {
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
be_t<s16> slotNumber;
|
be_t<s16> slotNumber;
|
||||||
be_t<s16> slotCount;
|
be_t<s16> slotCount;
|
||||||
} VertexShader;
|
} VertexShader;
|
||||||
@ -204,12 +211,16 @@ struct CellFontGlyphMetrics
|
|||||||
{
|
{
|
||||||
be_t<float> width;
|
be_t<float> width;
|
||||||
be_t<float> height;
|
be_t<float> height;
|
||||||
struct {
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
be_t<float> bearingX;
|
be_t<float> bearingX;
|
||||||
be_t<float> bearingY;
|
be_t<float> bearingY;
|
||||||
be_t<float> advance;
|
be_t<float> advance;
|
||||||
} Horizontal;
|
} Horizontal;
|
||||||
struct {
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
be_t<float> bearingX;
|
be_t<float> bearingX;
|
||||||
be_t<float> bearingY;
|
be_t<float> bearingY;
|
||||||
be_t<float> advance;
|
be_t<float> advance;
|
||||||
@ -244,14 +255,16 @@ struct CellFontRenderSurface
|
|||||||
be_t<u32> widthByte;
|
be_t<u32> widthByte;
|
||||||
be_t<u32> pixelSizeByte;
|
be_t<u32> pixelSizeByte;
|
||||||
be_t<u32> width, height;
|
be_t<u32> width, height;
|
||||||
struct {
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
be_t<u32> x0, y0;
|
be_t<u32> x0, y0;
|
||||||
be_t<u32> x1, y1;
|
be_t<u32> x1, y1;
|
||||||
} Scissor;
|
} Scissor;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Internal Datatypes
|
// Internal Datatypes
|
||||||
struct CCellFontInternal //Module cellFont
|
struct CellFontInternal //Module cellFont
|
||||||
{
|
{
|
||||||
u32 m_buffer_addr, m_buffer_size;
|
u32 m_buffer_addr, m_buffer_size;
|
||||||
u32 m_userFontEntrys_addr, m_userFontEntryMax;
|
u32 m_userFontEntrys_addr, m_userFontEntryMax;
|
||||||
@ -259,7 +272,7 @@ struct CCellFontInternal //Module cellFont
|
|||||||
bool m_bInitialized;
|
bool m_bInitialized;
|
||||||
bool m_bFontGcmInitialized;
|
bool m_bFontGcmInitialized;
|
||||||
|
|
||||||
CCellFontInternal()
|
CellFontInternal()
|
||||||
: m_buffer_addr(0)
|
: m_buffer_addr(0)
|
||||||
, m_buffer_size(0)
|
, m_buffer_size(0)
|
||||||
, m_bInitialized(false)
|
, m_bInitialized(false)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user