From: Toni Wilen Date: Mon, 26 Mar 2012 16:59:14 +0000 (+0300) Subject: 2400b26 X-Git-Tag: 2400~2 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=388bfaadd09396192589bcc8fce5ff5fdbdb2c16;p=francis%2Fwinuae.git 2400b26 --- diff --git a/autoconf.cpp b/autoconf.cpp index 8c6256a3..3a2618b6 100644 --- a/autoconf.cpp +++ b/autoconf.cpp @@ -177,7 +177,7 @@ uae_u32 ds_bstr_ansi (const uae_char *str) rt_straddr--; rtarea[rt_straddr] = len - 2; strcpy ((uae_char*)rtarea + rt_straddr + 1, str); - return addr (rt_straddr); + return addr (rt_straddr) >> 2; } void calltrap (uae_u32 n) diff --git a/filesys.asm b/filesys.asm index aaf0acee..58a96e7d 100644 --- a/filesys.asm +++ b/filesys.asm @@ -23,6 +23,7 @@ ; 2009.01.20 clipboard sharing ; 2009.12.27 console hook ; 2010.05.27 Z3Chip +; 2011.12.17 built-in CDFS support AllocMem = -198 FreeMem = -210 @@ -70,6 +71,14 @@ bootcode: residenthack 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 cmp.w #37,20(a6) bcs.s .rsh @@ -151,16 +160,17 @@ FSIN_explibok: move.l d0,a4 tst.l $10c(a5) - beq.s FSIN_none + beq.w FSIN_none move.l #PP_TOTAL,d0 move.l #$10001,d1 jsr AllocMem(a6) move.l d0,a3 ; param packet move.l a4,PP_EXPLIB(a3) + moveq #0,d6 FSIN_init_units: - cmp.l $10c(a5),d6 + cmp.w $10e(a5),d6 bcc.b FSIN_units_ok move.l d6,-(sp) FSIN_nextsub: @@ -181,8 +191,27 @@ FSIN_nextsub: FSIN_nomoresub: move.l (sp)+,d6 addq.w #1,d6 - bra.b FSIN_init_units + bra.b FSIN_init_units FSIN_units_ok: + + tst.w d5 + beq.s CDIN_done + moveq #0,d6 +CDIN_init_units: + move.w $10c(a5),d0 + btst d6,d0 + beq.s CDIN_next + movem.l d6/a3,-(sp) + move.l a3,a0 + bset #31,d6 + bsr.w make_cd_dev + movem.l (sp)+,d6/a3 +CDIN_next: + addq.w #1,d6 + cmp.w #8,d6 + bne.s CDIN_init_units +CDIN_done: + move.l 4.w,a6 move.l a3,a1 move.l #PP_TOTAL,d0 @@ -224,7 +253,6 @@ FSIN_none: ;FSIN_scandone: ; jsr -$007e(a6) ; Enable - filesys_dev_storeinfo moveq #3,d4 ; MEMF_CHIP | MEMF_PUBLIC cmp.w #36,20(a6) @@ -233,6 +261,11 @@ filesys_dev_storeinfo FSIN_ksold ; add >2MB-6MB chip RAM to memory list + lea $210000,a1 + ; do not add if RAM detected already + jsr -$216(a6) ; TypeOfMem + tst.l d0 + bne.s FSIN_chip_done move.w #$FF80,d0 bsr.w getrtbase jsr (a0) @@ -347,8 +380,8 @@ EXTS_loop: jsr -366(a6) ; PutMsg bra.b EXTS_loop EXTS_signal_reply: - cmp.w #2,d0 - bgt.b EXTS_reply + cmp.w #2,d0 + bgt.b EXTS_reply move.l d1,d0 jsr -$144(a6) ; Signal bra.b EXTS_loop @@ -554,7 +587,7 @@ r0 move.l d7,d0 ree moveq #0,d7 bra.s r0 -fsres +fsres: movem.l d1/a0-a2/a6,-(sp) move.l 4.w,a6 lea $150(a6),a0 ;ResourceList @@ -897,6 +930,100 @@ action_exall tst.l (a0) ; eac_Entries == 0 -> get more rts + ; mount CD drives using built-in AROS CDFS + uaescsi.device + +make_cd_dev: ; IN: A0 param_packet, D6: unit_no | 0x80000000 (=CD) + bsr.w fsres + move.l d0,PP_FSRES(a0) ; pointer to FileSystem.resource + move.l a0,-(sp) + move.w #$FFFC,d0 ; filesys base + bsr.w getrtbase + move.l (a0),a5 + move.w #$FF28,d0 ; fill in unit-dependent info (filesys_dev_storeinfo) + bsr.w getrtbase + move.l a0,a1 + move.l (sp)+,a0 + clr.l PP_FSSIZE(a0) ; filesystem size + clr.l PP_FSPTR(a0) ; filesystem memory + jsr (a1) + tst.l d0 + beq.w .fail + + ; allocate memory for loaded filesystem + move.l PP_FSSIZE(a0),d0 + beq.s .nofs + bmi.s .nofs + move.l a0,-(sp) + moveq #1,d1 + move.l 4.w,a6 + jsr AllocMem(a6) + move.l (sp)+,a0 + move.l d0,PP_FSPTR(a0) + beq.w .fail +.nofs + + move.l a4,a6 + move.l a0,-(sp) + jsr -144(a6) ; MakeDosNode() + move.l (sp)+,a0 ; parmpacket + move.l a0,a1 + move.l d0,a3 ; devicenode + move.w #$FF20,d0 ; record in ui.startup (filesys_dev_remember) + bsr.w getrtbase + jsr (a0) + moveq #0,d0 + move.l d0,8(a3) ; dn_Task + move.l d0,16(a3) ; dn_Handler + move.l d0,32(a3) ; dn_SegList + + move.l PP_FSPTR(a1),d0 + beq.s .nofs2 + move.l d0,a0 + bsr.w relocate + movem.l d0/a0-a1,-(sp) + move.l PP_FSSIZE(a1),d0 + move.l PP_FSPTR(a1),a1 + move.l 4.w,a6 + jsr FreeMem(a6) + movem.l (sp)+,d0/a0-a1 + bsr.w addfs +.nofs2 + move.w #$FF18,d0 ; update dn_SegList if needed (filesys_dev_bootfilesys) + bsr.w getrtbase + jsr (a0) + + move.b 79(a1),d3 ; bootpri + cmp.b #-128,d3 + beq.s .cdnoboot + move.l 4.w,a6 + moveq #20,d0 + move.l #65536+1,d1 + jsr AllocMem(a6) + move.l d0,a1 ; bootnode + move.w #$1000,d0 + or.b d3,d0 + move.w d0,8(a1) + move.l $104(a5),10(a1) ; filesys_configdev + move.l a3,16(a1) ; devicenode + lea.l 74(a4),a0 ; MountList + jsr -$0084(a6) ;Forbid + jsr -270(a6) ; Enqueue() + jsr -$008a(a6) ;Permit + bra.s .fail +.cdnoboot: + move.l a1,a2 ; bootnode + move.l a3,a0 ; parmpacket + moveq #0,d1 + move.l d1,a1 + moveq #1,d1 ; ADNF_STARTPROC (v36+) + moveq #-20,d0 + move.l a4,a6 ; expansion base + jsr -150(a6) ; AddDosNode + +.fail: + rts + + ; mount harddrives, virtual or hdf make_dev: ; IN: A0 param_packet, D6: unit_no, D7: b0=autoboot,b1=onthefly,b2=v36+ ; A4: expansionbase @@ -930,15 +1057,15 @@ make_dev: ; IN: A0 param_packet, D6: unit_no, D7: b0=autoboot,b1=onthefly,b2=v36 mountalways ; allocate memory for loaded filesystem move.l PP_FSSIZE(a0),d0 - beq.s nordbfs1 - bmi.s nordbfs1 + beq.s .nordbfs1 + bmi.s .nordbfs1 move.l a0,-(sp) moveq #1,d1 move.l 4.w,a6 jsr AllocMem(a6) move.l (sp)+,a0 move.l d0,PP_FSPTR(a0) -nordbfs1: +.nordbfs1: tst.l d3 bpl.s do_mount @@ -1005,23 +1132,23 @@ MKDV_is_filesys: MKDV_doboot: btst #0,d7 beq.b MKDV_noboot + cmp.b #-128,d3 + beq.s MKDV_noboot move.l 4.w,a6 - moveq.l #20,d0 - moveq.l #0,d1 + moveq #20,d0 + move.l #65536+1,d1 jsr AllocMem(a6) move.l d0,a1 ; bootnode - moveq #0,d0 - move.l d0,(a1) - move.l d0,4(a1) - move.w d0,14(a1) move.w #$1000,d0 or.b d3,d0 move.w d0,8(a1) move.l $104(a5),10(a1) ; filesys_configdev - move.l a3,16(a1) ; devicenode + move.l a3,16(a1) ; devicenode lea.l 74(a4),a0 ; MountList + jsr -$0084(a6) ;Forbid jsr -270(a6) ; Enqueue() + jsr -$008a(a6) ;Permit moveq #0,d0 rts @@ -1035,7 +1162,8 @@ MKDV_noboot: btst #2,d7 beq.s .nob moveq #1,d1 ; ADNF_STARTPROC (v36+) -.nob moveq #-20,d0 +.nob + moveq #-128,d0 move.l a4,a6 ; expansion base jsr -150(a6) ; AddDosNode btst #1,d7 @@ -1219,22 +1347,35 @@ FSML_loop: bset #13,d0 ; SIGBREAK_CTRL_D jsr -$013e(a6) ;Wait .msg - ; disk changed? + ; SIGBREAK_CTRL_D = disk change notification from native code tst.b 172(a3) beq.s .nodc + ; call filesys_media_change_reply (pre) + move.w #$ff58,d0 ; fsmisc_helper + bsr.w getrtbase + moveq #1,d0 ; filesys_media_change_reply + jsr (a0) + tst.l d0 + beq.s .nodc2 bsr.w diskchange +.nodc2 clr.b 172(a3) + ; call filesys_media_change_reply (post) + move.w #$ff58,d0 ; fsmisc_helper + bsr.w getrtbase + moveq #2,d0 ; filesys_media_change_reply + jsr (a0) .nodc move.l a4,d0 - beq.s FSML_loop + beq.s nonnotif ; notify reply? cmp.w #38, 18(a4) - bne.s nonotif + bne.s nonnotif cmp.l #NOTIFY_CLASS, 20(a4) - bne.s nonotif + bne.s nonnotif cmp.w #NOTIFY_CODE, 24(a4) - bne.s nonotif + bne.s nonnotif move.l 26(a4),a0 ; NotifyRequest move.l 12(a0),d0 ; flags and.l #NRF_WAIT_REPLY|NRF_MAGIC,d0 @@ -1245,22 +1386,27 @@ FSML_loop: move.l a4,a1 move.b #8,(a1) jsr -366(a6) ; PutMsg - bra.s FSML_loop + bra.w FSML_loop nonoti move.l a4,a1 moveq #38,d0 jsr FreeMem(a6) 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 bne.b FSML_FromDOS + moveq #-1,d2 ; normal "done" value ; It's a dummy packet indicating that some queued command finished. move.w #$FF50,d0 ; exter_int_helper bsr.w getrtbase moveq.l #1,d0 jsr (a0) +FSML_check_queue_other: ; Go through the queue and reply all those that finished. lea.l 4(a3),a2 move.l (a2),a0 @@ -1272,7 +1418,8 @@ FSML_check_old: ; This field may be accessed concurrently by several UAE threads. ; This _should_ be harmless on all reasonable machines. move.l 4(a0),d0 - bpl.b FSML_check_next + cmp.l d0,d2 + bne.b FSML_check_next movem.l a0/a1,-(a7) move.l 10(a0),a4 bsr.b ReplyOne @@ -1328,8 +1475,9 @@ FSML_ReplyOne2: bsr.w action_exall bne.s FSML_ReplyOne3 ; Arghh.. we need more entries. (some buggy programs fail if eac_Entries = 0 with continue enabled) - move.w #$ff58,d0 + move.w #$ff58,d0 ; fsmisc_helper bsr.w getrtbase + moveq #0,d0 ; exall jsr (a0) bra.s .exaretry @@ -2061,6 +2209,14 @@ CLIP_END = (CLIP_POINTER_PREFS+32) clipboard_init: 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 #CLIP_END,d0 move.l #$10001,d1 @@ -2082,7 +2238,7 @@ clipboard_init: moveq #-10,d0 move.l #10000,d1 bsr.w createproc - +.noclip moveq #0,d0 movem.l (sp)+,a5/a6 rts @@ -2413,13 +2569,15 @@ cliphook: consolehook: move.l 4.w,a6 + moveq #-1,d2 move.w #$FF38,d0 - moveq #100,d1 + moveq #17,d1 bsr.w getrtbase jsr (a0) - tst.l d0 + btst #1,d0 beq.s .ch2 + moveq #0,d2 jsr -$0084(a6) ;Forbid lea 350(a6),a0 ;DeviceList diff --git a/filesys.cpp b/filesys.cpp index 43cc12de..50ac2934 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -104,8 +104,8 @@ static void aino_test_init (a_inode *aino) uaecptr filesys_initcode; -static uae_u32 fsdevname, filesys_configdev; -static uae_u32 cdfs_devname, cdfs_control; +static uae_u32 fsdevname, fshandlername, filesys_configdev; +static uae_u32 cdfs_devname, cdfs_handlername, cdfs_control; static int filesys_in_interrupt; static uae_u32 mountertask; static int automountunit = -1; @@ -125,6 +125,7 @@ typedef struct { TCHAR *devname; /* device name, e.g. UAE0: */ uaecptr devname_amiga; uaecptr startup; + uaecptr devicenode; TCHAR *volname; /* volume name, e.g. CDROM, WORK, etc. */ int volflags; /* volume flags, readonly, stream uaefsdb support */ TCHAR *rootdir; /* root native directory/hdf. empty drive if invalid path */ @@ -201,7 +202,7 @@ int nr_directory_units (struct uae_prefs *p) int is_hardfile (int unit_no) { - if (mountinfo.ui[unit_no].volname || mountinfo.ui[unit_no].wasisempty) + if (mountinfo.ui[unit_no].volname || mountinfo.ui[unit_no].wasisempty || mountinfo.ui[unit_no].unknown_media) return FILESYS_VIRTUAL; if (mountinfo.ui[unit_no].hf.secspertrack == 0) { if (mountinfo.ui[unit_no].hf.flags & 1) @@ -818,8 +819,10 @@ struct hardfiledata *get_hardfile_data (int nr) #define ACTION_MAKE_LINK 1021 #define ACTION_READ_LINK 1024 -#define DISK_TYPE 0x444f5301 /* DOS\1 */ -#define CDFS_DOSTYPE (USE_CDFS == 2 ? 0x43444653 : 0x43445644) +#define DISK_TYPE_DOS 0x444f5300 /* DOS\0 */ +#define DISK_TYPE_DOS_FFS 0x444f5301 /* DOS\1 */ +#define CDFS_DOSTYPE 0x43440000 /* CDxx */ +//#define CDFS_DOSTYPE (USE_CDFS == 2 ? 0x43444653 : 0x43445644) typedef struct { uae_u32 uniq; @@ -1158,7 +1161,14 @@ static uae_u32 fs_fsize (struct fs_filehandle *fsf) return (uae_u32)fs_fsize64 (fsf); } -static void set_volume_name (Unit *unit) +static void set_highcyl (UnitInfo *ui, uae_u32 blocks) +{ + uaecptr startup = get_long (ui->devicenode + 7 * 4) << 2; + uaecptr env = get_long (startup + 8) << 2; + put_long (env + 10 * 4, blocks); +} + +static void set_volume_name (Unit *unit, uae_u32 ctime) { int namelen; int i; @@ -1170,6 +1180,13 @@ static void set_volume_name (Unit *unit) for (i = 0; i < namelen; i++) put_byte (unit->volume + 45 + i, s[i]); put_byte (unit->volume + 45 + namelen, 0); + if (ctime) { + long days, mins, ticks; + get_time (ctime, &days, &mins, &ticks); + put_long (unit->volume + 16, days); + put_long (unit->volume + 20, mins); + put_long (unit->volume + 24, ticks); + } xfree (s); unit->rootnode.aname = unit->ui.volname; unit->rootnode.nname = unit->ui.rootdir; @@ -1178,7 +1195,7 @@ static void set_volume_name (Unit *unit) static int filesys_isvolume (Unit *unit) { - return get_byte (unit->volume + 44); + return get_byte (unit->volume + 44) || unit->ui.unknown_media; } static void clear_exkeys (Unit *unit) @@ -1220,7 +1237,7 @@ static void filesys_delayed_change (Unit *u, int frames, const TCHAR *rootdir, c u->newrootdir = my_strdup (rootdir); if (volume) u->newvolume = my_strdup (volume); - filesys_eject(u->unit); + filesys_eject (u->unit); if (!rootdir || _tcslen (rootdir) == 0) u->reinsertdelay = 0; if (u->reinsertdelay > 0) @@ -1330,6 +1347,7 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) ui->cdfs_superblock = u->ui.cdfs_superblock = NULL; zfile_fclose_archive (u->zarchive); u->zarchive = NULL; + u->ui.unknown_media = false; } else { u->mount_changed = 0; } @@ -1337,6 +1355,7 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) } else if (u->mount_changed > 0) { if (mode == 0) { // insert + uae_u32 ctime = 0; bool emptydrive = false; struct uaedev_config_info *uci; @@ -1345,18 +1364,27 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) xfree (u->ui.rootdir); ui->rootdir = u->ui.rootdir = my_strdup (u->mount_rootdir); flush_cache (u, -1); + xfree (u->ui.volname); + ui->volname = u->ui.volname = NULL; if (ui->unit_type == UNIT_CDFS) { uae_u64 uniq; ui->cdfs_superblock = u->ui.cdfs_superblock = isofs_mount (ui->cddevno, &uniq); u->rootnode.uniq_external = uniq; - if (!u->ui.cdfs_superblock) + if (!u->ui.cdfs_superblock) { + u->ui.unknown_media = true; return 0; + } struct isofs_info ii; + set_highcyl (ui, 0); if (isofs_mediainfo (ui->cdfs_superblock, &ii) && ii.media) { u->ui.unknown_media = ii.unknown_media; - if (!ii.unknown_media) + if (!ii.unknown_media) { u->ui.volname = ui->volname = my_strdup (ii.volumename); + ctime = ii.creation; + set_highcyl (ui, ii.blocks); + } } + } else { if (set_filesys_volume (u->mount_rootdir, &u->mount_flags, &u->mount_readonly, &emptydrive, &u->zarchive) < 0) return 0; @@ -1365,16 +1393,20 @@ static uae_u32 filesys_media_change_reply (TrapContext *ctx, int mode) xfree (u->ui.volname); ui->volname = u->ui.volname = filesys_createvolname (u->mount_volume, u->mount_rootdir, L"removable"); } - set_volume_name (u); - write_log (L"FILESYS: inserted volume NR=%d RO=%d '%s' ('%s')\n", nr, u->mount_readonly, ui->volname, u->mount_rootdir); - if (u->mount_flags >= 0) - ui->volflags = u->volflags = u->ui.volflags = u->mount_flags; - _tcscpy (uci->volname, ui->volname); - _tcscpy (uci->rootdir, u->mount_rootdir); - if (u->mount_flags >= 0) - uci->readonly = ui->readonly = u->ui.readonly = u->mount_readonly; - put_byte (u->volume + 44, 0); - put_byte (u->volume + 172 - 32, 1); + if (u->ui.unknown_media) { + write_log (L"FILESYS: inserted unreadable volume NR=%d RO=%d\n", nr, u->mount_readonly); + } else { + write_log (L"FILESYS: inserted volume NR=%d RO=%d '%s' ('%s')\n", nr, u->mount_readonly, ui->volname, u->mount_rootdir); + set_volume_name (u, ctime); + if (u->mount_flags >= 0) + ui->volflags = u->volflags = u->ui.volflags = u->mount_flags; + _tcscpy (uci->volname, ui->volname); + _tcscpy (uci->rootdir, u->mount_rootdir); + if (u->mount_flags >= 0) + uci->readonly = ui->readonly = u->ui.readonly = u->mount_readonly; + put_byte (u->volume + 44, 0); + put_byte (u->volume + 172 - 32, 1); + } xfree (u->mount_volume); xfree (u->mount_rootdir); @@ -2345,6 +2377,7 @@ static uae_u32 REGPARAM2 startup_handler (TrapContext *context) int late = 0; int ed, ef; uae_u64 uniq = 0; + uae_u32 cdays, ctime = 0; /* find UnitInfo with correct device name */ s = _tcschr (devname, ':'); @@ -2368,6 +2401,7 @@ static uae_u32 REGPARAM2 startup_handler (TrapContext *context) return 0; } uinfo = mountinfo.ui + i; + cdays = 3800 + i; if (uinfo->unit_type == UNIT_CDFS) { ed = ef = 0; @@ -2387,6 +2421,8 @@ static uae_u32 REGPARAM2 startup_handler (TrapContext *context) uinfo->wasisempty = false; if (!ii.unknown_media) { uinfo->volname = my_strdup (ii.volumename); + ctime = ii.creation; + set_highcyl (uinfo, ii.totalblocks); } } uinfo->unknown_media = ii.unknown_media; @@ -2436,7 +2472,7 @@ static uae_u32 REGPARAM2 startup_handler (TrapContext *context) /* Prepare volume information */ put_long (unit->volume + 4, 2); /* Type = dt_volume */ put_long (unit->volume + 12, 0); /* Lock */ - put_long (unit->volume + 16, 3800 + i); /* Creation Date */ + put_long (unit->volume + 16, cdays); /* Creation Date */ put_long (unit->volume + 20, 0); put_long (unit->volume + 24, 0); put_long (unit->volume + 28, 0); /* lock list */ @@ -2445,12 +2481,12 @@ static uae_u32 REGPARAM2 startup_handler (TrapContext *context) put_byte (unit->volume + 44, 0); if (!uinfo->wasisempty && !uinfo->unknown_media) { /* Set volume if non-empty */ - set_volume_name (unit); + set_volume_name (unit, ctime); fsdb_clean_dir (&unit->rootnode); } put_long (unit->volume + 8, unit->port); - put_long (unit->volume + 32, uinfo->unit_type == UNIT_CDFS ? CDFS_DOSTYPE : DISK_TYPE); + put_long (unit->volume + 32, uinfo->unit_type == UNIT_CDFS ? DISK_TYPE_DOS : DISK_TYPE_DOS_FFS); put_long (pkt + dp_Res1, DOS_TRUE); @@ -2497,7 +2533,7 @@ static void } else { put_long (info + 12, fsu.fsu_blocks ); /* numblocks */ put_long (info + 16, fsu.fsu_blocks - fsu.fsu_bavail); /* inuse */ - put_long (info + 24, DISK_TYPE); /* disk type */ + put_long (info + 24, (unit->volflags & MYVOLUMEINFO_CDFS) ? DISK_TYPE_DOS : DISK_TYPE_DOS_FFS); /* disk type */ put_long (info + 28, unit->volume >> 2); /* volume node */ } put_long (info + 32, 0); /* inuse */ @@ -3044,7 +3080,7 @@ static void { struct _stat64 statbuf; long days, mins, ticks; - int i, n, entrytype; + int i, n, entrytype, blocksize; int fsdb_can = fsdb_cando (unit); TCHAR *xs; char *x, *x2; @@ -3090,7 +3126,8 @@ static void #ifdef HAVE_ST_BLOCKS put_long (info + 128, statbuf.st_blocks); #else - put_long (info + 128, (statbuf.st_size + 511) / 512); + blocksize = (unit->volflags & MYVOLUMEINFO_CDFS) ? 2048 : 512; + put_long (info + 128, (statbuf.st_size + blocksize - 1) / blocksize); #endif get_time (statbuf.st_mtime, &days, &mins, &ticks); put_long (info + 132, days); @@ -4927,7 +4964,7 @@ static void /* get volume name */ xfree (unit->ui.volname); unit->ui.volname = bstr1 (name); - set_volume_name (unit); + set_volume_name (unit, 0); PUT_PCK_RES1 (packet, DOS_TRUE); } @@ -5684,14 +5721,16 @@ static uae_u32 REGPARAM2 filesys_dev_bootfilesys (TrapContext *context) uaecptr fsres = get_long (parmpacket + PP_FSRES); uaecptr fsnode; uae_u32 dostype, dostype2; - UnitInfo *uip = mountinfo.ui; int no = m68k_dreg (regs, 6) & 0x7fffffff; int unit_no = no & 65535; + UnitInfo *uip = &mountinfo.ui[unit_no]; int iscd = (m68k_dreg (regs, 6) & 0x80000000) != 0 || uip->unit_type == UNIT_CDFS; int type; if (iscd) { #if USE_CDFS == 2 + if (!get_long (devicenode + 16)) + put_long (devicenode + 16, cdfs_handlername); return 0; #endif type = FILESYS_CD; @@ -5699,8 +5738,11 @@ static uae_u32 REGPARAM2 filesys_dev_bootfilesys (TrapContext *context) type = is_hardfile (unit_no); } - if (type == FILESYS_VIRTUAL) + if (type == FILESYS_VIRTUAL) { + if (!get_long (devicenode + 16)) + put_long (devicenode + 16, fshandlername); return 0; + } dostype = get_long (parmpacket + 80); fsnode = get_long (fsres + 18); while (get_long (fsnode)) { @@ -5758,6 +5800,7 @@ static uae_u32 REGPARAM2 filesys_dev_remember (TrapContext *context) int fssize; uae_u8 *fs; + uip->devicenode = devicenode; if (iscd && USE_CDFS == 1) { fssize = cdfs_handler_len; fs = cdfs_handler; @@ -6041,6 +6084,9 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke buf = xmalloc (uae_u8, readblocksize); if (showdebug) { + if ((uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize > hfd->virtsize) + write_log (L"RDB: WARNING: RDSK header disk size > disk size! (%I64u > %I64u)\n", + (uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize, hfd->virtsize); write_log (L"RDSK dump start\n"); write_log (L"RDSK at %d, C=%d S=%d H=%d\n", rdblock, hfd->cylinders, hfd->sectors, hfd->heads); @@ -6048,11 +6094,6 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke write_log (L"RDSK dump end\n"); } - if ((uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize > hfd->virtsize) { - write_log (L"RDB: WARNING: RDSK header disk size > disk size! (%I64u > %I64u)\n", - (uae_u64)hfd->cylinders * hfd->sectors * hfd->heads, hfd->virtsize); - } - for (i = 0; i <= partnum; i++) { if (i == 0) partblock = rl (bufrdb + 28); @@ -6334,7 +6375,7 @@ static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *context) } write_log (L"Mounting uaescsi.device %d: (%d)\n", cd_unit_no, unit_no); - put_long (parmpacket, cdname_amiga); + put_long (parmpacket + 0, cdname_amiga); put_long (parmpacket + 4, cdfs_devname); put_long (parmpacket + 8, cd_unit_no); put_long (parmpacket + 12, 0); /* Device flags */ @@ -6350,13 +6391,13 @@ static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *context) put_long (parmpacket + 52, 0); /* lowCyl */ put_long (parmpacket + 56, 0); /* hiCyl */ put_long (parmpacket + 60, 50); /* Number of buffers */ - put_long (parmpacket + 64, 0); /* Buffer mem type */ - put_long (parmpacket + 68, 0x7FFFFFFF); /* largest transfer */ - put_long (parmpacket + 72, ~1); /* addMask (?) */ + put_long (parmpacket + 64, 1); /* Buffer mem type */ + put_long (parmpacket + 68, 0x7FFFFFFE); /* largest transfer */ + put_long (parmpacket + 72, 0x7FFFFFFE); /* addrressMask (?) */ put_long (parmpacket + 76, scsi_get_cd_drive_media_mask () & (1 << cd_unit_no) ? -127 : -128); /* bootPri */ - put_long (parmpacket + 80, CDFS_DOSTYPE); + put_long (parmpacket + 80, CDFS_DOSTYPE | (((cd_unit_no / 10) + '0') << 8) | ((cd_unit_no % 10) + '0')); put_long (parmpacket + 84, 0); /* baud */ - put_long (parmpacket + 88, cdfs_control >> 2); /* Control. BSTR! */ + put_long (parmpacket + 88, cdfs_control); put_long (parmpacket + 92, 0); /* bootblocks */ #if USE_CDFS == 1 uaecptr fsres = get_long (parmpacket + PP_FSRES); @@ -6403,11 +6444,11 @@ static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *context) put_long (parmpacket + 44, 0); /* unused */ put_long (parmpacket + 48, 0); /* interleave */ put_long (parmpacket + 60, 50); /* Number of buffers */ - put_long (parmpacket + 64, 0); /* Buffer mem type */ - put_long (parmpacket + 68, 0x7FFFFFFF); /* largest transfer */ - put_long (parmpacket + 72, ~1); /* addMask (?) */ + put_long (parmpacket + 64, 1); /* Buffer mem type */ + put_long (parmpacket + 68, 0x7FFFFFFE); /* largest transfer */ + put_long (parmpacket + 72, 0x7FFFFFFE); /* addMask (?) */ put_long (parmpacket + 76, uip[unit_no].bootpri); /* bootPri */ - put_long (parmpacket + 80, 0x444f5300); /* DOS\0 */ + put_long (parmpacket + 80, DISK_TYPE_DOS); /* DOS\0 */ if (type == FILESYS_VIRTUAL) { put_long (parmpacket + 4, fsdevname); put_long (parmpacket + 20, 1024 >> 2); /* longwords per block */ @@ -6510,8 +6551,10 @@ void filesys_install (void) ROM_filesys_resid = ds_ansi ("UAE unixfs 0.4"); fsdevname = ds_ansi ("uae.device"); /* does not really exist */ + fshandlername = ds_bstr_ansi ("uaefs"); #if USE_CDFS cdfs_devname = ds_ansi ("uaescsi.device"); + cdfs_handlername = ds_bstr_ansi ("uaecdfs"); #if USE_CDFS == 1 cdfs_control = ds_bstr_ansi ("ROCKRIDGE JOLIET MAYBELOWERCASE SCANINTERVAL=-1 DE=.1 RE=.2"); #endif diff --git a/fsusage.cpp b/fsusage.cpp index ac8f8fe4..1d02f84a 100644 --- a/fsusage.cpp +++ b/fsusage.cpp @@ -55,7 +55,7 @@ int get_fs_usage (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp) ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes; if (!GetFullPathName (path, sizeof buf2 / sizeof (TCHAR), buf2, NULL)) { - write_log (L"GetFullPathName() failed err=%d\n", GetLastError()); + write_log (L"GetFullPathName('%s') failed err=%d\n", path, GetLastError ()); return -1; } @@ -74,7 +74,7 @@ int get_fs_usage (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp) } if (!GetDiskFreeSpaceEx (buf2, &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes)) { - write_log (L"GetDiskFreeSpaceEx() failed err=%d\n", GetLastError()); + write_log (L"GetDiskFreeSpaceEx('%s') failed err=%d\n", buf2, GetLastError ()); return -1; } diff --git a/include/isofs_api.h b/include/isofs_api.h index e72b8a94..c601956c 100644 --- a/include/isofs_api.h +++ b/include/isofs_api.h @@ -8,7 +8,9 @@ struct isofs_info bool unknown_media; TCHAR volumename[256]; uae_u32 blocks; + uae_u32 totalblocks; uae_u32 blocksize; + time_t creation; }; void *isofs_mount(int unitnum, uae_u64 *uniq); diff --git a/isofs.cpp b/isofs.cpp index 2b90672d..96b37a5a 100644 --- a/isofs.cpp +++ b/isofs.cpp @@ -305,30 +305,10 @@ static void isofs_normalize_block_and_offset(struct iso_directory_record* de, un #endif } -/* - * We have to convert from a MM/DD/YY format to the Unix ctime format. - * We have to take into account leap years and all of that good stuff. - * Unfortunately, the kernel does not have the information on hand to - * take into account daylight savings time, but it shouldn't matter. - * The time stored should be localtime (with or without DST in effect), - * and the timezone offset should hold the offset required to get back - * to GMT. Thus we should always be correct. - */ - -static int iso_date(char * p, int flag) +static int make_date(int year, int month, int day, int hour, int minute, int second, int tz) { - int year, month, day, hour, minute, second, tz; int crtime, days, i; - year = p[0] - 70; - month = p[1]; - day = p[2]; - hour = p[3]; - minute = p[4]; - second = p[5]; - if (flag == 0) tz = p[6]; /* High sierra has no time zone */ - else tz = 0; - if (year < 0) { crtime = 0; } else { @@ -380,7 +360,64 @@ static int iso_date(char * p, int flag) return crtime; } +/* + * We have to convert from a MM/DD/YY format to the Unix ctime format. + * We have to take into account leap years and all of that good stuff. + * Unfortunately, the kernel does not have the information on hand to + * take into account daylight savings time, but it shouldn't matter. + * The time stored should be localtime (with or without DST in effect), + * and the timezone offset should hold the offset required to get back + * to GMT. Thus we should always be correct. + */ + +static int iso_date(char * p, int flag) +{ + int year, month, day, hour, minute, second, tz; + year = p[0] - 70; + month = p[1]; + day = p[2]; + hour = p[3]; + minute = p[4]; + second = p[5]; + if (flag == 0) tz = p[6]; /* High sierra has no time zone */ + else tz = 0; + + return make_date(year, month, day, hour, minute, second, tz); +} + +static int iso_ltime(char *p) +{ + int year, month, day, hour, minute, second; + char t; + + t = p[4]; + p[4] = 0; + year = atol(p); + p[4] = t; + t = p[6]; + p[6] = 0; + month = atol(p + 4); + p[6] = t; + t = p[8]; + p[8] = 0; + day = atol(p + 6); + p[8] = t; + t = p[10]; + p[10] = 0; + hour = atol(p + 8); + p[10] = t; + t = p[12]; + p[12] = 0; + minute = atol(p + 10); + p[12] = t; + t = p[14]; + p[14] = 0; + second = atol(p + 12); + p[14] = t; + + return make_date(year - 1970, month, day, hour, minute, second, 0); +} static int isofs_read_level3_size(struct inode *inode) @@ -1641,6 +1678,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent, uae_u int table, error = -EINVAL; unsigned int vol_desc_start; TCHAR *volume_name = NULL, *ch; + uae_u32 volume_date; //save_mount_options(s, data); @@ -1809,6 +1847,7 @@ root_found: write_log (L"ISOFS: System ID: %s", ch); xfree(ch); volume_name = getname(pri->volume_id, 32); + volume_date = iso_ltime(pri->creation_date); write_log (L" Volume ID: '%s'\n", volume_name); if (!strncmp(pri->system_id, ISO_SYSTEM_ID_CDTV, strlen(ISO_SYSTEM_ID_CDTV))) sbi->s_cdtv = 1; @@ -1938,6 +1977,7 @@ root_found: iput(inode); s->root = inode; inode->name = volume_name; + inode->i_ctime.tv_sec = volume_date; *uniq = inode->i_ino; return 0; @@ -2379,12 +2419,19 @@ bool isofs_mediainfo(void *sbp, struct isofs_info *ii) return true; struct isofs_sb_info *sbi = ISOFS_SB(sb); if (sys_command_ismedia (sb->unitnum, true)) { + struct device_info di; + uae_u32 totalblocks = 0; ii->media = true; + di.cylinders = 0; + if (sys_command_info (sb->unitnum, &di, true)) + totalblocks = di.cylinders * di.sectorspertrack * di.trackspercylinder; ii->unknown_media = sb->unknown_media; ii->blocksize = 2048; if (sb->root) { _tcscpy (ii->volumename, sb->root->name); ii->blocks = sbi->s_max_size; + ii->totalblocks = totalblocks ? totalblocks : ii->blocks; + ii->creation = sb->root->i_ctime.tv_sec; } } return true; diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index eb7a7791..d0405bba 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -397,6 +397,8 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p) m |= RP_SCREENMODE_FULLWINDOW; sm->dwScreenMode = m | (storeflags & (RP_SCREENMODE_STRETCH | RP_SCREENMODE_SUBPIXEL)); + sm->lTargetHeight = 0; + sm->lTargetWidth = 0; if ((storeflags & RP_SCREENMODE_MODEMASK) == RP_SCREENMODE_XX) { sm->dwScreenMode &= ~RP_SCREENMODE_MODEMASK; sm->dwScreenMode |= RP_SCREENMODE_XX; @@ -634,7 +636,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM case RPIPCHM_PAUSE: currentpausemode = pause_emulation; if (wParam ? 1 : 0 != pause_emulation ? 1 : 0) { - pausemode (wParam ? 1 : 0); + pausemode (wParam ? -1 : 0); if (wParam) { currentpausemode = -1; return 2; @@ -880,7 +882,8 @@ static void sendenum (void) cnt = 0; while ((cnt = rp_input_enum (&desc, cnt)) >= 0) { if (log_rp) - write_log(L"Enum%d: '%s' '%s'\n", cnt, desc.szHostInputName, desc.szHostInputID); + write_log(L"Enum%d: '%s' '%s' (%x/%x)\n", + cnt, desc.szHostInputName, desc.szHostInputID, desc.dwHostInputVendorID, desc.dwHostInputProductID); RPSendMessagex (RPIPCGM_INPUTDEVICE, 0, 0, &desc, sizeof desc, &guestinfo, NULL); } } diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index a91f0c39..5de956a4 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -791,6 +791,8 @@ void minimizewindow (void) void enablecapture (void) { + if (pause_emulation > 2) + return; setmouseactive (1); if (sound_closed < 0) { resumesoundpaused (); diff --git a/od-win32/win32.h b/od-win32/win32.h index 7c3bc765..3b207ba2 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,8 +19,8 @@ #define LANG_DLL 1 //#define WINUAEBETA L"" -#define WINUAEBETA L"Beta 25 (RC3)" -#define WINUAEDATE MAKEBD(2012, 3, 24) +#define WINUAEBETA L"Beta 26 (RC4)" +#define WINUAEDATE MAKEBD(2012, 3, 26) #define WINUAEEXTRA L"RC1" //#define WINUAEEXTRA L"AmiKit Preview" #define WINUAEREV L"" diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 0dbb688f..a90c40fc 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,3 +1,17 @@ +- cpu throttling +- custom event autofire +- cycle exact mode scanline sync +- restore only single input target to default. + + + + +Beta 25: (RC4) + +- CDFS missing features added: HighCyl value and volume creation timestamp. + I think all features are now done. +- CDFS media change stability improved (removing unreadable CD crashed) +- Forgot to mention: UAE CDFS also works fine under KS 1.x. (AROS CDFS was 2.0+) Beta 25: (RC3)