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

@ -53,10 +53,10 @@ static int seek_sect(FILE *f, const char *section)
static void keys_write(FILE *fn, const char *bind_str, int dev_id, const int *binds, int no_defaults) static void keys_write(FILE *fn, const char *bind_str, int dev_id, const int *binds, int no_defaults)
{ {
char act[48]; char act[48];
int key_count, k, i; int key_count = 0, k, i;
const int *def_binds; const int *def_binds;
key_count = in_get_dev_info(dev_id, IN_INFO_BIND_COUNT); in_get_config(dev_id, IN_CFG_BIND_COUNT, &key_count);
def_binds = in_get_dev_def_binds(dev_id); def_binds = in_get_dev_def_binds(dev_id);
for (k = 0; k < key_count; k++) for (k = 0; k < key_count; k++)
@ -268,6 +268,8 @@ write:
int dummy; int dummy;
if (!me->need_to_save) if (!me->need_to_save)
continue; continue;
if (me->name == NULL || me->name[0] == 0)
continue;
if (me->beh == MB_OPT_ONOFF || me->beh == MB_OPT_CUSTONOFF) { if (me->beh == MB_OPT_ONOFF || me->beh == MB_OPT_CUSTONOFF) {
if (!no_defaults || ((*(int *)me->var ^ default_var(me)) & me->mask)) if (!no_defaults || ((*(int *)me->var ^ default_var(me)) & me->mask))
@ -285,7 +287,7 @@ write:
goto write_line; goto write_line;
} }
} }
else if (me->name != NULL && me->generate_name != NULL) { else if (me->generate_name != NULL) {
if (!no_defaults || !is_cust_val_default(me)) { if (!no_defaults || !is_cust_val_default(me)) {
strncpy(line, me->generate_name(0, &dummy), sizeof(line)); strncpy(line, me->generate_name(0, &dummy), sizeof(line));
goto write_line; goto write_line;
@ -318,7 +320,7 @@ write_line:
const int *binds = in_get_dev_binds(t); const int *binds = in_get_dev_binds(t);
const char *name = in_get_dev_name(t, 0, 0); const char *name = in_get_dev_name(t, 0, 0);
char strbind[16]; char strbind[16];
int count; int count = 0;
if (binds == NULL || name == NULL) if (binds == NULL || name == NULL)
continue; continue;
@ -326,7 +328,7 @@ write_line:
sprintf(strbind, "bind%d", t); sprintf(strbind, "bind%d", t);
if (t == 0) strbind[4] = 0; if (t == 0) strbind[4] = 0;
count = in_get_dev_info(t, IN_INFO_BIND_COUNT); in_get_config(t, IN_CFG_BIND_COUNT, &count);
keys_write(fn, strbind, t, binds, no_defaults); keys_write(fn, strbind, t, binds, no_defaults);
} }
@ -670,9 +672,9 @@ static void parse(const char *var, const char *val)
if (!me->need_to_save) if (!me->need_to_save)
continue; continue;
if (me->name != NULL && me->name[0] != 0) { if (me->name == NULL || strcasecmp(var, me->name) != 0)
if (strcasecmp(var, me->name) != 0) continue;
continue; /* surely not this one */
if (me->beh == MB_OPT_ONOFF) { if (me->beh == MB_OPT_ONOFF) {
tmp = strtol(val, &p, 0); tmp = strtol(val, &p, 0);
if (*p != 0) if (*p != 0)
@ -707,9 +709,7 @@ static void parse(const char *var, const char *val)
} }
goto bad_val; goto bad_val;
} }
} else if (custom_read(me, var, val))
if (!custom_read(me, var, val))
break;
return; return;
} }

View file

@ -1256,7 +1256,7 @@ static void run_events_ui(unsigned int which)
plat_status_msg_busy_first(tmp); plat_status_msg_busy_first(tmp);
in_set_blocking(1); in_set_config_int(0, IN_CFG_BLOCKING, 1);
while (in_menu_wait_any(50) & (PBTN_MA3|PBTN_MBACK)) while (in_menu_wait_any(50) & (PBTN_MA3|PBTN_MBACK))
; ;
while ( !((keys = in_menu_wait_any(50)) & (PBTN_MA3|PBTN_MBACK)) ) while ( !((keys = in_menu_wait_any(50)) & (PBTN_MA3|PBTN_MBACK)) )
@ -1265,7 +1265,7 @@ static void run_events_ui(unsigned int which)
do_it = 0; do_it = 0;
while (in_menu_wait_any(50) & (PBTN_MA3|PBTN_MBACK)) while (in_menu_wait_any(50) & (PBTN_MA3|PBTN_MBACK))
; ;
in_set_blocking(0); in_set_config_int(0, IN_CFG_BLOCKING, 0);
} }
if (do_it) { if (do_it) {
plat_status_msg_busy_first((which & PEV_STATE_LOAD) ? "LOADING STATE" : "SAVING STATE"); plat_status_msg_busy_first((which & PEV_STATE_LOAD) ? "LOADING STATE" : "SAVING STATE");

View file

@ -76,6 +76,7 @@ typedef struct _currentConfig_t {
int renderer; int renderer;
int renderer32x; int renderer32x;
int filter; // pandora int filter; // pandora
int analog_deadzone;
} currentConfig_t; } currentConfig_t;
extern currentConfig_t currentConfig, defaultConfig; extern currentConfig_t currentConfig, defaultConfig;

View file

@ -74,15 +74,13 @@ int main(int argc, char *argv[])
plat_early_init(); plat_early_init();
/* in_init() must go before config, config accesses in_ fwk */
in_init(); in_init();
emu_prep_defconfig(); in_probe();
emu_read_config(NULL, 0);
config_readlrom(PicoConfigFile);
plat_init(); plat_init();
in_probe();
in_debug_dump(); emu_prep_defconfig(); // depends on input
emu_read_config(NULL, 0);
emu_init(); emu_init();
menu_init(); menu_init();

View file

@ -314,6 +314,17 @@ void menu_init(void)
} }
} }
static void menu_draw_begin(int need_bg)
{
plat_video_menu_begin();
if (need_bg)
memcpy(g_menuscreen_ptr, g_menubg_ptr, g_menuscreen_w * g_menuscreen_h * 2);
}
static void menu_draw_end(void)
{
plat_video_menu_end();
}
static void menu_darken_bg(void *dst, void *src, int pixels, int darker) static void menu_darken_bg(void *dst, void *src, int pixels, int darker)
{ {
@ -342,12 +353,8 @@ static void menu_enter(int is_rom_loaded)
{ {
if (is_rom_loaded) if (is_rom_loaded)
{ {
void *src = g_menubg_src_ptr;
if (src == NULL)
src = g_menuscreen_ptr;
// darken the active framebuffer // darken the active framebuffer
menu_darken_bg(g_menubg_ptr, src, g_menuscreen_w * g_menuscreen_h, 1); menu_darken_bg(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 1);
} }
else else
{ {
@ -466,7 +473,7 @@ static void me_draw(const menu_entry *entries, int sel, void (*draw_more)(void))
y = g_menuscreen_h / 2 - h / 2; y = g_menuscreen_h / 2 - h / 2;
/* draw */ /* draw */
plat_video_menu_begin(); menu_draw_begin(1);
menu_draw_selection(x, y + vi_sel_ln * me_mfont_h, w); menu_draw_selection(x, y + vi_sel_ln * me_mfont_h, w);
x += me_mfont_w * 2; x += me_mfont_w * 2;
@ -547,7 +554,7 @@ static void me_draw(const menu_entry *entries, int sel, void (*draw_more)(void))
if (draw_more != NULL) if (draw_more != NULL)
draw_more(); draw_more();
plat_video_menu_end(); menu_draw_end();
} }
static int me_process(menu_entry *entry, int is_next, int is_lr) static int me_process(menu_entry *entry, int is_next, int is_lr)
@ -687,7 +694,7 @@ static void draw_menu_credits(void)
if (x < 0) x = 0; if (x < 0) x = 0;
if (y < 0) y = 0; if (y < 0) y = 0;
plat_video_menu_begin(); menu_draw_begin(1);
for (p = creds; *p != 0 && y <= g_menuscreen_h - me_mfont_h; y += me_mfont_h) { for (p = creds; *p != 0 && y <= g_menuscreen_h - me_mfont_h; y += me_mfont_h) {
text_out16(x, y, p); text_out16(x, y, p);
@ -698,7 +705,7 @@ static void draw_menu_credits(void)
p++; p++;
} }
plat_video_menu_end(); menu_draw_end();
} }
// --------- loading ROM screen ---------- // --------- loading ROM screen ----------
@ -708,20 +715,25 @@ static int cdload_called = 0;
static void load_progress_cb(int percent) static void load_progress_cb(int percent)
{ {
int ln, len = percent * g_menuscreen_w / 100; int ln, len = percent * g_menuscreen_w / 100;
unsigned short *dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2; unsigned short *dst;
if (len > g_menuscreen_w) if (len > g_menuscreen_w)
len = g_menuscreen_w; len = g_menuscreen_w;
menu_draw_begin(0);
dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2;
for (ln = me_sfont_h - 2; ln > 0; ln--, dst += g_menuscreen_w) for (ln = me_sfont_h - 2; ln > 0; ln--, dst += g_menuscreen_w)
memset(dst, 0xff, len * 2); memset(dst, 0xff, len * 2);
plat_video_menu_end(); menu_draw_end();
} }
static void cdload_progress_cb(const char *fname, int percent) static void cdload_progress_cb(const char *fname, int percent)
{ {
int ln, len = percent * g_menuscreen_w / 100; int ln, len = percent * g_menuscreen_w / 100;
unsigned short *dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2; unsigned short *dst;
menu_draw_begin(0);
dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2;
memset(dst, 0xff, g_menuscreen_w * (me_sfont_h - 2) * 2); memset(dst, 0xff, g_menuscreen_w * (me_sfont_h - 2) * 2);
smalltext_out16(1, 3 * me_sfont_h, "Processing CD image / MP3s", 0xffff); smalltext_out16(1, 3 * me_sfont_h, "Processing CD image / MP3s", 0xffff);
@ -730,10 +742,11 @@ static void cdload_progress_cb(const char *fname, int percent)
if (len > g_menuscreen_w) if (len > g_menuscreen_w)
len = g_menuscreen_w; len = g_menuscreen_w;
for (ln = (me_sfont_h - 2); ln > 0; ln--, dst += g_menuscreen_w) for (ln = (me_sfont_h - 2); ln > 0; ln--, dst += g_menuscreen_w)
memset(dst, 0xff, len * 2); memset(dst, 0xff, len * 2);
menu_draw_end();
plat_video_menu_end();
cdload_called = 1; cdload_called = 1;
} }
@ -747,10 +760,10 @@ void menu_romload_prepare(const char *rom_name)
/* fill all buffers, callbacks won't update in full */ /* fill all buffers, callbacks won't update in full */
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
plat_video_menu_begin(); menu_draw_begin(1);
smalltext_out16(1, 1, "Loading", 0xffff); smalltext_out16(1, 1, "Loading", 0xffff);
smalltext_out16(1, me_sfont_h, p, 0xffff); smalltext_out16(1, me_sfont_h, p, 0xffff);
plat_video_menu_end(); menu_draw_end();
} }
PicoCartLoadProgressCB = load_progress_cb; PicoCartLoadProgressCB = load_progress_cb;
@ -762,9 +775,11 @@ void menu_romload_end(void)
{ {
PicoCartLoadProgressCB = NULL; PicoCartLoadProgressCB = NULL;
PicoCDLoadProgressCB = NULL; PicoCDLoadProgressCB = NULL;
menu_draw_begin(0);
smalltext_out16(1, (cdload_called ? 6 : 3) * me_sfont_h, smalltext_out16(1, (cdload_called ? 6 : 3) * me_sfont_h,
"Starting emulation...", 0xffff); "Starting emulation...", 0xffff);
plat_video_menu_end(); menu_draw_end();
} }
// -------------- del confirm --------------- // -------------- del confirm ---------------
@ -775,7 +790,7 @@ static void do_delete(const char *fpath, const char *fname)
const char *nm; const char *nm;
char tmp[64]; char tmp[64];
plat_video_menu_begin(); menu_draw_begin(1);
if (!rom_loaded) if (!rom_loaded)
menu_darken_bg(g_menuscreen_ptr, g_menuscreen_ptr, g_menuscreen_w * g_menuscreen_h, 0); menu_darken_bg(g_menuscreen_ptr, g_menuscreen_ptr, g_menuscreen_w * g_menuscreen_h, 0);
@ -797,7 +812,7 @@ static void do_delete(const char *fpath, const char *fname)
len = strlen(tmp); len = strlen(tmp);
text_out16(mid - me_mfont_w * len / 2, 12 * me_mfont_h, tmp); text_out16(mid - me_mfont_w * len / 2, 12 * me_mfont_h, tmp);
plat_video_menu_end(); menu_draw_end();
while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MA2)); while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MA2));
inp = in_menu_wait(PBTN_MA3|PBTN_MBACK, 100); inp = in_menu_wait(PBTN_MA3|PBTN_MBACK, 100);
@ -832,7 +847,7 @@ static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)
start = max_cnt / 2 - sel; start = max_cnt / 2 - sel;
n--; // exclude current dir (".") n--; // exclude current dir (".")
plat_video_menu_begin(); menu_draw_begin(1);
// if (!rom_loaded) // if (!rom_loaded)
// menu_darken_bg(gp2x_screen, 320*240, 0); // menu_darken_bg(gp2x_screen, 320*240, 0);
@ -856,7 +871,7 @@ static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)
} }
} }
smalltext_out16(5, max_cnt/2 * me_sfont_h, ">", 0xffff); smalltext_out16(5, max_cnt/2 * me_sfont_h, ">", 0xffff);
plat_video_menu_end(); menu_draw_end();
} }
static int scandir_cmp(const void *p1, const void *p2) static int scandir_cmp(const void *p1, const void *p2)
@ -1038,7 +1053,7 @@ static void draw_patchlist(int sel)
max_cnt = g_menuscreen_h / me_sfont_h; max_cnt = g_menuscreen_h / me_sfont_h;
start = max_cnt / 2 - sel; start = max_cnt / 2 - sel;
plat_video_menu_begin(); menu_draw_begin(1);
for (i = 0; i < PicoPatchCount; i++) { for (i = 0; i < PicoPatchCount; i++) {
pos = start + i; pos = start + i;
@ -1053,7 +1068,7 @@ static void draw_patchlist(int sel)
smalltext_out16(14, pos * me_sfont_h, "done", 0xffff); smalltext_out16(14, pos * me_sfont_h, "done", 0xffff);
text_out16(5, max_cnt / 2 * me_sfont_h, ">"); text_out16(5, max_cnt / 2 * me_sfont_h, ">");
plat_video_menu_end(); menu_draw_end();
} }
static void menu_loop_patches(void) static void menu_loop_patches(void)
@ -1109,8 +1124,9 @@ static void draw_savestate_bg(int slot)
PicoStateLoadGfx(fname); PicoStateLoadGfx(fname);
/* do a frame and fetch menu bg */ /* do a frame and fetch menu bg */
pemu_forced_frame(POPT_EN_SOFTSCALE, 0); pemu_forced_frame(0, 0);
menu_enter(1);
menu_darken_bg(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 1);
PicoTmpStateRestore(tmp_state); PicoTmpStateRestore(tmp_state);
} }
@ -1129,7 +1145,7 @@ static void draw_savestate_menu(int menu_sel, int is_loading)
y = g_menuscreen_h / 2 - h / 2; y = g_menuscreen_h / 2 - h / 2;
if (y < 0) y = 0; if (y < 0) y = 0;
plat_video_menu_begin(); menu_draw_begin(1);
text_out16(x, y, is_loading ? "Load state" : "Save state"); text_out16(x, y, is_loading ? "Load state" : "Save state");
y += 3 * me_mfont_h; y += 3 * me_mfont_h;
@ -1143,7 +1159,7 @@ static void draw_savestate_menu(int menu_sel, int is_loading)
} }
text_out16(x, y, "back"); text_out16(x, y, "back");
plat_video_menu_end(); menu_draw_end();
} }
static int menu_loop_savestate(int is_loading) static int menu_loop_savestate(int is_loading)
@ -1199,7 +1215,7 @@ static int menu_loop_savestate(int is_loading)
static char *action_binds(int player_idx, int action_mask, int dev_id) static char *action_binds(int player_idx, int action_mask, int dev_id)
{ {
int k, count, can_combo, type; int k, count = 0, can_combo = 0, type;
const int *binds; const int *binds;
static_buff[0] = 0; static_buff[0] = 0;
@ -1208,8 +1224,8 @@ static char *action_binds(int player_idx, int action_mask, int dev_id)
if (binds == NULL) if (binds == NULL)
return static_buff; return static_buff;
count = in_get_dev_info(dev_id, IN_INFO_BIND_COUNT); in_get_config(dev_id, IN_CFG_BIND_COUNT, &count);
can_combo = in_get_dev_info(dev_id, IN_INFO_DOES_COMBOS); in_get_config(dev_id, IN_CFG_DOES_COMBOS, &can_combo);
type = IN_BINDTYPE_EMU; type = IN_BINDTYPE_EMU;
if (player_idx >= 0) { if (player_idx >= 0) {
@ -1244,13 +1260,13 @@ static int count_bound_keys(int dev_id, int action_mask, int bindtype)
{ {
const int *binds; const int *binds;
int k, keys = 0; int k, keys = 0;
int count; int count = 0;
binds = in_get_dev_binds(dev_id); binds = in_get_dev_binds(dev_id);
if (binds == NULL) if (binds == NULL)
return 0; return 0;
count = in_get_dev_info(dev_id, IN_INFO_BIND_COUNT); in_get_config(dev_id, IN_CFG_BIND_COUNT, &count);
for (k = 0; k < count; k++) for (k = 0; k < count; k++)
{ {
if (binds[IN_BIND_OFFS(k, bindtype)] & action_mask) if (binds[IN_BIND_OFFS(k, bindtype)] & action_mask)
@ -1273,7 +1289,7 @@ static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_
if (x < me_mfont_w * 2) if (x < me_mfont_w * 2)
x = me_mfont_w * 2; x = me_mfont_w * 2;
plat_video_menu_begin(); menu_draw_begin(1);
if (player_idx >= 0) if (player_idx >= 0)
text_out16(x, y, "Player %i controls", player_idx + 1); text_out16(x, y, "Player %i controls", player_idx + 1);
else else
@ -1309,12 +1325,12 @@ static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_
text_out16(x, g_menuscreen_h - 2 * me_mfont_h, "Press left/right for other devs"); text_out16(x, g_menuscreen_h - 2 * me_mfont_h, "Press left/right for other devs");
} }
plat_video_menu_end(); menu_draw_end();
} }
static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_idx) static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_idx)
{ {
int i, sel = 0, menu_sel_max = opt_cnt - 1; int i, sel = 0, menu_sel_max = opt_cnt - 1, does_combos = 0;
int dev_id, dev_count, kc, is_down, mkey; int dev_id, dev_count, kc, is_down, mkey;
int unbind, bindtype, mask_shift; int unbind, bindtype, mask_shift;
@ -1383,8 +1399,8 @@ static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_
unbind = (i > 0); unbind = (i > 0);
/* allow combos if device supports them */ /* allow combos if device supports them */
if (i == 1 && bindtype == IN_BINDTYPE_EMU && in_get_config(dev_id, IN_CFG_DOES_COMBOS, &does_combos);
in_get_dev_info(dev_id, IN_INFO_DOES_COMBOS)) if (i == 1 && bindtype == IN_BINDTYPE_EMU && does_combos)
unbind = 0; unbind = 0;
if (unbind) if (unbind)
@ -1477,6 +1493,7 @@ static menu_entry e_menu_keyconfig[] =
mee_handler_id("Emulator controls", MA_CTRL_EMU, key_config_loop_wrap), mee_handler_id("Emulator controls", MA_CTRL_EMU, key_config_loop_wrap),
mee_onoff ("6 button pad", MA_OPT_6BUTTON_PAD, PicoOpt, POPT_6BTN_PAD), mee_onoff ("6 button pad", MA_OPT_6BUTTON_PAD, PicoOpt, POPT_6BTN_PAD),
mee_range ("Turbo rate", MA_CTRL_TURBO_RATE, currentConfig.turbo_rate, 1, 30), mee_range ("Turbo rate", MA_CTRL_TURBO_RATE, currentConfig.turbo_rate, 1, 30),
mee_range ("Analog deadzone", MA_CTRL_DEADZONE, currentConfig.analog_deadzone, 1, 99),
mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg), mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg),
mee_cust_nosave("Save cfg for loaded game", MA_OPT_SAVECFG_GAME, mh_saveloadcfg, mgn_saveloadcfg), mee_cust_nosave("Save cfg for loaded game", MA_OPT_SAVECFG_GAME, mh_saveloadcfg, mgn_saveloadcfg),
mee_label (""), mee_label (""),
@ -1834,7 +1851,7 @@ static menu_entry e_menu_options[] =
mee_onoff ("Enable sound", MA_OPT_ENABLE_SOUND, currentConfig.EmuOpt, EOPT_EN_SOUND), mee_onoff ("Enable sound", MA_OPT_ENABLE_SOUND, currentConfig.EmuOpt, EOPT_EN_SOUND),
mee_cust ("Sound Quality", MA_OPT_SOUND_QUALITY, mh_opt_misc, mgn_opt_sound), mee_cust ("Sound Quality", MA_OPT_SOUND_QUALITY, mh_opt_misc, mgn_opt_sound),
mee_enum_h ("Confirm savestate", MA_OPT_CONFIRM_STATES,currentConfig.confirm_save, men_confirm_save, h_confirm_save), mee_enum_h ("Confirm savestate", MA_OPT_CONFIRM_STATES,currentConfig.confirm_save, men_confirm_save, h_confirm_save),
mee_range ("", MA_OPT_CPU_CLOCKS, currentConfig.CPUclock, 20, 900), mee_range ("", MA_OPT_CPU_CLOCKS, currentConfig.CPUclock, 20, 1200),
mee_handler ("[Display options]", menu_loop_gfx_options), mee_handler ("[Display options]", menu_loop_gfx_options),
mee_handler ("[Sega/Mega CD options]", menu_loop_cd_options), mee_handler ("[Sega/Mega CD options]", menu_loop_cd_options),
#ifndef NO_32X #ifndef NO_32X
@ -1854,7 +1871,7 @@ static int menu_loop_options(menu_id id, int keys)
int i; int i;
i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS); i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS);
e_menu_options[i].enabled = e_menu_options[i].name ? 1 : 0; e_menu_options[i].enabled = e_menu_options[i].name[0] ? 1 : 0;
me_enable(e_menu_options, MA_OPT_SAVECFG_GAME, rom_loaded); me_enable(e_menu_options, MA_OPT_SAVECFG_GAME, rom_loaded);
me_enable(e_menu_options, MA_OPT_LOADCFG, config_slot != config_slot_current); me_enable(e_menu_options, MA_OPT_LOADCFG, config_slot != config_slot_current);
@ -1926,8 +1943,8 @@ static void draw_frame_debug(void)
if (PicoDrawMask & PDRAW_SPRITES_HI_ON) memcpy(layer_str + 19, "spr_hi", 6); if (PicoDrawMask & PDRAW_SPRITES_HI_ON) memcpy(layer_str + 19, "spr_hi", 6);
if (PicoDrawMask & PDRAW_32X_ON) memcpy(layer_str + 26, "32x", 4); if (PicoDrawMask & PDRAW_32X_ON) memcpy(layer_str + 26, "32x", 4);
memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2); pemu_forced_frame(1, 0);
pemu_forced_frame(0, 0); memcpy(g_menuscreen_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h * 2);
smalltext_out16(4, 1, "build: r" REVISION " "__DATE__ " " __TIME__ " " COMPILER, 0xffff); smalltext_out16(4, 1, "build: r" REVISION " "__DATE__ " " __TIME__ " " COMPILER, 0xffff);
smalltext_out16(4, g_menuscreen_h - me_sfont_h, layer_str, 0xffff); smalltext_out16(4, g_menuscreen_h - me_sfont_h, layer_str, 0xffff);
} }
@ -1940,10 +1957,10 @@ static void debug_menu_loop(void)
while (1) while (1)
{ {
menu_draw_begin(1);
switch (mode) switch (mode)
{ {
case 0: plat_video_menu_begin(); case 0: tmp = PDebugMain();
tmp = PDebugMain();
plat_debug_cat(tmp); plat_debug_cat(tmp);
draw_text_debug(tmp, 0, 0); draw_text_debug(tmp, 0, 0);
if (dumped) { if (dumped) {
@ -1954,9 +1971,8 @@ static void debug_menu_loop(void)
break; break;
case 1: draw_frame_debug(); case 1: draw_frame_debug();
break; break;
case 2: memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2); case 2: pemu_forced_frame(1, 0);
pemu_forced_frame(0, 1); menu_darken_bg(g_menuscreen_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 0);
menu_darken_bg(g_menuscreen_ptr, g_menuscreen_ptr, g_menuscreen_w * g_menuscreen_h, 0);
PDebugShowSpriteStats((unsigned short *)g_menuscreen_ptr + (g_menuscreen_h/2 - 240/2)*g_menuscreen_w + PDebugShowSpriteStats((unsigned short *)g_menuscreen_ptr + (g_menuscreen_h/2 - 240/2)*g_menuscreen_w +
g_menuscreen_w/2 - 320/2, g_menuscreen_w); g_menuscreen_w/2 - 320/2, g_menuscreen_w);
break; break;
@ -1966,12 +1982,11 @@ static void debug_menu_loop(void)
g_menuscreen_w, spr_offs); g_menuscreen_w, spr_offs);
draw_text_debug(PDebugSpriteList(), spr_offs, 6); draw_text_debug(PDebugSpriteList(), spr_offs, 6);
break; break;
case 4: plat_video_menu_begin(); case 4: tmp = PDebug32x();
tmp = PDebug32x();
draw_text_debug(tmp, 0, 0); draw_text_debug(tmp, 0, 0);
break; break;
} }
plat_video_menu_end(); menu_draw_end();
inp = in_menu_wait(PBTN_MOK|PBTN_MBACK|PBTN_MA2|PBTN_MA3|PBTN_L|PBTN_R | inp = in_menu_wait(PBTN_MOK|PBTN_MBACK|PBTN_MA2|PBTN_MA3|PBTN_L|PBTN_R |
PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT, 70); PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT, 70);
@ -2118,7 +2133,7 @@ void menu_loop(void)
me_enable(e_menu_main, MA_MAIN_PATCHES, PicoPatches != NULL); me_enable(e_menu_main, MA_MAIN_PATCHES, PicoPatches != NULL);
menu_enter(rom_loaded); menu_enter(rom_loaded);
in_set_blocking(1); in_set_config_int(0, IN_CFG_BLOCKING, 1);
me_loop(e_menu_main, &sel, menu_main_plat_draw); me_loop(e_menu_main, &sel, menu_main_plat_draw);
if (rom_loaded) { if (rom_loaded) {
@ -2129,7 +2144,7 @@ void menu_loop(void)
; ;
} }
in_set_blocking(0); in_set_config_int(0, IN_CFG_BLOCKING, 0);
} }
// --------- CD tray close menu ---------- // --------- CD tray close menu ----------
@ -2167,7 +2182,7 @@ int menu_loop_tray(void)
menu_enter(rom_loaded); menu_enter(rom_loaded);
in_set_blocking(1); in_set_config_int(0, IN_CFG_BLOCKING, 1);
me_loop(e_menu_tray, &sel, NULL); me_loop(e_menu_tray, &sel, NULL);
if (engineState != PGS_RestartRun) { if (engineState != PGS_RestartRun) {
@ -2176,7 +2191,7 @@ int menu_loop_tray(void)
} }
while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK)); while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK));
in_set_blocking(0); in_set_config_int(0, IN_CFG_BLOCKING, 0);
return ret; return ret;
} }

View file

@ -101,6 +101,7 @@ typedef enum
MA_CTRL_PLAYER2, MA_CTRL_PLAYER2,
MA_CTRL_EMU, MA_CTRL_EMU,
MA_CTRL_TURBO_RATE, MA_CTRL_TURBO_RATE,
MA_CTRL_DEADZONE,
MA_CTRL_DEV_FIRST, MA_CTRL_DEV_FIRST,
MA_CTRL_DEV_NEXT, MA_CTRL_DEV_NEXT,
MA_CTRL_DONE, MA_CTRL_DONE,

View file

@ -10,7 +10,7 @@ void pemu_prep_defconfig(void);
void pemu_validate_config(void); void pemu_validate_config(void);
void pemu_loop_prep(void); void pemu_loop_prep(void);
void pemu_loop_end(void); void pemu_loop_end(void);
void pemu_forced_frame(int opts, int no_scale); void pemu_forced_frame(int no_scale, int do_emu); // ..to g_menubg_src_ptr
void pemu_finalize_frame(const char *fps, const char *notice_msg); void pemu_finalize_frame(const char *fps, const char *notice_msg);
void pemu_sound_start(void); void pemu_sound_start(void);

View file

@ -294,13 +294,15 @@ static void SkipFrame(void)
} }
/* forced frame to front buffer */ /* forced frame to front buffer */
void pemu_forced_frame(int opts, int no_scale) void pemu_forced_frame(int no_scale, int do_emu)
{ {
int po_old = PicoOpt; int po_old = PicoOpt;
int eo_old = currentConfig.EmuOpt; int eo_old = currentConfig.EmuOpt;
PicoOpt &= ~0x10; PicoOpt &= ~0x10;
PicoOpt |= opts|POPT_ACC_SPRITES; PicoOpt |= POPT_ACC_SPRITES;
if (!no_scale)
PicoOpt |= POPT_EN_SOFTSCALE;
currentConfig.EmuOpt |= 0x80; currentConfig.EmuOpt |= 0x80;
if (giz_screen == NULL) if (giz_screen == NULL)

View file

@ -23,6 +23,7 @@
#include "../common/fonts.h" #include "../common/fonts.h"
#include "../common/emu.h" #include "../common/emu.h"
#include "../common/config.h" #include "../common/config.h"
#include "../common/input.h"
#include "../linux/sndout_oss.h" #include "../linux/sndout_oss.h"
#include "version.h" #include "version.h"
@ -60,6 +61,7 @@ void pemu_prep_defconfig(void)
defaultConfig.CPUclock = default_cpu_clock; defaultConfig.CPUclock = default_cpu_clock;
defaultConfig.renderer32x = RT_8BIT_FAST; defaultConfig.renderer32x = RT_8BIT_FAST;
defaultConfig.analog_deadzone = 50;
soc = soc_detect(); soc = soc_detect();
if (soc == SOCID_MMSP2) if (soc == SOCID_MMSP2)
@ -523,9 +525,10 @@ static void vid_reset_mode(void)
} }
else { else {
PicoDrawSetOutFormat(PDF_NONE, 0); PicoDrawSetOutFormat(PDF_NONE, 0);
PicoDraw32xSetFrameMode(1, (renderer == RT_16BIT) ? 1 : 0); PicoDraw32xSetFrameMode(1, 0);
} }
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2); PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
gp2x_mode = 16;
} }
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) { if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {
@ -548,12 +551,7 @@ static void vid_reset_mode(void)
else else
osd_text = (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) ? osd_text8_rot : osd_text8; 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_wait_vsync();
gp2x_video_changemode(gp2x_mode);
if (!is_16bit_mode()) { if (!is_16bit_mode()) {
// setup pal for 8-bit modes // setup pal for 8-bit modes
localPal[0xc0] = 0x0000c000; // MCD LEDs localPal[0xc0] = 0x0000c000; // MCD LEDs
@ -566,6 +564,11 @@ static void vid_reset_mode(void)
else else
gp2x_memset_all_buffers(0, 0, 320*240*2); 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; Pico.m.dirtyPal = 1;
PicoOpt &= ~POPT_EN_SOFTSCALE; PicoOpt &= ~POPT_EN_SOFTSCALE;
@ -794,13 +797,15 @@ void pemu_sound_wait(void)
// don't need to do anything, writes will block by themselves // 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; int po_old = PicoOpt;
doing_bg_frame = 1; doing_bg_frame = 1;
PicoOpt &= ~POPT_ALT_RENDERER; 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); 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); PicoDrawSetCallbacks(NULL, NULL);
Pico.m.dirtyPal = 1; Pico.m.dirtyPal = 1;
if (no_scale == -9) if (do_emu)
// yes I'm lazy, see pemu_forced_frame call below
PicoFrame(); PicoFrame();
else else
PicoFrameDrawOnly(); PicoFrameDrawOnly();
g_menubg_src_ptr = g_screen_ptr;
doing_bg_frame = 0; doing_bg_frame = 0;
PicoOpt = po_old; PicoOpt = po_old;
} }
@ -909,6 +914,10 @@ void pemu_loop_prep(void)
unset_lcd_custom_rate(); 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) if ((EmuOpt_old ^ currentConfig.EmuOpt) & EOPT_MMUHACK)
gp2x_make_fb_bufferable(currentConfig.EmuOpt & EOPT_MMUHACK); gp2x_make_fb_bufferable(currentConfig.EmuOpt & EOPT_MMUHACK);
@ -931,8 +940,7 @@ void pemu_loop_end(void)
pemu_sound_stop(); pemu_sound_stop();
/* do one more frame for menu bg */ /* do one more frame for menu bg */
pemu_forced_frame(POPT_EN_SOFTSCALE, -9); pemu_forced_frame(0, 1);
g_menubg_src_ptr = g_screen_ptr;
} }
const char *plat_get_credits(void) 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_adv_options[];
static menu_entry e_menu_gfx_options[]; static menu_entry e_menu_gfx_options[];
static menu_entry e_menu_options[]; static menu_entry e_menu_options[];
static menu_entry e_menu_keyconfig[];
void gp2x_menu_init(void) void gp2x_menu_init(void)
{ {
@ -120,5 +121,8 @@ void gp2x_menu_init(void)
if (gp2x_dev_id != GP2X_DEV_GP2X) if (gp2x_dev_id != GP2X_DEV_GP2X)
men_scaling_opts[2] = NULL; /* leave only off and sw */ 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/readpng.h"
#include "../common/menu.h" #include "../common/menu.h"
#include "../common/emu.h" #include "../common/emu.h"
#include "../common/input.h"
#include "../linux/sndout_oss.h" #include "../linux/sndout_oss.h"
#include <pico/pico.h> #include <pico/pico.h>
@ -20,6 +21,27 @@ int gp2x_dev_id;
int gp2x_current_bpp; int gp2x_current_bpp;
void *gp2x_screens[4]; 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) void gp2x_video_changemode(int bpp)
{ {
gp2x_video_changemode_ll(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); memset(gp2x_screens[1], 0, 320*240*2);
gp2x_video_flip2(); // might flip to fb2/3 gp2x_video_flip2(); // might flip to fb2/3
gp2x_video_flip2(); // ..so we do it again gp2x_video_flip2(); // ..so we do it again
// gp2x_video_wait_vsync();
} }
else
gp2x_video_flip2();
// switch to 16bpp // switch to 16bpp
gp2x_video_changemode_ll(16); gp2x_video_changemode_ll(16);
@ -85,14 +108,11 @@ void plat_video_menu_enter(int is_rom_loaded)
void plat_video_menu_begin(void) void plat_video_menu_begin(void)
{ {
memcpy(g_screen_ptr, gp2x_screens[2], 320*240*2);
g_menuscreen_ptr = g_screen_ptr; g_menuscreen_ptr = g_screen_ptr;
} }
void plat_video_menu_end(void) void plat_video_menu_end(void)
{ {
// FIXME
// gp2x_video_flush_cache();
gp2x_video_flip2(); gp2x_video_flip2();
} }
@ -126,7 +146,9 @@ void plat_early_init(void)
break; 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) void plat_init(void)
@ -156,6 +178,12 @@ void plat_init(void)
// snd // snd
sndout_oss_init(); 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) void plat_finish(void)

View file

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

View file

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

View file

@ -174,7 +174,6 @@ void plat_video_menu_enter(int is_rom_loaded)
void plat_video_menu_begin(void) void plat_video_menu_begin(void)
{ {
memcpy32(g_screen_ptr, g_menubg_ptr, g_screen_width * g_screen_height * 2 / 4);
g_menuscreen_ptr = g_screen_ptr; g_menuscreen_ptr = g_screen_ptr;
} }
@ -209,23 +208,29 @@ void plat_update_volume(int has_changed, int is_up)
{ {
} }
void pemu_forced_frame(int opts, int no_scale) void pemu_forced_frame(int no_scale, int do_emu)
{ {
int po_old = PicoOpt; int po_old = PicoOpt;
int eo_old = currentConfig.EmuOpt;
memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);
PicoOpt &= ~POPT_ALT_RENDERER; PicoOpt &= ~POPT_ALT_RENDERER;
PicoOpt |= opts|POPT_ACC_SPRITES; // acc_sprites PicoOpt |= POPT_ACC_SPRITES;
if (!no_scale)
PicoOpt |= POPT_EN_SOFTSCALE;
PicoDrawSetOutFormat(PDF_RGB555, 1); PicoDrawSetOutFormat(PDF_RGB555, 1);
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2); PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
PicoDraw32xSetFrameMode(0, 0); PicoDraw32xSetFrameMode(0, 0);
Pico.m.dirtyPal = 1; Pico.m.dirtyPal = 1;
if (do_emu)
PicoFrame();
else
PicoFrameDrawOnly(); PicoFrameDrawOnly();
g_menubg_src_ptr = g_screen_ptr;
PicoOpt = po_old; PicoOpt = po_old;
currentConfig.EmuOpt = eo_old;
} }
static void updateSound(int len) static void updateSound(int len)
@ -300,24 +305,10 @@ void pemu_loop_prep(void)
void pemu_loop_end(void) void pemu_loop_end(void)
{ {
int po_old = PicoOpt;
int eo_old = currentConfig.EmuOpt;
pemu_sound_stop(); pemu_sound_stop();
memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);
/* do one more frame for menu bg */ /* do one more frame for menu bg */
PicoOpt &= ~POPT_ALT_RENDERER; pemu_forced_frame(0, 1);
PicoOpt |= POPT_EN_SOFTSCALE|POPT_ACC_SPRITES;
PicoDrawSetOutFormat(PDF_RGB555, 1);
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
PicoDraw32xSetFrameMode(0, 0);
Pico.m.dirtyPal = 1;
PicoFrame();
PicoOpt = po_old;
currentConfig.EmuOpt = eo_old;
} }
void plat_wait_till_us(unsigned int us_to) void plat_wait_till_us(unsigned int us_to)

View file

@ -21,10 +21,10 @@ static int menu_loop_cscaler(menu_id id, int keys)
for (;;) for (;;)
{ {
plat_video_menu_begin(); menu_draw_begin(0);
memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2); memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);
text_out16(2, 480 - 18, "%dx%d | d-pad to resize, R+d-pad to move", g_layer_cw, g_layer_ch); text_out16(2, 480 - 18, "%dx%d | d-pad to resize, R+d-pad to move", g_layer_cw, g_layer_ch);
plat_video_menu_end(); menu_draw_end();
inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_R|PBTN_MOK|PBTN_MBACK, 40); inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_R|PBTN_MOK|PBTN_MBACK, 40);
if (inp & PBTN_UP) g_layer_cy--; if (inp & PBTN_UP) g_layer_cy--;
@ -82,6 +82,7 @@ static int menu_loop_cscaler(menu_id id, int keys)
static menu_entry e_menu_gfx_options[]; static menu_entry e_menu_gfx_options[];
static menu_entry e_menu_options[]; static menu_entry e_menu_options[];
static menu_entry e_menu_keyconfig[];
void pnd_menu_init(void) void pnd_menu_init(void)
{ {
@ -141,7 +142,9 @@ void pnd_menu_init(void)
e_menu_gfx_options[i].data = (void *)mfilters; e_menu_gfx_options[i].data = (void *)mfilters;
pnd_filter_list = mfilters; pnd_filter_list = mfilters;
i = me_id2offset(e_menu_options, MA_OPT_SCALING); i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS);
e_menu_options[i]->name = "Max CPU clock"; e_menu_options[i].name = "Max CPU clock";
me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, 0);
} }

View file

@ -18,6 +18,7 @@
#include "../common/menu.h" #include "../common/menu.h"
#include "../common/plat.h" #include "../common/plat.h"
#include "../common/arm_utils.h" #include "../common/arm_utils.h"
#include "../common/input.h"
#include "../linux/sndout_oss.h" #include "../linux/sndout_oss.h"
#include "../linux/fbdev.h" #include "../linux/fbdev.h"
#include "plat.h" #include "plat.h"
@ -26,6 +27,7 @@
#include <pico/pico_int.h> #include <pico/pico_int.h>
#include <linux/input.h>
static struct vout_fbdev *main_fb, *layer_fb; static struct vout_fbdev *main_fb, *layer_fb;
static int g_layer_x, g_layer_y; static int g_layer_x, g_layer_y;
@ -40,6 +42,23 @@ unsigned char *PicoDraw2FB = temp_frame;
const char *renderer_names[] = { NULL }; const char *renderer_names[] = { NULL };
const char *renderer_names32x[] = { NULL }; const char *renderer_names32x[] = { NULL };
static const char * const pandora_gpio_keys[KEY_MAX + 1] = {
[0 ... KEY_MAX] = NULL,
[KEY_UP] = "Up",
[KEY_LEFT] = "Left",
[KEY_RIGHT] = "Right",
[KEY_DOWN] = "Down",
[KEY_HOME] = "A",
[KEY_PAGEDOWN] = "X",
[KEY_END] = "B",
[KEY_PAGEUP] = "Y",
[KEY_RIGHTSHIFT]= "L",
[KEY_RIGHTCTRL] = "R",
[KEY_LEFTALT] = "Start",
[KEY_LEFTCTRL] = "Select",
[KEY_MENU] = "Pandora",
};
static int get_cpu_clock(void) static int get_cpu_clock(void)
{ {
FILE *f; FILE *f;
@ -137,7 +156,6 @@ void plat_video_menu_enter(int is_rom_loaded)
void plat_video_menu_begin(void) void plat_video_menu_begin(void)
{ {
memcpy32(g_menuscreen_ptr, g_menubg_ptr, g_menuscreen_w * g_menuscreen_h * 2 / 4);
} }
void plat_video_menu_end(void) void plat_video_menu_end(void)
@ -189,23 +207,45 @@ void plat_update_volume(int has_changed, int is_up)
} }
} }
void pemu_forced_frame(int opts, int no_scale) static void make_bg(void)
{
unsigned short *s = (void *)fb_copy;
unsigned int t, *d = (unsigned int *)g_menubg_src_ptr + 80 / 2;
int x, y;
memset32(g_menubg_src_ptr, 0, 800 * 480 * 2 / 4);
for (y = 0; y < 240; y++, s += 320, d += 800*2/2) {
for (x = 0; x < 320; x++) {
t = s[x];
t |= t << 16;
d[x] = d[x + 800 / 2] = t;
}
}
}
void pemu_forced_frame(int no_scale, int do_emu)
{ {
int oldscale = currentConfig.scaling;
int po_old = PicoOpt; int po_old = PicoOpt;
if (no_scale) { memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);
currentConfig.scaling = SCALE_1x1;
emu_video_mode_change(8, 224, 0);
}
PicoOpt |= opts|POPT_ACC_SPRITES; PicoOpt |= POPT_ACC_SPRITES;
if (!no_scale)
PicoOpt |= POPT_EN_SOFTSCALE;
PicoDrawSetOutFormat(PDF_RGB555, 1);
Pico.m.dirtyPal = 1; Pico.m.dirtyPal = 1;
if (do_emu)
PicoFrame();
else
PicoFrameDrawOnly(); PicoFrameDrawOnly();
// making a copy because enabling the layer clears it's mem
memcpy32((void *)fb_copy, g_screen_ptr, sizeof(fb_copy) / 4);
make_bg(); // FIXME: honour no_scale
PicoOpt = po_old; PicoOpt = po_old;
currentConfig.scaling = oldscale;
} }
static void updateSound(int len) static void updateSound(int len)
@ -425,23 +465,6 @@ void emu_video_mode_change(int start_line, int line_count, int is_32cols)
plat_video_flip(); plat_video_flip();
} }
static void make_bg(void)
{
unsigned short *s = (void *)fb_copy;
unsigned int t, *d = (unsigned int *)g_menubg_src_ptr + 80 / 2;
int x, y;
memset32(g_menubg_src_ptr, 0, 800 * 480 * 2 / 4);
for (y = 0; y < 240; y++, s += 320, d += 800*2/2) {
for (x = 0; x < 320; x++) {
t = s[x];
t |= t << 16;
d[x] = d[x + 800 / 2] = t;
}
}
}
void pemu_loop_prep(void) void pemu_loop_prep(void)
{ {
static int pal_old = -1; static int pal_old = -1;
@ -481,28 +504,12 @@ void pemu_loop_prep(void)
void pemu_loop_end(void) void pemu_loop_end(void)
{ {
int po_old = PicoOpt;
int eo_old = currentConfig.EmuOpt;
pemu_sound_stop(); pemu_sound_stop();
memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);
/* do one more frame for menu bg */ /* do one more frame for menu bg */
PicoOpt |= POPT_EN_SOFTSCALE|POPT_ACC_SPRITES; pemu_forced_frame(0, 1);
currentConfig.EmuOpt |= EOPT_16BPP;
PicoDrawSetOutFormat(PDF_RGB555, 1);
Pico.m.dirtyPal = 1;
PicoFrame();
// making a copy because enabling the layer clears it's mem
memcpy32((void *)fb_copy, g_screen_ptr, sizeof(fb_copy) / 4);
make_bg();
pnd_setup_layer(0, g_layer_x, g_layer_y, g_layer_w, g_layer_h); pnd_setup_layer(0, g_layer_x, g_layer_y, g_layer_w, g_layer_h);
PicoOpt = po_old;
currentConfig.EmuOpt = eo_old;
} }
void plat_wait_till_us(unsigned int us_to) void plat_wait_till_us(unsigned int us_to)
@ -613,6 +620,9 @@ void plat_init(void)
sndout_oss_init(); sndout_oss_init();
pnd_menu_init(); pnd_menu_init();
in_set_config(in_name_to_id("evdev:gpio-keys"), IN_CFG_KEY_NAMES,
pandora_gpio_keys, sizeof(pandora_gpio_keys));
return; return;
fail1: fail1:

View file

@ -1,2 +1,2 @@
#define VERSION "1.80beta2" #define VERSION "1.80"

View file

@ -667,13 +667,15 @@ static void SkipFrame(void)
PicoSkipFrame=0; PicoSkipFrame=0;
} }
void pemu_forced_frame(int opts, int no_scale) void pemu_forced_frame(int no_scale, int do_emu)
{ {
int po_old = PicoOpt; int po_old = PicoOpt;
int eo_old = currentConfig.EmuOpt; int eo_old = currentConfig.EmuOpt;
PicoOpt &= ~0x10; PicoOpt &= ~POPT_ALT_RENDERER;
PicoOpt |= opts|POPT_ACC_SPRITES; PicoOpt |= POPT_ACC_SPRITES;
if (!no_scale)
PicoOpt |= POPT_EN_SOFTSCALE;
currentConfig.EmuOpt |= 0x80; currentConfig.EmuOpt |= 0x80;
vidResetMode(); vidResetMode();

View file

@ -80,7 +80,7 @@ void pemu_loop_end(void)
pemu_sound_stop(); pemu_sound_stop();
} }
void pemu_forced_frame(int opts, int no_scale) void pemu_forced_frame(int no_scale, int do_emu)
{ {
} }