MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / cellFontOpenFontFile

Function cellFontOpenFontFile

ps3fw/cellFont.cpp:152–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152error_code cellFontOpenFontFile(vm::ptr<CellFontLibrary> library, vm::cptr<char> fontPath, u32 subNum, s32 uniqueId, vm::ptr<CellFont> font)
153{
154 cellFont.todo("cellFontOpenFontFile(library=*0x%x, fontPath=%s, subNum=%d, uniqueId=%d, font=*0x%x)", library, fontPath, subNum, uniqueId, font);
155
156 if (!font)
157 {
158 return CELL_FONT_ERROR_INVALID_PARAMETER;
159 }
160
161 // TODO: reset some font fields here
162
163 if (!library)
164 {
165 return CELL_FONT_ERROR_INVALID_PARAMETER;
166 }
167
168 if (false) // TODO
169 {
170 return CELL_FONT_ERROR_UNINITIALIZED;
171 }
172
173 if (!fontPath || uniqueId < 0)
174 {
175 return CELL_FONT_ERROR_INVALID_PARAMETER;
176 }
177
178 // TODO
179
180 fs::file f(vfs::get(fontPath.get_ptr()));
181 if (!f)
182 {
183 return CELL_FONT_ERROR_FONT_OPEN_FAILED;
184 }
185
186 u32 fileSize = ::size32(f);
187 u32 bufferAddr = vm::alloc(fileSize, vm::main); // Freed in cellFontCloseFont
188 f.read(vm::base(bufferAddr), fileSize);
189 s32 ret = cellFontOpenFontMemory(library, bufferAddr, fileSize, subNum, uniqueId, font);
190 font->origin = CELL_FONT_OPEN_FONT_FILE;
191
192 return ret;
193}
194
195error_code cellFontOpenFontset(vm::ptr<CellFontLibrary> library, vm::ptr<CellFontType> fontType, vm::ptr<CellFont> font)
196{

Callers 1

cellFontOpenFontsetFunction · 0.85

Calls 7

getFunction · 0.85
size32Function · 0.85
allocFunction · 0.85
baseFunction · 0.85
cellFontOpenFontMemoryFunction · 0.85
get_ptrMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected