tweak and refactor frontends, menu and config

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@895 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2010-09-17 09:49:16 +00:00
parent 603c28b317
commit 45285368c0
19 changed files with 262 additions and 198 deletions

View file

@ -23,6 +23,7 @@
#include "../common/fonts.h"
#include "../common/emu.h"
#include "../common/config.h"
#include "../common/input.h"
#include "../linux/sndout_oss.h"
#include "version.h"
@ -60,6 +61,7 @@ void pemu_prep_defconfig(void)
defaultConfig.CPUclock = default_cpu_clock;
defaultConfig.renderer32x = RT_8BIT_FAST;
defaultConfig.analog_deadzone = 50;
soc = soc_detect();
if (soc == SOCID_MMSP2)
@ -523,9 +525,10 @@ static void vid_reset_mode(void)
}
else {
PicoDrawSetOutFormat(PDF_NONE, 0);
PicoDraw32xSetFrameMode(1, (renderer == RT_16BIT) ? 1 : 0);
PicoDraw32xSetFrameMode(1, 0);
}
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
gp2x_mode = 16;
}
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {
@ -548,12 +551,7 @@ static void vid_reset_mode(void)
else
osd_text = (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) ? osd_text8_rot : osd_text8;
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX)
gp2x_mode = -gp2x_mode;
gp2x_video_wait_vsync();
gp2x_video_changemode(gp2x_mode);
if (!is_16bit_mode()) {
// setup pal for 8-bit modes
localPal[0xc0] = 0x0000c000; // MCD LEDs
@ -566,6 +564,11 @@ static void vid_reset_mode(void)
else
gp2x_memset_all_buffers(0, 0, 320*240*2);
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX)
gp2x_mode = -gp2x_mode;
gp2x_video_changemode(gp2x_mode);
Pico.m.dirtyPal = 1;
PicoOpt &= ~POPT_EN_SOFTSCALE;
@ -794,13 +797,15 @@ void pemu_sound_wait(void)
// don't need to do anything, writes will block by themselves
}
void pemu_forced_frame(int opts, int no_scale)
void pemu_forced_frame(int no_scale, int do_emu)
{
int po_old = PicoOpt;
doing_bg_frame = 1;
PicoOpt &= ~POPT_ALT_RENDERER;
PicoOpt |= opts|POPT_ACC_SPRITES;
PicoOpt |= POPT_ACC_SPRITES;
if (!no_scale)
PicoOpt |= POPT_EN_SOFTSCALE;
memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);
@ -810,12 +815,12 @@ void pemu_forced_frame(int opts, int no_scale)
PicoDrawSetCallbacks(NULL, NULL);
Pico.m.dirtyPal = 1;
if (no_scale == -9)
// yes I'm lazy, see pemu_forced_frame call below
if (do_emu)
PicoFrame();
else
PicoFrameDrawOnly();
g_menubg_src_ptr = g_screen_ptr;
doing_bg_frame = 0;
PicoOpt = po_old;
}
@ -909,6 +914,10 @@ void pemu_loop_prep(void)
unset_lcd_custom_rate();
}
if (gp2x_dev_id == GP2X_DEV_CAANOO)
in_set_config_int(in_name_to_id("evdev:pollux-analog"), IN_CFG_ABS_DEAD_ZONE,
currentConfig.analog_deadzone);
if ((EmuOpt_old ^ currentConfig.EmuOpt) & EOPT_MMUHACK)
gp2x_make_fb_bufferable(currentConfig.EmuOpt & EOPT_MMUHACK);
@ -931,8 +940,7 @@ void pemu_loop_end(void)
pemu_sound_stop();
/* do one more frame for menu bg */
pemu_forced_frame(POPT_EN_SOFTSCALE, -9);
g_menubg_src_ptr = g_screen_ptr;
pemu_forced_frame(0, 1);
}
const char *plat_get_credits(void)

View file

@ -82,6 +82,7 @@ const char *men_scaling_opts[] = { "OFF", "software", "hardware", NULL };
static menu_entry e_menu_adv_options[];
static menu_entry e_menu_gfx_options[];
static menu_entry e_menu_options[];
static menu_entry e_menu_keyconfig[];
void gp2x_menu_init(void)
{
@ -120,5 +121,8 @@ void gp2x_menu_init(void)
if (gp2x_dev_id != GP2X_DEV_GP2X)
men_scaling_opts[2] = NULL; /* leave only off and sw */
if (gp2x_dev_id != GP2X_DEV_CAANOO)
me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, 0);
}

View file

@ -10,6 +10,7 @@
#include "../common/readpng.h"
#include "../common/menu.h"
#include "../common/emu.h"
#include "../common/input.h"
#include "../linux/sndout_oss.h"
#include <pico/pico.h>
@ -20,6 +21,27 @@ int gp2x_dev_id;
int gp2x_current_bpp;
void *gp2x_screens[4];
#include <linux/input.h>
static const char * const caanoo_keys[KEY_MAX + 1] = {
[0 ... KEY_MAX] = NULL,
[KEY_UP] = "Up",
[KEY_LEFT] = "Left",
[KEY_RIGHT] = "Right",
[KEY_DOWN] = "Down",
[BTN_TRIGGER] = "A",
[BTN_THUMB] = "X",
[BTN_THUMB2] = "B",
[BTN_TOP] = "Y",
[BTN_TOP2] = "L",
[BTN_PINKIE] = "R",
[BTN_BASE] = "Home",
[BTN_BASE2] = "Lock",
[BTN_BASE3] = "I",
[BTN_BASE4] = "II",
[BTN_BASE5] = "Push",
};
void gp2x_video_changemode(int bpp)
{
gp2x_video_changemode_ll(bpp);
@ -75,8 +97,9 @@ void plat_video_menu_enter(int is_rom_loaded)
memset(gp2x_screens[1], 0, 320*240*2);
gp2x_video_flip2(); // might flip to fb2/3
gp2x_video_flip2(); // ..so we do it again
// gp2x_video_wait_vsync();
}
else
gp2x_video_flip2();
// switch to 16bpp
gp2x_video_changemode_ll(16);
@ -85,14 +108,11 @@ void plat_video_menu_enter(int is_rom_loaded)
void plat_video_menu_begin(void)
{
memcpy(g_screen_ptr, gp2x_screens[2], 320*240*2);
g_menuscreen_ptr = g_screen_ptr;
}
void plat_video_menu_end(void)
{
// FIXME
// gp2x_video_flush_cache();
gp2x_video_flip2();
}
@ -126,7 +146,9 @@ void plat_early_init(void)
break;
}
gp2x_menu_init();
// just use gettimeofday until plat_init()
gp2x_get_ticks_ms = plat_get_ticks_ms_good;
gp2x_get_ticks_us = plat_get_ticks_us_good;
}
void plat_init(void)
@ -156,6 +178,12 @@ void plat_init(void)
// snd
sndout_oss_init();
if (gp2x_dev_id == GP2X_DEV_CAANOO)
in_set_config(in_name_to_id("evdev:pollux-analog"), IN_CFG_KEY_NAMES,
caanoo_keys, sizeof(caanoo_keys));
gp2x_menu_init();
}
void plat_finish(void)

View file

@ -387,6 +387,7 @@ void pollux_finish(void)
memregl[0xf004>>2] = pllsetreg0;
memregl[0xf07c>>2] |= 0x8000;
}
timer_cleanup();
munmap((void *)memregs, 0x20000);
close(memdev);

View file

@ -1,2 +1,2 @@
#define VERSION "1.70b3"
#define VERSION "1.80"