OBJS += platform/common/plat_sdl.o platform/common/input_sdlkbd.o
OBJS += platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o
OBJS += platform/libpicofe/plat_dummy.o platform/libpicofe/linux/plat.o
-OBJS += platform/libpicofe/gl.o
-OBJS += platform/libpicofe/gl_platform.o
USE_FRONTEND = 1
endif
ifeq "$(PLATFORM)" "generic"
+#ifeq (y,$(shell echo "\#include <GLES/gl.h>" | $(CC) -E -xc - >/dev/null 2>&1 && echo y))
+ifeq "$(HAVE_GLES)" "1"
+CFLAGS += -DHAVE_GLES -DSDL_REDRAW_EVT
+LDFLAGS += -lEGL -lGLESv1_CM
+endif
CFLAGS += -DSDL_OVERLAY_2X -DSDL_BUFFER_3X
OBJS += platform/linux/emu.o platform/linux/blit.o # FIXME
ifeq "$(use_inputmap)" "1"
# libpicofe
OBJS += platform/libpicofe/input.o platform/libpicofe/readpng.o \
platform/libpicofe/fonts.o
+ifneq (,$(filter %HAVE_GLES, $(CFLAGS)))
+OBJS += platform/libpicofe/gl.o platform/libpicofe/gl_platform.o
+endif
# libpicofe - sound
OBJS += platform/libpicofe/sndout.o
have_arm_neon=""
have_libavcodec=""
have_libchdr=""
+have_gles="no"
need_sdl="no"
need_zlib="no"
case "$platform" in
rpi1)
MFLAGS="mcpu=arm1176jzf-s -mfpu=vfp"
+ have_gles="yes"
;;
rpi2)
MFLAGS="mcpu=cortex-a7 -mfpu=neon"
+ have_gles="yes"
;;
generic)
;;
;;
--with-libavcodec=*) have_libavcodec="$optarg"
;;
+ --with-sdl-gles=*) have_gles="$optarg"
+ ;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
esac
echo " --sound-drivers=LIST sound output drivers [guessed]"
echo " available: $sound_driver_list"
echo " --with-libavcodec=yes|no use libavcodec for mp3 decoding"
+ echo " --with-sdl-gles=yes|no enable GLES usage for SDL"
echo "influential environment variables:"
echo " CROSS_COMPILE CC CXX AS STRIP CFLAGS ASFLAGS LDFLAGS LDLIBS"
exit 1
echo "ARCH = $ARCH" >> $config_mak
echo "PLATFORM = $platform" >> $config_mak
echo "SOUND_DRIVERS = $sound_drivers" >> $config_mak
+if [ "$have_gles" = "yes" ]; then
+ echo "HAVE_GLES = 1" >> $config_mak
+fi
if [ "$have_libavcodec" = "yes" ]; then
echo "HAVE_LIBAVCODEC = 1" >> $config_mak
fi
#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__)
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);
}
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)
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);
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;
}
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;
}
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);
{
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;
}
{
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;
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;
}
{
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;
}
{
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;
}
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;
}
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)
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;
{
if (SDL_MUSTLOCK(plat_sdl_screen))
SDL_UnlockSurface(plat_sdl_screen);
- plat_sdl_change_video_mode(g_menuscreen_w, g_menuscreen_h, 1);
- resize_buffers();
}
void plat_video_menu_begin(void)
{
+ plat_sdl_change_video_mode(g_menuscreen_w, g_menuscreen_h, 1);
resize_buffers();
if (plat_sdl_overlay || plat_sdl_gl_active) {
g_menuscreen_pp = g_menuscreen_w;
static void plat_sdl_resize(int w, int h)
{
// take over new settings
- g_menuscreen_h = (plat_sdl_screen->h < 480 ? plat_sdl_screen->h : 480);
- if (!plat_sdl_overlay && !plat_sdl_gl_active)
- g_menuscreen_h = plat_sdl_screen->h;
- g_menuscreen_w = g_menuscreen_h * plat_sdl_screen->w/plat_sdl_screen->h;
+ g_menuscreen_h = plat_sdl_screen->h;
+ g_menuscreen_w = plat_sdl_screen->w;
+ resize_buffers();
+ rendstatus_old = -1;
}
static void plat_sdl_quit(void)
emu_cmn_forced_frame(no_scale, do_emu, screen_buffer(g_screen_ptr));\r
render_bg = 0;\r
\r
- g_menubg_src_ptr = g_screen_ptr;\r
+ g_menubg_src_ptr = realloc(g_menubg_src_ptr, g_screen_height * g_screen_ppitch * 2);\r
+ memcpy(g_menubg_src_ptr, g_screen_ptr, g_screen_height * g_screen_ppitch * 2);\r
currentConfig.scaling = hs, currentConfig.vscaling = vs;\r
}\r
\r
out_y = start_line; out_x = start_col;\r
out_h = line_count; out_w = col_count;\r
\r
+ plat_video_loop_prepare(); // recalculates g_screen_w/h\r
PicoDrawSetCallbacks(NULL, NULL);\r
// center output in screen\r
screen_w = g_screen_width, screen_x = (screen_w - out_w)/2;\r
}\r
\r
plat_video_set_size(screen_w, screen_h);\r
- plat_video_set_buffer(g_screen_ptr);\r
\r
if (screen_w < g_screen_width)\r
screen_x = (g_screen_width - screen_w)/2;\r
screen_y += (224 - out_h)/2;\r
}\r
\r
+ plat_video_set_buffer(g_screen_ptr);\r
+\r
// create a backing buffer for emulating the bad GG lcd display\r
if (currentConfig.ghosting && out_h == 144) {\r
int h = currentConfig.vscaling == EOPT_SCALE_SW ? 240:out_h;\r