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

@ -26,7 +26,7 @@ void drc_cmn_init(void)
tcache, DRC_TCACHE_SIZE, ret); tcache, DRC_TCACHE_SIZE, ret);
#ifdef __arm__ #ifdef __arm__
if (PicoOpt & POPT_EN_DRC) if (PicoIn.opt & POPT_EN_DRC)
{ {
static int test_done; static int test_done;
if (!test_done) if (!test_done)

View file

@ -99,7 +99,7 @@ void Pico32xStartup(void)
elprintf(EL_STATUS|EL_32X, "32X startup"); elprintf(EL_STATUS|EL_32X, "32X startup");
// TODO: OOM handling // TODO: OOM handling
PicoAHW |= PAHW_32X; PicoIn.AHW |= PAHW_32X;
sh2_init(&msh2, 0, &ssh2); sh2_init(&msh2, 0, &ssh2);
msh2.irq_callback = sh2_irq_cb; msh2.irq_callback = sh2_irq_cb;
sh2_init(&ssh2, 1, &msh2); sh2_init(&ssh2, 1, &msh2);
@ -136,7 +136,7 @@ void p32x_reset_sh2s(void)
if (p32x_bios_m == NULL) { if (p32x_bios_m == NULL) {
sh2_set_gbr(0, 0x20004000); sh2_set_gbr(0, 0x20004000);
if (!(PicoAHW & PAHW_MCD)) { if (!(PicoIn.AHW & PAHW_MCD)) {
unsigned int idl_src, idl_dst, idl_size; // initial data load unsigned int idl_src, idl_dst, idl_size; // initial data load
unsigned int vbr; unsigned int vbr;
@ -200,12 +200,12 @@ void PicoUnload32x(void)
sh2_finish(&msh2); sh2_finish(&msh2);
sh2_finish(&ssh2); sh2_finish(&ssh2);
PicoAHW &= ~PAHW_32X; PicoIn.AHW &= ~PAHW_32X;
} }
void PicoReset32x(void) void PicoReset32x(void)
{ {
if (PicoAHW & PAHW_32X) { if (PicoIn.AHW & PAHW_32X) {
p32x_trigger_irq(NULL, SekCyclesDone(), P32XI_VRES); p32x_trigger_irq(NULL, SekCyclesDone(), P32XI_VRES);
p32x_sh2_poll_event(&msh2, SH2_IDLE_STATES, 0); p32x_sh2_poll_event(&msh2, SH2_IDLE_STATES, 0);
p32x_sh2_poll_event(&ssh2, SH2_IDLE_STATES, 0); p32x_sh2_poll_event(&ssh2, SH2_IDLE_STATES, 0);
@ -216,13 +216,13 @@ void PicoReset32x(void)
static void p32x_start_blank(void) static void p32x_start_blank(void)
{ {
if (Pico32xDrawMode != PDM32X_OFF && !PicoSkipFrame) { if (Pico32xDrawMode != PDM32X_OFF && !PicoIn.skipFrame) {
int offs, lines; int offs, lines;
pprof_start(draw); pprof_start(draw);
offs = 8; lines = 224; offs = 8; lines = 224;
if ((Pico.video.reg[1] & 8) && !(PicoOpt & POPT_ALT_RENDERER)) { if ((Pico.video.reg[1] & 8) && !(PicoIn.opt & POPT_ALT_RENDERER)) {
offs = 0; offs = 0;
lines = 240; lines = 240;
} }
@ -376,7 +376,7 @@ static void run_sh2(SH2 *sh2, int m68k_cycles)
elprintf_sh2(sh2, EL_32X, "+run %u %d @%08x", elprintf_sh2(sh2, EL_32X, "+run %u %d @%08x",
sh2->m68krcycles_done, cycles, sh2->pc); sh2->m68krcycles_done, cycles, sh2->pc);
done = sh2_execute(sh2, cycles, PicoOpt & POPT_EN_DRC); done = sh2_execute(sh2, cycles, PicoIn.opt & POPT_EN_DRC);
sh2->m68krcycles_done += C_SH2_TO_M68K(*sh2, done); sh2->m68krcycles_done += C_SH2_TO_M68K(*sh2, done);
sh2->state &= ~SH2_STATE_RUN; sh2->state &= ~SH2_STATE_RUN;
@ -521,13 +521,13 @@ void sync_sh2s_lockstep(unsigned int m68k_target)
} }
#define CPUS_RUN(m68k_cycles) do { \ #define CPUS_RUN(m68k_cycles) do { \
if (PicoAHW & PAHW_MCD) \ if (PicoIn.AHW & PAHW_MCD) \
pcd_run_cpus(m68k_cycles); \ pcd_run_cpus(m68k_cycles); \
else \ else \
SekRunM68k(m68k_cycles); \ SekRunM68k(m68k_cycles); \
\ \
if ((Pico32x.emu_flags & P32XF_Z80_32X_IO) && Pico.m.z80Run \ if ((Pico32x.emu_flags & P32XF_Z80_32X_IO) && Pico.m.z80Run \
&& !Pico.m.z80_reset && (PicoOpt & POPT_EN_Z80)) \ && !Pico.m.z80_reset && (PicoIn.opt & POPT_EN_Z80)) \
PicoSyncZ80(SekCyclesDone()); \ PicoSyncZ80(SekCyclesDone()); \
if (Pico32x.emu_flags & (P32XF_68KCPOLL|P32XF_68KVPOLL)) \ if (Pico32x.emu_flags & (P32XF_68KCPOLL|P32XF_68KVPOLL)) \
p32x_sync_sh2s(SekCyclesDone()); \ p32x_sync_sh2s(SekCyclesDone()); \
@ -550,7 +550,7 @@ void PicoFrame32x(void)
p32x_sh2_poll_event(&msh2, SH2_STATE_VPOLL, 0); p32x_sh2_poll_event(&msh2, SH2_STATE_VPOLL, 0);
p32x_sh2_poll_event(&ssh2, SH2_STATE_VPOLL, 0); p32x_sh2_poll_event(&ssh2, SH2_STATE_VPOLL, 0);
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
pcd_prepare_frame(); pcd_prepare_frame();
PicoFrameStart(); PicoFrameStart();

View file

@ -787,7 +787,7 @@ static u32 PicoRead8_32x_on(u32 a)
} }
if ((a & 0xfc00) != 0x5000) { if ((a & 0xfc00) != 0x5000) {
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
return PicoRead8_mcd_io(a); return PicoRead8_mcd_io(a);
else else
return PicoRead8_io(a); return PicoRead8_io(a);
@ -831,7 +831,7 @@ static u32 PicoRead16_32x_on(u32 a)
} }
if ((a & 0xfc00) != 0x5000) { if ((a & 0xfc00) != 0x5000) {
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
return PicoRead16_mcd_io(a); return PicoRead16_mcd_io(a);
else else
return PicoRead16_io(a); return PicoRead16_io(a);
@ -871,7 +871,7 @@ static void PicoWrite8_32x_on(u32 a, u32 d)
} }
if ((a & 0xfc00) != 0x5000) { if ((a & 0xfc00) != 0x5000) {
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
PicoWrite8_mcd_io(a, d); PicoWrite8_mcd_io(a, d);
else else
PicoWrite8_io(a, d); PicoWrite8_io(a, d);
@ -909,7 +909,7 @@ static void PicoWrite16_32x_on(u32 a, u32 d)
} }
if ((a & 0xfc00) != 0x5000) { if ((a & 0xfc00) != 0x5000) {
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
PicoWrite16_mcd_io(a, d); PicoWrite16_mcd_io(a, d);
else else
PicoWrite16_io(a, d); PicoWrite16_io(a, d);
@ -938,15 +938,18 @@ static void PicoWrite16_32x_on(u32 a, u32 d)
u32 PicoRead8_32x(u32 a) u32 PicoRead8_32x(u32 a)
{ {
u32 d = 0; u32 d = 0;
if ((a & 0xffc0) == 0x5100) { // a15100
// regs are always readable
d = ((u8 *)Pico32x.regs)[(a & 0x3f) ^ 1];
goto out;
}
if ((a & 0xfffc) == 0x30ec) { // a130ec if (PicoIn.opt & POPT_EN_32X) {
d = str_mars[a & 3]; if ((a & 0xffc0) == 0x5100) { // a15100
goto out; // regs are always readable
d = ((u8 *)Pico32x.regs)[(a & 0x3f) ^ 1];
goto out;
}
if ((a & 0xfffc) == 0x30ec) { // a130ec
d = str_mars[a & 3];
goto out;
}
} }
elprintf(EL_UIO, "m68k unmapped r8 [%06x] @%06x", a, SekPc); elprintf(EL_UIO, "m68k unmapped r8 [%06x] @%06x", a, SekPc);
@ -960,14 +963,17 @@ out:
u32 PicoRead16_32x(u32 a) u32 PicoRead16_32x(u32 a)
{ {
u32 d = 0; u32 d = 0;
if ((a & 0xffc0) == 0x5100) { // a15100
d = Pico32x.regs[(a & 0x3f) / 2];
goto out;
}
if ((a & 0xfffc) == 0x30ec) { // a130ec if (PicoIn.opt & POPT_EN_32X) {
d = !(a & 2) ? ('M'<<8)|'A' : ('R'<<8)|'S'; if ((a & 0xffc0) == 0x5100) { // a15100
goto out; d = Pico32x.regs[(a & 0x3f) / 2];
goto out;
}
if ((a & 0xfffc) == 0x30ec) { // a130ec
d = !(a & 2) ? ('M'<<8)|'A' : ('R'<<8)|'S';
goto out;
}
} }
elprintf(EL_UIO, "m68k unmapped r16 [%06x] @%06x", a, SekPc); elprintf(EL_UIO, "m68k unmapped r16 [%06x] @%06x", a, SekPc);
@ -980,7 +986,8 @@ out:
void PicoWrite8_32x(u32 a, u32 d) void PicoWrite8_32x(u32 a, u32 d)
{ {
if ((a & 0xffc0) == 0x5100) { // a15100 if ((PicoIn.opt & POPT_EN_32X) && (a & 0xffc0) == 0x5100) // a15100
{
u16 *r = Pico32x.regs; u16 *r = Pico32x.regs;
elprintf(EL_32X, "m68k 32x w8 [%06x] %02x @%06x", a, d & 0xff, SekPc); elprintf(EL_32X, "m68k 32x w8 [%06x] %02x @%06x", a, d & 0xff, SekPc);
@ -1008,7 +1015,8 @@ void PicoWrite8_32x(u32 a, u32 d)
void PicoWrite16_32x(u32 a, u32 d) void PicoWrite16_32x(u32 a, u32 d)
{ {
if ((a & 0xffc0) == 0x5100) { // a15100 if ((PicoIn.opt & POPT_EN_32X) && (a & 0xffc0) == 0x5100) // a15100
{
u16 *r = Pico32x.regs; u16 *r = Pico32x.regs;
elprintf(EL_UIO, "m68k 32x w16 [%06x] %04x @%06x", a, d & 0xffff, SekPc); elprintf(EL_UIO, "m68k 32x w16 [%06x] %04x @%06x", a, d & 0xffff, SekPc);

View file

@ -576,9 +576,9 @@ int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize,int is_sms)
if (!is_sms) if (!is_sms)
{ {
// maybe we are loading MegaCD BIOS? // maybe we are loading MegaCD BIOS?
if (!(PicoAHW & PAHW_MCD) && size == 0x20000 && (!strncmp((char *)rom+0x124, "BOOT", 4) || if (!(PicoIn.AHW & PAHW_MCD) && size == 0x20000 && (!strncmp((char *)rom+0x124, "BOOT", 4) ||
!strncmp((char *)rom+0x128, "BOOT", 4))) { !strncmp((char *)rom+0x128, "BOOT", 4))) {
PicoAHW |= PAHW_MCD; PicoIn.AHW |= PAHW_MCD;
} }
// Check for SMD: // Check for SMD:
@ -628,7 +628,7 @@ int PicoCartInsert(unsigned char *rom, unsigned int romsize, const char *carthw_
} }
pdb_cleanup(); pdb_cleanup();
PicoAHW &= PAHW_MCD|PAHW_SMS; PicoIn.AHW &= PAHW_MCD|PAHW_SMS;
PicoCartMemSetup = NULL; PicoCartMemSetup = NULL;
PicoDmaHook = NULL; PicoDmaHook = NULL;
@ -637,13 +637,13 @@ int PicoCartInsert(unsigned char *rom, unsigned int romsize, const char *carthw_
PicoLoadStateHook = NULL; PicoLoadStateHook = NULL;
carthw_chunks = NULL; carthw_chunks = NULL;
if (!(PicoAHW & (PAHW_MCD|PAHW_SMS))) if (!(PicoIn.AHW & (PAHW_MCD|PAHW_SMS)))
PicoCartDetect(carthw_cfg); PicoCartDetect(carthw_cfg);
// setup correct memory map for loaded ROM // setup correct memory map for loaded ROM
switch (PicoAHW) { switch (PicoIn.AHW) {
default: default:
elprintf(EL_STATUS|EL_ANOMALY, "starting in unknown hw configuration: %x", PicoAHW); elprintf(EL_STATUS|EL_ANOMALY, "starting in unknown hw configuration: %x", PicoIn.AHW);
case 0: case 0:
case PAHW_SVP: PicoMemSetup(); break; case PAHW_SVP: PicoMemSetup(); break;
case PAHW_MCD: PicoMemSetupCD(); break; case PAHW_MCD: PicoMemSetupCD(); break;
@ -654,7 +654,7 @@ int PicoCartInsert(unsigned char *rom, unsigned int romsize, const char *carthw_
if (PicoCartMemSetup != NULL) if (PicoCartMemSetup != NULL)
PicoCartMemSetup(); PicoCartMemSetup();
if (PicoAHW & PAHW_SMS) if (PicoIn.AHW & PAHW_SMS)
PicoPowerMS(); PicoPowerMS();
else else
PicoPower(); PicoPower();
@ -681,7 +681,7 @@ void PicoCartUnload(void)
PicoCartUnloadHook = NULL; PicoCartUnloadHook = NULL;
} }
if (PicoAHW & PAHW_32X) if (PicoIn.AHW & PAHW_32X)
PicoUnload32x(); PicoUnload32x();
if (Pico.rom != NULL) { if (Pico.rom != NULL) {
@ -965,7 +965,7 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram)
else if (strcmp(p, "filled_sram") == 0) else if (strcmp(p, "filled_sram") == 0)
*fill_sram = 1; *fill_sram = 1;
else if (strcmp(p, "force_6btn") == 0) else if (strcmp(p, "force_6btn") == 0)
PicoQuirks |= PQUIRK_FORCE_6BTN; PicoIn.quirks |= PQUIRK_FORCE_6BTN;
else { else {
elprintf(EL_STATUS, "carthw:%d: unsupported prop: %s", line, p); elprintf(EL_STATUS, "carthw:%d: unsupported prop: %s", line, p);
goto bad_nomsg; goto bad_nomsg;

View file

@ -30,8 +30,9 @@
#include <cpu/drc/cmn.h> #include <cpu/drc/cmn.h>
#include "compiler.h" #include "compiler.h"
#define SVP_CYCLES_LINE 850
svp_t *svp = NULL; svp_t *svp = NULL;
int PicoSVPCycles = 850; // cycles/line, just a guess
static int svp_dyn_ready = 0; static int svp_dyn_ready = 0;
/* save state stuff */ /* save state stuff */
@ -57,7 +58,7 @@ static void PicoSVPReset(void)
memcpy(svp->iram_rom + 0x800, Pico.rom + 0x800, 0x20000 - 0x800); memcpy(svp->iram_rom + 0x800, Pico.rom + 0x800, 0x20000 - 0x800);
ssp1601_reset(&svp->ssp1601); ssp1601_reset(&svp->ssp1601);
#ifdef _SVP_DRC #ifdef _SVP_DRC
if ((PicoOpt & POPT_EN_DRC) && svp_dyn_ready) if ((PicoIn.opt & POPT_EN_DRC) && svp_dyn_ready)
ssp1601_dyn_reset(&svp->ssp1601); ssp1601_dyn_reset(&svp->ssp1601);
#endif #endif
} }
@ -77,17 +78,17 @@ static void PicoSVPLine(void)
#endif #endif
#ifdef _SVP_DRC #ifdef _SVP_DRC
if ((PicoOpt & POPT_EN_DRC) && svp_dyn_ready) if ((PicoIn.opt & POPT_EN_DRC) && svp_dyn_ready)
ssp1601_dyn_run(PicoSVPCycles * count); ssp1601_dyn_run(SVP_CYCLES_LINE * count);
else else
#endif #endif
{ {
ssp1601_run(PicoSVPCycles * count); ssp1601_run(SVP_CYCLES_LINE * count);
svp_dyn_ready = 0; // just in case svp_dyn_ready = 0; // just in case
} }
// test mode // test mode
//if (Pico.m.frame_count == 13) PicoPad[0] |= 0xff; //if (Pico.m.frame_count == 13) PicoIn.pad[0] |= 0xff;
} }
@ -148,7 +149,7 @@ void PicoSVPStartup(void)
// init SVP compiler // init SVP compiler
svp_dyn_ready = 0; svp_dyn_ready = 0;
#ifdef _SVP_DRC #ifdef _SVP_DRC
if (PicoOpt & POPT_EN_DRC) { if (PicoIn.opt & POPT_EN_DRC) {
if (ssp1601_dyn_startup()) if (ssp1601_dyn_startup())
return; return;
svp_dyn_ready = 1; svp_dyn_ready = 1;
@ -167,6 +168,6 @@ void PicoSVPStartup(void)
svp_states[1].ptr = svp->dram; svp_states[1].ptr = svp->dram;
svp_states[2].ptr = &svp->ssp1601; svp_states[2].ptr = &svp->ssp1601;
carthw_chunks = svp_states; carthw_chunks = svp_states;
PicoAHW |= PAHW_SVP; PicoIn.AHW |= PAHW_SVP;
} }

View file

@ -434,7 +434,7 @@ void gfx_update(unsigned int cycles)
pcd_event_schedule(cycles, PCD_EVENT_GFX, 5 * w * lines); pcd_event_schedule(cycles, PCD_EVENT_GFX, 5 * w * lines);
} }
if (PicoOpt & POPT_EN_MCD_GFX) if (PicoIn.opt & POPT_EN_MCD_GFX)
{ {
/* render lines */ /* render lines */
while (lines--) while (lines--)

View file

@ -79,7 +79,7 @@ PICO_INTERNAL int PicoResetMCD(void)
// reset button doesn't affect MCD hardware // reset button doesn't affect MCD hardware
// use Pico.sv.data for RAM cart // use Pico.sv.data for RAM cart
if (PicoOpt & POPT_EN_MCD_RAMCART) { if (PicoIn.opt & POPT_EN_MCD_RAMCART) {
if (Pico.sv.data == NULL) if (Pico.sv.data == NULL)
Pico.sv.data = calloc(1, 0x12000); Pico.sv.data = calloc(1, 0x12000);
} }

View file

@ -1099,7 +1099,7 @@ PICO_INTERNAL void PicoMemSetupCD(void)
// main68k map (BIOS mapped by PicoMemSetup()): // main68k map (BIOS mapped by PicoMemSetup()):
// RAM cart // RAM cart
if (PicoOpt & POPT_EN_MCD_RAMCART) { if (PicoIn.opt & POPT_EN_MCD_RAMCART) {
cpu68k_map_set(m68k_read8_map, 0x400000, 0x7fffff, PicoReadM68k8_ramc, 1); cpu68k_map_set(m68k_read8_map, 0x400000, 0x7fffff, PicoReadM68k8_ramc, 1);
cpu68k_map_set(m68k_read16_map, 0x400000, 0x7fffff, PicoReadM68k16_ramc, 1); cpu68k_map_set(m68k_read16_map, 0x400000, 0x7fffff, PicoReadM68k16_ramc, 1);
cpu68k_map_set(m68k_write8_map, 0x400000, 0x7fffff, PicoWriteM68k8_ramc, 1); cpu68k_map_set(m68k_write8_map, 0x400000, 0x7fffff, PicoWriteM68k8_ramc, 1);

View file

@ -127,7 +127,7 @@ void pcd_pcm_update(int *buf32, int length, int stereo)
pcd_pcm_sync(SekCyclesDoneS68k()); pcd_pcm_sync(SekCyclesDoneS68k());
if (!Pico_mcd->pcm_mixbuf_dirty || !(PicoOpt & POPT_EN_MCD_PCM)) if (!Pico_mcd->pcm_mixbuf_dirty || !(PicoIn.opt & POPT_EN_MCD_PCM))
goto out; goto out;
step = (Pico_mcd->pcm_mixpos << 16) / length; step = (Pico_mcd->pcm_mixpos << 16) / length;

View file

@ -201,7 +201,7 @@ void PDebugShowPalette(unsigned short *screen, int stride)
int x, y; int x, y;
Pico.m.dirtyPal = 1; Pico.m.dirtyPal = 1;
if (PicoAHW & PAHW_SMS) if (PicoIn.AHW & PAHW_SMS)
PicoDoHighPal555M4(); PicoDoHighPal555M4();
else else
PicoDoHighPal555(1, 0, est); PicoDoHighPal555(1, 0, est);
@ -328,7 +328,7 @@ void PDebugDumpMem(void)
dump_ram_noswab(PicoMem.zram, "dumps/zram.bin"); dump_ram_noswab(PicoMem.zram, "dumps/zram.bin");
dump_ram(PicoMem.cram, "dumps/cram.bin"); dump_ram(PicoMem.cram, "dumps/cram.bin");
if (PicoAHW & PAHW_SMS) if (PicoIn.AHW & PAHW_SMS)
{ {
dump_ram_noswab(PicoMem.vramb, "dumps/vram.bin"); dump_ram_noswab(PicoMem.vramb, "dumps/vram.bin");
} }
@ -339,7 +339,7 @@ void PDebugDumpMem(void)
dump_ram(PicoMem.vsram,"dumps/vsram.bin"); dump_ram(PicoMem.vsram,"dumps/vsram.bin");
} }
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
{ {
dump_ram(Pico_mcd->prg_ram, "dumps/prg_ram.bin"); dump_ram(Pico_mcd->prg_ram, "dumps/prg_ram.bin");
if (Pico_mcd->s68k_regs[3]&4) // 1M mode? if (Pico_mcd->s68k_regs[3]&4) // 1M mode?
@ -355,7 +355,7 @@ void PDebugDumpMem(void)
} }
#ifndef NO_32X #ifndef NO_32X
if (PicoAHW & PAHW_32X) if (PicoIn.AHW & PAHW_32X)
{ {
dump_ram(Pico32xMem->sdram, "dumps/sdram.bin"); dump_ram(Pico32xMem->sdram, "dumps/sdram.bin");
dump_ram(Pico32xMem->dram[0], "dumps/dram0.bin"); dump_ram(Pico32xMem->dram[0], "dumps/dram0.bin");
@ -371,7 +371,7 @@ void PDebugZ80Frame(void)
{ {
int lines, line_sample; int lines, line_sample;
if (PicoAHW & PAHW_SMS) if (PicoIn.AHW & PAHW_SMS)
return; return;
if (Pico.m.pal) { if (Pico.m.pal) {
@ -385,12 +385,12 @@ void PDebugZ80Frame(void)
z80_resetCycles(); z80_resetCycles();
PsndStartFrame(); PsndStartFrame();
if (/*Pico.m.z80Run &&*/ !Pico.m.z80_reset && (PicoOpt&POPT_EN_Z80)) if (/*Pico.m.z80Run &&*/ !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80))
PicoSyncZ80(Pico.t.m68c_cnt + line_sample * 488); PicoSyncZ80(Pico.t.m68c_cnt + line_sample * 488);
if (PsndOut) if (PsndOut)
PsndGetSamples(line_sample); PsndGetSamples(line_sample);
if (/*Pico.m.z80Run &&*/ !Pico.m.z80_reset && (PicoOpt&POPT_EN_Z80)) { if (/*Pico.m.z80Run &&*/ !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80)) {
PicoSyncZ80(Pico.t.m68c_cnt + 224 * 488); PicoSyncZ80(Pico.t.m68c_cnt + 224 * 488);
z80_int(); z80_int();
} }
@ -398,7 +398,7 @@ void PDebugZ80Frame(void)
PsndGetSamples(224); PsndGetSamples(224);
// sync z80 // sync z80
if (/*Pico.m.z80Run &&*/ !Pico.m.z80_reset && (PicoOpt&POPT_EN_Z80)) { if (/*Pico.m.z80Run &&*/ !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80)) {
Pico.t.m68c_cnt += Pico.m.pal ? 151809 : 127671; // cycles adjusted for converter Pico.t.m68c_cnt += Pico.m.pal ? 151809 : 127671; // cycles adjusted for converter
PicoSyncZ80(Pico.t.m68c_cnt); PicoSyncZ80(Pico.t.m68c_cnt);
} }
@ -412,7 +412,7 @@ void PDebugZ80Frame(void)
void PDebugCPUStep(void) void PDebugCPUStep(void)
{ {
if (PicoAHW & PAHW_SMS) if (PicoIn.AHW & PAHW_SMS)
z80_run_nr(1); z80_run_nr(1);
else else
SekStepM68k(); SekStepM68k();

View file

@ -1027,7 +1027,7 @@ static NOINLINE void PrepareSprites(int full)
if (!(Pico.video.reg[12]&1)) if (!(Pico.video.reg[12]&1))
max_sprites = 64, max_line_sprites = 16, max_width = 264; max_sprites = 64, max_line_sprites = 16, max_width = 264;
if (PicoOpt & POPT_DIS_SPRITE_LIM) if (PicoIn.opt & POPT_DIS_SPRITE_LIM)
max_line_sprites = MAX_LINE_SPRITES; max_line_sprites = MAX_LINE_SPRITES;
if (pvid->reg[1]&8) max_lines = 240; if (pvid->reg[1]&8) max_lines = 240;
@ -1267,7 +1267,7 @@ void FinalizeLine555(int sh, int line, struct PicoEState *est)
if (Pico.video.reg[12]&1) { if (Pico.video.reg[12]&1) {
len = 320; len = 320;
} else { } else {
if (!(PicoOpt&POPT_DIS_32C_BORDER)) pd+=32; if (!(PicoIn.opt&POPT_DIS_32C_BORDER)) pd+=32;
len = 256; len = 256;
} }
@ -1314,7 +1314,7 @@ static void FinalizeLine8bit(int sh, int line, struct PicoEState *est)
if (Pico.video.reg[12]&1) { if (Pico.video.reg[12]&1) {
len = 320; len = 320;
} else { } else {
if (!(PicoOpt & POPT_DIS_32C_BORDER)) if (!(PicoIn.opt & POPT_DIS_32C_BORDER))
pd += 32; pd += 32;
len = 256; len = 256;
} }
@ -1427,7 +1427,7 @@ static int DrawDisplay(int sh)
else if (est->rendstatus & PDRAW_INTERLACE) else if (est->rendstatus & PDRAW_INTERLACE)
DrawAllSpritesInterlace(1, sh); DrawAllSpritesInterlace(1, sh);
// have sprites without layer pri bit ontop of sprites with that bit // have sprites without layer pri bit ontop of sprites with that bit
else if ((sprited[1] & 0xd0) == 0xd0 && (PicoOpt & POPT_ACC_SPRITES)) else if ((sprited[1] & 0xd0) == 0xd0 && (PicoIn.opt & POPT_ACC_SPRITES))
DrawSpritesHiAS(sprited, sh); DrawSpritesHiAS(sprited, sh);
else if (sh && (sprited[1] & SPRL_MAY_HAVE_OP)) else if (sh && (sprited[1] & SPRL_MAY_HAVE_OP))
DrawSpritesSHi(sprited, est); DrawSpritesSHi(sprited, est);
@ -1481,7 +1481,7 @@ PICO_INTERNAL void PicoFrameStart(void)
Pico.est.DrawScanline = 0; Pico.est.DrawScanline = 0;
skip_next_line = 0; skip_next_line = 0;
if (PicoOpt & POPT_ALT_RENDERER) if (PicoIn.opt & POPT_ALT_RENDERER)
return; return;
if (Pico.m.dirtyPal) if (Pico.m.dirtyPal)
@ -1577,7 +1577,7 @@ void PicoDrawUpdateHighPal(void)
{ {
struct PicoEState *est = &Pico.est; struct PicoEState *est = &Pico.est;
int sh = (Pico.video.reg[0xC] & 8) >> 3; // shadow/hilight? int sh = (Pico.video.reg[0xC] & 8) >> 3; // shadow/hilight?
if (PicoOpt & POPT_ALT_RENDERER) if (PicoIn.opt & POPT_ALT_RENDERER)
sh = 0; // no s/h support sh = 0; // no s/h support
PicoDoHighPal555(sh, 0, &Pico.est); PicoDoHighPal555(sh, 0, &Pico.est);
@ -1597,7 +1597,7 @@ void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode)
break; break;
case PDF_RGB555: case PDF_RGB555:
if ((PicoAHW & PAHW_32X) && use_32x_line_mode) if ((PicoIn.AHW & PAHW_32X) && use_32x_line_mode)
FinalizeLine = FinalizeLine32xRGB555; FinalizeLine = FinalizeLine32xRGB555;
else else
FinalizeLine = FinalizeLine555; FinalizeLine = FinalizeLine555;
@ -1640,7 +1640,7 @@ void PicoDrawSetCallbacks(int (*begin)(unsigned int num), int (*end)(unsigned in
PicoScan32xBegin = NULL; PicoScan32xBegin = NULL;
PicoScan32xEnd = NULL; PicoScan32xEnd = NULL;
if ((PicoAHW & PAHW_32X) && FinalizeLine != FinalizeLine32xRGB555) { if ((PicoIn.AHW & PAHW_32X) && FinalizeLine != FinalizeLine32xRGB555) {
PicoScan32xBegin = begin; PicoScan32xBegin = begin;
PicoScan32xEnd = end; PicoScan32xEnd = end;
} }

View file

@ -209,11 +209,11 @@ enum media_type_e PicoLoadMedia(const char *filename,
if (media_type == PM_BAD_DETECT) if (media_type == PM_BAD_DETECT)
goto out; goto out;
if ((PicoAHW & PAHW_MCD) && Pico_mcd != NULL) if ((PicoIn.AHW & PAHW_MCD) && Pico_mcd != NULL)
cdd_unload(); cdd_unload();
PicoCartUnload(); PicoCartUnload();
PicoAHW = 0; PicoIn.AHW = 0;
PicoQuirks = 0; PicoIn.quirks = 0;
if (media_type == PM_CD) if (media_type == PM_CD)
{ {
@ -230,7 +230,7 @@ enum media_type_e PicoLoadMedia(const char *filename,
goto out; goto out;
} }
PicoAHW |= PAHW_MCD; PicoIn.AHW |= PAHW_MCD;
} }
else { else {
media_type = PM_BAD_CD; media_type = PM_BAD_CD;
@ -239,7 +239,7 @@ enum media_type_e PicoLoadMedia(const char *filename,
} }
else if (media_type == PM_MARK3) { else if (media_type == PM_MARK3) {
lprintf("detected SMS ROM\n"); lprintf("detected SMS ROM\n");
PicoAHW = PAHW_SMS; PicoIn.AHW = PAHW_SMS;
} }
rom = pm_open(rom_fname); rom = pm_open(rom_fname);
@ -249,7 +249,7 @@ enum media_type_e PicoLoadMedia(const char *filename,
goto out; goto out;
} }
ret = PicoCartLoad(rom, &rom_data, &rom_size, (PicoAHW & PAHW_SMS) ? 1 : 0); ret = PicoCartLoad(rom, &rom_data, &rom_size, (PicoIn.AHW & PAHW_SMS) ? 1 : 0);
pm_close(rom); pm_close(rom);
if (ret != 0) { if (ret != 0) {
if (ret == 2) lprintf("Out of memory\n"); if (ret == 2) lprintf("Out of memory\n");
@ -266,7 +266,7 @@ enum media_type_e PicoLoadMedia(const char *filename,
goto out; goto out;
} }
if (!(PicoAHW & PAHW_SMS)) { if (!(PicoIn.AHW & PAHW_SMS)) {
unsigned short *d = (unsigned short *)(rom_data + 4); unsigned short *d = (unsigned short *)(rom_data + 4);
if ((((d[0] << 16) | d[1]) & 0xffffff) >= (int)rom_size) { if ((((d[0] << 16) | d[1]) & 0xffffff) >= (int)rom_size) {
lprintf("bad reset vector\n"); lprintf("bad reset vector\n");
@ -276,7 +276,7 @@ enum media_type_e PicoLoadMedia(const char *filename,
} }
// load config for this ROM (do this before insert to get correct region) // load config for this ROM (do this before insert to get correct region)
if (!(PicoAHW & PAHW_MCD)) { if (!(PicoIn.AHW & PAHW_MCD)) {
memcpy(media_id_header, rom_data + 0x100, sizeof(media_id_header)); memcpy(media_id_header, rom_data + 0x100, sizeof(media_id_header));
if (do_region_override != NULL) if (do_region_override != NULL)
do_region_override(filename); do_region_override(filename);
@ -300,7 +300,7 @@ enum media_type_e PicoLoadMedia(const char *filename,
Pico.m.ncart_in = 1; Pico.m.ncart_in = 1;
} }
if (PicoQuirks & PQUIRK_FORCE_6BTN) if (PicoIn.quirks & PQUIRK_FORCE_6BTN)
PicoSetInputDevice(0, PICO_INPUT_PAD_6BTN); PicoSetInputDevice(0, PICO_INPUT_PAD_6BTN);
out: out:

View file

@ -210,7 +210,7 @@ void cyclone_crashed(u32 pc, struct Cyclone *context)
static u32 read_pad_3btn(int i, u32 out_bits) static u32 read_pad_3btn(int i, u32 out_bits)
{ {
u32 pad = ~PicoPadInt[i]; // Get inverse of pad MXYZ SACB RLDU u32 pad = ~PicoIn.padInt[i]; // Get inverse of pad MXYZ SACB RLDU
u32 value; u32 value;
if (out_bits & 0x40) // TH if (out_bits & 0x40) // TH
@ -224,7 +224,7 @@ static u32 read_pad_3btn(int i, u32 out_bits)
static u32 read_pad_6btn(int i, u32 out_bits) static u32 read_pad_6btn(int i, u32 out_bits)
{ {
u32 pad = ~PicoPadInt[i]; // Get inverse of pad MXYZ SACB RLDU u32 pad = ~PicoIn.padInt[i]; // Get inverse of pad MXYZ SACB RLDU
int phase = Pico.m.padTHPhase[i]; int phase = Pico.m.padTHPhase[i];
u32 value; u32 value;
@ -349,7 +349,7 @@ void NOINLINE ctl_write_z80busreq(u32 d)
} }
else else
{ {
if ((PicoOpt&POPT_EN_Z80) && !Pico.m.z80_reset) { if ((PicoIn.opt & POPT_EN_Z80) && !Pico.m.z80_reset) {
pprof_start(m68k); pprof_start(m68k);
PicoSyncZ80(SekCyclesDone()); PicoSyncZ80(SekCyclesDone());
pprof_end_sub(m68k); pprof_end_sub(m68k);
@ -367,7 +367,7 @@ void NOINLINE ctl_write_z80reset(u32 d)
{ {
if (d) if (d)
{ {
if ((PicoOpt&POPT_EN_Z80) && Pico.m.z80Run) { if ((PicoIn.opt & POPT_EN_Z80) && Pico.m.z80Run) {
pprof_start(m68k); pprof_start(m68k);
PicoSyncZ80(SekCyclesDone()); PicoSyncZ80(SekCyclesDone());
pprof_end_sub(m68k); pprof_end_sub(m68k);
@ -542,8 +542,8 @@ static void PicoWrite8_z80(u32 a, u32 d)
return; return;
} }
if ((a & 0x6000) == 0x4000) { // FM Sound if ((a & 0x6000) == 0x4000) { // FM Sound
if (PicoOpt & POPT_EN_FM) if (PicoIn.opt & POPT_EN_FM)
emustatus |= ym2612_write_local(a&3, d&0xff, 0)&1; Pico.m.status |= ym2612_write_local(a & 3, d & 0xff, 0) & 1;
return; return;
} }
// TODO: probably other VDP access too? Maybe more mirrors? // TODO: probably other VDP access too? Maybe more mirrors?
@ -597,12 +597,8 @@ u32 PicoRead8_io(u32 a)
goto end; goto end;
} }
if (PicoOpt & POPT_EN_32X) { d = PicoRead8_32x(a);
d = PicoRead8_32x(a);
goto end;
}
d = m68k_unmapped_read8(a);
end: end:
return d; return d;
} }
@ -632,12 +628,8 @@ u32 PicoRead16_io(u32 a)
goto end; goto end;
} }
if (PicoOpt & POPT_EN_32X) { d = PicoRead16_32x(a);
d = PicoRead16_32x(a);
goto end;
}
d = m68k_unmapped_read16(a);
end: end:
return d; return d;
} }
@ -662,12 +654,7 @@ void PicoWrite8_io(u32 a, u32 d)
Pico.m.sram_reg |= (u8)(d & 3); Pico.m.sram_reg |= (u8)(d & 3);
return; return;
} }
if (PicoOpt & POPT_EN_32X) { PicoWrite8_32x(a, d);
PicoWrite8_32x(a, d);
return;
}
m68k_unmapped_write8(a, d);
} }
void PicoWrite16_io(u32 a, u32 d) void PicoWrite16_io(u32 a, u32 d)
@ -690,11 +677,7 @@ void PicoWrite16_io(u32 a, u32 d)
Pico.m.sram_reg |= (u8)(d & 3); Pico.m.sram_reg |= (u8)(d & 3);
return; return;
} }
if (PicoOpt & POPT_EN_32X) { PicoWrite16_32x(a, d);
PicoWrite16_32x(a, d);
return;
}
m68k_unmapped_write16(a, d);
} }
#endif // _ASM_MEMORY_C #endif // _ASM_MEMORY_C
@ -971,7 +954,7 @@ static int ym2612_write_local(u32 a, u32 d, int is_from_z80)
ym2612.OPN.ST.address = d; ym2612.OPN.ST.address = d;
ym2612.addr_A1 = 0; ym2612.addr_A1 = 0;
#ifdef __GP2X__ #ifdef __GP2X__
if (PicoOpt & POPT_EXT_FM) YM2612Write_940(a, d, -1); if (PicoIn.opt & POPT_EXT_FM) YM2612Write_940(a, d, -1);
#endif #endif
return 0; return 0;
@ -1036,7 +1019,7 @@ static int ym2612_write_local(u32 a, u32 d, int is_from_z80)
if ((d ^ old_mode) & 0xc0) { if ((d ^ old_mode) & 0xc0) {
#ifdef __GP2X__ #ifdef __GP2X__
if (PicoOpt & POPT_EXT_FM) return YM2612Write_940(a, d, get_scanline(is_from_z80)); if (PicoIn.opt & POPT_EXT_FM) return YM2612Write_940(a, d, get_scanline(is_from_z80));
#endif #endif
return 1; return 1;
} }
@ -1049,7 +1032,7 @@ static int ym2612_write_local(u32 a, u32 d, int is_from_z80)
PsndDacLine = scanline; PsndDacLine = scanline;
} }
#ifdef __GP2X__ #ifdef __GP2X__
if (PicoOpt & POPT_EXT_FM) YM2612Write_940(a, d, scanline); if (PicoIn.opt & POPT_EXT_FM) YM2612Write_940(a, d, scanline);
#endif #endif
return 0; return 0;
} }
@ -1060,7 +1043,7 @@ static int ym2612_write_local(u32 a, u32 d, int is_from_z80)
ym2612.OPN.ST.address = d; ym2612.OPN.ST.address = d;
ym2612.addr_A1 = 1; ym2612.addr_A1 = 1;
#ifdef __GP2X__ #ifdef __GP2X__
if (PicoOpt & POPT_EXT_FM) YM2612Write_940(a, d, -1); if (PicoIn.opt & POPT_EXT_FM) YM2612Write_940(a, d, -1);
#endif #endif
return 0; return 0;
@ -1074,7 +1057,7 @@ static int ym2612_write_local(u32 a, u32 d, int is_from_z80)
} }
#ifdef __GP2X__ #ifdef __GP2X__
if (PicoOpt & POPT_EXT_FM) if (PicoIn.opt & POPT_EXT_FM)
return YM2612Write_940(a, d, get_scanline(is_from_z80)); return YM2612Write_940(a, d, get_scanline(is_from_z80));
#endif #endif
return YM2612Write_(a, d); return YM2612Write_(a, d);
@ -1123,7 +1106,7 @@ void ym2612_pack_state(void)
elprintf(EL_YMTIMER, "save: timer b %i/%i", tbt >> 16, tbc); elprintf(EL_YMTIMER, "save: timer b %i/%i", tbt >> 16, tbc);
#ifdef __GP2X__ #ifdef __GP2X__
if (PicoOpt & POPT_EXT_FM) if (PicoIn.opt & POPT_EXT_FM)
YM2612PicoStateSave2_940(tat, tbt); YM2612PicoStateSave2_940(tat, tbt);
else else
#endif #endif
@ -1158,7 +1141,7 @@ void ym2612_unpack_state(void)
} }
#ifdef __GP2X__ #ifdef __GP2X__
if (PicoOpt & POPT_EXT_FM) if (PicoIn.opt & POPT_EXT_FM)
ret = YM2612PicoStateLoad2_940(&tat, &tbt); ret = YM2612PicoStateLoad2_940(&tat, &tbt);
else else
#endif #endif
@ -1233,8 +1216,8 @@ static unsigned char z80_md_bank_read(unsigned short a)
static void z80_md_ym2612_write(unsigned int a, unsigned char data) static void z80_md_ym2612_write(unsigned int a, unsigned char data)
{ {
if (PicoOpt & POPT_EN_FM) if (PicoIn.opt & POPT_EN_FM)
emustatus |= ym2612_write_local(a, data, 1) & 1; Pico.m.status |= ym2612_write_local(a, data, 1) & 1;
} }
static void z80_md_vdp_br_write(unsigned int a, unsigned char data) static void z80_md_vdp_br_write(unsigned int a, unsigned char data)

View file

@ -70,7 +70,7 @@ PicoRead8_io: @ u32 a
m_read8_not_io: m_read8_not_io:
and r2, r0, #0xfc00 and r2, r0, #0xfc00
cmp r2, #0x1000 cmp r2, #0x1000
bne m_read8_not_brq bne PicoRead8_32x
ldr r3, =Pico ldr r3, =Pico
mov r1, r0 mov r1, r0
@ -92,14 +92,6 @@ m_read8_not_io:
orr r0, r0, r2 orr r0, r0, r2
bx lr bx lr
m_read8_not_brq:
ldr r2, =PicoOpt
ldr r2, [r2]
tst r2, #POPT_EN_32X
bne PicoRead8_32x
mov r0, #0
bx lr
@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
PicoRead16_sram: @ u32 a, u32 d PicoRead16_sram: @ u32 a, u32 d
@ -146,7 +138,7 @@ PicoRead16_io: @ u32 a, u32 d
m_read16_not_io: m_read16_not_io:
and r2, r0, #0xfc00 and r2, r0, #0xfc00
cmp r2, #0x1000 cmp r2, #0x1000
bne m_read16_not_brq bne PicoRead16_32x
ldr r3, =Pico ldr r3, =Pico
and r2, r0, #0xff00 and r2, r0, #0xff00
@ -165,14 +157,6 @@ m_read16_not_io:
orr r0, r0, r2, lsl #8 orr r0, r0, r2, lsl #8
bx lr bx lr
m_read16_not_brq:
ldr r2, =PicoOpt
ldr r2, [r2]
tst r2, #POPT_EN_32X
bne PicoRead16_32x
mov r0, #0
bx lr
@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
PicoWrite8_io: @ u32 a, u32 d PicoWrite8_io: @ u32 a, u32 d
@ -197,7 +181,7 @@ m_write8_not_z80ctl:
eor r2, r0, #0xa10000 eor r2, r0, #0xa10000
eor r2, r2, #0x003000 eor r2, r2, #0x003000
eors r2, r2, #0x0000f1 eors r2, r2, #0x0000f1
bne m_write8_not_sreg bne PicoWrite8_32x
ldr r3, =Pico ldr r3, =Pico
ldrb r2, [r3, #OFS_Pico_m_sram_reg] ldrb r2, [r3, #OFS_Pico_m_sram_reg]
and r1, r1, #(SRR_MAPPED|SRR_READONLY) and r1, r1, #(SRR_MAPPED|SRR_READONLY)
@ -206,13 +190,6 @@ m_write8_not_z80ctl:
strb r2, [r3, #OFS_Pico_m_sram_reg] strb r2, [r3, #OFS_Pico_m_sram_reg]
bx lr bx lr
m_write8_not_sreg:
ldr r2, =PicoOpt
ldr r2, [r2]
tst r2, #POPT_EN_32X
bne PicoWrite8_32x
bx lr
@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
PicoWrite16_io: @ u32 a, u32 d PicoWrite16_io: @ u32 a, u32 d
@ -234,7 +211,7 @@ m_write16_not_z80ctl:
eor r2, r0, #0xa10000 eor r2, r0, #0xa10000
eor r2, r2, #0x003000 eor r2, r2, #0x003000
eors r2, r2, #0x0000f0 eors r2, r2, #0x0000f0
bne m_write16_not_sreg bne PicoWrite16_32x
ldr r3, =Pico ldr r3, =Pico
ldrb r2, [r3, #OFS_Pico_m_sram_reg] ldrb r2, [r3, #OFS_Pico_m_sram_reg]
and r1, r1, #(SRR_MAPPED|SRR_READONLY) and r1, r1, #(SRR_MAPPED|SRR_READONLY)
@ -243,13 +220,6 @@ m_write16_not_z80ctl:
strb r2, [r3, #OFS_Pico_m_sram_reg] strb r2, [r3, #OFS_Pico_m_sram_reg]
bx lr bx lr
m_write16_not_sreg:
ldr r2, =PicoOpt
ldr r2, [r2]
tst r2, #POPT_EN_32X
bne PicoWrite16_32x
bx lr
.pool .pool
@ vim:filetype=armasm @ vim:filetype=armasm

View file

@ -284,7 +284,7 @@ static void FinalizeLine8bitM4(int line)
{ {
unsigned char *pd = Pico.est.DrawLineDest; unsigned char *pd = Pico.est.DrawLineDest;
if (!(PicoOpt & POPT_DIS_32C_BORDER)) if (!(PicoIn.opt & POPT_DIS_32C_BORDER))
pd += 32; pd += 32;
memcpy(pd, Pico.est.HighCol + 8, 256); memcpy(pd, Pico.est.HighCol + 8, 256);

View file

@ -290,7 +290,7 @@ void decode(const char* code, struct patch* result)
/* Initialize the result */ /* Initialize the result */
result->addr = result->data = result->comp = 0; result->addr = result->data = result->comp = 0;
if(!(PicoAHW & PAHW_SMS)) if(!(PicoIn.AHW & PAHW_SMS))
{ {
//If Genesis //If Genesis
@ -445,7 +445,7 @@ void PicoPatchPrepare(void)
PicoPatches[i].data_old = *(unsigned short *)(Pico.rom + addr); PicoPatches[i].data_old = *(unsigned short *)(Pico.rom + addr);
else else
{ {
if(!(PicoAHW & PAHW_SMS)) if(!(PicoIn.AHW & PAHW_SMS))
PicoPatches[i].data_old = (unsigned short) m68k_read16(addr); PicoPatches[i].data_old = (unsigned short) m68k_read16(addr);
else else
;// wrong: PicoPatches[i].data_old = (unsigned char) PicoRead8_z80(addr); ;// wrong: PicoPatches[i].data_old = (unsigned char) PicoRead8_z80(addr);
@ -468,7 +468,7 @@ void PicoPatchApply(void)
{ {
if (PicoPatches[i].active) if (PicoPatches[i].active)
{ {
if (!(PicoAHW & PAHW_SMS)) if (!(PicoIn.AHW & PAHW_SMS))
*(unsigned short *)(Pico.rom + addr) = PicoPatches[i].data; *(unsigned short *)(Pico.rom + addr) = PicoPatches[i].data;
else if (!PicoPatches[i].comp || PicoPatches[i].comp == *(char *)(Pico.rom + addr)) else if (!PicoPatches[i].comp || PicoPatches[i].comp == *(char *)(Pico.rom + addr))
*(char *)(Pico.rom + addr) = (char) PicoPatches[i].data; *(char *)(Pico.rom + addr) = (char) PicoPatches[i].data;
@ -480,7 +480,7 @@ void PicoPatchApply(void)
if (PicoPatches[u].addr == addr) break; if (PicoPatches[u].addr == addr) break;
if (u == i) if (u == i)
{ {
if (!(PicoAHW & PAHW_SMS)) if (!(PicoIn.AHW & PAHW_SMS))
*(unsigned short *)(Pico.rom + addr) = PicoPatches[i].data_old; *(unsigned short *)(Pico.rom + addr) = PicoPatches[i].data_old;
else else
*(char *)(Pico.rom + addr) = (char) PicoPatches[i].data_old; *(char *)(Pico.rom + addr) = (char) PicoPatches[i].data_old;
@ -493,7 +493,7 @@ void PicoPatchApply(void)
{ {
if (PicoPatches[i].active) if (PicoPatches[i].active)
{ {
if (!(PicoAHW & PAHW_SMS)) if (!(PicoIn.AHW & PAHW_SMS))
m68k_write16(addr,PicoPatches[i].data); m68k_write16(addr,PicoPatches[i].data);
else else
;// wrong: PicoWrite8_z80(addr,PicoPatches[i].data); ;// wrong: PicoWrite8_z80(addr,PicoPatches[i].data);
@ -505,7 +505,7 @@ void PicoPatchApply(void)
if (PicoPatches[u].addr == addr) break; if (PicoPatches[u].addr == addr) break;
if (u == i) if (u == i)
{ {
if (!(PicoAHW & PAHW_SMS)) if (!(PicoIn.AHW & PAHW_SMS))
m68k_write16(PicoPatches[i].addr,PicoPatches[i].data_old); m68k_write16(PicoPatches[i].addr,PicoPatches[i].data_old);
else else
;// wrong: PicoWrite8_z80(PicoPatches[i].addr,PicoPatches[i].data_old); ;// wrong: PicoWrite8_z80(PicoPatches[i].addr,PicoPatches[i].data_old);

View file

@ -12,16 +12,7 @@
struct Pico Pico; struct Pico Pico;
struct PicoMem PicoMem; struct PicoMem PicoMem;
int PicoOpt; PicoInterface PicoIn;
int PicoSkipFrame; // skip rendering frame?
int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU
int PicoPadInt[2]; // internal copy
int PicoAHW; // active addon hardware: PAHW_*
int PicoQuirks; // game-specific quirks
int PicoRegionOverride; // override the region detection 0: Auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe
int PicoAutoRgnOrder;
int emustatus; // rapid_ym2612, multi_ym_updates
void (*PicoWriteSound)(int len) = NULL; // called at the best time to send sound buffer (PsndOut) to hardware void (*PicoWriteSound)(int len) = NULL; // called at the best time to send sound buffer (PsndOut) to hardware
void (*PicoResetHook)(void) = NULL; void (*PicoResetHook)(void) = NULL;
@ -33,13 +24,13 @@ void PicoInit(void)
// Blank space for state: // Blank space for state:
memset(&Pico,0,sizeof(Pico)); memset(&Pico,0,sizeof(Pico));
memset(&PicoMem,0,sizeof(PicoMem)); memset(&PicoMem,0,sizeof(PicoMem));
memset(&PicoPad,0,sizeof(PicoPad)); memset(&PicoIn.pad,0,sizeof(PicoIn.pad));
memset(&PicoPadInt,0,sizeof(PicoPadInt)); memset(&PicoIn.padInt,0,sizeof(PicoIn.padInt));
Pico.est.Pico = &Pico; Pico.est.Pico = &Pico;
Pico.est.PicoMem_vram = PicoMem.vram; Pico.est.PicoMem_vram = PicoMem.vram;
Pico.est.PicoMem_cram = PicoMem.cram; Pico.est.PicoMem_cram = PicoMem.cram;
Pico.est.PicoOpt = &PicoOpt; Pico.est.PicoOpt = &PicoIn.opt;
// Init CPUs: // Init CPUs:
SekInit(); SekInit();
@ -56,7 +47,7 @@ void PicoInit(void)
// to be called once on emu exit // to be called once on emu exit
void PicoExit(void) void PicoExit(void)
{ {
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
PicoExitMCD(); PicoExitMCD();
PicoCartUnload(); PicoCartUnload();
z80_exit(); z80_exit();
@ -89,10 +80,10 @@ void PicoPower(void)
Pico.video.reg[0xc] = 0x81; Pico.video.reg[0xc] = 0x81;
Pico.video.reg[0xf] = 0x02; Pico.video.reg[0xf] = 0x02;
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
PicoPowerMCD(); PicoPowerMCD();
if (PicoOpt & POPT_EN_32X) if (PicoIn.opt & POPT_EN_32X)
PicoPower32x(); PicoPower32x();
PicoReset(); PicoReset();
@ -103,9 +94,9 @@ PICO_INTERNAL void PicoDetectRegion(void)
int support=0, hw=0, i; int support=0, hw=0, i;
unsigned char pal=0; unsigned char pal=0;
if (PicoRegionOverride) if (PicoIn.regionOverride)
{ {
support = PicoRegionOverride; support = PicoIn.regionOverride;
} }
else else
{ {
@ -138,10 +129,10 @@ PICO_INTERNAL void PicoDetectRegion(void)
} }
// auto detection order override // auto detection order override
if (PicoAutoRgnOrder) { if (PicoIn.autoRgnOrder) {
if (((PicoAutoRgnOrder>>0)&0xf) & support) support = (PicoAutoRgnOrder>>0)&0xf; if (((PicoIn.autoRgnOrder>>0)&0xf) & support) support = (PicoIn.autoRgnOrder>>0)&0xf;
else if (((PicoAutoRgnOrder>>4)&0xf) & support) support = (PicoAutoRgnOrder>>4)&0xf; else if (((PicoIn.autoRgnOrder>>4)&0xf) & support) support = (PicoIn.autoRgnOrder>>4)&0xf;
else if (((PicoAutoRgnOrder>>8)&0xf) & support) support = (PicoAutoRgnOrder>>8)&0xf; else if (((PicoIn.autoRgnOrder>>8)&0xf) & support) support = (PicoIn.autoRgnOrder>>8)&0xf;
} }
// Try to pick the best hardware value for English/50hz: // Try to pick the best hardware value for English/50hz:
@ -161,17 +152,16 @@ int PicoReset(void)
return 1; return 1;
#if defined(CPU_CMP_R) || defined(CPU_CMP_W) || defined(DRC_CMP) #if defined(CPU_CMP_R) || defined(CPU_CMP_W) || defined(DRC_CMP)
PicoOpt |= POPT_DIS_VDP_FIFO|POPT_DIS_IDLE_DET; PicoIn.opt |= POPT_DIS_VDP_FIFO|POPT_DIS_IDLE_DET;
#endif #endif
/* must call now, so that banking is reset, and correct vectors get fetched */ /* must call now, so that banking is reset, and correct vectors get fetched */
if (PicoResetHook) if (PicoResetHook)
PicoResetHook(); PicoResetHook();
memset(&PicoPadInt,0,sizeof(PicoPadInt)); memset(&PicoIn.padInt, 0, sizeof(PicoIn.padInt));
emustatus = 0;
if (PicoAHW & PAHW_SMS) { if (PicoIn.AHW & PAHW_SMS) {
PicoResetMS(); PicoResetMS();
return 0; return 0;
} }
@ -180,7 +170,7 @@ int PicoReset(void)
// ..but do not reset SekCycle* to not desync with addons // ..but do not reset SekCycle* to not desync with addons
// s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games). // s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games).
SekSetRealTAS(PicoAHW & PAHW_MCD); SekSetRealTAS(PicoIn.AHW & PAHW_MCD);
Pico.m.dirtyPal = 1; Pico.m.dirtyPal = 1;
@ -193,21 +183,21 @@ int PicoReset(void)
PsndReset(); // pal must be known here PsndReset(); // pal must be known here
// create an empty "dma" to cause 68k exec start at random frame location // create an empty "dma" to cause 68k exec start at random frame location
if (Pico.m.dma_xfers == 0 && !(PicoOpt & POPT_DIS_VDP_FIFO)) if (Pico.m.dma_xfers == 0 && !(PicoIn.opt & POPT_DIS_VDP_FIFO))
Pico.m.dma_xfers = rand() & 0x1fff; Pico.m.dma_xfers = rand() & 0x1fff;
SekFinishIdleDet(); SekFinishIdleDet();
if (PicoAHW & PAHW_MCD) { if (PicoIn.AHW & PAHW_MCD) {
PicoResetMCD(); PicoResetMCD();
return 0; return 0;
} }
// reinit, so that checksum checks pass // reinit, so that checksum checks pass
if (!(PicoOpt & POPT_DIS_IDLE_DET)) if (!(PicoIn.opt & POPT_DIS_IDLE_DET))
SekInitIdleDet(); SekInitIdleDet();
if (PicoOpt & POPT_EN_32X) if (PicoIn.opt & POPT_EN_32X)
PicoReset32x(); PicoReset32x();
// reset sram state; enable sram access by default if it doesn't overlap with ROM // reset sram state; enable sram access by default if it doesn't overlap with ROM
@ -225,9 +215,9 @@ int PicoReset(void)
// flush config changes before emu loop starts // flush config changes before emu loop starts
void PicoLoopPrepare(void) void PicoLoopPrepare(void)
{ {
if (PicoRegionOverride) if (PicoIn.regionOverride)
// force setting possibly changed.. // force setting possibly changed..
Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0; Pico.m.pal = (PicoIn.regionOverride == 2 || PicoIn.regionOverride == 8) ? 1 : 0;
Pico.m.dirtyPal = 1; Pico.m.dirtyPal = 1;
rendstatus_old = -1; rendstatus_old = -1;
@ -310,17 +300,17 @@ void PicoFrame(void)
Pico.m.frame_count++; Pico.m.frame_count++;
if (PicoAHW & PAHW_SMS) { if (PicoIn.AHW & PAHW_SMS) {
PicoFrameMS(); PicoFrameMS();
goto end; goto end;
} }
if (PicoAHW & PAHW_32X) { if (PicoIn.AHW & PAHW_32X) {
PicoFrame32x(); // also does MCD+32X PicoFrame32x(); // also does MCD+32X
goto end; goto end;
} }
if (PicoAHW & PAHW_MCD) { if (PicoIn.AHW & PAHW_MCD) {
PicoFrameMCD(); PicoFrameMCD();
goto end; goto end;
} }
@ -336,7 +326,7 @@ end:
void PicoFrameDrawOnly(void) void PicoFrameDrawOnly(void)
{ {
if (!(PicoAHW & PAHW_SMS)) { if (!(PicoIn.AHW & PAHW_SMS)) {
PicoFrameStart(); PicoFrameStart();
PicoDrawSync(223, 0); PicoDrawSync(223, 0);
} else { } else {

View file

@ -72,22 +72,34 @@ extern void *p32x_bios_g, *p32x_bios_m, *p32x_bios_s;
#define POPT_DIS_IDLE_DET (1<<19) #define POPT_DIS_IDLE_DET (1<<19)
#define POPT_EN_32X (1<<20) #define POPT_EN_32X (1<<20)
#define POPT_EN_PWM (1<<21) #define POPT_EN_PWM (1<<21)
extern int PicoOpt; // bitfield
#define PAHW_MCD (1<<0) #define PAHW_MCD (1<<0)
#define PAHW_32X (1<<1) #define PAHW_32X (1<<1)
#define PAHW_SVP (1<<2) #define PAHW_SVP (1<<2)
#define PAHW_PICO (1<<3) #define PAHW_PICO (1<<3)
#define PAHW_SMS (1<<4) #define PAHW_SMS (1<<4)
extern int PicoAHW; // Pico active hw
#define PQUIRK_FORCE_6BTN (1<<0) #define PQUIRK_FORCE_6BTN (1<<0)
extern int PicoQuirks;
extern int PicoSkipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff // the emulator is configured and some status is reported
extern int PicoRegionOverride; // override the region detection 0: auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe // through this global state (not saved in savestates)
extern int PicoAutoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP typedef struct
extern int PicoSVPCycles; {
unsigned int opt; // POPT_* bitfield
unsigned short pad[2]; // Joypads, format is MXYZ SACB RLDU
unsigned short padInt[2]; // internal copy
unsigned short AHW; // active addon hardware: PAHW_* bitfield
unsigned short skipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff
unsigned short regionOverride; // override the region detection 0: auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe
unsigned short autoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP
unsigned short quirks; // game-specific quirks: PQUIRK_*
} PicoInterface;
extern PicoInterface PicoIn;
void PicoInit(void); void PicoInit(void);
void PicoExit(void); void PicoExit(void);
void PicoPower(void); void PicoPower(void);
@ -95,7 +107,6 @@ int PicoReset(void);
void PicoLoopPrepare(void); void PicoLoopPrepare(void);
void PicoFrame(void); void PicoFrame(void);
void PicoFrameDrawOnly(void); void PicoFrameDrawOnly(void);
extern int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU
extern void (*PicoWriteSound)(int bytes); // called once per frame at the best time to send sound buffer (PsndOut) to hardware extern void (*PicoWriteSound)(int bytes); // called once per frame at the best time to send sound buffer (PsndOut) to hardware
extern void (*PicoMessage)(const char *msg); // callback to output text message from emu extern void (*PicoMessage)(const char *msg); // callback to output text message from emu
typedef enum { PI_ROM, PI_ISPAL, PI_IS40_CELL, PI_IS240_LINES } pint_t; typedef enum { PI_ROM, PI_ISPAL, PI_IS40_CELL, PI_IS240_LINES } pint_t;

View file

@ -35,8 +35,8 @@ static u32 PicoRead8_pico(u32 a)
{ {
case 0x01: d = PicoPicohw.r1; break; case 0x01: d = PicoPicohw.r1; break;
case 0x03: case 0x03:
d = PicoPad[0]&0x1f; // d-pad d = PicoIn.pad[0]&0x1f; // d-pad
d |= (PicoPad[0]&0x20) << 2; // pen push -> C d |= (PicoIn.pad[0]&0x20) << 2; // pen push -> C
d = ~d; d = ~d;
break; break;

View file

@ -86,7 +86,7 @@ PICO_INTERNAL void PicoInitPico(void)
PicoLineHook = PicoLinePico; PicoLineHook = PicoLinePico;
PicoResetHook = PicoResetPico; PicoResetHook = PicoResetPico;
PicoAHW = PAHW_PICO; PicoIn.AHW = PAHW_PICO;
memset(&PicoPicohw, 0, sizeof(PicoPicohw)); memset(&PicoPicohw, 0, sizeof(PicoPicohw));
PicoPicohw.pen_pos[0] = 0x03c + 320/2; PicoPicohw.pen_pos[0] = 0x03c + 320/2;
PicoPicohw.pen_pos[1] = 0x200 + 240/2; PicoPicohw.pen_pos[1] = 0x200 + 240/2;

View file

@ -97,7 +97,7 @@ static int PicoFrameHints(void)
pevt_log_m68k_o(EVT_FRAME_START); pevt_log_m68k_o(EVT_FRAME_START);
if ((PicoOpt&POPT_ALT_RENDERER) && !PicoSkipFrame && (pv->reg[1]&0x40)) { // fast rend., display enabled if ((PicoIn.opt&POPT_ALT_RENDERER) && !PicoIn.skipFrame && (pv->reg[1]&0x40)) { // fast rend., display enabled
// draw a frame just after vblank in alternative render mode // draw a frame just after vblank in alternative render mode
// yes, this will cause 1 frame lag, but this is inaccurate mode anyway. // yes, this will cause 1 frame lag, but this is inaccurate mode anyway.
PicoFrameFull(); PicoFrameFull();
@ -106,7 +106,7 @@ static int PicoFrameHints(void)
#endif #endif
skip = 1; skip = 1;
} }
else skip=PicoSkipFrame; else skip=PicoIn.skipFrame;
Pico.t.m68c_frame_start = Pico.t.m68c_aim; Pico.t.m68c_frame_start = Pico.t.m68c_aim;
pv->v_counter = Pico.m.scanline = 0; pv->v_counter = Pico.m.scanline = 0;
@ -140,7 +140,7 @@ static int PicoFrameHints(void)
} }
// decide if we draw this line // decide if we draw this line
if (!skip && (PicoOpt & POPT_ALT_RENDERER)) if (!skip && (PicoIn.opt & POPT_ALT_RENDERER))
{ {
// find the right moment for frame renderer, when display is no longer blanked // find the right moment for frame renderer, when display is no longer blanked
if ((pv->reg[1]&0x40) || y > 100) { if ((pv->reg[1]&0x40) || y > 100) {
@ -157,10 +157,10 @@ static int PicoFrameHints(void)
{ {
cycles = SekCyclesDone(); cycles = SekCyclesDone();
if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoOpt&POPT_EN_Z80)) if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80))
PicoSyncZ80(cycles); PicoSyncZ80(cycles);
#ifdef PICO_CD #ifdef PICO_CD
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
pcd_sync_s68k(cycles, 0); pcd_sync_s68k(cycles, 0);
#endif #endif
#ifdef PICO_32X #ifdef PICO_32X
@ -195,7 +195,7 @@ static int PicoFrameHints(void)
pv->lwrite_cnt = 0; pv->lwrite_cnt = 0;
Pico.video.status |= SR_EMPT; Pico.video.status |= SR_EMPT;
memcpy(PicoPadInt, PicoPad, sizeof(PicoPadInt)); memcpy(PicoIn.padInt, PicoIn.pad, sizeof(PicoIn.padInt));
PAD_DELAY(); PAD_DELAY();
// Last H-Int (normally): // Last H-Int (normally):
@ -225,14 +225,14 @@ static int PicoFrameHints(void)
} }
cycles = SekCyclesDone(); cycles = SekCyclesDone();
if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoOpt&POPT_EN_Z80)) { if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80)) {
PicoSyncZ80(cycles); PicoSyncZ80(cycles);
elprintf(EL_INTS, "zint"); elprintf(EL_INTS, "zint");
z80_int(); z80_int();
} }
#ifdef PICO_CD #ifdef PICO_CD
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
pcd_sync_s68k(cycles, 0); pcd_sync_s68k(cycles, 0);
#endif #endif
#ifdef PICO_32X #ifdef PICO_32X
@ -313,7 +313,7 @@ static int PicoFrameHints(void)
// sync cpus // sync cpus
cycles = SekCyclesDone(); cycles = SekCyclesDone();
if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoOpt&POPT_EN_Z80)) if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80))
PicoSyncZ80(cycles); PicoSyncZ80(cycles);
if (PsndOut && ym2612.dacen && PsndDacLine < lines) if (PsndOut && ym2612.dacen && PsndDacLine < lines)
PsndDoDAC(lines - 1); PsndDoDAC(lines - 1);
@ -321,7 +321,7 @@ static int PicoFrameHints(void)
PsndDoPSG(lines - 1); PsndDoPSG(lines - 1);
#ifdef PICO_CD #ifdef PICO_CD
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
pcd_sync_s68k(cycles, 0); pcd_sync_s68k(cycles, 0);
#endif #endif
#ifdef PICO_32X #ifdef PICO_32X

View file

@ -327,7 +327,7 @@ struct PicoMisc
unsigned char eeprom_cycle; // EEPROM cycle number unsigned char eeprom_cycle; // EEPROM cycle number
unsigned char eeprom_slave; // EEPROM slave word for X24C02 and better SRAMs unsigned char eeprom_slave; // EEPROM slave word for X24C02 and better SRAMs
unsigned char eeprom_status; unsigned char eeprom_status;
unsigned char pad2; unsigned char status; // rapid_ym2612, multi_ym_updates
unsigned short dma_xfers; // 18 unsigned short dma_xfers; // 18
unsigned char eeprom_wb[2]; // EEPROM latch/write buffer unsigned char eeprom_wb[2]; // EEPROM latch/write buffer
unsigned int frame_count; // 1c for movies and idle det unsigned int frame_count; // 1c for movies and idle det
@ -352,7 +352,7 @@ struct PicoEState
struct Pico *Pico; struct Pico *Pico;
void *PicoMem_vram; void *PicoMem_vram;
void *PicoMem_cram; void *PicoMem_cram;
int *PicoOpt; unsigned int *PicoOpt;
unsigned char *Draw2FB; unsigned char *Draw2FB;
unsigned short HighPal[0x100]; unsigned short HighPal[0x100];
}; };
@ -705,8 +705,6 @@ void pcd_state_loaded_mem(void);
// pico.c // pico.c
extern struct Pico Pico; extern struct Pico Pico;
extern struct PicoMem PicoMem; extern struct PicoMem PicoMem;
extern int PicoPadInt[2];
extern int emustatus;
extern void (*PicoResetHook)(void); extern void (*PicoResetHook)(void);
extern void (*PicoLineHook)(void); extern void (*PicoLineHook)(void);
PICO_INTERNAL int CheckDMA(void); PICO_INTERNAL int CheckDMA(void);

View file

@ -335,7 +335,7 @@ int SekIsIdleCode(unsigned short *dst, int bytes)
(*dst & 0xc1ff) == 0x0038 || // move.x ($xxxx.w), dX (*dst & 0xc1ff) == 0x0038 || // move.x ($xxxx.w), dX
(*dst & 0xf13f) == 0xb038) // cmp.x ($xxxx.w), dX (*dst & 0xf13f) == 0xb038) // cmp.x ($xxxx.w), dX
return 1; return 1;
if (PicoAHW & (PAHW_MCD|PAHW_32X)) if (PicoIn.AHW & (PAHW_MCD|PAHW_32X))
break; break;
// with no addons, there should be no need to wait // with no addons, there should be no need to wait
// for byte change anywhere // for byte change anywhere
@ -362,7 +362,7 @@ int SekIsIdleCode(unsigned short *dst, int bytes)
return 1; return 1;
break; break;
case 12: case 12:
if (PicoAHW & (PAHW_MCD|PAHW_32X)) if (PicoIn.AHW & (PAHW_MCD|PAHW_32X))
break; break;
if ( (*dst & 0xf1f8) == 0x3010 && // move.w (aX), dX if ( (*dst & 0xf1f8) == 0x3010 && // move.w (aX), dX
(dst[1]&0xf100) == 0x0000 && // arithmetic (dst[1]&0xf100) == 0x0000 && // arithmetic

View file

@ -108,12 +108,12 @@ static unsigned char z80_sms_in(unsigned short a)
break; break;
case 0xc0: /* I/O port A and B */ case 0xc0: /* I/O port A and B */
d = ~((PicoPad[0] & 0x3f) | (PicoPad[1] << 6)); d = ~((PicoIn.pad[0] & 0x3f) | (PicoIn.pad[1] << 6));
break; break;
case 0xc1: /* I/O port B and miscellaneous */ case 0xc1: /* I/O port B and miscellaneous */
d = (Pico.ms.io_ctl & 0x80) | ((Pico.ms.io_ctl << 1) & 0x40) | 0x30; d = (Pico.ms.io_ctl & 0x80) | ((Pico.ms.io_ctl << 1) & 0x40) | 0x30;
d |= ~(PicoPad[1] >> 2) & 0x0f; d |= ~(PicoIn.pad[1] >> 2) & 0x0f;
break; break;
} }
@ -133,7 +133,7 @@ static void z80_sms_out(unsigned short a, unsigned char d)
case 0x40: case 0x40:
case 0x41: case 0x41:
if (PicoOpt & POPT_EN_PSG) if (PicoIn.opt & POPT_EN_PSG)
SN76496Write(d); SN76496Write(d);
break; break;
@ -255,7 +255,7 @@ void PicoFrameMS(void)
int lines = is_pal ? 313 : 262; int lines = is_pal ? 313 : 262;
int cycles_line = is_pal ? 58020 : 58293; /* (226.6 : 227.7) * 256 */ int cycles_line = is_pal ? 58020 : 58293; /* (226.6 : 227.7) * 256 */
int cycles_done = 0, cycles_aim = 0; int cycles_done = 0, cycles_aim = 0;
int skip = PicoSkipFrame; int skip = PicoIn.skipFrame;
int lines_vis = 192; int lines_vis = 192;
int hint; // Hint counter int hint; // Hint counter
int nmi; int nmi;
@ -263,7 +263,7 @@ void PicoFrameMS(void)
PsndStartFrame(); PsndStartFrame();
nmi = (PicoPad[0] >> 7) & 1; nmi = (PicoIn.pad[0] >> 7) & 1;
if (!Pico.ms.nmi_state && nmi) if (!Pico.ms.nmi_state && nmi)
z80_nmi(); z80_nmi();
Pico.ms.nmi_state = nmi; Pico.ms.nmi_state = nmi;

View file

@ -141,9 +141,9 @@ void PsndRerate(int preserve_state)
PsndClear(); PsndClear();
// set mixer // set mixer
PsndMix_32_to_16l = (PicoOpt & POPT_EN_STEREO) ? mix_32_to_16l_stereo : mix_32_to_16_mono; PsndMix_32_to_16l = (PicoIn.opt & POPT_EN_STEREO) ? mix_32_to_16l_stereo : mix_32_to_16_mono;
if (PicoAHW & PAHW_PICO) if (PicoIn.AHW & PAHW_PICO)
PicoReratePico(); PicoReratePico();
} }
@ -159,7 +159,7 @@ PICO_INTERNAL void PsndStartFrame(void)
} }
PsndDacLine = PsndPsgLine = 0; PsndDacLine = PsndPsgLine = 0;
emustatus &= ~1; Pico.m.status &= ~1;
dac_info[224] = PsndLen_use; dac_info[224] = PsndLen_use;
} }
@ -183,7 +183,7 @@ PICO_INTERNAL void PsndDoDAC(int line_to)
if (!PsndOut) if (!PsndOut)
return; return;
if (PicoOpt & POPT_EN_STEREO) { if (PicoIn.opt & POPT_EN_STEREO) {
short *d = PsndOut + pos*2; short *d = PsndOut + pos*2;
for (; len > 0; len--, d+=2) *d += dout; for (; len > 0; len--, d+=2) *d += dout;
} else { } else {
@ -211,10 +211,10 @@ PICO_INTERNAL void PsndDoPSG(int line_to)
PsndPsgLine = line_to + 1; PsndPsgLine = line_to + 1;
if (!PsndOut || !(PicoOpt & POPT_EN_PSG)) if (!PsndOut || !(PicoIn.opt & POPT_EN_PSG))
return; return;
if (PicoOpt & POPT_EN_STEREO) { if (PicoIn.opt & POPT_EN_STEREO) {
stereo = 1; stereo = 1;
pos <<= 1; pos <<= 1;
} }
@ -272,7 +272,7 @@ PICO_INTERNAL void PsndClear(void)
{ {
int len = PsndLen; int len = PsndLen;
if (PsndLen_exc_add) len++; if (PsndLen_exc_add) len++;
if (PicoOpt & POPT_EN_STEREO) if (PicoIn.opt & POPT_EN_STEREO)
memset32((int *) PsndOut, 0, len); // assume PsndOut to be aligned memset32((int *) PsndOut, 0, len); // assume PsndOut to be aligned
else { else {
short *out = PsndOut; short *out = PsndOut;
@ -287,19 +287,19 @@ static int PsndRender(int offset, int length)
{ {
int buf32_updated = 0; int buf32_updated = 0;
int *buf32 = PsndBuffer+offset; int *buf32 = PsndBuffer+offset;
int stereo = (PicoOpt & 8) >> 3; int stereo = (PicoIn.opt & 8) >> 3;
offset <<= stereo; offset <<= stereo;
pprof_start(sound); pprof_start(sound);
if (PicoAHW & PAHW_PICO) { if (PicoIn.AHW & PAHW_PICO) {
PicoPicoPCMUpdate(PsndOut+offset, length, stereo); PicoPicoPCMUpdate(PsndOut+offset, length, stereo);
return length; return length;
} }
// Add in the stereo FM buffer // Add in the stereo FM buffer
if (PicoOpt & POPT_EN_FM) { if (PicoIn.opt & POPT_EN_FM) {
buf32_updated = YM2612UpdateOne(buf32, length, stereo, 1); buf32_updated = YM2612UpdateOne(buf32, length, stereo, 1);
} else } else
memset32(buf32, 0, length<<stereo); memset32(buf32, 0, length<<stereo);
@ -308,14 +308,14 @@ static int PsndRender(int offset, int length)
(void)buf32_updated; (void)buf32_updated;
// CD: PCM sound // CD: PCM sound
if (PicoAHW & PAHW_MCD) { if (PicoIn.AHW & PAHW_MCD) {
pcd_pcm_update(buf32, length, stereo); pcd_pcm_update(buf32, length, stereo);
//buf32_updated = 1; //buf32_updated = 1;
} }
// CD: CDDA audio // CD: CDDA audio
// CD mode, cdda enabled, not data track, CDC is reading // CD mode, cdda enabled, not data track, CDC is reading
if ((PicoAHW & PAHW_MCD) && (PicoOpt & POPT_EN_MCD_CDDA) if ((PicoIn.AHW & PAHW_MCD) && (PicoIn.opt & POPT_EN_MCD_CDDA)
&& Pico_mcd->cdda_stream != NULL && Pico_mcd->cdda_stream != NULL
&& !(Pico_mcd->s68k_regs[0x36] & 1)) && !(Pico_mcd->s68k_regs[0x36] & 1))
{ {
@ -326,7 +326,7 @@ static int PsndRender(int offset, int length)
cdda_raw_update(buf32, length); cdda_raw_update(buf32, length);
} }
if ((PicoAHW & PAHW_32X) && (PicoOpt & POPT_EN_PWM)) if ((PicoIn.AHW & PAHW_32X) && (PicoIn.opt & POPT_EN_PWM))
p32x_pwm_update(buf32, length, stereo); p32x_pwm_update(buf32, length, stereo);
// convert + limit to normal 16bit output // convert + limit to normal 16bit output
@ -348,33 +348,33 @@ PICO_INTERNAL void PsndGetSamples(int y)
if (y == 224) if (y == 224)
{ {
if (emustatus & 2) if (Pico.m.status & 2)
curr_pos += PsndRender(curr_pos, PsndLen-PsndLen/2); curr_pos += PsndRender(curr_pos, PsndLen-PsndLen/2);
else curr_pos = PsndRender(0, PsndLen_use); else curr_pos = PsndRender(0, PsndLen_use);
if (emustatus & 1) if (Pico.m.status & 1)
emustatus |= 2; Pico.m.status |= 2;
else emustatus &= ~2; else Pico.m.status &= ~2;
if (PicoWriteSound) if (PicoWriteSound)
PicoWriteSound(curr_pos * ((PicoOpt & POPT_EN_STEREO) ? 4 : 2)); PicoWriteSound(curr_pos * ((PicoIn.opt & POPT_EN_STEREO) ? 4 : 2));
// clear sound buffer // clear sound buffer
PsndClear(); PsndClear();
PsndDacLine = 224; PsndDacLine = 224;
dac_info[224] = 0; dac_info[224] = 0;
} }
else if (emustatus & 3) { else if (Pico.m.status & 3) {
emustatus|= 2; Pico.m.status |= 2;
emustatus&=~1; Pico.m.status &= ~1;
curr_pos = PsndRender(0, PsndLen/2); curr_pos = PsndRender(0, PsndLen/2);
} }
} }
PICO_INTERNAL void PsndGetSamplesMS(void) PICO_INTERNAL void PsndGetSamplesMS(void)
{ {
int stereo = (PicoOpt & 8) >> 3; int stereo = (PicoIn.opt & 8) >> 3;
int length = PsndLen_use; int length = PsndLen_use;
// PSG // PSG
if (PicoOpt & POPT_EN_PSG) if (PicoIn.opt & POPT_EN_PSG)
SN76496Update(PsndOut, length, stereo); SN76496Update(PsndOut, length, stereo);
// upmix to "stereo" if needed // upmix to "stereo" if needed
@ -385,7 +385,7 @@ PICO_INTERNAL void PsndGetSamplesMS(void)
} }
if (PicoWriteSound != NULL) if (PicoWriteSound != NULL)
PicoWriteSound(length * ((PicoOpt & POPT_EN_STEREO) ? 4 : 2)); PicoWriteSound(length * ((PicoIn.opt & POPT_EN_STEREO) ? 4 : 2));
PsndClear(); PsndClear();
} }

View file

@ -176,20 +176,20 @@ int YM2612PicoStateLoad2(int *tat, int *tbt);
#else #else
/* GP2X specific */ /* GP2X specific */
#include "../../platform/gp2x/940ctl.h" #include "../../platform/gp2x/940ctl.h"
extern int PicoOpt; extern int PicoIn.opt;
#define YM2612Init(baseclock,rate) { \ #define YM2612Init(baseclock,rate) { \
if (PicoOpt&0x200) YM2612Init_940(baseclock, rate); \ if (PicoIn.opt&0x200) YM2612Init_940(baseclock, rate); \
else YM2612Init_(baseclock, rate); \ else YM2612Init_(baseclock, rate); \
} }
#define YM2612ResetChip() { \ #define YM2612ResetChip() { \
if (PicoOpt&0x200) YM2612ResetChip_940(); \ if (PicoIn.opt&0x200) YM2612ResetChip_940(); \
else YM2612ResetChip_(); \ else YM2612ResetChip_(); \
} }
#define YM2612UpdateOne(buffer,length,stereo,is_buf_empty) \ #define YM2612UpdateOne(buffer,length,stereo,is_buf_empty) \
(PicoOpt&0x200) ? YM2612UpdateOne_940(buffer, length, stereo, is_buf_empty) : \ (PicoIn.opt&0x200) ? YM2612UpdateOne_940(buffer, length, stereo, is_buf_empty) : \
YM2612UpdateOne_(buffer, length, stereo, is_buf_empty); YM2612UpdateOne_(buffer, length, stereo, is_buf_empty);
#define YM2612PicoStateLoad() { \ #define YM2612PicoStateLoad() { \
if (PicoOpt&0x200) YM2612PicoStateLoad_940(); \ if (PicoIn.opt&0x200) YM2612PicoStateLoad_940(); \
else YM2612PicoStateLoad_(); \ else YM2612PicoStateLoad_(); \
} }
#endif /* __GP2X__ */ #endif /* __GP2X__ */

View file

@ -226,7 +226,7 @@ static int state_save(void *file)
areaWrite("PicoSEXT", 1, 8, file); areaWrite("PicoSEXT", 1, 8, file);
areaWrite(&ver, 1, 4, file); areaWrite(&ver, 1, 4, file);
if (!(PicoAHW & PAHW_SMS)) { if (!(PicoIn.AHW & PAHW_SMS)) {
memset(buff, 0, sizeof(buff)); memset(buff, 0, sizeof(buff));
SekPackCpu(buff, 0); SekPackCpu(buff, 0);
CHECKED_WRITE_BUFF(CHUNK_M68K, buff); CHECKED_WRITE_BUFF(CHUNK_M68K, buff);
@ -250,7 +250,7 @@ static int state_save(void *file)
CHECKED_WRITE_BUFF(CHUNK_Z80, buff_z80); CHECKED_WRITE_BUFF(CHUNK_Z80, buff_z80);
CHECKED_WRITE(CHUNK_PSG, 28*4, sn76496_regs); CHECKED_WRITE(CHUNK_PSG, 28*4, sn76496_regs);
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
{ {
buf2 = malloc(CHUNK_LIMIT_W); buf2 = malloc(CHUNK_LIMIT_W);
if (buf2 == NULL) if (buf2 == NULL)
@ -287,7 +287,7 @@ static int state_save(void *file)
} }
#ifndef NO_32X #ifndef NO_32X
if (PicoAHW & PAHW_32X) if (PicoIn.AHW & PAHW_32X)
{ {
unsigned char cpubuff[SH2_STATE_SIZE]; unsigned char cpubuff[SH2_STATE_SIZE];
@ -406,9 +406,9 @@ static int state_load(void *file)
CHECKED_READ(1, &chunk); CHECKED_READ(1, &chunk);
CHECKED_READ(4, &len); CHECKED_READ(4, &len);
if (len < 0 || len > 1024*512) R_ERROR_RETURN("bad length"); if (len < 0 || len > 1024*512) R_ERROR_RETURN("bad length");
if (CHUNK_S68K <= chunk && chunk <= CHUNK_MISC_CD && !(PicoAHW & PAHW_MCD)) if (CHUNK_S68K <= chunk && chunk <= CHUNK_MISC_CD && !(PicoIn.AHW & PAHW_MCD))
R_ERROR_RETURN("cd chunk in non CD state?"); R_ERROR_RETURN("cd chunk in non CD state?");
if (CHUNK_32X_FIRST <= chunk && chunk <= CHUNK_32X_LAST && !(PicoAHW & PAHW_32X)) if (CHUNK_32X_FIRST <= chunk && chunk <= CHUNK_32X_LAST && !(PicoIn.AHW & PAHW_32X))
Pico32xStartup(); Pico32xStartup();
switch (chunk) switch (chunk)
@ -535,28 +535,28 @@ breakswitch:
} }
readend: readend:
if (PicoAHW & PAHW_SMS) if (PicoIn.AHW & PAHW_SMS)
PicoStateLoadedMS(); PicoStateLoadedMS();
if (PicoAHW & PAHW_32X) if (PicoIn.AHW & PAHW_32X)
Pico32xStateLoaded(1); Pico32xStateLoaded(1);
if (PicoLoadStateHook != NULL) if (PicoLoadStateHook != NULL)
PicoLoadStateHook(); PicoLoadStateHook();
// must unpack 68k and z80 after banks are set up // must unpack 68k and z80 after banks are set up
if (!(PicoAHW & PAHW_SMS)) if (!(PicoIn.AHW & PAHW_SMS))
SekUnpackCpu(buff_m68k, 0); SekUnpackCpu(buff_m68k, 0);
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
SekUnpackCpu(buff_s68k, 1); SekUnpackCpu(buff_s68k, 1);
z80_unpack(buff_z80); z80_unpack(buff_z80);
// due to dep from 68k cycles.. // due to dep from 68k cycles..
Pico.t.m68c_aim = Pico.t.m68c_cnt; Pico.t.m68c_aim = Pico.t.m68c_cnt;
if (PicoAHW & PAHW_32X) if (PicoIn.AHW & PAHW_32X)
Pico32xStateLoaded(0); Pico32xStateLoaded(0);
if (PicoAHW & PAHW_MCD) if (PicoIn.AHW & PAHW_MCD)
{ {
SekCycleAimS68k = SekCycleCntS68k; SekCycleAimS68k = SekCycleCntS68k;
pcd_state_loaded(); pcd_state_loaded();
@ -579,7 +579,7 @@ static int state_load_gfx(void *file)
int ver, len, found = 0, to_find = 4; int ver, len, found = 0, to_find = 4;
char buff[8]; char buff[8];
if (PicoAHW & PAHW_32X) if (PicoIn.AHW & PAHW_32X)
to_find += 2; to_find += 2;
g_read_offs = 0; g_read_offs = 0;
@ -593,7 +593,7 @@ static int state_load_gfx(void *file)
CHECKED_READ(1, buff); CHECKED_READ(1, buff);
CHECKED_READ(4, &len); CHECKED_READ(4, &len);
if (len < 0 || len > 1024*512) R_ERROR_RETURN("bad length"); if (len < 0 || len > 1024*512) R_ERROR_RETURN("bad length");
if (buff[0] > CHUNK_FM && buff[0] <= CHUNK_MISC_CD && !(PicoAHW & PAHW_MCD)) if (buff[0] > CHUNK_FM && buff[0] <= CHUNK_MISC_CD && !(PicoIn.AHW & PAHW_MCD))
R_ERROR_RETURN("cd chunk in non CD state?"); R_ERROR_RETURN("cd chunk in non CD state?");
switch (buff[0]) switch (buff[0])
@ -723,7 +723,7 @@ void *PicoTmpStateSave(void)
memcpy(&t->video, &Pico.video, sizeof(Pico.video)); memcpy(&t->video, &Pico.video, sizeof(Pico.video));
#ifndef NO_32X #ifndef NO_32X
if (PicoAHW & PAHW_32X) { if (PicoIn.AHW & PAHW_32X) {
memcpy(&t->t32x.p32x, &Pico32x, sizeof(Pico32x)); memcpy(&t->t32x.p32x, &Pico32x, sizeof(Pico32x));
memcpy(t->t32x.dram, Pico32xMem->dram, sizeof(Pico32xMem->dram)); memcpy(t->t32x.dram, Pico32xMem->dram, sizeof(Pico32xMem->dram));
memcpy(t->t32x.pal, Pico32xMem->pal, sizeof(Pico32xMem->pal)); memcpy(t->t32x.pal, Pico32xMem->pal, sizeof(Pico32xMem->pal));
@ -746,7 +746,7 @@ void PicoTmpStateRestore(void *data)
Pico.m.dirtyPal = 1; Pico.m.dirtyPal = 1;
#ifndef NO_32X #ifndef NO_32X
if (PicoAHW & PAHW_32X) { if (PicoIn.AHW & PAHW_32X) {
memcpy(&Pico32x, &t->t32x.p32x, sizeof(Pico32x)); memcpy(&Pico32x, &t->t32x.p32x, sizeof(Pico32x));
memcpy(Pico32xMem->dram, t->t32x.dram, sizeof(Pico32xMem->dram)); memcpy(Pico32xMem->dram, t->t32x.dram, sizeof(Pico32xMem->dram));
memcpy(Pico32xMem->pal, t->t32x.pal, sizeof(Pico32xMem->pal)); memcpy(Pico32xMem->pal, t->t32x.pal, sizeof(Pico32xMem->pal));

View file

@ -109,7 +109,7 @@ static void DmaSlow(int len, unsigned int source)
base = (u16 *)PicoMem.ram; base = (u16 *)PicoMem.ram;
mask = 0xffff; mask = 0xffff;
} }
else if (PicoAHW & PAHW_MCD) else if (PicoIn.AHW & PAHW_MCD)
{ {
u8 r3 = Pico_mcd->s68k_regs[3]; u8 r3 = Pico_mcd->s68k_regs[3];
elprintf(EL_VDPDMA, "DmaSlow CD, r3=%02x", r3); elprintf(EL_VDPDMA, "DmaSlow CD, r3=%02x", r3);
@ -346,8 +346,8 @@ static NOINLINE void CommandChange(void)
static void DrawSync(int blank_on) static void DrawSync(int blank_on)
{ {
if (Pico.m.scanline < 224 && !(PicoOpt & POPT_ALT_RENDERER) && if (Pico.m.scanline < 224 && !(PicoIn.opt & POPT_ALT_RENDERER) &&
!PicoSkipFrame && Pico.est.DrawScanline <= Pico.m.scanline) { !PicoIn.skipFrame && Pico.est.DrawScanline <= Pico.m.scanline) {
//elprintf(EL_ANOMALY, "sync"); //elprintf(EL_ANOMALY, "sync");
PicoDrawSync(Pico.m.scanline, blank_on); PicoDrawSync(Pico.m.scanline, blank_on);
} }
@ -376,7 +376,7 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
pvid->pending=0; pvid->pending=0;
} }
if (!(pvid->status & SR_VB) && !(PicoOpt&POPT_DIS_VDP_FIFO)) if (!(pvid->status & SR_VB) && !(PicoIn.opt&POPT_DIS_VDP_FIFO))
{ {
int use = pvid->type == 1 ? 2 : 1; int use = pvid->type == 1 ? 2 : 1;
pvid->lwrite_cnt -= use; pvid->lwrite_cnt -= use;

View file

@ -104,17 +104,17 @@ void z80_reset(void)
*/ */
#ifdef FAST_Z80SP #ifdef FAST_Z80SP
// drZ80 is locked in single bank // drZ80 is locked in single bank
drz80_sp_base = (PicoAHW & PAHW_SMS) ? 0xc000 : 0x0000; drz80_sp_base = (PicoIn.AHW & PAHW_SMS) ? 0xc000 : 0x0000;
drZ80.Z80SP_BASE = z80_read_map[drz80_sp_base >> Z80_MEM_SHIFT] << 1; drZ80.Z80SP_BASE = z80_read_map[drz80_sp_base >> Z80_MEM_SHIFT] << 1;
#endif #endif
if (PicoAHW & PAHW_SMS) if (PicoIn.AHW & PAHW_SMS)
drZ80.Z80SP = drZ80.Z80SP_BASE + 0xdff0; // simulate BIOS drZ80.Z80SP = drZ80.Z80SP_BASE + 0xdff0; // simulate BIOS
// XXX: since we use direct SP pointer, it might make sense to force it to RAM, // XXX: since we use direct SP pointer, it might make sense to force it to RAM,
// but we'll rely on built-in stack protection for now // but we'll rely on built-in stack protection for now
#endif #endif
#ifdef _USE_CZ80 #ifdef _USE_CZ80
Cz80_Reset(&CZ80); Cz80_Reset(&CZ80);
if (PicoAHW & PAHW_SMS) if (PicoIn.AHW & PAHW_SMS)
Cz80_Set_Reg(&CZ80, CZ80_SP, 0xdff0); Cz80_Set_Reg(&CZ80, CZ80_SP, 0xdff0);
#endif #endif
} }

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

View file

@ -281,7 +281,7 @@ static void menu_loop_patches(void)
// -------------- key config -------------- // -------------- key config --------------
// PicoPad[] format: MXYZ SACB RLDU // PicoIn.pad[] format: MXYZ SACB RLDU
me_bind_action me_ctrl_actions[] = me_bind_action me_ctrl_actions[] =
{ {
{ "UP ", 0x0001 }, { "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[] = 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("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("CDDA audio", MA_CDOPT_CDDA, PicoIn.opt, POPT_EN_MCD_CDDA, h_cdda),
mee_onoff_h("PCM audio", MA_CDOPT_PCM, PicoOpt, POPT_EN_MCD_PCM, h_cdpcm), mee_onoff_h("PCM audio", MA_CDOPT_PCM, PicoIn.opt, POPT_EN_MCD_PCM, h_cdpcm),
mee_onoff_h("SaveRAM cart", MA_CDOPT_SAVERAM, PicoOpt, POPT_EN_MCD_RAMCART, h_srcart), 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, PicoOpt, POPT_EN_MCD_GFX, h_scfx), mee_onoff_h("Scale/Rot. fx", MA_CDOPT_SCALEROT_CHIP, PicoIn.opt, POPT_EN_MCD_GFX, h_scfx),
mee_end, mee_end,
}; };
@ -464,9 +464,9 @@ static const char h_sh2cycles[] = "Cycles/millisecond (similar to DOSBox)\n"
static menu_entry e_menu_32x_options[] = 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_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 ("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_cust_h ("Slave SH2 cycles", MA_32XOPT_SSH2_CYCLES, mh_opt_sh2cycles, mgn_opt_sh2cycles, h_sh2cycles),
mee_end, mee_end,
@ -491,15 +491,15 @@ static int menu_loop_32x_options(int id, int keys)
static menu_entry e_menu_adv_options[] = static menu_entry e_menu_adv_options[] =
{ {
mee_onoff ("SRAM/BRAM saves", MA_OPT_SRAM_STATES, currentConfig.EmuOpt, EOPT_EN_SRAM), 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 ("Disable sprite limit", MA_OPT2_NO_SPRITE_LIM, PicoIn.opt, POPT_DIS_SPRITE_LIM),
mee_onoff ("Emulate Z80", MA_OPT2_ENABLE_Z80, PicoOpt, POPT_EN_Z80), mee_onoff ("Emulate Z80", MA_OPT2_ENABLE_Z80, PicoIn.opt, POPT_EN_Z80),
mee_onoff ("Emulate YM2612 (FM)", MA_OPT2_ENABLE_YM2612, PicoOpt, POPT_EN_FM), mee_onoff ("Emulate YM2612 (FM)", MA_OPT2_ENABLE_YM2612, PicoIn.opt, POPT_EN_FM),
mee_onoff ("Emulate SN76496 (PSG)", MA_OPT2_ENABLE_SN76496,PicoOpt, POPT_EN_PSG), 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 ("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 ("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 ("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), mee_onoff ("Status line in main menu", MA_OPT2_STATUS_LINE, currentConfig.EmuOpt, EOPT_SHOW_RTC),
MENU_OPTIONS_ADV MENU_OPTIONS_ADV
mee_end, mee_end,
@ -556,15 +556,15 @@ static int sndrate_prevnext(int rate, int dir)
i += dir ? 1 : -1; i += dir ? 1 : -1;
if (i > 4) { if (i > 4) {
if (!(PicoOpt & POPT_EN_STEREO)) { if (!(PicoIn.opt & POPT_EN_STEREO)) {
PicoOpt |= POPT_EN_STEREO; PicoIn.opt |= POPT_EN_STEREO;
return rates[0]; return rates[0];
} }
return rates[4]; return rates[4];
} }
if (i < 0) { if (i < 0) {
if (PicoOpt & POPT_EN_STEREO) { if (PicoIn.opt & POPT_EN_STEREO) {
PicoOpt &= ~POPT_EN_STEREO; PicoIn.opt &= ~POPT_EN_STEREO;
return rates[4]; return rates[4];
} }
return rates[0]; return rates[0];
@ -579,24 +579,24 @@ static void region_prevnext(int right)
int i; int i;
if (right) { if (right) {
if (!PicoRegionOverride) { if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break; if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i < 5) PicoAutoRgnOrder = rgn_orders[i+1]; if (i < 5) PicoIn.autoRgnOrder = rgn_orders[i+1];
else PicoRegionOverride=1; else PicoIn.regionOverride=1;
} }
else else
PicoRegionOverride <<= 1; PicoIn.regionOverride <<= 1;
if (PicoRegionOverride > 8) if (PicoIn.regionOverride > 8)
PicoRegionOverride = 8; PicoIn.regionOverride = 8;
} else { } else {
if (!PicoRegionOverride) { if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break; if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i > 0) PicoAutoRgnOrder = rgn_orders[i-1]; if (i > 0) PicoIn.autoRgnOrder = rgn_orders[i-1];
} }
else else
PicoRegionOverride >>= 1; PicoIn.regionOverride >>= 1;
} }
} }
@ -667,7 +667,7 @@ static const char *mgn_opt_sound(int id, int *offs)
{ {
const char *str2; const char *str2;
*offs = -8; *offs = -8;
str2 = (PicoOpt & POPT_EN_STEREO) ? "stereo" : "mono"; str2 = (PicoIn.opt & POPT_EN_STEREO) ? "stereo" : "mono";
sprintf(static_buff, "%5iHz %s", PsndRate, str2); sprintf(static_buff, "%5iHz %s", PsndRate, str2);
return static_buff; 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[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" };
static const char *names_short[] = { "", " JP", " JP", " US", " EU" }; static const char *names_short[] = { "", " JP", " JP", " US", " EU" };
int code = PicoRegionOverride; int code = PicoIn.regionOverride;
int u, i = 0; int u, i = 0;
*offs = -6; *offs = -6;
@ -689,7 +689,7 @@ static const char *mgn_opt_region(int id, int *offs)
} else { } else {
strcpy(static_buff, "Auto:"); strcpy(static_buff, "Auto:");
for (u = 0; u < 3; u++) { for (u = 0; u < 3; u++) {
code = (PicoAutoRgnOrder >> u*4) & 0xf; code = (PicoIn.autoRgnOrder >> u*4) & 0xf;
for (i = 0; code; code >>= 1, i++) for (i = 0; code; code >>= 1, i++)
; ;
strcat(static_buff, names_short[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_MA2) pv->debug_p ^= PVD_KILL_32X;
if (inp & PBTN_MOK) { if (inp & PBTN_MOK) {
PsndOut = NULL; // just in case PsndOut = NULL; // just in case
PicoSkipFrame = 1; PicoIn.skipFrame = 1;
PicoFrame(); PicoFrame();
PicoSkipFrame = 0; PicoIn.skipFrame = 0;
while (inp & PBTN_MOK) inp = in_menu_wait_any(NULL, -1); while (inp & PBTN_MOK) inp = in_menu_wait_any(NULL, -1);
} }
break; break;
@ -1023,7 +1023,7 @@ static int main_menu_handler(int id, int keys)
} }
break; break;
case MA_MAIN_CHANGE_CD: case MA_MAIN_CHANGE_CD:
if (PicoAHW & PAHW_MCD) { if (PicoIn.AHW & PAHW_MCD) {
// if cd is loaded, cdd_unload() triggers eject and // if cd is loaded, cdd_unload() triggers eject and
// returns 1, else we'll select and load new CD here // returns 1, else we'll select and load new CD here
if (!cdd_unload()) 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_SAVE_STATE, PicoGameLoaded);
me_enable(e_menu_main, MA_MAIN_LOAD_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_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); me_enable(e_menu_main, MA_MAIN_PATCHES, PicoPatches != NULL);
menu_enter(PicoGameLoaded); menu_enter(PicoGameLoaded);
@ -1168,7 +1168,7 @@ void menu_update_msg(const char *msg)
/* hidden options for config engine only */ /* hidden options for config engine only */
static menu_entry e_menu_hidden[] = 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_onoff("autoload savestates", MA_OPT_AUTOLOAD_SAVE, g_autostateld_opt, 1),
mee_end, mee_end,
}; };

View file

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

View file

@ -501,7 +501,7 @@ static void draw_savestate_bg(int slot)
} }
if (file) { if (file) {
if (PicoAHW & 1) { if (PicoIn.AHW & 1) {
PicoCdLoadStateGfx(file); PicoCdLoadStateGfx(file);
} else { } else {
areaSeek(file, 0x10020, SEEK_SET); // skip header and RAM in state file 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 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 }, { "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 }, { "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 }, { "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 }, { "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_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_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
if (inp & PBTN_PLAY) { if (inp & PBTN_PLAY) {
int is_6button = PicoOpt & 0x020; int is_6button = PicoIn.opt & 0x020;
switch (selected_id) { switch (selected_id) {
case MA_CTRL_PLAYER1: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 0); return; 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; 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_EUR, NULL, 0, 0, 0, 1, 0 },
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_JAP, 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 }, { "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 }, { "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoIn.opt, 0x0800, 0, 0, 1, 1 },
{ "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 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 }, { 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 }, { "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoIn.opt, 0x8000, 0, 0, 1, 1 },
{ "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoOpt, 0x1000, 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, &PicoOpt, 0x2000, 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 }, { "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[] = menu_entry opt2_entries[] =
{ {
{ "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoOpt, 0x40000, 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, &PicoOpt, 0x00004, 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, &PicoOpt, 0x00001, 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,&PicoOpt, 0x00002, 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 }, { "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 }, { "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 }, { "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 }, { "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 }, { "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, &PicoOpt, 0x80000, 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 }, { "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[] = menu_entry opt_entries[] =
{ {
{ NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 }, { 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 }, { "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 }, { "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 }, { "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) switch (entry->id)
{ {
case MA_OPT_RENDERER: case MA_OPT_RENDERER:
if (PicoOpt&0x10) if (PicoIn.opt&0x10)
str = " 8bit fast"; str = " 8bit fast";
else if (currentConfig.EmuOpt&0x80) else if (currentConfig.EmuOpt&0x80)
str = "16bit accurate"; 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); text_out16(x, y, "Frameskip %s", str24);
break; break;
case MA_OPT_SOUND_QUALITY: 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); text_out16(x, y, "Sound Quality: %5iHz %s", PsndRate, str);
break; break;
case MA_OPT_REGION: 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; break;
case MA_OPT_CONFIRM_STATES: case MA_OPT_CONFIRM_STATES:
switch ((currentConfig.EmuOpt >> 9) & 5) { 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 }; static int rgn_orders[] = { 0x148, 0x184, 0x814, 0x418, 0x841, 0x481 };
int i; int i;
if (right) { if (right) {
if (!PicoRegionOverride) { if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break; if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i < 5) PicoAutoRgnOrder = rgn_orders[i+1]; if (i < 5) PicoIn.autoRgnOrder = rgn_orders[i+1];
else PicoRegionOverride=1; else PicoIn.regionOverride=1;
} }
else PicoRegionOverride<<=1; else PicoIn.regionOverride<<=1;
if (PicoRegionOverride > 8) PicoRegionOverride = 8; if (PicoIn.regionOverride > 8) PicoIn.regionOverride = 8;
} else { } else {
if (!PicoRegionOverride) { if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break; if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i > 0) PicoAutoRgnOrder = rgn_orders[i-1]; if (i > 0) PicoIn.autoRgnOrder = rgn_orders[i-1];
} }
else PicoRegionOverride>>=1; else PicoIn.regionOverride>>=1;
} }
} }
static void menu_options_save(void) static void menu_options_save(void)
{ {
if (PicoRegionOverride) { if (PicoIn.regionOverride) {
// force setting possibly changed.. // 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 XYZ MODE, just in case
unbind_action(0xf00); unbind_action(0xf00);
} }
@ -1162,28 +1162,28 @@ static int menu_loop_options(void)
switch (selected_id) { switch (selected_id) {
case MA_OPT_RENDERER: case MA_OPT_RENDERER:
if (inp & PBTN_LEFT) { if (inp & PBTN_LEFT) {
if ((PicoOpt&0x10) || !(currentConfig.EmuOpt &0x80)) { if ((PicoIn.opt&0x10) || !(currentConfig.EmuOpt &0x80)) {
PicoOpt&= ~0x10; PicoIn.opt&= ~0x10;
currentConfig.EmuOpt |= 0x80; currentConfig.EmuOpt |= 0x80;
} }
} else { } else {
if (!(PicoOpt&0x10) || (currentConfig.EmuOpt &0x80)) { if (!(PicoIn.opt&0x10) || (currentConfig.EmuOpt &0x80)) {
PicoOpt|= 0x10; PicoIn.opt|= 0x10;
currentConfig.EmuOpt &= ~0x80; currentConfig.EmuOpt &= ~0x80;
} }
} }
break; break;
case MA_OPT_SOUND_QUALITY: case MA_OPT_SOUND_QUALITY:
if ((inp & PBTN_RIGHT) && PsndRate == 44100 && if ((inp & PBTN_RIGHT) && PsndRate == 44100 &&
!(PicoOpt&0x08)) !(PicoIn.opt&0x08))
{ {
PsndRate = 11025; PsndRate = 11025;
PicoOpt |= 8; PicoIn.opt |= 8;
} else if ((inp & PBTN_LEFT) && PsndRate == 11025 && } else if ((inp & PBTN_LEFT) && PsndRate == 11025 &&
(PicoOpt&0x08) && !(PicoAHW&1)) (PicoIn.opt&0x08) && !(PicoIn.AHW&1))
{ {
PsndRate = 44100; PsndRate = 44100;
PicoOpt &= ~8; PicoIn.opt &= ~8;
} else } else
PsndRate = sndrate_prevnext(PsndRate, inp & PBTN_RIGHT); PsndRate = sndrate_prevnext(PsndRate, inp & PBTN_RIGHT);
break; 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) 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); //mp3_update_local(buffer, length, stereo);
return 0; 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) 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); //mp3_start_play_local(f, pos);
return -1; return -1;
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -506,7 +506,7 @@ static void draw_savestate_bg(int slot)
} }
if (file) { if (file) {
if (PicoAHW & PAHW_MCD) { if (PicoIn.AHW & PAHW_MCD) {
PicoCdLoadStateGfx(file); PicoCdLoadStateGfx(file);
} else { } else {
areaSeek(file, 0x10020, SEEK_SET); // skip header and RAM in state file 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 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 }, { "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 }, { "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 }, { "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 }, { "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_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_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
if (inp & PBTN_CIRCLE) { if (inp & PBTN_CIRCLE) {
int is_6button = PicoOpt & POPT_6BTN_PAD; int is_6button = PicoIn.opt & POPT_6BTN_PAD;
switch (selected_id) { switch (selected_id) {
case MA_CTRL_PLAYER1: key_config_loop(me_ctrl_actions, is_6button ? 15 : 11, 0); return; 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; 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_EUR, NULL, 0, 0, 0, 1, 0 },
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_JAP, 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 }, { "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 }, { "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoIn.opt, 0x0800, 0, 0, 1, 1 },
{ "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 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 }, { 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 }, { "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoIn.opt, 0x8000, 0, 0, 1, 1 },
{ "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoOpt, 0x1000, 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, &PicoOpt, 0x2000, 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 }, { "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[] = menu_entry opt2_entries[] =
{ {
{ "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoOpt, 0x40000, 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, &PicoOpt, 0x00004, 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, &PicoOpt, 0x00001, 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, &PicoOpt, 0x00002, 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 }, { "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 }, { "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 }, { "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 }, { "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 }, { "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[] = menu_entry opt_entries[] =
{ {
{ NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 }, { 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 }, { "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 }, { 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 }, { "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) switch (entry->id)
{ {
case MA_OPT_RENDERER: case MA_OPT_RENDERER:
if (PicoOpt & 0x10) if (PicoIn.opt & 0x10)
str = "fast"; str = "fast";
else if (currentConfig.EmuOpt & 0x80) else if (currentConfig.EmuOpt & 0x80)
str = "accurate"; 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); text_out16(x, y, "Frameskip %s", str24);
break; break;
case MA_OPT_SOUND_QUALITY: 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); text_out16(x, y, "Sound Quality: %5iHz %s", PsndRate, str);
break; break;
case MA_OPT_REGION: 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; break;
case MA_OPT_CONFIRM_STATES: case MA_OPT_CONFIRM_STATES:
switch ((currentConfig.EmuOpt >> 9) & 5) { 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 }; static int rgn_orders[] = { 0x148, 0x184, 0x814, 0x418, 0x841, 0x481 };
int i; int i;
if (right) { if (right) {
if (!PicoRegionOverride) { if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break; if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i < 5) PicoAutoRgnOrder = rgn_orders[i+1]; if (i < 5) PicoIn.autoRgnOrder = rgn_orders[i+1];
else PicoRegionOverride=1; else PicoIn.regionOverride=1;
} }
else PicoRegionOverride<<=1; else PicoIn.regionOverride<<=1;
if (PicoRegionOverride > 8) PicoRegionOverride = 8; if (PicoIn.regionOverride > 8) PicoIn.regionOverride = 8;
} else { } else {
if (!PicoRegionOverride) { if (!PicoIn.regionOverride) {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
if (rgn_orders[i] == PicoAutoRgnOrder) break; if (rgn_orders[i] == PicoIn.autoRgnOrder) break;
if (i > 0) PicoAutoRgnOrder = rgn_orders[i-1]; if (i > 0) PicoIn.autoRgnOrder = rgn_orders[i-1];
} }
else PicoRegionOverride>>=1; else PicoIn.regionOverride>>=1;
} }
} }
static void menu_options_save(void) static void menu_options_save(void)
{ {
if (PicoRegionOverride) { if (PicoIn.regionOverride) {
// force setting possibly changed.. // 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 XYZ MODE, just in case
unbind_action(0xf00); 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)) { if (!me_process(opt_entries, OPT_ENTRY_COUNT, selected_id, (inp&PBTN_RIGHT) ? 1 : 0)) {
switch (selected_id) { switch (selected_id) {
case MA_OPT_RENDERER: case MA_OPT_RENDERER:
if ((PicoOpt & 0x10) || !(currentConfig.EmuOpt & 0x80)) { if ((PicoIn.opt & 0x10) || !(currentConfig.EmuOpt & 0x80)) {
PicoOpt &= ~0x10; PicoIn.opt &= ~0x10;
currentConfig.EmuOpt |= 0x80; currentConfig.EmuOpt |= 0x80;
} else { } else {
PicoOpt |= 0x10; PicoIn.opt |= 0x10;
currentConfig.EmuOpt &= ~0x80; currentConfig.EmuOpt &= ~0x80;
} }
break; break;

View file

@ -466,7 +466,7 @@ int mp3_get_offset(void) // 0-1023
unsigned int offs1024 = 0; unsigned int offs1024 = 0;
int cdda_on; 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; (Pico_mcd->scd.Status_CDC & 1) && mp3_handle >= 0;
if (cdda_on) { if (cdda_on) {

View file

@ -131,7 +131,7 @@ static HBITMAP png2hb(const char *fname, int is_480)
static void PrepareForROM(void) static void PrepareForROM(void)
{ {
unsigned char *rom_data = NULL; 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); PicoGetInternal(PI_ROM, (pint_ret_t *) &rom_data);
EnableMenuItem(mmain, 2, MF_BYPOSITION|(show ? MF_ENABLED : MF_GRAYED)); 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) static void update_sound(int len)
{ {
/* avoid writing audio when lagging behind to prevent audio lag */ /* 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); DSoundUpdate(sndbuff, (currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) ? 0 : 1);
} }
@ -139,7 +139,7 @@ void pemu_sound_start(void)
{ {
PsndRerate(0); 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) { if (ret != 0) {
lprintf("dsound init failed\n"); lprintf("dsound init failed\n");
return; return;

View file

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
DUMP_EST(f, Pico); DUMP_EST(f, Pico);
DUMP_EST(f, PicoMem_vram); DUMP_EST(f, PicoMem_vram);
DUMP_EST(f, PicoMem_cram); DUMP_EST(f, PicoMem_cram);
DUMP_EST(f, PicoOpt); DUMP_EST(f, PicoIn.opt);
DUMP_EST(f, Draw2FB); DUMP_EST(f, Draw2FB);
DUMP_EST(f, HighPal); DUMP_EST(f, HighPal);
DUMP_PMEM(f, vram); DUMP_PMEM(f, vram);