From ef64163e576b0a1448a48405ffc7ee93179048fe Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 28 Nov 2023 19:25:00 +1100 Subject: [PATCH] N64: Text sometimes works --- src/Graphics_N64.c | 8 ++++---- src/Platform_N64.c | 12 ++++++++++-- src/SystemFonts.c | 1 + src/Window_N64.c | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/Graphics_N64.c b/src/Graphics_N64.c index 317352247..b705b919a 100644 --- a/src/Graphics_N64.c +++ b/src/Graphics_N64.c @@ -7,7 +7,6 @@ #include #include #include -#include typedef void (*GL_SetupVBFunc)(void); typedef void (*GL_SetupVBRangeFunc)(int startVertex); @@ -29,8 +28,9 @@ void Gfx_Create(void) { //rdpq_debug_log(true); zbuffer = surface_alloc(FMT_RGBA16, display_get_width(), display_get_height()); - Gfx.MaxTexWidth = 32; - Gfx.MaxTexHeight = 32; + Gfx.MaxTexWidth = 128; + Gfx.MaxTexHeight = 128; + Gfx.MaxTexSize = 1024; // TMEM only has 4 KB in it Gfx.Created = true; Gfx_RestoreState(); @@ -219,7 +219,7 @@ static void Gfx_RestoreState(void) { glHint(GL_FOG_HINT, GL_NICEST); glAlphaFunc(GL_GREATER, 0.5f); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDepthFunc(GL_LESS); + glDepthFunc(GL_LESS_INTERPENETRATING_N64); //glEnable(GL_RDPQ_TEXTURING_N64); } diff --git a/src/Platform_N64.c b/src/Platform_N64.c index f01585cfd..a42bb7c4c 100644 --- a/src/Platform_N64.c +++ b/src/Platform_N64.c @@ -7,6 +7,7 @@ #include "Window.h" #include "Utils.h" #include "Errors.h" +#include "Options.h" #include #include @@ -114,10 +115,14 @@ cc_result File_Open(cc_file* file, const cc_string* path) { return File_Do(file, path); } cc_result File_Create(cc_file* file, const cc_string* path) { - return File_Do(file, path); + *file = -1; + return ERR_NOT_SUPPORTED; + //return File_Do(file, path); } cc_result File_OpenOrCreate(cc_file* file, const cc_string* path) { - return File_Do(file, path); + *file = -1; + return ERR_NOT_SUPPORTED; + //return File_Do(file, path); } cc_result File_Read(cc_file file, void* data, cc_uint32 count, cc_uint32* bytesRead) { @@ -248,6 +253,9 @@ void Platform_Init(void) { debug_init_isviewer(); debug_init_usblog(); + // TODO: Redesign Drawer2D to better handle this + Options_SetBool(OPT_USE_CHAT_FONT, true); + //console_init(); //console_set_render_mode(RENDER_AUTOMATIC); //console_set_debug(true); diff --git a/src/SystemFonts.c b/src/SystemFonts.c index 0f0ddffa8..3275d0ef7 100644 --- a/src/SystemFonts.c +++ b/src/SystemFonts.c @@ -841,6 +841,7 @@ const cc_string* SysFonts_UNSAFE_GetDefault(void) { return &String_Empty; } void SysFonts_GetNames(struct StringsBuffer* buffer) { } cc_result SysFont_Make(struct FontDesc* desc, const cc_string* fontName, int size, int flags) { + size *= DisplayInfo.ScaleY; /* Round upwards to nearest 8 */ size = (size + 7) & ~0x07; diff --git a/src/Window_N64.c b/src/Window_N64.c index cde1283cc..ead413380 100644 --- a/src/Window_N64.c +++ b/src/Window_N64.c @@ -27,8 +27,8 @@ void Window_Init(void) { DisplayInfo.Width = display_get_width(); DisplayInfo.Height = display_get_height(); DisplayInfo.Depth = 4; // 32 bit - DisplayInfo.ScaleX = 1; - DisplayInfo.ScaleY = 1; + DisplayInfo.ScaleX = 0.5f; + DisplayInfo.ScaleY = 0.5f; WindowInfo.Width = DisplayInfo.Width; WindowInfo.Height = DisplayInfo.Height;