summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFranklin Wei <franklin@rockbox.org>2020-07-07 17:23:05 -0400
committerFranklin Wei <franklin@rockbox.org>2020-07-07 21:25:27 +0000
commit4dcd1a9ed8638f248f4e7c650300a531a608b7a4 (patch)
tree58378abefb845092ee9b99f2ba25396dec9b9501
parentc0276c83524773e5a64d85936f924e7d85142131 (diff)
downloadrockbox-4dcd1a9.tar.gz
rockbox-4dcd1a9.tar.bz2
rockbox-4dcd1a9.zip
puzzles: load cached fonts unconditionally
This works around an odd issue in Mines involving the zoom feature. The chain of events leading to it is rather convoluted: 1. No save game is found, so no fonts are loaded from disk. 2. A new game is started. 3. The user selects the "Zoom" option. 4. The allocation of the zoom framebuffer causes the malloc code to grab the audiobuffer. This causes all further font_load() calls to FAIL, due to buflib allocations no longer working. 5. The user goes back to the normal view and uncovers a square. 6. Font loading fails, causing the drawing code to fall back to the system font. 7. An unrelated bug (not yet tracked down) causes font_get(FONT_UI) to return a different font. 8. font_getstringsize() returns the right size of the "wrong" font, leading to centering issues upon rb_draw_text(). The real solution to this would be to fix font_get(), but this fix should prevent the issue from happening if Mines has been run and saved at least once before. Change-Id: Ib9ad51376eeb3ca1113a1f3786124b612db88cd7
-rw-r--r--apps/plugins/puzzles/rockbox.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c
index 51b5e0890b..cb357ac313 100644
--- a/apps/plugins/puzzles/rockbox.c
+++ b/apps/plugins/puzzles/rockbox.c
@@ -3362,10 +3362,6 @@ static bool load_game(void)
rb->close(fd);
rb->remove(fname);
-#ifdef FONT_CACHING
- load_fonts();
-#endif
-
/* success */
return true;
}
@@ -3451,6 +3447,11 @@ static void puzzles_main(void)
init_for_game(&thegame, -1);
}
+#ifdef FONT_CACHING
+ LOGF("loading fonts");
+ load_fonts();
+#endif
+
/* must be done before any menu needs to be displayed */
rb->snprintf(menu_desc, sizeof(menu_desc), "%s Menu", midend_which_game(me)->name);