Re-recorder updates

This commit is contained in:
Toni Wilen 2023-05-16 20:05:48 +03:00
parent 63df7cec8b
commit efd80dd39a
5 changed files with 40 additions and 49 deletions

View File

@ -21,9 +21,11 @@ extern int inputrecord_debug;
//#define INPREC_VSYNC 6
//#define INPREC_CIAVSYNC 7
#define INPREC_EVENT 8
#define INPREC_DEBUG_START 0x60
#define INPREC_DEBUG 0x60
#define INPREC_CIADEBUG 0x61
#define INPREC_DEBUG 0x62
#define INPREC_DEBUG2 0x63
#define INPREC_CPUDEBUG 0x62
#define INPREC_DEBUG_END 0x6f
#define INPREC_STOP 0x7d
#define INPREC_END 0x7e
#define INPREC_QUIT 0x7f
@ -50,8 +52,8 @@ extern void inprec_recorddiskchange (int nr, const TCHAR *fname, bool writeprote
extern void inprec_recorddebug (uae_u32);
extern void inprec_playdebug (uae_u32);
extern void inprec_recorddebug_cpu (int);
extern void inprec_playdebug_cpu (int);
extern void inprec_recorddebug_cpu (int, uae_u16);
extern void inprec_playdebug_cpu (int, uae_u16);
extern void inprec_recorddebug_cia (uae_u32, uae_u32, uae_u32);
extern void inprec_playdebug_cia (uae_u32, uae_u32, uae_u32);

View File

@ -3580,7 +3580,7 @@ static void maybe_read_input(void)
if (inputread >= 0 && (vpos - inputread) <= maxvpos_display / 3) {
return;
}
if (input_record) {
if (input_record || savestate_state == STATE_DOSAVE) {
return;
}
inputread = vpos;

View File

@ -33,7 +33,7 @@
#include "newcpu.h"
#endif
int inputrecord_debug = 3;
int inputrecord_debug = 1 | 2;
extern int inputdevice_logging;
@ -122,7 +122,7 @@ static bool inprec_rstart (uae_u8 type)
int hpos = current_hpos();
lastcycle = get_cycles ();
int mvp = current_maxvpos ();
if ((type != INPREC_DEBUG && type != INPREC_DEBUG2 && type != INPREC_CIADEBUG) || (0 && vsync_counter >= 49 && vsync_counter <= 51))
if ((type < INPREC_DEBUG_START || type > INPREC_DEBUG_END) || (0 && vsync_counter >= 49 && vsync_counter <= 51))
write_log (_T("INPREC: %010d/%03d: %d (%d/%d) %08x\n"), hsync_counter, hpos, type, hsync_counter % mvp, mvp, lastcycle);
inprec_plast = inprec_p;
inprec_ru8 (type);
@ -236,7 +236,7 @@ static int inprec_pstart (uae_u8 type)
return 1;
}
if (cycles < cycles2) {
if (type2 != INPREC_DEBUG && type2 != INPREC_DEBUG2 && type2 != INPREC_CIADEBUG) {
if (type2 < INPREC_DEBUG_START || type2 > INPREC_DEBUG_END) {
int diff = (uae_u32)((cycles2 - cycles) / CYCLE_UNIT);
if (diff < maxhpos) {
event2_newevent_x_replace(diff, 0, inprec_event);
@ -246,7 +246,7 @@ static int inprec_pstart (uae_u8 type)
break;
}
if (type2 == type) {
if (type != INPREC_DEBUG && type != INPREC_DEBUG2 && type != INPREC_CIADEBUG && cycles != cycles2)
if ((type < INPREC_DEBUG_START || type > INPREC_DEBUG_END) && cycles != cycles2)
write_log (_T("INPREC: %010d/%03d: %d (%d/%d) (%d/%d) %08X/%08X\n"), hc, hpos, type, hc % mvp, mvp, hc_orig - hc2_orig, hpos - hpos2, cycles, cycles2);
if (cycles != cycles2 + cycleoffset) {
if (warned > 0) {
@ -632,29 +632,28 @@ void inprec_playdebug_cia (uae_u32 v1, uae_u32 v2, uae_u32 v3)
#endif
}
void inprec_recorddebug_cpu (int mode)
void inprec_recorddebug_cpu (int mode, uae_u16 data)
{
#if INPUTRECORD_DEBUG > 0
if (inprec_rstart (INPREC_DEBUG2)) {
inprec_ru32 (m68k_getpc ());
inprec_ru64 (get_cycles () | mode);
if (inprec_rstart (INPREC_CPUDEBUG + mode)) {
inprec_ru32(m68k_getpc());
inprec_ru16(data);
inprec_rend ();
}
#endif
}
void inprec_playdebug_cpu (int mode)
void inprec_playdebug_cpu (int mode, uae_u16 data)
{
#if INPUTRECORD_DEBUG > 0
int err = 0;
if (inprec_pstart (INPREC_DEBUG2)) {
uae_u32 pc1 = m68k_getpc ();
uae_u32 pc2 = inprec_pu32 ();
uae_u64 v1 = get_cycles () | mode;
uae_u64 v2 = inprec_pu64 ();
if (pc1 != pc2) {
if (inprec_pstart (INPREC_CPUDEBUG + mode)) {
uae_u32 pc1 = m68k_getpc();
uae_u32 pc2 = inprec_pu32();
uae_u16 data2 = inprec_pu16();
if (pc1 != pc2 || data != data2) {
if (warned > 0) {
warned--;
write_log (_T("SYNC ERROR2 PC %08x != %08x\n"), pc1, pc2);
write_log (_T("SYNC ERROR2 PC %08x - %08x, D %04x - %04x, M %d\n"), pc1, pc2, data, data2, mode);
for (int i = 0; i < 15; i++)
write_log (_T("%08x "), pcs[i]);
write_log (_T("\n"));
@ -667,16 +666,6 @@ void inprec_playdebug_cpu (int mode)
memmove(pcs2 + 1, pcs2, 15 * sizeof(uae_u64));
pcs2[0] = get_cycles();
}
if (v1 != v2) {
if (warned > 0) {
warned--;
write_log (_T("SYNC ERROR2 %08x != %08x\n"), v1, v2);
for (int i = 0; i < 15; i++)
write_log (_T("%08x "), pcs[i]);
write_log (_T("\n"));
}
err = 1;
}
inprec_pend ();
} else if (input_play > 0) {
if (warned > 0) {

View File

@ -3497,9 +3497,9 @@ static void do_interrupt (int nr)
#endif
if (inputrecord_debug & 2) {
if (input_record > 0)
inprec_recorddebug_cpu (2);
inprec_recorddebug_cpu(2, 0);
else if (input_play > 0)
inprec_playdebug_cpu (2);
inprec_playdebug_cpu(2, 0);
}
assert (nr < 8 && nr >= 0);
@ -5007,9 +5007,9 @@ static void m68k_run_1_ce (void)
if (inputrecord_debug & 4) {
if (input_record > 0)
inprec_recorddebug_cpu (1);
inprec_recorddebug_cpu(1, r->opcode);
else if (input_play > 0)
inprec_playdebug_cpu (1);
inprec_playdebug_cpu(1, r->opcode);
}
#ifdef DEBUGGER
@ -6112,9 +6112,9 @@ static void m68k_run_2ce (void)
if (inputrecord_debug & 4) {
if (input_record > 0)
inprec_recorddebug_cpu (1);
inprec_recorddebug_cpu(1, r->opcode);
else if (input_play > 0)
inprec_playdebug_cpu (1);
inprec_playdebug_cpu(1, r->opcode);
}
#ifdef DEBUGGER
if (debug_opcode_watch) {
@ -6240,9 +6240,9 @@ static void m68k_run_2p (void)
if (inputrecord_debug & 4) {
if (input_record > 0)
inprec_recorddebug_cpu (1);
inprec_recorddebug_cpu(1, r->opcode);
else if (input_play > 0)
inprec_playdebug_cpu (1);
inprec_playdebug_cpu(1, r->opcode);
}
#ifdef DEBUGGER
if (debug_opcode_watch) {
@ -6537,15 +6537,15 @@ void m68k_go (int may_quit)
memory_clear ();
write_log (_T("hardreset, memory cleared\n"));
}
#ifdef DEBUGGER
if (debug_dma) {
record_dma_reset(1);
record_dma_reset(1);
}
#endif
#ifdef SAVESTATE
/* We may have been restoring state, but we're done now. */
if (isrestore ()) {
#ifdef DEBUGGER
if (debug_dma) {
record_dma_reset(0);
record_dma_reset(0);
}
#endif
restored = savestate_restore_finish ();
memory_map_dump ();
if (currprefs.mmu_model == 68030) {

View File

@ -1547,14 +1547,14 @@ void savestate_capture (int force)
struct staterecord *st;
bool firstcapture = false;
#ifdef FILESYS
if (nr_units ())
return;
#endif
if (!staterecords)
return;
if (!input_record)
return;
#ifdef FILESYS
if (nr_units())
return;
#endif
if (currprefs.statecapturerate && hsync_counter == 0 && input_record == INPREC_RECORD_START && savestate_first_capture > 0) {
// first capture
force = true;