From: Toni Wilen Date: Tue, 1 Mar 2005 17:11:53 +0000 (+0200) Subject: imported winuaesrc1000b3.zip X-Git-Tag: 2100~318 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=8c0ec7c35a4ea60db54c923c8dcd6818c719085b;p=francis%2Fwinuae.git imported winuaesrc1000b3.zip --- diff --git a/cfgfile.c b/cfgfile.c index 8a18f505..1cbce89a 100755 --- 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; diff --git a/custom.c b/custom.c index 05b6302f..f357e1ef 100755 --- 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 diff --git a/enforcer.c b/enforcer.c index 461e6b47..f01c81bb 100755 --- a/enforcer.c +++ b/enforcer.c @@ -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) diff --git a/expansion.c b/expansion.c index 6b4eba75..a5b156ff 100755 --- a/expansion.c +++ b/expansion.c @@ -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); diff --git a/include/options.h b/include/options.h index 65e3cd8c..5ae77cd6 100755 --- a/include/options.h +++ b/include/options.h @@ -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 1b01ca29..fd271cb1 100755 --- 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; diff --git a/od-win32/fsdb_win32.c b/od-win32/fsdb_win32.c index 5d1056ad..96f7997f 100755 --- a/od-win32/fsdb_win32.c +++ b/od-win32/fsdb_win32.c @@ -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( diff --git a/od-win32/mman.c b/od-win32/mman.c index ad67e76e..75e25874 100755 --- a/od-win32/mman.c +++ b/od-win32/mman.c @@ -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; } diff --git a/od-win32/picasso96_win.c b/od-win32/picasso96_win.c index 9ea9ba1a..c6a09196 100755 --- a/od-win32/picasso96_win.c +++ b/od-win32/picasso96_win.c @@ -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{ diff --git a/od-win32/win32.c b/od-win32/win32.c index c6784bb1..e3c21ace 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -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; } diff --git a/od-win32/win32.h b/od-win32/win32.h index fd977607..49e72954 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -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); diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index e063dc07..dc8c962f 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -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); }