From 36eb8efd7b777d2c9bca4559747d61d7fa989133 Mon Sep 17 00:00:00 2001 From: penfold42 Date: Wed, 8 Aug 2018 23:11:58 +1000 Subject: [PATCH] And search for chargen in /roms/ too --- src/main.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8c4fd72..ac59de8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1189,21 +1189,28 @@ static void CheckOptions() u32 widthScreen = screen.Width(); u32 heightScreen = screen.Height(); u32 xpos, ypos; - const char* ROMName; deviceID = (u8)options.GetDeviceID(); DEBUG_LOG("DeviceID = %d\r\n", deviceID); - ROMName = options.GetRomFontName(); - if (ROMName) + const char* FontROMName = options.GetRomFontName(); + if (FontROMName) { + char FontROMName2[256] = "/roms/"; + + if (FontROMName[0] != '/') // not a full path, prepend /roms/ + strncat (FontROMName2, FontROMName, 240); + else + FontROMName2[0] = 0; + //DEBUG_LOG("%d Rom Name = %s\r\n", ROMIndex, ROMName); - if (FR_OK == f_open(&fp, ROMName, FA_READ)) + if ( (FR_OK == f_open(&fp, FontROMName, FA_READ)) + || (FR_OK == f_open(&fp, FontROMName2, FA_READ)) ) { u32 bytesRead; screen.Clear(COLOUR_BLACK); - snprintf(tempBuffer, tempBufferSize, "Loading ROM %s\r\n", ROMName); + snprintf(tempBuffer, tempBufferSize, "Loading Font ROM %s\r\n", FontROMName); screen.MeasureText(false, tempBuffer, &widthText, &heightText); xpos = (widthScreen - widthText) >> 1; ypos = (heightScreen - heightText) >> 1;