generic ui, add basic GLES support

This commit is contained in:
kub 2022-06-19 22:46:50 +02:00
parent 7c6f79147b
commit 23e4719638
7 changed files with 54 additions and 26 deletions

View file

@ -69,6 +69,7 @@ static unsigned short fname2color(const char *fname)
#include <platform/libpicofe/menu.c>
static const char *men_dummy[] = { NULL };
static int menu_w, menu_h;
/* platform specific options and handlers */
#if defined(__GP2X__)
@ -147,7 +148,17 @@ static void copy_bg(int dir)
static void menu_enter(int is_rom_loaded)
{
if (is_rom_loaded)
plat_video_menu_enter(is_rom_loaded);
menu_w = menu_h = 0;
}
static void menu_draw_prep(void)
{
if (menu_w == g_menuscreen_w && menu_h == g_menuscreen_h)
return;
menu_w = g_menuscreen_w, menu_h = g_menuscreen_h;
if (PicoGameLoaded)
{
make_bg(0, 0);
}
@ -159,12 +170,11 @@ static void menu_enter(int is_rom_loaded)
strcpy(buff + pos, "background.png");
// should really only happen once, on startup..
memset(g_menubg_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);
if (readpng(g_menubg_ptr, buff, READPNG_BG,
g_menuscreen_w, g_menuscreen_h) < 0)
memset(g_menubg_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);
}
plat_video_menu_enter(is_rom_loaded);
}
static void draw_savestate_bg(int slot)
@ -436,7 +446,7 @@ static int menu_loop_keyconfig(int id, int keys)
static int sel = 0;
me_enable(e_menu_keyconfig, MA_OPT_SAVECFG_GAME, PicoGameLoaded);
me_loop(e_menu_keyconfig, &sel);
me_loop_d(e_menu_keyconfig, &sel, menu_draw_prep, NULL);
PicoSetInputDevice(0, currentConfig.input_dev0);
PicoSetInputDevice(1, currentConfig.input_dev1);
@ -461,7 +471,7 @@ static int menu_loop_md_options(int id, int keys)
static int sel = 0;
me_enable(e_menu_md_options, MA_OPT_RENDERER, renderer_names[0] != NULL);
me_loop(e_menu_md_options, &sel);
me_loop_d(e_menu_md_options, &sel, menu_draw_prep, NULL);
return 0;
}
@ -489,7 +499,7 @@ static menu_entry e_menu_cd_options[] =
static int menu_loop_cd_options(int id, int keys)
{
static int sel = 0;
me_loop(e_menu_cd_options, &sel);
me_loop_d(e_menu_cd_options, &sel, menu_draw_prep, NULL);
return 0;
}
@ -548,7 +558,7 @@ static int menu_loop_32x_options(int id, int keys)
static int sel = 0;
me_enable(e_menu_32x_options, MA_32XOPT_RENDERER, renderer_names32x[0] != NULL);
me_loop(e_menu_32x_options, &sel);
me_loop_d(e_menu_32x_options, &sel, menu_draw_prep, NULL);
Pico32xSetClocks(currentConfig.msh2_khz * 1000, currentConfig.msh2_khz * 1000);
@ -580,7 +590,7 @@ static int menu_loop_sms_options(int id, int keys)
{
static int sel = 0;
me_loop(e_menu_sms_options, &sel);
me_loop_d(e_menu_sms_options, &sel, menu_draw_prep, NULL);
return 0;
}
@ -612,7 +622,7 @@ static int menu_loop_adv_options(int id, int keys)
{
static int sel = 0;
me_loop(e_menu_adv_options, &sel);
me_loop_d(e_menu_adv_options, &sel, menu_draw_prep, NULL);
PicoIn.overclockM68k = currentConfig.overclock_68k; // int vs short
return 0;
@ -701,7 +711,7 @@ static int menu_loop_snd_options(int id, int keys)
if (PicoIn.sndRate > 52000 && PicoIn.sndRate < 54000)
PicoIn.sndRate = 53000;
me_loop(e_menu_snd_options, &sel);
me_loop_d(e_menu_snd_options, &sel, menu_draw_prep, NULL);
return 0;
}
@ -739,7 +749,7 @@ static int menu_loop_gfx_options(int id, int keys)
{
static int sel = 0;
me_loop(e_menu_gfx_options, &sel);
me_loop_d(e_menu_gfx_options, &sel, menu_draw_prep, NULL);
return 0;
}
@ -762,7 +772,7 @@ static int menu_loop_ui_options(int id, int keys)
{
static int sel = 0;
me_loop(e_menu_ui_options, &sel);
me_loop_d(e_menu_ui_options, &sel, menu_draw_prep, NULL);
return 0;
}
@ -916,7 +926,7 @@ static int menu_loop_options(int id, int keys)
me_enable(e_menu_options, MA_OPT_SAVECFG_GAME, PicoGameLoaded);
me_enable(e_menu_options, MA_OPT_LOADCFG, config_slot != config_slot_current);
me_loop(e_menu_options, &sel);
me_loop_d(e_menu_options, &sel, menu_draw_prep, NULL);
return 0;
}
@ -1265,7 +1275,7 @@ void menu_loop(void)
menu_enter(PicoGameLoaded);
in_set_config_int(0, IN_CFG_BLOCKING, 1);
me_loop_d(e_menu_main, &sel, NULL, menu_main_draw_status);
me_loop_d(e_menu_main, &sel, menu_draw_prep, menu_main_draw_status);
if (PicoGameLoaded) {
if (engineState == PGS_Menu)
@ -1318,7 +1328,7 @@ int menu_loop_tray(void)
menu_enter(PicoGameLoaded);
in_set_config_int(0, IN_CFG_BLOCKING, 1);
me_loop(e_menu_tray, &sel);
me_loop_d(e_menu_tray, &sel, menu_draw_prep, NULL);
if (engineState != PGS_RestartRun) {
engineState = PGS_RestartRun;