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;
#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
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
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
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
#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
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)
: 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);
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);
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);
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;
char *p;
HANDLE h;
DWORD read;
-
+
p = make_uaefsdbpath (dir, name);
h = CreateFile (p, GENERIC_READ, 0,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
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) {
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;
}
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;
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;
}
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(
#include "include/memory.h"
#include "options.h"
#include "autoconf.h"
+#include "win32.h"
static struct shmid_ds shmids[ MAX_SHMID ];
static uae_u32 gfxoffs;
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;
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;
}
#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{
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 );
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;
}
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);
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);
}