X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fpico.c;h=96025fff739d6bdf9974a2aead01f728902fe42e;hb=ae87bffa0696eeb18ffb8d283992bc3881e8f241;hp=f2da10b686df6e95952190085164cb72c307db5f;hpb=45f2f245f51ef0c0d37df3c998595c132bfcaffa;p=picodrive.git diff --git a/pico/pico.c b/pico/pico.c index f2da10b..96025ff 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; @@ -40,6 +41,7 @@ void PicoInit(void) PicoInitMCD(); PicoSVPInit(); + Pico32xInit(); } // to be called once on emu exit @@ -75,6 +77,9 @@ void PicoPower(void) if (PicoAHW & PAHW_MCD) PicoPowerMCD(); + if (PicoOpt & POPT_EN_32X) + PicoPower32x(); + PicoReset(); } @@ -187,6 +192,11 @@ int PicoReset(void) if (!(PicoOpt & POPT_DIS_IDLE_DET)) SekInitIdleDet(); + if (PicoOpt & POPT_EN_32X) { + PicoReset32x(); + return 0; + } + // reset sram state; enable sram access by default if it doesn't overlap with ROM Pico.m.sram_reg = 0; if ((SRam.flags & SRF_EEPROM) || Pico.romsize <= SRam.start) @@ -199,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) @@ -296,11 +320,17 @@ void PicoFrame(void) return; } + // TODO: MCD+32X if (PicoAHW & PAHW_MCD) { PicoFrameMCD(); return; } + if (PicoAHW & PAHW_32X) { + PicoFrame32x(); + return; + } + //if(Pico.video.reg[12]&0x2) Pico.video.status ^= 0x10; // change odd bit in interlace mode PicoFrameStart();