diff --git a/data/dynos.cpp.h b/data/dynos.cpp.h index dad094d2a..720da5ab7 100644 --- a/data/dynos.cpp.h +++ b/data/dynos.cpp.h @@ -291,44 +291,20 @@ public: inline bool Empty() const { return mCount == 0; } public: - bool operator==(const char *aString) const { - if (strlen(aString) != mCount) return false; - for (u8 i = 0; i != mCount; ++i) { - if (aString[i] != mBuffer[i]) { - return false; - } - } - return true; + bool OPTIMIZE_O3 operator==(const char *aString) const { + return !strcmp(mBuffer, aString); } - bool operator==(const String &aOther) const { - if (aOther.mCount != mCount) return false; - for (u8 i = 0; i != mCount; ++i) { - if (aOther.mBuffer[i] != mBuffer[i]) { - return false; - } - } - return true; + bool OPTIMIZE_O3 operator==(const String &aOther) const { + return !strcmp(mBuffer, aOther.mBuffer); } - bool operator!=(const char *aString) const { - if (strlen(aString) != mCount) return true; - for (u8 i = 0; i != mCount; ++i) { - if (aString[i] != mBuffer[i]) { - return true; - } - } - return false; + bool OPTIMIZE_O3 operator!=(const char *aString) const { + return strcmp(mBuffer, aString); } - bool operator!=(const String &aOther) const { - if (aOther.mCount != mCount) return true; - for (u8 i = 0; i != mCount; ++i) { - if (aOther.mBuffer[i] != mBuffer[i]) { - return true; - } - } - return false; + bool OPTIMIZE_O3 operator!=(const String &aOther) const { + return strcmp(mBuffer, aOther.mBuffer); } public: diff --git a/src/pc/djui/djui_font.c b/src/pc/djui/djui_font.c index 6e8a36de3..68a0b9070 100644 --- a/src/pc/djui/djui_font.c +++ b/src/pc/djui/djui_font.c @@ -12,18 +12,20 @@ static Vtx djui_font_normal_vertices[] = { {{{ 0, 0, 0}, 0, { 512, 256}, { 0xff, 0xff, 0xff, 0xff }}}, }; -const Gfx dl_font_normal_display_list[] = { +const Gfx dl_font_normal_display_list_begin[] = { gsDPPipeSync(), gsSPClearGeometryMode(G_LIGHTING), gsDPSetCombineMode(G_CC_FADEA, G_CC_FADEA), gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2), gsDPSetTextureFilter(G_TF_POINT), gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON), - gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, 3, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 4, G_TX_NOLOD), - gsDPLoadSync(), - gsDPLoadBlock(G_TX_LOADTILE, 0, 0, ((16 * 8 + G_IM_SIZ_4b_INCR) >> G_IM_SIZ_4b_SHIFT) - 1, CALC_DXT(16, G_IM_SIZ_4b_BYTES)), gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_4b, 1, 0, G_TX_RENDERTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, 3, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 4, G_TX_NOLOD), gsDPSetTileSize(0, 0, 0, (16 - 1) << G_TEXTURE_IMAGE_FRAC, (8 - 1) << G_TEXTURE_IMAGE_FRAC), + gsSPEndDisplayList(), +}; + +const Gfx dl_font_normal_display_list[] = { + gsDPLoadBlock(G_TX_LOADTILE, 0, 0, ((16 * 8 + G_IM_SIZ_4b_INCR) >> G_IM_SIZ_4b_SHIFT) - 1, CALC_DXT(16, G_IM_SIZ_4b_BYTES)), gsSPVertex(djui_font_normal_vertices, 4, 0), gsSPExecuteDjui(G_TEXCLIP_DJUI), gsSP2Triangles(0, 1, 2, 0x0, 0, 2, 3, 0x0), @@ -54,7 +56,7 @@ static const struct DjuiFont sDjuiFontNormal = { .lineHeight = 0.8125f, .defaultFontScale = 32.0f, .rotatedUV = true, - .textBeginDisplayList = NULL, + .textBeginDisplayList = dl_font_normal_display_list_begin, .render_char = djui_font_normal_render_char, .char_width = djui_font_normal_char_width, }; diff --git a/src/pc/gfx/gfx_pc.c b/src/pc/gfx/gfx_pc.c index 6d745b493..b3447c0a7 100644 --- a/src/pc/gfx/gfx_pc.c +++ b/src/pc/gfx/gfx_pc.c @@ -1866,7 +1866,7 @@ static uint32_t sDjuiOverrideW = 0; static uint32_t sDjuiOverrideH = 0; static uint32_t sDjuiOverrideB = 0; -static void djui_gfx_dp_execute_clipping(void) { +static void OPTIMIZE_O3 djui_gfx_dp_execute_clipping(void) { if (!sDjuiClip) { return; } sDjuiClip = false; @@ -1941,7 +1941,7 @@ static void djui_gfx_dp_execute_clipping(void) { } } -static void djui_gfx_dp_execute_override(void) { +static void OPTIMIZE_O3 djui_gfx_dp_execute_override(void) { if (!sDjuiOverride) { return; } sDjuiOverride = false; @@ -1974,14 +1974,14 @@ static void djui_gfx_dp_execute_override(void) { rdp.textures_changed[1] = true; } -static void djui_gfx_dp_execute_djui(uint32_t opcode) { +static void OPTIMIZE_O3 djui_gfx_dp_execute_djui(uint32_t opcode) { switch (opcode) { case G_TEXOVERRIDE_DJUI: djui_gfx_dp_execute_override(); break; case G_TEXCLIP_DJUI: djui_gfx_dp_execute_clipping(); break; } } -static void djui_gfx_dp_set_clipping(bool rotatedUV, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) { +static void OPTIMIZE_O3 djui_gfx_dp_set_clipping(bool rotatedUV, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) { sDjuiClipRotatedUV = rotatedUV; sDjuiClipX1 = x1; sDjuiClipY1 = y1; @@ -1990,7 +1990,7 @@ static void djui_gfx_dp_set_clipping(bool rotatedUV, uint32_t x1, uint32_t y1, u sDjuiClip = true; } -static void djui_gfx_dp_set_override(void* texture, uint32_t w, uint32_t h, uint32_t b) { +static void OPTIMIZE_O3 djui_gfx_dp_set_override(void* texture, uint32_t w, uint32_t h, uint32_t b) { sDjuiOverrideTexture = texture; sDjuiOverrideW = w; sDjuiOverrideH = h; @@ -1998,7 +1998,7 @@ static void djui_gfx_dp_set_override(void* texture, uint32_t w, uint32_t h, uint sDjuiOverride = (texture != NULL); } -void djui_gfx_run_dl(Gfx* cmd) { +void OPTIMIZE_O3 djui_gfx_run_dl(Gfx* cmd) { uint32_t opcode = cmd->words.w0 >> 24; switch (opcode) { case G_TEXCLIP_DJUI: