From c62b43c9f32d79116225247acf09ccd30d4d658b Mon Sep 17 00:00:00 2001 From: notaz Date: Thu, 23 Dec 2010 01:52:12 +0200 Subject: [PATCH] init some forgotten stuff otherwise glitches happen if certain games are ran in a row. --- libpcsxcore/cdrom.c | 1 + libpcsxcore/mdec.c | 9 ++++----- libpcsxcore/psxbios.c | 11 +++++++++++ libpcsxcore/psxcounters.c | 3 +++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index ae59a63e..0e033db7 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -1123,6 +1123,7 @@ void cdrReset() { cdr.CurTrack = 1; cdr.File = 1; cdr.Channel = 1; + memset(&stat, 0, sizeof(stat)); } int cdrFreeze(gzFile f, int Mode) { diff --git a/libpcsxcore/mdec.c b/libpcsxcore/mdec.c index 629816bc..b25b9612 100644 --- a/libpcsxcore/mdec.c +++ b/libpcsxcore/mdec.c @@ -219,7 +219,7 @@ struct _pending_dma1 { u32 chcr; }; -struct { +static struct { u32 reg0; u32 reg1; u16 * rl; @@ -436,11 +436,10 @@ static void yuv2rgb24(int *blk, u8 *image) { } void mdecInit(void) { + memset(&mdec, 0, sizeof(mdec)); + memset(iq_y, 0, sizeof(iq_y)); + memset(iq_uv, 0, sizeof(iq_uv)); mdec.rl = (u16 *)&psxM[0x100000]; - mdec.reg0 = 0; - mdec.reg1 = 0; - mdec.pending_dma1.adr = 0; - mdec.block_buffer_pos = 0; } // command register diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index b135b522..005e1bb8 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -2545,6 +2545,17 @@ void psxBiosInit() { memset(Thread, 0, sizeof(Thread)); Thread[0].status = 2; // main thread + jmp_int = NULL; + pad_buf = NULL; + pad_buf1 = NULL; + pad_buf2 = NULL; + pad_buf1len = pad_buf2len = 0; + heap_addr = NULL; + heap_end = NULL; + CardState = -1; + CurThread = 0; + memset(FDesc, 0, sizeof(FDesc)); + psxMu32ref(0x0150) = SWAPu32(0x160); psxMu32ref(0x0154) = SWAPu32(0x320); psxMu32ref(0x0160) = SWAPu32(0x248); diff --git a/libpcsxcore/psxcounters.c b/libpcsxcore/psxcounters.c index ebfe6296..c9f29315 100644 --- a/libpcsxcore/psxcounters.c +++ b/libpcsxcore/psxcounters.c @@ -461,6 +461,9 @@ void psxRcntInit() _psxRcntWcount( i, 0 ); } + hSyncCount = 0; + spuSyncCount = 0; + psxRcntSet(); } -- 2.39.2