gp2x->common menu migration finished, gp2x now only uses input fwk

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@692 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2009-05-14 13:41:48 +00:00
parent 2c60056042
commit 82abf46f3d
22 changed files with 207 additions and 1765 deletions

View file

@ -1,17 +0,0 @@
/* random common definitions */
#define PBTN_UP (1 << 0)
#define PBTN_DOWN (1 << 1)
#define PBTN_LEFT (1 << 2)
#define PBTN_RIGHT (1 << 3)
#define PBTN_MOK (1 << 4)
#define PBTN_MBACK (1 << 5)
#define PBTN_MA2 (1 << 6) /* menu action 2 */
#define PBTN_MA3 (1 << 7)
#define PBTN_L (1 << 8)
#define PBTN_R (1 << 9)
#define PBTN_MENU (1 << 10)

View file

@ -15,7 +15,6 @@
#include "fonts.h"
#include "lprintf.h"
#include "config.h"
#include "common.h"
#include "plat.h"
#include <pico/pico_int.h>
@ -631,13 +630,7 @@ int emu_ReadConfig(int game, int no_defaults)
if (currentConfig.gamma < 10 || currentConfig.gamma > 300) currentConfig.gamma = 100;
#endif
if (currentConfig.volume < 0 || currentConfig.volume > 99) currentConfig.volume = 50;
#ifdef __GP2X__
// if volume keys are unbound, bind them to volume control
if (!currentConfig.KeyBinds[23] && !currentConfig.KeyBinds[22]) {
currentConfig.KeyBinds[23] = 1<<29; // vol up
currentConfig.KeyBinds[22] = 1<<30; // vol down
}
#endif
if (ret == 0) config_slot_current = config_slot;
return (ret == 0);
}

View file

@ -40,12 +40,8 @@ typedef struct _currentConfig_t {
int s_PicoCDBuffers;
int Frameskip;
int CPUclock;
int KeyBinds[PLAT_MAX_KEYS];
int volume;
int gamma;
#if PLAT_HAVE_JOY
int JoyBinds[4][32];
#endif
int scaling; // gp2x: 0=center, 1=hscale, 2=hvscale, 3=hsoftscale; psp: bilinear filtering
int rotation; // for UIQ
float scale; // psp: screen scale

View file

@ -2,7 +2,6 @@
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "input.h"
#include "plat.h"
#include "../linux/in_evdev.h"
@ -23,6 +22,8 @@ static in_drv_t in_drivers[IN_DRVID_COUNT];
static in_dev_t in_devices[IN_MAX_DEVS];
static int in_dev_count = 0;
static int in_have_async_devs = 0;
static int menu_key_state = 0;
static int menu_last_used_dev = 0;
#define DRV(id) in_drivers[(unsigned)(id) < IN_DRVID_COUNT ? (id) : 0]
@ -259,8 +260,6 @@ int in_update(void)
return result;
}
static int menu_key_state = 0;
void in_set_blocking(int is_blocking)
{
int i, ret;
@ -414,6 +413,7 @@ int in_menu_wait_any(int timeout_ms)
break;
if (code < 0)
continue;
menu_last_used_dev = dev_id;
if (keys_old != menu_key_state)
break;
}
@ -516,9 +516,15 @@ const char *in_get_key_name(int dev_id, int keycode)
static char xname[16];
const char *name;
if (dev_id < 0) /* want last used dev? */
dev_id = menu_last_used_dev;
if (dev_id < 0 || dev_id >= IN_MAX_DEVS)
return "Unkn0";
if (keycode < 0) /* want name for menu key? */
keycode = DRV(in_devices[dev_id].drv_id).menu_translate(keycode);
name = DRV(in_devices[dev_id].drv_id).get_key_name(keycode);
if (name != NULL)
return name;

View file

@ -1,5 +1,21 @@
#define IN_MAX_DEVS 10
/* unified menu keys */
#define PBTN_UP (1 << 0)
#define PBTN_DOWN (1 << 1)
#define PBTN_LEFT (1 << 2)
#define PBTN_RIGHT (1 << 3)
#define PBTN_MOK (1 << 4)
#define PBTN_MBACK (1 << 5)
#define PBTN_MA2 (1 << 6) /* menu action 2 */
#define PBTN_MA3 (1 << 7)
#define PBTN_L (1 << 8)
#define PBTN_R (1 << 9)
#define PBTN_MENU (1 << 10)
enum {
IN_DRVID_UNKNOWN = 0,
IN_DRVID_GP2X,

View file

@ -12,7 +12,6 @@
#include "fonts.h"
#include "readpng.h"
#include "lprintf.h"
#include "common.h"
#include "input.h"
#include "emu.h"
#include "plat.h"
@ -641,6 +640,44 @@ void menu_romload_end(void)
plat_video_menu_end();
}
// -------------- del confirm ---------------
static void do_delete(const char *fpath, const char *fname)
{
int len, mid, inp;
const char *nm;
char tmp[64];
plat_video_menu_begin();
if (!rom_loaded)
menu_darken_bg(g_screen_ptr, g_screen_width * g_screen_height, 0);
len = strlen(fname);
if (len > g_screen_width/6)
len = g_screen_width/6;
mid = g_screen_width / 2;
text_out16(mid - me_mfont_w * 15 / 2, 8 * me_mfont_h, "About to delete");
smalltext_out16(mid - len * me_sfont_w / 2, 9 * me_mfont_h + 5, fname, 0xbdff);
text_out16(mid - me_mfont_w * 13 / 2, 11 * me_mfont_h, "Are you sure?");
nm = in_get_key_name(-1, -PBTN_MA3);
snprintf(tmp, sizeof(tmp), "(%s - confirm, ", nm);
len = strlen(tmp);
nm = in_get_key_name(-1, -PBTN_MBACK);
snprintf(tmp + len, sizeof(tmp) - len, "%s - cancel)", nm);
len = strlen(tmp);
text_out16(mid - me_mfont_w * len / 2, 12 * me_mfont_h, tmp);
plat_video_menu_end();
while (in_menu_wait_any(50) & (PBTN_MENU|PBTN_MA2));
inp = in_menu_wait(PBTN_MA3|PBTN_MBACK, 100);
if (inp & PBTN_MA3)
remove(fpath);
}
// -------------- ROM selector --------------
// rrrr rggg gggb bbbb
@ -788,7 +825,7 @@ rescan:
ret = rom_fname_reload;
break;
}
// do_delete(rom_fname_reload, namelist[sel+1]->d_name); // TODO
do_delete(rom_fname_reload, namelist[sel+1]->d_name);
if (n > 0) {
while (n--) free(namelist[n]);
free(namelist);