| 150 | } |
| 151 | |
| 152 | error_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 | |
| 195 | error_code cellFontOpenFontset(vm::ptr<CellFontLibrary> library, vm::ptr<CellFontType> fontType, vm::ptr<CellFont> font) |
| 196 | { |
no test coverage detected