diff --git a/joymapping.cpp b/joymapping.cpp index 859df6e..65e1ec4 100644 --- a/joymapping.cpp +++ b/joymapping.cpp @@ -43,9 +43,10 @@ static void get_buttons() joy_bcount = 0; defaults = 0; + user_io_read_confstr(); while(1) { - p = user_io_8bit_get_string(i); + p = user_io_get_confstr(i); if (!p) break; // this option used as default name map (unless jn/jp is supplied) diff --git a/main.cpp b/main.cpp index 0461836..01bc569 100644 --- a/main.cpp +++ b/main.cpp @@ -31,6 +31,7 @@ along with this program. If not, see . #include "input.h" #include "fpga_io.h" #include "scheduler.h" +#include "osd.h" const char *version = "$VER:" VDATE; diff --git a/menu.cpp b/menu.cpp index f062285..f2cb2a7 100644 --- a/menu.cpp +++ b/menu.cpp @@ -1250,7 +1250,7 @@ void HandleUI(void) spi_uio_cmd_cont(UIO_GET_OSDMASK); hdmask = spi_w(0); DisableIO(); - + user_io_read_confstr(); int entry = 0; while(1) { @@ -1273,7 +1273,7 @@ void HandleUI(void) { char* pos; - p = user_io_8bit_get_string(i++); + p = user_io_get_confstr(i++); //printf("Option %d: %s\n", i-1, p); if (p) @@ -1476,14 +1476,14 @@ void HandleUI(void) else { static char ext[256]; - p = user_io_8bit_get_string(1); + p = user_io_get_confstr(1); int h = 0, d = 0; uint32_t entry = 0; int i = 1; while (1) { - p = user_io_8bit_get_string(i++); + p = user_io_get_confstr(i++); if (!p) continue; h = 0; @@ -2475,7 +2475,7 @@ void HandleUI(void) if (menu | select | left) { menustate = MENU_8BIT_SYSTEM1; - menusub = 7 - m; + menusub = 12; } break; diff --git a/osd.cpp b/osd.cpp index 426e738..a70ea4d 100644 --- a/osd.cpp +++ b/osd.cpp @@ -116,6 +116,7 @@ void StarsUpdate() } framebuffer_plot(stars[i].x >> 4, stars[i].y >> 4); } + osdset = -1; } @@ -702,6 +703,7 @@ void OsdUpdate() spi_osd_cmd_cont(OSD_CMD_WRITE | i); spi_write(osdbuf + i * 256, 256, 0); DisableOsd(); + if (is_megacd_core()) mcd_poll(); } } diff --git a/user_io.cpp b/user_io.cpp index b982e3b..9dd4131 100644 --- a/user_io.cpp +++ b/user_io.cpp @@ -324,7 +324,7 @@ static void user_io_read_core_name() core_name[0] = 0; // get core name - char *p = user_io_8bit_get_string(0); + char *p = user_io_get_confstr(0); if (p && p[0]) strcpy(core_name, p); strncpy(core_dir, !strcasecmp(p, "minimig") ? "Amiga" : core_name, 1024); @@ -417,7 +417,7 @@ static void parse_config() joy_force = 0; do { - p = user_io_8bit_get_string(i); + p = user_io_get_confstr(i); printf("get cfgstring %d = %s\n", i, p); if (!i && p && p[0]) { @@ -725,6 +725,7 @@ void user_io_init(const char *path) spi_init(core_type != CORE_TYPE_UNKNOWN); OsdSetSize(8); + user_io_read_confstr(); if (core_type == CORE_TYPE_8BIT) { puts("Identified 8BIT core"); @@ -1690,53 +1691,52 @@ int user_io_file_tx(const char* name, unsigned char index, char opensave, char m return 1; } -// 8 bit cores have a config string telling the firmware how -// to treat it -char *user_io_8bit_get_string(char index) +static char cfgstr[1024 * 10] = {}; +void user_io_read_confstr() +{ + spi_uio_cmd_cont(UIO_GET_STRING); + + uint32_t j = 0; + while (j < sizeof(cfgstr) - 1) + { + char i = spi_in(); + if (!i) break; + cfgstr[j++] = i; + } + + cfgstr[j++] = 0; +} + +char *user_io_get_confstr(int index) { unsigned char i, lidx = 0, j = 0; static char buffer[128 + 1]; // max 128 bytes per config item - // clear buffer buffer[0] = 0; + int pos = 0; - spi_uio_cmd_cont(UIO_GET_STRING); - i = spi_in(); - // the first char returned will be 0xff if the core doesn't support - // config strings. atari 800 returns 0xa4 which is the status byte - if ((i == 0xff) || (i == 0xa4)) + i = cfgstr[pos++]; + while (i && (j < sizeof(buffer))) { - DisableIO(); - return NULL; - } - - // printf("String: "); - while ((i != 0) && (i != 0xff) && (j