Commit bb1b7971 authored by gnostic's avatar gnostic

puae 2.3.1

parent 358777a3
...@@ -1284,8 +1284,10 @@ static void do_blitter2 (int hpos, int copper) ...@@ -1284,8 +1284,10 @@ static void do_blitter2 (int hpos, int copper)
#ifdef BLITTER_DEBUG_NOWAIT #ifdef BLITTER_DEBUG_NOWAIT
if (bltstate != BLT_done) { if (bltstate != BLT_done) {
if (blit_final) if (blit_final) {
write_log ("blitter was already active! PC=%08x\n", M68K_GETPC); write_log ("blitter was already active! PC=%08x\n", M68K_GETPC);
//activate_debugger();
}
} }
#endif #endif
cleanstart = 0; cleanstart = 0;
......
...@@ -190,8 +190,8 @@ static const TCHAR *maxhoriz[] = { "lores", "hires", "superhires", 0 }; ...@@ -190,8 +190,8 @@ static const TCHAR *maxhoriz[] = { "lores", "hires", "superhires", 0 };
static const TCHAR *maxvert[] = { "nointerlace", "interlace", 0 }; static const TCHAR *maxvert[] = { "nointerlace", "interlace", 0 };
static const TCHAR *abspointers[] = { "none", "mousehack", "tablet", 0 }; static const TCHAR *abspointers[] = { "none", "mousehack", "tablet", 0 };
static const TCHAR *magiccursors[] = { "both", "native", "host", 0 }; static const TCHAR *magiccursors[] = { "both", "native", "host", 0 };
static const TCHAR *autoscale[] = { "none", "scale", "resize", 0 }; static const TCHAR *autoscale[] = { "none", "auto", "standard", "max", "scale", "resize", "center", 0 };
static const TCHAR *joyportmodes[] = { NULL, "mouse", "djoy", "ajoy", "cdtvjoy", "cd32joy", "lightpen", 0 }; static const TCHAR *joyportmodes[] = { "", "mouse", "djoy", "gamepad", "ajoy", "cdtvjoy", "cd32joy", "lightpen", 0 };
static const TCHAR *joyaf[] = { "none", "normal", "toggle", 0 }; static const TCHAR *joyaf[] = { "none", "normal", "toggle", 0 };
static const TCHAR *epsonprinter[] = { "none", "ascii", "epson_matrix_9pin", "epson_matrix_24pin", "epson_matrix_48pin", 0 }; static const TCHAR *epsonprinter[] = { "none", "ascii", "epson_matrix_9pin", "epson_matrix_24pin", "epson_matrix_48pin", 0 };
static const TCHAR *aspects[] = { "none", "vga", "tv", 0 }; static const TCHAR *aspects[] = { "none", "vga", "tv", 0 };
...@@ -726,6 +726,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) ...@@ -726,6 +726,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_dwrite_bool (f, "magic_mouse", p->input_magic_mouse); cfgfile_dwrite_bool (f, "magic_mouse", p->input_magic_mouse);
cfgfile_dwrite_str (f, "magic_mousecursor", magiccursors[p->input_magic_mouse_cursor]); cfgfile_dwrite_str (f, "magic_mousecursor", magiccursors[p->input_magic_mouse_cursor]);
cfgfile_dwrite_str (f, "absolute_mouse", abspointers[p->input_tablet]); cfgfile_dwrite_str (f, "absolute_mouse", abspointers[p->input_tablet]);
cfgfile_dwrite_bool (f, "clipboard_sharing", p->clipboard_sharing);
cfgfile_write (f, "gfx_display", "%d", p->gfx_display); cfgfile_write (f, "gfx_display", "%d", p->gfx_display);
cfgfile_write_str (f, "gfx_display_name", p->gfx_display_name); cfgfile_write_str (f, "gfx_display_name", p->gfx_display_name);
...@@ -740,6 +741,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) ...@@ -740,6 +741,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_write (f, "gfx_height_fullscreen", "%d", p->gfx_size_fs.height); cfgfile_write (f, "gfx_height_fullscreen", "%d", p->gfx_size_fs.height);
cfgfile_write (f, "gfx_refreshrate", "%d", p->gfx_refreshrate); cfgfile_write (f, "gfx_refreshrate", "%d", p->gfx_refreshrate);
cfgfile_write_bool (f, "gfx_autoresolution", p->gfx_autoresolution); cfgfile_write_bool (f, "gfx_autoresolution", p->gfx_autoresolution);
cfgfile_write (f, "gfx_backbuffers", "%d", p->gfx_backbuffers);
cfgfile_write_str (f, "gfx_vsync", vsyncmodes[p->gfx_avsync]); cfgfile_write_str (f, "gfx_vsync", vsyncmodes[p->gfx_avsync]);
cfgfile_write_str (f, "gfx_vsync_picasso", vsyncmodes[p->gfx_pvsync]); cfgfile_write_str (f, "gfx_vsync_picasso", vsyncmodes[p->gfx_pvsync]);
cfgfile_write_bool (f, "gfx_lores", p->gfx_resolution == 0); cfgfile_write_bool (f, "gfx_lores", p->gfx_resolution == 0);
...@@ -920,9 +922,9 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) ...@@ -920,9 +922,9 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
: "FOO")); : "FOO"));
#ifdef SAVESTATE #ifdef SAVESTATE
cfgfile_dwrite_str (f, "state_replay", p->statecapture ? "yes" : "no");
cfgfile_dwrite (f, "state_replay_rate", "%d", p->statecapturerate); cfgfile_dwrite (f, "state_replay_rate", "%d", p->statecapturerate);
cfgfile_dwrite (f, "state_replay_buffer", "%d", p->statecapturebuffersize); cfgfile_dwrite (f, "state_replay_buffers", "%d", p->statecapturebuffersize);
cfgfile_dwrite_bool (f, "state_replay_autoplay", p->inprec_autoplay);
#endif #endif
cfgfile_dwrite_bool (f, "warp", p->turbo_emulation); cfgfile_dwrite_bool (f, "warp", p->turbo_emulation);
...@@ -1309,7 +1311,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) ...@@ -1309,7 +1311,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
if (cfgfile_intval (option, value, "sound_latency", &p->sound_latency, 1) if (cfgfile_intval (option, value, "sound_latency", &p->sound_latency, 1)
|| cfgfile_intval (option, value, "sound_max_buff", &p->sound_maxbsiz, 1) || cfgfile_intval (option, value, "sound_max_buff", &p->sound_maxbsiz, 1)
|| cfgfile_intval (option, value, "state_replay_rate", &p->statecapturerate, 1) || cfgfile_intval (option, value, "state_replay_rate", &p->statecapturerate, 1)
|| cfgfile_intval (option, value, "state_replay_buffer", &p->statecapturebuffersize, 1) || cfgfile_intval (option, value, "state_replay_buffers", &p->statecapturebuffersize, 1)
|| cfgfile_yesno (option, value, "state_replay_autoplay", &p->inprec_autoplay)
|| cfgfile_intval (option, value, "sound_frequency", &p->sound_freq, 1) || cfgfile_intval (option, value, "sound_frequency", &p->sound_freq, 1)
|| cfgfile_intval (option, value, "sound_volume", &p->sound_volume, 1) || cfgfile_intval (option, value, "sound_volume", &p->sound_volume, 1)
|| cfgfile_intval (option, value, "sound_stereo_separation", &p->sound_stereo_separation, 1) || cfgfile_intval (option, value, "sound_stereo_separation", &p->sound_stereo_separation, 1)
...@@ -1381,17 +1384,16 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) ...@@ -1381,17 +1384,16 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
|| cfgfile_yesno (option, value, "sound_auto", &p->sound_auto) || cfgfile_yesno (option, value, "sound_auto", &p->sound_auto)
|| cfgfile_yesno (option, value, "sound_stereo_swap_paula", &p->sound_stereo_swap_paula) || cfgfile_yesno (option, value, "sound_stereo_swap_paula", &p->sound_stereo_swap_paula)
|| cfgfile_yesno (option, value, "sound_stereo_swap_ahi", &p->sound_stereo_swap_ahi) || cfgfile_yesno (option, value, "sound_stereo_swap_ahi", &p->sound_stereo_swap_ahi)
|| cfgfile_yesno (option, value, "state_replay", &p->statecapture)
|| cfgfile_yesno (option, value, "avoid_cmov", &p->avoid_cmov) || cfgfile_yesno (option, value, "avoid_cmov", &p->avoid_cmov)
|| cfgfile_yesno (option, value, "log_illegal_mem", &p->illegal_mem) || cfgfile_yesno (option, value, "log_illegal_mem", &p->illegal_mem)
|| cfgfile_yesno (option, value, "filesys_no_fsdb", &p->filesys_no_uaefsdb) || cfgfile_yesno (option, value, "filesys_no_fsdb", &p->filesys_no_uaefsdb)
|| cfgfile_yesno (option, value, "gfx_vsync_picasso", &p->gfx_pvsync)
|| cfgfile_yesno (option, value, "gfx_blacker_than_black", &p->gfx_blackerthanblack) || cfgfile_yesno (option, value, "gfx_blacker_than_black", &p->gfx_blackerthanblack)
|| cfgfile_yesno (option, value, "gfx_flickerfixer", &p->gfx_scandoubler) || cfgfile_yesno (option, value, "gfx_flickerfixer", &p->gfx_scandoubler)
|| cfgfile_yesno (option, value, "synchronize_clock", &p->tod_hack) || cfgfile_yesno (option, value, "synchronize_clock", &p->tod_hack)
|| cfgfile_yesno (option, value, "magic_mouse", &p->input_magic_mouse) || cfgfile_yesno (option, value, "magic_mouse", &p->input_magic_mouse)
|| cfgfile_yesno (option, value, "warp", &p->turbo_emulation) || cfgfile_yesno (option, value, "warp", &p->turbo_emulation)
|| cfgfile_yesno (option, value, "headless", &p->headless) || cfgfile_yesno (option, value, "headless", &p->headless)
|| cfgfile_yesno (option, value, "clipboard_sharing", &p->clipboard_sharing)
|| cfgfile_yesno (option, value, "bsdsocket_emu", &p->socket_emu)) || cfgfile_yesno (option, value, "bsdsocket_emu", &p->socket_emu))
return 1; return 1;
...@@ -3680,6 +3682,7 @@ void default_prefs (struct uae_prefs *p, int type) ...@@ -3680,6 +3682,7 @@ void default_prefs (struct uae_prefs *p, int type)
p->picasso96_nocustom = 1; p->picasso96_nocustom = 1;
p->cart_internal = 1; p->cart_internal = 1;
p->sana2 = 0; p->sana2 = 0;
p->clipboard_sharing = true;
p->cs_compatible = 1; p->cs_compatible = 1;
p->cs_rtc = 2; p->cs_rtc = 2;
...@@ -3708,13 +3711,13 @@ void default_prefs (struct uae_prefs *p, int type) ...@@ -3708,13 +3711,13 @@ void default_prefs (struct uae_prefs *p, int type)
p->gfx_filter = 0; p->gfx_filter = 0;
p->gfx_filtershader[0] = 0; p->gfx_filtershader[0] = 0;
p->gfx_filtermask[0] = 0; p->gfx_filtermask[0] = 0;
p->gfx_filter_horiz_zoom_mult = 0; p->gfx_filter_horiz_zoom_mult = 1000;
p->gfx_filter_vert_zoom_mult = 0; p->gfx_filter_vert_zoom_mult = 1000;
p->gfx_filter_bilinear = 0; p->gfx_filter_bilinear = 0;
p->gfx_filter_filtermode = 0; p->gfx_filter_filtermode = 0;
p->gfx_filter_scanlineratio = (1 << 4) | 1; p->gfx_filter_scanlineratio = (1 << 4) | 1;
p->gfx_filter_keep_aspect = 0; p->gfx_filter_keep_aspect = 0;
p->gfx_filter_autoscale = 0; p->gfx_filter_autoscale = AUTOSCALE_STATIC_AUTO;
p->gfx_filteroverlay_overscan = 0; p->gfx_filteroverlay_overscan = 0;
#endif #endif
...@@ -3782,9 +3785,9 @@ void default_prefs (struct uae_prefs *p, int type) ...@@ -3782,9 +3785,9 @@ void default_prefs (struct uae_prefs *p, int type)
#endif #endif
#ifdef SAVESTATE #ifdef SAVESTATE
p->statecapturebuffersize = 20 * 1024 * 1024; p->statecapturebuffersize = 100;
p->statecapturerate = 5 * 50; p->statecapturerate = 5 * 50;
p->statecapture = 0; p->inprec_autoplay = true;
#endif #endif
#ifdef UAE_MINI #ifdef UAE_MINI
......
...@@ -70,6 +70,14 @@ bootcode: ...@@ -70,6 +70,14 @@ bootcode:
residenthack residenthack
movem.l d0-d2/a0-a2/a6,-(sp) movem.l d0-d2/a0-a2/a6,-(sp)
move.w #$FF38,d0
moveq #17,d1
bsr.w getrtbase
jsr (a0)
tst.l d0
beq.s .rsh
move.l 4.w,a6 move.l 4.w,a6
cmp.w #37,20(a6) cmp.w #37,20(a6)
bcs.s .rsh bcs.s .rsh
...@@ -347,8 +355,8 @@ EXTS_loop: ...@@ -347,8 +355,8 @@ EXTS_loop:
jsr -366(a6) ; PutMsg jsr -366(a6) ; PutMsg
bra.b EXTS_loop bra.b EXTS_loop
EXTS_signal_reply: EXTS_signal_reply:
cmp.w #2,d0 cmp.w #2,d0
bgt.b EXTS_reply bgt.b EXTS_reply
move.l d1,d0 move.l d1,d0
jsr -$144(a6) ; Signal jsr -$144(a6) ; Signal
bra.b EXTS_loop bra.b EXTS_loop
...@@ -1226,15 +1234,15 @@ FSML_loop: ...@@ -1226,15 +1234,15 @@ FSML_loop:
clr.b 172(a3) clr.b 172(a3)
.nodc .nodc
move.l a4,d0 move.l a4,d0
beq.s FSML_loop beq.s nonnotif
; notify reply? ; notify reply?
cmp.w #38, 18(a4) cmp.w #38, 18(a4)
bne.s nonotif bne.s nonnotif
cmp.l #NOTIFY_CLASS, 20(a4) cmp.l #NOTIFY_CLASS, 20(a4)
bne.s nonotif bne.s nonnotif
cmp.w #NOTIFY_CODE, 24(a4) cmp.w #NOTIFY_CODE, 24(a4)
bne.s nonotif bne.s nonnotif
move.l 26(a4),a0 ; NotifyRequest move.l 26(a4),a0 ; NotifyRequest
move.l 12(a0),d0 ; flags move.l 12(a0),d0 ; flags
and.l #NRF_WAIT_REPLY|NRF_MAGIC,d0 and.l #NRF_WAIT_REPLY|NRF_MAGIC,d0
...@@ -1252,15 +1260,20 @@ nonoti ...@@ -1252,15 +1260,20 @@ nonoti
jsr FreeMem(a6) jsr FreeMem(a6)
bra.w FSML_loop bra.w FSML_loop
nonotif nonnotif
moveq #-2,d2 ; lock timeout "done" value
move.l a4,d0
beq.s FSML_check_queue_other
move.l 10(a4),d3 ; ln_Name move.l 10(a4),d3 ; ln_Name
bne.b FSML_FromDOS bne.b FSML_FromDOS
moveq #-1,d2 ; normal "done" value
; It's a dummy packet indicating that some queued command finished. ; It's a dummy packet indicating that some queued command finished.
move.w #$FF50,d0 ; exter_int_helper move.w #$FF50,d0 ; exter_int_helper
bsr.w getrtbase bsr.w getrtbase
moveq.l #1,d0 moveq.l #1,d0
jsr (a0) jsr (a0)
FSML_check_queue_other:
; Go through the queue and reply all those that finished. ; Go through the queue and reply all those that finished.
lea.l 4(a3),a2 lea.l 4(a3),a2
move.l (a2),a0 move.l (a2),a0
...@@ -1272,7 +1285,8 @@ FSML_check_old: ...@@ -1272,7 +1285,8 @@ FSML_check_old:
; This field may be accessed concurrently by several UAE threads. ; This field may be accessed concurrently by several UAE threads.
; This _should_ be harmless on all reasonable machines. ; This _should_ be harmless on all reasonable machines.
move.l 4(a0),d0 move.l 4(a0),d0
bpl.b FSML_check_next cmp.l d0,d2
bne.b FSML_check_next
movem.l a0/a1,-(a7) movem.l a0/a1,-(a7)
move.l 10(a0),a4 move.l 10(a0),a4
bsr.b ReplyOne bsr.b ReplyOne
...@@ -2061,6 +2075,14 @@ CLIP_END = (CLIP_POINTER_PREFS+32) ...@@ -2061,6 +2075,14 @@ CLIP_END = (CLIP_POINTER_PREFS+32)
clipboard_init: clipboard_init:
movem.l a5/a6,-(sp) movem.l a5/a6,-(sp)
move.w #$FF38,d0
moveq #17,d1
bsr.w getrtbase
jsr (a0)
btst #0,d0
beq.s .noclip
move.l 4.w,a6 move.l 4.w,a6
move.l #CLIP_END,d0 move.l #CLIP_END,d0
move.l #$10001,d1 move.l #$10001,d1
...@@ -2082,7 +2104,7 @@ clipboard_init: ...@@ -2082,7 +2104,7 @@ clipboard_init:
moveq #-10,d0 moveq #-10,d0
move.l #10000,d1 move.l #10000,d1
bsr.w createproc bsr.w createproc
.noclip
moveq #0,d0 moveq #0,d0
movem.l (sp)+,a5/a6 movem.l (sp)+,a5/a6
rts rts
...@@ -2413,13 +2435,15 @@ cliphook: ...@@ -2413,13 +2435,15 @@ cliphook:
consolehook: consolehook:
move.l 4.w,a6 move.l 4.w,a6
moveq #-1,d2 moveq #-1,d2
move.w #$FF38,d0 move.w #$FF38,d0
moveq #100,d1 moveq #17,d1
bsr.w getrtbase bsr.w getrtbase
jsr (a0) jsr (a0)
tst.l d0 btst #1,d0
beq.s .ch2 beq.s .ch2
moveq #0,d2 moveq #0,d2
jsr -$0084(a6) ;Forbid jsr -$0084(a6) ;Forbid
lea 350(a6),a0 ;DeviceList lea 350(a6),a0 ;DeviceList
......
...@@ -732,60 +732,57 @@ struct hardfiledata *get_hardfile_data (int nr) ...@@ -732,60 +732,57 @@ struct hardfiledata *get_hardfile_data (int nr)
#define MAXFILESIZE32 (0x7fffffff) #define MAXFILESIZE32 (0x7fffffff)
/* Passed as type to Lock() */ /* Passed as type to Lock() */
#define SHARED_LOCK -2 /* File is readable by others */ #define SHARED_LOCK -2 /* File is readable by others */
#define ACCESS_READ -2 /* Synonym */ #define ACCESS_READ -2 /* Synonym */
#define EXCLUSIVE_LOCK -1 /* No other access allowed */ #define EXCLUSIVE_LOCK -1 /* No other access allowed */
#define ACCESS_WRITE -1 /* Synonym */ #define ACCESS_WRITE -1 /* Synonym */
/* packet types */ /* packet types */
#define ACTION_CURRENT_VOLUME 7 #define ACTION_CURRENT_VOLUME 7
#define ACTION_LOCATE_OBJECT 8 #define ACTION_LOCATE_OBJECT 8
#define ACTION_RENAME_DISK 9 #define ACTION_RENAME_DISK 9
#define ACTION_FREE_LOCK 15 #define ACTION_FREE_LOCK 15
#define ACTION_DELETE_OBJECT 16 #define ACTION_DELETE_OBJECT 16
#define ACTION_RENAME_OBJECT 17 #define ACTION_RENAME_OBJECT 17
#define ACTION_MORE_CACHE 18 #define ACTION_MORE_CACHE 18
#define ACTION_COPY_DIR 19 #define ACTION_COPY_DIR 19
#define ACTION_SET_PROTECT 21 #define ACTION_SET_PROTECT 21
#define ACTION_CREATE_DIR 22 #define ACTION_CREATE_DIR 22
#define ACTION_EXAMINE_OBJECT 23 #define ACTION_EXAMINE_OBJECT 23
#define ACTION_EXAMINE_NEXT 24 #define ACTION_EXAMINE_NEXT 24
#define ACTION_DISK_INFO 25 #define ACTION_DISK_INFO 25
#define ACTION_INFO 26 #define ACTION_INFO 26
#define ACTION_FLUSH 27 #define ACTION_FLUSH 27
#define ACTION_SET_COMMENT 28 #define ACTION_SET_COMMENT 28
#define ACTION_PARENT 29 #define ACTION_PARENT 29
#define ACTION_SET_DATE 34 #define ACTION_SET_DATE 34
#define ACTION_FIND_WRITE 1004 #define ACTION_FIND_WRITE 1004
#define ACTION_FIND_INPUT 1005 #define ACTION_FIND_INPUT 1005
#define ACTION_FIND_OUTPUT 1006 #define ACTION_FIND_OUTPUT 1006
#define ACTION_END 1007 #define ACTION_END 1007
#define ACTION_SEEK 1008 #define ACTION_SEEK 1008
#define ACTION_WRITE_PROTECT 1023 #define ACTION_WRITE_PROTECT 1023
#define ACTION_IS_FILESYSTEM 1027 #define ACTION_IS_FILESYSTEM 1027
#define ACTION_READ 'R' #define ACTION_READ 'R'
#define ACTION_WRITE 'W' #define ACTION_WRITE 'W'
/* 2.0+ packet types */ /* 2.0+ packet types */
#define ACTION_INHIBIT 31 #define ACTION_INHIBIT 31
#define ACTION_SET_FILE_SIZE 1022 #define ACTION_SET_FILE_SIZE 1022
#define ACTION_LOCK_RECORD 2008 #define ACTION_LOCK_RECORD 2008
#define ACTION_FREE_RECORD 2009 #define ACTION_FREE_RECORD 2009
#define ACTION_SAME_LOCK 40 #define ACTION_SAME_LOCK 40
#define ACTION_CHANGE_MODE 1028 #define ACTION_CHANGE_MODE 1028
#define ACTION_FH_FROM_LOCK 1026 #define ACTION_FH_FROM_LOCK 1026
#define ACTION_COPY_DIR_FH 1030 #define ACTION_COPY_DIR_FH 1030
#define ACTION_PARENT_FH 1031 #define ACTION_PARENT_FH 1031
#define ACTION_EXAMINE_ALL 1033 #define ACTION_EXAMINE_ALL 1033
#define ACTION_EXAMINE_FH 1034 #define ACTION_EXAMINE_FH 1034
#define ACTION_EXAMINE_ALL_END 1035 #define ACTION_EXAMINE_ALL_END 1035
#define ACTION_MAKE_LINK 1021 #define ACTION_FORMAT 1020
#define ACTION_READ_LINK 1024
#define ACTION_FORMAT 1020
#define ACTION_IS_FILESYSTEM 1027 #define ACTION_IS_FILESYSTEM 1027
#define ACTION_ADD_NOTIFY 4097 #define ACTION_ADD_NOTIFY 4097
#define ACTION_REMOVE_NOTIFY 4098 #define ACTION_REMOVE_NOTIFY 4098
#define ACTION_CHANGE_FILE_POSITION64 8001 #define ACTION_CHANGE_FILE_POSITION64 8001
...@@ -793,7 +790,11 @@ struct hardfiledata *get_hardfile_data (int nr) ...@@ -793,7 +790,11 @@ struct hardfiledata *get_hardfile_data (int nr)
#define ACTION_CHANGE_FILE_SIZE64 8003 #define ACTION_CHANGE_FILE_SIZE64 8003
#define ACTION_GET_FILE_SIZE64 8004 #define ACTION_GET_FILE_SIZE64 8004
#define DISK_TYPE 0x444f5301 /* DOS\1 */ /* not supported */
#define ACTION_MAKE_LINK 1021
#define ACTION_READ_LINK 1024
#define DISK_TYPE 0x444f5301 /* DOS\1 */
typedef struct { typedef struct {
uae_u32 uniq; uae_u32 uniq;
...@@ -803,6 +804,17 @@ typedef struct { ...@@ -803,6 +804,17 @@ typedef struct {
a_inode *curr_file; a_inode *curr_file;
} ExamineKey; } ExamineKey;
struct lockrecord
{
struct lockrecord *next;
uae_u32 packet;
uae_u32 pos;
uae_u32 len;
uae_u32 mode;
uae_u32 timeout;
uae_u32 msg;
};
typedef struct key { typedef struct key {
struct key *next; struct key *next;
a_inode *aino; a_inode *aino;
...@@ -812,6 +824,7 @@ typedef struct key { ...@@ -812,6 +824,7 @@ typedef struct key {
int dosmode; int dosmode;
int createmode; int createmode;
int notifyactive; int notifyactive;
struct lockrecord *record;
} Key; } Key;
typedef struct notify { typedef struct notify {
...@@ -871,6 +884,8 @@ typedef struct _unit { ...@@ -871,6 +884,8 @@ typedef struct _unit {
/* Keys */ /* Keys */
struct key *keys; struct key *keys;
struct lockrecord *waitingrecords;
a_inode rootnode; a_inode rootnode;
unsigned long aino_cache_size; unsigned long aino_cache_size;
a_inode *aino_hash[MAX_AINO_HASH]; a_inode *aino_hash[MAX_AINO_HASH];
...@@ -1156,23 +1171,6 @@ int filesys_eject (int nr) ...@@ -1156,23 +1171,6 @@ int filesys_eject (int nr)
return 1; return 1;
} }
void filesys_vsync (void)
{
Unit *u;
for (u = units; u; u = u->next) {
if (u->reinsertdelay > 0) {
u->reinsertdelay--;
if (u->reinsertdelay == 0) {
filesys_insert (u->unit, u->newvolume, u->newrootdir, u->newreadonly, u->newflags);
xfree (u->newvolume);
u->newvolume = NULL;
xfree (u->newrootdir);
u->newrootdir = NULL;
}
}
}
}
static void filesys_delayed_change (Unit *u, int frames, const TCHAR *rootdir, const TCHAR *volume, bool readonly, int flags) static void filesys_delayed_change (Unit *u, int frames, const TCHAR *rootdir, const TCHAR *volume, bool readonly, int flags)
{ {
u->reinsertdelay = 50; u->reinsertdelay = 50;
...@@ -2144,7 +2142,7 @@ static void filesys_start_thread (UnitInfo *ui, int nr) ...@@ -2144,7 +2142,7 @@ static void filesys_start_thread (UnitInfo *ui, int nr)
ui->unit_pipe = 0; ui->unit_pipe = 0;
ui->back_pipe = 0; ui->back_pipe = 0;
ui->reset_state = FS_STARTUP; ui->reset_state = FS_STARTUP;
if (savestate_state != STATE_RESTORE) { if (!isrestore ()) {
ui->startup = 0; ui->startup = 0;
ui->self = 0; ui->self = 0;
} }
...@@ -2157,7 +2155,7 @@ static void filesys_start_thread (UnitInfo *ui, int nr) ...@@ -2157,7 +2155,7 @@ static void filesys_start_thread (UnitInfo *ui, int nr)
uae_start_thread ("filesys", filesys_thread, (void *)ui, &ui->tid); uae_start_thread ("filesys", filesys_thread, (void *)ui, &ui->tid);
} }
#endif #endif
if (savestate_state == STATE_RESTORE) if (isrestore ())
startup_update_unit (ui->self, ui); startup_update_unit (ui->self, ui);
} }
...@@ -2308,6 +2306,8 @@ static void free_key (Unit *unit, Key *k) ...@@ -2308,6 +2306,8 @@ static void free_key (Unit *unit, Key *k)
{ {
Key *k1; Key *k1;
Key *prev = 0; Key *prev = 0;
struct lockrecord *lr;
for (k1 = unit->keys; k1; k1 = k1->next) { for (k1 = unit->keys; k1; k1 = k1->next) {
if (k == k1) { if (k == k1) {
if (prev) if (prev)
...@@ -2319,6 +2319,12 @@ static void free_key (Unit *unit, Key *k) ...@@ -2319,6 +2319,12 @@ static void free_key (Unit *unit, Key *k)
prev = k1; prev = k1;
} }
for (lr = k->record; lr;) {
struct lockrecord *next = lr->next;
xfree (lr);
lr = next;
}
if (k->fd != NULL) if (k->fd != NULL)
fs_close (k->fd); fs_close (k->fd);
...@@ -2684,7 +2690,7 @@ static void ...@@ -2684,7 +2690,7 @@ static void
action_lock_from_fh (Unit *unit, dpacket packet) action_lock_from_fh (Unit *unit, dpacket packet)
{ {
Key *k = lookup_key (unit, GET_PCK_ARG1 (packet)); Key *k = lookup_key (unit, GET_PCK_ARG1 (packet));
TRACE(("ACTION_COPY_DIR_FH(0x%lx)\n", GET_PCK_ARG1 (packet))); TRACE(("ACTION_COPY_DIR_FH(0x%lx,'%s')\n", GET_PCK_ARG1 (packet), k ? k->aino->aname : "<null>"));
if (k == 0) { if (k == 0) {
PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES1 (packet, DOS_FALSE);
return; return;
...@@ -2985,6 +2991,198 @@ int get_native_path (uae_u32 lock, TCHAR *out) ...@@ -2985,6 +2991,198 @@ int get_native_path (uae_u32 lock, TCHAR *out)
return -1; return -1;
} }
#define REC_EXCLUSIVE 0
#define REC_EXCLUSIVE_IMMED 1
#define REC_SHARED 2
#define REC_SHARED_IMMED 3
static struct lockrecord *new_record (uae_u32 packet, uae_u32 pos, uae_u32 len, uae_u32 mode, uae_u32 timeout, uae_u32 msg)
{
struct lockrecord *lr = xcalloc (struct lockrecord, 1);
lr->packet = packet;
lr->pos = pos;
lr->len = len;
lr->mode = mode;
lr->timeout = timeout * vblank_hz / 50;
lr->msg = msg;
return lr;
}
static bool record_hit (Unit *unit, Key *k, uae_u32 pos, uae_u32 len, uae_u32 mode)
{
Key *k2;
struct lockrecord *lr;
bool exclusive = mode == REC_EXCLUSIVE || mode == REC_EXCLUSIVE_IMMED;
for (k2 = unit->keys; k2; k2 = k2->next) {
if (k2->aino->uniq == k->aino->uniq) {
if (k2 == k)
continue;
for (lr = k2->record; lr; lr = lr->next) {
bool exclusive2 = lr->mode == REC_EXCLUSIVE || lr->mode == REC_EXCLUSIVE_IMMED;
if (exclusive || exclusive2) {
uae_u32 a1 = pos;
uae_u32 a2 = pos + len;
uae_u32 b1 = lr->pos;
uae_u32 b2 = lr->pos + lr->len;
if (len && lr->len) {
bool hit = (a1 >= b1 && a1 < b2) || (a2 > b1 && a2 < b2) || (b1 >= a1 && b1 < a2) || (b2 > a1 && b2 < a2);
if (hit)
return true;
}
}
}
}
}
return false;
}
static void record_timeout (Unit *unit)
{
bool retry = true;
struct lockrecord *lr;
while (retry) {
retry = false;
struct lockrecord *prev = NULL;
for (lr = unit->waitingrecords; lr; lr = lr->next) {
lr->timeout--;
if (lr->timeout == 0) {
Key *k = lookup_key (unit, GET_PCK_ARG1 (lr->packet));
PUT_PCK_RES1 (lr->packet, DOS_FALSE);
PUT_PCK_RES2 (lr->packet, ERROR_LOCK_TIMEOUT);
// mark packet as complete
put_long (lr->msg + 4, 0xfffffffe);
uae_Signal (get_long (unit->volume + 176 - 32), 1 << 13);
if (prev)
prev->next = lr->next;
else
unit->waitingrecords = lr->next;
write_log ("queued record timed out '%s',%d,%d,%d,%d\n", k ? k->aino->nname : "NULL", lr->pos, lr->len, lr->mode, lr->timeout);
xfree (lr);
retry = true;
break;
}
prev = lr;
}
}
}
static void record_check_waiting (Unit *unit)
{
bool retry = true;
struct lockrecord *lr;
while (retry) {
retry = false;
struct lockrecord *prev = NULL;
for (lr = unit->waitingrecords; lr; lr = lr->next) {
Key *k = lookup_key (unit, GET_PCK_ARG1 (lr->packet));
if (!k || !record_hit (unit, k, lr->pos, lr->len, lr->mode)) {
if (prev)
prev->next = lr->next;
else
unit->waitingrecords = lr->next;
write_log ("queued record released '%s',%d,%d,%d,%d\n", k->aino->nname, lr->pos, lr->len, lr->mode, lr->timeout);
// mark packet as complete
put_long (lr->msg + 4, 0xffffffff);
xfree (lr);
retry = true;
break;
}
prev = lr;
}
}
}
static int action_lock_record (Unit *unit, dpacket packet, uae_u32 msg)
{
Key *k = lookup_key (unit, GET_PCK_ARG1 (packet));
uae_u32 pos = GET_PCK_ARG2 (packet);
uae_u32 len = GET_PCK_ARG3 (packet);
uae_u32 mode = GET_PCK_ARG4 (packet);
uae_u32 timeout = GET_PCK_ARG5 (packet);
bool exclusive = mode == REC_EXCLUSIVE || mode == REC_EXCLUSIVE_IMMED;
write_log ("action_lock_record('%s',%d,%d,%d,%d)\n", k ? k->aino->nname : "null", pos, len, mode, timeout);
if (!k || mode > REC_SHARED_IMMED) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_OBJECT_WRONG_TYPE);
return 1;
}
if (mode == REC_EXCLUSIVE_IMMED || mode == REC_SHARED_IMMED)
timeout = 0;
if (record_hit (unit, k, pos, len, mode)) {
if (timeout && msg) {
// queue it and do not reply
struct lockrecord *lr = new_record (packet, pos, len, mode, timeout, msg);
if (unit->waitingrecords) {
lr->next = unit->waitingrecords;
unit->waitingrecords = lr;
} else {
unit->waitingrecords = lr;
}
write_log ("-> collision, timeout queued\n");
return -1;
}
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_LOCK_COLLISION);
write_log ("-> ERROR_LOCK_COLLISION\n");
return 1;
}
struct lockrecord *lr = new_record (GET_PCK_ARG1 (packet), pos, len, mode, timeout, 0);
if (k->record) {
lr->next = k->record;
k->record = lr;
} else {
k->record = lr;
}
PUT_PCK_RES1 (packet, DOS_TRUE);
write_log ("-> OK\n");
return 1;
}
static void action_free_record (Unit *unit, dpacket packet)
{
Key *k = lookup_key (unit, GET_PCK_ARG1 (packet));
uae_u32 pos = GET_PCK_ARG2 (packet);
uae_u32 len = GET_PCK_ARG3 (packet);
write_log ("action_free_record('%s',%d,%d)\n", k ? k->aino->nname : "null", pos, len);
if (!k) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_OBJECT_WRONG_TYPE);
return;
}
struct lockrecord *prev = NULL;
struct lockrecord *lr;
for (lr = k->record; lr; lr = lr->next) {
if (lr->pos == pos && lr->len == len) {
if (prev)
prev->next = lr->next;
else
k->record = lr->next;
xfree (lr);
write_log ("->OK\n");
record_check_waiting (unit);
PUT_PCK_RES1 (packet, DOS_TRUE);
return;
}
}
write_log ("-> ERROR_RECORD_NOT_LOCKED\n");
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_RECORD_NOT_LOCKED);
}
#define EXALL_DEBUG 0 #define EXALL_DEBUG 0
#define EXALL_END 0xde1111ad #define EXALL_END 0xde1111ad
...@@ -3485,7 +3683,7 @@ no_more_entries: ...@@ -3485,7 +3683,7 @@ no_more_entries:
PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_NO_MORE_ENTRIES); PUT_PCK_RES2 (packet, ERROR_NO_MORE_ENTRIES);
} }
extern void activate_debugger(void);
static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallback) static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallback)
{ {
uaecptr fh = GET_PCK_ARG1 (packet) << 2; uaecptr fh = GET_PCK_ARG1 (packet) << 2;
...@@ -3500,8 +3698,12 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb ...@@ -3500,8 +3698,12 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb
int isarch = unit->volflags & MYVOLUMEINFO_ARCHIVE; int isarch = unit->volflags & MYVOLUMEINFO_ARCHIVE;
TRACE(("ACTION_FIND_*(0x%lx,0x%lx,\"%s\",%d,%d)\n", fh, lock, bstr (unit, name), mode, create)); TRACE(("ACTION_FIND_*(0x%lx,0x%lx,\"%s\",%d,%d)\n", fh, lock, bstr (unit, name), mode, create));
TRACE(("fh=%x lock=%x name=%x\n", fh, lock, name));
DUMPLOCK(unit, lock); DUMPLOCK(unit, lock);
if (!_tcsicmp(bstr(unit,name), "Nù"))
activate_debugger();
aino = find_aino (unit, lock, bstr (unit, name), &err); aino = find_aino (unit, lock, bstr (unit, name), &err);
if (aino == 0 || (err != 0 && err != ERROR_OBJECT_NOT_AROUND)) { if (aino == 0 || (err != 0 && err != ERROR_OBJECT_NOT_AROUND)) {
...@@ -4930,12 +5132,14 @@ static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context) ...@@ -4930,12 +5132,14 @@ static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context)
return 0; return 0;
} }
static int handle_packet (Unit *unit, dpacket pck) static int handle_packet (Unit *unit, dpacket pck, uae_u32 msg)
{ {
uae_s32 type = GET_PCK_TYPE (pck); uae_s32 type = GET_PCK_TYPE (pck);
PUT_PCK_RES2 (pck, 0); PUT_PCK_RES2 (pck, 0);
#if TRACING_ENABLED > 0
if (unit->inhibited && filesys_isvolume(unit) write_log("packet=%d\n", type);
#endif
if (unit->inhibited && filesys_isvolume (unit)
&& type != ACTION_INHIBIT && type != ACTION_MORE_CACHE && type != ACTION_INHIBIT && type != ACTION_MORE_CACHE
&& type != ACTION_DISK_INFO) { && type != ACTION_DISK_INFO) {
PUT_PCK_RES1 (pck, DOS_FALSE); PUT_PCK_RES1 (pck, DOS_FALSE);
...@@ -4945,7 +5149,7 @@ static int handle_packet (Unit *unit, dpacket pck) ...@@ -4945,7 +5149,7 @@ static int handle_packet (Unit *unit, dpacket pck)
if (type != ACTION_INHIBIT && type != ACTION_CURRENT_VOLUME if (type != ACTION_INHIBIT && type != ACTION_CURRENT_VOLUME
&& type != ACTION_IS_FILESYSTEM && type != ACTION_MORE_CACHE && type != ACTION_IS_FILESYSTEM && type != ACTION_MORE_CACHE
&& type != ACTION_WRITE_PROTECT && type != ACTION_WRITE_PROTECT
&& !filesys_isvolume(unit)) { && !filesys_isvolume (unit)) {
PUT_PCK_RES1 (pck, DOS_FALSE); PUT_PCK_RES1 (pck, DOS_FALSE);
PUT_PCK_RES2 (pck, ERROR_NO_DISK); PUT_PCK_RES2 (pck, ERROR_NO_DISK);
return 1; return 1;
...@@ -4993,6 +5197,8 @@ static int handle_packet (Unit *unit, dpacket pck) ...@@ -4993,6 +5197,8 @@ static int handle_packet (Unit *unit, dpacket pck)
case ACTION_REMOVE_NOTIFY: action_remove_notify (unit, pck); break; case ACTION_REMOVE_NOTIFY: action_remove_notify (unit, pck); break;
case ACTION_EXAMINE_ALL: return action_examine_all (unit, pck); case ACTION_EXAMINE_ALL: return action_examine_all (unit, pck);
case ACTION_EXAMINE_ALL_END: return action_examine_all_end (unit, pck); case ACTION_EXAMINE_ALL_END: return action_examine_all_end (unit, pck);
case ACTION_LOCK_RECORD: return action_lock_record (unit, pck, msg); break;
case ACTION_FREE_RECORD: action_free_record (unit, pck); break;
/* OS4+ packet types */ /* OS4+ packet types */
case ACTION_CHANGE_FILE_POSITION64: action_change_file_position64 (unit, pck); break; case ACTION_CHANGE_FILE_POSITION64: action_change_file_position64 (unit, pck); break;
...@@ -5001,8 +5207,6 @@ static int handle_packet (Unit *unit, dpacket pck) ...@@ -5001,8 +5207,6 @@ static int handle_packet (Unit *unit, dpacket pck)
case ACTION_GET_FILE_SIZE64: action_get_file_size64 (unit, pck); break; case ACTION_GET_FILE_SIZE64: action_get_file_size64 (unit, pck); break;
/* unsupported packets */ /* unsupported packets */
case ACTION_LOCK_RECORD:
case ACTION_FREE_RECORD:
case ACTION_MAKE_LINK: case ACTION_MAKE_LINK:
case ACTION_READ_LINK: case ACTION_READ_LINK:
case ACTION_FORMAT: case ACTION_FORMAT:
...@@ -5040,18 +5244,19 @@ static void *filesys_thread (void *unit_v) ...@@ -5040,18 +5244,19 @@ static void *filesys_thread (void *unit_v)
put_long (get_long (morelocks), get_long (ui->self->locklist)); put_long (get_long (morelocks), get_long (ui->self->locklist));
put_long (ui->self->locklist, morelocks); put_long (ui->self->locklist, morelocks);
if (! handle_packet (ui->self, pck)) { int ret = handle_packet (ui->self, pck, msg);
if (!ret) {
PUT_PCK_RES1 (pck, DOS_FALSE); PUT_PCK_RES1 (pck, DOS_FALSE);
PUT_PCK_RES2 (pck, ERROR_ACTION_NOT_KNOWN); PUT_PCK_RES2 (pck, ERROR_ACTION_NOT_KNOWN);
} }
/* Mark the packet as processed for the list scan in the assembly code. */ if (ret >= 0) {
put_long (msg + 4, 0xffffffff); /* Mark the packet as processed for the list scan in the assembly code. */
/* Acquire the message lock, so that we know we can safely send the put_long (msg + 4, 0xffffffff);
* message. */ }
/* Acquire the message lock, so that we know we can safely send the message. */
ui->self->cmds_sent++; ui->self->cmds_sent++;
/* The message is sent by our interrupt handler, so make sure an interrupt /* The message is sent by our interrupt handler, so make sure an interrupt happens. */
* happens. */ do_uae_int_requested ();
do_uae_int_requested();
/* Send back the locks. */ /* Send back the locks. */
if (get_long (ui->self->locklist) != 0) if (get_long (ui->self->locklist) != 0)
write_comm_pipe_int (ui->back_pipe, (int)(get_long (ui->self->locklist)), 0); write_comm_pipe_int (ui->back_pipe, (int)(get_long (ui->self->locklist)), 0);
...@@ -5098,7 +5303,7 @@ static uae_u32 REGPARAM2 filesys_handler (TrapContext *context) ...@@ -5098,7 +5303,7 @@ static uae_u32 REGPARAM2 filesys_handler (TrapContext *context)
} }
#endif #endif
if (! handle_packet (unit, packet_addr)) { if (! handle_packet (unit, packet_addr, 0)) {
error: error:
PUT_PCK_RES1 (packet_addr, DOS_FALSE); PUT_PCK_RES1 (packet_addr, DOS_FALSE);
PUT_PCK_RES2 (packet_addr, ERROR_ACTION_NOT_KNOWN); PUT_PCK_RES2 (packet_addr, ERROR_ACTION_NOT_KNOWN);
...@@ -5141,6 +5346,8 @@ void filesys_cleanup (void) ...@@ -5141,6 +5346,8 @@ void filesys_cleanup (void)
void filesys_free_handles (void) void filesys_free_handles (void)
{ {
Unit *u, *u1; Unit *u, *u1;
struct lockrecord *lr;
for (u = units; u; u = u1) { for (u = units; u; u = u1) {
Key *k1, *knext; Key *k1, *knext;
u1 = u->next; u1 = u->next;
...@@ -5151,6 +5358,12 @@ void filesys_free_handles (void) ...@@ -5151,6 +5358,12 @@ void filesys_free_handles (void)
xfree (k1); xfree (k1);
} }
u->keys = NULL; u->keys = NULL;
struct lockrecord *lrnext;
for (lr = u->waitingrecords; lr; lr = lrnext) {
lrnext = lr->next;
xfree (lr);
}
u->waitingrecords = NULL;
free_all_ainos (u, &u->rootnode); free_all_ainos (u, &u->rootnode);
u->rootnode.next = u->rootnode.prev = &u->rootnode; u->rootnode.next = u->rootnode.prev = &u->rootnode;
u->aino_cache_size = 0; u->aino_cache_size = 0;
...@@ -5165,10 +5378,6 @@ static void filesys_reset2 (void) ...@@ -5165,10 +5378,6 @@ static void filesys_reset2 (void)
{ {
Unit *u, *u1; Unit *u, *u1;
/* We get called once from customreset at the beginning of the program
* before filesys_start_threads has been called. Survive that. */
if (savestate_state == STATE_RESTORE)
return;
filesys_free_handles (); filesys_free_handles ();
for (u = units; u; u = u1) { for (u = units; u; u = u1) {
...@@ -5183,7 +5392,7 @@ static void filesys_reset2 (void) ...@@ -5183,7 +5392,7 @@ static void filesys_reset2 (void)
void filesys_reset (void) void filesys_reset (void)
{ {
if (savestate_state == STATE_RESTORE) if (isrestore ())
return; return;
filesys_reset2 (); filesys_reset2 ();
initialize_mountinfo (); initialize_mountinfo ();
...@@ -5224,7 +5433,7 @@ static void filesys_prepare_reset2 (void) ...@@ -5224,7 +5433,7 @@ static void filesys_prepare_reset2 (void)
void filesys_prepare_reset (void) void filesys_prepare_reset (void)
{ {
if (savestate_state == STATE_RESTORE) if (isrestore ())
return; return;
filesys_prepare_reset2 (); filesys_prepare_reset2 ();
} }
...@@ -5534,10 +5743,10 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke ...@@ -5534,10 +5743,10 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
return -2; return -2;
} }
for (rdblock = 0; rdblock < lastblock; rdblock++) { for (rdblock = 0; rdblock < lastblock; rdblock++) {
hdf_read (hfd, bufrdb, rdblock * hfd->blocksize, hfd->blocksize); hdf_read_rdb (hfd, bufrdb, rdblock * hfd->blocksize, hfd->blocksize);
if (rdb_checksum ("RDSK", bufrdb, rdblock)) if (rdb_checksum ("RDSK", bufrdb, rdblock))
break; break;
hdf_read (hfd, bufrdb, rdblock * hfd->blocksize, hfd->blocksize); hdf_read_rdb (hfd, bufrdb, rdblock * hfd->blocksize, hfd->blocksize);
if (!memcmp ("RDSK", bufrdb, 4)) { if (!memcmp ("RDSK", bufrdb, 4)) {
bufrdb[0xdc] = 0; bufrdb[0xdc] = 0;
bufrdb[0xdd] = 0; bufrdb[0xdd] = 0;
...@@ -5912,8 +6121,13 @@ static uae_u32 REGPARAM2 mousehack_done (TrapContext *context) ...@@ -5912,8 +6121,13 @@ static uae_u32 REGPARAM2 mousehack_done (TrapContext *context)
} else if (mode == 16) { } else if (mode == 16) {
uaecptr a2 = m68k_areg (regs, 2); uaecptr a2 = m68k_areg (regs, 2);
input_mousehack_mouseoffset (a2); input_mousehack_mouseoffset (a2);
} else if (mode == 100) { } else if (mode == 17) {
return consolehook_activate () ? 1 : 0; uae_u32 v = 0;
/*if (currprefs.clipboard_sharing)
v |= 1;
if (consolehook_activate ())
v |= 2;*/
return v;
} else if (mode == 101) { } else if (mode == 101) {
consolehook_ret (m68k_areg (regs, 1), m68k_areg (regs, 2)); consolehook_ret (m68k_areg (regs, 1), m68k_areg (regs, 2));
} else if (mode == 102) { } else if (mode == 102) {
...@@ -5925,6 +6139,25 @@ static uae_u32 REGPARAM2 mousehack_done (TrapContext *context) ...@@ -5925,6 +6139,25 @@ static uae_u32 REGPARAM2 mousehack_done (TrapContext *context)
return 1; return 1;
} }
void filesys_vsync (void)
{
Unit *u;
for (u = units; u; u = u->next) {
if (u->reinsertdelay > 0) {
u->reinsertdelay--;
if (u->reinsertdelay == 0) {
filesys_insert (u->unit, u->newvolume, u->newrootdir, u->newreadonly, u->newflags);
xfree (u->newvolume);
u->newvolume = NULL;
xfree (u->newrootdir);
u->newrootdir = NULL;
}
}
record_timeout (u);
}
}
void filesys_install (void) void filesys_install (void)
{ {
uaecptr loop; uaecptr loop;
......
...@@ -371,7 +371,7 @@ static uae_u32 vhd_checksum (uae_u8 *p, int offset) ...@@ -371,7 +371,7 @@ static uae_u32 vhd_checksum (uae_u8 *p, int offset)
return ~sum; return ~sum;
} }
static int hdf_open2 (struct hardfiledata *hfd, const TCHAR *pname) int hdf_open (struct hardfiledata *hfd, const TCHAR *pname)
{ {
uae_u8 tmp[512], tmp2[512]; uae_u8 tmp[512], tmp2[512];
uae_u32 v; uae_u32 v;
...@@ -439,25 +439,6 @@ end: ...@@ -439,25 +439,6 @@ end:
return 0; return 0;
} }
int hdf_open (struct hardfiledata *hfd, const TCHAR *pname)
{
int v;
uae_u8 buf[512];
v = hdf_open2 (hfd, pname);
if (!v)
return v;
memset (buf, 0, sizeof buf);
hdf_read (hfd, buf, 0, sizeof buf);
if (buf[0] == 0x39 && buf[1] == 0x10 && buf[2] == 0xd3 && buf[3] == 0x12) { // AdIDE encoded "CPRM"
hfd->adide = 1;
}
if (!memcmp (buf, "DRKS", 4)) {
hfd->byteswap = 1;
}
return v;
}
void hdf_close (struct hardfiledata *hfd) void hdf_close (struct hardfiledata *hfd)
{ {
hdf_close_target (hfd); hdf_close_target (hfd);
...@@ -888,6 +869,28 @@ static void hdf_byteswap (void *v, int len) ...@@ -888,6 +869,28 @@ static void hdf_byteswap (void *v, int len)
} }
} }
int hdf_read_rdb (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
{
int v;
v = hdf_read (hfd, buffer, offset, len);
if (v > 0 && offset < 16 * 512 && !hfd->byteswap && !hfd->adide) {
uae_u8 *buf = (uae_u8*)buffer;
bool changed = false;
if (buf[0] == 0x39 && buf[1] == 0x10 && buf[2] == 0xd3 && buf[3] == 0x12) { // AdIDE encoded "CPRM"
hfd->adide = 1;
changed = true;
write_log ("HDF: adide scrambling detected\n");
} else if (!memcmp (buf, "DRKS", 4)) {
hfd->byteswap = 1;
changed = true;
write_log ("HDF: byteswapped RDB detected\n");
}
if (changed)
v = hdf_read (hfd, buffer, offset, len);
}
return v;
}
int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
{ {
int v; int v;
......
...@@ -99,6 +99,7 @@ extern struct hardfiledata *get_hardfile_data (int nr); ...@@ -99,6 +99,7 @@ extern struct hardfiledata *get_hardfile_data (int nr);
extern int hdf_open (struct hardfiledata *hfd, const TCHAR *name); extern int hdf_open (struct hardfiledata *hfd, const TCHAR *name);
extern int hdf_dup (struct hardfiledata *dhfd, const struct hardfiledata *shfd); extern int hdf_dup (struct hardfiledata *dhfd, const struct hardfiledata *shfd);
extern void hdf_close (struct hardfiledata *hfd); extern void hdf_close (struct hardfiledata *hfd);
extern int hdf_read_rdb (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); extern int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len); extern int hdf_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_getnumharddrives (void); extern int hdf_getnumharddrives (void);
......
...@@ -773,7 +773,7 @@ void inprec_playtorecord (void) ...@@ -773,7 +773,7 @@ void inprec_playtorecord (void)
} }
zfile_fwrite (inprec_buffer + header_end2, inprec_size - header_end2, 1, inprec_zf); zfile_fwrite (inprec_buffer + header_end2, inprec_size - header_end2, 1, inprec_zf);
inprec_realtime (false); inprec_realtime (false);
// savestate_capture_request (); savestate_capture_request ();
} }
void inprec_setposition (int offset, int replaycounter) void inprec_setposition (int offset, int replaycounter)
......
...@@ -3866,8 +3866,10 @@ static void m68k_run_2p (void) ...@@ -3866,8 +3866,10 @@ static void m68k_run_2p (void)
prefetch_pc = m68k_getpc (); prefetch_pc = m68k_getpc ();
prefetch = x_get_long (prefetch_pc); prefetch = x_get_long (prefetch_pc);
for (;;) { for (;;) {
uae_u16 opcode;
uae_u32 pc = m68k_getpc (); uae_u32 pc = m68k_getpc ();
uae_u16 opcode;
r->instruction_pc = pc;
#if DEBUG_CD32CDTVIO #if DEBUG_CD32CDTVIO
out_cd32io (m68k_getpc ()); out_cd32io (m68k_getpc ());
...@@ -3877,19 +3879,16 @@ static void m68k_run_2p (void) ...@@ -3877,19 +3879,16 @@ static void m68k_run_2p (void)
if (pc == prefetch_pc) { if (pc == prefetch_pc) {
opcode = prefetch >> 16; opcode = prefetch >> 16;
regs.instruction_pc = pc;
} else if (pc == prefetch_pc + 2) { } else if (pc == prefetch_pc + 2) {
regs.instruction_pc = pc + 2;
opcode = prefetch; opcode = prefetch;
} else { } else {
regs.instruction_pc = pc;
opcode = x_get_word (pc); opcode = x_get_word (pc);
prefetch_pc = pc + 2;
prefetch = x_get_long (prefetch_pc);
} }
count_instr (opcode); count_instr (opcode);
prefetch_pc = m68k_getpc () + 2;
prefetch = x_get_long (prefetch_pc);
cpu_cycles = (*cpufunctbl[opcode])(opcode); cpu_cycles = (*cpufunctbl[opcode])(opcode);
cpu_cycles &= cycles_mask; cpu_cycles &= cycles_mask;
cpu_cycles |= cycles_val; cpu_cycles |= cycles_val;
...@@ -4986,6 +4985,7 @@ static void exception3f (uae_u32 opcode, uaecptr addr, int writeaccess, int inst ...@@ -4986,6 +4985,7 @@ static void exception3f (uae_u32 opcode, uaecptr addr, int writeaccess, int inst
last_writeaccess_for_exception_3 = writeaccess; last_writeaccess_for_exception_3 = writeaccess;
last_instructionaccess_for_exception_3 = instructionaccess; last_instructionaccess_for_exception_3 = instructionaccess;
Exception (3); Exception (3);
//activate_debugger();
} }
void exception3 (uae_u32 opcode, uaecptr addr) void exception3 (uae_u32 opcode, uaecptr addr)
......
...@@ -271,7 +271,7 @@ static uae_u32 emulib_GetDisk (uae_u32 drive, uaecptr name) ...@@ -271,7 +271,7 @@ static uae_u32 emulib_GetDisk (uae_u32 drive, uaecptr name)
if (drive > 3) if (drive > 3)
return 0; return 0;
for (i = 0;i < 256; i++) { for (i = 0; i < 256; i++) {
put_byte (name + i, currprefs.floppyslots[drive].df[i]); put_byte (name + i, currprefs.floppyslots[drive].df[i]);
} }
return 1; return 1;
......
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