initialize cpu speed state in the bios menu so it shows the correct value

This commit is contained in:
Jorj Bauer 2021-01-08 19:56:05 -05:00
parent 826e5d14c5
commit c0f105807c

View File

@ -173,6 +173,7 @@ bool BIOS::loop()
bool hitReturn = false; bool hitReturn = false;
uint16_t rv; uint16_t rv;
bool changingMenu = false;
if (g_keyboard->kbhit()) { if (g_keyboard->kbhit()) {
switch (g_keyboard->read()) { switch (g_keyboard->read()) {
case PK_DARR: case PK_DARR:
@ -187,11 +188,13 @@ bool BIOS::loop()
selectedMenuItem = 0; selectedMenuItem = 0;
selectedMenu++; selectedMenu++;
selectedMenu %= NUM_TITLES; selectedMenu %= NUM_TITLES;
changingMenu = true;
needsRedraw = true; needsRedraw = true;
break; break;
case PK_LARR: case PK_LARR:
selectedMenuItem = 0; selectedMenuItem = 0;
selectedMenu--; selectedMenu--;
changingMenu = true;
if (selectedMenu < 0) { if (selectedMenu < 0) {
selectedMenu = NUM_TITLES-1; selectedMenu = NUM_TITLES-1;
} }
@ -206,6 +209,29 @@ bool BIOS::loop()
} }
} }
if (changingMenu && selectedMenu == BIOS_HARDWARE) {
// Need to initialize the CPU speed from g_speed
switch (g_speed) {
case 1023000:
currentCPUSpeedIndex = CPUSPEED_FULL;
break;
case 1023000/2:
currentCPUSpeedIndex = CPUSPEED_HALF;
break;
case 1023000*2:
currentCPUSpeedIndex = CPUSPEED_DOUBLE;
break;
case 1023000*4:
currentCPUSpeedIndex = CPUSPEED_QUAD;
break;
default:
// Dunno what happened, but we'll default back to full (normal) speed
currentCPUSpeedIndex = CPUSPEED_FULL;
g_speed = 1023000;
break;
}
}
switch (selectedMenu) { switch (selectedMenu) {
case BIOS_AIIE: case BIOS_AIIE:
rv = AiieMenuHandler(needsRedraw, hitReturn); rv = AiieMenuHandler(needsRedraw, hitReturn);