Optomizations in OSD, more calls for megacd while OSD rendering.

This commit is contained in:
sorgelig
2019-12-02 02:16:47 +08:00
parent 7cde6e6b93
commit e56145f02d
6 changed files with 43 additions and 38 deletions

View File

@@ -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)

View File

@@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "input.h"
#include "fpga_io.h"
#include "scheduler.h"
#include "osd.h"
const char *version = "$VER:" VDATE;

View File

@@ -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;

View File

@@ -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();
}
}

View File

@@ -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<sizeof(buffer)))
{
if (i == ';') {
if (i == ';')
{
if (lidx == index) buffer[j++] = 0;
lidx++;
}
else {
if (lidx == index)
buffer[j++] = i;
else
{
if (lidx == index) buffer[j++] = i;
}
// printf("%c", i);
i = spi_in();
i = cfgstr[pos++];
}
DisableIO();
// printf("\n");
// if this was the last string in the config string list, then it still
// needs to be terminated
if (lidx == index) buffer[j] = 0;
// also return NULL for empty strings
if (!buffer[0]) return NULL;
return buffer;
return buffer[0] ? buffer : NULL;
}
uint32_t user_io_8bit_set_status(uint32_t new_status, uint32_t mask, int ex)

View File

@@ -206,7 +206,8 @@ char user_io_menu_button();
char user_io_user_button();
void user_io_osd_key_enable(char);
void user_io_serial_tx(char *, uint16_t);
char *user_io_8bit_get_string(char);
void user_io_read_confstr();
char *user_io_get_confstr(int index);
uint32_t user_io_8bit_set_status(uint32_t, uint32_t, int ex = 0);
int user_io_file_tx(const char* name, unsigned char index = 0, char opensave = 0, char mute = 0, char composite = 0);
uint32_t user_io_get_file_crc();
@@ -216,7 +217,6 @@ char *user_io_make_filepath(const char *path, const char *filename);
char *user_io_get_core_name();
char *user_io_get_core_path();
const char *user_io_get_core_name_ex();
char is_megacd_core();
char has_menu();
const char *get_image_name(int i);
@@ -281,6 +281,7 @@ char is_menu_core();
char is_x86_core();
char is_snes_core();
char is_neogeo_core();
char is_megacd_core();
#define HomeDir (is_menu_core() ? "Scripts" : user_io_get_core_path())
#define CoreName (is_menu_core() ? "Scripts" : user_io_get_core_name())