From b085d3eeaaf94612ca2257ecc69675880953d15a Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 18 Jan 2015 15:03:16 +0200 Subject: [PATCH] 3100b4 --- audio.cpp | 2 + cfgfile.cpp | 2 +- expansion.cpp | 17 ++- ide.cpp | 3 + include/blkdev.h | 1 + include/options.h | 2 + include/uae.h | 3 - od-win32/fsdb_mywin32.cpp | 2 +- od-win32/mman.cpp | 13 ++- od-win32/win32.h | 4 +- od-win32/win32gui.cpp | 1 + od-win32/winuae_msvc11/winuae_msvc.vcxproj | 1 + .../winuae_msvc11/winuae_msvc.vcxproj.filters | 3 + od-win32/winuaechangelog.txt | 29 +++++ savestate.cpp | 10 +- specialmonitors.cpp | 110 ++++++++++++++++-- 16 files changed, 167 insertions(+), 36 deletions(-) diff --git a/audio.cpp b/audio.cpp index 1d9bc545..a825ce0c 100644 --- a/audio.cpp +++ b/audio.cpp @@ -1936,6 +1936,8 @@ void audio_evhandler (void) void audio_hsync (void) { + if (!currprefs.produce_sound) + return; if (!isaudio ()) return; if (audio_work_to_do > 0 && currprefs.sound_auto && !audio_extra_channels[0] && !audio_extra_channels[1] diff --git a/cfgfile.cpp b/cfgfile.cpp index f994480e..71da082f 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -196,7 +196,7 @@ static const TCHAR *dongles[] = }; static const TCHAR *cdmodes[] = { _T("disabled"), _T(""), _T("image"), _T("ioctl"), _T("spti"), _T("aspi"), 0 }; static const TCHAR *cdconmodes[] = { _T(""), _T("uae"), _T("ide"), _T("scsi"), _T("cdtv"), _T("cd32"), 0 }; -static const TCHAR *specialmonitors[] = { _T("none"), _T("autodetect"), _T("a2024"), _T("graffiti"), _T("ham_e"), 0 }; +static const TCHAR *specialmonitors[] = { _T("none"), _T("autodetect"), _T("a2024"), _T("graffiti"), _T("ham_e"), _T("dctv"), 0 }; static const TCHAR *rtgtype[] = { _T("ZorroII"), _T("ZorroIII"), _T("PicassoII"), diff --git a/expansion.cpp b/expansion.cpp index ca067dd3..7954150c 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -1183,7 +1183,10 @@ static addrbank* expamem_init_filesys (void) uae_u8 diagarea[] = { 0x90, 0x00, /* da_Config, da_Flags */ 0x02, 0x00, /* da_Size */ FILESYS_DIAGPOINT >> 8, FILESYS_DIAGPOINT & 0xff, - FILESYS_BOOTPOINT >> 8, FILESYS_BOOTPOINT & 0xff + FILESYS_BOOTPOINT >> 8, FILESYS_BOOTPOINT & 0xff, + 0, 14, // Name offset + 0, 0, 0, 0, + 'U', 'A', 'E', 0 }; expamem_init_clear (); @@ -1536,7 +1539,8 @@ static void allocate_expamem (void) #ifdef PICASSO96 if (gfxmem_bank.allocated != currprefs.rtgmem_size) { mapped_free (&gfxmem_bank); - mapped_malloc_dynamic (&currprefs.rtgmem_size, &changed_prefs.rtgmem_size, &gfxmem_bank, 1, currprefs.rtgmem_type ? _T("z3_gfx") : _T("z2_gfx")); + if (currprefs.rtgmem_type < GFXBOARD_HARDWARE) + mapped_malloc_dynamic (&currprefs.rtgmem_size, &changed_prefs.rtgmem_size, &gfxmem_bank, 1, currprefs.rtgmem_type ? _T("z3_gfx") : _T("z2_gfx")); memory_hardreset (1); } #endif @@ -1545,8 +1549,12 @@ static void allocate_expamem (void) if (savestate_state == STATE_RESTORE) { if (fastmem_bank.allocated > 0) { restore_ram (fast_filepos, fastmem_bank.baseaddr); + if (!fastmem_bank.start) { + // old statefile compatibility support + fastmem_bank.start = 0x00200000; + } map_banks (&fastmem_bank, fastmem_bank.start >> 16, currprefs.fastmem_size >> 16, - fastmem_bank.allocated); + fastmem_bank.allocated); } if (fastmem2_bank.allocated > 0) { restore_ram (fast2_filepos, fastmem2_bank.baseaddr); @@ -2074,7 +2082,8 @@ void expansion_cleanup (void) mapped_free (&z3chipmem_bank); #ifdef PICASSO96 - mapped_free (&gfxmem_bank); + if (currprefs.rtgmem_type < GFXBOARD_HARDWARE) + mapped_free (&gfxmem_bank); #endif #ifdef FILESYS diff --git a/ide.cpp b/ide.cpp index d323d9d0..79509fe3 100644 --- a/ide.cpp +++ b/ide.cpp @@ -1110,10 +1110,13 @@ void remove_ide_unit(struct ide_hdf **idetable, int ch) return; ide = idetable[ch]; if (ide) { + struct ide_thread_state *its; hdf_hd_close(&ide->hdhfd); scsi_free(ide->scsi); xfree(ide->secbuf); + its = ide->its; memset(ide, 0, sizeof(struct ide_hdf)); + ide->its = its; } } diff --git a/include/blkdev.h b/include/blkdev.h index 1e416afd..0a17b79f 100644 --- a/include/blkdev.h +++ b/include/blkdev.h @@ -192,6 +192,7 @@ extern int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len, uae_u8 *scsi_data, int *data_len, uae_u8 *r, int *reply_len, uae_u8 *s, int *sense_len, bool atapi); extern void blkdev_vsync (void); +extern void restore_blkdev_start(void); extern int msf2lsn (int msf); extern int lsn2msf (int lsn); diff --git a/include/options.h b/include/options.h index abb37c01..fc9a30e0 100644 --- a/include/options.h +++ b/include/options.h @@ -108,6 +108,7 @@ struct cdslot TCHAR name[MAX_DPATH]; bool inuse; bool delayed; + bool temporary; int type; }; struct floppyslot @@ -205,6 +206,7 @@ enum { CP_GENERIC = 1, CP_CDTV, CP_CDTVCR, CP_CD32, CP_A500, CP_A500P, CP_A600, #define MONITOREMU_A2024 2 #define MONITOREMU_GRAFFITI 3 #define MONITOREMU_HAM_E 4 +#define MONITOREMU_DCTV 5 #define MAX_FILTERSHADERS 4 diff --git a/include/uae.h b/include/uae.h index bd84f9d5..1c5d65e6 100644 --- a/include/uae.h +++ b/include/uae.h @@ -7,11 +7,9 @@ */ extern void do_start_program (void); -extern void do_leave_program (void); extern void start_program (void); extern void leave_program (void); extern void real_main (int, TCHAR **); -extern void virtualdevice_init (void); extern void usage (void); extern void sleep_millis (int ms); extern void sleep_millis_main (int ms); @@ -26,7 +24,6 @@ extern int sleep_resolution; extern void uae_reset (int, int); extern void uae_quit (void); extern void uae_restart (int, const TCHAR*); -extern void reset_all_systems (void); extern void target_reset (void); extern void target_addtorecent (const TCHAR*, int); extern void target_run (void); diff --git a/od-win32/fsdb_mywin32.cpp b/od-win32/fsdb_mywin32.cpp index 7bddfef6..d36f2fe7 100644 --- a/od-win32/fsdb_mywin32.cpp +++ b/od-win32/fsdb_mywin32.cpp @@ -1031,5 +1031,5 @@ const TCHAR *my_getfilepart(const TCHAR *filename) p = _tcsrchr(filename, '/'); if (p) return p + 1; - return p; + return filename; } \ No newline at end of file diff --git a/od-win32/mman.cpp b/od-win32/mman.cpp index db98ad05..b660ff90 100644 --- a/od-win32/mman.cpp +++ b/od-win32/mman.cpp @@ -432,13 +432,13 @@ static int doinit_shm (void) return canbang; } +static uae_u32 oz3fastmem_size, oz3fastmem2_size; +static uae_u32 oz3chipmem_size; +static uae_u32 ortgmem_size; +static int ortgmem_type = -1; + bool init_shm (void) { - static uae_u32 oz3fastmem_size, oz3fastmem2_size; - static uae_u32 oz3chipmem_size; - static uae_u32 ortgmem_size; - static int ortgmem_type; - if ( oz3fastmem_size == changed_prefs.z3fastmem_size && oz3fastmem2_size == changed_prefs.z3fastmem2_size && @@ -466,6 +466,7 @@ void free_shm (void) { resetmem (true); clear_shm (); + ortgmem_type = -1; } void mapped_free (addrbank *ab) @@ -502,8 +503,8 @@ void mapped_free (addrbank *ab) if (!(ab->flags & ABFLAG_DIRECTMAP)) { if (!(ab->flags & ABFLAG_NOALLOC)) { xfree(ab->baseaddr); - ab->baseaddr = NULL; } + ab->baseaddr = NULL; write_log(_T("mapped_free nondirect %s\n"), ab->name); return; } diff --git a/od-win32/win32.h b/od-win32/win32.h index 80855143..4dcad6ad 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -20,12 +20,12 @@ #define LANG_DLL_FULL_VERSION_MATCH 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("3") +#define WINUAEBETA _T("4") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2015, 1, 11) +#define WINUAEDATE MAKEBD(2015, 1, 18) //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 83af888a..dd6f068c 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -7165,6 +7165,7 @@ static INT_PTR CALLBACK ChipsetDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessage (hDlg, IDC_MONITOREMU, CB_ADDSTRING, 0, (LPARAM)_T("A2024")); SendDlgItemMessage (hDlg, IDC_MONITOREMU, CB_ADDSTRING, 0, (LPARAM)_T("Graffiti")); SendDlgItemMessage (hDlg, IDC_MONITOREMU, CB_ADDSTRING, 0, (LPARAM)_T("HAM-E")); + //SendDlgItemMessage (hDlg, IDC_MONITOREMU, CB_ADDSTRING, 0, (LPARAM)_T("DCTV")); #ifndef AGA ew (hDlg, IDC_AGA, FALSE); diff --git a/od-win32/winuae_msvc11/winuae_msvc.vcxproj b/od-win32/winuae_msvc11/winuae_msvc.vcxproj index 3086bd34..836b0c4e 100644 --- a/od-win32/winuae_msvc11/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc11/winuae_msvc.vcxproj @@ -805,6 +805,7 @@ + diff --git a/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters b/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters index 0e20e6c6..142b5933 100644 --- a/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters +++ b/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters @@ -727,6 +727,9 @@ common + + common + diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 48f4eb82..5cd865dd 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,33 @@ + +Beta 4: + +- HAM-E images updated only every other line in doubled modes. +- Graffiti didn't sync correctly if config was not AGA. +- Restart button crashed if hardware RTG was enabled. +- PCMCIA IDE didn't work anymore (b2) +- .pkd file extension inside archive wasn't autodetected. +- Disk/CD insert status message file name was shown as "null" if file was inside archive root. +- HD and tape SCSI emulation unsupported LUN sense data was overwritten with default ILLEGAL FIELD IN CDB sense data. +- CD SCSI emulator didn't check for non-zero LUNs. +- Return SCSI-1 HD inquiry data only if A590/A2091. +- Show also REQUEST SENSE command and data if scsi emulation logging is enabled. +- 68000 prefetch mode DIVS/DIVU timing update didn't work, always returned 4 cycles due to missing parenthesis. +- Switching chip ram and/or slow ram size usually crashed after reset if ECS Agnus was selected. +- Some very old statefiles had Z2 fast ram with zeroed autoconfig address, added workaround (broke during 2.9 betas) +- Added fl or fl and fc break points to debugger. +- Z3 space memory mapping was not initialized if only non-RAM/VRAM Z3 expansions are configured. +- Clock sync feature update, previously only 50Hz CIA-A TOD rate was fully accurate. +- Load CDTV/CD32 state file, load other state file: CDTV/CD32 CD was still mounted. +- Yet another bitplane DMA sequencer emulation rewrite and cleanups. Still some bitplane DMA on/off switch edge cases remaining + Switch on bitplane DMA near end the scanline: following line starts DMA for one "block" only, next line works normally. + This needs more real hardware testing to find exact conditions. +- Source cleanup, moved all kinds of device init/free/interrupt check codes to common file from non-related source + files. +- Added name to UAE Boot ROM DiagArea. (May be visible in some system info/diagnostics software) +- HALT status was not cleared when loading new state file. + + Beta 3: - Bitplane DMA sequencer emulation rewritten yet again to again match better with real hardware behavior. diff --git a/savestate.cpp b/savestate.cpp index fe283ce0..b6bd33f4 100644 --- a/savestate.cpp +++ b/savestate.cpp @@ -65,6 +65,7 @@ #include "disk.h" #include "threaddep/thread.h" #include "a2091.h" +#include "devices.h" int savestate_state = 0; static int savestate_first_capture; @@ -520,14 +521,7 @@ void restore_state (const TCHAR *filename) savestate_file = f; restore_header (chunk); xfree (chunk); - restore_cia_start (); - changed_prefs.bogomem_size = 0; - changed_prefs.chipmem_size = 0; - changed_prefs.fastmem_size = 0; - changed_prefs.z3fastmem_size = 0; - changed_prefs.z3fastmem2_size = 0; - changed_prefs.mbresmem_low_size = 0; - changed_prefs.mbresmem_high_size = 0; + devices_restore_start(); z3num = 0; for (;;) { name[0] = 0; diff --git a/specialmonitors.cpp b/specialmonitors.cpp index c9398e42..4f9f5ebb 100755 --- a/specialmonitors.cpp +++ b/specialmonitors.cpp @@ -12,6 +12,7 @@ static bool automatic; static int monitor; extern unsigned int bplcon0; +extern int interlace_seen; static uae_u8 graffiti_palette[256 * 4]; @@ -93,11 +94,65 @@ static void clearmonitor(struct vidbuffer *dst) } } +static bool dctv(struct vidbuffer *src, struct vidbuffer *dst, bool doublelines, int oddlines) +{ + int y, x, vdbl, hdbl; + int ystart, yend, isntsc; + int xadd; + + isntsc = (beamcon0 & 0x20) ? 0 : 1; + if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + isntsc = currprefs.ntscmode ? 1 : 0; + + vdbl = gfxvidinfo.ychange; + hdbl = gfxvidinfo.xchange; + + xadd = ((1 << 1) / hdbl) * src->pixbytes; + + ystart = isntsc ? VBLANK_ENDLINE_NTSC : VBLANK_ENDLINE_PAL; + yend = isntsc ? MAXVPOS_NTSC : MAXVPOS_PAL; + + oddlines = 1; + + uae_u8 r, g, b; + for (y = ystart; y < yend; y += 2) { + int yoff = (((y * 2 + oddlines) - src->yoffset) / vdbl); + if (yoff < 0) + continue; + if (yoff >= src->inheight) + continue; + uae_u8 *line = src->bufmem + yoff * src->rowbytes; + uae_u8 *dstline = dst->bufmem + (((y * 2 + oddlines) - dst->yoffset) / vdbl) * dst->rowbytes; + + for (x = 1; x < src->inwidth; x += 2) { + uae_u8 *s = line + ((x << 1) / hdbl) * src->pixbytes; + uae_u8 *d = dstline + ((x << 1) / hdbl) * dst->pixbytes; + uae_u8 *s2 = s + src->rowbytes; + uae_u8 *d2 = d + dst->rowbytes; + uae_u8 newval = FIRGB(src, s); + + r = newval << 4; + g = newval << 4; + b = newval << 4; + + PRGB(dst, d, r, g, b); + PRGB(dst, d + dst->pixbytes, r, g, b); + PRGB(dst, d + dst->rowbytes, r, g, b); + PRGB(dst, d + dst->rowbytes + dst->pixbytes, r, g, b); + + + } + } + dst->nativepositioning = true; + return true; +} + + static const uae_u8 ham_e_magic_cookie[] = { 0xa2, 0xf5, 0x84, 0xdc, 0x6d, 0xb0, 0x7f }; static const uae_u8 ham_e_magic_cookie_reg = 0x14; static const uae_u8 ham_e_magic_cookie_ham = 0x18; -static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst) +static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst, bool doublelines, int oddlines) { int y, x, vdbl, hdbl; int ystart, yend, isntsc; @@ -124,13 +179,13 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst) bool cookie_line = false; int cookiestartx = 10000; for (y = ystart; y < yend; y++) { - int yoff = (((y << VRES_MAX) - src->yoffset) / vdbl); + int yoff = (((y * 2 + oddlines) - src->yoffset) / vdbl); if (yoff < 0) continue; if (yoff >= src->inheight) continue; uae_u8 *line = src->bufmem + yoff * src->rowbytes; - uae_u8 *dstline = dst->bufmem + (((y << VRES_MAX) - dst->yoffset) / vdbl) * dst->rowbytes; + uae_u8 *dstline = dst->bufmem + (((y * 2 + oddlines) - dst->yoffset) / vdbl) * dst->rowbytes; bool getpalette = false; uae_u8 prev = 0; @@ -139,9 +194,14 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst) for (x = 0; x < src->inwidth; x++) { uae_u8 *s = line + ((x << 1) / hdbl) * src->pixbytes; uae_u8 *d = dstline + ((x << 1) / hdbl) * dst->pixbytes; - - uae_u8 val = prev | FIRGB(src, s); - if (val == ham_e_magic_cookie[0]) { + uae_u8 *s2 = s + src->rowbytes; + uae_u8 *d2 = d + dst->rowbytes; + uae_u8 newval = FIRGB(src, s); + uae_u8 val = prev | newval; + + if (newval) + zeroline = false; + if (val == ham_e_magic_cookie[0] && x + sizeof ham_e_magic_cookie + 1 < src->inwidth) { int i; for (i = 1; i <= sizeof ham_e_magic_cookie; i++) { uae_u8 val2 = (FIRGB(src, s + (i * 2 - 1) * xadd) << 4) | FIRGB(src, s + (i * 2 + 0) * xadd); @@ -166,8 +226,6 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst) oddeven = 0; if (oddeven) { - if (val) - zeroline = false; if (getpalette) { graffiti_palette[pcnt] = val; pcnt++; @@ -208,6 +266,10 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst) } PRGB(dst, d - dst->pixbytes, r, g, b); PRGB(dst, d, r, g, b); + if (doublelines) { + PRGB(dst, d2 - dst->pixbytes, r, g, b); + PRGB(dst, d2, r, g, b); + } } else { if (dst->pixbytes == 4) { ((uae_u32*)d)[-1] = ((uae_u32*)s)[-1]; @@ -216,6 +278,15 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst) ((uae_u16*)d)[-1] = ((uae_u16*)s)[-1]; ((uae_u16*)d)[0] = ((uae_u16*)s)[0]; } + if (doublelines) { + if (dst->pixbytes == 4) { + ((uae_u32*)d2)[-1] = ((uae_u32*)s2)[-1]; + ((uae_u32*)d2)[0] = ((uae_u32*)s2)[0]; + } else { + ((uae_u16*)d2)[-1] = ((uae_u16*)s2)[-1]; + ((uae_u16*)d2)[0] = ((uae_u16*)s2)[0]; + } + } } } @@ -227,6 +298,8 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst) // Erase magic cookie. I assume real HAM-E would erase it // because not erasing it would look really ugly. memset(dstline, 0, dst->outwidth * dst->pixbytes); + if (doublelines) + memset(dstline + dst->rowbytes, 0, dst->outwidth * dst->pixbytes); } cookie_line = false; @@ -234,8 +307,9 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst) was_active = mode_active; if (zeroline) { if (prevzeroline) { - mode_active = false; + mode_active = 0; pcnt = 0; + cookiestartx = 10000; } prevzeroline = true; } else { @@ -288,6 +362,10 @@ static bool graffiti(struct vidbuffer *src, struct vidbuffer *dst) xstart = 0x1c * 2 + 1; xend = 0xf0 * 2 + 1; + if (!(currprefs.chipset_mask & CSMASK_AGA)) { + xstart++; + xend++; + } srcbuf = src->bufmem + (((ystart << VRES_MAX) - src->yoffset) / gfxvidinfo.ychange) * src->rowbytes + (((xstart << RES_MAX) - src->xoffset) / gfxvidinfo.xchange) * src->pixbytes; srcend = src->bufmem + (((yend << VRES_MAX) - src->yoffset) / gfxvidinfo.ychange) * src->rowbytes; @@ -332,7 +410,7 @@ static bool graffiti(struct vidbuffer *src, struct vidbuffer *dst) command = false; dbl = 1; waitline = 2; - if (cmd & 16) { + if (0 && (cmd & 16)) { hires = true; xadd /= 2; xpixadd /= 2; @@ -619,9 +697,19 @@ static bool emulate_specialmonitors2(struct vidbuffer *src, struct vidbuffer *ds } else if (currprefs.monitoremu == MONITOREMU_GRAFFITI) { automatic = false; return graffiti(src, dst); + } else if (currprefs.monitoremu == MONITOREMU_DCTV) { + automatic = false; + return dctv(src, dst, false, 0); } else if (currprefs.monitoremu == MONITOREMU_HAM_E) { + bool v; automatic = false; - return ham_e(src, dst); + if (interlace_seen) { + v = ham_e(src, dst, false, 0); + v |= ham_e(src, dst, false, 1); + } else { + v = ham_e(src, dst, true, 0); + } + return v; } return false; } -- 2.47.3