From 4ec0987463822c8417800752f3aa53a25c08c4c5 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 6 Dec 2008 12:26:28 +0200 Subject: [PATCH] imported winuaesrc1540b4.zip --- blitter.c | 22 +++-- cfgfile.c | 1 + custom.c | 54 +++++------ debug.c | 61 ++++++++++--- disk.c | 15 ++-- enforcer.c | 5 +- expansion.c | 1 - gencpu.c | 12 +-- gfxutil.c | 10 ++- hardfile.c | 2 +- include/blitter.h | 14 +-- include/debug.h | 1 + include/options.h | 1 + inputdevice.c | 98 +++++++++++--------- memory.c | 25 +++--- od-win32/ahidsound_new.c | 169 +++++++++++++++++++++++++---------- od-win32/dxwrap.c | 5 +- od-win32/hardfile_win32.c | 8 +- od-win32/picasso96_win.c | 4 +- od-win32/win32.c | 21 +++-- od-win32/win32.h | 4 +- od-win32/win32gfx.c | 1 + od-win32/winuaechangelog.txt | 23 ++++- 23 files changed, 369 insertions(+), 188 deletions(-) diff --git a/blitter.c b/blitter.c index 80be495d..0cf1d5cd 100755 --- a/blitter.c +++ b/blitter.c @@ -33,7 +33,6 @@ static int blitter_cycle_exact; uae_u16 bltcon0, bltcon1; uae_u32 bltapt, bltbpt, bltcpt, bltdpt; -int blinea_shift; static uae_u16 blinea, blineb; static int blitline, blitfc, blitfill, blitife, blitsing, blitdesc; static int blitonedot, blitsign; @@ -497,16 +496,16 @@ STATIC_INLINE void blitter_write (void) STATIC_INLINE void blitter_line_incx (void) { - if (++blinea_shift == 16) { - blinea_shift = 0; + if (++blt_info.blitashift == 16) { + blt_info.blitashift = 0; bltcpt += 2; } } STATIC_INLINE void blitter_line_decx (void) { - if (blinea_shift-- == 0) { - blinea_shift = 15; + if (blt_info.blitashift-- == 0) { + blt_info.blitashift = 15; bltcpt -= 2; } } @@ -525,7 +524,7 @@ STATIC_INLINE void blitter_line_incy (void) static void blitter_line (void) { - uae_u16 blitahold = (blinea & blt_info.bltafwm) >> blinea_shift; + uae_u16 blitahold = (blinea & blt_info.bltafwm) >> blt_info.blitashift; uae_u16 blitbhold = blineb & 1 ? 0xFFFF : 0; uae_u16 blitchold = blt_info.bltcdat; @@ -1089,6 +1088,17 @@ void do_blitter (int hpos) return; } +#if 0 + if (M68K_GETPC >= 0x00070554 && M68K_GETPC <= 0x000706B0) { + blitter_done (); + return; + } + if (M68K_GETPC >= 0x00070838) { + blitter_done (); + return; + } +#endif + if (dmaen (DMA_BLITTER)) bltstate = BLT_work; diff --git a/cfgfile.c b/cfgfile.c index 71e1805d..3e2ba19e 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -2949,6 +2949,7 @@ void default_prefs (struct uae_prefs *p, int type) p->gfx_max_horizontal = RES_HIRES; p->gfx_max_vertical = 1; p->color_mode = 2; + p->gfx_blackerthanblack = 0; p->x11_use_low_bandwidth = 0; p->x11_use_mitshm = 0; diff --git a/custom.c b/custom.c index b49574c9..be9cb41e 100755 --- a/custom.c +++ b/custom.c @@ -3130,9 +3130,9 @@ static int isehb (uae_u16 bplcon0, uae_u16 bplcon2) if (currprefs.chipset_mask & CSMASK_AGA) bplehb = (bplcon0 & 0x7010) == 0x6000 && !(bplcon2 & 0x200); else if (currprefs.chipset_mask & CSMASK_ECS_DENISE) - bplehb = (bplcon0 & 0xFC00) == 0x6000 && !(bplcon2 & 0x200); + bplehb = ((bplcon0 & 0xFC00) == 0x6000 || (bplcon0 & 0xFC00) == 0x7000) && !(bplcon2 & 0x200); else - bplehb = (bplcon0 & 0xFC00) == 0x6000 && !currprefs.cs_denisenoehb; + bplehb = ((bplcon0 & 0xFC00) == 0x6000 || (bplcon0 & 0xFC00) == 0x7000) && !currprefs.cs_denisenoehb; return bplehb; } static void BPLCON0 (int hpos, uae_u16 v) @@ -3403,7 +3403,7 @@ static void FNULL (uae_u16 v) static void BLTADAT (uae_u16 v) { - maybe_blit (current_hpos(), 0); + maybe_blit (current_hpos (), 0); blt_info.bltadat = v; } @@ -3414,7 +3414,7 @@ static void BLTADAT (uae_u16 v) */ static void BLTBDAT (uae_u16 v) { - maybe_blit (current_hpos(), 0); + maybe_blit (current_hpos (), 0); if (bltcon1 & 2) blt_info.bltbhold = v << (bltcon1 >> 12); @@ -3422,40 +3422,40 @@ static void BLTBDAT (uae_u16 v) blt_info.bltbhold = v >> (bltcon1 >> 12); blt_info.bltbdat = v; } -static void BLTCDAT (uae_u16 v) { maybe_blit (current_hpos(), 0); blt_info.bltcdat = v; reset_blit (0); } +static void BLTCDAT (uae_u16 v) { maybe_blit (current_hpos (), 0); blt_info.bltcdat = v; reset_blit (0); } -static void BLTAMOD (uae_u16 v) { maybe_blit (current_hpos(), 1); blt_info.bltamod = (uae_s16)(v & 0xFFFE); reset_blit (0); } -static void BLTBMOD (uae_u16 v) { maybe_blit (current_hpos(), 1); blt_info.bltbmod = (uae_s16)(v & 0xFFFE); reset_blit (0); } -static void BLTCMOD (uae_u16 v) { maybe_blit (current_hpos(), 1); blt_info.bltcmod = (uae_s16)(v & 0xFFFE); reset_blit (0); } -static void BLTDMOD (uae_u16 v) { maybe_blit (current_hpos(), 1); blt_info.bltdmod = (uae_s16)(v & 0xFFFE); reset_blit (0); } +static void BLTAMOD (uae_u16 v) { maybe_blit (current_hpos (), 1); blt_info.bltamod = (uae_s16)(v & 0xFFFE); reset_blit (0); } +static void BLTBMOD (uae_u16 v) { maybe_blit (current_hpos (), 1); blt_info.bltbmod = (uae_s16)(v & 0xFFFE); reset_blit (0); } +static void BLTCMOD (uae_u16 v) { maybe_blit (current_hpos (), 1); blt_info.bltcmod = (uae_s16)(v & 0xFFFE); reset_blit (0); } +static void BLTDMOD (uae_u16 v) { maybe_blit (current_hpos (), 1); blt_info.bltdmod = (uae_s16)(v & 0xFFFE); reset_blit (0); } -static void BLTCON0 (uae_u16 v) { maybe_blit (current_hpos(), 2); bltcon0 = v; blinea_shift = v >> 12; reset_blit (1); } +static void BLTCON0 (uae_u16 v) { maybe_blit (current_hpos(), 2); bltcon0 = v; reset_blit (1); } /* The next category is "Most useless hardware register". * And the winner is... */ static void BLTCON0L (uae_u16 v) { if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; - maybe_blit (current_hpos(), 2); bltcon0 = (bltcon0 & 0xFF00) | (v & 0xFF); + maybe_blit (current_hpos (), 2); bltcon0 = (bltcon0 & 0xFF00) | (v & 0xFF); reset_blit (1); } -static void BLTCON1 (uae_u16 v) { maybe_blit (current_hpos(), 2); bltcon1 = v; reset_blit (2); } +static void BLTCON1 (uae_u16 v) { maybe_blit (current_hpos (), 2); bltcon1 = v; reset_blit (2); } -static void BLTAFWM (uae_u16 v) { maybe_blit (current_hpos(), 2); blt_info.bltafwm = v; reset_blit (0); } -static void BLTALWM (uae_u16 v) { maybe_blit (current_hpos(), 2); blt_info.bltalwm = v; reset_blit (0); } +static void BLTAFWM (uae_u16 v) { maybe_blit (current_hpos (), 2); blt_info.bltafwm = v; reset_blit (0); } +static void BLTALWM (uae_u16 v) { maybe_blit (current_hpos (), 2); blt_info.bltalwm = v; reset_blit (0); } -static void BLTAPTH (uae_u16 v) { maybe_blit (current_hpos(), 0); bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); } -static void BLTAPTL (uae_u16 v) { maybe_blit (current_hpos(), 0); bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); } -static void BLTBPTH (uae_u16 v) { maybe_blit (current_hpos(), 0); bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTBPTL (uae_u16 v) { maybe_blit (current_hpos(), 0); bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); } -static void BLTCPTH (uae_u16 v) { maybe_blit (current_hpos(), 0); bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTCPTL (uae_u16 v) { maybe_blit (current_hpos(), 0); bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); } -static void BLTDPTH (uae_u16 v) { maybe_blit (current_hpos(), 0); bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTDPTL (uae_u16 v) { maybe_blit (current_hpos(), 0); bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); } +static void BLTAPTH (uae_u16 v) { maybe_blit (current_hpos (), 0); bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); } +static void BLTAPTL (uae_u16 v) { maybe_blit (current_hpos (), 0); bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); } +static void BLTBPTH (uae_u16 v) { maybe_blit (current_hpos (), 0); bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); } +static void BLTBPTL (uae_u16 v) { maybe_blit (current_hpos (), 0); bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); } +static void BLTCPTH (uae_u16 v) { maybe_blit (current_hpos (), 0); bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); } +static void BLTCPTL (uae_u16 v) { maybe_blit (current_hpos (), 0); bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); } +static void BLTDPTH (uae_u16 v) { maybe_blit (current_hpos (), 0); bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); } +static void BLTDPTL (uae_u16 v) { maybe_blit (current_hpos (), 0); bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); } static void BLTSIZE (uae_u16 v) { - maybe_blit (current_hpos(), 0); + maybe_blit (current_hpos (), 0); blt_info.vblitsize = v >> 6; blt_info.hblitsize = v & 0x3F; @@ -3463,14 +3463,14 @@ static void BLTSIZE (uae_u16 v) blt_info.vblitsize = 1024; if (!blt_info.hblitsize) blt_info.hblitsize = 64; - do_blitter (current_hpos()); + do_blitter (current_hpos ()); } static void BLTSIZV (uae_u16 v) { if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; - maybe_blit (current_hpos(), 0); + maybe_blit (current_hpos (), 0); blt_info.vblitsize = v & 0x7FFF; } @@ -3478,13 +3478,13 @@ static void BLTSIZH (uae_u16 v) { if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; - maybe_blit (current_hpos(), 0); + maybe_blit (current_hpos (), 0); blt_info.hblitsize = v & 0x7FF; if (!blt_info.vblitsize) blt_info.vblitsize = 32768; if (!blt_info.hblitsize) blt_info.hblitsize = 0x800; - do_blitter (current_hpos()); + do_blitter (current_hpos ()); } STATIC_INLINE void spr_arm (int num, int state) diff --git a/debug.c b/debug.c index 2056a3d0..04972c4f 100755 --- a/debug.c +++ b/debug.c @@ -795,7 +795,7 @@ static uaecptr decode_copperlist (FILE* file, uaecptr address, int nolines) { uae_u32 insn; while (nolines-- > 0) { - insn = get_long (address); + insn = (chipmem_agnus_wget (address) << 16) | chipmem_agnus_wget (address + 2); decode_copper_insn (file, insn, address); address += 4; } @@ -1626,41 +1626,61 @@ void debug_lgetpeek (uaecptr addr, uae_u32 v) memwatch_func (addr, 1, 4, &vv); } -static void deinitialize_memwatch (void) +struct membank_store { - int i, as; - addrbank *a1, *a2; + addrbank *addr; + addrbank store; +}; + +static struct membank_store *membank_stores; + +static int deinitialize_memwatch (void) +{ + int i, oldmode; if (!memwatch_enabled && !mmu_enabled) - return; - as = currprefs.address_space_24 ? 256 : 65536; - for (i = 0; i < as; i++) { - a1 = debug_mem_banks[i]; - a2 = mem_banks[i]; - memcpy (a2, a1, sizeof (addrbank)); + return -1; + for (i = 0; membank_stores[i].addr; i++) { + memcpy (membank_stores[i].addr, &membank_stores[i].store, sizeof (addrbank)); } + oldmode = mmu_enabled ? 1 : 0; xfree (debug_mem_banks); - debug_mem_banks = 0; + debug_mem_banks = NULL; xfree (debug_mem_area); - debug_mem_area = 0; + debug_mem_area = NULL; + xfree (membank_stores); + membank_stores = NULL; memwatch_enabled = 0; mmu_enabled = 0; xfree (illgdebug); illgdebug = 0; + return oldmode; } static void initialize_memwatch (int mode) { - int i, as; - addrbank *a1, *a2; + int i, j, as; + addrbank *a1, *a2, *oa; deinitialize_memwatch (); as = currprefs.address_space_24 ? 256 : 65536; debug_mem_banks = xmalloc (sizeof (addrbank*) * as); debug_mem_area = xmalloc (sizeof (addrbank) * as); + membank_stores = xcalloc (sizeof (struct membank_store), 32); + oa = NULL; for (i = 0; i < as; i++) { a1 = debug_mem_banks[i] = debug_mem_area + i; a2 = mem_banks[i]; + if (a2 != oa) { + for (j = 0; membank_stores[j].addr; j++) { + if (membank_stores[j].addr == a2) + break; + } + if (membank_stores[j].addr == NULL) { + membank_stores[j].addr = a2; + memcpy (&membank_stores[j].store, a2, sizeof (addrbank)); + } + } memcpy (a1, a2, sizeof (addrbank)); } for (i = 0; i < as; i++) { @@ -1682,6 +1702,19 @@ static void initialize_memwatch (int mode) memwatch_enabled = 1; } +int debug_bankchange (int mode) +{ + if (mode == -1) { + int v = deinitialize_memwatch (); + if (v < 0) + return -2; + return v; + } + if (mode >= 0) + initialize_memwatch (mode); + return -1; +} + void memwatch_dump2 (char *buf, int bufsize, int num) { int i; diff --git a/disk.c b/disk.c index cb1a2ca4..18b9adbc 100755 --- a/disk.c +++ b/disk.c @@ -983,26 +983,29 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const char } drv->useturbo = 1; - } else if (size == 720 * 1024 || size == 1440 * 1024 || size == 800 * 1024 || size == 1600 * 1024) { + } else if ( + size == 9 * 80 * 2 * 512 || size == 18 * 80 * 2 * 512 || size == 10 * 80 * 2 * 512 || size == 20 * 80 * 2 * 512 || + size == 9 * 81 * 2 * 512 || size == 18 * 81 * 2 * 512 || size == 10 * 81 * 2 * 512 || size == 20 * 81 * 2 * 512 || + size == 9 * 82 * 2 * 512 || size == 18 * 82 * 2 * 512 || size == 10 * 82 * 2 * 512 || size == 20 * 82 * 2 * 512) { /* PC formatted image */ int i; - if (size == 720 * 1024) { + if ( size == 9 * 80 * 2 * 512 || size == 9 * 81 * 2 * 512 || size == 9 * 82 * 2 * 512) { drv->num_secs = 9; drv->ddhd = 1; - } else if (size == 1440 * 1024) { + } else if (size == 18 * 80 * 2 * 512 || size == 18 * 81 * 2 * 512 || size == 18 * 82 * 2 * 512) { drv->num_secs = 18; drv->ddhd = 1; - } else if (size == 800 * 1024) { + } else if (size == 10 * 80 * 2 * 512 || size == 10 * 81 * 2 * 512 || size == 10 * 82 * 2 * 512) { drv->num_secs = 10; drv->ddhd = 2; - } else if (size == 1600 * 1024) { + } else if (size == 20 * 80 * 2 * 512 || size == 20 * 81 * 2 * 512 || size == 20 * 82 * 2 * 512) { drv->num_secs = 20; drv->ddhd = 2; } + drv->num_tracks = size / (drv->num_secs * 512); drv->filetype = ADF_PCDOS; - drv->num_tracks = 160; for (i = 0; i < drv->num_tracks; i++) { tid = &drv->trackdata[i]; tid->type = TRACK_PCDOS; diff --git a/enforcer.c b/enforcer.c index baf95f39..1c118a0a 100755 --- a/enforcer.c +++ b/enforcer.c @@ -33,6 +33,7 @@ /* Configurable options */ #define ENFORCESIZE 1024 #define STACKLINES 5 +#define BACKTRACELONGS 500 #define INSTRUCTIONLINES 17 #define ISILLEGAL(addr) (addr < 4 || (addr > 4 && addr < ENFORCESIZE)) @@ -151,7 +152,7 @@ static int enforcer_decode_hunk_and_offset (char *buf, uae_u32 pc) while ((address = get_long (seg_entry))) { size = get_long (seg_entry + 4); - if (pc >= address && pc < address + size) { + if (pc > address && pc < address + size) { uae_u32 name, offset; uae_u8 *native_name; @@ -254,7 +255,7 @@ static void enforcer_display_hit (const char *addressmode, uae_u32 pc, uaecptr a } } - for (i = 0; i < 8 * STACKLINES; i++) { + for (i = 0; i < BACKTRACELONGS; i++) { a7 += 4; if (enforcer_decode_hunk_and_offset (buf, get_long (a7))) { int l = strlen (buf); diff --git a/expansion.c b/expansion.c index ad720ab4..9ab5e783 100755 --- a/expansion.c +++ b/expansion.c @@ -1192,7 +1192,6 @@ static void allocate_expamem (void) static uaecptr check_boot_rom (void) { - int i; uaecptr b = RTAREA_DEFAULT; addrbank *ab; diff --git a/gencpu.c b/gencpu.c index 812cba63..68bf7238 100755 --- a/gencpu.c +++ b/gencpu.c @@ -2515,7 +2515,7 @@ static void gen_opcode (unsigned long int opcode) printf ("\tuae_u32 carry = val & 1;\n"); printf ("\tval >>= 1;\n"); genflags (flag_logical, curi->size, "val", "", ""); - printf ("SET_CFLG (®s->ccrflags, carry);\n"); + printf ("\tSET_CFLG (®s->ccrflags, carry);\n"); duplicate_carry (0); genastore ("val", curi->smode, "srcreg", curi->size, "data"); break; @@ -2532,7 +2532,7 @@ static void gen_opcode (unsigned long int opcode) printf ("\tuae_u32 carry = val & %s;\n", cmask (curi->size)); printf ("\tval <<= 1;\n"); genflags (flag_logical, curi->size, "val", "", ""); - printf ("SET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1); + printf ("\tSET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1); duplicate_carry (0); genastore ("val", curi->smode, "srcreg", curi->size, "data"); break; @@ -2550,7 +2550,7 @@ static void gen_opcode (unsigned long int opcode) printf ("\tval <<= 1;\n"); printf ("\tif (carry) val |= 1;\n"); genflags (flag_logical, curi->size, "val", "", ""); - printf ("SET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1); + printf ("\tSET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1); genastore ("val", curi->smode, "srcreg", curi->size, "data"); break; case i_RORW: @@ -2567,7 +2567,7 @@ static void gen_opcode (unsigned long int opcode) printf ("\tval >>= 1;\n"); printf ("\tif (carry) val |= %s;\n", cmask (curi->size)); genflags (flag_logical, curi->size, "val", "", ""); - printf ("SET_CFLG (®s->ccrflags, carry);\n"); + printf ("\tSET_CFLG (®s->ccrflags, carry);\n"); genastore ("val", curi->smode, "srcreg", curi->size, "data"); break; case i_ROXLW: @@ -2584,7 +2584,7 @@ static void gen_opcode (unsigned long int opcode) printf ("\tval <<= 1;\n"); printf ("\tif (GET_XFLG (®s->ccrflags)) val |= 1;\n"); genflags (flag_logical, curi->size, "val", "", ""); - printf ("SET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1); + printf ("\tSET_CFLG (®s->ccrflags, carry >> %d);\n", bit_size (curi->size) - 1); duplicate_carry (0); genastore ("val", curi->smode, "srcreg", curi->size, "data"); break; @@ -2602,7 +2602,7 @@ static void gen_opcode (unsigned long int opcode) printf ("\tval >>= 1;\n"); printf ("\tif (GET_XFLG (®s->ccrflags)) val |= %s;\n", cmask (curi->size)); genflags (flag_logical, curi->size, "val", "", ""); - printf ("SET_CFLG (®s->ccrflags, carry);\n"); + printf ("\tSET_CFLG (®s->ccrflags, carry);\n"); duplicate_carry (0); genastore ("val", curi->smode, "srcreg", curi->size, "data"); break; diff --git a/gfxutil.c b/gfxutil.c index 3ff46c07..c8b344ff 100755 --- a/gfxutil.c +++ b/gfxutil.c @@ -289,7 +289,15 @@ void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int aw, i int bpp = rw + gw + bw + aw; int i; for(i = 0; i < 256; i++) { - int j = i + 256; + int j; + + if (currprefs.gfx_blackerthanblack) { + j = i * 15 / 16 + 15; + } else { + j = i; + } + j += 256; + rc[i] = doColor (gamma[j], rw, rs) | doAlpha (alpha, aw, as); gc[i] = doColor (gamma[j], gw, gs) | doAlpha (alpha, aw, as); bc[i] = doColor (gamma[j], bw, bs) | doAlpha (alpha, aw, as); diff --git a/hardfile.c b/hardfile.c index 099f66be..9a7d12f4 100755 --- a/hardfile.c +++ b/hardfile.c @@ -357,7 +357,7 @@ int hdf_open (struct hardfiledata *hfd, const char *pname) if (!hdf_open_target (hfd, pname)) return 0; if (hdf_read_target (hfd, tmp, 0, 512) != 512) - goto end; + goto nonvhd; v = gl (tmp + 8); // features if ((v & 3) != 2) goto nonvhd; diff --git a/include/blitter.h b/include/blitter.h index 36fd4c1b..b8688578 100755 --- a/include/blitter.h +++ b/include/blitter.h @@ -8,10 +8,11 @@ struct bltinfo { int blitzero; - int blitashift,blitbshift,blitdownashift,blitdownbshift; - uae_u16 bltadat, bltbdat, bltcdat,bltddat,bltahold,bltbhold,bltafwm,bltalwm; - int vblitsize,hblitsize; - int bltamod,bltbmod,bltcmod,bltdmod; + int blitashift, blitbshift, blitdownashift, blitdownbshift; + uae_u16 bltadat, bltbdat, bltcdat, bltddat; + uae_u16 bltahold, bltbhold, bltafwm, bltalwm; + int vblitsize, hblitsize; + int bltamod, bltbmod, bltcmod, bltdmod; int got_cycle; }; @@ -22,9 +23,8 @@ extern enum blitter_states { extern struct bltinfo blt_info; extern uae_u16 bltsize; -extern uae_u16 bltcon0,bltcon1; -extern int blinea_shift; -extern uae_u32 bltapt,bltbpt,bltcpt,bltdpt; +extern uae_u16 bltcon0, bltcon1; +extern uae_u32 bltapt, bltbpt, bltcpt, bltdpt; extern int blit_singlechannel; extern void maybe_blit (int, int); diff --git a/include/debug.h b/include/debug.h index 623f8e9e..99f8ac5e 100755 --- a/include/debug.h +++ b/include/debug.h @@ -34,6 +34,7 @@ extern void debug_help (void); extern uaecptr dumpmem2 (uaecptr addr, char *out, int osize); extern void update_debug_info (void); extern int instruction_breakpoint (char **c); +extern int debug_bankchange (int); #define BREAKPOINT_TOTAL 8 struct breakpoint_node { diff --git a/include/options.h b/include/options.h index a6a77221..cee0059a 100755 --- a/include/options.h +++ b/include/options.h @@ -170,6 +170,7 @@ struct uae_prefs { int gfx_xcenter_size, gfx_ycenter_size; int gfx_max_horizontal, gfx_max_vertical; int gfx_saturation, gfx_luminance, gfx_contrast, gfx_gamma; + int gfx_blackerthanblack; int color_mode; int gfx_filter; diff --git a/inputdevice.c b/inputdevice.c index 07709a36..f2538af4 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -1038,11 +1038,37 @@ int getbuttonstate (int joy, int button) return v; } -static void mouseupdate (int pct) +static int getvelocity (int num, int subnum, int pct) +{ + int val; + int v; + + val = mouse_delta[num][subnum]; + v = val * pct / 1000; + if (!v) { + if (val < -maxvpos / 2) + v = -2; + else if (val < 0) + v = -1; + else if (val > maxvpos / 2) + v = 2; + else if (val > 0) + v = 1; + } + if (!mouse_deltanoreset[num][subnum]) + mouse_delta[num][subnum] -= v; + return v; +} + +static void mouseupdate (int pct, int vsync) { int v, i; + int max = 127; + + if (pct > 1000) + pct = 1000; - if (pct == 100) { + if (vsync) { if (mouse_delta[0][0] < 0) { if (mouseedge_x > 0) mouseedge_x = 0; @@ -1082,17 +1108,13 @@ static void mouseupdate (int pct) for (i = 0; i < 2; i++) { - v = mouse_delta[i][0] * pct / 100; + v = getvelocity (i, 0, pct); mouse_x[i] += v; - if (!mouse_deltanoreset[i][0]) - mouse_delta[i][0] -= v; - v = mouse_delta[i][1] * pct / 100; + v = getvelocity (i, 1, pct); mouse_y[i] += v; - if (!mouse_deltanoreset[i][1]) - mouse_delta[i][1] -= v; - v = mouse_delta[i][2] * pct / 100; + v = getvelocity (i, 2, pct); if (v > 0) record_key (0x7a << 1); else if (v < 0) @@ -1100,23 +1122,17 @@ static void mouseupdate (int pct) if (!mouse_deltanoreset[i][2]) mouse_delta[i][2] = 0; - if (mouse_frame_x[i] - mouse_x[i] > 127) - mouse_x[i] = mouse_frame_x[i] - 127; - if (mouse_frame_x[i] - mouse_x[i] < -127) - mouse_x[i] = mouse_frame_x[i] + 127; - - if (mouse_frame_y[i] - mouse_y[i] > 127) - mouse_y[i] = mouse_frame_y[i] - 127; - if (mouse_frame_y[i] - mouse_y[i] < -127) - mouse_y[i] = mouse_frame_y[i] + 127; - - if (pct == 100) { - if (!mouse_deltanoreset[i][0]) - mouse_delta[i][0] = 0; - if (!mouse_deltanoreset[i][1]) - mouse_delta[i][1] = 0; - if (!mouse_deltanoreset[i][2]) - mouse_delta[i][2] = 0; + if (mouse_frame_x[i] - mouse_x[i] > max) + mouse_x[i] = mouse_frame_x[i] - max; + if (mouse_frame_x[i] - mouse_x[i] < -max) + mouse_x[i] = mouse_frame_x[i] + max; + + if (mouse_frame_y[i] - mouse_y[i] > max) + mouse_y[i] = mouse_frame_y[i] - max; + if (mouse_frame_y[i] - mouse_y[i] < -max) + mouse_y[i] = mouse_frame_y[i] + max; + + if (!vsync) { mouse_frame_x[i] = mouse_x[i]; mouse_frame_y[i] = mouse_y[i]; } @@ -1124,20 +1140,16 @@ static void mouseupdate (int pct) } } -static int input_read, input_vpos; +static int input_vpos, input_frame; extern int vpos; static void readinput (void) { - if (!input_read && (vpos & ~31) != (input_vpos & ~31)) { - idev[IDTYPE_JOYSTICK].read (); - idev[IDTYPE_MOUSE].read (); - mouseupdate ((vpos - input_vpos) * 100 / maxvpos); - input_vpos = vpos; - } - if (input_read) { - input_vpos = vpos; - input_read = 0; - } + uae_u32 totalvpos; + + totalvpos = input_frame * maxvpos + vpos; + mouseupdate ((totalvpos - input_vpos) * 1000 / maxvpos, 0); + input_vpos = totalvpos; + } int getjoystate (int joy) @@ -1146,7 +1158,7 @@ int getjoystate (int joy) uae_u16 v = 0; if (inputdevice_logging & 2) - write_log ("JOY%dDAT %x\n", joy, m68k_getpc (®s)); + write_log ("JOY%dDAT %08x\n", joy, M68K_GETPC); readinput (); if (joydir[joy] & DIR_LEFT) left = 1; @@ -2029,11 +2041,13 @@ void inputdevice_vsync (void) } } } - mouseupdate (100); - inputdelay = uaerand () % (maxvpos <= 1 ? 1 : maxvpos - 1); + + input_frame++; + mouseupdate (0, 1); idev[IDTYPE_MOUSE].read (); - input_read = 1; - input_vpos = 0; + idev[IDTYPE_JOYSTICK].read (); + + inputdelay = uaerand () % (maxvpos <= 1 ? 1 : maxvpos - 1); inputdevice_handle_inputcode (); if (ievent_alive > 0) ievent_alive--; diff --git a/memory.c b/memory.c index 23d46859..94c38010 100755 --- a/memory.c +++ b/memory.c @@ -45,11 +45,8 @@ static int isdirectjit (void) static int canjit (void) { -#if 0 - if (currprefs.cpu_model >= 68020) - return 1; - return 0; -#endif + if (currprefs.cpu_model < 68020 && currprefs.address_space_24) + return 0; return 1; } @@ -1081,7 +1078,7 @@ int addr_valid (char *txt, uaecptr addr, uae_u32 len) return 1; } -uae_u32 chipmem_mask, chipmem_full_mask; +uae_u32 chipmem_mask, chipmem_full_mask, chipmem_full_size; uae_u32 kickmem_mask, extendedkickmem_mask, extendedkickmem2_mask, bogomem_mask; uae_u32 a3000lmem_mask, a3000hmem_mask, cardmem_mask; @@ -1448,7 +1445,7 @@ static void REGPARAM2 chipmem_agnus_lput (uaecptr addr, uae_u32 l) uae_u32 *m; addr &= chipmem_full_mask; - if (addr >= allocated_chipmem) + if (addr >= chipmem_full_size) return; m = (uae_u32 *)(chipmemory + addr); do_put_mem_long (m, l); @@ -1459,7 +1456,7 @@ void REGPARAM2 chipmem_agnus_wput (uaecptr addr, uae_u32 w) uae_u16 *m; addr &= chipmem_full_mask; - if (addr >= allocated_chipmem) + if (addr >= chipmem_full_size) return; m = (uae_u16 *)(chipmemory + addr); do_put_mem_word (m, w); @@ -1468,7 +1465,7 @@ void REGPARAM2 chipmem_agnus_wput (uaecptr addr, uae_u32 w) static void REGPARAM2 chipmem_agnus_bput (uaecptr addr, uae_u32 b) { addr &= chipmem_full_mask; - if (addr >= allocated_chipmem) + if (addr >= chipmem_full_size) return; chipmemory[addr] = b; } @@ -1476,7 +1473,7 @@ static void REGPARAM2 chipmem_agnus_bput (uaecptr addr, uae_u32 b) static int REGPARAM2 chipmem_check (uaecptr addr, uae_u32 size) { addr &= chipmem_mask; - return (addr + size) <= allocated_chipmem; + return (addr + size) <= chipmem_full_size; } static uae_u8 *REGPARAM2 chipmem_xlate (uaecptr addr) @@ -3119,6 +3116,7 @@ static void allocate_memory (void) memsize2 = allocated_bogomem = currprefs.bogomem_size; chipmem_mask = allocated_chipmem - 1; chipmem_full_mask = allocated_chipmem * 2 - 1; + chipmem_full_size = 0x80000 * 2; chipmemory = mapped_malloc (memsize1 + memsize2, "chip"); bogomemory = chipmemory + memsize1; bogomem_mask = allocated_bogomem - 1; @@ -3138,7 +3136,7 @@ static void allocate_memory (void) if (currprefs.chipmem_size > 2 * 1024 * 1024) free_fastmemory (); - memsize = allocated_chipmem = currprefs.chipmem_size; + memsize = allocated_chipmem = chipmem_full_size = currprefs.chipmem_size; chipmem_full_mask = chipmem_mask = allocated_chipmem - 1; if (memsize < 0x100000) memsize = 0x100000; @@ -3679,13 +3677,14 @@ void memory_hardreset (void) void map_banks (addrbank *bank, int start, int size, int realsize) { - int bnr; + int bnr, old; unsigned long int hioffs = 0, endhioffs = 0x100; addrbank *orgbank = bank; uae_u32 realstart = start; //write_log ("MAP_BANK %04X0000 %d %s\n", start, size, bank->name); + old = debug_bankchange (-1); flush_icache (1); /* Sure don't want to keep any old mappings around! */ #ifdef NATMEM_OFFSET delete_shmmaps (start << 16, size << 16); @@ -3713,6 +3712,7 @@ void map_banks (addrbank *bank, int start, int size, int realsize) put_mem_bank (bnr << 16, bank, realstart << 16); real_left--; } + debug_bankchange (old); return; } #endif @@ -3735,6 +3735,7 @@ void map_banks (addrbank *bank, int start, int size, int realsize) real_left--; } } + debug_bankchange (old); } #ifdef SAVESTATE diff --git a/od-win32/ahidsound_new.c b/od-win32/ahidsound_new.c index e3b66279..3a0cc98f 100755 --- a/od-win32/ahidsound_new.c +++ b/od-win32/ahidsound_new.c @@ -1,7 +1,7 @@ /* * UAE - The Un*x Amiga Emulator * - * OpenAL AHI 7.1 wrapper + * OpenAL AHI 7.1 "wrapper" * * Copyright 2008 Toni Wilen */ @@ -41,7 +41,7 @@ #define AHI_STRUCT_VERSION 1 -static int ahi_debug = 2; +int ahi_debug = 1; #define UAE_MAXCHANNELS 24 #define UAE_MAXSOUNDS 256 @@ -358,6 +358,7 @@ struct dschannel { int buffertoggle; int maxplaysamples; int totalsamples; + int waitforack; }; struct DSAHI { @@ -482,21 +483,22 @@ static int sendsignal (struct DSAHI *dsahip) return 1; } -static void setchannelevent (struct DSAHI *dsahip, struct dschannel *dc) +static int setchannelevent (struct DSAHI *dsahip, struct dschannel *dc) { uae_u32 audioctrl = dsahip->audioctrl; uae_u32 puaebase = get_long (audioctrl + ahiac_DriverData); int ch = dc - &dsahip->channel[0]; uae_u32 mask; - if (!dsahip->playing || ahi_paused || !dc->al_source) - return; + if (!dsahip->playing || ahi_paused || !dc->al_source || !get_long (audioctrl + ahiac_SoundFunc)) + return 0; mask = get_long (puaebase + pub_ChannelSignal); if (mask & (1 << ch)) - return; + return 0; dc->channelsignal = 1; put_long (puaebase + pub_ChannelSignal, mask | (1 << ch)); sendsignal (dsahip); + return 1; } static void evtfunc (uae_u32 v) @@ -714,7 +716,7 @@ static void ds_setvolume (struct DSAHI *dsahip, struct dschannel *dc) { if (dc->al_source != -1) { if (abs (dc->cs.volume) != abs (dc->csnext.volume)) { - float vol = (float)(abs (dc->csnext.volume) / 65536.0); + float vol = ((float)(abs (dc->csnext.volume))) / 65536.0; alClear (); alSourcef (dc->al_source, AL_GAIN, vol); alError ("AHI: SetVolume(%d,%d)", dc->num, vol); @@ -752,7 +754,7 @@ static int ds_allocchannel (struct DSAHI *dsahip, struct dschannel *dc) ds_setfreq (dsahip, dc); if (ahi_debug) write_log ("AHI: allocated OpenAL source for channel %d. vol=%d pan=%d freq=%d\n", - dc->num, dc->cs.volume, dc->cs.panning, dc->cs.frequency); + dc->num, dc->cs.volume, dc->cs.panning, dc->cs.frequency); return 1; error: ds_freechannel (dsahip, dc); @@ -993,7 +995,35 @@ static void al_startplay (struct dschannel *dc) alError ("AHI: ds_play() alSourcePlay"); } -static void preparesample (struct DSAHI *dsahip, struct dschannel *dc) +static void preparesample_single (struct DSAHI *dsahip, struct dschannel *dc) +{ + uae_u8 *p, *ps, *pe; + struct dssample *ds; + int slen, dlen; + + dc->samplecounter = -1; + dc->buffertoggle = 0; + + ds = dc->cs.ds; + ps = p = get_real_address (ds->addr); + pe = ps + ds->len * ds->bytespersample * ds->ch; + + slen = ds->len; + p += dc->cs.srcplayoffset * ds->bytespersample * ds->ch; + dlen = copysampledata (dsahip, dc, ds, &p, pe, ps, dsahip->tmpbuffer, slen); + alClear (); + alBufferData (ds->al_buffer[dc->buffertoggle], dsahip->al_bufferformat, dsahip->tmpbuffer, dlen, dc->cs.frequency); + alError ("AHI: preparesample_single:alBufferData(len=%d,freq=%d)", dlen, dc->cs.frequency); + alClear (); + alSourceQueueBuffers (dc->al_source, 1, &ds->al_buffer[dc->buffertoggle]); + alError ("AHI: al_initsample_single:alSourceQueueBuffers(freq=%d)", dc->cs.frequency); + if (ahi_debug > 2) + write_log ("AHI: sample queued %d: %d/%d\n", + dc->num, dc->samplecounter, dc->totalsamples); +} + + +static void preparesample_multi (struct DSAHI *dsahip, struct dschannel *dc) { uae_u8 *p, *ps, *pe; struct dssample *ds; @@ -1015,7 +1045,7 @@ static void preparesample (struct DSAHI *dsahip, struct dschannel *dc) alClear (); alSourceQueueBuffers (dc->al_source, 1, &ds->al_buffer[dc->buffertoggle]); alError ("AHI: al_initsample:alSourceQueueBuffers(freq=%d)", dc->cs.frequency); - if (ahi_debug > 1) + if (ahi_debug > 2) write_log ("AHI: sample queued %d: %d/%d\n", dc->num, dc->samplecounter, dc->totalsamples); dc->samplecounter++; @@ -1025,7 +1055,9 @@ static void preparesample (struct DSAHI *dsahip, struct dschannel *dc) /* called when sample is started for the first time */ static void al_initsample (struct DSAHI *dsahip, struct dschannel *dc) { + uae_u32 audioctrl = dsahip->audioctrl; struct dssample *ds; + int single = 0; alSourceStop (dc->al_source); alClear (); @@ -1034,24 +1066,35 @@ static void al_initsample (struct DSAHI *dsahip, struct dschannel *dc) memcpy (&dc->cs, &dc->csnext, sizeof (struct chsample)); dc->csnext.ds = NULL; + dc->waitforack = 0; ds = dc->cs.ds; if (ds == NULL) return; - dc->samplecounter = 0; - if (ds->dynamic) - dc->maxplaysamples = dsahip->maxplaysamples / 2; - else - dc->maxplaysamples = ds->len / 2; - if (dc->maxplaysamples > dsahip->tmpbuffer_size) - dc->maxplaysamples = dsahip->tmpbuffer_size; - - dc->totalsamples = ds->len / dc->maxplaysamples; - - /* queue first half */ - preparesample (dsahip, dc); - /* queue second half */ - preparesample (dsahip, dc); + if (get_long (audioctrl + ahiac_SoundFunc)) { + dc->samplecounter = 0; + if (ds->dynamic) { + dc->maxplaysamples = dsahip->maxplaysamples / 2; + if (dc->maxplaysamples > ds->len / 2) + dc->maxplaysamples = ds->len / 2; + } else { + dc->maxplaysamples = ds->len / 2; + } + if (dc->maxplaysamples > dsahip->tmpbuffer_size) + dc->maxplaysamples = dsahip->tmpbuffer_size; + + dc->totalsamples = ds->len / dc->maxplaysamples; + if (dc->totalsamples <= 1) + dc->totalsamples = 2; + /* queue first half */ + preparesample_multi (dsahip, dc); + /* queue second half */ + preparesample_multi (dsahip, dc); + } else { + single = 1; + preparesample_single (dsahip, dc); + } + al_setloop (dc, single); if (dc->dsplaying) { dc->dsplaying = 1; @@ -1067,6 +1110,10 @@ static void al_queuesample (struct DSAHI *dsahip, struct dschannel *dc) if (!dc->cs.ds) return; + if (dc->cs.ds->num < 0) { + dc->cs.ds = NULL; + return; + } restart = 0; if (dc->dsplaying) { alClear (); @@ -1077,17 +1124,17 @@ static void al_queuesample (struct DSAHI *dsahip, struct dschannel *dc) alSourceRewind (dc->al_source); alError ("AHI: queuesample:restart"); restart = 1; - if (ahi_debug) + if (ahi_debug > 2) write_log ("AHI: queuesample, play restart\n"); - preparesample (dsahip, dc); + preparesample_multi (dsahip, dc); } } - preparesample (dsahip, dc); + preparesample_multi (dsahip, dc); if (dc->dsplaying) dc->dsplaying = 1; if (restart) al_startplay (dc); - if (ahi_debug > 1) + if (ahi_debug > 2) write_log ("AHI: sample %d queued to channel %d\n", dc->cs.ds->num, dc->num); } @@ -1131,27 +1178,33 @@ void ahi_hsync (void) for (i = 0; i < UAE_MAXCHANNELS; i++) { int v, removed; struct dschannel *dc = &dsahip->channel[i]; + uae_u32 mask = 1 << (dc - &dsahip->channel[0]); + if (dc->dsplaying != 1 || dc->al_source == -1) continue; + removed = unqueuebuffers (dc); v = 0; alClear (); alGetSourcei (dc->al_source, AL_SOURCE_STATE, &v); alError ("AHI: hsync AL_SOURCE_STATE"); if (v != AL_PLAYING) { - setchannelevent (dsahip, dc); - if (ahi_debug) - write_log ("AHI: ********* channel %d stopped state=%d!\n", dc->num, v); - removed = 1; - dc->dsplaying = 2; + if (dc->cs.ds) { + setchannelevent (dsahip, dc); + if (ahi_debug) + write_log ("AHI: ********* channel %d stopped state=%d!\n", dc->num, v); + removed = 1; + dc->dsplaying = 2; + dc->waitforack = 0; + } } - if (removed) { + if (!dc->waitforack && dc->samplecounter >= 0 && removed) { int evt = 0; - if (ahi_debug > 1) + if (ahi_debug > 2) write_log ("sample end channel %d: %d/%d\n", dc->num, dc->samplecounter, dc->totalsamples); if (dc->samplecounter >= dc->totalsamples) { evt = 1; - if (ahi_debug > 1) + if (ahi_debug > 2) write_log ("sample finished channel %d: %d\n", dc->num, dc->totalsamples); dc->samplecounter = 0; if (dc->csnext.ds) { @@ -1159,9 +1212,18 @@ void ahi_hsync (void) dc->csnext.ds = NULL; } } + if (evt) { + flags &= ~mask; + if (setchannelevent (dsahip, dc)) + dc->waitforack = 1; + } + if (!dc->waitforack) + al_queuesample (dsahip, dc); + } + if (dc->waitforack && (flags & mask)) { al_queuesample (dsahip, dc); - if (evt) - setchannelevent (dsahip, dc); + dc->waitforack = 0; + flags &= ~mask; } } put_long (pbase + pub_ChannelSignalAck, flags); @@ -1274,7 +1336,7 @@ static uae_u32 AHIsub_AllocAudio (TrapContext *ctx) return AHISF_ERROR; } if (size < pub_End) { - gui_message ("AHI: Incompatible DEVS:AHI/uae2.audio.\nInternal structure size %d<%d.", size, pub_End); + gui_message ("AHI: Incompatible DEVS:AHI/uae2.audio.\nInternal structure size %d<>%d.", size, pub_End); return AHISF_ERROR; } @@ -1337,7 +1399,7 @@ static void AHIsub_Disable (TrapContext *ctx) { uae_u32 audioctrl = m68k_areg (&ctx->regs, 2); struct DSAHI *dsahip = GETAHI; - if (ahi_debug) + if (ahi_debug > 1) write_log ("AHI: Disable(%08x)\n", audioctrl); dsahip->enabledisable++; } @@ -1346,7 +1408,7 @@ static void AHIsub_Enable (TrapContext *ctx) { uae_u32 audioctrl = m68k_areg (&ctx->regs, 2); struct DSAHI *dsahip = GETAHI; - if (ahi_debug) + if (ahi_debug > 1) write_log ("AHI: Enable(%08x)\n", audioctrl); dsahip->enabledisable--; if (dsahip->enabledisable == 0 && dsahip->playing) @@ -1571,17 +1633,25 @@ static uae_u32 AHIsub_Update (TrapContext *ctx) static uae_u32 AHIsub_SetVol (TrapContext *ctx) { uae_u16 channel = m68k_dreg (&ctx->regs, 0); - uae_u32 volume = m68k_dreg (&ctx->regs, 1); - uae_u32 pan = m68k_dreg (&ctx->regs, 2); + uae_s32 volume = m68k_dreg (&ctx->regs, 1); + uae_s32 pan = m68k_dreg (&ctx->regs, 2); uae_u32 audioctrl = m68k_areg (&ctx->regs, 2); uae_u32 flags = m68k_dreg (&ctx->regs, 3); struct DSAHI *dsahip = GETAHI; struct dschannel *dc = GETCHANNEL; - if (ahi_debug) + if (ahi_debug > 1) write_log ("AHI: SetVol(%d,%d,%d,%08x,%08x)\n", channel, volume, pan, audioctrl, flags); if (dc) { + if (volume < -65535) + volume = -65535; + if (volume > 65535) + volume = 65535; + if (pan < -65535) + pan = -65535; + if (pan > 65535) + pan = 65535; dc->csnext.volume = volume; dc->csnext.panning = pan; if (flags & AHISF_IMM) { @@ -1600,7 +1670,7 @@ static uae_u32 AHIsub_SetFreq (TrapContext *ctx) struct DSAHI *dsahip = GETAHI; struct dschannel *dc = GETCHANNEL; - if (ahi_debug) + if (ahi_debug > 1) write_log ("AHI: SetFreq(%d,%d,%08x,%08x)\n", channel, frequency, audioctrl, flags); if (dc) { @@ -1625,7 +1695,7 @@ static uae_u32 AHIsub_SetSound (TrapContext *ctx) struct dssample *ds = GETSAMPLE; struct dschannel *dc = GETCHANNEL; - if (ahi_debug) + if (ahi_debug > 1) write_log ("AHI: SetSound(%d,%d,%08x,%d,%08x,%08x)\n", channel, sound, offset, length, audioctrl, flags); if (dc == NULL) @@ -1677,6 +1747,7 @@ static uae_u32 AHIsub_SetEffect (TrapContext *ctx) put_long (puaebase + pub_ChannelInfo, 0); break; case AHIET_MASTERVOLUME: + write_log ("AHI: SetEffect(MasterVolume=%08x)\n", get_long (effect + 4)); case AHIET_MASTERVOLUME | AHIET_CANCEL: break; default: @@ -1700,7 +1771,7 @@ static uae_u32 AHIsub_LoadSound (TrapContext *ctx) int ch; int bps; - if (ahi_debug) + if (ahi_debug > 1) write_log ("AHI: LoadSound(%d,%d,%08x,%08x,SMP=%d,ADDR=%08x,LEN=%d)\n", sound, type, info, audioctrl, sampletype, addr, len); @@ -1760,7 +1831,7 @@ static uae_u32 AHIsub_LoadSound (TrapContext *ctx) alGenBuffers (2, ds->al_buffer); if (alError ("AHI: alGenBuffers")) return AHIE_NOMEM; - if (ahi_debug) + if (ahi_debug > 1) write_log ("AHI:LoadSound:allocated OpenAL buffer\n"); } return AHIE_OK; @@ -1773,7 +1844,7 @@ static uae_u32 AHIsub_UnloadSound (TrapContext *ctx) struct DSAHI *dsahip = GETAHI; struct dssample *ds = GETSAMPLE; - if (ahi_debug) + if (ahi_debug > 1) write_log ("AHI: UnloadSound(%d,%08x)\n", sound, audioctrl); ds->num = -1; diff --git a/od-win32/dxwrap.c b/od-win32/dxwrap.c index c9077eb8..47ab0dd3 100755 --- a/od-win32/dxwrap.c +++ b/od-win32/dxwrap.c @@ -421,9 +421,12 @@ HRESULT DirectDraw_CreateMainSurface (int width, int height) dxdata.secondary = surf; dxdata.swidth = width; dxdata.sheight = height; + dxdata.pitch = 0; if (locksurface (surf, &desc)) { dxdata.pitch = desc.lPitch; unlocksurface (surf); + } else { + write_log ("Couldn't get surface pitch!\n"); } createcursorsurface (); } else { @@ -625,7 +628,7 @@ int DirectDraw_SurfaceLock (void) surf = getlocksurface (); if (surf == NULL) return 0; - if (IDirectDrawSurface7_IsLost (surf) == DDERR_SURFACELOST) + if (FAILED (IDirectDrawSurface7_IsLost (surf))) return 0; if (dxdata.lockcnt > 0) return 1; diff --git a/od-win32/hardfile_win32.c b/od-win32/hardfile_win32.c index 4795a172..aa518014 100755 --- a/od-win32/hardfile_win32.c +++ b/od-win32/hardfile_win32.c @@ -585,10 +585,12 @@ int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int hfd->cache_valid = 0; hdf_seek (hfd, offset); poscheck (hfd, len); - if (hfd->handle_valid == HDF_HANDLE_WIN32) - ReadFile (hfd->handle, buffer, len, &ret, NULL); - else if (hfd->handle_valid == HDF_HANDLE_ZFILE) + if (hfd->handle_valid == HDF_HANDLE_WIN32) { + ReadFile (hfd->handle, hfd->cache, len, &ret, NULL); + memcpy (buffer, hfd->cache, ret); + } else if (hfd->handle_valid == HDF_HANDLE_ZFILE) { ret = zfile_fread (buffer, 1, len, hfd->handle); + } maxlen = len; } else { maxlen = len > CACHE_SIZE ? CACHE_SIZE : len; diff --git a/od-win32/picasso96_win.c b/od-win32/picasso96_win.c index 236acb5f..afa4b4a8 100755 --- a/od-win32/picasso96_win.c +++ b/od-win32/picasso96_win.c @@ -1767,6 +1767,8 @@ static struct modeids mi[] = 1152, 864, 6, 1280,1024, 7, 1600,1280, 8, + 320, 256, 9, + 640, 512,10, /* new modes */ @@ -1888,7 +1890,7 @@ static int p96depth (int depth) return ok; } -static int missmodes[] = { 320, 200, 320, 240, 640, 400, 640, 480, -1 }; +static int missmodes[] = { 320, 200, 320, 240, 320, 256, 640, 400, 640, 480, 640, 512, 800, 600, 1024, 768, 1280, 1024, -1 }; #ifdef UAEGFX_INTERNAL static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 size); diff --git a/od-win32/win32.c b/od-win32/win32.c index 3faf1691..c4b81544 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -1679,7 +1679,7 @@ static void pritransla (void) } } -static void WIN32_InitLang(void) +static void WIN32_InitLang (void) { int lid; WORD langid = -1; @@ -1691,7 +1691,7 @@ static void WIN32_InitLang(void) } /* try to load COMDLG32 and DDRAW, initialize csDraw */ -static int WIN32_InitLibraries( void ) +static int WIN32_InitLibraries (void) { LARGE_INTEGER freq; @@ -1712,11 +1712,7 @@ static int WIN32_InitLibraries( void ) return 0; } - /* Make sure we do an InitCommonControls() to get some advanced controls */ - InitCommonControls (); - hRichEdit = LoadLibrary ("RICHED32.DLL"); - return 1; } @@ -3336,6 +3332,16 @@ static int process_arg(char **xargv) always_flush_log = 1; continue; } + if (!strcmp (arg, "-ahidebug")) { + extern int ahi_debug; + ahi_debug = 2; + continue; + } + if (!strcmp (arg, "-ahidebug2")) { + extern int ahi_debug; + ahi_debug = 3; + continue; + } if (i + 1 < argc) { char *np = argv[i + 1]; @@ -3994,6 +4000,9 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin DWORD_PTR sys_aff; HANDLE thread; + /* Make sure we do an InitCommonControls() to get some advanced controls */ + InitCommonControls (); + original_affinity = 1; GetProcessAffinityMask (GetCurrentProcess(), &original_affinity, &sys_aff); diff --git a/od-win32/win32.h b/od-win32/win32.h index 620b353e..a403ae0f 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -17,8 +17,8 @@ #define WINUAEPUBLICBETA 1 -#define WINUAEBETA "3" -#define WINUAEDATE MAKEBD(2008, 11, 29) +#define WINUAEBETA "4" +#define WINUAEDATE MAKEBD(2008, 12, 6) #define WINUAEEXTRA "" #define WINUAEREV "" diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index a898dd76..3bd5a963 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -663,6 +663,7 @@ static uae_u8 *ddraw_dolock (void) if (!DirectDraw_SurfaceLock ()) return 0; gfxvidinfo.bufmem = DirectDraw_GetSurfacePointer (); + gfxvidinfo.rowbytes = DirectDraw_GetSurfacePitch (); init_row_map (); clear_inhibit_frame (IHF_WINDOWHIDDEN); return gfxvidinfo.bufmem; diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index a4bd96d4..cf93857d 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,25 @@ +Beta 4: + +- removable real harddrives (or other memory devices) work again + (broke in b2) +- OCS/ECS "7-planes" mode didn't enable EHB mode +- 320x256, 640x512, 800x600, 1024x768 and 1280x1024 are always + available in Picasso96 resolution selection, even if host does not + support the mode (in fullscreen mode automatically selects next + higher available mode + black borders) 320x200 and 320x240 was + already "faked" previously +- ECS Agnus 0.5M+0.5M "1M chip" mirror works again (Move Any Mountain) +- copper disassembler uses Agnus bank instead of direct memory access, + works now with above configuration +- blitter writes work to "chip mirror" (Move Any Mountain missing gfx) +- mouse counter emulation rewrite, now works with programs that read + counters hundreds of times/frame. (Oil Imperium pipelining minigame, + some weird lag can be noticed but it is much better than previously) +- added support for 81 and 82 cylinder PC/Atari ST image formats +- memwatch breakpoints work after reset/memory bank changes + + Beta 3: - HAM errors if left border was not fully visible (it seems this bug @@ -12,7 +33,7 @@ Beta 3: - vhd creator didn't create fully compatible images (larger images were incompatible with official vhd tools, did not cause data corruption) -- 1st Anniversary by Lazy Bones OCS/ECS "7-plane" trick emulated +- 1st Anniversary by Lazy Bones OCS/ECS "7-planes" trick emulated (missing black vertical lines) - Disposable Hero title screen is now perfect. Take screenshots before it gets broken again :) -- 2.47.3