From 62b7198dfbedc68de5645687f848cc05811cef26 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 4 Dec 2009 19:57:50 +0200 Subject: [PATCH] imported winuaesrc2000b24.zip --- archivers/dms/pfile.c | 34 ++++++++++++++++++++++- blitter.c | 19 ++++++++----- cia.c | 52 ++++++++++++++++++------------------ custom.c | 21 ++++++++++----- gencpu.c | 2 +- od-win32/avioutput.c | 9 ++++--- od-win32/direct3d.c | 6 ++--- od-win32/win32.c | 2 +- od-win32/win32.h | 7 ++--- od-win32/winuaechangelog.txt | 14 ++++++++++ 10 files changed, 115 insertions(+), 51 deletions(-) diff --git a/archivers/dms/pfile.c b/archivers/dms/pfile.c index 5641c3f5..bf952423 100644 --- a/archivers/dms/pfile.c +++ b/archivers/dms/pfile.c @@ -220,7 +220,37 @@ USHORT DMS_Process_File(struct zfile *fi, struct zfile *fo, USHORT cmd, USHORT o ret = Process_Track(fi,NULL,b1,b2,cmd,opt,(geninfo & 2)); else { zfile_fseek (fo, from * 512 * 22, SEEK_SET); - while ( (ret=Process_Track(fi,fo,b1,b2,cmd,opt,(geninfo & 2))) == NO_PROBLEM ) ; + for (;;) { + int ok = 0; + ret = Process_Track(fi,fo,b1,b2,cmd,opt,(geninfo & 2)); + if (ret == DMS_FILE_END) + break; + if (ret == NO_PROBLEM) + continue; + break; +#if 0 + while (!ok) { + uae_u8 b1[THLEN]; + + if (zfile_fread(b1,1,THLEN,fi) != 1) { + write_log (L"DMS: unexpected end of file\n"); + break; + } + write_log (L"DMS: corrupted track, searching for next track header..\n"); + if (b1[0] == 'T' && b1[1] == 'R') { + USHORT hcrc = (USHORT)((b1[THLEN-2] << 8) | b1[THLEN-1]); + if (CreateCRC(b1,(ULONG)(THLEN-2)) == hcrc) { + write_log (L"DMS: found checksum correct track header, retrying..\n"); + zfile_fseek (fi, SEEK_CUR, -THLEN); + ok = 1; + break; + } + } + if (!ok) + zfile_fseek (fi, SEEK_CUR, -(THLEN - 1)); + } +#endif + } } } @@ -277,6 +307,8 @@ static USHORT Process_Track(struct zfile *fi, struct zfile *fo, UCHAR *b1, UCHAR usum = (USHORT)((b1[14] << 8) | b1[15]); /* Track Data CheckSum AFTER unpacking */ dcrc = (USHORT)((b1[16] << 8) | b1[17]); /* Track Data CRC BEFORE unpacking */ + //write_log (L"DMS: track=%d\n", number); + if (cmd == CMD_VIEWFULL) { if (number==80) write_log (L" FileID "); diff --git a/blitter.c b/blitter.c index a735665d..af1c2a71 100644 --- a/blitter.c +++ b/blitter.c @@ -973,7 +973,7 @@ void decide_blitter (int hpos) if (blit_startcycles > 0) do_startcycles (hpos); - if (bltstate == BLT_done || blit_frozen) + if (bltstate == BLT_done) return; #ifdef BLITTER_DEBUG if (blitter_delayed_debug) { @@ -1016,6 +1016,11 @@ void decide_blitter (int hpos) break; } + if (blit_frozen) { + blit_misscyclecounter++; + break; + } + if (c == 0) { blt_info.got_cycle = 1; blit_cyclecounter++; @@ -1121,7 +1126,7 @@ static void blit_bltset (int con) blit_ch = (bltcon0 & 0x0f00) >> 8; blitline = bltcon1 & 1; - blitfill = bltcon1 & 0x18; + blitfill = !!(bltcon1 & 0x18); if (blitline) { if (hblitsize != 2) @@ -1131,7 +1136,7 @@ static void blit_bltset (int con) } else { if (con & 2) { blitfc = !!(bltcon1 & 0x4); - blitife = bltcon1 & 0x8; + blitife = !!(bltcon1 & 0x8); if ((bltcon1 & 0x18) == 0x18) { debugtest (DEBUGTEST_BLITTER, L"weird fill mode\n"); blitife = 0; @@ -1154,11 +1159,13 @@ static void blit_bltset (int con) int iseo = olddiag >= &blit_cycle_diagram_fill[0][0] && olddiag <= &blit_cycle_diagram_fill[15][0]; if (iseo != isen) { if (freezes > 0) { - write_log (L"BLITTER: on the fly %d (%d) -> %d (%d) switch!\n", original_ch, iseo, blit_ch, isen); + write_log (L"BLITTER: on the fly %d (%d) -> %d (%d) switch! PC=%08x\n", original_ch, iseo, blit_ch, isen, M68K_GETPC); freezes--; } } - if (iseo && !isen) { + if (original_fill == isen) { + blit_frozen = 0; // switched back to original fill mode? unfreeze + } else if (iseo && !isen) { blit_frozen = 1; } else if (!iseo && isen) { #ifdef BLITTER_DEBUG_NOWAIT @@ -1176,7 +1183,7 @@ static void blit_bltset (int con) if (o != n) { if (changetable[o * 32 + n] < 10) { changetable[o * 32 + n]++; - write_log (L"BLITTER: channel mode changed while active (%02X->%02X)\n", o, n); + write_log (L"BLITTER: channel mode changed while active (%02X->%02X) PC=%08x\n", o, n, M68K_GETPC); } } if (blit_ch == 13 && original_ch == 1) { diff --git a/cia.c b/cia.c index e2039387..6948b33b 100644 --- a/cia.c +++ b/cia.c @@ -38,11 +38,11 @@ #include "ersatz.h" #include "dongle.h" -//#define CIAA_DEBUG_R -//#define CIAA_DEBUG_W -//#define CIAB_DEBUG_R -//#define CIAB_DEBUG_W -//#define DONGLE_DEBUG +#define CIAA_DEBUG_R 0 +#define CIAA_DEBUG_W 0 +#define CIAB_DEBUG_R 0 +#define CIAB_DEBUG_W 0 +#define DONGLE_DEBUG 0 #define TOD_HACK @@ -603,7 +603,7 @@ static uae_u8 ReadCIAA (unsigned int addr) compute_passed_time (); -#ifdef CIAA_DEBUG_R +#if CIAA_DEBUG_R > 0 write_log (L"R_CIAA: bfe%x01 %08X\n", reg, M68K_GETPC); #endif @@ -620,7 +620,7 @@ static uae_u8 ReadCIAA (unsigned int addr) if (ciaadra & 0x80) tmp = (tmp & ~0x80) | (ciaapra & 0x80); tmp = dongle_cia_read (0, reg, tmp); -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom()) write_log (L"BFE001 R %02X %s\n", tmp, debuginfo(0)); #endif @@ -642,7 +642,7 @@ static uae_u8 ReadCIAA (unsigned int addr) { tmp = handle_parport_joystick (0, ciaaprb, ciaadrb); tmp = dongle_cia_read (1, reg, tmp); -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom()) write_log (L"BFE101 R %02X %s\n", tmp, debuginfo(0)); #endif @@ -663,13 +663,13 @@ static uae_u8 ReadCIAA (unsigned int addr) } return tmp; case 2: -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFE201 R %02X %s\n", ciaadra, debuginfo(0)); #endif return ciaadra; case 3: -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFE301 R %02X %s\n", ciaadrb, debuginfo(0)); #endif @@ -721,8 +721,8 @@ static uae_u8 ReadCIAB (unsigned int addr) unsigned int tmp; int reg = addr & 15; -#ifdef CIAB_DEBUG_R - if (addr >= 8 && addr <= 10) +#if CIAB_DEBUG_R > 0 + if ((addr >= 8 && addr <= 10) || CIAB_DEBUG_R > 1) write_log (L"R_CIAB: bfd%x00 %08X\n", reg, M68K_GETPC); #endif @@ -747,13 +747,13 @@ static uae_u8 ReadCIAB (unsigned int addr) } #endif tmp = dongle_cia_read (1, reg, tmp); -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFD000 R %02X %s\n", tmp, debuginfo(0)); #endif return tmp; case 1: -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFD100 R %02X %s\n", ciabprb, debuginfo(0)); #endif @@ -822,7 +822,7 @@ static void WriteCIAA (uae_u16 addr, uae_u8 val) { int reg = addr & 15; -#ifdef CIAA_DEBUG_W +#if CIAA_DEBUG_W > 0 write_log (L"W_CIAA: bfe%x01 %02X %08X\n", reg, val, M68K_GETPC); #endif #ifdef ACTION_REPLAY @@ -834,7 +834,7 @@ static void WriteCIAA (uae_u16 addr, uae_u8 val) } switch (reg) { case 0: -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFE001 W %02X %s\n", val, debuginfo(0)); #endif @@ -848,7 +848,7 @@ static void WriteCIAA (uae_u16 addr, uae_u8 val) #endif break; case 1: -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFE101 W %02X %s\n", val, debuginfo(0)); #endif @@ -869,7 +869,7 @@ static void WriteCIAA (uae_u16 addr, uae_u8 val) #endif break; case 2: -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFE201 W %02X %s\n", val, debuginfo(0)); #endif @@ -880,7 +880,7 @@ static void WriteCIAA (uae_u16 addr, uae_u8 val) case 3: ciaadrb = val; dongle_cia_write (0, reg, val); -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFE301 W %02X %s\n", val, debuginfo(0)); #endif @@ -988,8 +988,8 @@ static void WriteCIAB (uae_u16 addr, uae_u8 val) { int reg = addr & 15; -#ifdef CIAB_DEBUG_W - if (addr >= 8 && addr <= 10) +#if CIAB_DEBUG_W > 0 + if ((addr >= 8 && addr <= 10) || CIAB_DEBUG_W > 1) write_log (L"W_CIAB: bfd%x00 %02X %08X\n", reg, val, M68K_GETPC); #endif #ifdef ACTION_REPLAY @@ -997,7 +997,7 @@ static void WriteCIAB (uae_u16 addr, uae_u8 val) #endif switch (reg) { case 0: -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFD000 W %02X %s\n", val, debuginfo(0)); #endif @@ -1013,7 +1013,7 @@ static void WriteCIAB (uae_u16 addr, uae_u8 val) #endif break; case 1: -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFD100 W %02X %s\n", val, debuginfo(0)); #endif @@ -1022,7 +1022,7 @@ static void WriteCIAB (uae_u16 addr, uae_u8 val) DISK_select (val); break; case 2: -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFD200 W %02X %s\n", val, debuginfo(0)); #endif @@ -1034,7 +1034,7 @@ static void WriteCIAB (uae_u16 addr, uae_u8 val) #endif break; case 3: -#ifdef DONGLE_DEBUG +#if DONGLE_DEBUG > 0 if (notinrom ()) write_log (L"BFD300 W %02X %s\n", val, debuginfo(0)); #endif @@ -1107,7 +1107,7 @@ static void WriteCIAB (uae_u16 addr, uae_u8 val) CIA_calctimers (); break; case 13: - setclr (&ciabimask,val); + setclr (&ciabimask, val); break; case 14: CIA_update (); diff --git a/custom.c b/custom.c index 1a39e897..6c91450f 100644 --- a/custom.c +++ b/custom.c @@ -197,6 +197,7 @@ struct sprite { int armed; int dmastate; int dmacycle; + int ptxhpos; }; static struct sprite spr[MAX_SPRITES]; @@ -3845,8 +3846,10 @@ static void SPRxPOS (int hpos, uae_u16 v, int num) { decide_sprites (hpos); SPRx static void SPRxPTH (int hpos, uae_u16 v, int num) { decide_sprites (hpos); - spr[num].pt &= 0xffff; - spr[num].pt |= (uae_u32)v << 16; + if (hpos - 1 != spr[num].ptxhpos) { + spr[num].pt &= 0xffff; + spr[num].pt |= (uae_u32)v << 16; + } #if SPRITE_DEBUG > 0 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { write_log (L"%d:%d:SPR%dPTH %06X\n", vpos, hpos, num, spr[num].pt); @@ -3856,8 +3859,10 @@ static void SPRxPTH (int hpos, uae_u16 v, int num) static void SPRxPTL (int hpos, uae_u16 v, int num) { decide_sprites (hpos); - spr[num].pt &= ~0xffff; - spr[num].pt |= v; + if (hpos - 1 != spr[num].ptxhpos) { + spr[num].pt &= ~0xffff; + spr[num].pt |= v; + } #if SPRITE_DEBUG > 0 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { write_log (L"%d:%d:SPR%dPTL %06X\n", vpos, hpos, num, spr[num].pt); @@ -4482,11 +4487,13 @@ STATIC_INLINE uae_u16 sprite_fetch (struct sprite *s, int dma, int hpos, int cyc { uae_u16 data = last_custom_value1; if (dma) { + if (cycle) + s->ptxhpos = hpos; data = last_custom_value1 = chipmem_agnus_wget (s->pt); alloc_cycle (hpos, CYCLE_SPRITE); #ifdef DEBUGGER if (debug_dma) - record_dma ((s - &spr[0]) * 2 + 0x120, data, s->pt, hpos, vpos, DMARECORD_SPRITE); + record_dma ((s - &spr[0]) * 8 + 0x140 + mode * 4 + cycle * 2, data, s->pt, hpos, vpos, DMARECORD_SPRITE); #endif } s->pt += 2; @@ -4671,8 +4678,10 @@ static void do_sprites (int hpos) cycle = 1; break; } - if (cycle >= 0 && num >= 0 && num < MAX_SPRITES) + if (cycle >= 0 && num >= 0 && num < MAX_SPRITES) { + spr[num].ptxhpos = MAXHPOS; do_sprites_1 (num, cycle, i); + } } last_sprite_hpos = hpos; diff --git a/gencpu.c b/gencpu.c index 5616d1f0..e989cac0 100644 --- a/gencpu.c +++ b/gencpu.c @@ -1860,8 +1860,8 @@ static void gen_opcode (unsigned long int opcode) case i_CMPA: genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0); genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0, 0); - addcycles000 (2); fill_prefetch_next (); + addcycles000 (2); start_brace (); genflags (flag_cmp, sz_long, "newv", "src", "dst"); break; diff --git a/od-win32/avioutput.c b/od-win32/avioutput.c index 4697550d..aa1ca20d 100644 --- a/od-win32/avioutput.c +++ b/od-win32/avioutput.c @@ -460,7 +460,7 @@ int AVIOutput_ChooseAudioCodec (HWND hwnd, TCHAR *s, int len) return 0; } -static int AVIOutput_VideoAllocated(void) +static int AVIOutput_VideoAllocated (void) { return videoallocated ? 1 : 0; } @@ -495,7 +495,7 @@ static int AVIOutput_AllocateVideo (void) lpbi->biPlanes = 1; lpbi->biBitCount = avioutput_bits; lpbi->biCompression = BI_RGB; // uncompressed format - lpbi->biSizeImage = (lpbi->biWidth * lpbi->biHeight) * (lpbi->biBitCount / 8); + lpbi->biSizeImage = (((lpbi->biWidth * lpbi->biBitCount + 31) & ~31) / 8) * lpbi->biHeight; lpbi->biXPelsPerMeter = 0; // ?? lpbi->biYPelsPerMeter = 0; // ?? lpbi->biClrUsed = (lpbi->biBitCount <= 8) ? 1 << lpbi->biBitCount : 0; @@ -836,14 +836,15 @@ static int getFromBuffer (struct avientry *ae) int x, y; uae_u8 *src; uae_u8 *dst = ae->lpVideo; + int pitch = ((avioutput_width * avioutput_bits + 31) & ~31) / 8; src = bufmem_ptr; if (!src) return 0; - dst += avioutput_width * avioutput_bits / 8 * avioutput_height; + dst += pitch * avioutput_height; for (y = 0; y < (gfxvidinfo.height > avioutput_height ? avioutput_height : gfxvidinfo.height); y++) { uae_u8 *d; - dst -= avioutput_width * avioutput_bits / 8; + dst -= pitch; d = dst; for (x = 0; x < (gfxvidinfo.width > avioutput_width ? avioutput_width : gfxvidinfo.width); x++) { if (avioutput_bits == 8) { diff --git a/od-win32/direct3d.c b/od-win32/direct3d.c index 75841485..970a3e54 100644 --- a/od-win32/direct3d.c +++ b/od-win32/direct3d.c @@ -967,12 +967,12 @@ static void createscanlines (int force) p[0] = (sll << 4) | (sll << 0); } else { /* 32-bit, A8R8G8B8 */ - uae_u8 sll4 = sl42 | (sl42 << 4); + uae_u8 sll4 = sl4 | (sl4 << 4); uae_u8 sll2 = sll | (sll << 4); - p[0] = sll4; + p[0] = sll2; p[1] = sll2; p[2] = sll2; - p[3] = sll2; + p[3] = sll4; } } } diff --git a/od-win32/win32.c b/od-win32/win32.c index 01af1d63..ae37dcab 100644 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -1806,7 +1806,7 @@ static PGETUSERDEFAULTUILANGUAGE pGetUserDefaultUILanguage; HMODULE language_load (WORD language) { HMODULE result = NULL; -#if WINUAEPUBLICBETA == 0 +#if LANG_DLL > 0 TCHAR dllbuf[MAX_DPATH]; TCHAR *dllname; diff --git a/od-win32/win32.h b/od-win32/win32.h index 08e2652b..9d9ef198 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -16,10 +16,11 @@ #define GETBDD(x) ((x) % 100) #define WINUAEPUBLICBETA 1 +#define LANG_DLL 1 -#define WINUAEBETA L"23" -#define WINUAEDATE MAKEBD(2009, 11, 29) -#define WINUAEEXTRA L"" +#define WINUAEBETA L"Beta 24" +#define WINUAEDATE MAKEBD(2009, 12, 4) +#define WINUAEEXTRA L"RC2" #define WINUAEREV L"" #define IHF_WINDOWHIDDEN 6 diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index c12ecafb..040fb572 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,18 @@ +Beta 24: (RC2) + +- non 8 divisible width and avi video recording crash fix +- DMA debugger sprite register addresses fixed +- D3D 32-bit scanlines fixed +- frozen blitter didn't unfreeze when old channel mode was restored + (FreeNEasy / Arctic Force does bclr.b #1,$dff042 while blitter is + active.. Most likely simple accidental mistake) +- CE CPU emulation CMP cycle order change +- undocumented sprite DMA update, write to sprite pointer is ignored + between sprite DMA accesses (IcewindDale BBS intro / Possessed) + +Beta 23: (RC1) + - mouse capture didn't work if mouse driver (tablet) mode was enabled without magic mouse - selecting wave recording (file select) disabled audio sync even if -- 2.47.3