puae 2.3.1

parent 9f992501
......@@ -132,7 +132,7 @@ EXTRA_DIST = \
uae_SOURCES = \
main.c newcpu.c memory.c rommgr.c custom.c serial.c dongle.c cia.c \
blitter.c autoconf.c traps.c ersatz.c keybuf.c expansion.c \
blitter.c autoconf.c traps.c ersatz.c keybuf.c expansion.c inputrecord.c \
diskutil.c zfile.c zfile_archive.c cfgfile.c picasso96.c inputdevice.c \
gfxutil.c audio.c sinctable.c statusline.c drawing.c consolehook.c \
native2amiga.c disk.c crc32.c savestate.c arcadia.c cdtv.c cd32_fmv.c \
......
......@@ -673,14 +673,12 @@ static uae_u8 ReadCIAA (unsigned int addr)
if (notinrom())
write_log ("BFE001 R %02X %s\n", tmp, debuginfo(0));
#endif
#if INPREC
if (inputrecord_debug & 2) {
if (input_record > 0)
inprec_recorddebug_cia (tmp, div10, m68k_getpc ());
else if (input_play > 0)
inprec_playdebug_cia (tmp, div10, m68k_getpc ());
}
#endif
return tmp;
case 1:
#ifdef PARALLEL_PORT
......
......@@ -5716,25 +5716,6 @@ static void hsync_handler_post (bool isvsync)
do_sprites (0);
#endif
#ifdef INPREC
while (input_recording < 0 && inprec_pstart (INPREC_KEY)) {
record_key_direct (inprec_pu8 ());
inprec_pend ();
}
while (input_recording < 0 && inprec_pstart (INPREC_DISKREMOVE)) {
disk_eject (inprec_pu8 ());
inprec_pend ();
}
while (input_recording < 0 && inprec_pstart (INPREC_DISKINSERT)) {
int drv = inprec_pu8 ();
inprec_pstr (currprefs.floppyslots[drv].df);
_tcscpy (changed_prefs.floppyslots[drv].df, currprefs.floppyslots[drv].df);
disk_insert_force (drv, currprefs.floppyslots[drv].df);
inprec_pend ();
}
#endif
inputdevice_hsync ();
#ifdef GAYLE
gayle_hsync ();
#endif
......@@ -7118,7 +7099,6 @@ uae_u8 *save_custom_event_delay (int *len, uae_u8 *dstptr)
save_u8 (1);
save_u64 (e->evtime - get_cycles ());
save_u32 (e->data);
}
}
......
......@@ -3640,7 +3640,7 @@ void debug (void)
&& nr_units () == 0
#endif
) {
savestate_capture (1);
//savestate_capture (1);
}
for (i = 0; i < BREAKPOINT_TOTAL; i++) {
if (bpnodes[i].enabled)
......
......@@ -931,10 +931,8 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
return 0;
}
#ifdef INPREC
if (!fake)
inprec_recorddiskchange (dnum, fname, drv->wrprot);
#endif
_tcsncpy (currprefs.floppyslots[dnum].df, fname, 255);
currprefs.floppyslots[dnum].df[255] = 0;
......@@ -2049,9 +2047,7 @@ static void drive_eject (drive * drv)
drive_settype_id (drv); /* Back to 35 DD */
if (disk_debug_logging > 0)
write_log ("eject drive %d\n", drv - &floppy[0]);
#ifdef INPREC
inprec_recorddiskchange (drv - floppy, NULL, false);
#endif
}
/* We use this function if we have no Kickstart ROM.
......
......@@ -2668,7 +2668,8 @@ void vsync_handle_redraw (int long_frame, int lof_changed)
#ifdef SAVESTATE
if (!savestate_state) {
if (currprefs.quitstatefile[0]) {
savestate_initsave (currprefs.quitstatefile, 1, 1, true);
write_log ("Draw: Save_State");
savestate_initsave (currprefs.quitstatefile, 1, 1, true);
save_state (currprefs.quitstatefile, "");
}
}
......
......@@ -52,5 +52,5 @@ extern void inprec_playdebug_cia (uae_u32, uae_u32, uae_u32);
extern int inprec_getposition (void);
extern void inprec_setposition (int offset, int replaycounter);
extern bool inprec_realtime (void);
extern bool inprec_realtimev (void);
extern void inprec_getstatus (TCHAR*);
\ No newline at end of file
......@@ -133,33 +133,34 @@
#define KBLED_SCROLLLOCKM (1 << KBLED_SCROLLLOCKB)
enum aks { AKS_ENTERGUI = 0x200, AKS_SCREENSHOT_FILE, AKS_SCREENSHOT_CLIPBOARD, AKS_FREEZEBUTTON,
AKS_FLOPPY0, AKS_FLOPPY1, AKS_FLOPPY2, AKS_FLOPPY3,
AKS_EFLOPPY0, AKS_EFLOPPY1, AKS_EFLOPPY2, AKS_EFLOPPY3,
AKS_FLOPPY0, AKS_FLOPPY1, AKS_FLOPPY2, AKS_FLOPPY3,
AKS_EFLOPPY0, AKS_EFLOPPY1, AKS_EFLOPPY2, AKS_EFLOPPY3,
AKS_TOGGLEDEFAULTSCREEN,
AKS_TOGGLEWINDOWEDFULLSCREEN, AKS_TOGGLEFULLWINDOWFULLSCREEN, AKS_TOGGLEWINDOWFULLWINDOW,
AKS_TOGGLEWINDOWEDFULLSCREEN, AKS_TOGGLEFULLWINDOWFULLSCREEN, AKS_TOGGLEWINDOWFULLWINDOW,
AKS_ENTERDEBUGGER, AKS_IRQ7,
AKS_PAUSE, AKS_WARP, AKS_INHIBITSCREEN, AKS_STATEREWIND,
AKS_VOLDOWN, AKS_VOLUP, AKS_VOLMUTE,
AKS_MVOLDOWN, AKS_MVOLUP, AKS_MVOLMUTE,
AKS_QUIT, AKS_HARDRESET, AKS_SOFTRESET,
AKS_STATESAVEQUICK, AKS_STATERESTOREQUICK,
AKS_STATESAVEQUICK1, AKS_STATERESTOREQUICK1,
AKS_STATESAVEQUICK2, AKS_STATERESTOREQUICK2,
AKS_STATESAVEQUICK3, AKS_STATERESTOREQUICK3,
AKS_STATESAVEQUICK4, AKS_STATERESTOREQUICK4,
AKS_STATESAVEQUICK5, AKS_STATERESTOREQUICK5,
AKS_STATESAVEQUICK6, AKS_STATERESTOREQUICK6,
AKS_STATESAVEQUICK7, AKS_STATERESTOREQUICK7,
AKS_STATESAVEQUICK8, AKS_STATERESTOREQUICK8,
AKS_STATESAVEQUICK9, AKS_STATERESTOREQUICK9,
AKS_STATESAVEDIALOG, AKS_STATERESTOREDIALOG,
AKS_DECREASEREFRESHRATE,
AKS_INCREASEREFRESHRATE,
AKS_ARCADIADIAGNOSTICS, AKS_ARCADIAPLY1, AKS_ARCADIAPLY2, AKS_ARCADIACOIN1, AKS_ARCADIACOIN2,
AKS_TOGGLEMOUSEGRAB, AKS_SWITCHINTERPOL,
AKS_INPUT_CONFIG_1,AKS_INPUT_CONFIG_2,AKS_INPUT_CONFIG_3,AKS_INPUT_CONFIG_4,
AKS_DISKSWAPPER_NEXT,AKS_DISKSWAPPER_PREV,
AKS_DISKSWAPPER_INSERT0,AKS_DISKSWAPPER_INSERT1,AKS_DISKSWAPPER_INSERT2,AKS_DISKSWAPPER_INSERT3,
AKS_PAUSE, AKS_WARP, AKS_INHIBITSCREEN,
AKS_STATEREWIND, AKS_STATECURRENT, AKS_STATECAPTURE,
AKS_VOLDOWN, AKS_VOLUP, AKS_VOLMUTE,
AKS_MVOLDOWN, AKS_MVOLUP, AKS_MVOLMUTE,
AKS_QUIT, AKS_HARDRESET, AKS_SOFTRESET,
AKS_STATESAVEQUICK, AKS_STATERESTOREQUICK,
AKS_STATESAVEQUICK1, AKS_STATERESTOREQUICK1,
AKS_STATESAVEQUICK2, AKS_STATERESTOREQUICK2,
AKS_STATESAVEQUICK3, AKS_STATERESTOREQUICK3,
AKS_STATESAVEQUICK4, AKS_STATERESTOREQUICK4,
AKS_STATESAVEQUICK5, AKS_STATERESTOREQUICK5,
AKS_STATESAVEQUICK6, AKS_STATERESTOREQUICK6,
AKS_STATESAVEQUICK7, AKS_STATERESTOREQUICK7,
AKS_STATESAVEQUICK8, AKS_STATERESTOREQUICK8,
AKS_STATESAVEQUICK9, AKS_STATERESTOREQUICK9,
AKS_STATESAVEDIALOG, AKS_STATERESTOREDIALOG,
AKS_DECREASEREFRESHRATE,
AKS_INCREASEREFRESHRATE,
AKS_ARCADIADIAGNOSTICS, AKS_ARCADIAPLY1, AKS_ARCADIAPLY2, AKS_ARCADIACOIN1, AKS_ARCADIACOIN2,
AKS_TOGGLEMOUSEGRAB, AKS_SWITCHINTERPOL,
AKS_INPUT_CONFIG_1,AKS_INPUT_CONFIG_2,AKS_INPUT_CONFIG_3,AKS_INPUT_CONFIG_4,
AKS_DISKSWAPPER_NEXT,AKS_DISKSWAPPER_PREV,
AKS_DISKSWAPPER_INSERT0,AKS_DISKSWAPPER_INSERT1,AKS_DISKSWAPPER_INSERT2,AKS_DISKSWAPPER_INSERT3,
AKS_DISK_PREV0, AKS_DISK_PREV1, AKS_DISK_PREV2, AKS_DISK_PREV3,
AKS_DISK_NEXT0, AKS_DISK_NEXT1, AKS_DISK_NEXT2, AKS_DISK_NEXT3,
AKS_CDTV_FRONT_PANEL_STOP, AKS_CDTV_FRONT_PANEL_PLAYPAUSE, AKS_CDTV_FRONT_PANEL_PREV,
......
......@@ -14,6 +14,7 @@ struct zfile {
int archiveid;
uae_s64 size; // real size
uae_s64 datasize; // available size (not yet unpacked completely?)
uae_s64 allocsize; // memory allocated before realloc() needed again
uae_s64 seek; // seek position
int deleteafterclose;
int textmode;
......
......@@ -69,6 +69,7 @@ extern int zfile_convertimage (const TCHAR *src, const TCHAR *dst);
//extern struct zfile *zuncompress (struct znode*, struct zfile *z, int dodefault, int mask, int *retcode, int index);
extern void zfile_seterror (const TCHAR *format, ...);
extern TCHAR *zfile_geterror (void);
extern int zfile_truncate (struct zfile *z, uae_s64 size);
#define ZFD_NONE 0
#define ZFD_ARCHIVE 1 //zip/lha..
......@@ -120,3 +121,4 @@ extern unsigned int zfile_read_archive (struct zfile *d, void *b, unsigned int s
extern void zfile_close_archive (struct zfile *d);
extern struct zfile *zfile_open_archive (const TCHAR *path, int flags);
extern int zfile_exists_archive (const TCHAR *path, const TCHAR *rel);
extern bool zfile_needwrite (struct zfile*);
\ No newline at end of file
This diff is collapsed.
......@@ -314,7 +314,11 @@ DEFEVENT(SPC_PAUSE,"Pause emulation",AM_K,0,0,AKS_PAUSE)
DEFEVENT(SPC_WARP,"Warp mode",AM_K,0,0,AKS_WARP)
DEFEVENT(SPC_INHIBITSCREEN,"Toggle screen updates",AM_K,0,0,AKS_INHIBITSCREEN)
DEFEVENT(SPC_IRQ7,"Level 7 interrupt",AM_K,0,0,AKS_IRQ7)
DEFEVENT(SPC_STATEREWIND,"Load previous state capture",AM_K,0,0,AKS_STATEREWIND)
DEFEVENT(SPC_STATEREWIND,"Load previous state capture checkpoint",AM_K,0,0,AKS_STATEREWIND)
DEFEVENT(SPC_STATECURRENT,"Load current state capture checkpoint",AM_K,0,0,AKS_STATECURRENT)
DEFEVENT(SPC_STATECAPTURE,"Save state capture checkpoint",AM_K,0,0,AKS_STATECAPTURE)
DEFEVENT(SPC_VOLUME_DOWN,"Decrease volume level",AM_K,0,0,AKS_VOLDOWN)
DEFEVENT(SPC_VOLUME_UP,"Increase volume level",AM_K,0,0,AKS_VOLUP)
DEFEVENT(SPC_VOLUME_MUTE,"Mute/unmute volume",AM_K,0,0,AKS_VOLMUTE)
......@@ -336,12 +340,6 @@ DEFEVENT(SPC_TOGGLEMOUSEGRAB,"Toggle between mouse grabbed and un-grabbed",AM_K,
DEFEVENT(SPC_DECREASE_REFRESHRATE,"Decrease emulation speed",AM_K,0,0,AKS_DECREASEREFRESHRATE)
DEFEVENT(SPC_INCREASE_REFRESHRATE,"Increase emulation speed",AM_K,0,0,AKS_INCREASEREFRESHRATE)
DEFEVENT(SPC_SWITCHINTERPOL,"Switch between audio interpolation methods",AM_K,0,0,AKS_SWITCHINTERPOL)
DEFEVENT(SPC_GLPANLEFT,"Pan opengl texture to the left",AM_K,0,0,AKS_GLPANLEFT) /*Koko*/
DEFEVENT(SPC_GLPANRIGHT,"Pan opengl texture to the left",AM_K,0,0,AKS_GLPANRIGHT) /*Koko*/
DEFEVENT(SPC_GLPANUP,"Pan opengl texture to the left",AM_K,0,0,AKS_GLPANUP) /*Koko*/
DEFEVENT(SPC_GLPANDOWN,"Pan opengl texture to the left",AM_K,0,0,AKS_GLPANDOWN) /*Koko*/
DEFEVENT(SPC_GLPANSCANMORE,"ZoomIn opengl texture",AM_K,0,0,AKS_GLPANSCANMORE) /*Koko*/
DEFEVENT(SPC_GLPANSCANLESS,"ZoomOut opengl texture",AM_K,0,0,AKS_GLPANSCANLESS) /*Koko*/
DEFEVENT(SPC_DISKSWAPPER_NEXT,"Next slot in Disk Swapper",AM_K,0,0,AKS_DISKSWAPPER_NEXT)
DEFEVENT(SPC_DISKSWAPPER_PREV,"Previous slot in Disk Swapper",AM_K,0,0,AKS_DISKSWAPPER_PREV)
......@@ -377,3 +375,9 @@ DEFEVENT(SPC_CDTV_FRONT_PANEL_NEXT,"CDTV Front Panel Next",AM_K,0,0,AKS_CDTV_FRO
DEFEVENT(SPC_CDTV_FRONT_PANEL_REW,"CDTV Front Panel Rewind",AM_K,0,0,AKS_CDTV_FRONT_PANEL_REW)
DEFEVENT(SPC_CDTV_FRONT_PANEL_FF,"CDTV Front Panel Fast Forward",AM_K,0,0,AKS_CDTV_FRONT_PANEL_FF)
DEFEVENT(SPC_GLPANLEFT,"Pan opengl texture to the left",AM_K,0,0,AKS_GLPANLEFT) /*Koko*/
DEFEVENT(SPC_GLPANRIGHT,"Pan opengl texture to the left",AM_K,0,0,AKS_GLPANRIGHT) /*Koko*/
DEFEVENT(SPC_GLPANUP,"Pan opengl texture to the left",AM_K,0,0,AKS_GLPANUP) /*Koko*/
DEFEVENT(SPC_GLPANDOWN,"Pan opengl texture to the left",AM_K,0,0,AKS_GLPANDOWN) /*Koko*/
DEFEVENT(SPC_GLPANSCANMORE,"ZoomIn opengl texture",AM_K,0,0,AKS_GLPANSCANMORE) /*Koko*/
DEFEVENT(SPC_GLPANSCANLESS,"ZoomOut opengl texture",AM_K,0,0,AKS_GLPANSCANLESS) /*Koko*/
......@@ -11,6 +11,8 @@
#define ENABLE_DEBUGGER 0
#define HEADERSIZE 12
#define TRUE 1
#define FALSE 0
#include "sysconfig.h"
#include "sysdeps.h"
......@@ -162,6 +164,7 @@ static int inprec_pstart (uae_u8 type)
static uae_u8 *lastp;
uae_u32 hc_orig, hc2_orig;
int mvp = current_maxvpos ();
unsigned int i;
if (!input_play || !inprec_zf)
return 0;
......@@ -228,7 +231,7 @@ static int inprec_pstart (uae_u8 type)
if (cycles != cycles2 + cycleoffset) {
if (warned > 0) {
warned--;
for (int i = 0; i < 7; i++)
for (i = 0; i < 7; i++)
write_log ("%08x (%08x) ", pcs[i], pcs2[i]);
write_log ("\n");
}
......@@ -316,9 +319,9 @@ static int inprec_pstr (TCHAR *dst)
len++;
}
if (tmp[0]) {
TCHAR *d = utf8u (tmp);
_tcscpy (dst, d);
xfree (d);
//TCHAR *d = utf8u (tmp);
_tcscpy (dst, tmp);
//xfree (d);
}
return len;
}
......@@ -342,7 +345,7 @@ int inprec_open (const TCHAR *fname, const TCHAR *statefilename)
inprec_close (false);
if (fname == NULL)
inprec_zf = zfile_fopen_empty (NULL, "inp");
inprec_zf = zfile_fopen_empty (NULL, "inp", false);
else
inprec_zf = zfile_fopen (fname, input_record ? "wb" : "rb", ZFD_NORMAL);
if (inprec_zf == NULL)
......@@ -516,14 +519,14 @@ void inprec_close (bool clear)
static void setwriteprotect (const TCHAR *fname, bool readonly)
{
struct _stat64 st;
struct stat64 st;
int mode, oldmode;
if (stat (fname, &st))
return;
oldmode = mode = st.st_mode;
mode &= ~FILEFLAG_WRITE;
mode &= ~0x04;
if (!readonly)
mode |= FILEFLAG_WRITE;
mode |= 0x04;
if (mode != oldmode)
chmod (fname, mode);
}
......@@ -615,6 +618,8 @@ void inprec_playdebug_cpu (int mode)
{
#if INPUTRECORD_DEBUG > 0
int err = 0;
unsigned int i;
if (inprec_pstart (INPREC_DEBUG2)) {
uae_u32 pc1 = m68k_getpc ();
uae_u32 pc2 = inprec_pu32 ();
......@@ -624,7 +629,7 @@ void inprec_playdebug_cpu (int mode)
if (warned > 0) {
warned--;
write_log ("SYNC ERROR2 PC %08x != %08x\n", pc1, pc2);
for (int i = 0; i < 15; i++)
for (i = 0; i < 15; i++)
write_log ("%08x ", pcs[i]);
write_log ("\n");
......@@ -640,7 +645,7 @@ void inprec_playdebug_cpu (int mode)
if (warned > 0) {
warned--;
write_log ("SYNC ERROR2 %08x != %08x\n", v1, v2);
for (int i = 0; i < 15; i++)
for (i = 0; i < 15; i++)
write_log ("%08x ", pcs[i]);
write_log ("\n");
}
......@@ -757,7 +762,7 @@ void inprec_playtorecord (void)
input_play = INPREC_PLAY_RERECORD;
input_record = INPREC_RECORD_PLAYING;
zfile_fclose (inprec_zf);
inprec_zf = zfile_fopen_empty (NULL, "inp");
inprec_zf = zfile_fopen_empty (NULL, "inp", false);
zfile_fwrite (inprec_buffer, header_end2, 1, inprec_zf);
uae_u8 *p = inprec_buffer + header_end2;
uae_u8 *end = inprec_buffer + inprec_size;
......@@ -768,7 +773,7 @@ void inprec_playtorecord (void)
}
zfile_fwrite (inprec_buffer + header_end2, inprec_size - header_end2, 1, inprec_zf);
inprec_realtime (false);
savestate_capture_request ();
// savestate_capture_request ();
}
void inprec_setposition (int offset, int replaycounter)
......@@ -801,7 +806,7 @@ static void savelog (const TCHAR *path, const TCHAR *file)
_tcscpy (tmp, path);
_tcscat (tmp, file);
_tcscat (tmp, ".log.txt");
struct zfile *zfd = zfile_fopen (tmp, "wb");
struct zfile *zfd = zfile_fopen (tmp, "wb", 0);
if (zfd) {
int loglen;
uae_u8 *log;
......@@ -842,7 +847,7 @@ static int savedisk (const TCHAR *path, const TCHAR *file, uae_u8 *data, uae_u8
_tcscat (filename, ".");
getfilepart (filename + _tcslen (filename), MAX_DPATH, zfile_getname (zf));
_tcscat (tmp, filename);
struct zfile *zfd = zfile_fopen (tmp, "wb");
struct zfile *zfd = zfile_fopen (tmp, "wb", 0);
if (zfd) {
int size = zfile_size (zf);
uae_u8 *data = zfile_getdata (zf, 0, size);
......@@ -914,7 +919,7 @@ void inprec_save (const TCHAR *filename, const TCHAR *statefilename)
}
}
bool inprec_realtime (void)
bool inprec_realtimev (void)
{
if (input_record != INPREC_RECORD_PLAYING || input_play != INPREC_PLAY_RERECORD)
return false;
......
......@@ -48,11 +48,7 @@ int get_next_key (void)
int record_key (int kc)
{
#ifdef INPREC
if (input_recording < 0 || pause_emulation)
#else
if (pause_emulation)
#endif
return 0;
return record_key_direct (kc);
}
......
......@@ -77,6 +77,9 @@ TCHAR warning_buffer[256];
TCHAR optionsfile[256];
static uae_u32 randseed;
static int oldhcounter;
static void hr (void)
{
write_log ("------------------------------------------------------------------------------------\n");
......@@ -103,9 +106,27 @@ static void show_version_full (void)
hr ();
}
int uaerand (void)
uae_u32 uaesrand (uae_u32 seed)
{
oldhcounter = -1;
randseed = seed;
//randseed = 0x12345678;
//write_log (L"seed=%08x\n", randseed);
return randseed;
}
uae_u32 uaerand (void)
{
return rand ();
if (oldhcounter != hsync_counter) {
srand (hsync_counter ^ randseed);
oldhcounter = hsync_counter;
}
uae_u32 r = rand ();
//write_log (L"rand=%08x\n", r);
return r;
}
uae_u32 uaerandgetseed (void)
{
return randseed;
}
void discard_prefs (struct uae_prefs *p, int type)
......@@ -452,6 +473,10 @@ static int default_config;
void uae_reset (int hardreset)
{
if (debug_dma) {
record_dma_reset ();
record_dma_reset ();
}
currprefs.quitstatefile[0] = changed_prefs.quitstatefile[0] = 0;
if (quit_program == 0) {
......
......@@ -633,6 +633,48 @@ uae_u8 *save_log (int bootlog, int *len)
return dst;
}
void stripslashes (TCHAR *p)
{
while (_tcslen (p) > 0 && (p[_tcslen (p) - 1] == '\\' || p[_tcslen (p) - 1] == '/'))
p[_tcslen (p) - 1] = 0;
}
void fixtrailing (TCHAR *p)
{
if (_tcslen(p) == 0)
return;
if (p[_tcslen(p) - 1] == '/' || p[_tcslen(p) - 1] == '\\')
return;
_tcscat(p, "\\");
}
void getpathpart (TCHAR *outpath, int size, const TCHAR *inpath)
{
_tcscpy (outpath, inpath);
TCHAR *p = _tcsrchr (outpath, '\\');
if (p)
p[0] = 0;
fixtrailing (outpath);
}
void getfilepart (TCHAR *out, int size, const TCHAR *path)
{
out[0] = 0;
const TCHAR *p = _tcsrchr (path, '\\');
if (p)
_tcscpy (out, p + 1);
else
_tcscpy (out, path);
}
void refreshtitle (void)
{
/*
if (isfullscreen () == 0)
setmaintitle (hMainWnd);
*/
}
// win32gui.c
#define MAX_ROM_PATHS 10
int scan_roms (int show)
......@@ -802,6 +844,14 @@ void fetch_ripperpath (TCHAR *out, int size)
{
fetch_path ("RipperPath", out, size);
}
void fetch_statefilepath (TCHAR *out, int size)
{
fetch_path ("StatefilePath", out, size);
}
void fetch_inputfilepath (TCHAR *out, int size)
{
fetch_path ("InputPath", out, size);
}
void fetch_datapath (TCHAR *out, int size)
{
fetch_path (NULL, out, size);
......@@ -854,7 +904,15 @@ void debugger_change (int mode)
// unicode.c
char *ua (const TCHAR *s)
{
return s;
return s;
}
char *uutf8 (const char *s)
{
return s;
}
char *utf8u (const char *s)
{
return s;
}
// fsdb_mywin32.c
......@@ -1146,7 +1204,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
if (specialpressed ())
return;
write_log ("kbd = %d, scancode = %d, state = %d\n", keyboard, scancode, newstate );
// write_log ("kbd = %d, scancode = %d, state = %d\n", keyboard, scancode, newstate );
inputdevice_translatekeycode (keyboard, scancode, newstate);
}
......
......@@ -828,10 +828,8 @@ bool set_cpu_tracer (bool state)
if (cpu_tracer < 0)
return false;
int old = cpu_tracer;
#ifdef INPREC
if (input_record)
state = true;
#endif
cpu_tracer = 0;
if (state && can_cpu_tracer ()) {
cpu_tracer = 1;
......@@ -2318,14 +2316,12 @@ STATIC_INLINE void do_interrupt (int nr)
if (debug_dma)
record_dma_event (DMA_EVENT_CPUIRQ, current_hpos (), vpos);
#endif
#ifdef INPREC
if (inputrecord_debug & 2) {
if (input_record > 0)
inprec_recorddebug_cpu (2);
else if (input_play > 0)
inprec_playdebug_cpu (2);
}
#endif
regs.stopped = 0;
unset_special (SPCFLAG_STOP);
......@@ -3509,14 +3505,12 @@ static void m68k_run_1_ce (void)
cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0;
cputrace.readcounter = cputrace.writecounter = 0;
}
#ifdef INPREC
if (inputrecord_debug & 4) {
if (input_record > 0)
inprec_recorddebug_cpu (1);
else if (input_play > 0)
inprec_playdebug_cpu (1);
}
#endif
(*cpufunctbl[opcode])(opcode);
if (cpu_tracer) {
......@@ -3837,14 +3831,12 @@ static void m68k_run_2ce (void)
cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0;
cputrace.readcounter = cputrace.writecounter = 0;
}
#ifdef INPREC
if (inputrecord_debug & 4) {
if (input_record > 0)
inprec_recorddebug_cpu (1);
else if (input_play > 0)
inprec_playdebug_cpu (1);
}
#endif
docodece020 (opcode);
......@@ -3989,7 +3981,6 @@ void m68k_go (int may_quit)
cputrace.state = -1;
#ifdef INPREC
if (currprefs.inprecfile[0] && input_play) {
inprec_open (currprefs.inprecfile, NULL);
changed_prefs.inprecfile[0] = currprefs.inprecfile[0] = 0;
......@@ -3997,7 +3988,6 @@ void m68k_go (int may_quit)
}
if (input_play || input_record)
inprec_startup ();
#endif
if (quit_program > 0) {
int hardreset = (quit_program == 3 ? 1 : 0) | hardboot;
......@@ -4045,12 +4035,9 @@ void m68k_go (int may_quit)
if (!restored || hsync_counter == 0)
savestate_check ();
#ifdef INPREC
if (input_record == INPREC_RECORD_START)
input_record = INPREC_RECORD_NORMAL;
#endif
} else {
#ifdef INPREC
if (input_record == INPREC_RECORD_START) {
input_record = INPREC_RECORD_NORMAL;
savestate_init ();
......@@ -4058,13 +4045,10 @@ void m68k_go (int may_quit)
vsync_counter = 0;
savestate_check ();
}
#endif
}
#ifdef INPREC
if (changed_prefs.inprecfile[0] && input_record)
inprec_prepare_record (savestate_fname[0] ? savestate_fname : NULL);
#endif
set_cpu_tracer (false);
#ifdef DEBUGGER
......
......@@ -708,9 +708,7 @@ void savestate_initsave (const TCHAR *filename, int mode, int nodialogs, bool sa
new_blitter = false;
if (save) {
savestate_free ();
#ifdef INPREC
inprec_close (true);
#endif
}
}
......@@ -1060,10 +1058,8 @@ void savestate_quick (int slot, int save)
bool savestate_check (void)
{
if (vpos == 0 && !savestate_state) {
#ifdef INPREC
if (hsync_counter == 0 && input_play == INPREC_PLAY_NORMAL)
savestate_memorysave ();
#endif
savestate_capture (0);
}
if (savestate_state == STATE_DORESTORE) {
......@@ -1239,9 +1235,7 @@ void savestate_rewind (void)
uae_reset (0);
return;
}
#ifdef INPREC
inprec_setposition (st->inprecoffset, pos);
#endif
write_log ("state %d restored. (%010d/%03d)\n", pos, hsync_counter, vsync_counter);
if (rewind) {
replaycounter--;
......@@ -1285,7 +1279,6 @@ void savestate_capture (int force)
#endif
if (!staterecords)
return;
#ifdef INPREC
if (!input_record)
return;
if (currprefs.statecapturerate && hsync_counter == 0 && input_record == INPREC_RECORD_START && savestate_first_capture > 0) {
......@@ -1296,7 +1289,6 @@ void savestate_capture (int force)
force = true;
firstcapture = false;
}
#endif
if (!force) {
if (currprefs.statecapturerate <= 0)
return;
......@@ -1598,9 +1590,7 @@ retry2:
save_u32_func (&p, tlen);
st->end = p;
st->inuse = 1;
#ifdef INPREC
st->inprecoffset = inprec_getposition ();
#endif
replaycounter++;
if (replaycounter >= staterecords_max)
......@@ -1618,19 +1608,13 @@ retry2:
if (firstcapture) {
savestate_memorysave ();
#ifdef INPREC
input_record++;
#endif
for (i = 0; i < 4; i++) {
bool wp = true;
DISK_validate_filename (currprefs.floppyslots[i].df, false, &wp, NULL, NULL);
#ifdef INPREC
inprec_recorddiskchange (i, currprefs.floppyslots[i].df, wp);
#endif
}
#ifdef INPREC
input_record--;
#endif
}
......@@ -1660,7 +1644,6 @@ void savestate_init (void)
staterecords_max = currprefs.statecapturebuffersize;
staterecords = xcalloc (struct staterecord*, staterecords_max);
statefile_alloc = STATEFILE_ALLOC_SIZE;
#ifdef INPREC
if (input_record && savestate_state != STATE_DORESTORE) {
zfile_fclose (staterecord_statefile);
staterecord_statefile = NULL;
......@@ -1668,7 +1651,6 @@ void savestate_init (void)
inprec_open (NULL, NULL);
savestate_first_capture = 1;
}
#endif
}
......
......@@ -10,6 +10,7 @@
#define ZLIB_WINAPI
#define RECURSIVE_ARCHIVES 1
//#define ZFILE_DEBUG
#define FSDB_DIR_SEPARATOR_S "\\"
#include "sysconfig.h"
#include "sysdeps.h"
......@@ -1839,9 +1840,11 @@ struct zfile *zfile_fopen_empty (struct zfile *prev, const TCHAR *name, uae_u64
}
l->size = size;
l->datasize = size;
l->allocsize = size;
} else {
l->data = xcalloc (uae_u8, 1);
l->data = xcalloc (uae_u8, 1000);
l->size = 0;
l->allocsize = 1000;
}
return l;
}
......@@ -1885,6 +1888,24 @@ struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, uae_u8 *data)
return l;
}
int zfile_truncate (struct zfile *z, uae_s64 size)
{
if (z->data) {
if (z->size > size) {
z->size = size;
if (z->datasize > z->size)
z->datasize = z->size;
if (z->seek > z->size)
z->seek = z->size;
return 1;
}
return 0;
} else {
/* !!! */
return 0;
}
}
uae_s64 zfile_size (struct zfile *z)
{
return z->size;
......@@ -1983,12 +2004,25 @@ size_t zfile_fwrite (void *b, size_t l1, size_t l2, struct zfile *z)
return 0;
if (z->data) {
int off = z->seek + l1 * l2;
if (off > z->size) {
z->data = xrealloc (uae_u8, z->data, off);
if (z->allocsize == 0) {
write_log ("zfile_fwrite(data,%s) but allocsize=0!\n", z->name);
return 0;
}
if (off > z->allocsize) {
if (z->allocsize < off)
z->allocsize = off;
z->allocsize += z->size / 2;
if (z->allocsize < 10000)
z->allocsize = 10000;
z->data = xrealloc (uae_u8, z->data, z->allocsize);
z->datasize = z->size = off;
}
memcpy (z->data + z->seek, b, l1 * l2);
z->seek += l1 * l2;
if (z->seek > z->size)
z->size = z->seek;
if (z->size > z->datasize)
z->datasize = z->size;
return l2;
}
return fwrite (b, l1, l2, z->f);
......@@ -2089,7 +2123,7 @@ int zfile_ferror (struct zfile *z)
uae_u8 *zfile_getdata (struct zfile *z, uae_s64 offset, int len)
{
uae_s64 pos;
uae_s64 pos = zfile_ftell (z);
uae_u8 *b;
if (len < 0) {
zfile_fseek (z, 0, SEEK_END);
......@@ -2097,7 +2131,6 @@ uae_u8 *zfile_getdata (struct zfile *z, uae_s64 offset, int len)
zfile_fseek (z, 0, SEEK_SET);
}
b = xmalloc (uae_u8, len);
pos = zfile_ftell (z);
zfile_fseek (z, offset, SEEK_SET);
zfile_fread (b, len, 1, z);
zfile_fseek (z, pos, SEEK_SET);
......@@ -2206,7 +2239,6 @@ static struct zvolume *zvolume_list;
static void recurparent (TCHAR *newpath, struct znode *zn, int recurse)
{
TCHAR tmp[2] = { FSDB_DIR_SEPARATOR, 0 };
if (zn->parent && (&zn->volume->root != zn->parent || zn->volume->parentz == NULL)) {
if (&zn->volume->root == zn->parent && zn->volume->parentz == NULL && !_tcscmp (zn->name, zn->parent->name))
goto end;
......@@ -2218,7 +2250,7 @@ static void recurparent (TCHAR *newpath, struct znode *zn, int recurse)
}
end:
if (newpath[0])
_tcscat (newpath, tmp);
_tcscat (newpath, FSDB_DIR_SEPARATOR_S);
_tcscat (newpath, zn->name);
}
......@@ -2228,7 +2260,6 @@ static struct znode *znode_alloc (struct znode *parent, const TCHAR *name)
TCHAR tmpname[MAX_DPATH];
struct znode *zn = xcalloc (struct znode, 1);
struct znode *zn2;
TCHAR sep[] = { FSDB_DIR_SEPARATOR, 0 };
_tcscpy (tmpname, name);
zn2 = parent->child;
......@@ -2255,7 +2286,7 @@ static struct znode *znode_alloc (struct znode *parent, const TCHAR *name)
fullpath[0] = 0;
recurparent (fullpath, parent, 0);
_tcscat (fullpath, sep);
_tcscat (fullpath, FSDB_DIR_SEPARATOR_S);
_tcscat (fullpath, tmpname);
#ifdef ZFILE_DEBUG
write_log ("znode_alloc vol='%s' parent='%s' name='%s'\n", parent->volume->root.name, parent->name, name);
......@@ -2657,11 +2688,10 @@ struct znode *znode_adddir (struct znode *parent, const TCHAR *name, struct zarc
{
struct znode *zn;
TCHAR path[MAX_DPATH];
TCHAR sep[] = { FSDB_DIR_SEPARATOR, 0 };
path[0] = 0;
//recurparent (path, parent, 0);
_tcscat (path, sep);
recurparent (path, parent, 0);
_tcscat (path, FSDB_DIR_SEPARATOR_S);
_tcscat (path, name);
//zn = get_znode (parent->volume, path, 0);
if (zn)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment