gp2x+wiz binary support, wiz code wip

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@705 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2009-07-17 22:49:29 +00:00
parent fa5e045bdc
commit fa8d133192
17 changed files with 899 additions and 88 deletions

View file

@ -451,13 +451,13 @@ static int custom_read(menu_entry *me, const char *var, const char *val)
#ifdef __GP2X__
if (strcasecmp(var, "Scaling") != 0) return 0;
if (strcasecmp(val, "OFF") == 0) {
currentConfig.scaling = 0;
currentConfig.scaling = EOPT_SCALE_NONE;
} else if (strcasecmp(val, "hw horizontal") == 0) {
currentConfig.scaling = 1;
currentConfig.scaling = EOPT_SCALE_HW_H;
} else if (strcasecmp(val, "hw horiz. + vert.") == 0) {
currentConfig.scaling = 2;
currentConfig.scaling = EOPT_SCALE_HW_HV;
} else if (strcasecmp(val, "sw horizontal") == 0) {
currentConfig.scaling = 3;
currentConfig.scaling = EOPT_SCALE_SW_H;
} else
return 0;
return 1;

View file

@ -5,7 +5,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h> // tolower
#ifndef NO_SYNC
#include <unistd.h>
#endif
@ -47,12 +46,13 @@ unsigned char *movie_data = NULL;
static int movie_size = 0;
// utilities
/* don't use tolower() for easy old glibc binary compatibility */
static void strlwr_(char *string)
{
char *p;
for (p = string; *p; p++)
*p = (char)tolower(*p);
if ('A' <= *p && *p <= 'Z')
*p += 'a' - 'A';
}
static int try_rfn_cut(char *fname)
@ -621,17 +621,21 @@ int emu_ReadConfig(int game, int no_defaults)
}
}
plat_validate_config();
// some sanity checks
if (currentConfig.CPUclock < 10 || currentConfig.CPUclock > 4096) currentConfig.CPUclock = 200;
#ifdef PSP
/* TODO: mv to plat_validate_config() */
if (currentConfig.CPUclock < 10 || currentConfig.CPUclock > 4096) currentConfig.CPUclock = 200;
if (currentConfig.gamma < -4 || currentConfig.gamma > 16) currentConfig.gamma = 0;
if (currentConfig.gamma2 < 0 || currentConfig.gamma2 > 2) currentConfig.gamma2 = 0;
#else
if (currentConfig.gamma < 10 || currentConfig.gamma > 300) currentConfig.gamma = 100;
#endif
if (currentConfig.volume < 0 || currentConfig.volume > 99) currentConfig.volume = 50;
if (currentConfig.volume < 0 || currentConfig.volume > 99)
currentConfig.volume = 50;
if (ret == 0)
config_slot_current = config_slot;
if (ret == 0) config_slot_current = config_slot;
return (ret == 0);
}

View file

@ -27,8 +27,16 @@ extern int g_screen_height;
#define EOPT_MMUHACK (1<<4)
#define EOPT_NO_AUTOSVCFG (1<<5)
#define EOPT_RAM_TIMINGS (1<<8)
#define EOPT_A_SN_GAMMA (1<<12)
#define EOPT_PSYNC (1<<13)
enum {
EOPT_SCALE_NONE = 0,
EOPT_SCALE_SW_H,
EOPT_SCALE_HW_H,
EOPT_SCALE_HW_HV,
};
typedef struct _currentConfig_t {
// char lastRomFile[512];
int EmuOpt; // LSb->MSb: use_sram, show_fps, enable_sound, gzip_saves,

View file

@ -1443,12 +1443,12 @@ static int menu_loop_adv_options(menu_id id, int keys)
static const char *mgn_opt_scaling(menu_id id, int *offs)
{
*offs = -12;
*offs = -13;
switch (currentConfig.scaling) {
default: return " OFF";
case 1: return "hw horizontal";
case 2: return "hw horiz. + vert.";
case 3: return "sw horizontal";
default: return " OFF";
case EOPT_SCALE_HW_H: return " hw horizontal";
case EOPT_SCALE_HW_HV: return "hw horiz. + vert";
case EOPT_SCALE_SW_H: return " sw horizontal";
}
}
@ -1462,8 +1462,8 @@ static menu_entry e_menu_gfx_options[] =
{
mee_range_cust("Scaling", MA_OPT_SCALING, currentConfig.scaling, 0, 3, mgn_opt_scaling),
mee_range_cust("Gamma correction", MA_OPT2_GAMMA, currentConfig.gamma, 1, 300, mgn_aopt_gamma),
mee_onoff ("A_SN's gamma curve", MA_OPT2_A_SN_GAMMA, currentConfig.EmuOpt, 0x1000),
mee_onoff ("Perfect vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, 0x2000),
mee_onoff ("A_SN's gamma curve", MA_OPT2_A_SN_GAMMA, currentConfig.EmuOpt, EOPT_A_SN_GAMMA),
mee_onoff ("Perfect vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_PSYNC),
mee_end,
};
@ -2044,6 +2044,22 @@ void me_update_msg(const char *msg)
// ------------ util ------------
/* wiz for now, probably extend later */
void menu_plat_setup(int is_wiz)
{
int i;
if (!is_wiz)
return;
me_enable(e_menu_adv_options, MA_OPT_ARM940_SOUND, 0);
me_enable(e_menu_gfx_options, MA_OPT2_GAMMA, 0);
me_enable(e_menu_gfx_options, MA_OPT2_A_SN_GAMMA, 0);
i = me_id2offset(e_menu_gfx_options, MA_OPT_SCALING);
e_menu_gfx_options[i].max = 1; /* only off and sw */
}
/* TODO: rename */
void menu_darken_bg(void *dst, int pixels, int darker)
{

View file

@ -153,6 +153,7 @@ extern me_bind_action me_ctrl_actions[15];
extern me_bind_action emuctrl_actions[]; // platform code
void menu_init(void);
void menu_plat_setup(int is_wiz);
void text_out16(int x, int y, const char *texto, ...);
void me_update_msg(const char *msg);

View file

@ -19,6 +19,7 @@ int emu_getMainDir(char *dst, int len);
void menu_romload_prepare(const char *rom_name);
void menu_romload_end(void);
void plat_early_init(void);
void plat_init(void);
void plat_finish(void);
@ -27,6 +28,8 @@ void plat_video_menu_enter(int is_rom_loaded);
void plat_video_menu_begin(void);
void plat_video_menu_end(void);
void plat_validate_config(void);
int plat_is_dir(const char *path);
int plat_wait_event(int *fds_hnds, int count, int timeout_ms);
void plat_sleep_ms(int ms);