while (p > rom_name && *p != '/') p--;
psp_video_switch_to_single();
- if (rom_data) menu_draw_begin();
+ if (rom_loaded) menu_draw_begin();
else memset32_uncached(psp_screen, 0, 512*272*2/4);
smalltext_out16(1, 1, "Loading", 0xffff);
menu_draw_begin();
- if (rom_data == NULL) {
+ if (!rom_loaded) {
// menu_darken_bg(menu_screen, menu_screen, 321*240, 0);
}
case 1: key_config_loop(ctrl_actions, is_6button ? 12 : 8, 1); return;
case 2: key_config_loop(emuctrl_actions,
sizeof(emuctrl_actions)/sizeof(emuctrl_actions[0]), -1); return;
- case 3: if (rom_data == NULL) emu_WriteConfig(0); return;
+ case 3: if (!rom_loaded) emu_WriteConfig(0); return;
default: return;
}
}
{
void *oldstate = NULL;
- if (rom_data == NULL || ((Pico.video.reg[12]&1)^1) != is_32col)
+ if (!rom_loaded || ((Pico.video.reg[12]&1)^1) != is_32col)
{
extern char bgdatac32_start[], bgdatac40_start[];
extern int bgdatac32_size, bgdatac40_size;
ret = uncompress((Bytef *)bg_buffer, &outsize, bgdata, insize);
if (ret == 0)
{
- if (rom_data != NULL) oldstate = get_oldstate_for_preview();
+ if (rom_loaded) oldstate = get_oldstate_for_preview();
memcpy(Pico.vram, bg_buffer, sizeof(Pico.vram));
memcpy(Pico.cram, (char *)bg_buffer + 0x10000, 0x40*2);
memcpy(Pico.vsram, (char *)bg_buffer + 0x10080, 0x40*2);
#define OPT_ENTRY_COUNT (sizeof(opt_entries) / sizeof(opt_entries[0]))
-static const char *region_name(unsigned int code)
-{
- static const char *names[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" };
- static const char *names_short[] = { "", " JP", " JP", " US", " EU" };
- int u, i = 0;
- if (code) {
- code <<= 1;
- while((code >>= 1)) i++;
- if (i > 4) return "unknown";
- return names[i];
- } else {
- static char name[24];
- strcpy(name, "Auto:");
- for (u = 0; u < 3; u++) {
- i = 0; code = ((PicoAutoRgnOrder >> u*4) & 0xf) << 1;
- while((code >>= 1)) i++;
- strcat(name, names_short[i]);
- }
- return name;
- }
-}
-
-
static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *param)
{
char *str, str24[24];
text_out16(x, y, "Sound Quality: %5iHz %s", currentConfig.PsndRate, str);
break;
case MA_OPT_REGION:
- text_out16(x, y, "Region: %s", region_name(currentConfig.PicoRegion));
+ text_out16(x, y, "Region: %s", me_region_name(PicoRegionOverride, PicoAutoRgnOrder));
break;
case MA_OPT_CONFIRM_STATES:
switch ((currentConfig.EmuOpt >> 9) & 5) {
static int rgn_orders[] = { 0x148, 0x184, 0x814, 0x418, 0x841, 0x481 };
int i;
if (right) {
- if (!currentConfig.PicoRegion) {
+ if (!PicoRegionOverride) {
for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break;
if (i < 5) PicoAutoRgnOrder = rgn_orders[i+1];
- else currentConfig.PicoRegion=1;
+ else PicoRegionOverride=1;
}
- else currentConfig.PicoRegion<<=1;
- if (currentConfig.PicoRegion > 8) currentConfig.PicoRegion = 8;
+ else PicoRegionOverride<<=1;
+ if (PicoRegionOverride > 8) PicoRegionOverride = 8;
} else {
- if (!currentConfig.PicoRegion) {
+ if (!PicoRegionOverride) {
for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break;
if (i > 0) PicoAutoRgnOrder = rgn_orders[i-1];
}
- else currentConfig.PicoRegion>>=1;
+ else PicoRegionOverride>>=1;
}
}
{
PicoOpt = currentConfig.PicoOpt;
PsndRate = currentConfig.PsndRate;
- PicoRegionOverride = currentConfig.PicoRegion;
+ if (PicoRegionOverride) {
+ // force setting possibly changed..
+ Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0;
+ }
if (!(PicoOpt & 0x20)) {
// unbind XYZ MODE, just in case
unbind_action(0xf00);
currentConfig.PicoOpt = PicoOpt;
currentConfig.PsndRate = PsndRate;
- currentConfig.PicoRegion = PicoRegionOverride;
- me_enable(opt_entries, OPT_ENTRY_COUNT, MA_OPT_SAVECFG_GAME, rom_data != NULL);
+ me_enable(opt_entries, OPT_ENTRY_COUNT, MA_OPT_SAVECFG_GAME, rom_loaded);
me_enable(opt_entries, OPT_ENTRY_COUNT, MA_OPT_LOADCFG, config_slot != config_slot_current);
menu_sel_max = me_count_enabled(opt_entries, OPT_ENTRY_COUNT) - 1;
if (menu_sel > menu_sel_max) menu_sel = menu_sel_max;
int ret, menu_sel_max;
unsigned long inp = 0;
- me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_RESUME_GAME, rom_data != NULL);
- me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_SAVE_STATE, rom_data != NULL);
- me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_LOAD_STATE, rom_data != NULL);
- me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_RESET_GAME, rom_data != NULL);
+ me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_RESUME_GAME, rom_loaded);
+ me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_SAVE_STATE, rom_loaded);
+ me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_LOAD_STATE, rom_loaded);
+ me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_RESET_GAME, rom_loaded);
me_enable(main_entries, MAIN_ENTRY_COUNT, MA_MAIN_PATCHES, PicoPatches != NULL);
menu_sel_max = me_count_enabled(main_entries, MAIN_ENTRY_COUNT) - 1;
if(inp & BTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
if((inp & (BTN_L|BTN_R)) == (BTN_L|BTN_R)) debug_menu_loop();
if( inp & (BTN_SELECT|BTN_X)) {
- if (rom_data) {
+ if (rom_loaded) {
while (psp_pad_read(1) & (BTN_SELECT|BTN_X)) psp_msleep(50); // wait until released
engineState = PGS_Running;
break;
switch (me_index2id(main_entries, MAIN_ENTRY_COUNT, menu_sel))
{
case MA_MAIN_RESUME_GAME:
- if (rom_data) {
+ if (rom_loaded) {
while (psp_pad_read(1) & BTN_CIRCLE) psp_msleep(50);
engineState = PGS_Running;
return;
}
break;
case MA_MAIN_SAVE_STATE:
- if (rom_data) {
+ if (rom_loaded) {
if(savestate_menu_loop(0))
continue;
engineState = PGS_Running;
}
break;
case MA_MAIN_LOAD_STATE:
- if (rom_data) {
+ if (rom_loaded) {
if(savestate_menu_loop(1))
continue;
engineState = PGS_Running;
}
break;
case MA_MAIN_RESET_GAME:
- if (rom_data) {
+ if (rom_loaded) {
emu_ResetGame();
engineState = PGS_Running;
return;
engineState = PGS_Quit;
return;
case MA_MAIN_PATCHES:
- if (rom_data && PicoPatches) {
+ if (rom_loaded && PicoPatches) {
patches_menu_loop();
PicoPatchApply();
strcpy(menuErrorMsg, "Patches applied");
static void menu_gfx_prepare(void)
{
- menu_prepare_bg(rom_data != NULL, 1);
+ menu_prepare_bg(rom_loaded, 1);
menu_draw_begin();
menu_draw_end();