]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1340b4.zip
authorToni Wilen <twilen@winuae.net>
Sat, 16 Dec 2006 11:46:51 +0000 (13:46 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:30:26 +0000 (21:30 +0200)
22 files changed:
bsdsocket.c
cfgfile.c
custom.c
debug.c
filesys.c
include/filesys.h
include/native2amiga.h
inputdevice.c
od-win32/bsdsock.c
od-win32/driveclick_win32.c
od-win32/mman.c
od-win32/parser.c
od-win32/posixemu.c
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/target.h
od-win32/win32.c
od-win32/win32.h
od-win32/win32gui.c
od-win32/winuaechangelog.txt
uaelib.c
uaeserial.c

index 13b32181270d6ecdbde465c1c77fcdad73778c1c..cd79a5ae96738b7c100a19bfd02174f1623eba79 100644 (file)
@@ -30,11 +30,14 @@ static uae_u32 SockLibBase;
 #define UNIQUE_ID (-1)
 
 /* ObtainSocket()/ReleaseSocket() public socket pool */
-long sockpoolids[SOCKPOOLSIZE];
-SOCKET_TYPE sockpoolsocks[SOCKPOOLSIZE];
-uae_u32 sockpoolflags[SOCKPOOLSIZE];
+struct sockd {
+    long sockpoolids[SOCKPOOLSIZE];
+    SOCKET_TYPE sockpoolsocks[SOCKPOOLSIZE];
+    uae_u32 sockpoolflags[SOCKPOOLSIZE];
+};
 
-long curruniqid = 65536;
+static long curruniqid = 65536;
+static struct sockd *sockdata;
 
 /* Memory-related helper functions */
 STATIC_INLINE void memcpyha (uae_u32 dst, const char *src, int size)
@@ -158,33 +161,28 @@ void bsdsocklib_setherrno (SB, int sb_herrno)
 }
 
 BOOL checksd(SB, int sd)
-       {
-       int iCounter;
-       SOCKET s;
+{
+    int iCounter;
+    SOCKET s;
 
     s = getsock(sb,sd);
-    if (s != INVALID_SOCKET)
-               {
-               for (iCounter  = 1; iCounter <= sb->dtablesize; iCounter++)
-                       {
-                       if (iCounter != sd)
-                               {
-                               if (getsock(sb,iCounter) == s)
-                                       {
-                                       releasesock(sb,sd);
-                                       return TRUE;
-                                       }
-                               }
-                       }
-               for (iCounter  = 0; iCounter < SOCKPOOLSIZE; iCounter++)
-                       {
-                       if (s == sockpoolsocks[iCounter])
-                               return TRUE;
-                       }
+    if (s != INVALID_SOCKET) {
+       for (iCounter  = 1; iCounter <= sb->dtablesize; iCounter++) {
+           if (iCounter != sd) {
+               if (getsock(sb,iCounter) == s) {
+                   releasesock(sb,sd);
+                   return TRUE;
                }
-       TRACE(("checksd FALSE s 0x%x sd %d\n",s,sd));
-       return FALSE;
+           }
+       }
+       for (iCounter  = 0; iCounter < SOCKPOOLSIZE; iCounter++) {
+           if (s == sockdata->sockpoolsocks[iCounter])
+               return TRUE;
        }
+    }
+    TRACE(("checksd FALSE s 0x%x sd %d\n",s,sd));
+    return FALSE;
+}
 
 void setsd(SB, int sd, SOCKET_TYPE s)
 {
@@ -683,7 +681,7 @@ static int sockpoolindex (long id)
     int i;
 
     for (i = 0; i < SOCKPOOLSIZE; i++)
-       if (sockpoolids[i] == id)
+       if (sockdata->sockpoolids[i] == id)
            return i;
 
     return -1;
@@ -708,15 +706,15 @@ static uae_u32 REGPARAM2 bsdsocklib_ObtainSocket (TrapContext *context)
        TRACE (("[invalid key]\n"));
        return -1;
     }
-    s = sockpoolsocks[i];
+    s = sockdata->sockpoolsocks[i];
 
     sd = getsd (sb, s);
 
     TRACE (("%d\n", sd));
 
     if (sd != -1) {
-       sb->ftable[sd - 1] = sockpoolflags[i];
-        sockpoolids[i] = UNIQUE_ID;
+       sb->ftable[sd - 1] = sockdata->sockpoolflags[i];
+        sockdata->sockpoolids[i] = UNIQUE_ID;
         return sd - 1;
     }
 
@@ -773,9 +771,9 @@ static uae_u32 REGPARAM2 bsdsocklib_ReleaseSocket (TrapContext *context)
            write_log (("bsdsocket: ERROR: Global socket pool overflow\n"));
            return -1;
        }
-       sockpoolids[i] = id;
-       sockpoolsocks[i] = s;
-       sockpoolflags[i] = flags;
+       sockdata->sockpoolids[i] = id;
+       sockdata->sockpoolsocks[i] = s;
+       sockdata->sockpoolflags[i] = flags;
 
        TRACE (("id %d s 0x%x\n", id,s));
     } else {
@@ -833,9 +831,9 @@ static uae_u32 REGPARAM2 bsdsocklib_ReleaseCopyOfSocket (TrapContext *context)
            write_log (("bsdsocket: ERROR: Global socket pool overflow\n"));
            return -1;
        }
-       sockpoolids[i] = id;
-       sockpoolsocks[i] = s;
-       sockpoolflags[i] = flags;
+       sockdata->sockpoolids[i] = id;
+       sockdata->sockpoolsocks[i] = s;
+       sockdata->sockpoolflags[i] = flags;
 
        TRACE (("id %d s 0x%x\n", id,s));
 
@@ -1018,7 +1016,7 @@ static uae_u32 REGPARAM2 bsdsocklib_gethostid (TrapContext *context)
     return 0x7f000001;
 }
 
-const char *errortexts[] =
+static const char *errortexts[] =
 {"No error", "Operation not permitted", "No such file or directory",
  "No such process", "Interrupted system call", "Input/output error", "Device not configured",
  "Argument list too long", "Exec format error", "Bad file descriptor", "No child processes",
@@ -1044,32 +1042,32 @@ const char *errortexts[] =
  "RPC prog. not avail", "Program version wrong", "Bad procedure for program", "No locks available",
  "Function not implemented", "Inappropriate file type or format", "PError 0"};
 
-uae_u32 errnotextptrs[sizeof (errortexts) / sizeof (*errortexts)];
-uae_u32 number_sys_error = sizeof (errortexts) / sizeof (*errortexts);
+static uae_u32 errnotextptrs[sizeof (errortexts) / sizeof (*errortexts)];
+static const uae_u32 number_sys_error = sizeof (errortexts) / sizeof (*errortexts);
 
 
-const char *herrortexts[] =
+static const char *herrortexts[] =
  {"No error", "Unknown host", "Host name lookup failure", "Unknown server error",
  "No address associated with name"};
 
-uae_u32 herrnotextptrs[sizeof (herrortexts) / sizeof (*herrortexts)];
-uae_u32 number_host_error = sizeof (herrortexts) / sizeof (*herrortexts);
+static uae_u32 herrnotextptrs[sizeof (herrortexts) / sizeof (*herrortexts)];
+static const uae_u32 number_host_error = sizeof (herrortexts) / sizeof (*herrortexts);
 
 static const char * const strErr = "Errlist lookup error"; 
-uae_u32 strErrptr;
+static uae_u32 strErrptr;
 
 
 #define TAG_DONE   (0L)                /* terminates array of TagItems. ti_Data unused */
 #define TAG_IGNORE (1L)                /* ignore this item, not end of array */
 #define TAG_MORE   (2L)                /* ti_Data is pointer to another array of TagItems */
 #define TAG_SKIP   (3L)                /* skip this and the next ti_Data items */
-#define TAG_USER   ((uae_u32)(1L<<31))
+#define TAG_USER   ((uae_u32)(1L << 31))
 
 #define SBTF_VAL 0x0000
 #define SBTF_REF 0x8000
 #define SBTB_CODE 1
 #define SBTS_CODE 0x3FFF
-#define SBTM_CODE(tag) ((((UWORD)(tag))>>SBTB_CODE) & SBTS_CODE)
+#define SBTM_CODE(tag) ((((UWORD)(tag)) >> SBTB_CODE) & SBTS_CODE)
 #define SBTF_GET  0x0
 #define SBTF_SET  0x1
 #define SBTM_GETREF(code) \
@@ -1369,6 +1367,9 @@ void bsdlib_reset (void)
     SB, *nsb;
     int i;
 
+    if (!SockLibBase)
+       return;
+
     SockLibBase = 0;
 
     for (sb = socketbases; sb; sb = nsb) {
@@ -1386,9 +1387,9 @@ void bsdlib_reset (void)
     sbsigqueue = NULL;
 
     for (i = 0; i < SOCKPOOLSIZE; i++) {
-       if (sockpoolids[i] != UNIQUE_ID) {
-           sockpoolids[i] = UNIQUE_ID;
-           host_closesocketquick (sockpoolsocks[i]);
+       if (sockdata->sockpoolids[i] != UNIQUE_ID) {
+           sockdata->sockpoolids[i] = UNIQUE_ID;
+           host_closesocketquick (sockdata->sockpoolsocks[i]);
        }
     }
 
@@ -1436,10 +1437,13 @@ void bsdlib_install (void)
     uae_u32 func_place, data_place, init_place;
     int i;
 
+    if (!sockdata)
+       sockdata = xcalloc (sizeof (struct sockd), 1);
     if (!init_socket_layer ())
        return;
 
-    memset (sockpoolids, UNIQUE_ID, sizeof (sockpoolids));
+    for (i = 0; i < SOCKPOOLSIZE; i++)
+       sockdata->sockpoolids[i] = UNIQUE_ID;
 
     resname = ds ("bsdsocket.library");
     resid = ds ("UAE bsdsocket.library 4.1");
index 04864b5866a024a9c113a85ec1dd23753aed5264..7a4d61f65b0c2d6df4afe51c3ff62c8e5184c054 100644 (file)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -2518,8 +2518,8 @@ void default_prefs (struct uae_prefs *p, int type)
     strcpy (p->path_floppy, "./");
     strcpy (p->path_hardfile, "./");
 
-    strcpy (p->prtname, DEFPRTNAME);
-    strcpy (p->sername, DEFSERNAME);
+    p->prtname[0] = 0;
+    p->sername[0] = 0;
 
     p->cpu_level = 0;
     p->m68k_speed = 0;
@@ -2621,8 +2621,8 @@ static void buildin_default_prefs (struct uae_prefs *p)
     strcpy (p->romextfile, "");
     strcpy (p->flashfile, "");
     strcpy (p->cartfile, "");
-    strcpy (p->prtname, DEFPRTNAME);
-    strcpy (p->sername, DEFSERNAME);
+    p->prtname[0] = 0;
+    p->sername[0] = 0;
     target_default_options (p, 1);
 }
 
index d172bc25ee4ff1655c9e62b19c899169b885e809..6b36c4b1b0827bc8c5b939ea23ead3e943ac44d0 100644 (file)
--- a/custom.c
+++ b/custom.c
@@ -70,7 +70,7 @@ void uae_abort (const char *format,...)
     char buffer[1000];
 
     va_start (parms, format);
-    _vsnprintf( buffer, sizeof (buffer) -1, format, parms );
+    _vsnprintf(buffer, sizeof (buffer) - 1, format, parms );
     va_end (parms);
     if (nomore) {
        write_log(buffer);
@@ -3400,15 +3400,12 @@ static void dump_copper (char *error, int until_hpos)
 {
     static int warned = 10;
 
-    if (warned < 0)
-       return;
-    warned--;
     write_log("%s: vpos=%d until_hpos=%d\n",
        error, vpos, until_hpos);
     write_log("cvcmp=%d chcmp=%d chpos=%d cvpos=%d ci1=%04.4X ci2=%04.4X\n",
        cop_state.vcmp,cop_state.hcmp,cop_state.hpos,cop_state.vpos,cop_state.saved_i1,cop_state.saved_i2);
-    write_log("cstate=%d ip=%08.8X\n",
-       cop_state.state,cop_state.ip);
+    write_log("cstate=%d ip=%x SPCFLAGS=%x\n",
+       cop_state.state, cop_state.ip, regs.spcflags);
 }
 
 static void update_copper (int until_hpos)
@@ -3420,8 +3417,10 @@ static void update_copper (int until_hpos)
        return;
  
     if (cop_state.state == COP_wait && vp < cop_state.vcmp) {
-       dump_copper ("error2",until_hpos);
+       dump_copper ("error2", until_hpos);
        copper_enabled_thisline = 0;
+       cop_state.state = COP_stop;
+       unset_special(&regs, SPCFLAG_COPPER);
        return;
     }
 
diff --git a/debug.c b/debug.c
index f8a386d632506780402f7f311b75577ad5994615..ac861a1ec8f2f6bf1599e4a726fd93883f266bd5 100644 (file)
--- a/debug.c
+++ b/debug.c
@@ -1413,7 +1413,8 @@ static void memory_map_dump_2 (int log)
        if (i < max)
            a2 = mem_banks[i];
        if (a1 != a2) {
-           int k, mirrored, size;
+           int k, mirrored, size, size_out;
+           char size_ext;
            uae_u8 *caddr;
            char *name;
            char tmp[MAX_DPATH];
@@ -1432,7 +1433,14 @@ static void memory_map_dump_2 (int log)
                k++;
            }
            size = (i - j) << (16 - 10);
-           sprintf (txt, "%08.8X %7dK/%d = %7dK %s", j << 16, size, mirrored, mirrored ? size / mirrored : size, name);
+           size_out = size;
+           size_ext = 'K';
+           if (j >= 256) {
+               size_out /= 1024;
+               size_ext = 'M';
+           }
+           sprintf (txt, "%08.8X %7d%c/%d = %7d%c %s", j << 16, size_out, size_ext,
+               mirrored, mirrored ? size_out / mirrored : size_out, size_ext, name);
 
            tmp[0] = 0;
            if (a1->flags == ABFLAG_ROM && mirrored) {
index 300b137b6c3bc4aff83f5e78fb50f3a863c63400..5b320ea35d9d6da1f5a234da0bceedd5bc89abf9 100644 (file)
--- a/filesys.c
+++ b/filesys.c
@@ -2060,6 +2060,22 @@ get_fileinfo (Unit *unit, dpacket packet, uaecptr info, a_inode *aino)
     PUT_PCK_RES1 (packet, DOS_TRUE);
 }
 
+int get_native_path(uae_u32 lock, char *out)
+{
+    int i = 0;
+    for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
+       if (current_mountinfo.ui[i].self) {
+           uae_u32 err;
+           a_inode *a = lookup_aino (current_mountinfo.ui[i].self, get_long ((lock << 2) + 4));
+           if (a) {
+               strcpy (out, a->nname);
+               return 0;
+           }
+       }
+    }
+    return -1;
+}
+
 static void action_examine_object (Unit *unit, dpacket packet)
 {
     uaecptr lock = GET_PCK_ARG1 (packet) << 2;
index efa48b92d51226d2b575d55f1f199dcf693f8318..1d202e2f45dba12af2a94f0dfce460fc14a5dfd9 100644 (file)
@@ -57,3 +57,4 @@ extern int hdf_getnumharddrives (void);
 extern char *hdf_getnameharddrive (int index, int flags);
 extern int hdf_init (void);
 extern int isspecialdrive(const char *name);
+extern int get_native_path(uae_u32 lock, char *out);
\ No newline at end of file
index a2f8cdc00d9fbeaa26ce81df584a77d4ef0750db..043e08bf1db52d7bb9f8caf42a0c00e6cf0f6066 100644 (file)
@@ -59,5 +59,4 @@ STATIC_INLINE void do_uae_int_requested (void)
 {
     uae_int_requested = 1;
     set_uae_int_flag ();
-    INTREQ (0x8000 | 0x0008);
 }
index 2ad4825007895ac11cba8a987414c89c5871ce6b..7704a27fb3e5ed38c45f28f7647f4fd54e614cf6 100644 (file)
@@ -1592,14 +1592,17 @@ void inputdevice_vsync (void)
        if (iq->framecnt > 0) {
            iq->framecnt--;
            if (iq->framecnt == 0) {
-               if (iq->state) iq->state = 0; else iq->state = iq->storedstate;
+               if (iq->state)
+                   iq->state = 0;
+               else
+                   iq->state = iq->storedstate;
                handle_input_event (iq->event, iq->state, iq->max, 0);
                iq->framecnt = iq->nextframecnt;
            }
        }
     }
     mouseupdate (100);
-    inputdelay = uaerand () % (maxvpos - 1);
+    inputdelay = uaerand () % (maxvpos == 0 ? 1 : maxvpos - 1);
     idev[IDTYPE_MOUSE].read ();
     input_read = 1;
     input_vpos = 0;
index 82566d1bf05962b00a08830f75fd51d33c20919c..c0ffcfbc0671a3a084559e3941837c596e84d6d5 100644 (file)
@@ -968,7 +968,7 @@ void host_connect(TrapContext *context, SB, uae_u32 sd, uae_u32 name, uae_u32 na
                                }
                        }
                } else
-                       write_log("BSDSOCK: WARNING - Excessive namelen (%d) in connect()!\n",namelen);
+                       write_log("BSDSOCK: WARNING - Excessive namelen (%d) in connect()!\n", namelen);
     }
     TRACE(("%d\n",sb->sb_errno));
 }
@@ -994,7 +994,7 @@ void host_sendto(TrapContext *context, SB, uae_u32 sd, uae_u32 msg, uae_u32 len,
                realpt = get_real_address(msg);
                
                if (to) {
-                       if (tolen > sizeof buf) write_log("BSDSOCK: WARNING - Target address in sendto() too large (%d)!\n",tolen);
+                       if (tolen > sizeof buf) write_log("BSDSOCK: WARNING - Target address in sendto() too large (%d)!\n", tolen);
                        else {
                                memcpy(buf,get_real_address(to),tolen);
                                // some Amiga software sets this field to bogus values
@@ -1255,7 +1255,7 @@ void host_setsockopt(SB, uae_u32 sd, uae_u32 level, uae_u32 optname, uae_u32 opt
 
     if (s != INVALID_SOCKET) {
                if (len > sizeof buf) {
-                       write_log("BSDSOCK: WARNING - Excessive optlen in setsockopt() (%d)\n",len);
+                       write_log("BSDSOCK: WARNING - Excessive optlen in setsockopt() (%d)\n", len);
                        len = sizeof buf;
                }       
                if (level == IPPROTO_IP && optname == 2) { // IP_HDRINCL emulated by icmp.dll
@@ -1264,14 +1264,14 @@ void host_setsockopt(SB, uae_u32 sd, uae_u32 level, uae_u32 optname, uae_u32 opt
                        }
                if (level == SOL_SOCKET && optname == SO_LINGER) {
                        ((LINGER *)buf)->l_onoff = get_long(optval);
-                       ((LINGER *)buf)->l_linger = get_long(optval+4);
+                       ((LINGER *)buf)->l_linger = get_long(optval + 4);
                } else {
                        if (len == 4)
                                *(long *)buf = get_long(optval);
                        else if (len == 2)
                                *(short *)buf = get_word(optval);
                        else
-                               write_log("BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n",level,optname);
+                               write_log("BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n", len, level, optname);
                }
 
                // handle SO_EVENTMASK
@@ -1333,7 +1333,7 @@ uae_u32 host_getsockopt(SB, uae_u32 sd, uae_u32 level, uae_u32 optname, uae_u32
                                else if (len == 2)
                                        put_word(optval,*(short *)buf);
                                else
-                                       write_log("BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n",level,optname);
+                                       write_log("BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n", len, level, optname);
                        }
 
 //                     put_long(optlen,len); // some programs pass the actual length instead of a pointer to the length, so...
@@ -1464,7 +1464,7 @@ uae_u32 host_IoctlSocket(TrapContext *context, SB, uae_u32 sd, uae_u32 request,
                                success = -1;
                                break;
                        default:
-                               write_log("BSDSOCK: WARNING - Unknown IoctlSocket request: 0x%08lx\n",request);
+                               write_log("BSDSOCK: WARNING - Unknown IoctlSocket request: 0x%08lx\n", request);
                                bsdsocklib_seterrno(sb,22); // EINVAL
                                break;
                }
@@ -1551,7 +1551,7 @@ static void makesocktable(SB, uae_u32 fd_set_amiga, struct fd_set *fd_set_win, i
        }
 
        if (nfds > sb->dtablesize) {
-               write_log("BSDSOCK: ERROR - select()ing more sockets (%d) than socket descriptors available (%d)!\n",nfds,sb->dtablesize);
+               write_log("BSDSOCK: ERROR - select()ing more sockets (%d) than socket descriptors available (%d)!\n", nfds, sb->dtablesize);
                nfds = sb->dtablesize;
        }
 
@@ -1573,7 +1573,7 @@ static void makesocktable(SB, uae_u32 fd_set_amiga, struct fd_set *fd_set_win, i
                                        fd_set_win->fd_array[fd_set_win->fd_count++] = s;
 
                                        if (fd_set_win->fd_count >= FD_SETSIZE) {
-                                               write_log("BSDSOCK: ERROR - select()ing more sockets (%d) than the hard-coded fd_set limit (%d) - please report\n",nfds,FD_SETSIZE);
+                                               write_log("BSDSOCK: ERROR - select()ing more sockets (%d) than the hard-coded fd_set limit (%d) - please report\n", nfds, FD_SETSIZE);
                                                return;
                                        }
                                }
@@ -1817,7 +1817,7 @@ void host_WaitSelect(TrapContext *context, SB, uae_u32 nfds, uae_u32 readfds, ua
 */
                if (sb->needAbort) {
                        if ((newsock = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) == INVALID_SOCKET)
-                               write_log("BSDSOCK: ERROR - Cannot create socket: %d\n",WSAGetLastError());
+                               write_log("BSDSOCK: ERROR - Cannot create socket: %d\n", WSAGetLastError());
                        shutdown(sb->sockAbort,1);
                        if (newsock != sb->sockAbort) {
                                shutdown(sb->sockAbort,1);
@@ -2340,7 +2340,7 @@ void host_getservbynameport(TrapContext *context, SB, uae_u32 nameport, uae_u32
                                bsd->gt->hGetThreads[i] = THREAD(thread_get, &i);
                                if (bsd->gt->hGetEvents[i] == NULL || bsd->gt->hGetThreads[i] == NULL) {
                                        bsd->gt->hGetThreads[i] = 0;
-                                       write_log("BSDSOCK: ERROR - Thread/Event creation failed - error code: %d\n",GetLastError());
+                                       write_log("BSDSOCK: ERROR - Thread/Event creation failed - error code: %d\n", GetLastError());
                                        bsdsocklib_seterrno(sb, 12); // ENOMEM
                                        sb->resultval = -1;
                                        return;
@@ -2392,7 +2392,7 @@ void host_getservbynameport(TrapContext *context, SB, uae_u32 nameport, uae_u32
                sb->servent = uae_AllocMem(context, size, 0);
 
                if (!sb->servent) {
-                       write_log("BSDSOCK: WARNING - getservby%s() ran out of Amiga memory (couldn't allocate %ld bytes)\n",type ? "port" : "name",size);
+                       write_log("BSDSOCK: WARNING - getservby%s() ran out of Amiga memory (couldn't allocate %ld bytes)\n", type ? "port" : "name", size);
                        bsdsocklib_seterrno(sb, 12); // ENOMEM
                        return;
                }
index 05130e044bf257167ea11902907c7dfceedfeb3c..d85f3578843f590e9f4012b9f2c9936453a5da14 100644 (file)
@@ -19,7 +19,7 @@
 #include <windows.h>
 #include "fdrawcmd.h"
 
-int driveclick_pcdrivenum, driveclick_pcdrivemask;
+int driveclick_pcdrivemask;
 
 #define DC_PIPE_SIZE 100
 static smp_comm_pipe dc_pipe[DC_PIPE_SIZE];
@@ -159,15 +159,11 @@ void driveclick_fdrawcmd_detect(void)
     if (detected)
        return;
     detected = 1;
-    if (driveclick_fdrawcmd_open(0)) {
+    if (driveclick_fdrawcmd_open(0))
        driveclick_pcdrivemask |= 1;
-       driveclick_pcdrivenum++;
-    }
     driveclick_fdrawcmd_close(0);
-    if (driveclick_fdrawcmd_open(1)) {
+    if (driveclick_fdrawcmd_open(1))
        driveclick_pcdrivemask |= 2;
-       driveclick_pcdrivenum++;
-    }
     driveclick_fdrawcmd_close(1);
 }
 
index 0305f1141263c93d6f62377c12fdf6a944240b11..1f31bfff65d8e52a7faa695e45e9c76cf018aa05 100644 (file)
@@ -70,8 +70,6 @@ void init_shm(void)
                total64 = memstatsex.ullAvailPageFile + memstatsex.ullAvailPhys;
            }
        }
-       if (totalphys64 >= (uae_u64)1800 * 1024 * 1024 && max_allowed_mman < 1024)
-           max_allowed_mman = 1024;
     }
 
     size64 = 16 * 1024 * 1024;
index 16b9d590e88b5cc550d1fc5344cb8cd0cc0497fb..e2273ec424fde24f6134e059bc6f74bbf313d101 100644 (file)
@@ -298,7 +298,7 @@ static void DoSomeWeirdPrintingStuff (char val)
 
 int isprinter (void)
 {
-    if (!strcasecmp(currprefs.prtname,"none"))
+    if (!currprefs.prtname[0])
        return 0;
     if (!memcmp(currprefs.prtname,"LPT", 3)) {
        paraport_open (currprefs.prtname);
@@ -404,7 +404,7 @@ void openprinter( void )
     static int first;
     
     closeprinter ();
-    if (!strcasecmp(currprefs.prtname,"none"))
+    if (!currprefs.prtname[0])
        return;
 
     if (currprefs.parallel_postscript_emulation) {
@@ -755,7 +755,7 @@ int openser (char *sername)
 
     sprintf (buf, "\\.\\\\%s", sername);
 
-   if (!(writeevent = CreateEvent (NULL, TRUE, FALSE, NULL))) {
+    if (!(writeevent = CreateEvent (NULL, TRUE, FALSE, NULL))) {
        write_log ("SERIAL: Failed to create event!\n");
        return 0;
     }
index 524ae1e703a6043135762820a2465f4382c2db7b..171303481d8e46ae64dc6ca43be5fe14d65952d7 100644 (file)
@@ -237,6 +237,6 @@ int cpu_affinity = 1;
 void uae_set_thread_priority (int pri)
 {
     /* workaround for filesystem emulation freeze with some dual core systems */
-    SetThreadAffinityMask(GetCurrentThread(), cpu_affinity); 
+    //SetThreadAffinityMask(GetCurrentThread(), cpu_affinity); 
 }
 
index ba8db068436d5b2d6bebbf89cf3ab58153560b51..c3515a7fe4290418108fc77b151e828bbe8d280c 100644 (file)
 #define IDC_T1                          1551
 #define IDC_T2                          1552
 #define IDC_T3                          1553
-#define IDC_SHARED                      1553
+#define IDC_SER_SHARED                  1553
 #define IDC_T4                          1554
 #define IDC_SER_CTSRTS                  1554
 #define IDC_T5                          1555
-#define IDC_SERIAL_DIRECT               1555
+#define IDC_SER_DIRECT                  1555
 #define IDC_T6                          1556
 #define IDC_PSPRINTER                   1556
 #define IDC_T7                          1557
 #define IDC_PSPRINTERDETECT             1557
 #define IDC_T8                          1558
-#define IDC_SHARED2                     1558
 #define IDC_UAESERIAL                   1558
 #define IDC_T9                          1559
 #define IDC_T10                         1560
index 241828ece7a3872077897fbadd2f999c9527edfa..a8967aadce534b86f388941a2194e68775a7436f 100644 (file)
@@ -307,9 +307,9 @@ BEGIN
     EDITTEXT        IDC_PS_PARAMS,120,50,169,12,ES_AUTOHSCROLL
     GROUPBOX        "Serial Port",IDC_SERIALFRAME,4,72,292,48
     COMBOBOX        IDC_SERIAL,19,84,95,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
-    CONTROL         "Shared",IDC_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,132,83,48,13
+    CONTROL         "Shared",IDC_SER_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,132,83,48,13
     CONTROL         "RTS/CTS",IDC_SER_CTSRTS,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,185,83,53,12
-    CONTROL         "Direct []Use when emulating serial-link games on two PCs running WinUAE",IDC_SERIAL_DIRECT,
+    CONTROL         "Direct []Use when emulating serial-link games on two PCs running WinUAE",IDC_SER_DIRECT,
                     "Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,243,83,46,12
     GROUPBOX        "MIDI",IDC_MIDIFRAME,4,123,292,33
     RTEXT           "Out:",IDC_MIDI,10,134,34,15,SS_CENTERIMAGE
index 4afd596eaec3bc90714e92c1201b6ba9ffdbb8d8..d37492e60e44d60c801310353f14af6c8e98fd3a 100644 (file)
@@ -21,5 +21,3 @@
 
 #define OPTIONSFILENAME "default.uae"
 
-#define DEFPRTNAME "none"
-#define DEFSERNAME "none"
index a9cd52a3c7567823aa3e384f877558bbcbee72cf..1019a54064c85843e1c07d7c8ce036a0028dda0d 100644 (file)
@@ -1730,7 +1730,7 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
     cfgfile_target_write (f, "logfile=%s\n", p->win32_logfile ? "true" : "false");
     cfgfile_target_write (f, "map_drives=%s\n", p->win32_automount_drives ? "true" : "false");
     cfgfile_target_write (f, "map_net_drives=%s\n", p->win32_automount_netdrives ? "true" : "false");
-    cfgfile_target_write (f, "serial_port=%s\n", p->use_serial ? p->sername : "none" );
+    cfgfile_target_write (f, "serial_port=%s\n", p->sername[0] ? p->sername : "none" );
     cfgfile_target_write (f, "parallel_port=%s\n", p->prtname[0] ? p->prtname : "none" );
 
     cfgfile_target_write (f, "active_priority=%d\n", priorities[p->win32_active_priority].value);
@@ -1796,8 +1796,6 @@ int target_parse_option (struct uae_prefs *p, char *option, char *value)
            || cfgfile_intval (option, value, "midiout_device", &p->win32_midioutdev, 1)
            || cfgfile_intval (option, value, "midiin_device", &p->win32_midiindev, 1)
            || cfgfile_intval (option, value, "soundcard", &p->win32_soundcard, 1)
-           || cfgfile_string (option, value, "serial_port", &p->sername[0], 256)
-           || cfgfile_string (option, value, "parallel_port", &p->prtname[0], 256)
            || cfgfile_yesno (option, value, "notaskbarbutton", &p->win32_notaskbarbutton)
            || cfgfile_yesno (option, value, "always_on_top", &p->win32_alwaysontop)
            || cfgfile_yesno (option, value, "powersavedisabled", &p->win32_powersavedisabled)
@@ -1834,10 +1832,21 @@ int target_parse_option (struct uae_prefs *p, char *option, char *value)
        return 1;
     }
 
-    if (p->sername[0] == 'n')
-       p->use_serial = 0;
-    else
-       p->use_serial = 1;
+    if (cfgfile_string (option, value, "serial_port", &p->sername[0], 256)) {
+       if (!strcmp(p->sername, "none"))
+           p->sername[0] = 0;
+       if (p->sername[0])
+           p->use_serial = 1;
+       else
+           p->use_serial = 0;
+       return 1;
+    }
+
+    if (cfgfile_string (option, value, "parallel_port", &p->prtname[0], 256)) {
+       if (!strcmp(p->prtname, "none"))
+           p->prtname[0] = 0;
+       return 1;
+    }
 
     i = 0;
     while (obsolete[i]) {
@@ -3002,6 +3011,7 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
 
     thread = GetCurrentThread();
     original_affinity = SetThreadAffinityMask(thread, 1); 
+    SetThreadAffinityMask(thread, original_affinity);
 #if 0
     CHANGEWINDOWMESSAGEFILTER pChangeWindowMessageFilter;
     pChangeWindowMessageFilter = (CHANGEWINDOWMESSAGEFILTER)GetProcAddress(
index 12d5bbe322f25f3ced8493fbc975e69a78967769..5df5dad695e63df6ed4792c86d34bbd365f08efa 100644 (file)
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEBETA 3
+#define WINUAEBETA 4
 #define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2006, 12, 6)
+#define WINUAEDATE MAKEBD(2006, 12, 16)
 
 #define IHF_WINDOWHIDDEN 6
-#define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU )
+#define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU)
 
 extern HMODULE hUIDLL;
 extern HWND hAmigaWnd, hMainWnd, hHiddenWnd;
index cdf5e61985a1b2c325c880109d4c67375c0e7f3f..4ad3aad2751641145285508106169abc9baecd6c 100644 (file)
@@ -82,6 +82,8 @@
 #define CONFIG_HOST "Host"
 #define CONFIG_HARDWARE "Hardware"
 
+static char szNone[MAX_DPATH];
+
 static int allow_quit;
 static int restart_requested;
 static int full_property_sheet = 1;
@@ -377,8 +379,6 @@ static HWND cachedlist = NULL;
 #define MIN_SOUND_MEM 0
 #define MAX_SOUND_MEM 6
 
-static char szNone[ MAX_DPATH ] = "None";
-
 struct romscandata {
     HKEY fkey;
     int got;
@@ -5333,7 +5333,7 @@ static void values_to_sounddlg (HWND hDlg)
     }
     if (workprefs.dfxclick[idx] < 0) {
        p = drivesounds;
-       i = DS_BUILD_IN_SOUNDS + driveclick_pcdrivenum + 1;
+       i = DS_BUILD_IN_SOUNDS + 2 + 1;
        while (p && p[0]) {
            if (!strcmpi (p, workprefs.dfxclickexternal[idx])) {
                SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_SETCURSEL, i, 0);
@@ -5422,8 +5422,8 @@ static void values_from_sounddlg (HWND hDlg)
     if (idx >= 0) {
        LRESULT res = SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_GETCURSEL, 0, 0);
        if (res >= 0) {
-           if (res > DS_BUILD_IN_SOUNDS + driveclick_pcdrivenum) {
-               int j = res - (DS_BUILD_IN_SOUNDS + driveclick_pcdrivenum + 1);
+           if (res > DS_BUILD_IN_SOUNDS + 2) {
+               int j = res - (DS_BUILD_IN_SOUNDS + 2 + 1);
                char *p = drivesounds;
                while (j-- > 0)
                    p += strlen (p) + 1;
@@ -6878,9 +6878,9 @@ static void enable_for_portsdlg( HWND hDlg )
     EnableWindow(GetDlgItem(hDlg, IDC_UAESERIAL), FALSE);
 #else
     v = workprefs.use_serial ? TRUE : FALSE;
-    EnableWindow(GetDlgItem(hDlg, IDC_SHARED), v);
+    EnableWindow(GetDlgItem(hDlg, IDC_SER_SHARED), v);
     EnableWindow(GetDlgItem(hDlg, IDC_SER_CTSRTS), v);
-    EnableWindow(GetDlgItem(hDlg, IDC_SERIAL_DIRECT), v);
+    EnableWindow(GetDlgItem(hDlg, IDC_SER_DIRECT), v);
     EnableWindow(GetDlgItem(hDlg, IDC_UAESERIAL), full_property_sheet);
 #endif
 #if !defined (PARALLEL_PORT)
@@ -7025,8 +7025,7 @@ static void values_from_portsdlg (HWND hDlg)
     }
 
     item = SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_GETCURSEL, 0, 0L);
-    if(item != CB_ERR)
-    {
+    if(item != CB_ERR) {
        int got = 0;
        strcpy (tmp, workprefs.prtname);
        if (item > 0) {
@@ -7048,7 +7047,7 @@ static void values_from_portsdlg (HWND hDlg)
            }
        }
        if (!got)
-           strcpy( workprefs.prtname, "none" );
+           workprefs.prtname[0] = 0;
 #ifdef PARALLEL_PORT
        if (strcmp (workprefs.prtname, tmp))
            closeprinter ();
@@ -7058,48 +7057,35 @@ static void values_from_portsdlg (HWND hDlg)
     workprefs.win32_midioutdev = SendDlgItemMessage(hDlg, IDC_MIDIOUTLIST, CB_GETCURSEL, 0, 0);
     workprefs.win32_midioutdev -= 2;
 
-    if( bNoMidiIn )
-    {
+    if( bNoMidiIn) {
        workprefs.win32_midiindev = -1;
-    }
-    else
-    {
+    } else {
        workprefs.win32_midiindev = SendDlgItemMessage(hDlg, IDC_MIDIINLIST, CB_GETCURSEL, 0, 0);
     }
-    EnableWindow(GetDlgItem( hDlg, IDC_MIDIINLIST ), workprefs.win32_midioutdev < -1 ? FALSE : TRUE);
+    EnableWindow(GetDlgItem(hDlg, IDC_MIDIINLIST), workprefs.win32_midioutdev < -1 ? FALSE : TRUE);
 
     item = SendDlgItemMessage (hDlg, IDC_SERIAL, CB_GETCURSEL, 0, 0L);
-    switch( item ) 
-    {
-       case 1:
-       case 2:
-       case 3:
-       case 4:
-       case 5:
-       case 6:
-       case 7:
-       case 8:
-           workprefs.use_serial = 1;
-           strcpy (workprefs.sername, comports[item - 1]);
-       break;
-
-       default:
-           workprefs.use_serial = 0;
-           strcpy(workprefs.sername, "none");
-       break;
+    if (item != CB_ERR) {
+        workprefs.use_serial = 1;
+        strcpy (workprefs.sername, comports[item - 1]);
+    } else {
+        workprefs.use_serial = 0;
+        workprefs.sername[0] = 0;
     }
-    workprefs.uaeserial = 0;
-    if (IsDlgButtonChecked (hDlg, IDC_UAESERIAL))
-       workprefs.uaeserial = 1;
     workprefs.serial_demand = 0;
-    if (IsDlgButtonChecked (hDlg, IDC_SHARED))
+    if (IsDlgButtonChecked (hDlg, IDC_SER_SHARED))
        workprefs.serial_demand = 1;
     workprefs.serial_hwctsrts = 0;
     if (IsDlgButtonChecked (hDlg, IDC_SER_CTSRTS))
        workprefs.serial_hwctsrts = 1;
     workprefs.serial_direct = 0;
-    if (IsDlgButtonChecked (hDlg, IDC_SERIAL_DIRECT))
+    if (IsDlgButtonChecked (hDlg, IDC_SER_DIRECT))
        workprefs.serial_direct = 1;
+
+    workprefs.uaeserial = 0;
+    if (IsDlgButtonChecked (hDlg, IDC_UAESERIAL))
+       workprefs.uaeserial = 1;
+
     GetDlgItemText (hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters, sizeof workprefs.ghostscript_parameters);
     v  = GetDlgItemInt (hDlg, IDC_PRINTERAUTOFLUSH, &success, FALSE);
     if (success)
@@ -7111,11 +7097,10 @@ static void values_to_portsdlg (HWND hDlg)
 {
     LRESULT result = 0;
 
-    if( strcmp (workprefs.prtname, "none"))
-    {
+    if(workprefs.prtname[0]) {
        int i, got = 1;
        char tmp[10];
-       result = SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_FINDSTRINGEXACT, -1, (LPARAM)workprefs.prtname );
+       result = SendDlgItemMessage(hDlg, IDC_PRINTERLIST, CB_FINDSTRINGEXACT, -1, (LPARAM)workprefs.prtname);
        for (i = 0; i < 4; i++) {
            sprintf (tmp, "LPT%d", i + 1);
            if (!strcmp (tmp, workprefs.prtname)) {
@@ -7125,16 +7110,13 @@ static void values_to_portsdlg (HWND hDlg)
                break;
            }
        }
-       if( result < 0 || got == 0)
-       {
+       if(result < 0 || got == 0) {
            // Warn the user that their printer-port selection is not valid on this machine
-           char szMessage[ MAX_DPATH ];
-           WIN32GUI_LoadUIString( IDS_INVALIDPRTPORT, szMessage, MAX_DPATH );
-           pre_gui_message (szMessage);
-           
+           char szMessage[MAX_DPATH];
+           WIN32GUI_LoadUIString(IDS_INVALIDPRTPORT, szMessage, MAX_DPATH);
+           pre_gui_message (szMessage);    
            // Disable the invalid parallel-port selection
-           strcpy( workprefs.prtname, "none" );
-
+           workprefs.prtname[0] = 0;
            result = 0;
        }
     }
@@ -7152,15 +7134,14 @@ static void values_to_portsdlg (HWND hDlg)
     EnableWindow(GetDlgItem(hDlg, IDC_MIDIINLIST ), workprefs.win32_midioutdev < -1 ? FALSE : TRUE);
     
     CheckDlgButton(hDlg, IDC_UAESERIAL, workprefs.uaeserial);
-    CheckDlgButton(hDlg, IDC_SHARED, workprefs.serial_demand);
+    CheckDlgButton(hDlg, IDC_SER_SHARED, workprefs.serial_demand);
     CheckDlgButton(hDlg, IDC_SER_CTSRTS, workprefs.serial_hwctsrts);
-    CheckDlgButton(hDlg, IDC_SERIAL_DIRECT, workprefs.serial_direct);
+    CheckDlgButton(hDlg, IDC_SER_DIRECT, workprefs.serial_direct);
     
-    if(strcasecmp(workprefs.sername, "none") == 0)  {
+    if(!workprefs.sername[0])  {
        SendDlgItemMessage (hDlg, IDC_SERIAL, CB_SETCURSEL, 0, 0L);
        workprefs.use_serial = 0;
     } else {
-       int t = (workprefs.sername[0] == '\0' ? 0 : workprefs.sername[3] - '0');
        int i;
        LRESULT result = -1;
        for (i = 0; i < MAX_SERIALS; i++) {
@@ -7169,18 +7150,15 @@ static void values_to_portsdlg (HWND hDlg)
                break;
            }
        }
-       if(result < 0) {
-           if (t > 0) {
-               // Warn the user that their COM-port selection is not valid on this machine
-               char szMessage[MAX_DPATH];
-               WIN32GUI_LoadUIString(IDS_INVALIDCOMPORT, szMessage, MAX_DPATH);
-               pre_gui_message (szMessage);
-
-               // Select "none" as the COM-port
-               SendDlgItemMessage(hDlg, IDC_SERIAL, CB_SETCURSEL, 0L, 0L);             
-           }
+       if(result < 0 && workprefs.sername[0]) {
+           // Warn the user that their COM-port selection is not valid on this machine
+           char szMessage[MAX_DPATH];
+           WIN32GUI_LoadUIString(IDS_INVALIDCOMPORT, szMessage, MAX_DPATH);
+           pre_gui_message (szMessage);
+           // Select "none" as the COM-port
+           SendDlgItemMessage(hDlg, IDC_SERIAL, CB_SETCURSEL, 0L, 0L);         
            // Disable the chosen serial-port selection
-           strcpy( workprefs.sername, "none" );
+           workprefs.sername[0] = 0;
            workprefs.use_serial = 0;
        } else {
            workprefs.use_serial = 1;
@@ -7210,28 +7188,27 @@ static void init_portsdlg( HWND hDlg )
 
     joy0previous = joy1previous = -1;
     SendDlgItemMessage (hDlg, IDC_SERIAL, CB_RESETCONTENT, 0, 0L);
-    SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)szNone );
+    SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)szNone);
     portcnt = 0;
-    for( port = 0; port < MAX_SERIALS; port++ )
-    {
-       sprintf( comports[portcnt], "COM%d", port );
-       if( GetDefaultCommConfig( comports[portcnt], &cc, &size ) )
-       {
-           SendDlgItemMessage( hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comports[portcnt++] );
+    for(port = 0; port < MAX_SERIALS; port++) {
+       sprintf(comports[portcnt], "COM%d", port);
+       if(GetDefaultCommConfig(comports[portcnt], &cc, &size)) {
+           SendDlgItemMessage(hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comports[portcnt++]);
        }
+       write_log("%d:%d\n",port, GetLastError());
     }
 
     SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_RESETCONTENT, 0, 0L);
-    SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)szNone );
-    if( !pInfo ) {
+    SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)szNone);
+    if(!pInfo) {
        int flags = PRINTER_ENUM_LOCAL | (os_winnt ? PRINTER_ENUM_CONNECTIONS : 0);
        DWORD needed = 0;
-       EnumPrinters( flags, NULL, 1, (LPBYTE)pInfo, 0, &needed, &dwEnumeratedPrinters );
+       EnumPrinters(flags, NULL, 1, (LPBYTE)pInfo, 0, &needed, &dwEnumeratedPrinters);
        if (needed > 0) {
            DWORD size = needed;
            pInfo = calloc(1, size);
            dwEnumeratedPrinters = 0;
-           EnumPrinters( flags, NULL, 1, (LPBYTE)pInfo, size, &needed, &dwEnumeratedPrinters );
+           EnumPrinters(flags, NULL, 1, (LPBYTE)pInfo, size, &needed, &dwEnumeratedPrinters);
        }
        if (dwEnumeratedPrinters == 0) {
            free (pInfo);
@@ -7239,10 +7216,10 @@ static void init_portsdlg( HWND hDlg )
        }
     }
     if (pInfo) {
-       for( port = 0; port < (int)dwEnumeratedPrinters; port++ )
-           SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)pInfo[port].pName );
+       for(port = 0; port < (int)dwEnumeratedPrinters; port++)
+           SendDlgItemMessage(hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)pInfo[port].pName);
     } else {
-       EnableWindow( GetDlgItem( hDlg, IDC_PRINTERLIST ), FALSE );
+       EnableWindow(GetDlgItem(hDlg, IDC_PRINTERLIST), FALSE);
     }
     if (paraport_mask) {
        int mask = paraport_mask;
@@ -7258,42 +7235,30 @@ static void init_portsdlg( HWND hDlg )
        }
     }
 
-    SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_RESETCONTENT, 0, 0L );
-    SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szNone );
-    if( ( numdevs = midiOutGetNumDevs() ) == 0 )
-    {
-       EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), FALSE );
-    }
-    else
-    {
-       char szMidiOut[ MAX_DPATH ];
-       WIN32GUI_LoadUIString( IDS_DEFAULTMIDIOUT, szMidiOut, MAX_DPATH );
-       SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szMidiOut );
+    SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_RESETCONTENT, 0, 0L);
+    SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szNone);
+    if((numdevs = midiOutGetNumDevs()) == 0) {
+       EnableWindow(GetDlgItem(hDlg, IDC_MIDIOUTLIST), FALSE);
+    } else {
+       char szMidiOut[MAX_DPATH];
+       WIN32GUI_LoadUIString(IDS_DEFAULTMIDIOUT, szMidiOut, MAX_DPATH);
+       SendDlgItemMessage(hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szMidiOut);
 
-       for( port = 0; port < numdevs; port++ )
-       {
-           if( midiOutGetDevCaps( port, &midiOutCaps, sizeof( midiOutCaps ) ) == MMSYSERR_NOERROR )
-           {
-               SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midiOutCaps.szPname );
-           }
+       for(port = 0; port < numdevs; port++) {
+           if(midiOutGetDevCaps(port, &midiOutCaps, sizeof(midiOutCaps)) == MMSYSERR_NOERROR)
+               SendDlgItemMessage(hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midiOutCaps.szPname);
        }
-       EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), TRUE );
+       EnableWindow(GetDlgItem(hDlg, IDC_MIDIOUTLIST), TRUE);
     }
 
-    SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_RESETCONTENT, 0, 0L );
-    if( ( numdevs = midiInGetNumDevs() ) == 0 )
-    {
-       EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), FALSE );
+    SendDlgItemMessage(hDlg, IDC_MIDIINLIST, CB_RESETCONTENT, 0, 0L);
+    if((numdevs = midiInGetNumDevs()) == 0) {
+       EnableWindow(GetDlgItem(hDlg, IDC_MIDIINLIST), FALSE);
        bNoMidiIn = TRUE;
-    }
-    else
-    {
-       for( port = 0; port < numdevs; port++ )
-       {
-           if( midiInGetDevCaps( port, &midiInCaps, sizeof( midiInCaps ) ) == MMSYSERR_NOERROR )
-           {
-               SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)midiInCaps.szPname );
-           }
+    } else {
+       for(port = 0; port < numdevs; port++) {
+           if(midiInGetDevCaps(port, &midiInCaps, sizeof(midiInCaps)) == MMSYSERR_NOERROR)
+               SendDlgItemMessage(hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)midiInCaps.szPname);
        }
     }
 }
@@ -9133,7 +9098,6 @@ static int GetSettings (int all_options, HWND hwnd)
     default_prefs (&workprefs, 0);
 
     WIN32GUI_LoadUIString (IDS_NONE, szNone, MAX_DPATH);
-
     prefs_to_gui (&changed_prefs);
 
     if (!init_called) {
index 08aa04322fec795dab34c22d6e1503e464f0e9c8..c8815aa2e0d10b82d1293d2889feff18c6e286f3 100644 (file)
@@ -3,10 +3,14 @@ Beta 4:
 
 - uaeserial.device tweaks
 - added more logging to RDB parser
-- 1G Z3 fast RAM allowed (only if NT-based Windows and >=2G RAM)
 - do not reopen DirectSound when losing/gaining focus
-- reverted DirectSound initialization to pre-1.3.3 version, perhaps
-  it helps with VIA AC97 pitch change issue..
+- DirectSound initialization changes
+- drivesound disk selection menu selected wrong entry in some cases
+- rare divide by zero error when running Amiga program tries to
+  program 1 line tall display mode
+- final MSVC 2005 SP1 installed
+- dual core/SMP hardfile freeze fix (RD)
+- bsdsocket bug fix that could have caused buffer overflows
 
 Beta 3:
 
index d1075ff84cc5526f422883014064d1ae2d52c9dd..0df0e92414c5f89f50978f0b669b2b865f353b3e 100644 (file)
--- a/uaelib.c
+++ b/uaelib.c
@@ -26,6 +26,7 @@
 #include "debug.h"
 #include "gensound.h"
 #include "picasso96.h"
+#include "filesys.h"
 
 /*
  * Returns UAE Version
@@ -357,6 +358,26 @@ static uae_u32 emulib_Minimize (void)
     return 0; // OSDEP_minimize_uae();
 }
 
+static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3)
+{
+    char tmp[MAX_DPATH];
+    int v, i;
+
+    if (mode)
+       return -1;
+    /* receive native path from lock
+     * p1 = dos.library:Lock, p2 = buffer, p3 = max buffer size 
+     */
+    v = get_native_path (p1, tmp);
+    if (v)
+       return v;
+    for (i = 0; i <= strlen(tmp) && i < p3 - 1; i++) {
+        put_byte (p2 + i, tmp[i]);
+        put_byte (p2 + i + 1, 0);
+    }
+    return 0;
+}
+
 static uae_u32 REGPARAM2 uaelib_demux (TrapContext *context)
 {
 #define ARG0 (get_long (m68k_areg (&context->regs, 7) + 4))
@@ -423,6 +444,7 @@ static uae_u32 REGPARAM2 uaelib_demux (TrapContext *context)
 #ifdef DEBUGGER
      case 84: return mmu_init (ARG1, ARG2, ARG3);
 #endif
+     case 85: return native_dos_op (ARG1, ARG2, ARG3, ARG4);
     }
     return 0;
 }
index 735a73d8f15d36a64c950eec009ccf7bfdcdae75..9ec6294a877b6a11cb50c7dca8fc79284c5412c9 100644 (file)
@@ -120,6 +120,7 @@ struct asyncreq {
 };
 
 struct devstruct {
+    int open;
     int unit;
     int uniq;
     int exclusive;
@@ -131,7 +132,6 @@ struct devstruct {
     int thread_running;
     uae_sem_t sync_sem;
 
-    int brk;
     void *sysdata;
 };
 
@@ -177,7 +177,7 @@ static int start_thread (struct devstruct *dev)
 static void dev_close_3 (struct devstruct *dev)
 {
     uaeser_close (dev->sysdata);
-    dev->unit = -1;
+    dev->open = 0;
     xfree (dev->sysdata);
     write_comm_pipe_u32 (&dev->requests, 0, 1);
 }
@@ -210,7 +210,6 @@ static int setparams(struct devstruct *dev, uaecptr req)
        return 5;
     }
     baud = get_long (req + io_Baud);
-    dev->brk = get_long (req + io_BrkTime);
     v = get_byte (req + io_SerFlags);
     if (v & SERF_EOFMODE) {
        write_log ("UAESER: SERF_EOFMODE not supported\n");
@@ -260,7 +259,7 @@ static uae_u32 REGPARAM2 dev_open (TrapContext *context)
            return openfail (ioreq, -6); /* busy */
     }
     for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
-       if (devst[i].unit == -1)
+       if (!devst[i].open)
            break;
     }
     dev = &devst[i];
@@ -272,6 +271,7 @@ static uae_u32 REGPARAM2 dev_open (TrapContext *context)
        return openfail (ioreq, 32); /* badunitnum */
     }
     dev->unit = unit;
+    dev->open = 1;
     dev->uniq = ++uniq;
     dev->exclusive = (get_word(ioreq + io_SerFlags) & SERF_SHARED) ? 0 : 1;
     put_long (ioreq + 24, dev->uniq);
@@ -400,6 +400,12 @@ void uaeser_signal (struct devstruct *dev, int sigmask)
 
            switch (command)
            {
+               case SDCMD_BREAK:
+               if (ar == dev->ar) {
+                   uaeser_break (dev->sysdata,  get_long (request + io_BrkTime));
+                   io_done = 1;
+               }
+               break;
                case CMD_READ:
                if (sigmask & 1) {
                    addr = memmap(io_data, io_length);
@@ -496,7 +502,11 @@ static int dev_do_io (struct devstruct *dev, uaecptr request, int quick)
        async = 1;
        break;
        case SDCMD_BREAK:
-       uaeser_break (dev->sysdata, dev->brk);
+       if (get_byte (request + io_SerFlags) & SERF_QUEUEDBRK) {
+           async = 1;
+       } else {
+           uaeser_break (dev->sysdata,  get_long (request + io_BrkTime));
+       }
        break;
        case CMD_CLEAR:
        uaeser_clearbuffers(dev->sysdata);
@@ -604,12 +614,13 @@ static void dev_reset (void)
 
     for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
        dev = &devst[i];
-       if (dev->unit >= 0) {
+       if (dev->open) {
            while (dev->ar)
                abort_async (dev, dev->ar->request);
+           dev_close_3 (dev);
+           uae_sem_wait (&dev->sync_sem);
        }
        memset (dev, 0, sizeof (struct devstruct));
-       dev->unit = -1;
     }
 }
 
@@ -619,18 +630,10 @@ static uaecptr ROM_uaeserialdev_resname = 0,
 
 uaecptr uaeserialdev_startup (uaecptr resaddr)
 {
-    int i;
-    struct devstruct *dev;
-
     if (!currprefs.uaeserial)
        return resaddr;
     if (log_uaeserial)
        write_log ("uaeserialdev_startup(0x%x)\n", resaddr);
-    for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
-       dev = &devst[i];
-       dev->unit = -1;
-       dev->brk = 250000;
-    }
     /* Build a struct Resident. This will set up and initialize
      * the serial.device */
     put_word(resaddr + 0x0, 0x4AFC);