mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
cd: fix yet more desyncs
state load, reset..
This commit is contained in:
parent
33be04ca5f
commit
8e4e84c215
3 changed files with 19 additions and 9 deletions
|
@ -203,7 +203,6 @@ void PicoUnload32x(void)
|
||||||
void PicoReset32x(void)
|
void PicoReset32x(void)
|
||||||
{
|
{
|
||||||
if (PicoAHW & PAHW_32X) {
|
if (PicoAHW & PAHW_32X) {
|
||||||
msh2.m68krcycles_done = ssh2.m68krcycles_done = SekCyclesDone();
|
|
||||||
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);
|
||||||
|
|
|
@ -30,6 +30,8 @@ PICO_INTERNAL void PicoExitMCD(void)
|
||||||
|
|
||||||
PICO_INTERNAL void PicoPowerMCD(void)
|
PICO_INTERNAL void PicoPowerMCD(void)
|
||||||
{
|
{
|
||||||
|
SekCycleCntS68k = SekCycleAimS68k = 0;
|
||||||
|
|
||||||
int fmt_size = sizeof(formatted_bram);
|
int fmt_size = sizeof(formatted_bram);
|
||||||
memset(Pico_mcd->prg_ram, 0, sizeof(Pico_mcd->prg_ram));
|
memset(Pico_mcd->prg_ram, 0, sizeof(Pico_mcd->prg_ram));
|
||||||
memset(Pico_mcd->word_ram2M, 0, sizeof(Pico_mcd->word_ram2M));
|
memset(Pico_mcd->word_ram2M, 0, sizeof(Pico_mcd->word_ram2M));
|
||||||
|
@ -110,6 +112,14 @@ static __inline void SekRunS68k(unsigned int to)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pcd_set_cycle_mult(void)
|
||||||
|
{
|
||||||
|
// ~1.63 for NTSC, ~1.645 for PAL
|
||||||
|
if (Pico.m.pal)
|
||||||
|
m68k_cycle_mult = ((12500000ull << 16) / (50*312*488));
|
||||||
|
else
|
||||||
|
m68k_cycle_mult = ((12500000ull << 16) / (60*262*488)) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int pcd_cycles_m68k_to_s68k(unsigned int c)
|
unsigned int pcd_cycles_m68k_to_s68k(unsigned int c)
|
||||||
{
|
{
|
||||||
|
@ -302,12 +312,7 @@ PICO_INTERNAL void PicoFrameMCD(void)
|
||||||
if (!(PicoOpt&POPT_ALT_RENDERER))
|
if (!(PicoOpt&POPT_ALT_RENDERER))
|
||||||
PicoFrameStart();
|
PicoFrameStart();
|
||||||
|
|
||||||
// ~1.63 for NTSC, ~1.645 for PAL
|
pcd_set_cycle_mult();
|
||||||
if (Pico.m.pal)
|
|
||||||
m68k_cycle_mult = ((12500000ull << 16) / (50*312*488));
|
|
||||||
else
|
|
||||||
m68k_cycle_mult = ((12500000ull << 16) / (60*262*488)) + 1;
|
|
||||||
|
|
||||||
PicoFrameHints();
|
PicoFrameHints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,6 +321,7 @@ void pcd_state_loaded(void)
|
||||||
unsigned int cycles;
|
unsigned int cycles;
|
||||||
int diff;
|
int diff;
|
||||||
|
|
||||||
|
pcd_set_cycle_mult();
|
||||||
pcd_state_loaded_mem();
|
pcd_state_loaded_mem();
|
||||||
|
|
||||||
memset(Pico_mcd->pcm_mixbuf, 0, sizeof(Pico_mcd->pcm_mixbuf));
|
memset(Pico_mcd->pcm_mixbuf, 0, sizeof(Pico_mcd->pcm_mixbuf));
|
||||||
|
@ -346,6 +352,10 @@ void pcd_state_loaded(void)
|
||||||
}
|
}
|
||||||
if (Pico_mcd->pcm.update_cycles == 0)
|
if (Pico_mcd->pcm.update_cycles == 0)
|
||||||
Pico_mcd->pcm.update_cycles = cycles;
|
Pico_mcd->pcm.update_cycles = cycles;
|
||||||
|
|
||||||
|
// reschedule
|
||||||
|
event_time_next = 0;
|
||||||
|
pcd_run_events(SekCycleCntS68k);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim:shiftwidth=2:ts=2:expandtab
|
// vim:shiftwidth=2:ts=2:expandtab
|
||||||
|
|
|
@ -61,6 +61,7 @@ void PicoExit(void)
|
||||||
void PicoPower(void)
|
void PicoPower(void)
|
||||||
{
|
{
|
||||||
Pico.m.frame_count = 0;
|
Pico.m.frame_count = 0;
|
||||||
|
SekCycleCnt = SekCycleAim = 0;
|
||||||
|
|
||||||
// clear all memory of the emulated machine
|
// clear all memory of the emulated machine
|
||||||
memset(&Pico.ram,0,(unsigned char *)&Pico.rom - Pico.ram);
|
memset(&Pico.ram,0,(unsigned char *)&Pico.rom - Pico.ram);
|
||||||
|
@ -167,15 +168,15 @@ int PicoReset(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
SekReset();
|
SekReset();
|
||||||
|
// ..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(PicoAHW & PAHW_MCD);
|
||||||
SekCycleCnt = SekCycleAim = 0;
|
|
||||||
|
|
||||||
Pico.m.dirtyPal = 1;
|
Pico.m.dirtyPal = 1;
|
||||||
|
|
||||||
Pico.m.z80_bank68k = 0;
|
Pico.m.z80_bank68k = 0;
|
||||||
Pico.m.z80_reset = 1;
|
Pico.m.z80_reset = 1;
|
||||||
memset(Pico.zram, 0, sizeof(Pico.zram)); // ??
|
|
||||||
|
|
||||||
PicoDetectRegion();
|
PicoDetectRegion();
|
||||||
Pico.video.status = 0x3428 | Pico.m.pal; // 'always set' bits | vblank | collision | pal
|
Pico.video.status = 0x3428 | Pico.m.pal; // 'always set' bits | vblank | collision | pal
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue