#include "gpu.h"
#include "ppf.h"
#include "database.h"
+#include "lightrec/plugin.h"
#include <zlib.h>
char CdromId[10] = "";
char name [1];
};
-void mmssdd( char *b, char *p )
+static void mmssdd( char *b, char *p )
{
int m, s, d;
-#if defined(__arm__)
- unsigned char *u = (void *)b;
- int block = (u[3] << 24) | (u[2] << 16) | (u[1] << 8) | u[0];
-#elif defined(__BIGENDIAN__)
- int block = (b[0] & 0xff) | ((b[1] & 0xff) << 8) | ((b[2] & 0xff) << 16) | (b[3] << 24);
-#else
- int block = *((int*)b);
-#endif
+ unsigned char *ub = (void *)b;
+ int block = (ub[3] << 24) | (ub[2] << 16) | (ub[1] << 8) | ub[0];
block += 150;
m = block / 4500; // minutes
time[0] = itob(time[0]); time[1] = itob(time[1]); time[2] = itob(time[2]);
#define READTRACK() \
- if (CDR_readTrack(time) == -1) return -1; \
+ if (!CDR_readTrack(time)) return -1; \
buf = (void *)CDR_getBuffer(); \
if (buf == NULL) return -1; \
else CheckPPFCache((u8 *)buf, time[0], time[1], time[2]);
// If you make changes to the savestate version, please increment the value below.
static const u32 SaveVersion = 0x8b410006;
-static int drc_is_lightrec(void)
-{
-#if defined(LIGHTREC)
- return 1;
-#else
- return 0;
-#endif
-}
-
int SaveState(const char *file) {
void *f;
GPUFreeze_t *gpufP;
new_dyna_before_save();
if (drc_is_lightrec() && Config.Cpu != CPU_INTERPRETER)
- lightrec_plugin_prepare_save_state();
+ lightrec_plugin_sync_regs_to_pcsx();
SaveFuncs.write(f, (void *)PcsxHeader, 32);
SaveFuncs.write(f, (void *)&SaveVersion, sizeof(u32));
psxRegs.gteBusyCycle = psxRegs.cycle;
if (drc_is_lightrec() && Config.Cpu != CPU_INTERPRETER)
- lightrec_plugin_prepare_load_state();
+ lightrec_plugin_sync_regs_from_pcsx();
if (Config.HLE)
psxBiosFreeze(0);
GPU_freeze(0, gpufP);
free(gpufP);
if (HW_GPU_STATUS == 0)
- HW_GPU_STATUS = GPU_readStatus();
+ HW_GPU_STATUS = SWAP32(GPU_readStatus());
// spu
SaveFuncs.read(f, &Size, 4);
if (NET_recvData == NULL || NET_sendData == NULL)
return 0;
+ boolean Sio_old = 0;
+ boolean SpuIrq_old = 0;
+ boolean RCntFix_old = 0;
NET_sendData(&Config.Xa, sizeof(Config.Xa), PSE_NET_BLOCKING);
- NET_sendData(&Config.Sio, sizeof(Config.Sio), PSE_NET_BLOCKING);
- NET_sendData(&Config.SpuIrq, sizeof(Config.SpuIrq), PSE_NET_BLOCKING);
- NET_sendData(&Config.RCntFix, sizeof(Config.RCntFix), PSE_NET_BLOCKING);
+ NET_sendData(&Sio_old, sizeof(Sio_old), PSE_NET_BLOCKING);
+ NET_sendData(&SpuIrq_old, sizeof(SpuIrq_old), PSE_NET_BLOCKING);
+ NET_sendData(&RCntFix_old, sizeof(RCntFix_old), PSE_NET_BLOCKING);
NET_sendData(&Config.PsxType, sizeof(Config.PsxType), PSE_NET_BLOCKING);
NET_sendData(&Config.Cpu, sizeof(Config.Cpu), PSE_NET_BLOCKING);
if (NET_recvData == NULL || NET_sendData == NULL)
return 0;
+ boolean Sio_old = 0;
+ boolean SpuIrq_old = 0;
+ boolean RCntFix_old = 0;
NET_recvData(&Config.Xa, sizeof(Config.Xa), PSE_NET_BLOCKING);
- NET_recvData(&Config.Sio, sizeof(Config.Sio), PSE_NET_BLOCKING);
- NET_recvData(&Config.SpuIrq, sizeof(Config.SpuIrq), PSE_NET_BLOCKING);
- NET_recvData(&Config.RCntFix, sizeof(Config.RCntFix), PSE_NET_BLOCKING);
+ NET_recvData(&Sio_old, sizeof(Sio_old), PSE_NET_BLOCKING);
+ NET_recvData(&SpuIrq_old, sizeof(SpuIrq_old), PSE_NET_BLOCKING);
+ NET_recvData(&RCntFix_old, sizeof(RCntFix_old), PSE_NET_BLOCKING);
NET_recvData(&Config.PsxType, sizeof(Config.PsxType), PSE_NET_BLOCKING);
SysUpdate();