diff --git a/res/font2x.png b/res/font2x.png new file mode 100644 index 000000000..de460ee4a Binary files /dev/null and b/res/font2x.png differ diff --git a/src/platform/psp2/CMakeLists.txt b/src/platform/psp2/CMakeLists.txt index 02c3683db..cc1dfc01e 100644 --- a/src/platform/psp2/CMakeLists.txt +++ b/src/platform/psp2/CMakeLists.txt @@ -25,7 +25,7 @@ set_target_properties(${BINARY_NAME}.elf PROPERTIES COMPILE_DEFINITIONS "${OS_DE target_link_libraries(${BINARY_NAME}.elf ${BINARY_NAME} ${OS_LIB}) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/font.o - COMMAND ${OBJCOPY_CMD} font.png ${CMAKE_CURRENT_BINARY_DIR}/font.o + COMMAND ${OBJCOPY_CMD} font2x.png ${CMAKE_CURRENT_BINARY_DIR}/font.o WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/res) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o diff --git a/src/platform/psp2/gui-font.c b/src/platform/psp2/gui-font.c index 92145d548..d3c5ccb87 100644 --- a/src/platform/psp2/gui-font.c +++ b/src/platform/psp2/gui-font.c @@ -8,11 +8,11 @@ #include -#define CELL_HEIGHT 16 -#define CELL_WIDTH 16 -#define GLYPH_HEIGHT 12 +#define CELL_HEIGHT 32 +#define CELL_WIDTH 32 +#define GLYPH_HEIGHT 24 -extern const uint8_t _binary_font_png_start[]; +extern const uint8_t _binary_font2x_png_start[]; struct GUIFont { vita2d_texture* tex; @@ -23,7 +23,7 @@ struct GUIFont* GUIFontCreate(void) { if (!font) { return 0; } - font->tex = vita2d_load_PNG_buffer(_binary_font_png_start); + font->tex = vita2d_load_PNG_buffer(_binary_font2x_png_start); return font; } @@ -34,7 +34,7 @@ void GUIFontDestroy(struct GUIFont* font) { unsigned GUIFontHeight(const struct GUIFont* font) { UNUSED(font); - return GLYPH_HEIGHT * 2; + return GLYPH_HEIGHT; } unsigned GUIFontGlyphWidth(const struct GUIFont* font, uint32_t glyph) { @@ -50,10 +50,10 @@ void GUIFontDrawGlyph(const struct GUIFont* font, int x, int y, uint32_t color, glyph = '?'; } struct GUIFontGlyphMetric metric = defaultFontMetrics[glyph]; - vita2d_draw_texture_tint_part_scale(font->tex, x, y + (-GLYPH_HEIGHT + metric.padding.top) * 2, - (glyph & 15) * CELL_WIDTH + metric.padding.left, - (glyph >> 4) * CELL_HEIGHT + metric.padding.top, - CELL_WIDTH - (metric.padding.left + metric.padding.right), - CELL_HEIGHT - (metric.padding.top + metric.padding.bottom), - 2, 2, color); + vita2d_draw_texture_tint_part_scale(font->tex, x, y - GLYPH_HEIGHT + metric.padding.top * 2, + (glyph & 15) * CELL_WIDTH + metric.padding.left * 2, + (glyph >> 4) * CELL_HEIGHT + metric.padding.top * 2, + CELL_WIDTH - (metric.padding.left + metric.padding.right) * 2, + CELL_HEIGHT - (metric.padding.top + metric.padding.bottom) * 2, + 1, 1, color); } diff --git a/src/platform/wii/CMakeLists.txt b/src/platform/wii/CMakeLists.txt index fb6bc9385..7e50df6d7 100644 --- a/src/platform/wii/CMakeLists.txt +++ b/src/platform/wii/CMakeLists.txt @@ -24,6 +24,7 @@ target_link_libraries(${BINARY_NAME}.elf ${BINARY_NAME} ${OS_LIB}) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/font.c COMMAND ${RAW2C} ${CMAKE_SOURCE_DIR}/src/platform/wii/font.tpl + MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/src/platform/wii/font.tpl WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_custom_target(${BINARY_NAME}.dol ALL diff --git a/src/platform/wii/font.tpl b/src/platform/wii/font.tpl index 5a3b14047..ec3f8cdaf 100644 Binary files a/src/platform/wii/font.tpl and b/src/platform/wii/font.tpl differ diff --git a/src/platform/wii/gui-font.c b/src/platform/wii/gui-font.c index 65b672b13..1efe09e4e 100644 --- a/src/platform/wii/gui-font.c +++ b/src/platform/wii/gui-font.c @@ -10,9 +10,9 @@ #include #include -#define GLYPH_HEIGHT 12 -#define CELL_HEIGHT 16 -#define CELL_WIDTH 16 +#define GLYPH_HEIGHT 24 +#define CELL_HEIGHT 32 +#define CELL_WIDTH 32 struct GUIFont { TPLFile tdf; @@ -50,7 +50,7 @@ unsigned GUIFontGlyphWidth(const struct GUIFont* font, uint32_t glyph) { if (glyph > 0x7F) { glyph = '?'; } - return defaultFontMetrics[glyph].width; + return defaultFontMetrics[glyph].width * 2; } void GUIFontDrawGlyph(const struct GUIFont* font, int x, int y, uint32_t color, uint32_t glyph) { @@ -69,23 +69,23 @@ void GUIFontDrawGlyph(const struct GUIFont* font, int x, int y, uint32_t color, glyph = '?'; } struct GUIFontGlyphMetric metric = defaultFontMetrics[glyph]; - s16 tx = (glyph & 15) * CELL_WIDTH + metric.padding.left; - s16 ty = (glyph >> 4) * CELL_HEIGHT + metric.padding.top; + s16 tx = (glyph & 15) * CELL_WIDTH + metric.padding.left * 2; + s16 ty = (glyph >> 4) * CELL_HEIGHT + metric.padding.top * 2; GX_Begin(GX_QUADS, GX_VTXFMT0, 4); - GX_Position2s16(x, y - GLYPH_HEIGHT + metric.padding.top); + GX_Position2s16(x, y - GLYPH_HEIGHT + metric.padding.top * 2); GX_Color1u32(color); - GX_TexCoord2f32(tx / 256.f, ty / 128.f); + GX_TexCoord2f32(tx / 512.f, ty / 256.f); - GX_Position2s16(x + CELL_WIDTH - (metric.padding.left + metric.padding.right), y - GLYPH_HEIGHT + metric.padding.top); + GX_Position2s16(x + CELL_WIDTH - (metric.padding.left + metric.padding.right) * 2, y - GLYPH_HEIGHT + metric.padding.top * 2); GX_Color1u32(color); - GX_TexCoord2f32((tx + CELL_WIDTH - (metric.padding.left + metric.padding.right)) / 256.f, ty / 128.f); + GX_TexCoord2f32((tx + CELL_WIDTH - (metric.padding.left + metric.padding.right) * 2) / 512.f, ty / 256.f); - GX_Position2s16(x + CELL_WIDTH - (metric.padding.left + metric.padding.right), y - GLYPH_HEIGHT + CELL_HEIGHT - metric.padding.bottom); + GX_Position2s16(x + CELL_WIDTH - (metric.padding.left + metric.padding.right) * 2, y - GLYPH_HEIGHT + CELL_HEIGHT - metric.padding.bottom * 2); GX_Color1u32(color); - GX_TexCoord2f32((tx + CELL_WIDTH - (metric.padding.left + metric.padding.right)) / 256.f, (ty + CELL_HEIGHT - (metric.padding.top + metric.padding.bottom)) / 128.f); + GX_TexCoord2f32((tx + CELL_WIDTH - (metric.padding.left + metric.padding.right) * 2) / 512.f, (ty + CELL_HEIGHT - (metric.padding.top + metric.padding.bottom) * 2) / 256.f); - GX_Position2s16(x, y - GLYPH_HEIGHT + CELL_HEIGHT - metric.padding.bottom); + GX_Position2s16(x, y - GLYPH_HEIGHT + CELL_HEIGHT - metric.padding.bottom * 2); GX_Color1u32(color); - GX_TexCoord2f32(tx / 256.f, (ty + CELL_HEIGHT - (metric.padding.top + metric.padding.bottom)) / 128.f); + GX_TexCoord2f32(tx / 512.f, (ty + CELL_HEIGHT - (metric.padding.top + metric.padding.bottom) * 2) / 256.f); GX_End(); } diff --git a/src/platform/wii/main.c b/src/platform/wii/main.c index 801c9f67d..2d0e28e5a 100644 --- a/src/platform/wii/main.c +++ b/src/platform/wii/main.c @@ -196,7 +196,7 @@ int main() { struct GBAGUIRunner runner = { .params = { - vmode->fbWidth * 0.9, vmode->efbHeight * 0.9, + vmode->fbWidth * 1.6, vmode->efbHeight * 1.6, font, "", _drawStart, _drawEnd, _pollInput, _pollCursor, @@ -374,21 +374,22 @@ void _reproj(int w, int h) { GX_LoadProjectionMtx(proj, GX_ORTHOGRAPHIC); } +void _reproj2(int w, int h) { + Mtx44 proj; + s16 top = 20; + guOrtho(proj, -top, top + h, 0, w, 0, 300); + GX_LoadProjectionMtx(proj, GX_ORTHOGRAPHIC); +} + void _guiPrepare(void) { - int w = vmode->fbWidth * 0.9; - int h = vmode->efbHeight * 0.9; - _reproj(w, h); + _reproj2(vmode->fbWidth * 1.6, vmode->efbHeight * 1.6); } void _guiFinish(void) { if (screenMode == SM_PA) { _reproj(VIDEO_HORIZONTAL_PIXELS * scaleFactor, VIDEO_VERTICAL_PIXELS * scaleFactor); } else { - Mtx44 proj; - short top = (CONF_GetAspectRatio() == CONF_ASPECT_16_9) ? 10 : 20; - short bottom = VIDEO_VERTICAL_PIXELS + top; - guOrtho(proj, -top, bottom, 0, VIDEO_HORIZONTAL_PIXELS, 0, 300); - GX_LoadProjectionMtx(proj, GX_ORTHOGRAPHIC); + _reproj2(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS); } }