V2RetroComputing / analog

∀2 Analog VGA card for the Apple II computer line
MIT License
125 stars 18 forks source link

Font configuration ist lost on reboot/power-up #31

Open ThorstenBr opened 8 months ago

ThorstenBr commented 8 months ago

Currently the configured font is not restored when the machine is started. This is caused by the logic in render.c/switch_font, which always reloads and switches the font to something machine-specific, when the machine type has changed. When the machine is powered on, variable "current_machine" is initially always set to "MACHINE_AUTO". At some point after the system has started, this variable eventually switches to something machine-specific. This change triggers switch_font to reset the current font to a default for the specific machine.

However, when a user has selected a French or German font, for example, this font needs to remain active. Currently, the only way to use a font other than the machine default, is by using the config utility each time the machine was started.

This could be fixed in several ways - depending on what was intended.

Here's something I used locally to fix the font issue for me: I added a check "if (romx_textbank==0)" to render.c/switch_font. So only when the default font (font 0) was selected, then change the font once the machine type changes from MACHINE_AUTO to the machine specific value. Otherwise, if the user has configured a specific, non-default font - then keep the user-selected font. The user probably knows what he is doing:

@@ -31,10 +31,11 @@ static void DELAYED_COPY_CODE(switch_font)() {
     if(romx_changed) {
         memcpy32(character_rom, (void*)FLASH_FONT(romx_textbank), 4096);
     } else if(userfont) {
         return;
     } else if(current_machine != machinefont) {
+        if (romx_textbank==0)
         switch(current_machine) {
         default:
         case MACHINE_II:
             memcpy32(character_rom, (void*)FLASH_FONT_APPLE_II, 4096);
             break;
dkgrizzly commented 8 months ago

I'll take a look in the next few days. Currently have test machines packed up for the holidays.