Skip to content

Commit

Permalink
Merge pull request #518 from Wryyyong/patch-1
Browse files Browse the repository at this point in the history
Very minor fix for libctru 1.6.0 compatibility
  • Loading branch information
Steveice10 authored Oct 23, 2019
2 parents 5e09243 + 71947a7 commit 5ffcc4c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions source/core/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void screen_init() {
return;
}

TGLP_s* glyphInfo = fontGetGlyphInfo();
TGLP_s* glyphInfo = fontGetGlyphInfo(NULL);

glyph_count = glyphInfo->nSheets;
glyph_sheets = calloc(glyph_count, sizeof(C3D_Tex));
Expand All @@ -148,7 +148,7 @@ void screen_init() {

for(int i = 0; i < glyph_count; i++) {
C3D_Tex* tex = &glyph_sheets[i];
tex->data = fontGetGlyphSheetTex(i);
tex->data = fontGetGlyphSheetTex(NULL, i);
tex->fmt = (GPU_TEXCOLOR) glyphInfo->sheetFmt;
tex->size = glyphInfo->sheetSize;
tex->width = glyphInfo->sheetWidth;
Expand Down Expand Up @@ -491,7 +491,7 @@ void screen_draw_texture_crop(u32 id, float x, float y, float width, float heigh
}

float screen_get_font_height(float scaleY) {
return scaleY * fontGetInfo()->lineFeed;
return scaleY * fontGetInfo(NULL)->lineFeed;
}

#define MAX_LINES 64
Expand Down Expand Up @@ -558,12 +558,12 @@ static void screen_wrap_string(u32* lines, float* lineWidths, float* lineHeights
lastAlignPos = linePos;
}

charWidth *= scaleX * fontGetCharWidthInfo(fontGlyphIndexFromCodePoint(code))->charWidth;
charWidth *= scaleX * fontGetCharWidthInfo(NULL, fontGlyphIndexFromCodePoint(NULL, code))->charWidth;

if(code == '\n' || (wordWrap && lw + charWidth >= maxWidth)) {
if(code == '\n') {
linePos++;
lh = scaleY * fontGetInfo()->lineFeed;
lh = scaleY * fontGetInfo(NULL)->lineFeed;
}

u32 oldLinePos = linePos;
Expand Down Expand Up @@ -600,7 +600,7 @@ static void screen_wrap_string(u32* lines, float* lineWidths, float* lineHeights
}

lw += charWidth;
lh = scaleY * fontGetInfo()->lineFeed;
lh = scaleY * fontGetInfo(NULL)->lineFeed;

linePos++;
}
Expand Down Expand Up @@ -692,10 +692,10 @@ static void screen_draw_string_internal(const char* text, float x, float y, floa
}

fontGlyphPos_s data;
fontCalcGlyphPos(&data, fontGlyphIndexFromCodePoint(code), GLYPH_POS_CALC_VTXCOORD, scaleX * font_scale, scaleY * font_scale);
fontCalcGlyphPos(&data, NULL, fontGlyphIndexFromCodePoint(NULL, code), GLYPH_POS_CALC_VTXCOORD, scaleX * font_scale, scaleY * font_scale);

if(data.sheetIndex >= glyph_count) {
fontCalcGlyphPos(&data, fontGlyphIndexFromCodePoint(0xFFFD), GLYPH_POS_CALC_VTXCOORD, scaleX * font_scale, scaleY * font_scale);
fontCalcGlyphPos(&data, NULL, fontGlyphIndexFromCodePoint(NULL, 0xFFFD), GLYPH_POS_CALC_VTXCOORD, scaleX * font_scale, scaleY * font_scale);
}

if(data.sheetIndex < glyph_count && data.sheetIndex != lastSheet) {
Expand Down

0 comments on commit 5ffcc4c

Please sign in to comment.