MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / OSLoadFont

Function OSLoadFont

src/dolphin/src/os/OSFont.c:418–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418u32 OSLoadFont(OSFontHeader* fontInfo, void* temp)
419{
420 u8* image;
421 u8* ptr;
422 int fontCodeT, sheet, numChars, row, column, x, y;
423
424 u32 fontSize = ReadFont(temp, OS_FONT_ENCODE_SJIS, NULL);
425 if (fontSize)
426 {
427 Decode(temp, (void*)fontInfo);
428 FontData = fontInfo;
429 WidthTable = (u8*)FontData + fontInfo->widthTable;
430 CharsInSheet = fontInfo->sheetColumn * fontInfo->sheetRow;
431 if (OSGetFontEncode() == OS_FONT_ENCODE_SJIS)
432 {
433 // what is this even doing
434
435 const u16 codes[4] = { 0x2ABE, 0x003D, 0x003D, 0x003D };
436
437 fontCodeT = GetFontCode('T'); // ????
438 sheet = fontCodeT / CharsInSheet;
439 numChars = fontCodeT - sheet * CharsInSheet;
440 row = numChars / FontData->sheetColumn;
441 column = numChars - row * FontData->sheetColumn;
442 row *= FontData->cellHeight;
443 column *= FontData->cellWidth;
444
445 image = (u8*)FontData + FontData->sheetImage;
446 image += sheet * FontData->sheetSize / 2;
447
448 for (y = 4; y < 8; y++)
449 {
450 x = 0;
451 ptr = image + (((FontData->sheetWidth / 8) * 32) / 2) * ((row + y) / 8);
452 ptr += 16 * ((column + x) / 8);
453 ptr += 2 * ((row + y) % 8);
454 ptr += ((column + x) % 8) / 4;
455
456 *(u16*)ptr = codes[y - 4];
457 }
458 }
459 }
460
461 return fontSize;
462}
463
464static void ExpandFontSheet(u8* source, u8* dest)
465{

Callers 1

OSInitFontFunction · 0.85

Calls 4

ReadFontFunction · 0.85
OSGetFontEncodeFunction · 0.85
GetFontCodeFunction · 0.85
DecodeFunction · 0.70

Tested by

no test coverage detected