diff --git a/archie.cpp b/archie.cpp index 76609c9..bf206d2 100644 --- a/archie.cpp +++ b/archie.cpp @@ -105,6 +105,17 @@ char archie_get_ar() return config.system_ctrl & 1; } +void archie_set_amix(char i) +{ + config.system_ctrl = (config.system_ctrl & ~0b110) | ((i & 3)<<1); + user_io_8bit_set_status(config.system_ctrl << 1, 0b1100); +} + +char archie_get_amix() +{ + return (config.system_ctrl>>1) & 3; +} + void archie_save_config(void) { FileSaveConfig(CONFIG_FILENAME, &config, sizeof(config)); @@ -276,6 +287,7 @@ void archie_init(void) archie_debugf("No %s config found", CONFIG_FILENAME); archie_set_ar(archie_get_ar()); + archie_set_amix(archie_get_amix()); // upload rom file archie_set_rom(config.rom_img); diff --git a/archie.h b/archie.h index f35d56d..72fd748 100644 --- a/archie.h +++ b/archie.h @@ -16,5 +16,7 @@ void archie_save_config(void); void archie_set_ar(char i); char archie_get_ar(); +void archie_set_amix(char i); +char archie_get_amix(); #endif // ARCHIE_H diff --git a/menu.cpp b/menu.cpp index 1a2557f..bc30c6a 100644 --- a/menu.cpp +++ b/menu.cpp @@ -827,10 +827,10 @@ void HandleUI(void) /* archimedes main menu */ /******************************************************************/ - case MENU_ARCHIE_MAIN1: { - menumask = 0xff; - OsdSetTitle("ARCHIE", 0); + case MENU_ARCHIE_MAIN1: + OsdSetTitle(user_io_get_core_name(), OSD_ARROW_RIGHT); + menumask = 0x3f; OsdWrite(0, "", 0, 0); strcpy(s, " Floppy 0: "); @@ -850,22 +850,26 @@ void HandleUI(void) OsdWrite(5, "", 0, 0); strcpy(s, " Aspect ratio: "); - strcat(s, archie_get_ar() ? "16:9" : " 4:3"); + strcat(s, archie_get_ar() ? "16:9" : "4:3"); OsdWrite(6, s, menusub == 3, 0); - OsdWrite(7, " Define joystick buttons", menusub == 4, 0); - OsdWrite(8, "", 0, 0); + OsdWrite(7, "", 0, 0); - // the following is exactly like the atatri st core - OsdWrite(9, " Firmware & Core \x16", menusub == 5, 0); - OsdWrite(10, " Save config ", menusub == 6, 0); + sprintf(s, " Stereo mix: %s", config_stereo_msg[archie_get_amix()]); + OsdWrite(8, s, menusub == 4, 0); - for (int i = 11; i<15; i++) OsdWrite(i, "", 0, 0); + for (int i = 9; i<15; i++) OsdWrite(i, "", 0, 0); - OsdWrite(15, STD_EXIT, menusub == 7, 0); + OsdWrite(15, STD_EXIT, menusub == 5, 0); menustate = MENU_ARCHIE_MAIN2; parentstate = MENU_ARCHIE_MAIN1; - } break; + + // set helptext with core display on top of basic info + sprintf(helptext_custom, HELPTEXT_SPACER); + strcat(helptext_custom, OsdCoreName()); + strcat(helptext_custom, helptexts[HELPTEXT_MAIN]); + helptext = helptext_custom; + break; case MENU_ARCHIE_MAIN2: // menu key closes menu @@ -893,28 +897,21 @@ void HandleUI(void) break; case 4: - joy_bcount = 1; - strcpy(joy_bnames[0], "Fire"); - start_map_setting(joy_bcount ? joy_bcount + 5 : 9); - menustate = MENU_JOYDIGMAP; - menusub = 0; + archie_set_amix(archie_get_amix()+1); + menustate = MENU_ARCHIE_MAIN1; break; - case 5: // Firmware submenu - menustate = MENU_FIRMWARE1; - menusub = 1; - break; - - case 6: // Save config - menustate = MENU_NONE1; - archie_save_config(); - break; - - case 7: // Exit + case 5: // Exit menustate = MENU_NONE1; break; } } + + if (right) + { + menustate = MENU_8BIT_SYSTEM1; + menusub = 0; + } break; case MENU_ARCHIE_MAIN_FILE_SELECTED: // file successfully selected @@ -1232,7 +1229,7 @@ void HandleUI(void) OsdWrite(OsdIsBig ? 1 : 0, " Firmware & Core \x16", menusub == 0, 0); OsdWrite(OsdIsBig ? 2 : 1, " Define joystick buttons \x16", menusub == 1, 0); OsdWrite(OsdIsBig ? 3 : 2, "", 0, 0); - OsdWrite(OsdIsBig ? 4 : 3, m ? " Reset" : " Reset settings", menusub == 3, 0); + OsdWrite(OsdIsBig ? 4 : 3, m ? " Reset" : " Reset settings", menusub == 3, user_io_core_type() == CORE_TYPE_ARCHIE); if (m) OsdWrite(OsdIsBig ? 5 : 4, "", 0, 0); else @@ -1276,8 +1273,11 @@ void HandleUI(void) case 2: break; case 3: - menustate = MENU_RESET1; - menusub = 1; + if (user_io_core_type() != CORE_TYPE_ARCHIE) + { + menustate = MENU_RESET1; + menusub = 1; + } break; case 4: if (m) @@ -1287,13 +1287,22 @@ void HandleUI(void) else { // Save settings - char *filename = user_io_create_config_name(); - unsigned long status = user_io_8bit_set_status(0, 0); - printf("Saving config to %s\n", filename); - FileSaveConfig(filename, &status, 4); - if (is_x86_core()) x86_config_save(); menustate = MENU_8BIT_MAIN1; menusub = 0; + + if (user_io_core_type() == CORE_TYPE_ARCHIE) + { + archie_save_config(); + menustate = MENU_ARCHIE_MAIN1; + } + else + { + char *filename = user_io_create_config_name(); + unsigned long status = user_io_8bit_set_status(0, 0); + printf("Saving config to %s\n", filename); + FileSaveConfig(filename, &status, 4); + if (is_x86_core()) x86_config_save(); + } } break; case 5: @@ -1336,7 +1345,7 @@ void HandleUI(void) menustate = MENU_MIST_MAIN1; break; case CORE_TYPE_ARCHIE: - menusub = 3; + menusub = 0; menustate = MENU_ARCHIE_MAIN1; break; case CORE_TYPE_8BIT: @@ -1406,11 +1415,6 @@ void HandleUI(void) menustate = MENU_FIRMWARE1; menusub = 2; } - else if (is_archie()) - { - menustate = MENU_ARCHIE_MAIN1; - menusub = 4; - } else { menustate = MENU_8BIT_SYSTEM1; diff --git a/user_io.cpp b/user_io.cpp index 961f881..f36deb1 100644 --- a/user_io.cpp +++ b/user_io.cpp @@ -41,7 +41,6 @@ static int emu_mode = EMU_NONE; // keep state over core type and its capabilities static unsigned char core_type = CORE_TYPE_UNKNOWN; -static char core_type_8bit_with_config_string = 0; static int fio_size = 0; static int io_ver = 0; @@ -101,11 +100,6 @@ char* user_io_create_config_name() return str; } -char user_io_is_8bit_with_config_string() -{ - return core_type_8bit_with_config_string; -} - static char core_name[16 + 1]; // max 16 bytes for core name char *user_io_get_core_name() @@ -164,11 +158,9 @@ static void user_io_read_core_name() is_no_type = 0; core_name[0] = 0; - if (user_io_is_8bit_with_config_string()) - { - char *p = user_io_8bit_get_string(0); // get core name - if (p && p[0]) strcpy(core_name, p); - } + // get core name + char *p = user_io_8bit_get_string(0); + if (p && p[0]) strcpy(core_name, p); printf("Core name is \"%s\"\n", core_name); } @@ -219,66 +211,70 @@ static int joy_force = 0; static void parse_config() { + int i = 0; + char *p; + joy_force = 0; - if (core_type_8bit_with_config_string) - { - int i = 2; - char *p; - do { - p = user_io_8bit_get_string(i); - if (i && p && p[0]) + + do { + p = user_io_8bit_get_string(i); + printf("get cfgstring %d = %s\n", i, p); + if (!i && p && p[0]) + { + OsdCoreNameSet(p); + } + if (i>=2 && p && p[0]) + { + if (p[0] == 'J') { - if (p[0] == 'J') + if (p[1] == '1') { - if (p[1] == '1') - { - joy_force = 1; - emu_mode = EMU_JOY0; - input_notify_mode(); - set_kbd_led(HID_LED_NUM_LOCK, true); - set_emu_leds(); - } - - joy_bcount = 0; - for (int n = 0; n < 12; n++) - { - substrcpy(joy_bnames[n], p, n + 1); - if (!joy_bnames[n][0]) break; - joy_bcount++; - } + joy_force = 1; + emu_mode = EMU_JOY0; + input_notify_mode(); + set_kbd_led(HID_LED_NUM_LOCK, true); + set_emu_leds(); } - if (p[0] == 'O' && p[1] == 'X') + joy_bcount = 0; + for (int n = 0; n < 12; n++) { - unsigned long status = user_io_8bit_set_status(0, 0); - printf("found OX option: %s, 0x%08X\n", p, status); - - unsigned long x = getStatus(p+1, status); - - if (is_x86_core()) - { - if (p[2] == '2') x86_set_fdd_boot(!(x&1)); - } - } - - if (p[0] == 'X') - { - disable_osd = 1; - } - - if (p[0] == 'V') - { - // get version string - char s[40]; - strcpy(s, OsdCoreName()); - strcat(s, " "); - substrcpy(s + strlen(s), p, 1); - OsdCoreNameSet(s); + substrcpy(joy_bnames[n], p, n + 1); + if (!joy_bnames[n][0]) break; + joy_bcount++; } } - i++; - } while (p); - } + + if (p[0] == 'O' && p[1] == 'X') + { + unsigned long status = user_io_8bit_set_status(0, 0); + printf("found OX option: %s, 0x%08X\n", p, status); + + unsigned long x = getStatus(p+1, status); + + if (is_x86_core()) + { + if (p[2] == '2') x86_set_fdd_boot(!(x&1)); + } + } + + if (p[0] == 'X') + { + disable_osd = 1; + } + + if (p[0] == 'V') + { + // get version string + char s[40]; + strcpy(s, OsdCoreName()); + strcat(s, " "); + substrcpy(s + strlen(s), p, 1); + OsdCoreNameSet(s); + } + } + i++; + } while (p || i<3); } //MSM6242B layout @@ -358,8 +354,6 @@ void user_io_init() // forward SD card config to core in case it uses the local // SD card implementation user_io_sd_set_config(); - // check if core has a config string - core_type_8bit_with_config_string = (user_io_8bit_get_string(0) != NULL); // set core name. This currently only sets a name for the 8 bit cores user_io_read_core_name(); @@ -398,6 +392,8 @@ void user_io_init() case CORE_TYPE_ARCHIE: puts("Identified Archimedes core"); archie_init(); + user_io_read_core_name(); + parse_config(); break; case CORE_TYPE_8BIT: diff --git a/user_io.h b/user_io.h index bf7a20d..144a6ea 100644 --- a/user_io.h +++ b/user_io.h @@ -164,7 +164,6 @@ void user_io_init(); unsigned char user_io_core_type(); char is_minimig(); char is_archie(); -char user_io_is_8bit_with_config_string(); void user_io_poll(); char user_io_menu_button(); char user_io_button_dip_switch1();