return ret;
}
-static int write_uaefsdb (const TCHAR *dir, uae_u8 *fsdb)
+static int write_uaefsdb(const TCHAR *item, uae_u8 *fsdb)
{
TCHAR *p;
HANDLE h;
- DWORD written = 0, dirflag, dirattr;
+ DWORD written = 0, itemflag, itemattr;
DWORD attr = INVALID_FILE_ATTRIBUTES;
FILETIME t1, t2, t3;
int time_valid = FALSE;
TCHAR path[MAX_DPATH];
if (currprefs.win32_filesystem_mangle_reserved_names == false) {
- _tcscpy (path, PATHPREFIX);
- _tcscat (path, dir);
+ _tcscpy(path, PATHPREFIX);
+ _tcscat(path, item);
namep = path;
} else {
- namep = dir;
+ namep = item;
}
- p = make_uaefsdbpath (dir, NULL);
+ p = make_uaefsdbpath (item, NULL);
- dirattr = GetFileAttributesSafe (dir);
- dirflag = FILE_ATTRIBUTE_NORMAL;
- if (dirattr != INVALID_FILE_ATTRIBUTES && (dirattr & FILE_ATTRIBUTE_DIRECTORY))
- dirflag = FILE_FLAG_BACKUP_SEMANTICS; /* argh... */
- h = CreateFile (namep, GENERIC_READ, 0,
- NULL, OPEN_EXISTING, dirflag, NULL);
+ itemattr = GetFileAttributesSafe (item);
+ itemflag = FILE_ATTRIBUTE_NORMAL;
+ if (itemflag != INVALID_FILE_ATTRIBUTES && (itemattr & FILE_ATTRIBUTE_DIRECTORY))
+ itemflag = FILE_FLAG_BACKUP_SEMANTICS; /* argh... */
+ h = CreateFile(namep, GENERIC_READ, 0, NULL, OPEN_EXISTING, itemflag, NULL);
if (h != INVALID_HANDLE_VALUE) {
- if (GetFileTime (h, &t1, &t2, &t3))
+ if (GetFileTime(h, &t1, &t2, &t3)) {
+ if (fsdb_debug) {
+ write_log(_T("time ok (%08x-%08x %08x-%08x %08x-%08x)\n"),
+ t1.dwHighDateTime, t1.dwLowDateTime,
+ t2.dwHighDateTime, t2.dwLowDateTime,
+ t3.dwHighDateTime, t3.dwLowDateTime);
+ }
time_valid = TRUE;
- CloseHandle (h);
+ }
+ CloseHandle(h);
}
- h = CreateFile (p, GENERIC_WRITE, 0,
- NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ h = CreateFile(p, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (fsdb_debug) {
TCHAR *an, *nn, *co;
- an = au_fs ((char*)fsdb + 5);
- nn = au_fs ((char*)fsdb + 262);
- co = au_fs ((char*)fsdb + 519);
- write_log (_T("write_uaefsdb '%s' = %x\n"), p, h);
+ an = au_fs((char*)fsdb + 5);
+ nn = au_fs((char*)fsdb + 262);
+ co = au_fs((char*)fsdb + 519);
+ write_log (_T("write_uaefsdb '%s' = %p\n"), p, h);
write_log (_T("v=%02x flags=%08x an='%s' nn='%s' c='%s'\n"),
fsdb[0], ((uae_u32*)(fsdb+1))[0], an, nn, co);
- xfree (co);
- xfree (nn);
- xfree (an);
+ xfree(co);
+ xfree(nn);
+ xfree(an);
}
- if (h == INVALID_HANDLE_VALUE && GetLastError () == ERROR_ACCESS_DENIED) {
- attr = GetFileAttributes (p);
- if (attr != INVALID_FILE_ATTRIBUTES) {
- if (attr & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN)) {
- SetFileAttributes (p, attr & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN));
- h = CreateFile (p, GENERIC_WRITE, 0,
- NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- if (fsdb_debug)
- write_log (_T("write_uaefsdb (2) '%s' = %x\n"), p, h);
+ if (h == INVALID_HANDLE_VALUE) {
+ DWORD err = GetLastError();
+ if (fsdb_debug) {
+ write_log(_T("fail %d\n"), err);
+ }
+ if (err == ERROR_ACCESS_DENIED) {
+ attr = GetFileAttributes(p);
+ if (fsdb_debug) {
+ write_log(_T("attrs %08x\n"), attr);
+ }
+ if (attr != INVALID_FILE_ATTRIBUTES) {
+ if (attr & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN)) {
+ uae_u32 attr2 = attr & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+ if (!SetFileAttributes(p, attr2)) {
+ write_log(_T("'%s' SetFileAttributes1 %08x %d\n"), p, attr2, GetLastError());
+ }
+ h = CreateFile(p, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (fsdb_debug) {
+ write_log(_T("write_uaefsdb (2) '%s' = %p %d\n"), p, h, GetLastError());
+ }
+ }
}
}
}
if (h != INVALID_HANDLE_VALUE) {
- WriteFile (h, fsdb, UAEFSDB2_LEN, &written, NULL);
- CloseHandle (h);
+ WriteFile(h, fsdb, UAEFSDB2_LEN, &written, NULL);
+ CloseHandle(h);
if (written == UAEFSDB2_LEN) {
if (fsdb_debug)
- write_log (_T("->ok\n"));
+ write_log(_T("->ok\n"));
ret = 1;
goto end;
}
}
if (fsdb_debug)
- write_log (_T("->fail %d, %d\n"), written, GetLastError ());
+ write_log(_T("->fail %d, %d\n"), written, GetLastError());
- DeleteFile (p);
+ DeleteFile(p);
end:
- if (attr != INVALID_FILE_ATTRIBUTES)
- SetFileAttributes (p, attr);
+ if (attr != INVALID_FILE_ATTRIBUTES) {
+ if (!SetFileAttributes(p, attr)) {
+ write_log(_T("'%s' SetFileAttributes2 %08x %d\n"), p, attr, GetLastError());
+ }
+ }
if (time_valid) {
- h = CreateFile (namep, GENERIC_WRITE, 0,
- NULL, OPEN_EXISTING, dirflag, NULL);
+ h = CreateFile(namep, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, itemflag, NULL);
if (h != INVALID_HANDLE_VALUE) {
- SetFileTime (h, &t1, &t2, &t3);
- CloseHandle (h);
+ if (!SetFileTime(h, &t1, &t2, &t3)) {
+ write_log(_T("'%s' SetFileTime %d\n"), namep, GetLastError());
+ }
+ CloseHandle(h);
}
}
- xfree (p);
+ xfree(p);
return ret;
}
+Beta 5:
+
+Some more or less edge-case cpu tester detected fixes:
+
+- 68020 and 68030 unexpected difference found: RTE causing format error with trace set (T0, T1 or both). 68020: format error stacked SR has trace bits unmodified (expected behavior). 68030: stacked SR has trace bits cleared! (Stacked SR equals current SR at the beginning of format exception handler) Very useless difference. 68040/68060 works like 68020.
+- 68040 and 68060: instruction that can generate exception internally (CHK, CHK2, DIV, TRAPx) and if trace is active: trace is not generated after execution continues from address pointed by exception vector. All previous CPU models generate trace exception in this situation.
+- 68040 T0 trace + MOVEC: only MOVEC to control register triggers T0 trace. (Documentation only lists "MOVEC")
+- 68040/68060 + cpRESTORE/cpSAVE (=FSAVE/FRESTORE with co-pro ID!=1) will always generate F-line exception. Probably because external co-pro interface was removed in 68040. 68020-68030 will generate privilege violation if not in supervisor mode.
+- 68040 RTR and RTE with odd return address in stack: address error stacked SR contains contents before RTR/RTE SR modifications. SR register contents when address error exception starts has correct contents.
+- 68060 RTR odd return address: CCR is loaded first, then address exception is generated. Previous models: CCR is not modified.
+- 68060 RTE odd return address: SR is not updated, CCR part is cleared. Z is set if new SR would have been zero, N is set if new SR would have had bit 15 set.
+- 68040/68060 seems to halt if trace (probably any exception) is being processed but exception vector is odd. 68000-68030 will generate address error without halting.
+
+- UAE: 68020+ MOVE to CCR triggered T0 trace but it only should be done if MOVE to SR (which does pipeline refill which triggeres T0 trace)
+- UAE: 68020+ and trace exception with odd trace exception vector (which will generate address error): SR trace bits were not cleared when address error started.
+- UAE: 68040+ BSR/JSR address error stacked address field was incorrect.
+- UAE: 68020+ MOVE to SR, EOR SR, OR SR enabled trace: following trace exception stack frame PC field in stack was wrong.
+
+- b3 "When ejecting directory filesystem that points to plain file or archive, not all host file handles were closed properly." caused problems when opening archive files.
+- ROM scanner now prefer roms that have matching size (overdumps and a1000 ks disks have lower priority) and are not in archive (was already done previously).
+- Debugger assembler didn't support instructions that modify address register but mnemonic does not end to 'A'. (for example EXG x,An)
+- Debugger fa and s commands skipped chip ram.
+- FPU default is back to 64-bit. Very few programs requires 80-bit, it isn't worth the speed loss.
+- Optional (config file only) halt if BKPT instruction is executed. Some accelerator boards hang when it is executed because they don't generate required acknowledge cycle.
+
Beta 4:
- 68010 address errors fixed. Most read and write bus errors tested and fixed.