mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 15:48:05 -04:00
bugfixes, state load for new mode
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@468 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
538a6098d4
commit
453d2a6eda
9 changed files with 32 additions and 44 deletions
|
@ -159,7 +159,7 @@ static int PicoAreaScan(int PmovAction,unsigned int ver, void *PmovFile)
|
|||
ScanVar(sn76496_regs,28*4,"SN76496state", PmovFile, PmovAction); // regs and other stuff
|
||||
if(PicoOpt&1) {
|
||||
ScanVar(ym2612_regs, 0x200+4, "YM2612state", PmovFile, PmovAction); // regs + addr line
|
||||
if((PmovAction&3)==2) YM2612PicoStateLoad(); // reload YM2612 state from it's regs
|
||||
if((PmovAction&3)==2) ym2612_unpack_state(); // reload YM2612 state from it's regs
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -712,7 +712,7 @@ static void PicoCartDetect(void)
|
|||
}
|
||||
|
||||
// Unusual region 'code'
|
||||
if (rom_strcmp(0x1f0, "EUROPE") == 0)
|
||||
if (rom_strcmp(0x1f0, "EUROPE") == 0 || rom_strcmp(0x1f0, "Europe") == 0)
|
||||
*(int *) (Pico.rom+0x1f0) = 0x20204520;
|
||||
}
|
||||
|
||||
|
|
|
@ -883,14 +883,13 @@ int ym2612_write_local(u32 a, u32 d, int is_from_z80)
|
|||
return YM2612Write_(a, d);
|
||||
}
|
||||
|
||||
// TODO: savestates
|
||||
|
||||
#define ym2612_read_local() \
|
||||
if (xcycles >= timer_a_next_oflow) \
|
||||
ym2612.OPN.ST.status |= (ym2612.OPN.ST.mode >> 2) & 1; \
|
||||
if (xcycles >= timer_b_next_oflow) \
|
||||
ym2612.OPN.ST.status |= (ym2612.OPN.ST.mode >> 2) & 2
|
||||
|
||||
|
||||
u32 ym2612_read_local_z80(void)
|
||||
{
|
||||
int xcycles = z80_cyclesDone() << 8;
|
||||
|
@ -913,6 +912,23 @@ u32 ym2612_read_local_68k(void)
|
|||
return ym2612.OPN.ST.status;
|
||||
}
|
||||
|
||||
// TODO: new ym2612 savestates
|
||||
void ym2612_unpack_state(void)
|
||||
{
|
||||
int i;
|
||||
YM2612PicoStateLoad();
|
||||
|
||||
// feed all the registers and update internal state
|
||||
for (i = 0x20; i < 0xC0; i++) {
|
||||
ym2612_write_local(0, i, 0);
|
||||
ym2612_write_local(1, ym2612.REGS[i], 0);
|
||||
}
|
||||
for (i = 0x30; i < 0xC0; i++) {
|
||||
ym2612_write_local(2, i, 0);
|
||||
ym2612_write_local(3, ym2612.REGS[i|0x100], 0);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// z80 memhandlers
|
||||
|
||||
|
|
|
@ -479,6 +479,7 @@ extern int timer_a_next_oflow, timer_a_step, timer_a_offset; // in z80 cycles
|
|||
extern int timer_b_next_oflow, timer_b_step, timer_b_offset;
|
||||
|
||||
void ym2612_sync_timers(int z80_cycles, int mode_old, int mode_new);
|
||||
void ym2612_unpack_state(void);
|
||||
|
||||
#define timers_cycle() \
|
||||
if (timer_a_next_oflow > 0 && timer_a_next_oflow < 0x70000000) \
|
||||
|
|
|
@ -230,7 +230,7 @@ PICO_INTERNAL int PicoCdLoadState(void *file)
|
|||
case CHUNK_PSG: CHECKED_READ2(28*4, sn76496_regs); break;
|
||||
case CHUNK_FM:
|
||||
CHECKED_READ2(0x200+4, ym2612_regs);
|
||||
YM2612PicoStateLoad();
|
||||
ym2612_unpack_state();
|
||||
break;
|
||||
|
||||
// cd stuff
|
||||
|
|
|
@ -140,7 +140,7 @@ void PsndRerate(int preserve_state)
|
|||
if (preserve_state) {
|
||||
// feed it back it's own registers, just like after loading state
|
||||
memcpy(YM2612GetRegs(), state, 0x200);
|
||||
YM2612PicoStateLoad();
|
||||
ym2612_unpack_state();
|
||||
if ((PicoAHW & PAHW_MCD) && !(Pico_mcd->s68k_regs[0x36] & 1) && (Pico_mcd->scd.Status_CDC & 1))
|
||||
cdda_start_play();
|
||||
}
|
||||
|
|
|
@ -1863,26 +1863,7 @@ int YM2612PicoTick_(int n)
|
|||
|
||||
void YM2612PicoStateLoad_(void)
|
||||
{
|
||||
#ifndef EXTERNAL_YM2612
|
||||
int i, real_A1 = ym2612.addr_A1;
|
||||
|
||||
reset_channels( &ym2612.CH[0] );
|
||||
|
||||
// feed all the registers and update internal state
|
||||
for(i = 0; i < 0x100; i++) {
|
||||
YM2612Write_(0, i);
|
||||
YM2612Write_(1, ym2612.REGS[i]);
|
||||
}
|
||||
|
||||
for(i = 0; i < 0x100; i++) {
|
||||
YM2612Write_(2, i);
|
||||
YM2612Write_(3, ym2612.REGS[i|0x100]);
|
||||
}
|
||||
|
||||
ym2612.addr_A1 = real_A1;
|
||||
#else
|
||||
reset_channels( &ym2612.CH[0] );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef EXTERNAL_YM2612
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue