]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1400b8.zip
authorToni Wilen <twilen@winuae.net>
Sat, 24 Feb 2007 16:18:42 +0000 (18:18 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:31:50 +0000 (21:31 +0200)
12 files changed:
cdtv.c
expansion.c
filesys.c
include/cdtv.h
main.c
memory.c
newcpu.c
od-win32/blkdev_win32_ioctl.c
od-win32/picasso96_win.c
od-win32/posixemu.c
od-win32/win32.h
od-win32/winuaechangelog.txt

diff --git a/cdtv.c b/cdtv.c
index 4f63013a6b20f0b4e1dc824ff4d3a8169cbdbdc6..d1e1a97655b90f83524e5c3c04dfff097f7096a2 100755 (executable)
--- a/cdtv.c
+++ b/cdtv.c
@@ -298,12 +298,17 @@ static int cdrom_info(uae_u8 *out)
 {
     uae_u8 *p;
     uae_u32 size;
+    int i;
 
     if (!ismedia())
        return -1;
     cd_motor = 1;
     out[0] = cdrom_toc[2];
-    out[1] = cdrom_toc[3];
+    i = (cdrom_toc[0] << 8) | (cdrom_toc[1] << 0);
+    i -= 2 + 11;
+    i /= 11;
+    p = cdrom_toc + 4 + i * 11;
+    out[1] = p[3];
     p = cdrom_toc + 4 + 2 * 11;
     size =  ((p[8] << 16) | (p[9] << 8) | p[10]);
     out[2] = size >> 16;
@@ -535,6 +540,7 @@ static void dma_do_thread(void)
 static void *dev_thread (void *p)
 {
     write_log("CDTV: CD thread started\n");
+    thread_alive = 1;
     for (;;) {
 
        uae_u32 b = read_comm_pipe_u32_blocking (&requests);
@@ -1053,10 +1059,12 @@ static void open_unit(void)
     int first = -1;
     int cdtvunit = -1, audiounit = -1;
 
-    if (unitnum >= 0)
+    if (unitnum >= 0) {
+       cdaudiostop();
        sys_command_close (DF_IOCTL, unitnum);
-    cdtv_reset();
+    }
     unitnum = -1;
+    cdtv_reset();
     if (!device_func_init(DEVICE_TYPE_ANY)) {
         write_log ("no CDROM support\n");
         return;
@@ -1219,13 +1227,29 @@ uae_u8 cdtv_battram_read (int addr)
     return v;
 }
 
+void cdtv_free (void)
+{
+    if (thread_alive > 0) {
+       write_comm_pipe_u32 (&requests, 0xffff, 1);
+       while (thread_alive > 0)
+           sleep_millis(10);
+    }
+    thread_alive = 0;
+    cdaudiostop ();
+    if (unitnum >= 0)
+       sys_command_close(DF_IOCTL, unitnum);
+    unitnum = -1;
+    configured = 0;
+}
 
-void dmac_init (void)
+void cdtv_init (void)
 {
     if (!thread_alive) {
         uae_thread_id tid;
        init_comm_pipe (&requests, 100, 1);
        uae_start_thread ("cdtv", dev_thread, NULL, &tid);
+       while (!thread_alive)
+           sleep_millis(10);
     }
 
     configured = 0;
index a1b59dca91ea51657c996a473c45e271ecf69e21..d98e78ced4a066f4e2c81915c4853e16e20ae2bc 100755 (executable)
@@ -1066,7 +1066,7 @@ void expamem_reset (void)
     allocate_expamem ();
 
     if (currprefs.cs_cdtvcd)
-       dmac_init ();
+       cdtv_init ();
 
     /* check if Kickstart version is below 1.3 */
     if (! ersatzkickfile && kickstart_version
index 51d405bf65b0483f7ce78ba7af36a5feb7cf05c2..880e6d6f646205c526d5d785e9a61c8006ee2092 100755 (executable)
--- a/filesys.c
+++ b/filesys.c
@@ -441,7 +441,7 @@ void free_mountinfo (void)
 struct hardfiledata *get_hardfile_data (int nr)
 {
     UnitInfo *uip = mountinfo.ui;
-    if (nr < 0 || uip[nr].open == 0 || uip[nr].volname != 0)
+    if (nr < 0 || nr >= MAX_FILESYSTEM_UNITS || uip[nr].open == 0 || uip[nr].volname != 0)
        return 0;
     return &uip[nr].hf;
 }
@@ -1805,18 +1805,12 @@ static void action_free_lock (Unit *unit, dpacket packet)
 }
 
 static uaecptr
-action_dup_lock_2 (Unit *unit, dpacket packet, uaecptr lock)
+action_dup_lock_2 (Unit *unit, dpacket packet, uae_u32 uniq)
 {
     uaecptr out;
     a_inode *a;
-    TRACE(("ACTION_DUP_LOCK(0x%lx)\n", lock));
-    DUMPLOCK(unit, lock);
 
-    if (!lock) {
-       PUT_PCK_RES1 (packet, 0);
-       return 0;
-    }
-    a = lookup_aino (unit, get_long (lock + 4));
+    a = lookup_aino (unit, uniq);
     if (a == 0) {
        PUT_PCK_RES1 (packet, DOS_FALSE);
        PUT_PCK_RES2 (packet, ERROR_OBJECT_NOT_AROUND);
@@ -1841,12 +1835,31 @@ static void
 action_dup_lock (Unit *unit, dpacket packet)
 {
     uaecptr lock = GET_PCK_ARG1 (packet) << 2;
-    action_dup_lock_2 (unit, packet, lock);
+    TRACE(("ACTION_DUP_LOCK(0x%lx)\n", lock));
+    if (!lock) {
+       PUT_PCK_RES1 (packet, 0);
+       return;
+    }
+    action_dup_lock_2 (unit, packet, get_long(lock + 4));
+}
+
+
+static void
+action_lock_from_fh (Unit *unit, dpacket packet)
+{
+    uaecptr out;
+    Key *k = lookup_key (unit, GET_PCK_ARG1 (packet));
+    TRACE(("ACTION_COPY_DIR_FH(0x%lx)\n", GET_PCK_ARG1 (packet)));
+    if (k == 0) {
+       PUT_PCK_RES1 (packet, DOS_FALSE);
+       return;
+    }
+    out = action_dup_lock_2 (unit, packet, k->aino->uniq);
 }
 
 /* convert time_t to/from AmigaDOS time */
-const int secs_per_day = 24 * 60 * 60;
-const int diff = (8 * 365 + 2) * (24 * 60 * 60);
+static const int secs_per_day = 24 * 60 * 60;
+static const int diff = (8 * 365 + 2) * (24 * 60 * 60);
 
 static void
 get_time (time_t t, long* days, long* mins, long* ticks)
@@ -2288,7 +2301,7 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb
     if (create)
         fsdb_set_file_attrs (aino);
 
-    put_long (fh+36, k->uniq);
+    put_long (fh + 36, k->uniq);
     if (create == 2)
        aino->elock = 1;
     else
@@ -2297,20 +2310,6 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb
     PUT_PCK_RES1 (packet, DOS_TRUE);
 }
 
-static void
-action_lock_from_fh (Unit *unit, dpacket packet)
-{
-    uaecptr out;
-    Key *k = lookup_key (unit, GET_PCK_ARG1 (packet));
-    //write_log("lock_from_fh %x\n", k);
-    if (k == 0) {
-       PUT_PCK_RES1 (packet, DOS_FALSE);
-       return;
-    }
-    out = action_dup_lock_2 (unit, packet, make_lock (unit, k->aino->uniq, -2));
-    //write_log("=%x\n", out);
-}
-
 static void
 action_fh_from_lock (Unit *unit, dpacket packet)
 {
@@ -2322,7 +2321,7 @@ action_fh_from_lock (Unit *unit, dpacket packet)
     mode_t openmode;
     int mode;
 
-    TRACE(("ACTION_FH_FROM_LOCK(0x%lx,0x%lx)\n",fh,lock));
+    TRACE(("ACTION_FH_FROM_LOCK(0x%lx,0x%lx)\n", fh, lock));
     DUMPLOCK(unit,lock);
 
     if (!lock) {
index 863e6eb0947f7c543baeae8f4724f6a59c1a24e0..e44df5c08bb7e23e7bb6bdd40a22cc1b43a08863 100755 (executable)
@@ -3,7 +3,8 @@
 
 extern addrbank dmac_bank;
 
-extern void dmac_init (void);
+extern void cdtv_init (void);
+extern void cdtv_free (void);
 extern void CDTV_hsync_handler(void);
 
 extern void cdtv_entergui (void);
diff --git a/main.c b/main.c
index cbd511ae6c0a18cba5f1d2d2bb70fd7ead4696de..810ecf77c7f3a39467ded7d9b56bfae2fb924048 100755 (executable)
--- a/main.c
+++ b/main.c
@@ -38,6 +38,7 @@
 #include "scsidev.h"
 #include "uaeserial.h"
 #include "akiko.h"
+#include "cdtv.h"
 #include "savestate.h"
 #include "filesys.h"
 #include "parallel.h"
@@ -544,6 +545,9 @@ void do_leave_program (void)
 #ifdef SERIAL_PORT
     serial_exit ();
 #endif
+#ifdef CDTV
+    cdtv_free ();
+#endif
 #ifdef CD32
     akiko_free ();
 #endif
index ce537efeb98e36b465cd5dccfc1df2e5172cabb0..8acf47eac385420c200a38ab9865383db134b0f6 100755 (executable)
--- a/memory.c
+++ b/memory.c
@@ -1545,7 +1545,7 @@ uae_u8 *REGPARAM2 default_xlate (uaecptr a)
            }
        }
     }
-    return kickmem_xlate (0); /* So we don't crash. */
+    return kickmem_xlate (2); /* So we don't crash. */
 }
 
 /* Address banks */
index 16a27cd2cad9327c2ae94de500582f843b6f734d..159974a52151b8bd44e89615b627bc8fbf2b8833 100755 (executable)
--- a/newcpu.c
+++ b/newcpu.c
@@ -962,9 +962,6 @@ static void Exception_normal (int nr, struct regstruct *regs, uaecptr oldpc)
     exception_debug (nr);
     MakeSR(regs);
 
-    if (nr == 3)
-       activate_debugger();
-
     if (!regs->s) {
        regs->usp = m68k_areg(regs, 7);
        if (currprefs.cpu_level >= 2)
@@ -2630,24 +2627,42 @@ void exception2 (uaecptr addr, uaecptr fault)
 
 void cpureset (void)
 {
-    customreset ();
-#if 0
+    uaecptr pc;
+    uaecptr ksboot = 0xf80002 - 2; /* -2 = RESET hasn't increased PC yet */
     uae_u16 ins;
-    if (currprefs.cpu_level == 0 && (currprefs.cpu_compatible || currprefs.cpu_cycle_exact)) {
+
+    if (currprefs.cpu_compatible || currprefs.cpu_cycle_exact) {
+        customreset ();
+       return;
+    }
+    pc = m68k_getpc(&regs);
+    if (pc >= currprefs.chipmem_size) {
+       addrbank *b = &get_mem_bank(pc);
+       if (b->check(pc, 2 + 2)) {
+           /* We have memory, hope for the best.. */
+           customreset ();
+           return;
+       }
+       write_log("M68K RESET PC=%x, rebooting..\n", pc);
        customreset ();
+       m68k_setpc (&regs, ksboot);
        return;
     }
-    ins = get_word (m68k_getpc(&regs) + 2);
+    /* panic, RAM is going to disappear under PC */
+    ins = get_word (pc + 2);
     if ((ins & ~7) == 0x4ed0) {
        int reg = ins & 7;
        uae_u32 addr = m68k_areg (&regs, reg);
-       write_log ("reset/jmp (ax) combination emulated\n");
+       write_log ("reset/jmp (ax) combination emulated -> %x\n", addr);
        customreset ();
        if (addr < 0x80000)
            addr += 0xf80000;
-       m68k_setpc (&regs, addr);
+       m68k_setpc (&regs, addr - 2);
+       return;
     }
-#endif
+    write_log("M68K RESET PC=%x, rebooting..\n", pc);
+    customreset ();
+    m68k_setpc (&regs, ksboot);
 }
 
 
index e400aafc275722df025c7f8d2584ae8b2fe66076..05bbe8431f69389e7d260b68dfa11be28129f7c7 100755 (executable)
@@ -113,7 +113,7 @@ static int close_mci(int unitnum)
     MCI_GENERIC_PARMS gp = { 0 };
 
     ciw->playend = -1;
-    if (ciw->mciid) {
+    if (ciw->mciid > 0) {
        if (log_scsi)
            write_log("IOCTL: MCI close\n");
        mcierr("MCI_STOP", mciSendCommand(ciw->mciid, MCI_STOP, MCI_WAIT, (DWORD_PTR)&gp));
index 80c8bb7794927dde79a83cbda6c4d8739f72a007..d74e276cfc7e70dd4b59785e4d678873a461cc29 100755 (executable)
@@ -65,7 +65,7 @@ int p96hsync_counter, palette_changed;
 #endif
 #define LOCK_UNLOCK_MADNESS //need for 7 times faster linedraw
 #define PIXEL_LOCK    //and scrollable screens
-#define MAXFLUSHPIXEL 3200 //pixel draw in a lock
+#define MAXFLUSHPIXEL 2000 //pixel draw in a lock
 static void flushpixels(void);
 #ifdef P96TRACING_ENABLED
 #define P96TRACE(x) do { write_log x; } while(0)
index ffa6f1ff45e3a46493dbb75dcd9f6b12fc6da0e5..d5e68654946e86bcabba411eb7c73f04abd8fb63 100755 (executable)
@@ -247,17 +247,19 @@ int uae_start_thread (char *name, void *(*f)(void *), void *arg, uae_thread_id *
     unsigned foo;
     struct thparms *thp;
 
-    if (name)
-       write_log("Thread '%s' started\n", name);
     thp = malloc (sizeof (struct thparms));
     thp->f = f;
     thp->arg = arg;
     hThread = (HANDLE)_beginthreadex(NULL, 0, thread_init, thp, 0, &foo);
     *tid = hThread;
-    if (hThread)
+    if (hThread) {
         SetThreadPriority (hThread, THREAD_PRIORITY_ABOVE_NORMAL);
-    else
+       if (name)
+           write_log("Thread '%s' started (%d)\n", name, foo);
+    } else {
         result = 0;
+       write_log("Thread '%s' failed to start!?\n", name ? name : "<unknown>");
+    }
     return result;
 }
 
index 1b0b06fcac96ee5dd76068787505fc25e39dc6e9..55ec845a8e518c128ed5c6bde61045f0063dc657 100755 (executable)
@@ -15,9 +15,9 @@
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEBETA 7
+#define WINUAEBETA 8
 #define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2007, 2, 17)
+#define WINUAEDATE MAKEBD(2007, 2, 24)
 
 #define IHF_WINDOWHIDDEN 6
 #define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU)
index c26c0b282b509afed47ec0a1cfb377b03008c913..419e9a21d557adc28f25256f8d45314f055f64eb 100755 (executable)
@@ -1,4 +1,13 @@
 
+Beta 8: (RC 1)
+
+- uaehf.device unit >=30 crash fixed
+- CDTV CD audio will be stopped when exiting/reseting
+- correct CDTV CD number of tracks returned in ASPI-mode
+- re-added and fixed special case handling for 68k reset-instruction
+  when more compatible CPU setting is not enabled
+- filesystem ACTION_COPY_DIR_FH packet memory (lock) leak fixed
+
 Beta 7: (possible bug fixes and small tweaks left)
 
 - Picasso96 graphics problems really fixed