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)
f = SaveFuncs.open(file, "wb");
if (f == NULL) return -1;
- new_dyna_before_save();
+ 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();
- 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;
+ 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;\r
GPUgetScreenPic GPU_getScreenPic;\r
GPUshowScreenPic GPU_showScreenPic;\r
-GPUclearDynarec GPU_clearDynarec;\r
GPUvBlank GPU_vBlank;\r
\r
CDRinit CDR_init;\r
void CALLBACK GPU__keypressed(int key) {}\r
long CALLBACK GPU__getScreenPic(unsigned char *pMem) { return -1; }\r
long CALLBACK GPU__showScreenPic(unsigned char *pMem) { return -1; }\r
-void CALLBACK GPU__clearDynarec(void (CALLBACK *callback)(void)) {}\r
void CALLBACK GPU__vBlank(int val) {}\r
\r
#define LoadGpuSym1(dest, name) \\r
LoadGpuSym1(freeze, "GPUfreeze");\r
LoadGpuSym0(getScreenPic, "GPUgetScreenPic");\r
LoadGpuSym0(showScreenPic, "GPUshowScreenPic");\r
- LoadGpuSym0(clearDynarec, "GPUclearDynarec");\r
LoadGpuSym0(vBlank, "GPUvBlank");\r
LoadGpuSym0(configure, "GPUconfigure");\r
LoadGpuSym0(test, "GPUtest");\r
\r
#endif\r
\r
-void CALLBACK clearDynarec(void) {\r
- psxCpu->Reset();\r
-}\r
-\r
int LoadPlugins() {\r
int ret;\r
char Plugin[MAXPATHLEN * 2];\r
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) { \