X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fcd%2FArea.c;h=ea4220e554ea582eb50c0e1f14d2ca885151c07f;hb=e28a980fb7737edcf70fbce20c77b64fa14264a2;hp=51da6160f4efa63b69e704e6577cf6fc44a5186b;hpb=860c6322c346c8e2ec2a4626e79f26d8b0d23777;p=picodrive.git diff --git a/Pico/cd/Area.c b/Pico/cd/Area.c index 51da616..ea4220e 100644 --- a/Pico/cd/Area.c +++ b/Pico/cd/Area.c @@ -1,9 +1,5 @@ -// This is part of Pico Library - -// (c) Copyright 2007 notaz, All rights reserved. -// Free for non-commercial use. - -// For commercial use, separate licencing terms must be obtained. +// Savestate handling for emulated Sega/Mega CD machine. +// (c) Copyright 2007, Grazvydas "notaz" Ignotas #include "../PicoInt.h" @@ -92,7 +88,7 @@ static int write_chunk(chunk_name_e name, int len, void *data, void *file) if (PicoStateProgressCB) PicoStateProgressCB(chunk_names[name]); \ if (!write_chunk(name, sizeof(buff), &buff, file)) return 1; -int PicoCdSaveState(void *file) +PICO_INTERNAL int PicoCdSaveState(void *file) { unsigned char buff[0x60]; void *ym2612_regs = YM2612GetRegs(); @@ -172,7 +168,7 @@ static int g_read_offs = 0; #define CHECKED_READ_BUFF(buff) CHECKED_READ2(sizeof(buff), &buff); -int PicoCdLoadState(void *file) +PICO_INTERNAL int PicoCdLoadState(void *file) { unsigned char buff[0x60]; int ver, len; @@ -243,7 +239,13 @@ int PicoCdLoadState(void *file) /* after load events */ if (Pico_mcd->s68k_regs[3]&4) // 1M mode? wram_2M_to_1M(Pico_mcd->word_ram2M); - mp3_start_play(Pico_mcd->TOC.Tracks[Pico_mcd->m.audio_track].F, Pico_mcd->m.audio_offset); +#ifdef _ASM_CD_MEMORY_C + PicoMemResetCD(Pico_mcd->s68k_regs[3]); + if (Pico_mcd->s68k_regs[3]&4) + PicoMemResetCDdecode(Pico_mcd->s68k_regs[3]); +#endif + if (Pico_mcd->m.audio_track > 0 && Pico_mcd->m.audio_track < Pico_mcd->TOC.Last_Track) + mp3_start_play(Pico_mcd->TOC.Tracks[Pico_mcd->m.audio_track].F, Pico_mcd->m.audio_offset); // restore hint vector *(unsigned short *)(Pico_mcd->bios + 0x72) = Pico_mcd->m.hint_vector;