rearrange globals

scripted find/replace
gives slightly better code on ARM, less unnecessary asm,
~400 bytes saved
This commit is contained in:
notaz 2017-10-19 02:38:20 +03:00
parent 759c9d3846
commit 93f9619ed8
47 changed files with 532 additions and 573 deletions

View file

@ -266,9 +266,9 @@ static int custom_read(menu_entry *me, const char *var, const char *val)
if (*tmp == 'Z' || *tmp == 'z') tmp++;
while (*tmp == ' ') tmp++;
if (strcasecmp(tmp, "stereo") == 0) {
PicoOpt |= POPT_EN_STEREO;
PicoIn.opt |= POPT_EN_STEREO;
} else if (strcasecmp(tmp, "mono") == 0) {
PicoOpt &= ~POPT_EN_STEREO;
PicoIn.opt &= ~POPT_EN_STEREO;
} else
return 0;
return 1;
@ -279,31 +279,31 @@ static int custom_read(menu_entry *me, const char *var, const char *val)
{
const char *p = val + 5, *end = val + strlen(val);
int i;
PicoRegionOverride = PicoAutoRgnOrder = 0;
PicoIn.regionOverride = PicoIn.autoRgnOrder = 0;
for (i = 0; p < end && i < 3; i++)
{
while (*p == ' ') p++;
if (p[0] == 'J' && p[1] == 'P') {
PicoAutoRgnOrder |= 1 << (i*4);
PicoIn.autoRgnOrder |= 1 << (i*4);
} else if (p[0] == 'U' && p[1] == 'S') {
PicoAutoRgnOrder |= 4 << (i*4);
PicoIn.autoRgnOrder |= 4 << (i*4);
} else if (p[0] == 'E' && p[1] == 'U') {
PicoAutoRgnOrder |= 8 << (i*4);
PicoIn.autoRgnOrder |= 8 << (i*4);
}
while (*p != ' ' && *p != 0) p++;
if (*p == 0) break;
}
}
else if (strcasecmp(val, "Auto") == 0) {
PicoRegionOverride = 0;
PicoIn.regionOverride = 0;
} else if (strcasecmp(val, "Japan NTSC") == 0) {
PicoRegionOverride = 1;
PicoIn.regionOverride = 1;
} else if (strcasecmp(val, "Japan PAL") == 0) {
PicoRegionOverride = 2;
PicoIn.regionOverride = 2;
} else if (strcasecmp(val, "USA") == 0) {
PicoRegionOverride = 4;
PicoIn.regionOverride = 4;
} else if (strcasecmp(val, "Europe") == 0) {
PicoRegionOverride = 8;
PicoIn.regionOverride = 8;
} else
return 0;
return 1;

View file

@ -171,8 +171,8 @@ static const char *find_bios(int *region, const char *cd_fname)
ret = emu_read_config(cd_fname, 0);
if (!ret) emu_read_config(NULL, 0);
if (PicoRegionOverride) {
*region = PicoRegionOverride;
if (PicoIn.regionOverride) {
*region = PicoIn.regionOverride;
lprintf("override region to %s\n", *region != 4 ?
(*region == 8 ? "EU" : "JAP") : "USA");
}
@ -266,16 +266,16 @@ static char *emu_make_rom_id(const char *fname)
static char id_string[3+0xe*3+0x3*3+0x30*3+3];
int pos, swab = 1;
if (PicoAHW & PAHW_MCD) {
if (PicoIn.AHW & PAHW_MCD) {
strcpy(id_string, "CD|");
swab = 0;
}
else if (PicoAHW & PAHW_SMS)
else if (PicoIn.AHW & PAHW_SMS)
strcpy(id_string, "MS|");
else strcpy(id_string, "MD|");
pos = 3;
if (!(PicoAHW & PAHW_SMS)) {
if (!(PicoIn.AHW & PAHW_SMS)) {
pos += extract_text(id_string + pos, media_id_header + 0x80, 0x0e, swab); // serial
id_string[pos] = '|'; pos++;
pos += extract_text(id_string + pos, media_id_header + 0xf0, 0x03, swab); // region
@ -296,7 +296,7 @@ static char *emu_make_rom_id(const char *fname)
// buffer must be at least 150 byte long
void emu_get_game_name(char *str150)
{
int ret, swab = (PicoAHW & PAHW_MCD) ? 0 : 1;
int ret, swab = (PicoIn.AHW & PAHW_MCD) ? 0 : 1;
char *s, *d;
ret = extract_text(str150, media_id_header + 0x50, 0x30, swab); // overseas name
@ -315,22 +315,22 @@ static void system_announce(void)
const char *sys_name, *tv_standard, *extra = "";
int fps;
if (PicoAHW & PAHW_SMS) {
if (PicoIn.AHW & PAHW_SMS) {
sys_name = "Master System";
#ifdef NO_SMS
extra = " [no support]";
#endif
} else if (PicoAHW & PAHW_PICO) {
} else if (PicoIn.AHW & PAHW_PICO) {
sys_name = "Pico";
} else if ((PicoAHW & (PAHW_32X|PAHW_MCD)) == (PAHW_32X|PAHW_MCD)) {
} else if ((PicoIn.AHW & (PAHW_32X|PAHW_MCD)) == (PAHW_32X|PAHW_MCD)) {
sys_name = "32X + Mega CD";
if ((Pico.m.hardware & 0xc0) == 0x80)
sys_name = "32X + Sega CD";
} else if (PicoAHW & PAHW_MCD) {
} else if (PicoIn.AHW & PAHW_MCD) {
sys_name = "Mega CD";
if ((Pico.m.hardware & 0xc0) == 0x80)
sys_name = "Sega CD";
} else if (PicoAHW & PAHW_32X) {
} else if (PicoIn.AHW & PAHW_32X) {
sys_name = "32X";
} else {
sys_name = "MegaDrive";
@ -451,7 +451,7 @@ int emu_reload_rom(const char *rom_fname_in)
}
// make quirks visible in UI
if (PicoQuirks & PQUIRK_FORCE_6BTN)
if (PicoIn.quirks & PQUIRK_FORCE_6BTN)
currentConfig.input_dev0 = PICO_INPUT_PAD_6BTN;
menu_romload_end();
@ -470,12 +470,12 @@ int emu_reload_rom(const char *rom_fname_in)
PicoSetInputDevice(0, indev);
PicoSetInputDevice(1, indev);
PicoOpt |= POPT_DIS_VDP_FIFO; // no VDP fifo timing
PicoIn.opt |= POPT_DIS_VDP_FIFO; // no VDP fifo timing
if (movie_data[0xF] >= 'A') {
if (movie_data[0x16] & 0x80) {
PicoRegionOverride = 8;
PicoIn.regionOverride = 8;
} else {
PicoRegionOverride = 4;
PicoIn.regionOverride = 4;
}
PicoReset();
// TODO: bits 6 & 5
@ -486,7 +486,7 @@ int emu_reload_rom(const char *rom_fname_in)
else
{
system_announce();
PicoOpt &= ~POPT_DIS_VDP_FIFO;
PicoIn.opt &= ~POPT_DIS_VDP_FIFO;
}
strncpy(rom_fname_loaded, rom_fname, sizeof(rom_fname_loaded)-1);
@ -603,10 +603,10 @@ void emu_prep_defconfig(void)
void emu_set_defconfig(void)
{
memcpy(&currentConfig, &defaultConfig, sizeof(currentConfig));
PicoOpt = currentConfig.s_PicoOpt;
PicoIn.opt = currentConfig.s_PicoOpt;
PsndRate = currentConfig.s_PsndRate;
PicoRegionOverride = currentConfig.s_PicoRegion;
PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
PicoIn.regionOverride = currentConfig.s_PicoRegion;
PicoIn.autoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
}
int emu_read_config(const char *rom_fname, int no_defaults)
@ -767,20 +767,20 @@ static void update_movie(void)
lprintf("END OF MOVIE.\n");
} else {
// MXYZ SACB RLDU
PicoPad[0] = ~movie_data[offs] & 0x8f; // ! SCBA RLDU
if(!(movie_data[offs] & 0x10)) PicoPad[0] |= 0x40; // C
if(!(movie_data[offs] & 0x20)) PicoPad[0] |= 0x10; // A
if(!(movie_data[offs] & 0x40)) PicoPad[0] |= 0x20; // B
PicoPad[1] = ~movie_data[offs+1] & 0x8f; // ! SCBA RLDU
if(!(movie_data[offs+1] & 0x10)) PicoPad[1] |= 0x40; // C
if(!(movie_data[offs+1] & 0x20)) PicoPad[1] |= 0x10; // A
if(!(movie_data[offs+1] & 0x40)) PicoPad[1] |= 0x20; // B
PicoPad[0] |= (~movie_data[offs+2] & 0x0A) << 8; // ! MZYX
if(!(movie_data[offs+2] & 0x01)) PicoPad[0] |= 0x0400; // X
if(!(movie_data[offs+2] & 0x04)) PicoPad[0] |= 0x0100; // Z
PicoPad[1] |= (~movie_data[offs+2] & 0xA0) << 4; // ! MZYX
if(!(movie_data[offs+2] & 0x10)) PicoPad[1] |= 0x0400; // X
if(!(movie_data[offs+2] & 0x40)) PicoPad[1] |= 0x0100; // Z
PicoIn.pad[0] = ~movie_data[offs] & 0x8f; // ! SCBA RLDU
if(!(movie_data[offs] & 0x10)) PicoIn.pad[0] |= 0x40; // C
if(!(movie_data[offs] & 0x20)) PicoIn.pad[0] |= 0x10; // A
if(!(movie_data[offs] & 0x40)) PicoIn.pad[0] |= 0x20; // B
PicoIn.pad[1] = ~movie_data[offs+1] & 0x8f; // ! SCBA RLDU
if(!(movie_data[offs+1] & 0x10)) PicoIn.pad[1] |= 0x40; // C
if(!(movie_data[offs+1] & 0x20)) PicoIn.pad[1] |= 0x10; // A
if(!(movie_data[offs+1] & 0x40)) PicoIn.pad[1] |= 0x20; // B
PicoIn.pad[0] |= (~movie_data[offs+2] & 0x0A) << 8; // ! MZYX
if(!(movie_data[offs+2] & 0x01)) PicoIn.pad[0] |= 0x0400; // X
if(!(movie_data[offs+2] & 0x04)) PicoIn.pad[0] |= 0x0100; // Z
PicoIn.pad[1] |= (~movie_data[offs+2] & 0xA0) << 4; // ! MZYX
if(!(movie_data[offs+2] & 0x10)) PicoIn.pad[1] |= 0x0400; // X
if(!(movie_data[offs+2] & 0x40)) PicoIn.pad[1] |= 0x0100; // Z
}
}
@ -809,9 +809,9 @@ char *emu_get_save_fname(int load, int is_sram, int slot, int *time)
if (is_sram)
{
strcpy(ext, (PicoAHW & PAHW_MCD) ? ".brm" : ".srm");
strcpy(ext, (PicoIn.AHW & PAHW_MCD) ? ".brm" : ".srm");
romfname_ext(saveFname, sizeof(static_buff),
(PicoAHW & PAHW_MCD) ? "brm"PATH_SEP : "srm"PATH_SEP, ext);
(PicoIn.AHW & PAHW_MCD) ? "brm"PATH_SEP : "srm"PATH_SEP, ext);
if (!load)
return saveFname;
@ -885,9 +885,9 @@ int emu_save_load_game(int load, int sram)
int sram_size;
unsigned char *sram_data;
int truncate = 1;
if (PicoAHW & PAHW_MCD)
if (PicoIn.AHW & PAHW_MCD)
{
if (PicoOpt & POPT_EN_MCD_RAMCART) {
if (PicoIn.opt & POPT_EN_MCD_RAMCART) {
sram_size = 0x12000;
sram_data = Pico.sv.data;
if (sram_data)
@ -912,7 +912,7 @@ int emu_save_load_game(int load, int sram)
ret = fread(sram_data, 1, sram_size, sramFile);
ret = ret > 0 ? 0 : -1;
fclose(sramFile);
if ((PicoAHW & PAHW_MCD) && (PicoOpt&POPT_EN_MCD_RAMCART))
if ((PicoIn.AHW & PAHW_MCD) && (PicoIn.opt&POPT_EN_MCD_RAMCART))
memcpy(Pico_mcd->bram, sram_data, 0x2000);
} else {
// sram save needs some special processing
@ -974,7 +974,7 @@ void emu_set_fastforward(int set_on)
PsndRerate(1);
is_on = 0;
// mainly to unbreak pcm
if (PicoAHW & PAHW_MCD)
if (PicoIn.AHW & PAHW_MCD)
pcd_state_loaded();
}
}
@ -1034,11 +1034,11 @@ void run_events_pico(unsigned int events)
return;
/* handle other input modes */
if (PicoPad[0] & 1) pico_pen_y--;
if (PicoPad[0] & 2) pico_pen_y++;
if (PicoPad[0] & 4) pico_pen_x--;
if (PicoPad[0] & 8) pico_pen_x++;
PicoPad[0] &= ~0x0f; // release UDLR
if (PicoIn.pad[0] & 1) pico_pen_y--;
if (PicoIn.pad[0] & 2) pico_pen_y++;
if (PicoIn.pad[0] & 4) pico_pen_x--;
if (PicoIn.pad[0] & 8) pico_pen_x++;
PicoIn.pad[0] &= ~0x0f; // release UDLR
lim_x = (Pico.video.reg[12]&1) ? 319 : 255;
if (pico_pen_y < 8)
@ -1057,7 +1057,7 @@ void run_events_pico(unsigned int events)
PicoPicohw.pen_pos[1] = pico_inp_mode == 1 ? (0x2f8 + pico_pen_y) : (0x1fc + pico_pen_y);
}
static void do_turbo(int *pad, int acts)
static void do_turbo(unsigned short *pad, int acts)
{
static int turbo_pad = 0;
static unsigned char turbo_cnt[3] = { 0, 0, 0 };
@ -1159,13 +1159,13 @@ void emu_update_input(void)
pl_actions[0] = actions[IN_BINDTYPE_PLAYER12];
pl_actions[1] = actions[IN_BINDTYPE_PLAYER12] >> 16;
PicoPad[0] = pl_actions[0] & 0xfff;
PicoPad[1] = pl_actions[1] & 0xfff;
PicoIn.pad[0] = pl_actions[0] & 0xfff;
PicoIn.pad[1] = pl_actions[1] & 0xfff;
if (pl_actions[0] & 0x7000)
do_turbo(&PicoPad[0], pl_actions[0]);
do_turbo(&PicoIn.pad[0], pl_actions[0]);
if (pl_actions[1] & 0x7000)
do_turbo(&PicoPad[1], pl_actions[1]);
do_turbo(&PicoIn.pad[1], pl_actions[1]);
events = actions[IN_BINDTYPE_EMU] & PEV_MASK;
@ -1181,7 +1181,7 @@ void emu_update_input(void)
events &= ~prev_events;
if (PicoAHW == PAHW_PICO)
if (PicoIn.AHW == PAHW_PICO)
run_events_pico(events);
if (events)
run_events_ui(events);
@ -1202,14 +1202,14 @@ static void mkdir_path(char *path_with_reserve, int pos, const char *name)
void emu_cmn_forced_frame(int no_scale, int do_emu)
{
int po_old = PicoOpt;
int po_old = PicoIn.opt;
memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);
PicoOpt &= ~POPT_ALT_RENDERER;
PicoOpt |= POPT_ACC_SPRITES;
PicoIn.opt &= ~POPT_ALT_RENDERER;
PicoIn.opt |= POPT_ACC_SPRITES;
if (!no_scale)
PicoOpt |= POPT_EN_SOFTSCALE;
PicoIn.opt |= POPT_EN_SOFTSCALE;
PicoDrawSetOutFormat(PDF_RGB555, 1);
Pico.m.dirtyPal = 1;
@ -1218,7 +1218,7 @@ void emu_cmn_forced_frame(int no_scale, int do_emu)
else
PicoFrameDrawOnly();
PicoOpt = po_old;
PicoIn.opt = po_old;
}
void emu_init(void)
@ -1293,7 +1293,7 @@ void emu_sound_start(void)
if (currentConfig.EmuOpt & EOPT_EN_SOUND)
{
int is_stereo = (PicoOpt & POPT_EN_STEREO) ? 1 : 0;
int is_stereo = (PicoIn.opt & POPT_EN_STEREO) ? 1 : 0;
PsndRerate(Pico.m.frame_count ? 1 : 0);
@ -1470,9 +1470,9 @@ void emu_loop(void)
emu_update_input();
if (skip) {
int do_audio = diff > -target_frametime_x3 * 2;
PicoSkipFrame = do_audio ? 1 : 2;
PicoIn.skipFrame = do_audio ? 1 : 2;
PicoFrame();
PicoSkipFrame = 0;
PicoIn.skipFrame = 0;
}
else {
PicoFrame();

View file

@ -281,7 +281,7 @@ static void menu_loop_patches(void)
// -------------- key config --------------
// PicoPad[] format: MXYZ SACB RLDU
// PicoIn.pad[] format: MXYZ SACB RLDU
me_bind_action me_ctrl_actions[] =
{
{ "UP ", 0x0001 },
@ -410,10 +410,10 @@ static const char h_scfx[] = "Emulate scale/rotate ASIC chip for graphics effe
static menu_entry e_menu_cd_options[] =
{
mee_onoff_h("CD LEDs", MA_CDOPT_LEDS, currentConfig.EmuOpt, EOPT_EN_CD_LEDS, h_cdleds),
mee_onoff_h("CDDA audio", MA_CDOPT_CDDA, PicoOpt, POPT_EN_MCD_CDDA, h_cdda),
mee_onoff_h("PCM audio", MA_CDOPT_PCM, PicoOpt, POPT_EN_MCD_PCM, h_cdpcm),
mee_onoff_h("SaveRAM cart", MA_CDOPT_SAVERAM, PicoOpt, POPT_EN_MCD_RAMCART, h_srcart),
mee_onoff_h("Scale/Rot. fx", MA_CDOPT_SCALEROT_CHIP, PicoOpt, POPT_EN_MCD_GFX, h_scfx),
mee_onoff_h("CDDA audio", MA_CDOPT_CDDA, PicoIn.opt, POPT_EN_MCD_CDDA, h_cdda),
mee_onoff_h("PCM audio", MA_CDOPT_PCM, PicoIn.opt, POPT_EN_MCD_PCM, h_cdpcm),
mee_onoff_h("SaveRAM cart", MA_CDOPT_SAVERAM, PicoIn.opt, POPT_EN_MCD_RAMCART, h_srcart),
mee_onoff_h("Scale/Rot. fx", MA_CDOPT_SCALEROT_CHIP, PicoIn.opt, POPT_EN_MCD_GFX, h_scfx),
mee_end,
};
@ -464,9 +464,9 @@ static const char h_sh2cycles[] = "Cycles/millisecond (similar to DOSBox)\n"
static menu_entry e_menu_32x_options[] =
{
mee_onoff_h ("32X enabled", MA_32XOPT_ENABLE_32X, PicoOpt, POPT_EN_32X, h_32x_enable),
mee_onoff_h ("32X enabled", MA_32XOPT_ENABLE_32X, PicoIn.opt, POPT_EN_32X, h_32x_enable),
mee_enum ("32X renderer", MA_32XOPT_RENDERER, currentConfig.renderer32x, renderer_names32x),
mee_onoff_h ("PWM sound", MA_32XOPT_PWM, PicoOpt, POPT_EN_PWM, h_pwm),
mee_onoff_h ("PWM sound", MA_32XOPT_PWM, PicoIn.opt, POPT_EN_PWM, h_pwm),
mee_cust_h ("Master SH2 cycles", MA_32XOPT_MSH2_CYCLES, mh_opt_sh2cycles, mgn_opt_sh2cycles, h_sh2cycles),
mee_cust_h ("Slave SH2 cycles", MA_32XOPT_SSH2_CYCLES, mh_opt_sh2cycles, mgn_opt_sh2cycles, h_sh2cycles),
mee_end,
@ -491,15 +491,15 @@ static int menu_loop_32x_options(int id, int keys)
static menu_entry e_menu_adv_options[] =
{
mee_onoff ("SRAM/BRAM saves", MA_OPT_SRAM_STATES, currentConfig.EmuOpt, EOPT_EN_SRAM),
mee_onoff ("Disable sprite limit", MA_OPT2_NO_SPRITE_LIM, PicoOpt, POPT_DIS_SPRITE_LIM),
mee_onoff ("Emulate Z80", MA_OPT2_ENABLE_Z80, PicoOpt, POPT_EN_Z80),
mee_onoff ("Emulate YM2612 (FM)", MA_OPT2_ENABLE_YM2612, PicoOpt, POPT_EN_FM),
mee_onoff ("Emulate SN76496 (PSG)", MA_OPT2_ENABLE_SN76496,PicoOpt, POPT_EN_PSG),
mee_onoff ("Disable sprite limit", MA_OPT2_NO_SPRITE_LIM, PicoIn.opt, POPT_DIS_SPRITE_LIM),
mee_onoff ("Emulate Z80", MA_OPT2_ENABLE_Z80, PicoIn.opt, POPT_EN_Z80),
mee_onoff ("Emulate YM2612 (FM)", MA_OPT2_ENABLE_YM2612, PicoIn.opt, POPT_EN_FM),
mee_onoff ("Emulate SN76496 (PSG)", MA_OPT2_ENABLE_SN76496,PicoIn.opt, POPT_EN_PSG),
mee_onoff ("gzip savestates", MA_OPT2_GZIP_STATES, currentConfig.EmuOpt, EOPT_GZIP_SAVES),
mee_onoff ("Don't save last used ROM", MA_OPT2_NO_LAST_ROM, currentConfig.EmuOpt, EOPT_NO_AUTOSVCFG),
mee_onoff ("Disable idle loop patching",MA_OPT2_NO_IDLE_LOOPS,PicoOpt, POPT_DIS_IDLE_DET),
mee_onoff ("Disable idle loop patching",MA_OPT2_NO_IDLE_LOOPS,PicoIn.opt, POPT_DIS_IDLE_DET),
mee_onoff ("Disable frame limiter", MA_OPT2_NO_FRAME_LIMIT,currentConfig.EmuOpt, EOPT_NO_FRMLIMIT),
mee_onoff ("Enable dynarecs", MA_OPT2_DYNARECS, PicoOpt, POPT_EN_DRC),
mee_onoff ("Enable dynarecs", MA_OPT2_DYNARECS, PicoIn.opt, POPT_EN_DRC),
mee_onoff ("Status line in main menu", MA_OPT2_STATUS_LINE, currentConfig.EmuOpt, EOPT_SHOW_RTC),
MENU_OPTIONS_ADV
mee_end,
@ -556,15 +556,15 @@ static int sndrate_prevnext(int rate, int dir)
i += dir ? 1 : -1;
if (i > 4) {
if (!(PicoOpt & POPT_EN_STEREO)) {
PicoOpt |= POPT_EN_STEREO;
if (!(PicoIn.opt & POPT_EN_STEREO)) {
PicoIn.opt |= POPT_EN_STEREO;
return rates[0];
}
return rates[4];
}
if (i < 0) {
if (PicoOpt & POPT_EN_STEREO) {
PicoOpt &= ~POPT_EN_STEREO;
if (PicoIn.opt & POPT_EN_STEREO) {
PicoIn.opt &= ~POPT_EN_STEREO;
return rates[4];
}
return rates[0];
@ -579,24 +579,24 @@ static void region_prevnext(int right)
int i;
if (right) {
if (!PicoRegionOverride) {
if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break;
if (i < 5) PicoAutoRgnOrder = rgn_orders[i+1];
else PicoRegionOverride=1;
if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i < 5) PicoIn.autoRgnOrder = rgn_orders[i+1];
else PicoIn.regionOverride=1;
}
else
PicoRegionOverride <<= 1;
if (PicoRegionOverride > 8)
PicoRegionOverride = 8;
PicoIn.regionOverride <<= 1;
if (PicoIn.regionOverride > 8)
PicoIn.regionOverride = 8;
} else {
if (!PicoRegionOverride) {
if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break;
if (i > 0) PicoAutoRgnOrder = rgn_orders[i-1];
if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i > 0) PicoIn.autoRgnOrder = rgn_orders[i-1];
}
else
PicoRegionOverride >>= 1;
PicoIn.regionOverride >>= 1;
}
}
@ -667,7 +667,7 @@ static const char *mgn_opt_sound(int id, int *offs)
{
const char *str2;
*offs = -8;
str2 = (PicoOpt & POPT_EN_STEREO) ? "stereo" : "mono";
str2 = (PicoIn.opt & POPT_EN_STEREO) ? "stereo" : "mono";
sprintf(static_buff, "%5iHz %s", PsndRate, str2);
return static_buff;
}
@ -676,7 +676,7 @@ static const char *mgn_opt_region(int id, int *offs)
{
static const char *names[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" };
static const char *names_short[] = { "", " JP", " JP", " US", " EU" };
int code = PicoRegionOverride;
int code = PicoIn.regionOverride;
int u, i = 0;
*offs = -6;
@ -689,7 +689,7 @@ static const char *mgn_opt_region(int id, int *offs)
} else {
strcpy(static_buff, "Auto:");
for (u = 0; u < 3; u++) {
code = (PicoAutoRgnOrder >> u*4) & 0xf;
code = (PicoIn.autoRgnOrder >> u*4) & 0xf;
for (i = 0; code; code >>= 1, i++)
;
strcat(static_buff, names_short[i]);
@ -887,9 +887,9 @@ static void debug_menu_loop(void)
if (inp & PBTN_MA2) pv->debug_p ^= PVD_KILL_32X;
if (inp & PBTN_MOK) {
PsndOut = NULL; // just in case
PicoSkipFrame = 1;
PicoIn.skipFrame = 1;
PicoFrame();
PicoSkipFrame = 0;
PicoIn.skipFrame = 0;
while (inp & PBTN_MOK) inp = in_menu_wait_any(NULL, -1);
}
break;
@ -1023,7 +1023,7 @@ static int main_menu_handler(int id, int keys)
}
break;
case MA_MAIN_CHANGE_CD:
if (PicoAHW & PAHW_MCD) {
if (PicoIn.AHW & PAHW_MCD) {
// if cd is loaded, cdd_unload() triggers eject and
// returns 1, else we'll select and load new CD here
if (!cdd_unload())
@ -1081,7 +1081,7 @@ void menu_loop(void)
me_enable(e_menu_main, MA_MAIN_SAVE_STATE, PicoGameLoaded);
me_enable(e_menu_main, MA_MAIN_LOAD_STATE, PicoGameLoaded);
me_enable(e_menu_main, MA_MAIN_RESET_GAME, PicoGameLoaded);
me_enable(e_menu_main, MA_MAIN_CHANGE_CD, PicoAHW & PAHW_MCD);
me_enable(e_menu_main, MA_MAIN_CHANGE_CD, PicoIn.AHW & PAHW_MCD);
me_enable(e_menu_main, MA_MAIN_PATCHES, PicoPatches != NULL);
menu_enter(PicoGameLoaded);
@ -1168,7 +1168,7 @@ void menu_update_msg(const char *msg)
/* hidden options for config engine only */
static menu_entry e_menu_hidden[] =
{
mee_onoff("Accurate sprites", MA_OPT_ACC_SPRITES, PicoOpt, 0x080),
mee_onoff("Accurate sprites", MA_OPT_ACC_SPRITES, PicoIn.opt, 0x080),
mee_onoff("autoload savestates", MA_OPT_AUTOLOAD_SAVE, g_autostateld_opt, 1),
mee_end,
};

View file

@ -115,7 +115,7 @@ void mp3_start_play(void *f_, int pos1024)
cdda_out_pos = 0;
decoder_active = 0;
if (!(PicoOpt & POPT_EN_MCD_CDDA) || f == NULL) // cdda disabled or no file?
if (!(PicoIn.opt & POPT_EN_MCD_CDDA) || f == NULL) // cdda disabled or no file?
return;
fseek(f, 0, SEEK_END);

View file

@ -145,7 +145,7 @@ static void blit(const char *fps, const char *notice)
{
int emu_opt = currentConfig.EmuOpt;
if (PicoOpt&0x10)
if (PicoIn.opt&0x10)
{
int lines_flags = 224;
// 8bit fast renderer
@ -154,7 +154,7 @@ static void blit(const char *fps, const char *notice)
vidConvCpyRGB565(localPal, Pico.cram, 0x40);
}
// a hack for VR
if (PicoAHW & PAHW_SVP)
if (PicoIn.AHW & PAHW_SVP)
memset32((int *)(Pico.est.Draw2FB+328*8+328*223), 0xe0e0e0e0, 328);
if (!(Pico.video.reg[12]&1)) lines_flags|=0x10000;
if (currentConfig.EmuOpt&0x4000)
@ -196,7 +196,7 @@ static void blit(const char *fps, const char *notice)
if (emu_opt & 2) osd_text(OSD_FPS_X, h, fps);
}
if ((emu_opt & 0x400) && (PicoAHW & PAHW_MCD))
if ((emu_opt & 0x400) && (PicoIn.AHW & PAHW_MCD))
cd_leds();
}
@ -220,7 +220,7 @@ static void vidResetMode(void)
{
giz_screen = fb_lock(1);
if (PicoOpt&0x10) {
if (PicoIn.opt&0x10) {
} else if (currentConfig.EmuOpt&0x80) {
PicoDrawSetOutFormat(PDF_RGB555, 0);
PicoDrawSetCallbacks(EmuScanBegin16, NULL);
@ -228,7 +228,7 @@ static void vidResetMode(void)
PicoDrawSetOutFormat(PDF_NONE, 0);
PicoDrawSetCallbacks(EmuScanBegin8, NULL);
}
if ((PicoOpt&0x10) || !(currentConfig.EmuOpt&0x80)) {
if ((PicoIn.opt&0x10) || !(currentConfig.EmuOpt&0x80)) {
// setup pal for 8-bit modes
localPal[0xc0] = 0x0600;
localPal[0xd0] = 0xc000;
@ -278,21 +278,21 @@ static void updateSound(int len)
static void SkipFrame(void)
{
PicoSkipFrame=1;
PicoIn.skipFrame=1;
PicoFrame();
PicoSkipFrame=0;
PicoIn.skipFrame=0;
}
/* forced frame to front buffer */
void pemu_forced_frame(int no_scale, int do_emu)
{
int po_old = PicoOpt;
int po_old = PicoIn.opt;
int eo_old = currentConfig.EmuOpt;
PicoOpt &= ~0x10;
PicoOpt |= POPT_ACC_SPRITES;
PicoIn.opt &= ~0x10;
PicoIn.opt |= POPT_ACC_SPRITES;
if (!no_scale)
PicoOpt |= POPT_EN_SOFTSCALE;
PicoIn.opt |= POPT_EN_SOFTSCALE;
currentConfig.EmuOpt |= 0x80;
if (giz_screen == NULL)
@ -306,7 +306,7 @@ void pemu_forced_frame(int no_scale, int do_emu)
fb_unlock();
giz_screen = NULL;
PicoOpt = po_old;
PicoIn.opt = po_old;
currentConfig.EmuOpt = eo_old;
}
@ -350,12 +350,12 @@ static void RunEvents(unsigned int which)
}
if (which & 0x0400) // switch renderer
{
if (PicoOpt&0x10) { PicoOpt&=~0x10; currentConfig.EmuOpt |= 0x80; }
else { PicoOpt|= 0x10; currentConfig.EmuOpt &= ~0x80; }
if (PicoIn.opt&0x10) { PicoIn.opt&=~0x10; currentConfig.EmuOpt |= 0x80; }
else { PicoIn.opt|= 0x10; currentConfig.EmuOpt &= ~0x80; }
vidResetMode();
if (PicoOpt&0x10) {
if (PicoIn.opt&0x10) {
strcpy(noticeMsg, " 8bit fast renderer");
} else if (currentConfig.EmuOpt&0x80) {
strcpy(noticeMsg, "16bit accurate renderer");
@ -392,11 +392,11 @@ static void updateKeys(void)
keys &= CONFIGURABLE_KEYS;
PicoPad[0] = allActions[0] & 0xfff;
PicoPad[1] = allActions[1] & 0xfff;
PicoIn.pad[0] = allActions[0] & 0xfff;
PicoIn.pad[1] = allActions[1] & 0xfff;
if (allActions[0] & 0x7000) emu_DoTurbo(&PicoPad[0], allActions[0]);
if (allActions[1] & 0x7000) emu_DoTurbo(&PicoPad[1], allActions[1]);
if (allActions[0] & 0x7000) emu_DoTurbo(&PicoIn.pad[0], allActions[0]);
if (allActions[1] & 0x7000) emu_DoTurbo(&PicoIn.pad[1], allActions[1]);
events = (allActions[0] | allActions[1]) >> 16;
@ -455,8 +455,8 @@ void pemu_loop(void)
// make sure we are in correct mode
vidResetMode();
if (currentConfig.scaling) PicoOpt|=0x4000;
else PicoOpt&=~0x4000;
if (currentConfig.scaling) PicoIn.opt|=0x4000;
else PicoIn.opt&=~0x4000;
Pico.m.dirtyPal = 1;
oldmodes = ((Pico.video.reg[12]&1)<<2) ^ 0xc;
@ -466,17 +466,17 @@ void pemu_loop(void)
reset_timing = 1;
// prepare CD buffer
if (PicoAHW & PAHW_MCD) PicoCDBufferInit();
if (PicoIn.AHW & PAHW_MCD) PicoCDBufferInit();
// prepare sound stuff
PsndOut = NULL;
if (currentConfig.EmuOpt & 4)
{
int ret, snd_excess_add, stereo;
if (PsndRate != PsndRate_old || (PicoOpt&0x0b) != (PicoOpt_old&0x0b) || Pico.m.pal != pal_old) {
if (PsndRate != PsndRate_old || (PicoIn.opt&0x0b) != (PicoOpt_old&0x0b) || Pico.m.pal != pal_old) {
PsndRerate(Pico.m.frame_count ? 1 : 0);
}
stereo=(PicoOpt&8)>>3;
stereo=(PicoIn.opt&8)>>3;
snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;
snd_cbuf_samples = (PsndRate<<stereo) * 16 / target_fps;
lprintf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n",
@ -494,7 +494,7 @@ void pemu_loop(void)
PsndOut = snd_cbuff + snd_cbuf_samples / 2; // start writing at the middle
snd_all_samples = 0;
PsndRate_old = PsndRate;
PicoOpt_old = PicoOpt;
PicoOpt_old = PicoIn.opt;
pal_old = Pico.m.pal;
}
}
@ -561,7 +561,7 @@ void pemu_loop(void)
audio_skew = snd_all_samples*2 - FrameworkAudio_BufferPos();
if (PsndRate == 22050) co = 10;
if (PsndRate > 22050) co = 11;
if (PicoOpt&8) shift++;
if (PicoIn.opt&8) shift++;
if (audio_skew < 0) {
adj = -((-audio_skew) >> shift);
if (audio_skew > -(6<<co)) adj>>=1;
@ -674,7 +674,7 @@ void pemu_loop(void)
}
if (PicoAHW & PAHW_MCD) PicoCDBufferFree();
if (PicoIn.AHW & PAHW_MCD) PicoCDBufferFree();
if (PsndOut != NULL) {
PsndOut = snd_cbuff = NULL;

View file

@ -501,7 +501,7 @@ static void draw_savestate_bg(int slot)
}
if (file) {
if (PicoAHW & 1) {
if (PicoIn.AHW & 1) {
PicoCdLoadStateGfx(file);
} else {
areaSeek(file, 0x10020, SEEK_SET); // skip header and RAM in state file
@ -703,7 +703,7 @@ menu_entry ctrlopt_entries[] =
{ "Player 1", MB_NONE, MA_CTRL_PLAYER1, NULL, 0, 0, 0, 1, 0 },
{ "Player 2", MB_NONE, MA_CTRL_PLAYER2, NULL, 0, 0, 0, 1, 0 },
{ "Emulator controls", MB_NONE, MA_CTRL_EMU, NULL, 0, 0, 0, 1, 0 },
{ "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoOpt, 0x020, 0, 0, 1, 1 },
{ "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoIn.opt, 0x020, 0, 0, 1, 1 },
{ "Turbo rate", MB_RANGE, MA_CTRL_TURBO_RATE, &currentConfig.turbo_rate, 0, 1, 30, 1, 1 },
{ "Done", MB_NONE, MA_CTRL_DONE, NULL, 0, 0, 0, 1, 0 },
};
@ -756,7 +756,7 @@ static void kc_sel_loop(void)
if (inp & PBTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
if (inp & PBTN_PLAY) {
int is_6button = PicoOpt & 0x020;
int is_6button = PicoIn.opt & 0x020;
switch (selected_id) {
case MA_CTRL_PLAYER1: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 0); return;
case MA_CTRL_PLAYER2: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 1); return;
@ -779,12 +779,12 @@ menu_entry cdopt_entries[] =
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_EUR, NULL, 0, 0, 0, 1, 0 },
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_JAP, NULL, 0, 0, 0, 1, 0 },
{ "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, &currentConfig.EmuOpt, 0x0400, 0, 0, 1, 1 },
{ "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
{ "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 0, 0, 1, 1 },
{ "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoIn.opt, 0x0800, 0, 0, 1, 1 },
{ "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoIn.opt, 0x0400, 0, 0, 1, 1 },
{ NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1, 1 },
{ "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoOpt, 0x8000, 0, 0, 1, 1 },
{ "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoOpt, 0x1000, 0, 0, 1, 1 },
{ "Better sync (slow)", MB_ONOFF, MA_CDOPT_BETTER_SYNC, &PicoOpt, 0x2000, 0, 0, 1, 1 },
{ "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoIn.opt, 0x8000, 0, 0, 1, 1 },
{ "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoIn.opt, 0x1000, 0, 0, 1, 1 },
{ "Better sync (slow)", MB_ONOFF, MA_CDOPT_BETTER_SYNC, &PicoIn.opt, 0x2000, 0, 0, 1, 1 },
{ "done", MB_NONE, MA_CDOPT_DONE, NULL, 0, 0, 0, 1, 0 },
};
@ -927,16 +927,16 @@ static void cd_menu_loop_options(void)
menu_entry opt2_entries[] =
{
{ "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoOpt, 0x40000, 0, 0, 1, 1 },
{ "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoOpt, 0x00004, 0, 0, 1, 1 },
{ "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoOpt, 0x00001, 0, 0, 1, 1 },
{ "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,&PicoOpt, 0x00002, 0, 0, 1, 1 },
{ "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoIn.opt, 0x40000, 0, 0, 1, 1 },
{ "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoIn.opt, 0x00004, 0, 0, 1, 1 },
{ "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoIn.opt, 0x00001, 0, 0, 1, 1 },
{ "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,&PicoIn.opt, 0x00002, 0, 0, 1, 1 },
{ "Double buffering", MB_ONOFF, MA_OPT2_DBLBUFF, &currentConfig.EmuOpt, 0x8000, 0, 0, 1, 1 },
{ "Wait for V-sync (slow)", MB_ONOFF, MA_OPT2_VSYNC, &currentConfig.EmuOpt, 0x2000, 0, 0, 1, 1 },
{ "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, &currentConfig.EmuOpt, 0x0008, 0, 0, 1, 1 },
{ "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, &currentConfig.EmuOpt, 0x0020, 0, 0, 1, 1 },
{ "SVP dynarec", MB_ONOFF, MA_OPT2_SVP_DYNAREC, &PicoOpt, 0x20000, 0, 0, 1, 1 },
{ "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoOpt, 0x80000, 0, 0, 1, 1 },
{ "SVP dynarec", MB_ONOFF, MA_OPT2_SVP_DYNAREC, &PicoIn.opt, 0x20000, 0, 0, 1, 1 },
{ "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoIn.opt, 0x80000, 0, 0, 1, 1 },
{ "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1, 0 },
};
@ -1001,7 +1001,7 @@ static void amenu_loop_options(void)
menu_entry opt_entries[] =
{
{ NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 },
{ "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 0, 1 },
{ "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoIn.opt, 0x080, 0, 0, 0, 1 },
{ "Scanline mode (faster)", MB_ONOFF, MA_OPT_INTERLACED, &currentConfig.EmuOpt, 0x4000, 0, 0, 1, 1 },
{ "Scale low res mode", MB_ONOFF, MA_OPT_SCALING, &currentConfig.scaling, 0x0001, 0, 3, 1, 1 },
{ "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, &currentConfig.EmuOpt, 0x0002, 0, 0, 1, 1 },
@ -1030,7 +1030,7 @@ static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *para
switch (entry->id)
{
case MA_OPT_RENDERER:
if (PicoOpt&0x10)
if (PicoIn.opt&0x10)
str = " 8bit fast";
else if (currentConfig.EmuOpt&0x80)
str = "16bit accurate";
@ -1045,11 +1045,11 @@ static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *para
text_out16(x, y, "Frameskip %s", str24);
break;
case MA_OPT_SOUND_QUALITY:
str = (PicoOpt&0x08)?"stereo":"mono";
str = (PicoIn.opt&0x08)?"stereo":"mono";
text_out16(x, y, "Sound Quality: %5iHz %s", PsndRate, str);
break;
case MA_OPT_REGION:
text_out16(x, y, "Region: %s", me_region_name(PicoRegionOverride, PicoAutoRgnOrder));
text_out16(x, y, "Region: %s", me_region_name(PicoIn.regionOverride, PicoIn.autoRgnOrder));
break;
case MA_OPT_CONFIRM_STATES:
switch ((currentConfig.EmuOpt >> 9) & 5) {
@ -1108,31 +1108,31 @@ static void region_prevnext(int right)
static int rgn_orders[] = { 0x148, 0x184, 0x814, 0x418, 0x841, 0x481 };
int i;
if (right) {
if (!PicoRegionOverride) {
if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break;
if (i < 5) PicoAutoRgnOrder = rgn_orders[i+1];
else PicoRegionOverride=1;
if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i < 5) PicoIn.autoRgnOrder = rgn_orders[i+1];
else PicoIn.regionOverride=1;
}
else PicoRegionOverride<<=1;
if (PicoRegionOverride > 8) PicoRegionOverride = 8;
else PicoIn.regionOverride<<=1;
if (PicoIn.regionOverride > 8) PicoIn.regionOverride = 8;
} else {
if (!PicoRegionOverride) {
if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break;
if (i > 0) PicoAutoRgnOrder = rgn_orders[i-1];
if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i > 0) PicoIn.autoRgnOrder = rgn_orders[i-1];
}
else PicoRegionOverride>>=1;
else PicoIn.regionOverride>>=1;
}
}
static void menu_options_save(void)
{
if (PicoRegionOverride) {
if (PicoIn.regionOverride) {
// force setting possibly changed..
Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0;
Pico.m.pal = (PicoIn.regionOverride == 2 || PicoIn.regionOverride == 8) ? 1 : 0;
}
if (!(PicoOpt & 0x20)) {
if (!(PicoIn.opt & 0x20)) {
// unbind XYZ MODE, just in case
unbind_action(0xf00);
}
@ -1162,28 +1162,28 @@ static int menu_loop_options(void)
switch (selected_id) {
case MA_OPT_RENDERER:
if (inp & PBTN_LEFT) {
if ((PicoOpt&0x10) || !(currentConfig.EmuOpt &0x80)) {
PicoOpt&= ~0x10;
if ((PicoIn.opt&0x10) || !(currentConfig.EmuOpt &0x80)) {
PicoIn.opt&= ~0x10;
currentConfig.EmuOpt |= 0x80;
}
} else {
if (!(PicoOpt&0x10) || (currentConfig.EmuOpt &0x80)) {
PicoOpt|= 0x10;
if (!(PicoIn.opt&0x10) || (currentConfig.EmuOpt &0x80)) {
PicoIn.opt|= 0x10;
currentConfig.EmuOpt &= ~0x80;
}
}
break;
case MA_OPT_SOUND_QUALITY:
if ((inp & PBTN_RIGHT) && PsndRate == 44100 &&
!(PicoOpt&0x08))
!(PicoIn.opt&0x08))
{
PsndRate = 11025;
PicoOpt |= 8;
PicoIn.opt |= 8;
} else if ((inp & PBTN_LEFT) && PsndRate == 11025 &&
(PicoOpt&0x08) && !(PicoAHW&1))
(PicoIn.opt&0x08) && !(PicoIn.AHW&1))
{
PsndRate = 44100;
PicoOpt &= ~8;
PicoIn.opt &= ~8;
} else
PsndRate = sndrate_prevnext(PsndRate, inp & PBTN_RIGHT);
break;

View file

@ -424,7 +424,7 @@ int YM2612UpdateOne_940(int *buffer, int length, int stereo, int is_buf_empty)
int mp3dec_decode(FILE *f, int *file_pos, int file_len)
{
if (!(PicoOpt & POPT_EXT_FM)) {
if (!(PicoIn.opt & POPT_EXT_FM)) {
//mp3_update_local(buffer, length, stereo);
return 0;
}
@ -456,7 +456,7 @@ int mp3dec_decode(FILE *f, int *file_pos, int file_len)
int mp3dec_start(FILE *f, int fpos_start)
{
if (!(PicoOpt & POPT_EXT_FM)) {
if (!(PicoIn.opt & POPT_EXT_FM)) {
//mp3_start_play_local(f, pos);
return -1;
}

View file

@ -70,7 +70,7 @@ void pemu_prep_defconfig(void)
void pemu_validate_config(void)
{
if (gp2x_dev_id != GP2X_DEV_GP2X)
PicoOpt &= ~POPT_EXT_FM;
PicoIn.opt &= ~POPT_EXT_FM;
if (gp2x_dev_id != GP2X_DEV_WIZ)
currentConfig.EmuOpt &= ~EOPT_WIZ_TEAR_FIX;
@ -83,7 +83,7 @@ void pemu_validate_config(void)
static int get_renderer(void)
{
if (PicoAHW & PAHW_32X)
if (PicoIn.AHW & PAHW_32X)
return currentConfig.renderer32x;
else
return currentConfig.renderer;
@ -92,14 +92,14 @@ static int get_renderer(void)
static void change_renderer(int diff)
{
int *r;
if (PicoAHW & PAHW_32X)
if (PicoIn.AHW & PAHW_32X)
r = &currentConfig.renderer32x;
else
r = &currentConfig.renderer;
*r += diff;
// 8bpp fast is not there (yet?)
if ((PicoAHW & PAHW_SMS) && *r == RT_8BIT_FAST)
if ((PicoIn.AHW & PAHW_SMS) && *r == RT_8BIT_FAST)
(*r)++;
if (*r >= RT_COUNT)
@ -109,7 +109,7 @@ static void change_renderer(int diff)
}
#define is_16bit_mode() \
(get_renderer() == RT_16BIT || (PicoAHW & PAHW_32X))
(get_renderer() == RT_16BIT || (PicoIn.AHW & PAHW_32X))
static void (*osd_text)(int x, int y, const char *text);
@ -201,7 +201,7 @@ static void draw_pico_ptr(void)
x = pico_pen_x + PICO_PEN_ADJUST_X;
y = pico_pen_y + PICO_PEN_ADJUST_Y;
if (!(Pico.video.reg[12]&1) && !(PicoOpt & POPT_DIS_32C_BORDER))
if (!(Pico.video.reg[12]&1) && !(PicoIn.opt & POPT_DIS_32C_BORDER))
x += 32;
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {
@ -231,7 +231,7 @@ static int EmuScanEnd16_rot(unsigned int num)
if ((num & 3) != 3)
return 0;
rotated_blit16(g_screen_ptr, rot_buff, num + 1,
!(Pico.video.reg[12] & 1) && !(PicoOpt & POPT_EN_SOFTSCALE));
!(Pico.video.reg[12] & 1) && !(PicoIn.opt & POPT_EN_SOFTSCALE));
return 0;
}
@ -342,7 +342,7 @@ void pemu_finalize_frame(const char *fps, const char *notice)
int emu_opt = currentConfig.EmuOpt;
int ret;
if (PicoAHW & PAHW_32X)
if (PicoIn.AHW & PAHW_32X)
; // nothing to do
else if (get_renderer() == RT_8BIT_FAST)
{
@ -354,11 +354,11 @@ void pemu_finalize_frame(const char *fps, const char *notice)
gp2x_video_setpalette(localPal, ret);
}
// a hack for VR
if (PicoAHW & PAHW_SVP)
if (PicoIn.AHW & PAHW_SVP)
memset32((int *)(Pico.est.Draw2FB+328*8+328*223), 0xe0e0e0e0, 328);
// do actual copy
vidcpyM2(g_screen_ptr, Pico.est.Draw2FB+328*8,
!(Pico.video.reg[12] & 1), !(PicoOpt & POPT_DIS_32C_BORDER));
!(Pico.video.reg[12] & 1), !(PicoIn.opt & POPT_DIS_32C_BORDER));
}
else if (get_renderer() == RT_8BIT_ACC)
{
@ -375,9 +375,9 @@ void pemu_finalize_frame(const char *fps, const char *notice)
osd_text(4, osd_y, notice);
if (emu_opt & EOPT_SHOW_FPS)
osd_text(osd_fps_x, osd_y, fps);
if ((PicoAHW & PAHW_MCD) && (emu_opt & EOPT_EN_CD_LEDS))
if ((PicoIn.AHW & PAHW_MCD) && (emu_opt & EOPT_EN_CD_LEDS))
draw_cd_leds();
if (PicoAHW & PAHW_PICO)
if (PicoIn.AHW & PAHW_PICO)
draw_pico_ptr();
}
@ -472,7 +472,7 @@ static void vid_reset_mode(void)
int gp2x_mode = 16;
int renderer = get_renderer();
PicoOpt &= ~POPT_ALT_RENDERER;
PicoIn.opt &= ~POPT_ALT_RENDERER;
emu_scan_begin = NULL;
emu_scan_end = NULL;
@ -487,7 +487,7 @@ static void vid_reset_mode(void)
gp2x_mode = 8;
break;
case RT_8BIT_FAST:
PicoOpt |= POPT_ALT_RENDERER;
PicoIn.opt |= POPT_ALT_RENDERER;
PicoDrawSetOutFormat(PDF_NONE, 0);
vidcpyM2 = vidcpy_m2;
gp2x_mode = 8;
@ -497,7 +497,7 @@ static void vid_reset_mode(void)
break;
}
if (PicoAHW & PAHW_32X) {
if (PicoIn.AHW & PAHW_32X) {
// Wiz 16bit is an exception, uses line rendering due to rotation mess
if (renderer == RT_16BIT && (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX)) {
PicoDrawSetOutFormat(PDF_RGB555, 1);
@ -510,7 +510,7 @@ static void vid_reset_mode(void)
}
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {
if ((PicoAHW & PAHW_32X) || renderer == RT_16BIT) {
if ((PicoIn.AHW & PAHW_32X) || renderer == RT_16BIT) {
emu_scan_begin = EmuScanBegin16_rot;
emu_scan_end = EmuScanEnd16_rot;
}
@ -549,12 +549,12 @@ static void vid_reset_mode(void)
Pico.m.dirtyPal = 1;
PicoOpt &= ~POPT_EN_SOFTSCALE;
PicoIn.opt &= ~POPT_EN_SOFTSCALE;
if (currentConfig.scaling == EOPT_SCALE_SW)
PicoOpt |= POPT_EN_SOFTSCALE;
PicoIn.opt |= POPT_EN_SOFTSCALE;
// palette converters for 8bit modes
make_local_pal = (PicoAHW & PAHW_SMS) ? make_local_pal_sms : make_local_pal_md;
make_local_pal = (PicoIn.AHW & PAHW_SMS) ? make_local_pal_sms : make_local_pal_md;
}
void emu_video_mode_change(int start_line, int line_count, int is_32cols)
@ -569,10 +569,10 @@ void emu_video_mode_change(int start_line, int line_count, int is_32cols)
osd_y = 232;
/* set up hwscaling here */
PicoOpt &= ~POPT_DIS_32C_BORDER;
PicoIn.opt &= ~POPT_DIS_32C_BORDER;
if (is_32cols && currentConfig.scaling == EOPT_SCALE_HW) {
scalex = 256;
PicoOpt |= POPT_DIS_32C_BORDER;
PicoIn.opt |= POPT_DIS_32C_BORDER;
osd_fps_x = OSD_FPS_X - 64;
}
@ -607,7 +607,7 @@ void plat_video_toggle_renderer(int change, int is_menu_call)
vid_reset_mode();
rendstatus_old = -1;
if (PicoAHW & PAHW_32X)
if (PicoIn.AHW & PAHW_32X)
emu_status_msg(renderer_names32x[get_renderer()]);
else
emu_status_msg(renderer_names[get_renderer()]);
@ -626,7 +626,7 @@ static void RunEventsPico(unsigned int events)
if (ret > 35000)
{
if (pdown_frames++ > 5)
PicoPad[0] |= 0x20;
PicoIn.pad[0] |= 0x20;
pico_pen_x = px;
pico_pen_y = py;
@ -654,7 +654,7 @@ void plat_update_volume(int has_changed, int is_up)
gp2x_soc_t soc;
soc = soc_detect();
if ((PicoOpt & POPT_EN_STEREO) && soc == SOCID_MMSP2)
if ((PicoIn.opt & POPT_EN_STEREO) && soc == SOCID_MMSP2)
need_low_volume = 1;
if (has_changed)

View file

@ -13,7 +13,7 @@ const char *men_scaling_opts[] = { "OFF", "software", "hardware", NULL };
mee_onoff ("Vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC),
#define MENU_OPTIONS_ADV \
mee_onoff ("Use second CPU for sound", MA_OPT_ARM940_SOUND, PicoOpt, POPT_EXT_FM), \
mee_onoff ("Use second CPU for sound", MA_OPT_ARM940_SOUND, PicoIn.opt, POPT_EXT_FM), \
static menu_entry e_menu_adv_options[];

View file

@ -1115,13 +1115,13 @@ void *retro_get_memory_data(unsigned type)
switch(type)
{
case RETRO_MEMORY_SAVE_RAM:
if (PicoAHW & PAHW_MCD)
if (PicoIn.AHW & PAHW_MCD)
data = Pico_mcd->bram;
else
data = Pico.sv.data;
break;
case RETRO_MEMORY_SYSTEM_RAM:
if (PicoAHW & PAHW_SMS)
if (PicoIn.AHW & PAHW_SMS)
data = PicoMem.zram;
else
data = PicoMem.ram;
@ -1142,7 +1142,7 @@ size_t retro_get_memory_size(unsigned type)
switch(type)
{
case RETRO_MEMORY_SAVE_RAM:
if (PicoAHW & PAHW_MCD)
if (PicoIn.AHW & PAHW_MCD)
// bram
return 0x2000;
@ -1157,7 +1157,7 @@ size_t retro_get_memory_size(unsigned type)
return (sum != 0) ? Pico.sv.size : 0;
case RETRO_MEMORY_SYSTEM_RAM:
if (PicoAHW & PAHW_SMS)
if (PicoIn.AHW & PAHW_SMS)
return 0x2000;
else
return sizeof(PicoMem.ram);
@ -1228,38 +1228,38 @@ static void update_variables(void)
var.key = "picodrive_sprlim";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "enabled") == 0)
PicoOpt |= POPT_DIS_SPRITE_LIM;
PicoIn.opt |= POPT_DIS_SPRITE_LIM;
else
PicoOpt &= ~POPT_DIS_SPRITE_LIM;
PicoIn.opt &= ~POPT_DIS_SPRITE_LIM;
}
var.value = NULL;
var.key = "picodrive_ramcart";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "enabled") == 0)
PicoOpt |= POPT_EN_MCD_RAMCART;
PicoIn.opt |= POPT_EN_MCD_RAMCART;
else
PicoOpt &= ~POPT_EN_MCD_RAMCART;
PicoIn.opt &= ~POPT_EN_MCD_RAMCART;
}
OldPicoRegionOverride = PicoRegionOverride;
OldPicoRegionOverride = PicoIn.regionOverride;
var.value = NULL;
var.key = "picodrive_region";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "Auto") == 0)
PicoRegionOverride = 0;
PicoIn.regionOverride = 0;
else if (strcmp(var.value, "Japan NTSC") == 0)
PicoRegionOverride = 1;
PicoIn.regionOverride = 1;
else if (strcmp(var.value, "Japan PAL") == 0)
PicoRegionOverride = 2;
PicoIn.regionOverride = 2;
else if (strcmp(var.value, "US") == 0)
PicoRegionOverride = 4;
PicoIn.regionOverride = 4;
else if (strcmp(var.value, "Europe") == 0)
PicoRegionOverride = 8;
PicoIn.regionOverride = 8;
}
// Update region, fps and sound flags if needed
if (Pico.rom && PicoRegionOverride != OldPicoRegionOverride)
if (Pico.rom && PicoIn.regionOverride != OldPicoRegionOverride)
{
PicoDetectRegion();
PicoLoopPrepare();
@ -1300,14 +1300,14 @@ static void update_variables(void)
var.key = "picodrive_drc";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "enabled") == 0)
PicoOpt |= POPT_EN_DRC;
PicoIn.opt |= POPT_EN_DRC;
else
PicoOpt &= ~POPT_EN_DRC;
PicoIn.opt &= ~POPT_EN_DRC;
}
#endif
#ifdef _3DS
if(!ctr_svchack_successful)
PicoOpt &= ~POPT_EN_DRC;
PicoIn.opt &= ~POPT_EN_DRC;
#endif
}
@ -1321,11 +1321,11 @@ void retro_run(void)
input_poll_cb();
PicoPad[0] = PicoPad[1] = 0;
PicoIn.pad[0] = PicoIn.pad[1] = 0;
for (pad = 0; pad < 2; pad++)
for (i = 0; i < RETRO_PICO_MAP_LEN; i++)
if (input_state_cb(pad, RETRO_DEVICE_JOYPAD, 0, i))
PicoPad[pad] |= retro_pico_map[i];
PicoIn.pad[pad] |= retro_pico_map[i];
PicoPatchApply();
PicoFrame();
@ -1355,7 +1355,7 @@ void retro_init(void)
sceBlock = getVMBlock();
#endif
PicoOpt = POPT_EN_STEREO|POPT_EN_FM|POPT_EN_PSG|POPT_EN_Z80
PicoIn.opt = POPT_EN_STEREO|POPT_EN_FM|POPT_EN_PSG|POPT_EN_Z80
| POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_MCD_GFX
| POPT_EN_32X|POPT_EN_PWM
| POPT_ACC_SPRITES|POPT_DIS_32C_BORDER;
@ -1363,10 +1363,10 @@ void retro_init(void)
#ifdef _3DS
if (ctr_svchack_successful)
#endif
PicoOpt |= POPT_EN_DRC;
PicoIn.opt |= POPT_EN_DRC;
#endif
PsndRate = 44100;
PicoAutoRgnOrder = 0x184; // US, EU, JP
PicoIn.autoRgnOrder = 0x184; // US, EU, JP
vout_width = 320;
vout_height = 240;

View file

@ -29,10 +29,8 @@ void pemu_prep_defconfig(void)
void pemu_validate_config(void)
{
extern int PicoOpt;
// PicoOpt &= ~POPT_EXT_FM;
#ifndef __arm__
PicoOpt &= ~POPT_EN_DRC;
PicoIn.opt &= ~POPT_EN_DRC;
#endif
}
@ -68,7 +66,7 @@ static void draw_cd_leds(void)
void pemu_finalize_frame(const char *fps, const char *notice)
{
if (currentConfig.renderer != RT_16BIT && !(PicoAHW & PAHW_32X)) {
if (currentConfig.renderer != RT_16BIT && !(PicoIn.AHW & PAHW_32X)) {
unsigned short *pd = (unsigned short *)g_screen_ptr + 8 * g_screen_width;
unsigned char *ps = Pico.est.Draw2FB + 328*8 + 8;
unsigned short *pal = Pico.est.HighPal;
@ -86,7 +84,7 @@ void pemu_finalize_frame(const char *fps, const char *notice)
if (currentConfig.EmuOpt & EOPT_SHOW_FPS)
emu_osd_text16(g_screen_width - 60, g_screen_height - 8, fps);
}
if ((PicoAHW & PAHW_MCD) && (currentConfig.EmuOpt & EOPT_EN_CD_LEDS))
if ((PicoIn.AHW & PAHW_MCD) && (currentConfig.EmuOpt & EOPT_EN_CD_LEDS))
draw_cd_leds();
}
@ -94,22 +92,22 @@ static void apply_renderer(void)
{
switch (currentConfig.renderer) {
case RT_16BIT:
PicoOpt &= ~POPT_ALT_RENDERER;
PicoIn.opt &= ~POPT_ALT_RENDERER;
PicoDrawSetOutFormat(PDF_RGB555, 0);
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
break;
case RT_8BIT_ACC:
PicoOpt &= ~POPT_ALT_RENDERER;
PicoIn.opt &= ~POPT_ALT_RENDERER;
PicoDrawSetOutFormat(PDF_8BIT, 0);
PicoDrawSetOutBuf(Pico.est.Draw2FB + 8, 328);
break;
case RT_8BIT_FAST:
PicoOpt |= POPT_ALT_RENDERER;
PicoIn.opt |= POPT_ALT_RENDERER;
PicoDrawSetOutFormat(PDF_NONE, 0);
break;
}
if (PicoAHW & PAHW_32X)
if (PicoIn.AHW & PAHW_32X)
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
}

View file

@ -168,7 +168,7 @@ void pemu_finalize_frame(const char *fps, const char *notice)
emu_osd_text16(2, g_osd_y, notice);
if (fps && fps[0] && (currentConfig.EmuOpt & EOPT_SHOW_FPS))
emu_osd_text16(g_osd_fps_x, g_osd_y, fps);
if ((PicoAHW & PAHW_MCD) && (currentConfig.EmuOpt & EOPT_EN_CD_LEDS))
if ((PicoIn.AHW & PAHW_MCD) && (currentConfig.EmuOpt & EOPT_EN_CD_LEDS))
draw_cd_leds();
}

View file

@ -309,7 +309,7 @@ static void blitscreen_clut(void)
blit_16bit_mode = 0;
}
if ((PicoOpt&0x10) && Pico.m.dirtyPal)
if ((PicoIn.opt&0x10) && Pico.m.dirtyPal)
do_pal_update(0, 0);
sceKernelDcacheWritebackAll();
@ -395,7 +395,7 @@ static void dbg_text(void)
/* called after rendering is done, but frame emulation is not finished */
void blit1(void)
{
if (PicoOpt&0x10)
if (PicoIn.opt&0x10)
{
int i;
unsigned char *pd;
@ -406,7 +406,7 @@ void blit1(void)
memset32((int *)pd, 0xe0e0e0e0, 320/4);
}
if (PicoAHW & PAHW_PICO)
if (PicoIn.AHW & PAHW_PICO)
draw_pico_ptr();
blitscreen_clut();
@ -424,7 +424,7 @@ static void blit2(const char *fps, const char *notice, int lagging_behind)
//dbg_text();
if ((emu_opt & 0x400) && (PicoAHW & PAHW_MCD))
if ((emu_opt & 0x400) && (PicoIn.AHW & PAHW_MCD))
cd_leds();
if (currentConfig.EmuOpt & 0x2000) { // want vsync
@ -571,10 +571,10 @@ void pemu_sound_start(void)
samples_made = samples_done = 0;
if (PsndRate != PsndRate_old || (PicoOpt&0x0b) != (PicoOpt_old&0x0b) || Pico.m.pal != pal_old) {
if (PsndRate != PsndRate_old || (PicoIn.opt&0x0b) != (PicoOpt_old&0x0b) || Pico.m.pal != pal_old) {
PsndRerate(Pico.m.frame_count ? 1 : 0);
}
stereo=(PicoOpt&8)>>3;
stereo=(PicoIn.opt&8)>>3;
samples_block = Pico.m.pal ? SOUND_BLOCK_SIZE_PAL : SOUND_BLOCK_SIZE_NTSC;
if (PsndRate <= 22050) samples_block /= 2;
@ -597,7 +597,7 @@ void pemu_sound_start(void)
samples_made = samples_block; // send 1 empty block first..
PsndOut = sndBuffer;
PsndRate_old = PsndRate;
PicoOpt_old = PicoOpt;
PicoOpt_old = PicoIn.opt;
pal_old = Pico.m.pal;
}
}
@ -664,20 +664,20 @@ static void writeSound(int len)
static void SkipFrame(void)
{
PicoSkipFrame=1;
PicoIn.skipFrame=1;
PicoFrame();
PicoSkipFrame=0;
PicoIn.skipFrame=0;
}
void pemu_forced_frame(int no_scale, int do_emu)
{
int po_old = PicoOpt;
int po_old = PicoIn.opt;
int eo_old = currentConfig.EmuOpt;
PicoOpt &= ~POPT_ALT_RENDERER;
PicoOpt |= POPT_ACC_SPRITES;
PicoIn.opt &= ~POPT_ALT_RENDERER;
PicoIn.opt |= POPT_ACC_SPRITES;
if (!no_scale)
PicoOpt |= POPT_EN_SOFTSCALE;
PicoIn.opt |= POPT_EN_SOFTSCALE;
currentConfig.EmuOpt |= 0x80;
vidResetMode();
@ -692,7 +692,7 @@ void pemu_forced_frame(int no_scale, int do_emu)
blit1();
sceGuSync(0,0);
PicoOpt = po_old;
PicoIn.opt = po_old;
currentConfig.EmuOpt = eo_old;
}
@ -703,7 +703,7 @@ static void RunEventsPico(unsigned int events, unsigned int keys)
if (pico_inp_mode != 0)
{
PicoPad[0] &= ~0x0f; // release UDLR
PicoIn.pad[0] &= ~0x0f; // release UDLR
if (keys & PBTN_UP) { pico_pen_y--; if (pico_pen_y < 8) pico_pen_y = 8; }
if (keys & PBTN_DOWN) { pico_pen_y++; if (pico_pen_y > 224-PICO_PEN_ADJUST_Y) pico_pen_y = 224-PICO_PEN_ADJUST_Y; }
if (keys & PBTN_LEFT) { pico_pen_x--; if (pico_pen_x < 0) pico_pen_x = 0; }
@ -754,12 +754,12 @@ static void RunEvents(unsigned int which)
}
if (which & 0x0400) // switch renderer
{
if (PicoOpt&0x10) { PicoOpt&=~0x10; currentConfig.EmuOpt |= 0x80; }
else { PicoOpt|= 0x10; currentConfig.EmuOpt &= ~0x80; }
if (PicoIn.opt&0x10) { PicoIn.opt&=~0x10; currentConfig.EmuOpt |= 0x80; }
else { PicoIn.opt|= 0x10; currentConfig.EmuOpt &= ~0x80; }
vidResetMode();
if (PicoOpt & POPT_ALT_RENDERER)
if (PicoIn.opt & POPT_ALT_RENDERER)
emu_status_msg("fast renderer");
else if (currentConfig.EmuOpt&0x80)
emu_status_msg("accurate renderer");
@ -794,11 +794,11 @@ static void updateKeys(void)
keys &= CONFIGURABLE_KEYS;
PicoPad[0] = allActions[0] & 0xfff;
PicoPad[1] = allActions[1] & 0xfff;
PicoIn.pad[0] = allActions[0] & 0xfff;
PicoIn.pad[1] = allActions[1] & 0xfff;
if (allActions[0] & 0x7000) emu_DoTurbo(&PicoPad[0], allActions[0]);
if (allActions[1] & 0x7000) emu_DoTurbo(&PicoPad[1], allActions[1]);
if (allActions[0] & 0x7000) emu_DoTurbo(&PicoIn.pad[0], allActions[0]);
if (allActions[1] & 0x7000) emu_DoTurbo(&PicoIn.pad[1], allActions[1]);
events = (allActions[0] | allActions[1]) >> 16;
@ -809,7 +809,7 @@ static void updateKeys(void)
events &= ~prevEvents;
if (PicoAHW == PAHW_PICO)
if (PicoIn.AHW == PAHW_PICO)
RunEventsPico(events, keys);
if (events) RunEvents(events);
if (movie_data) emu_updateMovie();
@ -861,7 +861,7 @@ void pemu_loop(void)
target_frametime = Pico.m.pal ? (1000000<<8)/50 : (1000000<<8)/60+1;
reset_timing = 1;
if (PicoAHW & PAHW_MCD) {
if (PicoIn.AHW & PAHW_MCD) {
// prepare CD buffer
PicoCDBufferInit();
// mp3...
@ -986,7 +986,7 @@ void pemu_loop(void)
updateKeys();
if (!(PicoOpt&0x10))
if (!(PicoIn.opt&0x10))
EmuScanPrepare();
PicoFrame();
@ -1019,7 +1019,7 @@ void pemu_loop(void)
emu_set_fastforward(0);
if (PicoAHW & PAHW_MCD) PicoCDBufferFree();
if (PicoIn.AHW & PAHW_MCD) PicoCDBufferFree();
if (PsndOut != NULL) {
pemu_sound_stop();
@ -1039,7 +1039,7 @@ void pemu_loop(void)
void emu_HandleResume(void)
{
if (!(PicoAHW & PAHW_MCD)) return;
if (!(PicoIn.AHW & PAHW_MCD)) return;
// reopen first CD track
if (Pico_mcd->TOC.Tracks[0].F != NULL)

View file

@ -506,7 +506,7 @@ static void draw_savestate_bg(int slot)
}
if (file) {
if (PicoAHW & PAHW_MCD) {
if (PicoIn.AHW & PAHW_MCD) {
PicoCdLoadStateGfx(file);
} else {
areaSeek(file, 0x10020, SEEK_SET); // skip header and RAM in state file
@ -708,7 +708,7 @@ menu_entry ctrlopt_entries[] =
{ "Player 1", MB_NONE, MA_CTRL_PLAYER1, NULL, 0, 0, 0, 1, 0 },
{ "Player 2", MB_NONE, MA_CTRL_PLAYER2, NULL, 0, 0, 0, 1, 0 },
{ "Emulator controls", MB_NONE, MA_CTRL_EMU, NULL, 0, 0, 0, 1, 0 },
{ "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoOpt, 0x020, 0, 0, 1, 1 },
{ "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoIn.opt, 0x020, 0, 0, 1, 1 },
{ "Turbo rate", MB_RANGE, MA_CTRL_TURBO_RATE, &currentConfig.turbo_rate, 0, 1, 30, 1, 1 },
{ "Done", MB_NONE, MA_CTRL_DONE, NULL, 0, 0, 0, 1, 0 },
};
@ -763,7 +763,7 @@ static void kc_sel_loop(void)
if (inp & PBTN_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
if (inp & PBTN_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
if (inp & PBTN_CIRCLE) {
int is_6button = PicoOpt & POPT_6BTN_PAD;
int is_6button = PicoIn.opt & POPT_6BTN_PAD;
switch (selected_id) {
case MA_CTRL_PLAYER1: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 0); return;
case MA_CTRL_PLAYER2: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 1); return;
@ -786,12 +786,12 @@ menu_entry cdopt_entries[] =
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_EUR, NULL, 0, 0, 0, 1, 0 },
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_JAP, NULL, 0, 0, 0, 1, 0 },
{ "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, &currentConfig.EmuOpt, 0x0400, 0, 0, 1, 1 },
{ "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
{ "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 0, 0, 1, 1 },
{ "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoIn.opt, 0x0800, 0, 0, 1, 1 },
{ "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoIn.opt, 0x0400, 0, 0, 1, 1 },
{ NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1, 1 },
{ "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoOpt, 0x8000, 0, 0, 1, 1 },
{ "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoOpt, 0x1000, 0, 0, 1, 1 },
{ "Better sync (slow)", MB_ONOFF, MA_CDOPT_BETTER_SYNC, &PicoOpt, 0x2000, 0, 0, 1, 1 },
{ "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoIn.opt, 0x8000, 0, 0, 1, 1 },
{ "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoIn.opt, 0x1000, 0, 0, 1, 1 },
{ "Better sync (slow)", MB_ONOFF, MA_CDOPT_BETTER_SYNC, &PicoIn.opt, 0x2000, 0, 0, 1, 1 },
{ "done", MB_NONE, MA_CDOPT_DONE, NULL, 0, 0, 0, 1, 0 },
};
@ -1115,14 +1115,14 @@ static void dispmenu_loop_options(void)
menu_entry opt2_entries[] =
{
{ "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoOpt, 0x40000, 0, 0, 1, 1 },
{ "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoOpt, 0x00004, 0, 0, 1, 1 },
{ "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoOpt, 0x00001, 0, 0, 1, 1 },
{ "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496, &PicoOpt, 0x00002, 0, 0, 1, 1 },
{ "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoIn.opt, 0x40000, 0, 0, 1, 1 },
{ "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoIn.opt, 0x00004, 0, 0, 1, 1 },
{ "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoIn.opt, 0x00001, 0, 0, 1, 1 },
{ "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496, &PicoIn.opt, 0x00002, 0, 0, 1, 1 },
{ "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, &currentConfig.EmuOpt, 0x00008, 0, 0, 1, 1 },
{ "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, &currentConfig.EmuOpt, 0x00020, 0, 0, 1, 1 },
{ "Status line in main menu", MB_ONOFF, MA_OPT2_STATUS_LINE, &currentConfig.EmuOpt, 0x20000, 0, 0, 1, 1 },
{ "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoOpt, 0x80000, 0, 0, 1, 1 },
{ "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoIn.opt, 0x80000, 0, 0, 1, 1 },
{ "Disable frame limiter", MB_ONOFF, MA_OPT2_NO_FRAME_LIMIT, &currentConfig.EmuOpt, 0x40000, 0, 0, 1, 1 },
{ "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1, 0 },
};
@ -1182,7 +1182,7 @@ static void amenu_loop_options(void)
menu_entry opt_entries[] =
{
{ NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 },
{ "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 0, 1 },
{ "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoIn.opt, 0x080, 0, 0, 0, 1 },
{ "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, &currentConfig.EmuOpt, 0x0002, 0, 0, 1, 1 },
{ NULL, MB_RANGE, MA_OPT_FRAMESKIP, &currentConfig.Frameskip, 0, -1, 16, 1, 1 },
{ "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, &currentConfig.EmuOpt, 0x0004, 0, 0, 1, 1 },
@ -1211,7 +1211,7 @@ static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *para
switch (entry->id)
{
case MA_OPT_RENDERER:
if (PicoOpt & 0x10)
if (PicoIn.opt & 0x10)
str = "fast";
else if (currentConfig.EmuOpt & 0x80)
str = "accurate";
@ -1226,11 +1226,11 @@ static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *para
text_out16(x, y, "Frameskip %s", str24);
break;
case MA_OPT_SOUND_QUALITY:
str = (PicoOpt&0x08)?"stereo":"mono";
str = (PicoIn.opt&0x08)?"stereo":"mono";
text_out16(x, y, "Sound Quality: %5iHz %s", PsndRate, str);
break;
case MA_OPT_REGION:
text_out16(x, y, "Region: %s", me_region_name(PicoRegionOverride, PicoAutoRgnOrder));
text_out16(x, y, "Region: %s", me_region_name(PicoIn.regionOverride, PicoIn.autoRgnOrder));
break;
case MA_OPT_CONFIRM_STATES:
switch ((currentConfig.EmuOpt >> 9) & 5) {
@ -1291,31 +1291,31 @@ static void region_prevnext(int right)
static int rgn_orders[] = { 0x148, 0x184, 0x814, 0x418, 0x841, 0x481 };
int i;
if (right) {
if (!PicoRegionOverride) {
if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break;
if (i < 5) PicoAutoRgnOrder = rgn_orders[i+1];
else PicoRegionOverride=1;
if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i < 5) PicoIn.autoRgnOrder = rgn_orders[i+1];
else PicoIn.regionOverride=1;
}
else PicoRegionOverride<<=1;
if (PicoRegionOverride > 8) PicoRegionOverride = 8;
else PicoIn.regionOverride<<=1;
if (PicoIn.regionOverride > 8) PicoIn.regionOverride = 8;
} else {
if (!PicoRegionOverride) {
if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break;
if (i > 0) PicoAutoRgnOrder = rgn_orders[i-1];
if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i > 0) PicoIn.autoRgnOrder = rgn_orders[i-1];
}
else PicoRegionOverride>>=1;
else PicoIn.regionOverride>>=1;
}
}
static void menu_options_save(void)
{
if (PicoRegionOverride) {
if (PicoIn.regionOverride) {
// force setting possibly changed..
Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0;
Pico.m.pal = (PicoIn.regionOverride == 2 || PicoIn.regionOverride == 8) ? 1 : 0;
}
if (!(PicoOpt & POPT_6BTN_PAD)) {
if (!(PicoIn.opt & POPT_6BTN_PAD)) {
// unbind XYZ MODE, just in case
unbind_action(0xf00);
}
@ -1344,11 +1344,11 @@ static int menu_loop_options(void)
if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0)) {
switch (selected_id) {
case MA_OPT_RENDERER:
if ((PicoOpt & 0x10) || !(currentConfig.EmuOpt & 0x80)) {
PicoOpt &= ~0x10;
if ((PicoIn.opt & 0x10) || !(currentConfig.EmuOpt & 0x80)) {
PicoIn.opt &= ~0x10;
currentConfig.EmuOpt |= 0x80;
} else {
PicoOpt |= 0x10;
PicoIn.opt |= 0x10;
currentConfig.EmuOpt &= ~0x80;
}
break;

View file

@ -466,7 +466,7 @@ int mp3_get_offset(void) // 0-1023
unsigned int offs1024 = 0;
int cdda_on;
cdda_on = (PicoAHW & PAHW_MCD) && (PicoOpt&0x800) && !(Pico_mcd->s68k_regs[0x36] & 1) &&
cdda_on = (PicoIn.AHW & PAHW_MCD) && (PicoIn.opt&0x800) && !(Pico_mcd->s68k_regs[0x36] & 1) &&
(Pico_mcd->scd.Status_CDC & 1) && mp3_handle >= 0;
if (cdda_on) {

View file

@ -131,7 +131,7 @@ static HBITMAP png2hb(const char *fname, int is_480)
static void PrepareForROM(void)
{
unsigned char *rom_data = NULL;
int i, ret, show = PicoAHW & PAHW_PICO;
int i, ret, show = PicoIn.AHW & PAHW_PICO;
PicoGetInternal(PI_ROM, (pint_ret_t *) &rom_data);
EnableMenuItem(mmain, 2, MF_BYPOSITION|(show ? MF_ENABLED : MF_GRAYED));

View file

@ -123,7 +123,7 @@ static int sndbuff[2*44100/50/2 + 4];
static void update_sound(int len)
{
/* avoid writing audio when lagging behind to prevent audio lag */
if (PicoSkipFrame != 2)
if (PicoIn.skipFrame != 2)
DSoundUpdate(sndbuff, (currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) ? 0 : 1);
}
@ -139,7 +139,7 @@ void pemu_sound_start(void)
{
PsndRerate(0);
ret = DSoundInit(FrameWnd, PsndRate, (PicoOpt & POPT_EN_STEREO) ? 1 : 0, PsndLen);
ret = DSoundInit(FrameWnd, PsndRate, (PicoIn.opt & POPT_EN_STEREO) ? 1 : 0, PsndLen);
if (ret != 0) {
lprintf("dsound init failed\n");
return;