static void keys_write(FILE *fn, const char *bind_str, int dev_id, const int *binds, int no_defaults)
{
char act[48];
- int key_count, k, i;
+ int key_count = 0, k, i;
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);
for (k = 0; k < key_count; k++)
int dummy;
if (!me->need_to_save)
continue;
+ if (me->name == NULL || me->name[0] == 0)
+ continue;
if (me->beh == MB_OPT_ONOFF || me->beh == MB_OPT_CUSTONOFF) {
if (!no_defaults || ((*(int *)me->var ^ default_var(me)) & me->mask))
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)) {
strncpy(line, me->generate_name(0, &dummy), sizeof(line));
goto write_line;
const int *binds = in_get_dev_binds(t);
const char *name = in_get_dev_name(t, 0, 0);
char strbind[16];
- int count;
+ int count = 0;
if (binds == NULL || name == NULL)
continue;
sprintf(strbind, "bind%d", t);
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);
}
if (!me->need_to_save)
continue;
- if (me->name != NULL && me->name[0] != 0) {
- if (strcasecmp(var, me->name) != 0)
- continue; /* surely not this one */
- if (me->beh == MB_OPT_ONOFF) {
- tmp = strtol(val, &p, 0);
- if (*p != 0)
- goto bad_val;
- if (tmp) *(int *)me->var |= me->mask;
- else *(int *)me->var &= ~me->mask;
- return;
- }
- else if (me->beh == MB_OPT_RANGE) {
- tmp = strtol(val, &p, 0);
- if (*p != 0)
- goto bad_val;
- if (tmp < me->min) tmp = me->min;
- if (tmp > me->max) tmp = me->max;
- *(int *)me->var = tmp;
- return;
- }
- else if (me->beh == MB_OPT_ENUM) {
- const char **names, *p1;
- int i;
+ if (me->name == NULL || strcasecmp(var, me->name) != 0)
+ continue;
- names = (const char **)me->data;
- if (names == NULL)
- goto bad_val;
- for (i = 0; names[i] != NULL; i++) {
- for (p1 = names[i]; *p1 == ' '; p1++)
- ;
- if (strcasecmp(p1, val) == 0) {
- *(int *)me->var = i;
- return;
- }
- }
+ if (me->beh == MB_OPT_ONOFF) {
+ tmp = strtol(val, &p, 0);
+ if (*p != 0)
goto bad_val;
+ if (tmp) *(int *)me->var |= me->mask;
+ else *(int *)me->var &= ~me->mask;
+ return;
+ }
+ else if (me->beh == MB_OPT_RANGE) {
+ tmp = strtol(val, &p, 0);
+ if (*p != 0)
+ goto bad_val;
+ if (tmp < me->min) tmp = me->min;
+ if (tmp > me->max) tmp = me->max;
+ *(int *)me->var = tmp;
+ return;
+ }
+ else if (me->beh == MB_OPT_ENUM) {
+ const char **names, *p1;
+ int i;
+
+ names = (const char **)me->data;
+ if (names == NULL)
+ goto bad_val;
+ for (i = 0; names[i] != NULL; i++) {
+ for (p1 = names[i]; *p1 == ' '; p1++)
+ ;
+ if (strcasecmp(p1, val) == 0) {
+ *(int *)me->var = i;
+ return;
+ }
}
+ goto bad_val;
}
- if (!custom_read(me, var, val))
- break;
- return;
+ else if (custom_read(me, var, val))
+ return;
}
lprintf("config_readsect: unhandled var: \"%s\"\n", var);
\r
plat_status_msg_busy_first(tmp);\r
\r
- in_set_blocking(1);\r
+ in_set_config_int(0, IN_CFG_BLOCKING, 1);\r
while (in_menu_wait_any(50) & (PBTN_MA3|PBTN_MBACK))\r
;\r
while ( !((keys = in_menu_wait_any(50)) & (PBTN_MA3|PBTN_MBACK)) )\r
do_it = 0;\r
while (in_menu_wait_any(50) & (PBTN_MA3|PBTN_MBACK))\r
;\r
- in_set_blocking(0);\r
+ in_set_config_int(0, IN_CFG_BLOCKING, 0);\r
}\r
if (do_it) {\r
plat_status_msg_busy_first((which & PEV_STATE_LOAD) ? "LOADING STATE" : "SAVING STATE");\r
int renderer;
int renderer32x;
int filter; // pandora
+ int analog_deadzone;
} currentConfig_t;
extern currentConfig_t currentConfig, defaultConfig;
\r
plat_early_init();\r
\r
- /* in_init() must go before config, config accesses in_ fwk */\r
in_init();\r
- emu_prep_defconfig();\r
- emu_read_config(NULL, 0);\r
- config_readlrom(PicoConfigFile);\r
+ in_probe();\r
\r
plat_init();\r
- in_probe();\r
- in_debug_dump();\r
+\r
+ emu_prep_defconfig(); // depends on input\r
+ emu_read_config(NULL, 0);\r
\r
emu_init();\r
menu_init();\r
}\r
}\r
\r
+static void menu_draw_begin(int need_bg)\r
+{\r
+ plat_video_menu_begin();\r
+ if (need_bg)\r
+ memcpy(g_menuscreen_ptr, g_menubg_ptr, g_menuscreen_w * g_menuscreen_h * 2);\r
+}\r
+\r
+static void menu_draw_end(void)\r
+{\r
+ plat_video_menu_end();\r
+}\r
\r
static void menu_darken_bg(void *dst, void *src, int pixels, int darker)\r
{\r
{\r
if (is_rom_loaded)\r
{\r
- void *src = g_menubg_src_ptr;\r
- if (src == NULL)\r
- src = g_menuscreen_ptr;\r
-\r
// darken the active framebuffer\r
- menu_darken_bg(g_menubg_ptr, src, g_menuscreen_w * g_menuscreen_h, 1);\r
+ menu_darken_bg(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 1);\r
}\r
else\r
{\r
y = g_menuscreen_h / 2 - h / 2;\r
\r
/* draw */\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
menu_draw_selection(x, y + vi_sel_ln * me_mfont_h, w);\r
x += me_mfont_w * 2;\r
\r
if (draw_more != NULL)\r
draw_more();\r
\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static int me_process(menu_entry *entry, int is_next, int is_lr)\r
if (x < 0) x = 0;\r
if (y < 0) y = 0;\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
\r
for (p = creds; *p != 0 && y <= g_menuscreen_h - me_mfont_h; y += me_mfont_h) {\r
text_out16(x, y, p);\r
p++;\r
}\r
\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
// --------- loading ROM screen ----------\r
static void load_progress_cb(int percent)\r
{\r
int ln, len = percent * g_menuscreen_w / 100;\r
- unsigned short *dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2;\r
+ unsigned short *dst;\r
\r
if (len > g_menuscreen_w)\r
len = g_menuscreen_w;\r
+\r
+ menu_draw_begin(0);\r
+ dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2;\r
for (ln = me_sfont_h - 2; ln > 0; ln--, dst += g_menuscreen_w)\r
memset(dst, 0xff, len * 2);\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static void cdload_progress_cb(const char *fname, int percent)\r
{\r
int ln, len = percent * g_menuscreen_w / 100;\r
- unsigned short *dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2;\r
+ unsigned short *dst;\r
\r
+ menu_draw_begin(0);\r
+ dst = (unsigned short *)g_menuscreen_ptr + g_menuscreen_w * me_sfont_h * 2;\r
memset(dst, 0xff, g_menuscreen_w * (me_sfont_h - 2) * 2);\r
\r
smalltext_out16(1, 3 * me_sfont_h, "Processing CD image / MP3s", 0xffff);\r
\r
if (len > g_menuscreen_w)\r
len = g_menuscreen_w;\r
+\r
for (ln = (me_sfont_h - 2); ln > 0; ln--, dst += g_menuscreen_w)\r
memset(dst, 0xff, len * 2);\r
+ menu_draw_end();\r
\r
- plat_video_menu_end();\r
cdload_called = 1;\r
}\r
\r
\r
/* fill all buffers, callbacks won't update in full */\r
for (i = 0; i < 3; i++) {\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
smalltext_out16(1, 1, "Loading", 0xffff);\r
smalltext_out16(1, me_sfont_h, p, 0xffff);\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
PicoCartLoadProgressCB = load_progress_cb;\r
{\r
PicoCartLoadProgressCB = NULL;\r
PicoCDLoadProgressCB = NULL;\r
+\r
+ menu_draw_begin(0);\r
smalltext_out16(1, (cdload_called ? 6 : 3) * me_sfont_h,\r
"Starting emulation...", 0xffff);\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
// -------------- del confirm ---------------\r
const char *nm;\r
char tmp[64];\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
\r
if (!rom_loaded)\r
menu_darken_bg(g_menuscreen_ptr, g_menuscreen_ptr, g_menuscreen_w * g_menuscreen_h, 0);\r
len = strlen(tmp);\r
\r
text_out16(mid - me_mfont_w * len / 2, 12 * me_mfont_h, tmp);\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
\r
while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MA2));\r
inp = in_menu_wait(PBTN_MA3|PBTN_MBACK, 100);\r
start = max_cnt / 2 - sel;\r
n--; // exclude current dir (".")\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
\r
// if (!rom_loaded)\r
// menu_darken_bg(gp2x_screen, 320*240, 0);\r
}\r
}\r
smalltext_out16(5, max_cnt/2 * me_sfont_h, ">", 0xffff);\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static int scandir_cmp(const void *p1, const void *p2)\r
max_cnt = g_menuscreen_h / me_sfont_h;\r
start = max_cnt / 2 - sel;\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
\r
for (i = 0; i < PicoPatchCount; i++) {\r
pos = start + i;\r
smalltext_out16(14, pos * me_sfont_h, "done", 0xffff);\r
\r
text_out16(5, max_cnt / 2 * me_sfont_h, ">");\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static void menu_loop_patches(void)\r
PicoStateLoadGfx(fname);\r
\r
/* do a frame and fetch menu bg */\r
- pemu_forced_frame(POPT_EN_SOFTSCALE, 0);\r
- menu_enter(1);\r
+ pemu_forced_frame(0, 0);\r
+\r
+ menu_darken_bg(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 1);\r
\r
PicoTmpStateRestore(tmp_state);\r
}\r
y = g_menuscreen_h / 2 - h / 2;\r
if (y < 0) y = 0;\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
\r
text_out16(x, y, is_loading ? "Load state" : "Save state");\r
y += 3 * me_mfont_h;\r
}\r
text_out16(x, y, "back");\r
\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static int menu_loop_savestate(int is_loading)\r
\r
static char *action_binds(int player_idx, int action_mask, int dev_id)\r
{\r
- int k, count, can_combo, type;\r
+ int k, count = 0, can_combo = 0, type;\r
const int *binds;\r
\r
static_buff[0] = 0;\r
if (binds == NULL)\r
return static_buff;\r
\r
- count = in_get_dev_info(dev_id, IN_INFO_BIND_COUNT);\r
- can_combo = in_get_dev_info(dev_id, IN_INFO_DOES_COMBOS);\r
+ in_get_config(dev_id, IN_CFG_BIND_COUNT, &count);\r
+ in_get_config(dev_id, IN_CFG_DOES_COMBOS, &can_combo);\r
\r
type = IN_BINDTYPE_EMU;\r
if (player_idx >= 0) {\r
{\r
const int *binds;\r
int k, keys = 0;\r
- int count;\r
+ int count = 0;\r
\r
binds = in_get_dev_binds(dev_id);\r
if (binds == NULL)\r
return 0;\r
\r
- count = in_get_dev_info(dev_id, IN_INFO_BIND_COUNT);\r
+ in_get_config(dev_id, IN_CFG_BIND_COUNT, &count);\r
for (k = 0; k < count; k++)\r
{\r
if (binds[IN_BIND_OFFS(k, bindtype)] & action_mask)\r
if (x < me_mfont_w * 2)\r
x = me_mfont_w * 2;\r
\r
- plat_video_menu_begin();\r
+ menu_draw_begin(1);\r
if (player_idx >= 0)\r
text_out16(x, y, "Player %i controls", player_idx + 1);\r
else\r
text_out16(x, g_menuscreen_h - 2 * me_mfont_h, "Press left/right for other devs");\r
}\r
\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
}\r
\r
static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_idx)\r
{\r
- int i, sel = 0, menu_sel_max = opt_cnt - 1;\r
+ int i, sel = 0, menu_sel_max = opt_cnt - 1, does_combos = 0;\r
int dev_id, dev_count, kc, is_down, mkey;\r
int unbind, bindtype, mask_shift;\r
\r
unbind = (i > 0);\r
\r
/* allow combos if device supports them */\r
- if (i == 1 && bindtype == IN_BINDTYPE_EMU &&\r
- in_get_dev_info(dev_id, IN_INFO_DOES_COMBOS))\r
+ in_get_config(dev_id, IN_CFG_DOES_COMBOS, &does_combos);\r
+ if (i == 1 && bindtype == IN_BINDTYPE_EMU && does_combos)\r
unbind = 0;\r
\r
if (unbind)\r
mee_handler_id("Emulator controls", MA_CTRL_EMU, key_config_loop_wrap),\r
mee_onoff ("6 button pad", MA_OPT_6BUTTON_PAD, PicoOpt, POPT_6BTN_PAD),\r
mee_range ("Turbo rate", MA_CTRL_TURBO_RATE, currentConfig.turbo_rate, 1, 30),\r
+ mee_range ("Analog deadzone", MA_CTRL_DEADZONE, currentConfig.analog_deadzone, 1, 99),\r
mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg),\r
mee_cust_nosave("Save cfg for loaded game", MA_OPT_SAVECFG_GAME, mh_saveloadcfg, mgn_saveloadcfg),\r
mee_label (""),\r
mee_onoff ("Enable sound", MA_OPT_ENABLE_SOUND, currentConfig.EmuOpt, EOPT_EN_SOUND),\r
mee_cust ("Sound Quality", MA_OPT_SOUND_QUALITY, mh_opt_misc, mgn_opt_sound),\r
mee_enum_h ("Confirm savestate", MA_OPT_CONFIRM_STATES,currentConfig.confirm_save, men_confirm_save, h_confirm_save),\r
- mee_range ("", MA_OPT_CPU_CLOCKS, currentConfig.CPUclock, 20, 900),\r
+ mee_range ("", MA_OPT_CPU_CLOCKS, currentConfig.CPUclock, 20, 1200),\r
mee_handler ("[Display options]", menu_loop_gfx_options),\r
mee_handler ("[Sega/Mega CD options]", menu_loop_cd_options),\r
#ifndef NO_32X\r
int i;\r
\r
i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS);\r
- e_menu_options[i].enabled = e_menu_options[i].name ? 1 : 0;\r
+ e_menu_options[i].enabled = e_menu_options[i].name[0] ? 1 : 0;\r
me_enable(e_menu_options, MA_OPT_SAVECFG_GAME, rom_loaded);\r
me_enable(e_menu_options, MA_OPT_LOADCFG, config_slot != config_slot_current);\r
\r
if (PicoDrawMask & PDRAW_SPRITES_HI_ON) memcpy(layer_str + 19, "spr_hi", 6);\r
if (PicoDrawMask & PDRAW_32X_ON) memcpy(layer_str + 26, "32x", 4);\r
\r
- memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);\r
- pemu_forced_frame(0, 0);\r
+ pemu_forced_frame(1, 0);\r
+ memcpy(g_menuscreen_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h * 2);\r
smalltext_out16(4, 1, "build: r" REVISION " "__DATE__ " " __TIME__ " " COMPILER, 0xffff);\r
smalltext_out16(4, g_menuscreen_h - me_sfont_h, layer_str, 0xffff);\r
}\r
\r
while (1)\r
{\r
+ menu_draw_begin(1);\r
switch (mode)\r
{\r
- case 0: plat_video_menu_begin();\r
- tmp = PDebugMain();\r
+ case 0: tmp = PDebugMain();\r
plat_debug_cat(tmp);\r
draw_text_debug(tmp, 0, 0);\r
if (dumped) {\r
break;\r
case 1: draw_frame_debug();\r
break;\r
- case 2: memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);\r
- pemu_forced_frame(0, 1);\r
- menu_darken_bg(g_menuscreen_ptr, g_menuscreen_ptr, g_menuscreen_w * g_menuscreen_h, 0);\r
+ case 2: pemu_forced_frame(1, 0);\r
+ menu_darken_bg(g_menuscreen_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 0);\r
PDebugShowSpriteStats((unsigned short *)g_menuscreen_ptr + (g_menuscreen_h/2 - 240/2)*g_menuscreen_w +\r
g_menuscreen_w/2 - 320/2, g_menuscreen_w);\r
break;\r
g_menuscreen_w, spr_offs);\r
draw_text_debug(PDebugSpriteList(), spr_offs, 6);\r
break;\r
- case 4: plat_video_menu_begin();\r
- tmp = PDebug32x();\r
+ case 4: tmp = PDebug32x();\r
draw_text_debug(tmp, 0, 0);\r
break;\r
}\r
- plat_video_menu_end();\r
+ menu_draw_end();\r
\r
inp = in_menu_wait(PBTN_MOK|PBTN_MBACK|PBTN_MA2|PBTN_MA3|PBTN_L|PBTN_R |\r
PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT, 70);\r
me_enable(e_menu_main, MA_MAIN_PATCHES, PicoPatches != NULL);\r
\r
menu_enter(rom_loaded);\r
- in_set_blocking(1);\r
+ in_set_config_int(0, IN_CFG_BLOCKING, 1);\r
me_loop(e_menu_main, &sel, menu_main_plat_draw);\r
\r
if (rom_loaded) {\r
;\r
}\r
\r
- in_set_blocking(0);\r
+ in_set_config_int(0, IN_CFG_BLOCKING, 0);\r
}\r
\r
// --------- CD tray close menu ----------\r
\r
menu_enter(rom_loaded);\r
\r
- in_set_blocking(1);\r
+ in_set_config_int(0, IN_CFG_BLOCKING, 1);\r
me_loop(e_menu_tray, &sel, NULL);\r
\r
if (engineState != PGS_RestartRun) {\r
}\r
\r
while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK));\r
- in_set_blocking(0);\r
+ in_set_config_int(0, IN_CFG_BLOCKING, 0);\r
\r
return ret;\r
}\r
MA_CTRL_PLAYER2,
MA_CTRL_EMU,
MA_CTRL_TURBO_RATE,
+ MA_CTRL_DEADZONE,
MA_CTRL_DEV_FIRST,
MA_CTRL_DEV_NEXT,
MA_CTRL_DONE,
void pemu_validate_config(void);
void pemu_loop_prep(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_sound_start(void);
#include "../common/fonts.h"\r
#include "../common/emu.h"\r
#include "../common/config.h"\r
+#include "../common/input.h"\r
#include "../linux/sndout_oss.h"\r
#include "version.h"\r
\r
\r
defaultConfig.CPUclock = default_cpu_clock;\r
defaultConfig.renderer32x = RT_8BIT_FAST;\r
+ defaultConfig.analog_deadzone = 50;\r
\r
soc = soc_detect();\r
if (soc == SOCID_MMSP2)\r
}\r
else {\r
PicoDrawSetOutFormat(PDF_NONE, 0);\r
- PicoDraw32xSetFrameMode(1, (renderer == RT_16BIT) ? 1 : 0);\r
+ PicoDraw32xSetFrameMode(1, 0);\r
}\r
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);\r
+ gp2x_mode = 16;\r
}\r
\r
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {\r
else\r
osd_text = (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) ? osd_text8_rot : osd_text8;\r
\r
- if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX)\r
- gp2x_mode = -gp2x_mode;\r
-\r
gp2x_video_wait_vsync();\r
- gp2x_video_changemode(gp2x_mode);\r
-\r
if (!is_16bit_mode()) {\r
// setup pal for 8-bit modes\r
localPal[0xc0] = 0x0000c000; // MCD LEDs\r
else\r
gp2x_memset_all_buffers(0, 0, 320*240*2);\r
\r
+ if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX)\r
+ gp2x_mode = -gp2x_mode;\r
+\r
+ gp2x_video_changemode(gp2x_mode);\r
+\r
Pico.m.dirtyPal = 1;\r
\r
PicoOpt &= ~POPT_EN_SOFTSCALE;\r
// don't need to do anything, writes will block by themselves\r
}\r
\r
-void pemu_forced_frame(int opts, int no_scale)\r
+void pemu_forced_frame(int no_scale, int do_emu)\r
{\r
int po_old = PicoOpt;\r
\r
doing_bg_frame = 1;\r
PicoOpt &= ~POPT_ALT_RENDERER;\r
- PicoOpt |= opts|POPT_ACC_SPRITES;\r
+ PicoOpt |= POPT_ACC_SPRITES;\r
+ if (!no_scale)\r
+ PicoOpt |= POPT_EN_SOFTSCALE;\r
\r
memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);\r
\r
PicoDrawSetCallbacks(NULL, NULL);\r
Pico.m.dirtyPal = 1;\r
\r
- if (no_scale == -9)\r
- // yes I'm lazy, see pemu_forced_frame call below\r
+ if (do_emu)\r
PicoFrame();\r
else\r
PicoFrameDrawOnly();\r
\r
+ g_menubg_src_ptr = g_screen_ptr;\r
doing_bg_frame = 0;\r
PicoOpt = po_old;\r
}\r
unset_lcd_custom_rate();\r
}\r
\r
+ if (gp2x_dev_id == GP2X_DEV_CAANOO)\r
+ in_set_config_int(in_name_to_id("evdev:pollux-analog"), IN_CFG_ABS_DEAD_ZONE,\r
+ currentConfig.analog_deadzone);\r
+\r
if ((EmuOpt_old ^ currentConfig.EmuOpt) & EOPT_MMUHACK)\r
gp2x_make_fb_bufferable(currentConfig.EmuOpt & EOPT_MMUHACK);\r
\r
pemu_sound_stop();\r
\r
/* do one more frame for menu bg */\r
- pemu_forced_frame(POPT_EN_SOFTSCALE, -9);\r
- g_menubg_src_ptr = g_screen_ptr;\r
+ pemu_forced_frame(0, 1);\r
}\r
\r
const char *plat_get_credits(void)\r
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)
{
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);
}
#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>
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);
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);
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();
}
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)
// 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)
memregl[0xf004>>2] = pllsetreg0;
memregl[0xf07c>>2] |= 0x8000;
}
+ timer_cleanup();
munmap((void *)memregs, 0x20000);
close(memdev);
-#define VERSION "1.70b3"\r
+#define VERSION "1.80"\r
\r
\r
void plat_video_menu_begin(void)\r
{\r
- memcpy32(g_screen_ptr, g_menubg_ptr, g_screen_width * g_screen_height * 2 / 4);\r
g_menuscreen_ptr = g_screen_ptr;\r
}\r
\r
{\r
}\r
\r
-void pemu_forced_frame(int opts, int no_scale)\r
+void pemu_forced_frame(int no_scale, int do_emu)\r
{\r
int po_old = PicoOpt;\r
- int eo_old = currentConfig.EmuOpt;\r
+\r
+ memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);\r
\r
PicoOpt &= ~POPT_ALT_RENDERER;\r
- PicoOpt |= opts|POPT_ACC_SPRITES; // acc_sprites\r
+ PicoOpt |= POPT_ACC_SPRITES;\r
+ if (!no_scale)\r
+ PicoOpt |= POPT_EN_SOFTSCALE;\r
\r
PicoDrawSetOutFormat(PDF_RGB555, 1);\r
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);\r
PicoDraw32xSetFrameMode(0, 0);\r
\r
Pico.m.dirtyPal = 1;\r
- PicoFrameDrawOnly();\r
+ if (do_emu)\r
+ PicoFrame();\r
+ else\r
+ PicoFrameDrawOnly();\r
\r
+ g_menubg_src_ptr = g_screen_ptr;\r
PicoOpt = po_old;\r
- currentConfig.EmuOpt = eo_old;\r
}\r
\r
static void updateSound(int len)\r
\r
void pemu_loop_end(void)\r
{\r
- int po_old = PicoOpt;\r
- int eo_old = currentConfig.EmuOpt;\r
-\r
pemu_sound_stop();\r
- memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);\r
\r
/* do one more frame for menu bg */\r
- PicoOpt &= ~POPT_ALT_RENDERER;\r
- PicoOpt |= POPT_EN_SOFTSCALE|POPT_ACC_SPRITES;\r
-\r
- PicoDrawSetOutFormat(PDF_RGB555, 1);\r
- PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);\r
- PicoDraw32xSetFrameMode(0, 0);\r
- Pico.m.dirtyPal = 1;\r
- PicoFrame();\r
-\r
- PicoOpt = po_old;\r
- currentConfig.EmuOpt = eo_old;\r
+ pemu_forced_frame(0, 1);\r
}\r
\r
void plat_wait_till_us(unsigned int us_to)\r
for (;;)
{
- plat_video_menu_begin();
+ menu_draw_begin(0);
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);
- 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);
if (inp & PBTN_UP) g_layer_cy--;
static menu_entry e_menu_gfx_options[];
static menu_entry e_menu_options[];
+static menu_entry e_menu_keyconfig[];
void pnd_menu_init(void)
{
e_menu_gfx_options[i].data = (void *)mfilters;
pnd_filter_list = mfilters;
- i = me_id2offset(e_menu_options, MA_OPT_SCALING);
- e_menu_options[i]->name = "Max CPU clock";
+ i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS);
+ e_menu_options[i].name = "Max CPU clock";
+
+ me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, 0);
}
#include "../common/menu.h"\r
#include "../common/plat.h"\r
#include "../common/arm_utils.h"\r
+#include "../common/input.h"\r
#include "../linux/sndout_oss.h"\r
#include "../linux/fbdev.h"\r
#include "plat.h"\r
\r
#include <pico/pico_int.h>\r
\r
+#include <linux/input.h>\r
\r
static struct vout_fbdev *main_fb, *layer_fb;\r
static int g_layer_x, g_layer_y;\r
const char *renderer_names[] = { NULL };\r
const char *renderer_names32x[] = { NULL };\r
\r
+static const char * const pandora_gpio_keys[KEY_MAX + 1] = {\r
+ [0 ... KEY_MAX] = NULL,\r
+ [KEY_UP] = "Up",\r
+ [KEY_LEFT] = "Left",\r
+ [KEY_RIGHT] = "Right",\r
+ [KEY_DOWN] = "Down",\r
+ [KEY_HOME] = "A",\r
+ [KEY_PAGEDOWN] = "X",\r
+ [KEY_END] = "B",\r
+ [KEY_PAGEUP] = "Y",\r
+ [KEY_RIGHTSHIFT]= "L",\r
+ [KEY_RIGHTCTRL] = "R",\r
+ [KEY_LEFTALT] = "Start",\r
+ [KEY_LEFTCTRL] = "Select",\r
+ [KEY_MENU] = "Pandora",\r
+};\r
+\r
static int get_cpu_clock(void)\r
{\r
FILE *f;\r
\r
void plat_video_menu_begin(void)\r
{\r
- memcpy32(g_menuscreen_ptr, g_menubg_ptr, g_menuscreen_w * g_menuscreen_h * 2 / 4);\r
}\r
\r
void plat_video_menu_end(void)\r
}\r
}\r
\r
-void pemu_forced_frame(int opts, int no_scale)\r
+static void make_bg(void)\r
{\r
- int oldscale = currentConfig.scaling;\r
- int po_old = PicoOpt;\r
+ unsigned short *s = (void *)fb_copy;\r
+ unsigned int t, *d = (unsigned int *)g_menubg_src_ptr + 80 / 2;\r
+ int x, y;\r
+\r
+ memset32(g_menubg_src_ptr, 0, 800 * 480 * 2 / 4);\r
\r
- if (no_scale) {\r
- currentConfig.scaling = SCALE_1x1;\r
- emu_video_mode_change(8, 224, 0);\r
+ for (y = 0; y < 240; y++, s += 320, d += 800*2/2) {\r
+ for (x = 0; x < 320; x++) {\r
+ t = s[x];\r
+ t |= t << 16;\r
+ d[x] = d[x + 800 / 2] = t;\r
+ }\r
}\r
+}\r
\r
- PicoOpt |= opts|POPT_ACC_SPRITES;\r
+void pemu_forced_frame(int no_scale, int do_emu)\r
+{\r
+ int po_old = PicoOpt;\r
\r
+ memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);\r
+\r
+ PicoOpt |= POPT_ACC_SPRITES;\r
+ if (!no_scale)\r
+ PicoOpt |= POPT_EN_SOFTSCALE;\r
+\r
+ PicoDrawSetOutFormat(PDF_RGB555, 1);\r
Pico.m.dirtyPal = 1;\r
- PicoFrameDrawOnly();\r
+ if (do_emu)\r
+ PicoFrame();\r
+ else\r
+ PicoFrameDrawOnly();\r
+\r
+ // making a copy because enabling the layer clears it's mem\r
+ memcpy32((void *)fb_copy, g_screen_ptr, sizeof(fb_copy) / 4);\r
+ make_bg(); // FIXME: honour no_scale\r
\r
PicoOpt = po_old;\r
- currentConfig.scaling = oldscale;\r
}\r
\r
static void updateSound(int len)\r
plat_video_flip();\r
}\r
\r
-static void make_bg(void)\r
-{\r
- unsigned short *s = (void *)fb_copy;\r
- unsigned int t, *d = (unsigned int *)g_menubg_src_ptr + 80 / 2;\r
- int x, y;\r
-\r
- memset32(g_menubg_src_ptr, 0, 800 * 480 * 2 / 4);\r
-\r
- for (y = 0; y < 240; y++, s += 320, d += 800*2/2) {\r
- for (x = 0; x < 320; x++) {\r
- t = s[x];\r
- t |= t << 16;\r
- d[x] = d[x + 800 / 2] = t;\r
- }\r
- }\r
-}\r
-\r
void pemu_loop_prep(void)\r
{\r
static int pal_old = -1;\r
\r
void pemu_loop_end(void)\r
{\r
- int po_old = PicoOpt;\r
- int eo_old = currentConfig.EmuOpt;\r
-\r
pemu_sound_stop();\r
- memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);\r
\r
/* do one more frame for menu bg */\r
- PicoOpt |= POPT_EN_SOFTSCALE|POPT_ACC_SPRITES;\r
- currentConfig.EmuOpt |= EOPT_16BPP;\r
-\r
- PicoDrawSetOutFormat(PDF_RGB555, 1);\r
- Pico.m.dirtyPal = 1;\r
- PicoFrame();\r
-\r
- // making a copy because enabling the layer clears it's mem\r
- memcpy32((void *)fb_copy, g_screen_ptr, sizeof(fb_copy) / 4);\r
- make_bg();\r
+ pemu_forced_frame(0, 1);\r
\r
pnd_setup_layer(0, g_layer_x, g_layer_y, g_layer_w, g_layer_h);\r
-\r
- PicoOpt = po_old;\r
- currentConfig.EmuOpt = eo_old;\r
}\r
\r
void plat_wait_till_us(unsigned int us_to)\r
\r
sndout_oss_init();\r
pnd_menu_init();\r
+\r
+ in_set_config(in_name_to_id("evdev:gpio-keys"), IN_CFG_KEY_NAMES,\r
+ pandora_gpio_keys, sizeof(pandora_gpio_keys));\r
return;\r
\r
fail1:\r
-#define VERSION "1.80beta2"\r
+#define VERSION "1.80"\r
\r
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 eo_old = currentConfig.EmuOpt;
- PicoOpt &= ~0x10;
- PicoOpt |= opts|POPT_ACC_SPRITES;
+ PicoOpt &= ~POPT_ALT_RENDERER;
+ PicoOpt |= POPT_ACC_SPRITES;
+ if (!no_scale)
+ PicoOpt |= POPT_EN_SOFTSCALE;
currentConfig.EmuOpt |= 0x80;
vidResetMode();
pemu_sound_stop();
}
-void pemu_forced_frame(int opts, int no_scale)
+void pemu_forced_frame(int no_scale, int do_emu)
{
}