From 6131ab11e628ede89d3d5f6d1e6043352b13b339 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Wed, 28 Mar 2012 21:20:07 +0300 Subject: [PATCH] 2400b27 --- custom.cpp | 43 +++++++++------- filesys.cpp | 97 +++++++++++++++++++++++------------- include/fsdb.h | 2 +- main.cpp | 10 +++- od-win32/fsdb_mywin32.cpp | 2 + od-win32/win32.cpp | 12 +++-- od-win32/win32.h | 6 +-- od-win32/win32_scaler.cpp | 6 ++- od-win32/win32gfx.cpp | 6 --- od-win32/winuaechangelog.txt | 11 ++-- 10 files changed, 119 insertions(+), 76 deletions(-) diff --git a/custom.cpp b/custom.cpp index 886f4c83..2010a46d 100644 --- a/custom.cpp +++ b/custom.cpp @@ -1986,22 +1986,6 @@ static void record_color_change (int hpos, int regno, unsigned long value) } } record_color_change2 (hpos, regno, value); - - if (regno == 0 && value != 0 && vpos >= 20) { - // autoscale if COLOR00 changes in top or bottom of screen - if (vpos >= minfirstline) { - int vpos2 = autoscale_bordercolors ? minfirstline : vpos; - if (first_planes_vpos == 0) - first_planes_vpos = vpos2 - 2; - if (plffirstline_total == current_maxvpos ()) - plffirstline_total = vpos2 - 2; - if (vpos2 > last_planes_vpos || vpos2 > plflastline_total) - plflastline_total = last_planes_vpos = vpos2 + 3; - autoscale_bordercolors = 0; - } else { - autoscale_bordercolors++; - } - } } static void record_register_change (int hpos, int regno, uae_u16 value) @@ -4293,6 +4277,7 @@ static uae_u16 COLOR_READ (int num) static void COLOR_WRITE (int hpos, uae_u16 v, int num) { + bool colzero = false; v &= 0xFFF; #ifdef AGA if (currprefs.chipset_mask & CSMASK_AGA) { @@ -4324,8 +4309,11 @@ static void COLOR_WRITE (int hpos, uae_u16 v, int num) color_regs_aga_genlock[colreg] = v >> 15; } cval = (cr << 16) | (cg << 8) | cb; + if (cval && colreg == 0) + colzero = true; + if (cval == current_colors.color_regs_aga[colreg]) - return; + goto end; /* Call this with the old table still intact. */ record_color_change (hpos, colreg, cval); @@ -4334,8 +4322,10 @@ static void COLOR_WRITE (int hpos, uae_u16 v, int num) current_colors.acolors[colreg] = getxcolor (cval); } else { #endif + if (num && v == 0) + colzero = true; if (current_colors.color_regs_ecs[num] == v) - return; + goto end; /* Call this with the old table still intact. */ record_color_change (hpos, num, v); remembered_color_entry = -1; @@ -4344,6 +4334,23 @@ static void COLOR_WRITE (int hpos, uae_u16 v, int num) #ifdef AGA } #endif +end: + if (copper_access && colzero && vpos >= 20) { + // autoscale if copper changes COLOR00 on top or bottom of screen + if (vpos >= minfirstline) { + int vpos2 = autoscale_bordercolors ? minfirstline : vpos; + if (first_planes_vpos == 0) + first_planes_vpos = vpos2 - 2; + if (plffirstline_total == current_maxvpos ()) + plffirstline_total = vpos2 - 2; + if (vpos2 > last_planes_vpos || vpos2 > plflastline_total) + plflastline_total = last_planes_vpos = vpos2 + 3; + autoscale_bordercolors = 0; + } else { + autoscale_bordercolors++; + } + } + } /* The copper code. The biggest nightmare in the whole emulator. diff --git a/filesys.cpp b/filesys.cpp index 50ac2934..55521364 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -56,13 +56,18 @@ #include "isofs_api.h" #define TRACING_ENABLED 0 -#define TRACE2(x) do { write_log x; } while(0) #if TRACING_ENABLED #define TRACE(x) do { write_log x; } while(0) #define DUMPLOCK(u,x) dumplock(u,x) +#if TRACING_ENABLED > 1 +#define TRACE2(x) do { write_log x; } while(0) +#else +#define TRACE2(x) +#endif #else #define TRACE(x) #define DUMPLOCK(u,x) +#define TRACE2(x) #endif static uae_sem_t test_sem; @@ -1682,7 +1687,7 @@ static void recycle_aino (Unit *unit, a_inode *new_aino) /* Still in use */ return; - TRACE ((L"Recycling; cache size %d, total_locked %d\n", + TRACE2((L"Recycling; cache size %d, total_locked %d\n", unit->aino_cache_size, unit->total_locked_ainos)); if (unit->aino_cache_size > 5000 + unit->total_locked_ainos) { /* Reap a few. */ @@ -3775,7 +3780,7 @@ static void populate_directory (Unit *unit, a_inode *base) base->locked_children++; unit->total_locked_ainos++; } - TRACE((L"Populating directory, child %p, locked_children %d\n", + TRACE2((L"Populating directory, child %p, locked_children %d\n", base->child, base->locked_children)); for (;;) { uae_u64 uniq = 0; @@ -4144,7 +4149,7 @@ static void Key *k = lookup_key (unit, GET_PCK_ARG1 (packet)); uaecptr addr = GET_PCK_ARG2 (packet); uae_u32 size = GET_PCK_ARG3 (packet); - uae_u32 actual; + uae_u32 actual = 0; if (k == 0) { PUT_PCK_RES1 (packet, DOS_FALSE); @@ -4155,31 +4160,40 @@ static void gui_flicker_led (LED_HD, unit->unit, 1); if (size == 0) { - actual = 0; PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, 0); } else if (!valid_address (addr, size)) { /* check if filesize < size */ - uae_s64 cur, filesize; + uae_s64 filesize, cur; - cur = fs_lseek64 (k->fd, 0, SEEK_CUR); filesize = fs_fsize64 (k->fd); + cur = k->file_pos; if (size > filesize - cur) size = filesize - cur; - if (!valid_address (addr, size)) { + if (size == 0) { + PUT_PCK_RES1 (packet, 0); + PUT_PCK_RES2 (packet, 0); + } else if (!valid_address (addr, size)) { /* it really crosses memory boundary */ uae_u8 *buf; write_log (L"unixfs warning: Bad pointer passed for read: %08x, size %d\n", addr, size); /* ugh this is inefficient but easy */ + if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + PUT_PCK_RES1 (packet, 0); + PUT_PCK_RES2 (packet, dos_errno ()); + return; + } + buf = xmalloc (uae_u8, size); if (!buf) { PUT_PCK_RES1 (packet, -1); PUT_PCK_RES2 (packet, ERROR_NO_FREE_STORE); return; } + actual = fs_read (k->fd, buf, size); if (actual < 0) { @@ -4200,6 +4214,13 @@ static void if (size) { /* normal fast read */ uae_u8 *realpt = get_real_address (addr); + + if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + PUT_PCK_RES1 (packet, 0); + PUT_PCK_RES2 (packet, dos_errno ()); + return; + } + actual = fs_read (k->fd, realpt, size); if (actual == 0) { @@ -4249,10 +4270,24 @@ static void PUT_PCK_RES2 (packet, 0); } else if (valid_address (addr, size)) { uae_u8 *realpt = get_real_address (addr); + + if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + PUT_PCK_RES1 (packet, 0); + PUT_PCK_RES2 (packet, dos_errno ()); + return; + } + actual = fs_write (k->fd, realpt, size); } else { write_log (L"unixfs warning: Bad pointer passed for write: %08x, size %d\n", addr, size); /* ugh this is inefficient but easy */ + + if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + PUT_PCK_RES1 (packet, 0); + PUT_PCK_RES2 (packet, dos_errno ()); + return; + } + buf = xmalloc (uae_u8, size); if (!buf) { PUT_PCK_RES1 (packet, -1); @@ -4286,6 +4321,7 @@ static void uae_s64 res; uae_s64 cur; int whence = SEEK_CUR; + uae_s64 temppos, filesize; if (k == 0) { PUT_PCK_RES1 (packet, -1); @@ -4298,38 +4334,32 @@ static void if (mode < 0) whence = SEEK_SET; - cur = fs_lseek (k->fd, 0, SEEK_CUR); - TRACE((L"ACTION_SEEK(%s,%d,%d)=%d\n", k->aino->nname, pos, mode, old)); + cur = k->file_pos; + TRACE((L"ACTION_SEEK(%s,%d,%d)=%d\n", k->aino->nname, pos, mode, cur)); gui_flicker_led (LED_HD, unit->unit, 1); - { - uae_s64 temppos; - uae_s64 filesize = fs_fsize64 (k->fd); - - if (whence == SEEK_CUR) - temppos = cur + pos; - if (whence == SEEK_SET) - temppos = pos; - if (whence == SEEK_END) - temppos = filesize + pos; - if (filesize < temppos) { - res = -1; - PUT_PCK_RES1 (packet, res); - PUT_PCK_RES2 (packet, ERROR_SEEK_ERROR); - return; - } + filesize = fs_fsize64 (k->fd); + if (whence == SEEK_CUR) + temppos = cur + pos; + if (whence == SEEK_SET) + temppos = pos; + if (whence == SEEK_END) + temppos = filesize + pos; + if (filesize < temppos) { + PUT_PCK_RES1 (packet, -1); + PUT_PCK_RES2 (packet, ERROR_SEEK_ERROR); + return; } - res = fs_lseek64 (k->fd, pos, whence); + res = fs_lseek64 (k->fd, pos, whence); if (-1 == res || cur > MAXFILESIZE32) { PUT_PCK_RES1 (packet, -1); PUT_PCK_RES2 (packet, ERROR_SEEK_ERROR); fs_lseek64 (k->fd, cur, SEEK_SET); - res = cur; } else { PUT_PCK_RES1 (packet, cur); + k->file_pos = fs_lseek64 (k->fd, 0, SEEK_CUR); } - k->file_pos = res; } static void @@ -5224,7 +5254,7 @@ static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context) lockend = get_long (lockend); cnt++; } - TRACE((L"message_lock: %d %x %x %x\n", cnt, locks, lockend, m68k_areg (regs, 3))); + TRACE2((L"message_lock: %d %x %x %x\n", cnt, locks, lockend, m68k_areg (regs, 3))); put_long (lockend, get_long (m68k_areg (regs, 3))); put_long (m68k_areg (regs, 3), locks); } @@ -5326,7 +5356,7 @@ static int handle_packet (Unit *unit, dpacket pck, uae_u32 msg) if (unit->cdfs_superblock) write_log(L"unit=%x packet=%d\n", unit, type); #endif -#if TRACING_ENABLED > 0 +#if TRACING_ENABLED > 1 write_log(L"unit=%x packet=%d\n", unit, type); #endif if (unit->inhibited && filesys_isvolume (unit) @@ -7039,7 +7069,7 @@ static int recurse_aino (UnitInfo *ui, a_inode *a, int cnt, uae_u8 **dstp) if (a->elock || a->shlock || a->uniq == 0) { if (dst) { TCHAR *fn; - write_log (L"%04x s=%d e=%d d=%d '%s' '%s'\n", a->uniq, a->shlock, a->elock, a->dir, a->aname, a->nname); + write_log (L"uniq=%d s=%d e=%d d=%d '%s' '%s'\n", a->uniq, a->shlock, a->elock, a->dir, a->aname, a->nname); fn = getfullaname(a); write_log (L"->'%s'\n", fn); save_u64 (a->uniq); @@ -7076,11 +7106,10 @@ static uae_u8 *save_key (uae_u8 *dst, Key *k) size = fs_fsize (k->fd); save_u32 ((uae_u32)size); save_u64 (k->aino->uniq); - fs_lseek (k->fd, k->file_pos, SEEK_SET); save_string (fn); save_u64 (k->file_pos); save_u64 (size); - write_log (L"'%s' uniq=%d size=%d seekpos=%d mode=%d dosmode=%d\n", + write_log (L"'%s' uniq=%d size=%I64d seekpos=%I64d mode=%d dosmode=%d\n", fn, k->uniq, size, k->file_pos, k->createmode, k->dosmode); xfree (fn); return dst; diff --git a/include/fsdb.h b/include/fsdb.h index 33204489..3766b8cb 100644 --- a/include/fsdb.h +++ b/include/fsdb.h @@ -71,7 +71,7 @@ typedef struct a_inode_struct { /* AmigaOS protection bits. */ int amigaos_mode; /* Unique number for identification. */ - uae_u64 uniq; + uae_u32 uniq; /* For a directory that is being ExNext()ed, the number of child ainos which must be kept locked in core. */ unsigned long locked_children; diff --git a/main.cpp b/main.cpp index 7f8298b6..e404e104 100644 --- a/main.cpp +++ b/main.cpp @@ -53,7 +53,9 @@ #include "dongle.h" #include "sampler.h" #include "consolehook.h" - +#ifdef RETROPLATFORM +#include "rp.h" +#endif #ifdef USE_SDL #include "SDL.h" #endif @@ -159,6 +161,8 @@ void fixup_prefs_dimensions (struct uae_prefs *prefs) if (prefs->gfx_filter == 0 && ((prefs->gfx_filter_autoscale && !prefs->gfx_api) || (prefs->gfx_apmode[0].gfx_vsyncmode))) prefs->gfx_filter = 1; + if (prefs->gfx_filter == 0 && prefs->monitoremu) + prefs->gfx_filter = 1; } void fixup_cpu (struct uae_prefs *p) @@ -413,6 +417,7 @@ void fixup_prefs (struct uae_prefs *p) if (p->genlock && p->monitoremu) p->genlock = false; + fixup_prefs_dimensions (p); #if !defined (JIT) @@ -896,6 +901,9 @@ static int real_main2 (int argc, TCHAR **argv) #endif fixup_prefs (&currprefs); +#ifdef RETROPLATFORM + rp_fixup_options (&currprefs); +#endif changed_prefs = currprefs; target_run (); /* force sound settings change */ diff --git a/od-win32/fsdb_mywin32.cpp b/od-win32/fsdb_mywin32.cpp index 756b1419..ca1c5eff 100644 --- a/od-win32/fsdb_mywin32.cpp +++ b/od-win32/fsdb_mywin32.cpp @@ -189,6 +189,8 @@ uae_s64 int my_lseek (struct my_openfile_s *mos, uae_s64 int offset, int whence) old.LowPart = SetFilePointer (mos->h, 0, &old.HighPart, FILE_CURRENT); if (old.LowPart == INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR) return -1; + if (offset == 0 && whence == SEEK_CUR) + return old.QuadPart; li.QuadPart = offset; li.LowPart = SetFilePointer (mos->h, li.LowPart, &li.HighPart, whence == SEEK_SET ? FILE_BEGIN : (whence == SEEK_END ? FILE_END : FILE_CURRENT)); diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 5de956a4..2777876d 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -2813,10 +2813,6 @@ void target_fixup_options (struct uae_prefs *p) p->win32_inactive_pause = p->win32_inactive_nosound = true; nosound = true; } - -#ifdef RETROPLATFORM - rp_fixup_options (p); -#endif } void target_default_options (struct uae_prefs *p, int type) @@ -5073,6 +5069,12 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR if (WIN32_RegisterClasses () && WIN32_InitLibraries ()) { DWORD i; +#ifdef RETROPLATFORM + if (rp_param != NULL) { + if (FAILED (rp_init ())) + goto end; + } +#endif WIN32_HandleRegistryStuff (); write_log (L"Enumerating display devices.. \n"); enumeratedisplays (); @@ -5121,7 +5123,7 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR real_main (argc, argv); } } - +end: closeIPC (globalipc); closeIPC (serialipc); write_disk_history (); diff --git a/od-win32/win32.h b/od-win32/win32.h index 3b207ba2..d322d5ba 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,9 +19,9 @@ #define LANG_DLL 1 //#define WINUAEBETA L"" -#define WINUAEBETA L"Beta 26 (RC4)" -#define WINUAEDATE MAKEBD(2012, 3, 26) -#define WINUAEEXTRA L"RC1" +#define WINUAEBETA L"Beta 27" +#define WINUAEDATE MAKEBD(2012, 3, 28) +#define WINUAEEXTRA L"RC5" //#define WINUAEEXTRA L"AmiKit Preview" #define WINUAEREV L"" diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index c7c443c7..ccd1becb 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -18,6 +18,8 @@ #include +#define AUTORESIZE_FRAME_DELAY 10 + struct uae_filter uaefilters[] = { { UAE_FILTER_NULL, 0, 1, L"Null filter", L"null", UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32 }, @@ -793,7 +795,7 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height lastresize--; if (lastresize > 0) { if (cw != lcw || ch != lch || cx != lcx || cy != lcy) - lastresize = 10; + lastresize = AUTORESIZE_FRAME_DELAY; useold = 1; } else if (lastdelay == 0) { lastdelay = 2; @@ -821,7 +823,7 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height och = ch; ocx = cx; ocy = cy; - lastresize = 10; + lastresize = AUTORESIZE_FRAME_DELAY; lastdelay = 0; } double scalex = currprefs.gfx_filter_horiz_zoom_mult > 0 ? 1000.0 / currprefs.gfx_filter_horiz_zoom_mult : 1.0; diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index e508f0aa..bfe53d1e 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -2067,12 +2067,6 @@ int machdep_init (void) memset (currentmode, 0, sizeof (*currentmode)); #ifdef LOGITECHLCD lcd_open (); -#endif -#ifdef RETROPLATFORM - if (rp_param != NULL) { - if (FAILED (rp_init ())) - return 0; - } #endif systray (hHiddenWnd, FALSE); return 1; diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index a90c40fc..dde16d88 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,12 +1,11 @@ -- cpu throttling -- custom event autofire -- cycle exact mode scanline sync -- restore only single input target to default. +Beta 27: (RC5) +- Saving directory filesystem statefile crashed (b23) +- "unixfs warning" optimization fix, ACTION_READ when file seek position was at the end + file returned bad result. (b23) - -Beta 25: (RC4) +Beta 26: (RC4) - CDFS missing features added: HighCyl value and volume creation timestamp. I think all features are now done. -- 2.47.3