cellCelp8Enc, cellCelpEnc module added

This commit is contained in:
Nekotekina 2015-07-29 15:57:46 +03:00
parent 06ef95fbea
commit 13a5a96117
8 changed files with 190 additions and 253 deletions

View file

@ -8,6 +8,8 @@ extern Module cellAtracMulti;
extern Module cellAudio; extern Module cellAudio;
extern Module cellAvconfExt; extern Module cellAvconfExt;
extern Module cellCamera; extern Module cellCamera;
extern Module cellCelp8Enc;
extern Module cellCelpEnc;
extern Module cellDmux; extern Module cellDmux;
extern Module cellFiber; extern Module cellFiber;
extern Module cellFont; extern Module cellFont;
@ -136,7 +138,7 @@ static const g_module_list[] =
{ 0x0045, "sceNpTus", &sceNpTus }, { 0x0045, "sceNpTus", &sceNpTus },
{ 0x0046, "cellVoice", &cellVoice }, { 0x0046, "cellVoice", &cellVoice },
{ 0x0047, "cellAdecCelp8", nullptr }, { 0x0047, "cellAdecCelp8", nullptr },
{ 0x0048, "cellCelp8Enc", nullptr }, { 0x0048, "cellCelp8Enc", &cellCelp8Enc },
{ 0x0049, "cellLicenseArea", nullptr }, { 0x0049, "cellLicenseArea", nullptr },
{ 0x004a, "cellMusic2", nullptr }, { 0x004a, "cellMusic2", nullptr },
{ 0x004e, "cellScreenShotUtility", &cellScreenshot }, { 0x004e, "cellScreenShotUtility", &cellScreenshot },
@ -149,7 +151,7 @@ static const g_module_list[] =
{ 0x0057, "cellRudp", &cellRudp }, { 0x0057, "cellRudp", &cellRudp },
{ 0x0059, "sceNpSns", &sceNpSns }, { 0x0059, "sceNpSns", &sceNpSns },
{ 0x005a, "libgem", &cellGem }, { 0x005a, "libgem", &cellGem },
{ 0xf00a, "cellCelpEnc", nullptr }, { 0xf00a, "cellCelpEnc", &cellCelpEnc },
{ 0xf010, "cellGifDec", &cellGifDec }, { 0xf010, "cellGifDec", &cellGifDec },
{ 0xf019, "cellAdecCelp", nullptr }, { 0xf019, "cellAdecCelp", nullptr },
{ 0xf01b, "cellAdecM2bc", nullptr }, { 0xf01b, "cellAdecM2bc", nullptr },

View file

@ -1,8 +1,9 @@
#include "stdafx.h" #include "stdafx.h"
#if 0 #include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/Modules.h"
void cellCelp8Enc_init(); extern Module cellCelp8Enc;
Module cellCelp8Enc(0x0048, cellCelp8Enc_init);
// Return Codes // Return Codes
enum enum
@ -15,61 +16,61 @@ enum
CELL_CELP8ENC_ERROR_CORE_ARG = 0x806140b3, CELL_CELP8ENC_ERROR_CORE_ARG = 0x806140b3,
}; };
int cellCelp8EncQueryAttr() s32 cellCelp8EncQueryAttr()
{ {
UNIMPLEMENTED_FUNC(cellCelp8Enc); UNIMPLEMENTED_FUNC(cellCelp8Enc);
return CELL_OK; return CELL_OK;
} }
int cellCelp8EncOpen() s32 cellCelp8EncOpen()
{ {
UNIMPLEMENTED_FUNC(cellCelp8Enc); UNIMPLEMENTED_FUNC(cellCelp8Enc);
return CELL_OK; return CELL_OK;
} }
int cellCelp8EncOpenEx() s32 cellCelp8EncOpenEx()
{ {
UNIMPLEMENTED_FUNC(cellCelp8Enc); UNIMPLEMENTED_FUNC(cellCelp8Enc);
return CELL_OK; return CELL_OK;
} }
int cellCelp8EncClose() s32 cellCelp8EncClose()
{ {
UNIMPLEMENTED_FUNC(cellCelp8Enc); UNIMPLEMENTED_FUNC(cellCelp8Enc);
return CELL_OK; return CELL_OK;
} }
int cellCelp8EncStart() s32 cellCelp8EncStart()
{ {
UNIMPLEMENTED_FUNC(cellCelp8Enc); UNIMPLEMENTED_FUNC(cellCelp8Enc);
return CELL_OK; return CELL_OK;
} }
int cellCelp8EncEnd() s32 cellCelp8EncEnd()
{ {
UNIMPLEMENTED_FUNC(cellCelp8Enc); UNIMPLEMENTED_FUNC(cellCelp8Enc);
return CELL_OK; return CELL_OK;
} }
int cellCelp8EncEncodeFrame() s32 cellCelp8EncEncodeFrame()
{ {
UNIMPLEMENTED_FUNC(cellCelp8Enc); UNIMPLEMENTED_FUNC(cellCelp8Enc);
return CELL_OK; return CELL_OK;
} }
int cellCelp8EncWaitForOutput() s32 cellCelp8EncWaitForOutput()
{ {
UNIMPLEMENTED_FUNC(cellCelp8Enc); UNIMPLEMENTED_FUNC(cellCelp8Enc);
return CELL_OK; return CELL_OK;
} }
int cellCelp8EncGetAu() s32 cellCelp8EncGetAu()
{ {
UNIMPLEMENTED_FUNC(cellCelp8Enc); UNIMPLEMENTED_FUNC(cellCelp8Enc);
return CELL_OK; return CELL_OK;
} }
void cellCelp8Enc_init() Module cellCelp8Enc("cellCelp8Enc", []()
{ {
REG_FUNC(cellCelp8Enc, cellCelp8EncQueryAttr); REG_FUNC(cellCelp8Enc, cellCelp8EncQueryAttr);
REG_FUNC(cellCelp8Enc, cellCelp8EncOpen); REG_FUNC(cellCelp8Enc, cellCelp8EncOpen);
@ -80,5 +81,4 @@ void cellCelp8Enc_init()
REG_FUNC(cellCelp8Enc, cellCelp8EncEncodeFrame); REG_FUNC(cellCelp8Enc, cellCelp8EncEncodeFrame);
REG_FUNC(cellCelp8Enc, cellCelp8EncWaitForOutput); REG_FUNC(cellCelp8Enc, cellCelp8EncWaitForOutput);
REG_FUNC(cellCelp8Enc, cellCelp8EncGetAu); REG_FUNC(cellCelp8Enc, cellCelp8EncGetAu);
} });
#endif

View file

@ -1,8 +1,9 @@
#include "stdafx.h" #include "stdafx.h"
#if 0 #include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/Modules.h"
void cellCelpEnc_init(); extern Module cellCelpEnc;
Module cellCelpEnc(0xf00a, cellCelpEnc_init);
// Return Codes // Return Codes
enum enum
@ -15,61 +16,61 @@ enum
CELL_CELPENC_ERROR_CORE_ARG = 0x80614083, CELL_CELPENC_ERROR_CORE_ARG = 0x80614083,
}; };
int cellCelpEncQueryAttr() s32 cellCelpEncQueryAttr()
{ {
UNIMPLEMENTED_FUNC(cellCelpEnc); UNIMPLEMENTED_FUNC(cellCelpEnc);
return CELL_OK; return CELL_OK;
} }
int cellCelpEncOpen() s32 cellCelpEncOpen()
{ {
UNIMPLEMENTED_FUNC(cellCelpEnc); UNIMPLEMENTED_FUNC(cellCelpEnc);
return CELL_OK; return CELL_OK;
} }
int cellCelpEncOpenEx() s32 cellCelpEncOpenEx()
{ {
UNIMPLEMENTED_FUNC(cellCelpEnc); UNIMPLEMENTED_FUNC(cellCelpEnc);
return CELL_OK; return CELL_OK;
} }
int cellCelpEncClose() s32 cellCelpEncClose()
{ {
UNIMPLEMENTED_FUNC(cellCelpEnc); UNIMPLEMENTED_FUNC(cellCelpEnc);
return CELL_OK; return CELL_OK;
} }
int cellCelpEncStart() s32 cellCelpEncStart()
{ {
UNIMPLEMENTED_FUNC(cellCelpEnc); UNIMPLEMENTED_FUNC(cellCelpEnc);
return CELL_OK; return CELL_OK;
} }
int cellCelpEncEnd() s32 cellCelpEncEnd()
{ {
UNIMPLEMENTED_FUNC(cellCelpEnc); UNIMPLEMENTED_FUNC(cellCelpEnc);
return CELL_OK; return CELL_OK;
} }
int cellCelpEncEncodeFrame() s32 cellCelpEncEncodeFrame()
{ {
UNIMPLEMENTED_FUNC(cellCelpEnc); UNIMPLEMENTED_FUNC(cellCelpEnc);
return CELL_OK; return CELL_OK;
} }
int cellCelpEncWaitForOutput() s32 cellCelpEncWaitForOutput()
{ {
UNIMPLEMENTED_FUNC(cellCelpEnc); UNIMPLEMENTED_FUNC(cellCelpEnc);
return CELL_OK; return CELL_OK;
} }
int cellCelpEncGetAu() s32 cellCelpEncGetAu()
{ {
UNIMPLEMENTED_FUNC(cellCelpEnc); UNIMPLEMENTED_FUNC(cellCelpEnc);
return CELL_OK; return CELL_OK;
} }
void cellCelpEnc_init() Module cellCelpEnc("cellCelpEnc", []()
{ {
REG_FUNC(cellCelpEnc, cellCelpEncQueryAttr); REG_FUNC(cellCelpEnc, cellCelpEncQueryAttr);
REG_FUNC(cellCelpEnc, cellCelpEncOpen); REG_FUNC(cellCelpEnc, cellCelpEncOpen);
@ -80,5 +81,4 @@ void cellCelpEnc_init()
REG_FUNC(cellCelpEnc, cellCelpEncEncodeFrame); REG_FUNC(cellCelpEnc, cellCelpEncEncodeFrame);
REG_FUNC(cellCelpEnc, cellCelpEncWaitForOutput); REG_FUNC(cellCelpEnc, cellCelpEncWaitForOutput);
REG_FUNC(cellCelpEnc, cellCelpEncGetAu); REG_FUNC(cellCelpEnc, cellCelpEncGetAu);
} });
#endif

View file

@ -8,19 +8,23 @@
extern Module cellFont; extern Module cellFont;
std::unique_ptr<CellFontInternal> g_font; struct font_instance_t
{
std::atomic<bool> init{ false };
}
g_font;
// Functions // Functions
s32 cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr<CellFontConfig> config) s32 cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr<CellFontConfig> config)
{ {
cellFont.Warning("cellFontInitializeWithRevision(revisionFlags=0x%llx, config=*0x%x)", revisionFlags, config); cellFont.Warning("cellFontInitializeWithRevision(revisionFlags=0x%llx, config=*0x%x)", revisionFlags, config);
if (g_font->m_bInitialized) if (g_font.init.load())
{ {
return CELL_FONT_ERROR_ALREADY_INITIALIZED; return CELL_FONT_ERROR_ALREADY_INITIALIZED;
} }
if (config->FileCache.size < 24) if (config->fc_size < 24)
{ {
return CELL_FONT_ERROR_INVALID_PARAMETER; return CELL_FONT_ERROR_INVALID_PARAMETER;
} }
@ -30,11 +34,11 @@ s32 cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr<CellFontConfig> co
cellFont.Error("cellFontInitializeWithRevision: Unknown flags (0x%x)", config->flags); cellFont.Error("cellFontInitializeWithRevision: Unknown flags (0x%x)", config->flags);
} }
g_font->m_buffer_addr = config->FileCache.buffer_addr; if (g_font.init.exchange(true))
g_font->m_buffer_size = config->FileCache.size; {
g_font->m_userFontEntrys_addr = config->userFontEntrys_addr; throw EXCEPTION("Unexpected");
g_font->m_userFontEntryMax = config->userFontEntryMax; }
g_font->m_bInitialized = true;
return CELL_OK; return CELL_OK;
} }
@ -44,11 +48,11 @@ s32 cellFontGetRevisionFlags(vm::ptr<u64> revisionFlags)
return CELL_OK; return CELL_OK;
} }
s32 cellFontInit(PPUThread& CPU, vm::ptr<CellFontConfig> config) s32 cellFontInit(PPUThread& ppu, vm::ptr<CellFontConfig> config)
{ {
cellFont.Warning("cellFontInit(config=*0x%x)", config); cellFont.Warning("cellFontInit(config=*0x%x)", config);
vm::stackvar<be_t<u64>> revisionFlags(CPU); vm::stackvar<be_t<u64>> revisionFlags(ppu);
revisionFlags.value() = 0; revisionFlags.value() = 0;
cellFontGetRevisionFlags(revisionFlags); cellFontGetRevisionFlags(revisionFlags);
@ -59,12 +63,15 @@ s32 cellFontEnd()
{ {
cellFont.Warning("cellFontEnd()"); cellFont.Warning("cellFontEnd()");
if (!g_font->m_bInitialized) if (!g_font.init.load())
{ {
return CELL_FONT_ERROR_UNINITIALIZED; return CELL_FONT_ERROR_UNINITIALIZED;
} }
g_font->m_bInitialized = false; if (!g_font.init.exchange(false))
{
throw EXCEPTION("Unexpected");
}
return CELL_OK; return CELL_OK;
} }
@ -79,7 +86,7 @@ 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 (!g_font->m_bInitialized) if (!g_font.init.load())
{ {
return CELL_FONT_ERROR_UNINITIALIZED; return CELL_FONT_ERROR_UNINITIALIZED;
} }
@ -115,11 +122,11 @@ s32 cellFontOpenFontFile(vm::ptr<CellFontLibrary> library, vm::cptr<char> fontPa
return ret; return ret;
} }
s32 cellFontOpenFontset(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::ptr<CellFontType> fontType, vm::ptr<CellFont> font) s32 cellFontOpenFontset(PPUThread& ppu, vm::ptr<CellFontLibrary> library, vm::ptr<CellFontType> fontType, vm::ptr<CellFont> font)
{ {
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 (!g_font->m_bInitialized) if (!g_font.init.load())
{ {
return CELL_FONT_ERROR_UNINITIALIZED; return CELL_FONT_ERROR_UNINITIALIZED;
} }
@ -195,7 +202,7 @@ s32 cellFontOpenFontset(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::pt
return CELL_FONT_ERROR_NO_SUPPORT_FONTSET; return CELL_FONT_ERROR_NO_SUPPORT_FONTSET;
} }
vm::stackvar<char> f(CPU, (u32)file.length() + 1, 1); vm::stackvar<char> f(ppu, (u32)file.length() + 1, 1);
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;
@ -227,7 +234,7 @@ s32 cellFontCreateRenderer(vm::ptr<CellFontLibrary> library, vm::ptr<CellFontRen
{ {
cellFont.Todo("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 (!g_font->m_bInitialized) if (!g_font.init.load())
{ {
return CELL_FONT_ERROR_UNINITIALIZED; return CELL_FONT_ERROR_UNINITIALIZED;
} }
@ -241,26 +248,21 @@ void cellFontRenderSurfaceInit(vm::ptr<CellFontRenderSurface> surface, vm::ptr<v
{ {
cellFont.Warning("cellFontRenderSurfaceInit(surface=*0x%x, buffer=*0x%x, bufferWidthByte=%d, pixelSizeByte=%d, w=%d, h=%d)", surface, buffer, bufferWidthByte, pixelSizeByte, w, h); cellFont.Warning("cellFontRenderSurfaceInit(surface=*0x%x, buffer=*0x%x, bufferWidthByte=%d, pixelSizeByte=%d, w=%d, h=%d)", surface, buffer, bufferWidthByte, pixelSizeByte, w, h);
surface->buffer_addr = buffer.addr(); surface->buffer = buffer;
surface->widthByte = bufferWidthByte; surface->widthByte = bufferWidthByte;
surface->pixelSizeByte = pixelSizeByte; surface->pixelSizeByte = pixelSizeByte;
surface->width = w; surface->width = w;
surface->height = h; surface->height = h;
if (!buffer)
{
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)
{ {
cellFont.Warning("cellFontRenderSurfaceSetScissor(surface=*0x%x, x0=%d, y0=%d, w=%d, h=%d)", surface, x0, y0, w, h); cellFont.Warning("cellFontRenderSurfaceSetScissor(surface=*0x%x, x0=%d, y0=%d, w=%d, h=%d)", surface, x0, y0, w, h);
surface->Scissor.x0 = x0; surface->sc_x0 = x0;
surface->Scissor.y0 = y0; surface->sc_y0 = y0;
surface->Scissor.x1 = w; surface->sc_x1 = w;
surface->Scissor.y1 = h; surface->sc_y1 = h;
} }
s32 cellFontSetScalePixel(vm::ptr<CellFont> font, float w, float h) s32 cellFontSetScalePixel(vm::ptr<CellFont> font, float w, float h)
@ -374,7 +376,7 @@ s32 cellFontRenderCharGlyphImage(vm::ptr<CellFont> font, u32 code, vm::ptr<CellF
baseLineY = (int)((float)ascent * scale); // ??? baseLineY = (int)((float)ascent * scale); // ???
// 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)
@ -457,12 +459,12 @@ s32 cellFontGetCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFo
// TODO: Add the rest of the information // TODO: Add the rest of the information
metrics->width = (x1-x0) * scale; metrics->width = (x1-x0) * scale;
metrics->height = (y1-y0) * scale; metrics->height = (y1-y0) * scale;
metrics->Horizontal.bearingX = (float)leftSideBearing * scale; metrics->h_bearingX = (float)leftSideBearing * scale;
metrics->Horizontal.bearingY = 0.f; metrics->h_bearingY = 0.f;
metrics->Horizontal.advance = (float)advanceWidth * scale; metrics->h_advance = (float)advanceWidth * scale;
metrics->Vertical.bearingX = 0.f; metrics->v_bearingX = 0.f;
metrics->Vertical.bearingY = 0.f; metrics->v_bearingY = 0.f;
metrics->Vertical.advance = 0.f; metrics->v_advance = 0.f;
return CELL_OK; return CELL_OK;
} }
@ -473,11 +475,11 @@ s32 cellFontGraphicsSetFontRGBA()
return CELL_OK; return CELL_OK;
} }
s32 cellFontOpenFontsetOnMemory(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::ptr<CellFontType> fontType, vm::ptr<CellFont> font) s32 cellFontOpenFontsetOnMemory(PPUThread& ppu, vm::ptr<CellFontLibrary> library, vm::ptr<CellFontType> fontType, vm::ptr<CellFont> font)
{ {
cellFont.Todo("cellFontOpenFontsetOnMemory(library=*0x%x, fontType=*0x%x, font=*0x%x)", library, fontType, font); cellFont.Todo("cellFontOpenFontsetOnMemory(library=*0x%x, fontType=*0x%x, font=*0x%x)", library, fontType, font);
if (!g_font->m_bInitialized) if (!g_font.init.load())
{ {
return CELL_FONT_ERROR_UNINITIALIZED; return CELL_FONT_ERROR_UNINITIALIZED;
} }
@ -632,7 +634,7 @@ s32 cellFontGetCharGlyphMetricsVertical()
Module cellFont("cellFont", []() Module cellFont("cellFont", []()
{ {
g_font = std::make_unique<CellFontInternal>(); g_font.init = false;
REG_FUNC(cellFont, cellFontInit); REG_FUNC(cellFont, cellFontInit);
REG_FUNC(cellFont, cellFontSetFontsetOpenMode); REG_FUNC(cellFont, cellFontSetFontsetOpenMode);

View file

@ -32,21 +32,6 @@ enum
CELL_FONT_ERROR_NO_SUPPORT_SURFACE = 0x80540040, CELL_FONT_ERROR_NO_SUPPORT_SURFACE = 0x80540040,
}; };
struct CellFontLibrary
{
u32 libraryType, libraryVersion;
//u32 SystemClosed[];
};
struct CellFontMemoryInterface
{
u32 Object_addr; //void*
//CellFontMallocCallback Malloc;
//CellFontFreeCallback Free;
//CellFontReallocCallback Realloc;
//CellFontCallocCallback Calloc;
};
// Font Set Types // Font Set Types
enum enum
{ {
@ -115,24 +100,6 @@ enum
CELL_FONT_MAP_UNICODE = 1, CELL_FONT_MAP_UNICODE = 1,
}; };
struct CellFontConfig
{
struct
{
be_t<u32> buffer_addr;
be_t<u32> size;
} FileCache;
be_t<u32> userFontEntryMax;
be_t<u32> userFontEntrys_addr;
be_t<u32> flags;
};
struct CellFontRenderer
{
void *systemReserved[64];
};
//Custom enum to determine the origin of a CellFont object //Custom enum to determine the origin of a CellFont object
enum enum
{ {
@ -142,20 +109,46 @@ enum
CELL_FONT_OPEN_MEMORY, CELL_FONT_OPEN_MEMORY,
}; };
struct stbtt_fontinfo;
struct CellFont using CellFontMallocCallback = vm::ptr<void>(vm::ptr<void> arg, u32 size);
using CellFontFreeCallback = void(vm::ptr<void> arg, vm::ptr<void> ptr);
using CellFontReallocCallback = vm::ptr<void>(vm::ptr<void> arg, vm::ptr<void> p, u32 reallocSize);
using CellFontCallocCallback = vm::ptr<void>(vm::ptr<void> arg, u32 num, u32 size);
struct CellFontMemoryInterface
{ {
//void* SystemReserved[64]; vm::bptr<void> arg;
be_t<float> scale_x; vm::bptr<CellFontMallocCallback> malloc;
be_t<float> scale_y; vm::bptr<CellFontFreeCallback> free;
be_t<float> slant; vm::bptr<CellFontReallocCallback> realloc;
be_t<u32> renderer_addr; vm::bptr<CellFontCallocCallback> calloc;
};
be_t<u32> fontdata_addr; struct CellFontEntry
be_t<u32> origin; {
stbtt_fontinfo* stbfont; be_t<u32> lock;
// hack: don't place anything after pointer be_t<u32> uniqueId;
vm::bcptr<void> fontLib;
vm::bptr<void> fontH;
};
struct CellFontConfig
{
// FileCache
vm::bptr<u32> fc_buffer;
be_t<u32> fc_size;
be_t<u32> userFontEntryMax;
vm::bptr<CellFontEntry> userFontEntrys;
be_t<u32> flags;
};
struct CellFontLibrary
{
be_t<u32> libraryType;
be_t<u32> libraryVersion;
// ...
}; };
struct CellFontType struct CellFontType
@ -164,119 +157,89 @@ struct CellFontType
be_t<u32> map; be_t<u32> map;
}; };
struct CellFontInitGraphicsConfigGcm
{
be_t<u32> configType;
struct
{
be_t<u32> address;
be_t<u32> size;
} GraphicsMemory;
struct
{
be_t<u32> address;
be_t<u32> size;
} MappedMainMemory;
struct
{
be_t<s16> slotNumber;
be_t<s16> slotCount;
} VertexShader;
};
struct CellFontGraphics
{
u32 graphicsType;
u32 SystemClosed_addr;
};
struct CellFontHorizontalLayout struct CellFontHorizontalLayout
{ {
be_t<float> baseLineY; be_t<f32> baseLineY;
be_t<float> lineHeight; be_t<f32> lineHeight;
be_t<float> effectHeight; be_t<f32> effectHeight;
}; };
struct CellFontVerticalLayout struct CellFontVerticalLayout
{ {
be_t<float> baseLineX; be_t<f32> baseLineX;
be_t<float> lineWidth; be_t<f32> lineWidth;
be_t<float> effectWidth; be_t<f32> effectWidth;
}; };
struct CellFontGlyphMetrics struct CellFontGlyphMetrics
{ {
be_t<float> width; be_t<f32> width;
be_t<float> height; be_t<f32> height;
struct be_t<f32> h_bearingX;
{ be_t<f32> h_bearingY;
be_t<float> bearingX; be_t<f32> h_advance;
be_t<float> bearingY;
be_t<float> advance;
} Horizontal;
struct be_t<f32> v_bearingX;
{ be_t<f32> v_bearingY;
be_t<float> bearingX; be_t<f32> v_advance;
be_t<float> bearingY;
be_t<float> advance;
} Vertical;
};
struct CellFontImageTransInfo
{
be_t<u32> Image_addr;
be_t<u32> imageWidthByte;
be_t<u32> imageWidth;
be_t<u32> imageHeight;
be_t<u32> Surface_addr;
be_t<u32> surfWidthByte;
};
struct CellFontRendererConfig
{
struct BufferingPolicy
{
be_t<u32> buffer;
be_t<u32> initSize;
be_t<u32> maxSize;
be_t<u32> expandSize;
be_t<u32> resetSize;
};
}; };
struct CellFontRenderSurface struct CellFontRenderSurface
{ {
be_t<u32> buffer_addr; vm::bptr<void> buffer;
be_t<u32> widthByte; be_t<s32> widthByte;
be_t<u32> pixelSizeByte; be_t<s32> pixelSizeByte;
be_t<u32> width, height; be_t<s32> width;
be_t<s32> height;
struct // Scissor
{ be_t<u32> sc_x0;
be_t<u32> x0, y0; be_t<u32> sc_y0;
be_t<u32> x1, y1; be_t<u32> sc_x1;
} Scissor; be_t<u32> sc_y1;
}; };
// Internal Datatypes struct CellFontImageTransInfo
struct CellFontInternal //Module cellFont
{ {
u32 m_buffer_addr, m_buffer_size; vm::bptr<u8> image;
u32 m_userFontEntrys_addr, m_userFontEntryMax; be_t<u32> imageWidthByte;
be_t<u32> imageWidth;
be_t<u32> imageHeight;
vm::bptr<void> surface;
be_t<u32> surfWidthByte;
};
bool m_bInitialized; struct CellFont
bool m_bFontGcmInitialized; {
be_t<float> scale_x;
be_t<float> scale_y;
be_t<float> slant;
be_t<u32> renderer_addr;
CellFontInternal() be_t<u32> fontdata_addr;
: m_buffer_addr(0) be_t<u32> origin;
, m_buffer_size(0) struct stbtt_fontinfo* stbfont;
, m_bInitialized(false) // hack: don't place anything after pointer
, m_bFontGcmInitialized(false) };
{
} struct CellFontRendererConfig
}; {
// Buffering Policy
vm::bptr<void> buffer;
be_t<u32> initSize;
be_t<u32> maxSize;
be_t<u32> expandSize;
be_t<u32> resetSize;
};
struct CellFontRenderer
{
void *systemReserved[64];
};
struct CellFontGraphics
{
be_t<u32> graphicsType;
// ...
};

View file

@ -2,20 +2,14 @@
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
#include "cellFont.h"
#include "cellFontFT.h" #include "cellFontFT.h"
extern Module cellFontFT; extern Module cellFontFT;
CCellFontFTInternal* s_fontFtInternalInstance = nullptr;
s32 cellFontInitLibraryFreeTypeWithRevision(u64 revisionFlags, vm::ptr<CellFontLibraryConfigFT> config, vm::pptr<CellFontLibrary> lib) s32 cellFontInitLibraryFreeTypeWithRevision(u64 revisionFlags, vm::ptr<CellFontLibraryConfigFT> config, vm::pptr<CellFontLibrary> lib)
{ {
cellFontFT.Warning("cellFontInitLibraryFreeTypeWithRevision(revisionFlags=0x%llx, config=*0x%x, lib=**0x%x)", revisionFlags, config, lib); cellFontFT.Warning("cellFontInitLibraryFreeTypeWithRevision(revisionFlags=0x%llx, config=*0x%x, lib=**0x%x)", revisionFlags, config, lib);
//if (s_fontInternalInstance->m_bInitialized)
//return CELL_FONT_ERROR_UNINITIALIZED;
lib->set(vm::alloc(sizeof(CellFontLibrary), vm::main)); lib->set(vm::alloc(sizeof(CellFontLibrary), vm::main));
return CELL_OK; return CELL_OK;
@ -35,13 +29,6 @@ s32 cellFontFTGetInitializedRevisionFlags()
Module cellFontFT("cellFontFT", []() Module cellFontFT("cellFontFT", []()
{ {
s_fontFtInternalInstance = new CCellFontFTInternal();
cellFontFT.on_stop = []()
{
delete s_fontFtInternalInstance;
};
REG_FUNC(cellFontFT, cellFontInitLibraryFreeTypeWithRevision); REG_FUNC(cellFontFT, cellFontInitLibraryFreeTypeWithRevision);
REG_FUNC(cellFontFT, cellFontFTGetRevisionFlags); REG_FUNC(cellFontFT, cellFontFTGetRevisionFlags);
REG_FUNC(cellFontFT, cellFontFTGetInitializedRevisionFlags); REG_FUNC(cellFontFT, cellFontFTGetInitializedRevisionFlags);

View file

@ -1,30 +1,13 @@
#pragma once #pragma once
#include "cellFont.h"
namespace vm { using namespace ps3; } namespace vm { using namespace ps3; }
struct CellFontLibraryConfigFT struct CellFontLibraryConfigFT
{ {
u32 library_addr; //void* vm::bptr<void> library;
CellFontMemoryInterface MemoryIF; CellFontMemoryInterface MemoryIF;
}; };
struct CellFontRendererConfigFT using CellFontRendererConfigFT = CellFontRendererConfig;
{
struct {
u32 buffer_addr; //void*
u32 initSize;
u32 maxSize;
u32 expandSize;
u32 resetSize;
} BufferingPolicy;
};
struct CCellFontFTInternal
{
bool m_bInitialized;
CCellFontFTInternal()
: m_bInitialized(false)
{
}
};

View file

@ -416,12 +416,6 @@
<ClCompile Include="Emu\SysCalls\Modules\cellBgdl.cpp"> <ClCompile Include="Emu\SysCalls\Modules\cellBgdl.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter> <Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellCelp8Enc.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellCelpEnc.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellHttpUtil.cpp"> <ClCompile Include="Emu\SysCalls\Modules\cellHttpUtil.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter> <Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile> </ClCompile>
@ -887,6 +881,12 @@
<ClCompile Include="Emu\SysCalls\Modules\cellAtracMulti.cpp"> <ClCompile Include="Emu\SysCalls\Modules\cellAtracMulti.cpp">
<Filter>Emu\SysCalls\Modules</Filter> <Filter>Emu\SysCalls\Modules</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellCelp8Enc.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellCelpEnc.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Crypto\aes.h"> <ClInclude Include="Crypto\aes.h">