aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore
diff options
context:
space:
mode:
authornotaz2012-11-05 03:11:29 +0200
committernotaz2012-11-05 03:12:26 +0200
commit8e1040b6a82ee1802fda83d4de84290a02656cc0 (patch)
treefb0c25827d3a42e8219ec6f5a50598435a4f1748 /libpcsxcore
parente0aec5eebf0fefe7a7314940546ef8a23d2169b7 (diff)
downloadpcsx_rearmed-8e1040b6a82ee1802fda83d4de84290a02656cc0.tar.gz
pcsx_rearmed-8e1040b6a82ee1802fda83d4de84290a02656cc0.tar.bz2
pcsx_rearmed-8e1040b6a82ee1802fda83d4de84290a02656cc0.zip
sort out 32/64bit savestate compat issues
Diffstat (limited to 'libpcsxcore')
-rw-r--r--libpcsxcore/cdrom.c23
-rw-r--r--libpcsxcore/cdrom.h2
-rw-r--r--libpcsxcore/mdec.c25
3 files changed, 37 insertions, 13 deletions
diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c
index 3bf3e03..1aa958b 100644
--- a/libpcsxcore/cdrom.c
+++ b/libpcsxcore/cdrom.c
@@ -26,6 +26,7 @@
#include "psxdma.h"
cdrStruct cdr;
+static unsigned char *pTransfer;
/* CD-ROM magic numbers */
#define CdlSync 0
@@ -1832,7 +1833,7 @@ unsigned char cdrRead2(void) {
if (cdr.Readed == 0) {
ret = 0;
} else {
- ret = *cdr.pTransfer++;
+ ret = *pTransfer++;
}
#ifdef CDR_LOG
@@ -1948,16 +1949,16 @@ void cdrWrite3(unsigned char rt) {
if (rt == 0x80 && !(cdr.Ctrl & 0x3) && cdr.Readed == 0) {
cdr.Readed = 1;
- cdr.pTransfer = cdr.Transfer;
+ pTransfer = cdr.Transfer;
switch (cdr.Mode & 0x30) {
case MODE_SIZE_2328:
case 0x00:
- cdr.pTransfer += 12;
+ pTransfer += 12;
break;
case MODE_SIZE_2340:
- cdr.pTransfer += 0;
+ pTransfer += 0;
break;
default:
@@ -2013,16 +2014,16 @@ void psxDma3(u32 madr, u32 bcr, u32 chcr) {
- CdlPlay
- Spams DMA3 and gets buffer overrun
*/
- size = CD_FRAMESIZE_RAW - (cdr.pTransfer - cdr.Transfer);
+ size = CD_FRAMESIZE_RAW - (pTransfer - cdr.Transfer);
if (size > cdsize)
size = cdsize;
if (size > 0)
{
- memcpy(ptr, cdr.pTransfer, size);
+ memcpy(ptr, pTransfer, size);
}
psxCpu->Clear(madr, cdsize / 4);
- cdr.pTransfer += cdsize;
+ pTransfer += cdsize;
// burst vs normal
@@ -2059,6 +2060,7 @@ void cdrReset() {
cdr.CurTrack = 1;
cdr.File = 1;
cdr.Channel = 1;
+ pTransfer = cdr.Transfer;
// BIOS player - default values
cdr.AttenuatorLeft[0] = 0x80;
@@ -2068,8 +2070,7 @@ void cdrReset() {
}
int cdrFreeze(gzFile f, int Mode) {
- uintptr_t tmp;
-
+ u32 tmp;
if( Mode == 0 ) {
StopCdda();
@@ -2078,12 +2079,12 @@ int cdrFreeze(gzFile f, int Mode) {
gzfreeze(&cdr, sizeof(cdr));
if (Mode == 1)
- tmp = cdr.pTransfer - cdr.Transfer;
+ tmp = pTransfer - cdr.Transfer;
gzfreeze(&tmp, sizeof(tmp));
if (Mode == 0) {
- cdr.pTransfer = cdr.Transfer + tmp;
+ pTransfer = cdr.Transfer + tmp;
if (cdr.Play && !Config.Cdda)
CDR_play(cdr.SetSectorPlay);
diff --git a/libpcsxcore/cdrom.h b/libpcsxcore/cdrom.h
index 772e3ca..fde7f21 100644
--- a/libpcsxcore/cdrom.h
+++ b/libpcsxcore/cdrom.h
@@ -52,7 +52,7 @@ typedef struct {
unsigned char StatP;
unsigned char Transfer[CD_FRAMESIZE_RAW];
- unsigned char *pTransfer;
+ unsigned int pad1;
unsigned char Prev[4];
unsigned char Param[8];
diff --git a/libpcsxcore/mdec.c b/libpcsxcore/mdec.c
index 6cf2886..cd8d3bf 100644
--- a/libpcsxcore/mdec.c
+++ b/libpcsxcore/mdec.c
@@ -672,7 +672,30 @@ void mdec1Interrupt() {
}
int mdecFreeze(gzFile f, int Mode) {
- gzfreeze(&mdec, sizeof(mdec));
+ u8 *base = (u8 *)&psxM[0x100000];
+ u32 v;
+
+ gzfreeze(&mdec.reg0, sizeof(mdec.reg0));
+ gzfreeze(&mdec.reg1, sizeof(mdec.reg1));
+
+ // old code used to save raw pointers..
+ v = (u8 *)mdec.rl - base;
+ gzfreeze(&v, sizeof(v));
+ mdec.rl = (u16 *)(base + (v & 0xffffe));
+ v = (u8 *)mdec.rl_end - base;
+ gzfreeze(&v, sizeof(v));
+ mdec.rl_end = (u16 *)(base + (v & 0xffffe));
+
+ v = 0;
+ if (mdec.block_buffer_pos)
+ v = mdec.block_buffer_pos - base;
+ gzfreeze(&v, sizeof(v));
+ mdec.block_buffer_pos = 0;
+ if (v)
+ mdec.block_buffer_pos = base + (v & 0xfffff);
+
+ gzfreeze(&mdec.block_buffer, sizeof(mdec.block_buffer));
+ gzfreeze(&mdec.pending_dma1, sizeof(mdec.pending_dma1));
gzfreeze(iq_y, sizeof(iq_y));
gzfreeze(iq_uv, sizeof(iq_uv));