]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1000b3.zip
authorToni Wilen <twilen@winuae.net>
Tue, 1 Mar 2005 17:11:53 +0000 (19:11 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:25:14 +0000 (21:25 +0200)
12 files changed:
cfgfile.c
custom.c
enforcer.c
expansion.c
include/options.h
main.c
od-win32/fsdb_win32.c
od-win32/mman.c
od-win32/picasso96_win.c
od-win32/win32.c
od-win32/win32.h
od-win32/win32gui.c

index 8a18f505c8bfb3239fc205ce0e2111e2802d05a6..1cbce89a70b1ff7b8214b816bada7c71c3fe998d 100755 (executable)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -1359,9 +1359,22 @@ end:
     return v;
 }
 
+void cfgfile_backup (const char *path)
+{
+    char dpath[MAX_DPATH];
+
+    fetch_configurationpath (dpath, sizeof (dpath));
+    strcat (dpath, "configuration.backup");
+    my_unlink (dpath);
+    my_rename (path, dpath);
+}
+
 int cfgfile_save (struct uae_prefs *p, const char *filename, int type)
 {
-    struct zfile *fh = zfile_fopen (filename, "w");
+    struct zfile *fh;
+
+    cfgfile_backup (filename);
+    fh = zfile_fopen (filename, "w");
     write_log ("save config '%s'\n", filename);
     if (! fh)
        return 0;
index 05b6302ffcd045e940dee395ecf2be9aa2392f0d..f357e1ef4edaa1ac1c0132b32435f6b711fbae70 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -12,7 +12,7 @@
 #define DEBUG_COPPER 0
 #define SPRITE_DEBUG 0
 #define SPRITE_DEBUG_MINY 0
-#define SPRITE_DEBUG_MAXY 401
+#define SPRITE_DEBUG_MAXY 41
 //#define SPRITE_MASK 0
 #define SPRITE_MASK (1|2|4|8|16|32|64|128)
 #define SPR0_HPOS 0x15
@@ -3070,7 +3070,7 @@ STATIC_INLINE void SPRxCTL_1 (uae_u16 v, int num, int hpos)
     SPRxCTLPOS (num);
 #if SPRITE_DEBUG > 0
     if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
-       write_log ("%d:%d:SPR%dCTL %04.4X P=%06.6X VSTRT=%d VSTOP=%d HSTRT=%d DMA=%d ARM=%d COP=%x PC=%x\n",
+       write_log ("%d:%d:SPR%dCTL %04.4X P=%06.6X VSTRT=%d VSTOP=%d HSTRT=%d D=%d A=%d CP=%x PC=%x\n",
            vpos, hpos, num, v, s->pt, s->vstart, s->vstop, s->xpos, spr[num].dmastate, spr[num].armed, cop_state.ip, m68k_getpc());
     }
 #endif
@@ -3083,7 +3083,7 @@ STATIC_INLINE void SPRxPOS_1 (uae_u16 v, int num, int hpos)
     SPRxCTLPOS (num);
 #if SPRITE_DEBUG > 0
     if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
-        write_log ("%d:%d:SPR%dPOS %04.4X P=%06.6X VSTRT=%d VSTOP=%d HSTRT=%d DMA=%d ARM=%d COP=%x PC=%x\n",
+        write_log ("%d:%d:SPR%dPOS %04.4X P=%06.6X VSTRT=%d VSTOP=%d HSTRT=%d D=%d A=%d CP=%x PC=%x\n",
            vpos, hpos, num, v, s->pt, s->vstart, s->vstop, s->xpos, spr[num].dmastate, spr[num].armed, cop_state.ip, m68k_getpc());
     }
 #endif
@@ -3099,7 +3099,7 @@ STATIC_INLINE void SPRxDATA_1 (uae_u16 v, int num, int hpos)
     spr_arm (num, 1);
 #if SPRITE_DEBUG > 1
     if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
-        write_log ("%d:%d:SPR%dDATA %04.4X P=%06.6X DMA=%d ARM=%d PC=%x\n",
+        write_log ("%d:%d:SPR%dDATA %04.4X P=%06.6X D=%d A=%d PC=%x\n",
            vpos, hpos, num, v, spr[num].pt, spr[num].dmastate, spr[num].armed, m68k_getpc());
     }
 #endif
@@ -3114,7 +3114,7 @@ STATIC_INLINE void SPRxDATB_1 (uae_u16 v, int num, int hpos)
 #endif
 #if SPRITE_DEBUG > 1
     if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
-        write_log ("%d:%d:SPR%dDATB %04.4X P=%06.6X DMA=%d ARM=%d PC=%x\n",
+        write_log ("%d:%d:SPR%dDATB %04.4X P=%06.6X D=%d A=%d PC=%x\n",
            vpos, hpos, num, v, spr[num].pt, spr[num].dmastate, spr[num].armed, m68k_getpc());
     }
 #endif
index 461e6b47ff9ac2c6b494eac5afc5837ad4e72a81..f01c81bb36f6962a6e4c56ead4c4c92f0ed289ad 100755 (executable)
@@ -464,12 +464,12 @@ void REGPARAM2 chipmem_bput2 (uaecptr addr, uae_u32 b)
        if (ISILLEGAL(addr))
        {
                enforcer_display_hit("BYTE WRITE to",(uae_u32)(regs.pc_p - NATMEM_OFFSET),addr);
-               chipmemory[addr] = b;
                        if (enforcermode==1)
                        {
                        set_special (SPCFLAG_TRAP);     
                        }
        }
+    chipmemory[addr] = b;
 }
 
 int REGPARAM2 chipmem_check2 (uaecptr addr, uae_u32 size)
index 6b4eba75f9d04f1a94d28e28d5f4eeeff9f8df59..a5b156fffb34866a8cb1ae0bcab3b19914662389 100755 (executable)
@@ -969,6 +969,7 @@ static void expamem_init_z3fastmem (void)
                : allocated_z3fastmem == 0x10000000 ? Z2_MEM_256MB
                : allocated_z3fastmem == 0x20000000 ? Z2_MEM_512MB
                : Z2_MEM_1GB);
+
     expamem_init_clear();
     expamem_write (0x00, add_memory | zorroIII | code);
 
@@ -1010,24 +1011,19 @@ static void expamem_map_gfxcard (void)
 
 static void expamem_init_gfxcard (void)
 {
-    expamem_init_clear();
-    expamem_write (0x00, zorroIII);
+    int code = (allocated_gfxmem == 0x100000 ? Z2_MEM_1MB
+        : allocated_gfxmem == 0x200000 ? Z2_MEM_2MB
+        : allocated_gfxmem == 0x400000 ? Z2_MEM_4MB
+        : allocated_gfxmem == 0x800000 ? Z2_MEM_8MB
+        : allocated_gfxmem == 0x1000000 ? Z2_MEM_16MB
+        : allocated_gfxmem == 0x2000000 ? Z2_MEM_32MB
+        : allocated_gfxmem == 0x4000000 ? Z2_MEM_64MB
+        : Z2_MEM_128MB);
 
-    switch (allocated_gfxmem) {
-     case 0x00100000:
-       expamem_write (0x08, no_shutup | force_z3 | Z3_MEM_1MB);
-       break;
-     case 0x00200000:
-       expamem_write (0x08, no_shutup | force_z3 | Z3_MEM_2MB);
-       break;
-     case 0x00400000:
-       expamem_write (0x08, no_shutup | force_z3 | Z3_MEM_4MB);
-       break;
-     case 0x00800000:
-       expamem_write (0x08, no_shutup | force_z3 | Z3_MEM_8MB);
-       break;
-    }
+    expamem_init_clear();
+    expamem_write (0x00, zorroIII | code);
 
+    expamem_write (0x08, no_shutup | force_z3 | (allocated_gfxmem > 0x800000 ? ext_size : Z3_MEM_AUTO));
     expamem_write (0x04, 96);
 
     expamem_write (0x10, hackers_id >> 8);
index 65e3cd8c68cc663d46d6b46c9bcceb811086cd9e..5ae77cd65f939bcfe98a738eb8574bab6606a45f 100755 (executable)
@@ -246,6 +246,7 @@ struct uae_prefs {
 extern char optionsfile[];
 extern void save_options (struct zfile *, struct uae_prefs *, int);
 extern void cfgfile_write (struct zfile *, char *format,...);
+extern void cfgfile_backup (const char *path);
 
 extern void default_prefs (struct uae_prefs *, int);
 extern void discard_prefs (struct uae_prefs *, int);
diff --git a/main.c b/main.c
index 1b01ca29481b1fa4dbe9b8351059df93fd36b6e4..fd271cb19cf1d960fae5b9ef08c628d646657cd4 100755 (executable)
--- a/main.c
+++ b/main.c
@@ -138,7 +138,7 @@ void fixup_prefs (struct uae_prefs *p)
        err = 1;
     }
     if ((p->gfxmem_size & (p->gfxmem_size - 1)) != 0
-       || (p->gfxmem_size != 0 && (p->gfxmem_size < 0x100000 || p->gfxmem_size > 0x2000000)))
+       || (p->gfxmem_size != 0 && (p->gfxmem_size < 0x100000 || p->gfxmem_size > 0x8000000)))
     {
        write_log ("Unsupported graphics card memory size %lx!\n", p->gfxmem_size);
        p->gfxmem_size = 0;
index 5d1056ad0eb13d2d825572e6c1558a7bc9b24884..96f7997fc67cecd913e2d26b2a8979ebc6d88084 100755 (executable)
@@ -67,7 +67,7 @@ static int read_uaefsdb (const char *dir, const char *name, uae_u8 *fsdb)
     char *p;
     HANDLE h;
     DWORD read;
-    
+
     p = make_uaefsdbpath (dir, name);
     h = CreateFile (p, GENERIC_READ, 0,
        NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -82,14 +82,23 @@ static int read_uaefsdb (const char *dir, const char *name, uae_u8 *fsdb)
     return 0;
 }
 
-static int write_uaefsdb (const char *dir, const char *name, uae_u8 *fsdb)
+static int write_uaefsdb (const char *dir, uae_u8 *fsdb)
 {
     char *p;
     HANDLE h;
     DWORD written, attr = INVALID_FILE_ATTRIBUTES;
+    FILETIME t1, t2, t3;
+    int time_valid = FALSE;
     int ret = 0;
     
-    p = make_uaefsdbpath (dir, name);
+    p = make_uaefsdbpath (dir, NULL);
+    h = CreateFile (dir, GENERIC_READ, 0,
+        NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+    if (h != INVALID_HANDLE_VALUE) {    
+       if (GetFileTime (h, &t1, &t2, &t3))
+           time_valid = TRUE;
+       CloseHandle (h);
+    }
     h = CreateFile (p, GENERIC_WRITE, 0,
         NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
     if (h == INVALID_HANDLE_VALUE && GetLastError () == ERROR_ACCESS_DENIED) {
@@ -114,6 +123,14 @@ static int write_uaefsdb (const char *dir, const char *name, uae_u8 *fsdb)
 end:
     if (attr != INVALID_FILE_ATTRIBUTES)
        SetFileAttributes (p, attr);
+    if (time_valid) {
+       h = CreateFile (dir, GENERIC_WRITE, 0,
+           NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+       if (h != INVALID_HANDLE_VALUE) {        
+           SetFileTime (h, &t1, &t2, &t3);
+           CloseHandle (h);
+       }
+    }
     xfree (p);
     return ret;
 }
@@ -257,7 +274,7 @@ int fsdb_fill_file_attrs (a_inode *base, a_inode *aino)
     if (reset) {
        if (base->volflags & MYVOLUMEINFO_STREAMS) {
            create_uaefsdb (aino, fsdb, mode);
-           write_uaefsdb (aino->nname, NULL, fsdb);
+           write_uaefsdb (aino->nname, fsdb);
        }
     }
     return 1;
@@ -294,7 +311,7 @@ int fsdb_set_file_attrs (a_inode *aino)
     aino->dirty = 1;
     if (aino->volflags & MYVOLUMEINFO_STREAMS) {
        create_uaefsdb (aino, fsdb, mode);
-       write_uaefsdb (aino->nname, NULL, fsdb);
+       write_uaefsdb (aino->nname, fsdb);
     }
     return 0;
 }
@@ -714,8 +731,10 @@ int my_getvolumeinfo (char *root)
        return -1;
     if (!(v & FILE_ATTRIBUTE_DIRECTORY))
        return -1;
+/*
     if (v & FILE_ATTRIBUTE_READONLY)
        ret |= MYVOLUMEINFO_READONLY;
+*/
     if (!os_winnt)
        return ret;
     pGetVolumePathName = (GETVOLUMEPATHNAME)GetProcAddress(
index ad67e76e1377df1294628146f0b158d0b397eed8..75e25874d5d5cbc1b1cdeb7dbb29c55cce47d186 100755 (executable)
@@ -10,6 +10,7 @@
 #include "include/memory.h"
 #include "options.h"
 #include "autoconf.h"
+#include "win32.h"
 
 static struct shmid_ds shmids[ MAX_SHMID ];
 static uae_u32 gfxoffs;
@@ -53,6 +54,8 @@ void init_shm( void )
            VirtualFree (blah, 0, MEM_RELEASE);
            while (address < (LPBYTE)0xa0000000) {
                address += add * 8;
+               if (!os_winnt) /* Windows 9x/ME sucks */
+                   break;
                blah = VirtualAlloc (address, size, MEM_RESERVE, PAGE_EXECUTE_READWRITE);
                if (blah == NULL) {
                    address -= add * 8;
@@ -61,7 +64,7 @@ void init_shm( void )
                VirtualFree (blah, 0, MEM_RELEASE);
            }
            natmem_offset = (uae_u8*)natmem_offset + ((uae_u8*)address - (uae_u8*)natmem_offset) / 2;
-           write_log ("NATMEM: after adjustment; 0x%x-0x%x\n", natmem_offset, natmem_offset + size);
+           write_log ("NATMEM: after adjustment: 0x%x-0x%x\n", natmem_offset, natmem_offset + size);
            canbang = 1;
            break;
        }
index 9ea9ba1a12f69f460dd55980126914441fd5aaa4..c6a091965a5a9b10f5340a9b7f54ed8ce425d78c 100755 (executable)
@@ -63,7 +63,7 @@ int p96hsync_counter;
 #endif
 #define LOCK_UNLOCK_MADNESS //need for 7 times faster linedraw
 #define PIXEL_LOCK         //and scrollable screens
-#define MAXFLUSHPIXEL 1600 //pixel draw in a lock
+#define MAXFLUSHPIXEL 3200 //pixel draw in a lock
 static void flushpixels(void);
 int pixelcount,palette_changed;
 struct pixel32{
index c6784bb106edf5781a8eabc1eb24bad4db81ae91..e3c21ace7ad91f71a65ef3c4bad20dca8591200c 100755 (executable)
@@ -1958,7 +1958,7 @@ static void WIN32_HandleRegistryStuff( void )
                               KEY_ALL_ACCESS, NULL, &hWinUAEKeyLocal, &disposition ) == ERROR_SUCCESS ) )
         {
             /* Set our (default) sub-key to BE the "WinUAE" command for launching a configuration */
-            sprintf( path, "%sWinUAE.exe -log -f \"%%1\"", start_path );
+            sprintf( path, "%sWinUAE.exe -f \"%%1\"", start_path );
             RegSetValueEx( hWinUAEKeyLocal, "", 0, REG_SZ, (CONST BYTE *)path, strlen( path ) + 1 );
         }
        RegCloseKey( hWinUAEKeyLocal );
@@ -2533,11 +2533,17 @@ HMODULE WIN32_LoadLibrary (const char *name)
 int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
                    int nCmdShow)
 {
+    HANDLE thread;
+    DWORD oldaff;
+
+    thread = GetCurrentThread();
+    oldaff = SetThreadAffinityMask(thread, 1); 
     __try {
        WinMain2 (hInstance, hPrevInstance, lpCmdLine, nCmdShow);
         } __except(ExceptionFilter(GetExceptionInformation(), GetExceptionCode()))
     {
     }
+    SetThreadAffinityMask(thread, oldaff);
     return FALSE;
 }
 
index fd9776073b9485965345e3a810663eb9ea850818..49e72954211f928f18fcb2416839f1686f933a63 100755 (executable)
@@ -22,7 +22,7 @@ extern int manual_palette_refresh_needed;
 extern int mouseactive, focus;
 extern int ignore_messages_all;
 #define WINUAEBETA 1
-#define WINUAEBETASTR " Beta 2"
+#define WINUAEBETASTR " Beta 3"
 
 extern void my_kbd_handler (int, int, int);
 extern void clearallkeys(void);
index e063dc076029d9302c0c9d5b5fcec55398462148..dc8c962f2d9246f8931be7d7756aa28a688a6f88 100755 (executable)
@@ -1505,6 +1505,7 @@ static char *HandleConfiguration (HWND hDlg, int flag, struct ConfigStruct *conf
                    WIN32GUI_LoadUIString( IDS_DELETECONFIGTITLE, szTitle, MAX_DPATH );
                     if( MessageBox( hDlg, szMessage, szTitle,
                        MB_YESNO | MB_ICONWARNING | MB_APPLMODAL | MB_SETFOREGROUND ) == IDYES ) {
+                       cfgfile_backup (path);
                        DeleteFile (path);
                        write_log ("deleted config '%s'\n", path);
                     }