X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fpico.c;h=d3123868c49eb3a6028ca0aecc481bab4621c571;hb=e05b81fc5b3f640496795ced5d893ece4cc51c2d;hp=302cc699215a78278e67a3902e3d3e097e34c515;hpb=974fdb5bfda8ed006661031e22c920828ddb60dc;p=picodrive.git diff --git a/pico/pico.c b/pico/pico.c index 302cc69..d312386 100644 --- a/pico/pico.c +++ b/pico/pico.c @@ -10,17 +10,18 @@ #include "pico_int.h" #include "sound/ym2612.h" -int PicoVer=0x0133; struct Pico Pico; -int PicoOpt = 0; -int PicoSkipFrame = 0; // skip rendering frame? -int emustatus = 0; // rapid_ym2612, multi_ym_updates +int PicoOpt; +int PicoSkipFrame; // skip rendering frame? int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU int PicoPadInt[2]; // internal copy -int PicoAHW = 0; // active addon hardware: scd_active, 32x_active, svp_active, pico_active -int PicoRegionOverride = 0; // override the region detection 0: Auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe -int PicoAutoRgnOrder = 0; -struct PicoSRAM SRam = {0,}; +int PicoAHW; // active addon hardware: PAHW_* +int PicoRegionOverride; // override the region detection 0: Auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe +int PicoAutoRgnOrder; + +struct PicoSRAM SRam; +int emustatus; // rapid_ym2612, multi_ym_updates +int scanlines_total; void (*PicoWriteSound)(int len) = NULL; // called at the best time to send sound buffer (PsndOut) to hardware void (*PicoResetHook)(void) = NULL; @@ -60,7 +61,7 @@ void PicoPower(void) Pico.m.frame_count = 0; // clear all memory of the emulated machine - memset(&Pico.ram,0,(unsigned int)&Pico.rom-(unsigned int)&Pico.ram); + memset(&Pico.ram,0,(unsigned char *)&Pico.rom - Pico.ram); memset(&Pico.video,0,sizeof(Pico.video)); memset(&Pico.m,0,sizeof(Pico.m)); @@ -76,7 +77,7 @@ void PicoPower(void) if (PicoAHW & PAHW_MCD) PicoPowerMCD(); - if (!(PicoOpt & POPT_DIS_32X)) + if (PicoOpt & POPT_EN_32X) PicoPower32x(); PicoReset(); @@ -191,7 +192,7 @@ int PicoReset(void) if (!(PicoOpt & POPT_DIS_IDLE_DET)) SekInitIdleDet(); - if (!(PicoOpt & POPT_DIS_32X)) { + if (PicoOpt & POPT_EN_32X) { PicoReset32x(); return 0; } @@ -208,6 +209,20 @@ int PicoReset(void) return 0; } +// flush cinfig changes before emu loop starts +void PicoLoopPrepare(void) +{ + if (PicoRegionOverride) + // force setting possibly changed.. + Pico.m.pal = (PicoRegionOverride == 2 || PicoRegionOverride == 8) ? 1 : 0; + + // FIXME: PAL has 313 scanlines.. + scanlines_total = Pico.m.pal ? 312 : 262; + + if (PicoAHW & PAHW_32X) + p32x_timers_recalc(); +} + // dma2vram settings are just hacks to unglitch Legend of Galahad (needs <= 104 to work) // same for Outrunners (92-121, when active is set to 24)