psxCpu = (Config.Cpu == CPU_INTERPRETER) ? &psxInt : &psxRec;
if (psxCpu != prev_cpu)
{
+ prev_cpu->Notify(R3000ACPU_NOTIFY_BEFORE_SAVE, NULL);
prev_cpu->Shutdown();
psxCpu->Init();
- psxCpu->Reset(); // not really a reset..
+ psxCpu->Reset();
+ psxCpu->Notify(R3000ACPU_NOTIFY_AFTER_LOAD, NULL);
}
}
#endif /* !DRC_DISABLE */
signal(SIGPIPE, SignalExit);
#endif
- GPU_clearDynarec(clearDynarec);
-
ret = CDR_open();
if (ret < 0) { SysMessage(_("Error opening CD-ROM plugin!")); return -1; }
ret = SPU_open();
psxCpu = &psxInt;
#endif
if (psxCpu != prev_cpu) {
+ prev_cpu->Notify(R3000ACPU_NOTIFY_BEFORE_SAVE, NULL);
prev_cpu->Shutdown();
psxCpu->Init();
- // note that this does not really reset, just clears drc caches
psxCpu->Reset();
+ psxCpu->Notify(R3000ACPU_NOTIFY_AFTER_LOAD, NULL);
}
menu_sync_config();
DIRECT_GPU(GPUgetScreenPic),
DIRECT_GPU(GPUshowScreenPic),
*/
-// DIRECT_GPU(GPUclearDynarec),
};
void *plugin_link(enum builtint_plugins_e id, const char *sym)
{
extern int stop;
- if (!booting)
- lightrec_plugin_sync_regs_from_pcsx();
-
while (!stop)
lightrec_plugin_execute_internal(false);
-
- lightrec_plugin_sync_regs_to_pcsx();
}
static void lightrec_plugin_execute_block(void)
lightrec_invalidate(lightrec_state, addr, size * 4);
}
-static void lightrec_plugin_notify(int note, void *data)
+static void lightrec_plugin_sync_regs_to_pcsx(void);
+static void lightrec_plugin_sync_regs_from_pcsx(void);
+
+static void lightrec_plugin_notify(enum R3000Anote note, void *data)
{
- /*
- To change once proper icache emulation is emulated
switch (note)
{
- case R3000ACPU_NOTIFY_CACHE_UNISOLATED:
- lightrec_plugin_clear(0, 0x200000/4);
- break;
- case R3000ACPU_NOTIFY_CACHE_ISOLATED:
- // Sent from psxDma3().
- case R3000ACPU_NOTIFY_DMA3_EXE_LOAD:
- default:
- break;
- }*/
+ case R3000ACPU_NOTIFY_CACHE_ISOLATED:
+ case R3000ACPU_NOTIFY_CACHE_UNISOLATED:
+ /* not used, lightrec calls lightrec_enable_ram() instead */
+ break;
+ case R3000ACPU_NOTIFY_BEFORE_SAVE:
+ lightrec_plugin_sync_regs_to_pcsx();
+ break;
+ case R3000ACPU_NOTIFY_AFTER_LOAD:
+ lightrec_plugin_sync_regs_from_pcsx();
+ break;
+ }
}
static void lightrec_plugin_apply_config()
regs->cp0[15] = 0x00000002; // PRevID = Revision ID, same as R3000A
}
-void lightrec_plugin_sync_regs_from_pcsx(void)
+static void lightrec_plugin_sync_regs_from_pcsx(void)
{
struct lightrec_registers *regs;
lightrec_invalidate_all(lightrec_state);
}
-void lightrec_plugin_sync_regs_to_pcsx(void)
+static void lightrec_plugin_sync_regs_to_pcsx(void)
{
struct lightrec_registers *regs;
#ifdef LIGHTREC
#define drc_is_lightrec() 1
-void lightrec_plugin_sync_regs_to_pcsx(void);
-void lightrec_plugin_sync_regs_from_pcsx(void);
#else /* if !LIGHTREC */
#define drc_is_lightrec() 0
-#define lightrec_plugin_sync_regs_to_pcsx()
-#define lightrec_plugin_sync_regs_from_pcsx()
#endif
#include "gpu.h"
#include "ppf.h"
#include "database.h"
-#include "lightrec/plugin.h"
#include <zlib.h>
char CdromId[10] = "";
f = SaveFuncs.open(file, "wb");
if (f == NULL) return -1;
- new_dyna_before_save();
-
- if (drc_is_lightrec() && Config.Cpu != CPU_INTERPRETER)
- lightrec_plugin_sync_regs_to_pcsx();
+ psxCpu->Notify(R3000ACPU_NOTIFY_BEFORE_SAVE, NULL);
SaveFuncs.write(f, (void *)PcsxHeader, 32);
SaveFuncs.write(f, (void *)&SaveVersion, sizeof(u32));
SaveFuncs.close(f);
- new_dyna_after_save();
-
return 0;
}
if (Config.HLE)
psxBiosInit();
- if (!drc_is_lightrec() || Config.Cpu == CPU_INTERPRETER)
- psxCpu->Reset();
SaveFuncs.seek(f, 128 * 96 * 3, SEEK_CUR);
-
SaveFuncs.read(f, psxM, 0x00200000);
SaveFuncs.read(f, psxR, 0x00080000);
SaveFuncs.read(f, psxH, 0x00010000);
SaveFuncs.read(f, &psxRegs, offsetof(psxRegisters, gteBusyCycle));
psxRegs.gteBusyCycle = psxRegs.cycle;
- if (drc_is_lightrec() && Config.Cpu != CPU_INTERPRETER)
- lightrec_plugin_sync_regs_from_pcsx();
+ psxCpu->Notify(R3000ACPU_NOTIFY_AFTER_LOAD, NULL);
if (Config.HLE)
psxBiosFreeze(0);
SysClose(); return -1;
}
psxCpu->Reset();
+ psxCpu->Notify(R3000ACPU_NOTIFY_AFTER_LOAD, NULL);
}
return 0;
MTC0(&psxRegs, reg, val);
}
-void new_dyna_before_save(void)
-{
- psxRegs.interrupt &= ~(1 << PSXINT_RCNT); // old savestate compat
-
- // psxRegs.intCycle is always maintained, no need to convert
-}
-
-void new_dyna_after_save(void)
-{
- psxRegs.interrupt |= 1 << PSXINT_RCNT;
-}
-
static void new_dyna_restore(void)
{
int i;
static void ari64_reset()
{
- printf("ari64_reset\n");
new_dyna_pcsx_mem_reset();
new_dynarec_invalidate_all_pages();
new_dyna_restore();
new_dynarec_invalidate_range(addr, addr + size);
}
-static void ari64_notify(int note, void *data) {
+static void ari64_notify(enum R3000Anote note, void *data) {
switch (note)
{
case R3000ACPU_NOTIFY_CACHE_UNISOLATED:
case R3000ACPU_NOTIFY_CACHE_ISOLATED:
new_dyna_pcsx_mem_isolate(note == R3000ACPU_NOTIFY_CACHE_ISOLATED);
break;
- default:
+ case R3000ACPU_NOTIFY_BEFORE_SAVE:
+ break;
+ case R3000ACPU_NOTIFY_AFTER_LOAD:
+ ari64_reset();
break;
}
}
GPUfreeze GPU_freeze;
GPUgetScreenPic GPU_getScreenPic;
GPUshowScreenPic GPU_showScreenPic;
-GPUclearDynarec GPU_clearDynarec;
GPUvBlank GPU_vBlank;
CDRinit CDR_init;
void CALLBACK GPU__keypressed(int key) {}
long CALLBACK GPU__getScreenPic(unsigned char *pMem) { return -1; }
long CALLBACK GPU__showScreenPic(unsigned char *pMem) { return -1; }
-void CALLBACK GPU__clearDynarec(void (CALLBACK *callback)(void)) {}
void CALLBACK GPU__vBlank(int val) {}
#define LoadGpuSym1(dest, name) \
LoadGpuSym1(freeze, "GPUfreeze");
LoadGpuSym0(getScreenPic, "GPUgetScreenPic");
LoadGpuSym0(showScreenPic, "GPUshowScreenPic");
- LoadGpuSym0(clearDynarec, "GPUclearDynarec");
LoadGpuSym0(vBlank, "GPUvBlank");
LoadGpuSym0(configure, "GPUconfigure");
LoadGpuSym0(test, "GPUtest");
#endif
-void CALLBACK clearDynarec(void) {
- psxCpu->Reset();
-}
-
int LoadPlugins() {
int ret;
char Plugin[MAXPATHLEN * 2];
typedef long (CALLBACK* GPUfreeze)(uint32_t, GPUFreeze_t *);\r
typedef long (CALLBACK* GPUgetScreenPic)(unsigned char *);\r
typedef long (CALLBACK* GPUshowScreenPic)(unsigned char *);\r
-typedef void (CALLBACK* GPUclearDynarec)(void (CALLBACK *callback)(void));\r
typedef void (CALLBACK* GPUvBlank)(int, int);\r
\r
// GPU function pointers\r
extern GPUfreeze GPU_freeze;\r
extern GPUgetScreenPic GPU_getScreenPic;\r
extern GPUshowScreenPic GPU_showScreenPic;\r
-extern GPUclearDynarec GPU_clearDynarec;\r
extern GPUvBlank GPU_vBlank;\r
\r
// CD-ROM Functions\r
\r
#endif\r
\r
-void CALLBACK clearDynarec(void);\r
-\r
void SetIsoFile(const char *filename);\r
const char *GetIsoFile(void);\r
boolean UsingIso(void);\r
}
static void intReset() {
- memset(&ICache, 0xff, sizeof(ICache));
}
static inline void execI_(u8 **memRLUT, psxRegisters *regs_) {
static void intClear(u32 Addr, u32 Size) {
}
-void intNotify (int note, void *data) {
- /* Armored Core won't boot without this */
- if (note == R3000ACPU_NOTIFY_CACHE_ISOLATED)
- {
+static void intNotify(enum R3000Anote note, void *data) {
+ switch (note) {
+ case R3000ACPU_NOTIFY_CACHE_ISOLATED: // Armored Core?
+ case R3000ACPU_NOTIFY_AFTER_LOAD:
memset(&ICache, 0xff, sizeof(ICache));
+ break;
+ case R3000ACPU_NOTIFY_CACHE_UNISOLATED:
+ case R3000ACPU_NOTIFY_BEFORE_SAVE:
+ break;
}
}
#include "psxcounters.h"
#include "psxbios.h"
-enum {
+enum R3000Anote {
R3000ACPU_NOTIFY_CACHE_ISOLATED = 0,
R3000ACPU_NOTIFY_CACHE_UNISOLATED = 1,
+ R3000ACPU_NOTIFY_BEFORE_SAVE,
+ R3000ACPU_NOTIFY_AFTER_LOAD,
};
typedef struct {
void (*Execute)(); /* executes up to a break */
void (*ExecuteBlock)(); /* executes up to a jump */
void (*Clear)(u32 Addr, u32 Size);
- void (*Notify)(int note, void *data);
+ void (*Notify)(enum R3000Anote note, void *data);
void (*ApplyConfig)();
void (*Shutdown)();
} R3000Acpu;
extern u32 event_cycles[PSXINT_COUNT];
extern u32 next_interupt;
-void new_dyna_before_save(void);
-void new_dyna_after_save(void);
void new_dyna_freeze(void *f, int mode);
#define new_dyna_set_event_abs(e, abs) { \