From: Toni Wilen Date: Sun, 17 Aug 2008 07:33:59 +0000 (+0300) Subject: imported winuaesrc1520b1.zip X-Git-Tag: 2100~125 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=e1fd87ff02fdd089cd4c05fe5f746bce71bc2489;p=francis%2Fwinuae.git imported winuaesrc1520b1.zip --- diff --git a/blitter.c b/blitter.c index 44e34980..43eabc09 100755 --- a/blitter.c +++ b/blitter.c @@ -283,19 +283,19 @@ static void blitter_dofast (void) if (bltcon0 & 0x800) { bltadatptr = bltapt; - bltapt += (blt_info.hblitsize*2 + blt_info.bltamod)*blt_info.vblitsize; + bltapt += (blt_info.hblitsize * 2 + blt_info.bltamod) * blt_info.vblitsize; } if (bltcon0 & 0x400) { bltbdatptr = bltbpt; - bltbpt += (blt_info.hblitsize*2 + blt_info.bltbmod)*blt_info.vblitsize; + bltbpt += (blt_info.hblitsize * 2 + blt_info.bltbmod) * blt_info.vblitsize; } if (bltcon0 & 0x200) { bltcdatptr = bltcpt; - bltcpt += (blt_info.hblitsize*2 + blt_info.bltcmod)*blt_info.vblitsize; + bltcpt += (blt_info.hblitsize * 2 + blt_info.bltcmod) * blt_info.vblitsize; } if (bltcon0 & 0x100) { bltddatptr = bltdpt; - bltdpt += (blt_info.hblitsize*2 + blt_info.bltdmod)*blt_info.vblitsize; + bltdpt += (blt_info.hblitsize * 2 + blt_info.bltdmod) * blt_info.vblitsize; } #ifdef SPEEDUP @@ -679,6 +679,7 @@ void blitter_handler (uae_u32 data) blitter_stuck = 0; if (blit_slowdown > 0 && !currprefs.immediate_blits) { event2_newevent (ev2_blitter, blit_slowdown); + blit_misscyclecounter = blit_slowdown; blit_slowdown = -1; return; } @@ -1060,12 +1061,20 @@ void do_blitter (int hpos) #ifdef BLITTER_DEBUG blitter_dontdo = 0; if (1) { + int ch = 0; if (oldstate != BLT_done) write_log ("blitter was already active!\n"); - write_log ("blitstart: v=%03.3d h=%03.3d %dx%d %d (%d) d=%d f=%02X n=%d pc=%p l=%d dma=%04X\n", - vpos, hpos, blt_info.hblitsize, blt_info.vblitsize, cycles, blit_ch, - blitdesc ? 1 : 0, blitfill, - dmaen (DMA_BLITPRI) ? 1 : 0, M68K_GETPC, blitline, dmacon); + if (blit_ch & 1) + ch++; + if (blit_ch & 2) + ch++; + if (blit_ch & 4) + ch++; + if (blit_ch & 8) + ch++; + write_log ("blitstart: v=%03d h=%03d %dx%d ch=%d %d*%d=%d d=%d f=%02X n=%d pc=%p l=%d dma=%04X\n", + vpos, hpos, blt_info.hblitsize, blt_info.vblitsize, ch, blit_diag[1], cycles, blit_diag[1] * cycles, + blitdesc ? 1 : 0, blitfill, dmaen (DMA_BLITPRI) ? 1 : 0, M68K_GETPC, blitline, dmacon); blitter_dump (); } #endif @@ -1099,7 +1108,8 @@ void do_blitter (int hpos) if (currprefs.immediate_blits) cycles = 1; - event2_newevent(ev2_blitter, cycles * blit_diag[1]); + blit_cyclecounter = cycles * blit_diag[1]; + event2_newevent (ev2_blitter, blit_cyclecounter); } void maybe_blit (int hpos, int hack) diff --git a/cfgfile.c b/cfgfile.c index 2e7258f8..34f73a3a 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -468,7 +468,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) for (i = 0; i < 2; i++) { struct jport *jp = &p->jports[i]; int v = jp->id; - char tmp1[100], tmp2[50]; + char tmp1[MAX_DPATH], tmp2[MAX_DPATH]; if (v < 0) { strcpy (tmp2, "none"); } else if (v < JSEM_JOYS) { diff --git a/cpummu.c b/cpummu.c index cde065e1..ff1319e0 100755 --- a/cpummu.c +++ b/cpummu.c @@ -44,9 +44,9 @@ #ifdef FULLMMU -mmu_atc_l1_array atc_l1[2]; -mmu_atc_l1_array *current_atc; -struct mmu_atc_line atc_l2[2][ATC_L2_SIZE]; +static mmu_atc_l1_array atc_l1[2]; +static mmu_atc_l1_array *current_atc; +static struct mmu_atc_line atc_l2[2][ATC_L2_SIZE]; # ifdef ATC_STATS static unsigned int mmu_atc_hits[ATC_L2_SIZE]; @@ -682,7 +682,7 @@ void REGPARAM2 mmu_put_word_unaligned(uaecptr addr, uae_u16 val, int data) SAVE_EXCEPTION; TRY(prb) { mmu_put_byte(addr, val >> 8, data, sz_word); - mmu_put_byte(addr + 1, val, data, sz_word); + mmu_put_byte(addr + 1, (uae_u8)val, data, sz_word); RESTORE_EXCEPTION; } CATCH(prb) { @@ -877,7 +877,7 @@ void REGPARAM2 dfc_put_word(uaecptr addr, uae_u16 val) mmu_put_user_word(addr, val, super, data, sz_word); else { mmu_put_user_byte(addr, val >> 8, super, data, sz_word); - mmu_put_user_byte(addr + 1, val, super, data, sz_word); + mmu_put_user_byte(addr + 1, (uae_u8)val, super, data, sz_word); } RESTORE_EXCEPTION; } diff --git a/custom.c b/custom.c index 04bf01f3..eb4ea13d 100755 --- a/custom.c +++ b/custom.c @@ -2327,7 +2327,7 @@ static void reset_decisions (void) static int isvsync (void) { - return currprefs.gfx_avsync && currprefs.gfx_afullscreen; + return currprefs.gfx_avsync && currprefs.gfx_afullscreen && !picasso_on; } int vsynctime_orig; diff --git a/debug.c b/debug.c index 4a1f4e15..02be180d 100755 --- a/debug.c +++ b/debug.c @@ -1339,7 +1339,7 @@ static void smc_detector (uaecptr addr, int rwi, int size, uae_u32 *valp) if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible) { /* ignore single-word unconditional jump instructions * (instruction prefetch from PC+2 can cause false positives) */ - if (regs.irc == 0x4e75 || regs.irc == 4e74 || regs.irc == 0x4e72 || regs.irc == 4e77) + if (regs.irc == 0x4e75 || regs.irc == 4e74 || regs.irc == 0x4e72 || regs.irc == 0x4e77) return; /* RTS, RTD, RTE, RTR */ if ((regs.irc & 0xff00) == 0x6000 && (regs.irc & 0x00ff) != 0 && (regs.irc & 0x00ff) != 0xff) return; /* BRA.B */ diff --git a/drawing.c b/drawing.c index aee583e4..7f8c0252 100755 --- a/drawing.c +++ b/drawing.c @@ -398,15 +398,6 @@ static void pfield_init_linetoscr (void) playfield_end = visible_right_border; } #endif - /* Now, compute some offsets. */ - - res_shift = lores_shift - bplres; - ddf_left -= DISPLAY_LEFT_SHIFT; - pixels_offset = MAX_PIXELS_PER_LINE - (ddf_left << bplres); - ddf_left <<= bplres; - - unpainted = visible_left_border < playfield_start ? 0 : visible_left_border - playfield_start; - src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window (playfield_start - native_ddf_left + unpainted); if (sprite_aga_first_x < sprite_aga_last_x) { uae_u8 *p = spritepixels + sprite_aga_first_x; @@ -420,6 +411,16 @@ static void pfield_init_linetoscr (void) sprite_aga_last_x = 0; sprite_aga_first_x = MAX_PIXELS_PER_LINE; } + + /* Now, compute some offsets. */ + res_shift = lores_shift - bplres; + ddf_left -= DISPLAY_LEFT_SHIFT; + pixels_offset = MAX_PIXELS_PER_LINE - (ddf_left << bplres); + ddf_left <<= bplres; + + unpainted = visible_left_border < playfield_start ? 0 : visible_left_border - playfield_start; + src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window (playfield_start - native_ddf_left + unpainted); + seen_sprites = 0; if (dip_for_drawing->nr_sprites == 0) return; @@ -440,22 +441,22 @@ static void pfield_init_linetoscr (void) } } -void drawing_adjust_mousepos(int *xp, int *yp) +void drawing_adjust_mousepos (int *xp, int *yp) { } -static uae_u8 merge_2pixel8(uae_u8 p1, uae_u8 p2) +static uae_u8 merge_2pixel8 (uae_u8 p1, uae_u8 p2) { return p1; } -static uae_u16 merge_2pixel16(uae_u16 p1, uae_u16 p2) +static uae_u16 merge_2pixel16 (uae_u16 p1, uae_u16 p2) { uae_u16 v = ((((p1 >> xredcolor_s) & xredcolor_m) + ((p2 >> xredcolor_s) & xredcolor_m)) / 2) << xredcolor_s; v |= ((((p1 >> xbluecolor_s) & xbluecolor_m) + ((p2 >> xbluecolor_s) & xbluecolor_m)) / 2) << xbluecolor_s; v |= ((((p1 >> xgreencolor_s) & xgreencolor_m) + ((p2 >> xgreencolor_s) & xgreencolor_m)) / 2) << xgreencolor_s; return v; } -static uae_u32 merge_2pixel32(uae_u32 p1, uae_u32 p2) +static uae_u32 merge_2pixel32 (uae_u32 p1, uae_u32 p2) { uae_u32 v = ((((p1 >> 16) & 0xff) + ((p2 >> 16) & 0xff)) / 2) << 16; v |= ((((p1 >> 8) & 0xff) + ((p2 >> 8) & 0xff)) / 2) << 8; diff --git a/gencpu.c b/gencpu.c index 81414ab0..c6e076a2 100755 --- a/gencpu.c +++ b/gencpu.c @@ -31,7 +31,7 @@ static FILE *headerfile; static FILE *stblfile; -static int using_prefetch, using_indirect; +static int using_prefetch, using_indirect, using_mmu; static int using_exception_3; static int using_ce; static int cpu_level; @@ -217,6 +217,9 @@ static void gen_nextilong (char *type, char *name, int norefill) } else if (using_indirect) { insn_n_cycles += 8; printf ("\t%s %s = get_ilongi (%d);\n", type, name, r); + } else if (using_mmu) { + insn_n_cycles += 8; + printf ("\t%s %s = get_ilong_mmu (regs, %d);\n", type, name, r); } else { insn_n_cycles += 8; printf ("\t%s %s = get_ilong (regs, %d);\n", type, name, r); @@ -246,6 +249,9 @@ static const char *gen_nextiword (int norefill) } else if (using_indirect) { sprintf (buffer, "get_iwordi(%d)", r); insn_n_cycles += 4; + } else if (using_mmu) { + sprintf (buffer, "get_iword_mmu (regs, %d)", r); + insn_n_cycles += 4; } else { sprintf (buffer, "get_iword (regs, %d)", r); insn_n_cycles += 4; @@ -277,6 +283,9 @@ static const char *gen_nextibyte (int norefill) } else if (using_indirect) { sprintf (buffer, "get_ibytei (%d)", r); insn_n_cycles += 4; + } else if (using_mmu) { + sprintf (buffer, "get_ibyte_mmu (%d)", r); + insn_n_cycles += 4; } else { sprintf (buffer, "get_ibyte (regs, %d)", r); insn_n_cycles += 4; @@ -480,7 +489,10 @@ static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int g start_brace (); /* This would ordinarily be done in gen_nextiword, which we bypass. */ insn_n_cycles += 4; - printf ("\t%sa = get_disp_ea_020 (regs, m68k_areg (regs, %s), next_iword (regs));\n", name, reg); + if (using_mmu) + printf ("\t%sa = get_disp_ea_020 (regs, m68k_areg (regs, %s), next_iword_mmu (regs));\n", name, reg); + else + printf ("\t%sa = get_disp_ea_020 (regs, m68k_areg (regs, %s), next_iword (regs));\n", name, reg); } else { printf ("\t%sa = get_disp_ea_000 (regs, m68k_areg (regs, %s), %s);\n", name, reg, gen_nextiword (flags & GF_NOREFILL)); } @@ -504,7 +516,10 @@ static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int g /* This would ordinarily be done in gen_nextiword, which we bypass. */ insn_n_cycles += 4; printf ("\ttmppc = m68k_getpc (regs);\n"); - printf ("\t%sa = get_disp_ea_020 (regs, tmppc, next_iword (regs));\n", name); + if (using_mmu) + printf ("\t%sa = get_disp_ea_020 (regs, tmppc, next_iword_mmu (regs));\n", name); + else + printf ("\t%sa = get_disp_ea_020 (regs, tmppc, next_iword (regs));\n", name); } else { printf ("\ttmppc = m68k_getpc (regs) + %d;\n", m68k_pc_offset); printf ("\t%sa = get_disp_ea_000 (regs, tmppc, %s);\n", name, gen_nextiword (flags & GF_NOREFILL)); @@ -587,6 +602,13 @@ static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int g case sz_long: printf ("\tuae_s32 %s = get_word_ce (%sa) << 16; %s |= get_word_ce (%sa + 2);\n", name, name, name, name); break; default: abort (); } + } else if (using_mmu) { + switch (size) { + case sz_byte: insn_n_cycles += 4; printf ("\tuae_s8 %s = uae_mmu_get_byte (%sa);\n", name, name); break; + case sz_word: insn_n_cycles += 4; printf ("\tuae_s16 %s = uae_mmu_get_word (%sa);\n", name, name); break; + case sz_long: insn_n_cycles += 8; printf ("\tuae_s32 %s = uae_mmu_get_long (%sa);\n", name, name); break; + default: abort (); + } } else { switch (size) { case sz_byte: insn_n_cycles += 4; printf ("\tuae_s8 %s = get_byte (%sa);\n", name, name); break; @@ -693,6 +715,27 @@ static void genastore_2 (char *from, amodes mode, char *reg, wordsizes size, cha default: abort (); } + } else if (using_mmu) { + switch (size) { + case sz_byte: + insn_n_cycles += 4; + printf ("\uae_mmu_put_byte (%sa,%s);\n", to, from); + break; + case sz_word: + insn_n_cycles += 4; + if (cpu_level < 2 && (mode == PC16 || mode == PC8r)) + abort (); + printf ("\uae_mmu_put_word (%sa,%s);\n", to, from); + break; + case sz_long: + insn_n_cycles += 8; + if (cpu_level < 2 && (mode == PC16 || mode == PC8r)) + abort (); + printf ("\uae_mmu_put_long (%sa,%s);\n", to, from); + break; + default: + abort (); + } } else { switch (size) { case sz_byte: @@ -743,12 +786,19 @@ static void genmovemel (uae_u16 opcode) char getcode[100]; int size = table68k[opcode].size == sz_long ? 4 : 2; - if (table68k[opcode].size == sz_long) { - strcpy (getcode, "get_long (srca)"); + if (using_mmu) { + if (table68k[opcode].size == sz_long) { + strcpy (getcode, "uae_mmu_get_long (srca)"); + } else { + strcpy (getcode, "(uae_s32)(uae_s16)uae_mmu_get_word (srca)"); + } } else { - strcpy (getcode, "(uae_s32)(uae_s16)get_word (srca)"); + if (table68k[opcode].size == sz_long) { + strcpy (getcode, "get_long (srca)"); + } else { + strcpy (getcode, "(uae_s32)(uae_s16)get_word (srca)"); + } } - printf ("\tuae_u16 mask = %s;\n", gen_nextiword (0)); printf ("\tunsigned int dmask = mask & 0xff, amask = (mask >> 8) & 0xff;\n"); genamode (table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1, 0); @@ -792,10 +842,19 @@ static void genmovemle (uae_u16 opcode) { char putcode[100]; int size = table68k[opcode].size == sz_long ? 4 : 2; - if (table68k[opcode].size == sz_long) { - strcpy (putcode, "put_long (srca"); + + if (using_mmu) { + if (table68k[opcode].size == sz_long) { + strcpy (putcode, "uae_mmu_put_long (srca"); + } else { + strcpy (putcode, "uae_mmu_put_word (srca"); + } } else { - strcpy (putcode, "put_word (srca"); + if (table68k[opcode].size == sz_long) { + strcpy (putcode, "put_long (srca"); + } else { + strcpy (putcode, "put_word (srca"); + } } printf ("\tuae_u16 mask = %s;\n", gen_nextiword (0)); @@ -3267,6 +3326,7 @@ int main (int argc, char **argv) freopen (fname, "wb", stdout); generate_includes (stdout); } + using_mmu = 0; cpu_level = 5 - i; if (i == 11 || i == 12) { cpu_level = 0; diff --git a/include/cpummu.h b/include/cpummu.h index c7dcfffc..a5a41c87 100755 --- a/include/cpummu.h +++ b/include/cpummu.h @@ -42,6 +42,8 @@ #define false 0 #define likely(x) x #define unlikely(x) x +static ALWAYS_INLINE bool test_ram_boundary (uaecptr addr, int size, bool super, bool write) { return false; } +static ALWAYS_INLINE void flush_internals (void) { } typedef char flagtype; @@ -340,7 +342,11 @@ static ALWAYS_INLINE bool is_unaligned(uaecptr addr, int size) static ALWAYS_INLINE uae_u8 *mmu_get_real_address(uaecptr addr, struct mmu_atc_line *cl) { - return do_get_real_address(cl->phys + addr); + return get_real_address(cl->phys + addr); +} +static ALWAYS_INLINE uae_u8 *phys_get_real_address(uaecptr addr) +{ + return get_real_address(addr); } static ALWAYS_INLINE uae_u32 mmu_get_long(uaecptr addr, int data, int size) @@ -458,6 +464,96 @@ static ALWAYS_INLINE void mmu_put_user_byte(uaecptr addr, uae_u8 val, int super, mmu_put_byte_slow(addr, val, super, data, size, cl); } + +static ALWAYS_INLINE void phys_put_long(uaecptr addr, uae_u32 l) +{ + put_long (addr, l); +} +static ALWAYS_INLINE void phys_put_word(uaecptr addr, uae_u32 w) +{ + put_word (addr, w); +} +static ALWAYS_INLINE void phys_put_byte(uaecptr addr, uae_u32 b) +{ + put_byte (addr, b); +} +static ALWAYS_INLINE uae_u32 phys_get_long(uaecptr addr) +{ + return get_long (addr); +} +static ALWAYS_INLINE uae_u32 phys_get_word(uaecptr addr) +{ + return get_word (addr); +} +static ALWAYS_INLINE uae_u32 phys_get_byte(uaecptr addr) +{ + return get_byte (addr); +} + +static ALWAYS_INLINE void HWput_l(uaecptr addr, uae_u32 l) +{ + put_long (addr, l); +} +static ALWAYS_INLINE void HWput_w(uaecptr addr, uae_u32 w) +{ + put_word (addr, w); +} +static ALWAYS_INLINE void HWput_b(uaecptr addr, uae_u32 b) +{ + put_byte (addr, b); +} +static ALWAYS_INLINE uae_u32 HWget_l(uaecptr addr) +{ + return get_long (addr); +} +static ALWAYS_INLINE uae_u32 HWget_w(uaecptr addr) +{ + return get_word (addr); +} +static ALWAYS_INLINE uae_u32 HWget_b(uaecptr addr) +{ + return get_byte (addr); +} + + +static ALWAYS_INLINE uae_u32 uae_mmu_get_long(uaecptr addr) +{ + if (unlikely(is_unaligned(addr, 4))) + return mmu_get_long_unaligned(addr, 1); + return mmu_get_long(addr, 1, sz_long); +} +static ALWAYS_INLINE uae_u16 uae_mmu_get_word(uaecptr addr) +{ + if (unlikely(is_unaligned(addr, 2))) + return mmu_get_word_unaligned(addr, 1); + return mmu_get_word(addr, 1, sz_word); +} +static ALWAYS_INLINE uae_u8 uae_mmu_get_byte(uaecptr addr) +{ + return mmu_get_byte(addr, 1, sz_byte); +} +static ALWAYS_INLINE void uae_mmu_put_long(uaecptr addr, uae_u32 val) +{ + if (unlikely(is_unaligned(addr, 4))) + mmu_put_long_unaligned(addr, val, 1); + else + mmu_put_long(addr, val, 1, sz_long); +} +static ALWAYS_INLINE void uae_mmu_put_word(uaecptr addr, uae_u16 val) +{ + if (unlikely(is_unaligned(addr, 2))) + mmu_put_word_unaligned(addr, val, 1); + else + mmu_put_word(addr, val, 1, sz_word); +} +static ALWAYS_INLINE void uae_mmu_put_byte(uaecptr addr, uae_u8 val) +{ + mmu_put_byte(addr, val, 1, sz_byte); +} + + + + #else # define get_long(a) phys_get_long(a) diff --git a/include/options.h b/include/options.h index 62235aaa..1a7eff6a 100755 --- a/include/options.h +++ b/include/options.h @@ -9,7 +9,7 @@ #define UAEMAJOR 1 #define UAEMINOR 5 -#define UAESUBREV 1 +#define UAESUBREV 2 typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang; diff --git a/inputdevice.c b/inputdevice.c index 23c2130e..389f594c 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -457,7 +457,7 @@ static struct inputdevice_functions *getidf (int devnum); static void write_config (struct zfile *f, int idnum, int devnum, char *name, struct uae_input_device *id, struct uae_input_device2 *id2, struct inputdevice_functions *idf) { - char tmp1[100], *s; + char tmp1[MAX_DPATH], *s; int i; if (!isdevice (id)) { @@ -2405,8 +2405,8 @@ static void matchdevices (struct inputdevice_functions *inf, struct uae_input_de int match = -1; for (j = 0; j < MAX_INPUT_DEVICES; j++) { if (aname2 && uid[j].configname) { - char bname[MAX_JPORTNAME]; - char bname2[MAX_JPORTNAME]; + char bname[MAX_DPATH]; + char bname2[MAX_DPATH]; char *p1 ,*p2; strcpy (bname, uid[j].configname); strcpy (bname2, aname2); diff --git a/od-win32/ahidsound.c b/od-win32/ahidsound.c index 03998f70..8016ce1c 100755 --- a/od-win32/ahidsound.c +++ b/od-win32/ahidsound.c @@ -337,7 +337,10 @@ static int ahi_init_sound_win32 (void) ahisndbuffer = malloc (ahisndbufsize + 32); if (!ahisndbuffer) return 0; - hr = DirectSoundCreate (&sound_devices[currprefs.win32_soundcard].guid, &lpDS2, NULL); + if (sound_devices[currprefs.win32_soundcard].type != SOUND_DEVICE_DS) + hr = DirectSoundCreate (NULL, &lpDS2, NULL); + else + hr = DirectSoundCreate (&sound_devices[currprefs.win32_soundcard].guid, &lpDS2, NULL); if (FAILED (hr)) { write_log ("AHI: DirectSoundCreate() failure: %s\n", DXError (hr)); return 0; diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index de3fbe08..f5710587 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -941,8 +941,8 @@ IDI_PATHS ICON "paths.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,5,1,0 - PRODUCTVERSION 1,5,1,0 + FILEVERSION 1,5,2,0 + PRODUCTVERSION 1,5,2,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -958,12 +958,12 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "WinUAE" - VALUE "FileVersion", "1.5.1" + VALUE "FileVersion", "1.5.2" VALUE "InternalName", "WinUAE" VALUE "LegalCopyright", "© 1996-2008 under the GNU Public License (GPL)" VALUE "OriginalFilename", "WinUAE.exe" VALUE "ProductName", "WinUAE" - VALUE "ProductVersion", "1.5.1" + VALUE "ProductVersion", "1.5.2" END END BLOCK "VarFileInfo" diff --git a/od-win32/resources/winuae_minimal.rc b/od-win32/resources/winuae_minimal.rc index c3261d1c..a23d595c 100755 --- a/od-win32/resources/winuae_minimal.rc +++ b/od-win32/resources/winuae_minimal.rc @@ -139,22 +139,26 @@ BEGIN RTEXT "Memory: [] Graphics card memory. Required for RTG (Picasso96) emulation.",IDC_GFXCARDTEXT,25,98,53,10,SS_NOTIFY | SS_CENTERIMAGE CONTROL "Slider1",IDC_P96MEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,88,94,60,20 EDITTEXT IDC_P96RAM,152,97,34,12,ES_CENTER | ES_READONLY - GROUPBOX "Advanced Memory Settings",-1,13,171,275,65 - RTEXT "Motherboard RAM (Low area):",-1,39,190,129,10,SS_CENTERIMAGE - CONTROL "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,186,59,20 - EDITTEXT IDC_MBRAM1,243,189,34,12,ES_CENTER | ES_READONLY - RTEXT "Motherboard RAM (High area):",-1,39,215,129,10,SS_CENTERIMAGE - CONTROL "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,211,59,20 - EDITTEXT IDC_MBRAM2,243,214,34,12,ES_CENTER | ES_READONLY - GROUPBOX "RTG Graphics Card Settings",-1,14,81,275,87 - CONTROL "Scale instead of switching resolution",IDC_RTG_SCALE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,134,162,10 + GROUPBOX "Advanced Memory Settings",-1,13,179,275,57 + RTEXT "Motherboard RAM (Low area):",-1,39,194,129,10,SS_CENTERIMAGE + CONTROL "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,190,59,20 + EDITTEXT IDC_MBRAM1,243,193,34,12,ES_CENTER | ES_READONLY + RTEXT "Motherboard RAM (High area):",-1,39,217,129,10,SS_CENTERIMAGE + CONTROL "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,213,59,20 + EDITTEXT IDC_MBRAM2,243,216,34,12,ES_CENTER | ES_READONLY + GROUPBOX "RTG Graphics Card Settings",-1,14,81,275,95 + CONTROL "Scale if smaller than display size setting",IDC_RTG_SCALE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,128,162,10 CONTROL "Match host and RTG color depth if possible",IDC_RTG_MATCH_DEPTH, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,119,163,10 - COMBOBOX IDC_RTG_8BIT,211,101,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_RTG_16BIT,211,117,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_RTG_24BIT,211,133,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_RTG_32BIT,211,149,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,116,163,10 + COMBOBOX IDC_RTG_8BIT,211,107,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_RTG_16BIT,211,123,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_RTG_24BIT,211,139,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_RTG_32BIT,211,155,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + CONTROL "Always scale in windowed mode",IDC_RTG_SCALE_ALLOW, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,140,162,10 + COMBOBOX IDC_RTG_SCALE_ASPECTRATIO,131,155,57,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + RTEXT "Scale aspect ratio",-1,24,156,99,10,SS_CENTERIMAGE END IDD_CPU DIALOGEX 0, 0, 300, 226 @@ -667,10 +671,10 @@ STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN GROUPBOX "Filter Settings",-1,0,0,294,186 - CONTROL "Enable",IDC_FILTERENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,17,46,10 - COMBOBOX IDC_FILTERMODE,62,15,61,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_FILTERFILTER,128,15,81,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Reset to defaults",IDC_FILTERDEFAULT,213,15,73,14 + CONTROL "Enable",IDC_FILTERENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,16,40,11 + COMBOBOX IDC_FILTERMODE,53,15,83,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_FILTERFILTER,142,15,74,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Reset to defaults",IDC_FILTERDEFAULT,221,15,67,14 RTEXT "Horiz. size:",-1,7,44,54,10,SS_CENTERIMAGE CONTROL "Slider1",IDC_FILTERHZ,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,99,37,152,19 EDITTEXT IDC_FILTERHZV,253,39,34,12,ES_CENTER | ES_READONLY @@ -683,10 +687,10 @@ BEGIN RTEXT "Vert. position:",-1,5,103,55,10,SS_CENTERIMAGE CONTROL "Slider1",IDC_FILTERVO,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,99,97,151,19 EDITTEXT IDC_FILTERVOV,253,99,34,12,ES_CENTER | ES_READONLY - RTEXT "Extra settings:",-1,27,133,57,10,SS_CENTERIMAGE + RTEXT "Extra settings:",-1,27,137,57,10,SS_CENTERIMAGE CONTROL "Slider1",IDC_FILTERXL,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,99,157,151,19 EDITTEXT IDC_FILTERXLV,253,159,34,12,ES_CENTER | ES_READONLY - COMBOBOX IDC_FILTERSLR,253,130,33,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_FILTERSLR,253,134,33,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP GROUPBOX "Presets",-1,0,187,296,36 COMBOBOX IDC_FILTERPRESETS,8,201,119,150,CBS_DROPDOWN | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Load",IDC_FILTERPRESETLOAD,132,200,47,14 @@ -694,9 +698,10 @@ BEGIN PUSHBUTTON "Delete",IDC_FILTERPRESETDELETE,236,200,47,14 COMBOBOX IDC_FILTERHZMULT,67,43,27,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_FILTERVZMULT,67,63,27,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - CONTROL "Autoscale",IDC_FILTERAUTORES,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,9,168,63,10 - COMBOBOX IDC_FILTERXTRA,105,130,138,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - CONTROL "Keep aspect ratio",IDC_FILTERASPECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,153,87,10 + CONTROL "Autoscale",IDC_FILTERAUTORES,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,9,168,83,10 + COMBOBOX IDC_FILTERXTRA,105,134,138,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_FILTERASPECT,21,118,73,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + CONTROL "Keep aspect ratio",IDC_FILTERKEEPASPECT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,9,153,85,10 END IDD_HARDDRIVE DIALOGEX 0, 0, 380, 76 @@ -936,8 +941,8 @@ IDI_PATHS ICON "paths.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,5,0,0 - PRODUCTVERSION 1,5,0,0 + FILEVERSION 1,5,1,0 + PRODUCTVERSION 1,5,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -953,12 +958,12 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "WinUAE" - VALUE "FileVersion", "1.5.0" + VALUE "FileVersion", "1.5.1" VALUE "InternalName", "WinUAE" VALUE "LegalCopyright", "© 1996-2008 under the GNU Public License (GPL)" VALUE "OriginalFilename", "WinUAE.exe" VALUE "ProductName", "WinUAE" - VALUE "ProductVersion", "1.5.0" + VALUE "ProductVersion", "1.5.1" END END BLOCK "VarFileInfo" @@ -1049,7 +1054,6 @@ BEGIN END END - ///////////////////////////////////////////////////////////////////////////// // // String Table @@ -1180,6 +1184,7 @@ BEGIN IDS_DEFAULT_NEWWINUAE "WinUAE default (new)" IDS_SOUND_CLONED51 "Cloned Stereo (5.1)" IDS_SOUND_51 "5.1 Channels" + IDS_AUTOMATIC "Automatic" END STRINGTABLE @@ -1213,7 +1218,7 @@ BEGIN IDS_SOUND_MONO "Mono" IDS_SOUND_MIXED "Mixed" IDS_SOUND_STEREO "Stereo" - IDS_SOUND_INTERPOL_DISABLED "Disabled" + IDS_DISABLED "Disabled" IDS_SOUND_FILTER_OFF "Always off" IDS_SOUND_FILTER_EMULATED "Emulated (A500)" END @@ -1328,6 +1333,8 @@ BEGIN IDS_NUMSG_EXPROMNEED "One of the following expansion boot ROMs is required:\n\n%s\n\nCheck the System ROM path in the Paths panel and click Rescan ROMs." IDS_HARDDRIVESAFETYWARNING2 "Warning: The drive safety check has been disabled, and non-empty and non-RDB partitioned hard disk(s) were detected." + IDS_SB_FAVORITENAME "Enter name..." + IDS_SB_CUSTOMEVENT "Enter custom event string.." END STRINGTABLE diff --git a/od-win32/sounddep/sound.c b/od-win32/sounddep/sound.c index 030fe7aa..140d0974 100755 --- a/od-win32/sounddep/sound.c +++ b/od-win32/sounddep/sound.c @@ -34,6 +34,9 @@ #include #include +#include +#include + #include #define ADJUST_SIZE 30 @@ -45,6 +48,7 @@ int sound_debug = 0; int sound_mode_skip = 0; +static int devicetype; static int obtainedfreq; static int have_sound; static int paused; @@ -69,9 +73,20 @@ static int num_sound_devices, num_record_devices; static LPDIRECTSOUND8 lpDS; static LPDIRECTSOUNDBUFFER8 lpDSBsecondary; - static DWORD writepos; + +#define AL_BUFFERS 2 +static ALCdevice *al_dev; +static ALCcontext *al_ctx; +static ALuint al_Buffers[AL_BUFFERS]; +static ALuint al_Source; +static int al_toggle; +static DWORD al_format; +static uae_u8 *al_bigbuffer; +static int al_bufsize, al_offset; + + int setup_sound (void) { sound_available = 1; @@ -103,7 +118,7 @@ void update_sound (int freq) } } -static void cleardsbuffer (void) +static void clearbuffer_ds (void) { void *buffer; DWORD size; @@ -120,6 +135,21 @@ static void cleardsbuffer (void) memset (buffer, 0, size); IDirectSoundBuffer_Unlock (lpDSBsecondary, buffer, size, NULL, 0); } +static void clearbuffer_al (void) +{ + int i; + for (i = 0; i < AL_BUFFERS; i++) { + alSourceUnqueueBuffers (al_Source, 1, &al_Buffers[i]); + } + alGetError (); +} +static void clearbuffer (void) +{ + if (devicetype == SOUND_DEVICE_AL) + clearbuffer_al (); + else if (devicetype == SOUND_DEVICE_DS) + clearbuffer_ds (); +} static void pause_audio_ds (void) { @@ -132,17 +162,27 @@ static void pause_audio_ds (void) hr = IDirectSoundBuffer_SetCurrentPosition (lpDSBsecondary, 0); if (FAILED (hr)) write_log ("SOUND: DirectSoundBuffer_SetCurretPosition failed, %s\n", DXError (hr)); - cleardsbuffer (); + clearbuffer (); } - static void resume_audio_ds (void) { paused = 0; - cleardsbuffer (); + clearbuffer (); + waiting_for_buffer = 1; +} +static void pause_audio_al (void) +{ + waiting_for_buffer = 0; + alSourcePause (al_Source); + clearbuffer (); +} +static void resume_audio_al (void) +{ waiting_for_buffer = 1; + al_offset = 0; } -static int restore (DWORD hr) +static int restore_ds (DWORD hr) { if (hr != DSERR_BUFFERLOST) return 0; @@ -172,7 +212,6 @@ static double getqpf (void) static void close_audio_ds (void) { - waiting_for_buffer = 0; if (lpDSBsecondary) IDirectSound_Release (lpDSBsecondary); lpDSBsecondary = 0; @@ -192,15 +231,21 @@ extern HWND hMainWnd; extern void setvolume_ahi(LONG); void set_volume (int volume, int mute) { - HRESULT hr; - LONG vol = DSBVOLUME_MIN; - - if (volume < 100 && !mute) - vol = (LONG)((DSBVOLUME_MIN / 2) + (-DSBVOLUME_MIN / 2) * log (1 + (2.718281828 - 1) * (1 - volume / 100.0))); - hr = IDirectSoundBuffer_SetVolume (lpDSBsecondary, vol); - if (FAILED (hr)) - write_log ("SOUND: SetVolume(%d) failed: %s\n", vol, DXError (hr)); - setvolume_ahi (vol); + if (devicetype == SOUND_DEVICE_AL) { + float vol = 0.0; + if (volume < 100 && !mute) + vol = (100 - volume) / 100.0; + alSourcef (al_Source, AL_GAIN, vol); + } else if (devicetype == SOUND_DEVICE_DS) { + HRESULT hr; + LONG vol = DSBVOLUME_MIN; + if (volume < 100 && !mute) + vol = (LONG)((DSBVOLUME_MIN / 2) + (-DSBVOLUME_MIN / 2) * log (1 + (2.718281828 - 1) * (1 - volume / 100.0))); + hr = IDirectSoundBuffer_SetVolume (lpDSBsecondary, vol); + if (FAILED (hr)) + write_log ("SOUND: SetVolume(%d) failed: %s\n", vol, DXError (hr)); + setvolume_ahi (vol); + } } static void recalc_offsets (void) @@ -283,6 +328,78 @@ DWORD fillsupportedmodes (LPDIRECTSOUND8 lpDS, int freq, struct dsaudiomodes *ds return speakerconfig; } +static void close_audio_al (void) +{ + int i; + + alDeleteSources (1, &al_Source); + al_Source = 0; + alDeleteBuffers (AL_BUFFERS, al_Buffers); + alcMakeContextCurrent (NULL); + if (al_ctx) + alcDestroyContext (al_ctx); + al_ctx = NULL; + if (al_dev) + alcCloseDevice (al_dev); + al_dev = NULL; + for (i = 0; i < AL_BUFFERS; i++) { + al_Buffers[i] = 0; + } + xfree (al_bigbuffer); + al_bigbuffer = NULL; +} + +static int open_audio_al (int size) +{ + int freq = currprefs.sound_freq; + int ch = get_audio_nativechannels(); + + devicetype = SOUND_DEVICE_AL; + size *= ch * 2; + sndbufsize = size / 8; + if (sndbufsize > SND_MAX_BUFFER) + sndbufsize = SND_MAX_BUFFER; + al_bufsize = size; + al_bigbuffer = xcalloc (al_bufsize, 1); + al_dev = alcOpenDevice (sound_devices[currprefs.win32_soundcard].name); + if (!al_dev) + goto error; + al_ctx = alcCreateContext (al_dev, NULL); + if (!al_ctx) + goto error; + alcMakeContextCurrent (al_ctx); + alGenBuffers (AL_BUFFERS, al_Buffers); + alGenSources (1, &al_Source); + al_toggle = 0; + al_format = 0; + switch (ch) + { + case 1: + al_format = AL_FORMAT_MONO16; + break; + case 2: + al_format = AL_FORMAT_STEREO16; + break; + case 4: + al_format = alGetEnumValue ("AL_FORMAT_QUAD16"); + break; + case 6: + al_format = alGetEnumValue ("AL_FORMAT_51CHN16"); + break; + } + if (al_format == 0) + goto error; + + write_log ("SOUND: %08X,CH=%d,FREQ=%d '%s' buffer %d (%d)\n", + al_format, ch, freq, sound_devices[currprefs.win32_soundcard].name, + sndbufsize, al_bufsize); + return 1; + +error: + close_audio_al (); + return 0; +} + static int open_audio_ds (int size) { HRESULT hr; @@ -295,7 +412,7 @@ static int open_audio_ds (int size) int round, i; DWORD speakerconfig; - enumerate_sound_devices (); + devicetype = SOUND_DEVICE_DS; size *= ch * 2; snd_configsize = size; sndbufsize = size / 32; @@ -315,7 +432,7 @@ static int open_audio_ds (int size) if (max_sndbufsize * 2 > dsoundbuf) max_sndbufsize = dsoundbuf / 2; - recalc_offsets(); + recalc_offsets (); hr = DirectSoundCreate8 (&sound_devices[currprefs.win32_soundcard].guid, &lpDS, NULL); if (FAILED (hr)) { @@ -422,16 +539,6 @@ static int open_audio_ds (int size) } IDirectSound_Release (pdsb); - set_volume (currprefs.sound_volume, mute); - cleardsbuffer (); - init_sound_table16 (); - if (get_audio_amigachannels() == 4) - sample_handler = sample16ss_handler; - else - sample_handler = get_audio_ismono () ? sample16_handler : sample16s_handler; - - obtainedfreq = currprefs.sound_freq; - return 1; error: @@ -457,10 +564,24 @@ static int open_sound (void) if (size < 512) size = 512; - ret = open_audio_ds (size); + enumerate_sound_devices (); + if (sound_devices[currprefs.win32_soundcard].type == SOUND_DEVICE_AL) + ret = open_audio_al (size); + else if (sound_devices[currprefs.win32_soundcard].type == SOUND_DEVICE_DS) + ret = open_audio_ds (size); if (!ret) return 0; + set_volume (currprefs.sound_volume, mute); + clearbuffer (); + init_sound_table16 (); + if (get_audio_amigachannels() == 4) + sample_handler = sample16ss_handler; + else + sample_handler = get_audio_ismono () ? sample16_handler : sample16s_handler; + + obtainedfreq = currprefs.sound_freq; + have_sound = 1; sound_available = 1; update_sound (fake_vblank_hz); @@ -477,7 +598,10 @@ void close_sound (void) if (! have_sound) return; pause_sound (); - close_audio_ds (); + if (devicetype == SOUND_DEVICE_AL) + close_audio_al (); + else if (devicetype == SOUND_DEVICE_DS) + close_audio_ds (); have_sound = 0; } @@ -506,8 +630,11 @@ void pause_sound (void) paused = 1; if (!have_sound) return; - pause_audio_ds (); - cleardsbuffer (); + if (devicetype == SOUND_DEVICE_AL) + pause_audio_al (); + else if (devicetype == SOUND_DEVICE_DS) + pause_audio_ds (); + clearbuffer (); } void resume_sound (void) @@ -516,15 +643,18 @@ void resume_sound (void) return; if (!have_sound) return; - cleardsbuffer (); - resume_audio_ds (); + clearbuffer (); + if (devicetype == SOUND_DEVICE_AL) + resume_audio_al (); + else if (devicetype == SOUND_DEVICE_DS) + resume_audio_ds (); } void reset_sound (void) { if (!have_sound) return; - cleardsbuffer (); + clearbuffer (); } #ifdef JIT @@ -566,6 +696,8 @@ void restart_sound_buffer (void) DWORD playpos, safed; HRESULT hr; + if (devicetype != SOUND_DEVICE_DS) + return; if (waiting_for_buffer != -1) return; hr = IDirectSoundBuffer_GetCurrentPosition (lpDSBsecondary, &playpos, &safed); @@ -579,6 +711,125 @@ void restart_sound_buffer (void) cf (writepos); } +static int alcheck (int v) +{ + int err = alGetError (); + if (err != AL_NO_ERROR) { + int v1, v2, v3; + alGetSourcei (al_Source, AL_BUFFERS_PROCESSED, &v1); + alGetSourcei (al_Source, AL_BUFFERS_QUEUED, &v2); + alGetSourcei (al_Source, AL_SOURCE_STATE, &v3); + write_log ("OpenAL %d: error %d. PROC=%d QUEUE=%d STATE=%d\n", v, err, v1, v2, v3); + return 1; + } + return 0; +} + +static void finish_sound_buffer_al (void) +{ + static int tfprev; + static int statuscnt; + int v, v2; + double m, skipmode; + + if (!waiting_for_buffer) + return; + if (savestate_state) + return; + + if (statuscnt > 0) { + statuscnt--; + if (statuscnt == 0) + gui_data.sndbuf_status = 0; + } + if (gui_data.sndbuf_status == 3) + gui_data.sndbuf_status = 0; + alGetError (); + + memcpy (al_bigbuffer + al_offset, sndbuffer, sndbufsize); + al_offset += sndbufsize; + if (al_offset >= al_bufsize) { + alGetSourcei (al_Source, AL_BUFFERS_PROCESSED, &v); + while (v == 0 && waiting_for_buffer < 0) { + sleep_millis (1); + alGetSourcei (al_Source, AL_SOURCE_STATE, &v); + if (v != AL_PLAYING) + break; + alGetSourcei (al_Source, AL_BUFFERS_PROCESSED, &v); + } + + alSourceUnqueueBuffers (al_Source, 1, &al_Buffers[al_toggle]); + alGetError (); + alBufferData (al_Buffers[al_toggle], al_format, al_bigbuffer, al_bufsize, currprefs.sound_freq); + alcheck(4); + alSourceQueueBuffers (al_Source, 1, &al_Buffers[al_toggle]); + alcheck(2); + al_toggle++; + if (al_toggle >= AL_BUFFERS) + al_toggle = 0; + + alGetSourcei (al_Source, AL_BUFFERS_QUEUED, &v2); + alGetSourcei (al_Source, AL_SOURCE_STATE, &v); + alcheck(3); + if (v != AL_PLAYING && v2 >= AL_BUFFERS) { + if (waiting_for_buffer > 0) { + write_log ("AL SOUND PLAY!\n"); + alSourcePlay (al_Source); + waiting_for_buffer = -1; + tfprev = timeframes + 10; + tfprev = (tfprev / 10) * 10; + } else { + gui_data.sndbuf_status = 2; + statuscnt = SND_STATUSCNT; + write_log ("AL underflow\n"); + clearbuffer (); + waiting_for_buffer = 1; + } + } + al_offset = 0; + } + alcheck(1); + + alGetSourcei (al_Source, AL_SOURCE_STATE, &v); + if (v == AL_PLAYING) { + alGetSourcei (al_Source, AL_BYTE_OFFSET, &v); + v -= al_offset; + gui_data.sndbuf = 100 * v / sndbufsize; + m = gui_data.sndbuf / 100.0; + + if (isvsync ()) { + + skipmode = pow (m < 0 ? -m : m, EXP) / 8; + if (m < 0) + skipmode = -skipmode; + if (skipmode < -ADJUST_VSSIZE) + skipmode = -ADJUST_VSSIZE; + if (skipmode > ADJUST_VSSIZE) + skipmode = ADJUST_VSSIZE; + + } else { + + skipmode = pow (m < 0 ? -m : m, EXP) / 2; + if (m < 0) + skipmode = -skipmode; + if (skipmode < -ADJUST_SIZE) + skipmode = -ADJUST_SIZE; + if (skipmode > ADJUST_SIZE) + skipmode = ADJUST_SIZE; + + } + if (tfprev != timeframes) { + if ((0 || sound_debug) && !(tfprev % 10)) + write_log ("s=%+02.1f\n", skipmode); + tfprev = timeframes; + if (!avioutput_audio) + sound_setadjust (skipmode); + } + } + + alcheck (0); +} + static void finish_sound_buffer_ds (void) { static int tfprev; @@ -608,14 +859,14 @@ static void finish_sound_buffer_ds (void) hr = IDirectSoundBuffer_Play (lpDSBsecondary, 0, 0, DSBPLAY_LOOPING); if (FAILED (hr)) { write_log ("SOUND: Play failed: %s\n", DXError (hr)); - restore (DSERR_BUFFERLOST); + restore_ds (DSERR_BUFFERLOST); waiting_for_buffer = 0; return; } hr = IDirectSoundBuffer_SetCurrentPosition (lpDSBsecondary, 0); if (FAILED (hr)) { write_log ("SOUND: 1st SetCurrentPosition failed: %s\n", DXError (hr)); - restore (DSERR_BUFFERLOST); + restore_ds (DSERR_BUFFERLOST); waiting_for_buffer = 0; return; } @@ -662,23 +913,23 @@ static void finish_sound_buffer_ds (void) hr = IDirectSoundBuffer_GetStatus (lpDSBsecondary, &status); if (FAILED (hr)) { write_log ("SOUND: GetStatus() failed: %s\n", DXError (hr)); - restore (DSERR_BUFFERLOST); + restore_ds (DSERR_BUFFERLOST); return; } if (status & DSBSTATUS_BUFFERLOST) { write_log ("SOUND: buffer lost\n"); - restore (DSERR_BUFFERLOST); + restore_ds (DSERR_BUFFERLOST); return; } if ((status & (DSBSTATUS_PLAYING | DSBSTATUS_LOOPING)) != (DSBSTATUS_PLAYING | DSBSTATUS_LOOPING)) { write_log ("SOUND: status = %08X\n", status); - restore (DSERR_BUFFERLOST); + restore_ds (DSERR_BUFFERLOST); return; } for (;;) { hr = IDirectSoundBuffer_GetCurrentPosition (lpDSBsecondary, &playpos, &safepos); if (FAILED (hr)) { - restore (hr); + restore_ds (hr); write_log ("SOUND: GetCurrentPosition failed: %s\n", DXError (hr)); return; } @@ -723,7 +974,7 @@ static void finish_sound_buffer_ds (void) counter--; if (counter < 0) { write_log ("SOUND: sound system got stuck!?\n"); - restore (DSERR_BUFFERLOST); + restore_ds (DSERR_BUFFERLOST); return; } continue; @@ -732,7 +983,7 @@ static void finish_sound_buffer_ds (void) } hr = IDirectSoundBuffer_Lock (lpDSBsecondary, writepos, sndbufsize, &b1, &s1, &b2, &s2, 0); - if (restore (hr)) + if (restore_ds (hr)) return; if (FAILED (hr)) { write_log ("SOUND: lock failed: %s (%d %d)\n", DXError (hr), writepos / samplesize, sndbufsize / samplesize); @@ -828,7 +1079,11 @@ void finish_sound_buffer (void) #endif if (!have_sound) return; - finish_sound_buffer_ds (); + + if (devicetype == SOUND_DEVICE_AL) + finish_sound_buffer_al (); + else if (devicetype == SOUND_DEVICE_DS) + finish_sound_buffer_ds (); } static BOOL CALLBACK DSEnumProc (LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext) @@ -845,14 +1100,54 @@ static BOOL CALLBACK DSEnumProc (LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDr if (lpGUID != NULL) memcpy (&sd[i].guid, lpGUID, sizeof (GUID)); sd[i].name = my_strdup (lpszDesc); + sd[i].type = SOUND_DEVICE_DS; return TRUE; } int enumerate_sound_devices (void) { if (!num_sound_devices) { + HMODULE l = NULL; DirectSoundEnumerate ((LPDSENUMCALLBACK)DSEnumProc, sound_devices); DirectSoundCaptureEnumerate ((LPDSENUMCALLBACK)DSEnumProc, record_devices); + l = LoadLibrary ("openal32.dll"); + if (l != NULL) { + FreeLibrary (l); + if (alcIsExtensionPresent (NULL, "ALC_ENUMERATION_EXT")) { + const ALchar* pDeviceNames = alcGetString (NULL, ALC_DEVICE_SPECIFIER); + const ALchar* ppDefaultDevice = alcGetString (NULL, ALC_DEFAULT_DEVICE_SPECIFIER); + while (pDeviceNames && *pDeviceNames) { + struct sound_device *sd; + ALCdevice *pDevice; + int i; + for (i = 0; i < MAX_SOUND_DEVICES; i++) { + sd = &sound_devices[i]; + if (sd->name == NULL) + break; + } + if (i >= MAX_SOUND_DEVICES) + break; + pDevice = alcOpenDevice (pDeviceNames); + if (pDevice) { + ALCcontext *context = alcCreateContext (pDevice, NULL); + if (context) { + ALint iMajorVersion = 0, iMinorVersion = 0; + alcMakeContextCurrent (context); + alcGetIntegerv (pDevice, ALC_MAJOR_VERSION, sizeof (ALint), &iMajorVersion); + alcGetIntegerv (pDevice, ALC_MINOR_VERSION, sizeof (ALint), &iMinorVersion); + if (iMajorVersion > 1 || (iMajorVersion == 1 && iMinorVersion > 0)) { + sd->type = SOUND_DEVICE_AL; + sd->name = my_strdup (pDeviceNames); + } + alcMakeContextCurrent (NULL); + alcDestroyContext (context); + } + alcCloseDevice (pDevice); + } + pDeviceNames += strlen (pDeviceNames) + 1; + } + } + } for (num_sound_devices = 0; num_sound_devices < MAX_SOUND_DEVICES; num_sound_devices++) { if (sound_devices[num_sound_devices].name == NULL) break; @@ -924,7 +1219,7 @@ static int setget_master_volume_vista (int setvolume, int *volume, int *mute) return ok == 2; } -static void mcierr(char *str, DWORD err) +static void mcierr (char *str, DWORD err) { char es[1000]; if (err == MMSYSERR_NOERROR) diff --git a/od-win32/win32.c b/od-win32/win32.c index 22d2ad9b..606b0f8e 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -1970,15 +1970,15 @@ void target_save_options (struct zfile *f, struct uae_prefs *p) cfgfile_target_dwrite (f, "ctrl_f11_is_quit=%s\n", p->win32_ctrl_F11_is_quit ? "true" : "false"); cfgfile_target_dwrite (f, "midiout_device=%d\n", p->win32_midioutdev ); cfgfile_target_dwrite (f, "midiin_device=%d\n", p->win32_midiindev ); - cfgfile_target_dwrite (f, "rtg_match_depth=%s\n", p->win32_rtgmatchdepth ? "true" : "false" ); - cfgfile_target_dwrite (f, "rtg_scale_small=%s\n", p->win32_rtgscaleifsmall ? "true" : "false" ); - cfgfile_target_dwrite (f, "rtg_scale_allow=%s\n", p->win32_rtgallowscaling ? "true" : "false" ); + cfgfile_target_dwrite (f, "rtg_match_depth=%s\n", p->win32_rtgmatchdepth ? "true" : "false"); + cfgfile_target_dwrite (f, "rtg_scale_small=%s\n", p->win32_rtgscaleifsmall ? "true" : "false"); + cfgfile_target_dwrite (f, "rtg_scale_allow=%s\n", p->win32_rtgallowscaling ? "true" : "false"); cfgfile_target_dwrite (f, "rtg_scale_aspect_ratio=%d:%d\n", p->win32_rtgscaleaspectratio >= 0 ? (p->win32_rtgscaleaspectratio >> 8) : -1, p->win32_rtgscaleaspectratio >= 0 ? (p->win32_rtgscaleaspectratio & 0xff) : -1); - cfgfile_target_dwrite (f, "borderless=%s\n", p->win32_borderless ? "true" : "false" ); + cfgfile_target_dwrite (f, "borderless=%s\n", p->win32_borderless ? "true" : "false"); cfgfile_target_dwrite (f, "uaescsimode=%s\n", scsimode[p->win32_uaescsimode]); - cfgfile_target_dwrite (f, "soundcard=%d\n", p->win32_soundcard ); + cfgfile_target_dwrite (f, "soundcard=%d\n", p->win32_soundcard); cfgfile_target_dwrite (f, "cpu_idle=%d\n", p->cpu_idle); cfgfile_target_dwrite (f, "notaskbarbutton=%s\n", p->win32_notaskbarbutton ? "true" : "false"); cfgfile_target_dwrite (f, "always_on_top=%s\n", p->win32_alwaysontop ? "true" : "false"); @@ -3214,7 +3214,7 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR if (WIN32_RegisterClasses () && WIN32_InitLibraries () && DirectDraw_Start (NULL)) { DEVMODE devmode; - DWORD i = 0; + DWORD i; DirectDraw_Release (); write_log ("Enumerating display devices.. \n"); @@ -3222,8 +3222,11 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR write_log ("Sorting devices and modes..\n"); sortdisplays (); write_log ("Display buffer mode = %d\n", ddforceram); + write_log ("Enumerating sound devices:\n"); + for (i = 0; i < enumerate_sound_devices (); i++) { + write_log ("%d:%s: %s\n", i, sound_devices[i].type == SOUND_DEVICE_DS ? "DS" : "AL", sound_devices[i].name); + } write_log ("done\n"); - memset (&devmode, 0, sizeof(devmode)); devmode.dmSize = sizeof (DEVMODE); if (EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &devmode)) { diff --git a/od-win32/win32.h b/od-win32/win32.h index 085abf2e..f231125e 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,9 +15,9 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEBETA 0 -#define WINUAEPUBLICBETA 0 -#define WINUAEDATE MAKEBD(2008, 8, 12) +#define WINUAEBETA 1 +#define WINUAEPUBLICBETA 1 +#define WINUAEDATE MAKEBD(2008, 8, 17) #define WINUAEEXTRA "" #define WINUAEREV "" @@ -139,11 +139,14 @@ extern void logging_cleanup (void); extern LONG WINAPI WIN32_ExceptionFilter (struct _EXCEPTION_POINTERS *pExceptionPointers, DWORD ec); -#define MAX_SOUND_DEVICES 10 +#define MAX_SOUND_DEVICES 20 +#define SOUND_DEVICE_DS 1 +#define SOUND_DEVICE_AL 2 struct sound_device { GUID guid; char *name; + int type; }; extern struct sound_device sound_devices[MAX_SOUND_DEVICES]; extern struct sound_device record_devices[MAX_SOUND_DEVICES]; diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index e1c4c5e3..0fd09e0e 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -1706,7 +1706,7 @@ static void createstatuswindow (void) lpParts = LocalLock (hloc); /* Calculate the right edge coordinate for each part, and copy the coords * to the array. */ - lpParts[0] = rc.right - (drive_width * 4) - power_width - idle_width - fps_width - cd_width - hd_width - snd_width - 2; + lpParts[0] = rc.right - (drive_width * 4) - power_width - idle_width - fps_width - cd_width - hd_width - snd_width - 16; lpParts[1] = lpParts[0] + snd_width; lpParts[2] = lpParts[1] + idle_width; lpParts[3] = lpParts[2] + fps_width; @@ -1721,7 +1721,7 @@ static void createstatuswindow (void) window_led_drives_end = lpParts[10]; /* Create the parts */ - SendMessage (hStatusWnd, SB_SETPARTS, (WPARAM) num_parts, (LPARAM) lpParts); + SendMessage (hStatusWnd, SB_SETPARTS, (WPARAM)num_parts, (LPARAM)lpParts); LocalUnlock (hloc); LocalFree (hloc); } diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index b0a9d917..cec27c43 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -6720,7 +6720,8 @@ static void values_to_sounddlg (HWND hDlg) sprintf (txt, "%d", workprefs.sound_freq); SendDlgItemMessage (hDlg, IDC_SOUNDFREQ, WM_SETTEXT, 0, (LPARAM)txt); - switch (workprefs.produce_sound) { + switch (workprefs.produce_sound) + { case 0: which_button = IDC_SOUND0; break; case 1: which_button = IDC_SOUND1; break; case 2: which_button = IDC_SOUND2; break; @@ -6887,6 +6888,8 @@ static INT_PTR CALLBACK SoundDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM switch (msg) { case WM_INITDIALOG: + { + int gotnonds = 0; sound_loaddrivesamples (); SendDlgItemMessage (hDlg, IDC_SOUNDBUFFERRAM, TBM_SETRANGE, TRUE, MAKELONG (MIN_SOUND_MEM, MAX_SOUND_MEM)); SendDlgItemMessage (hDlg, IDC_SOUNDBUFFERRAM, TBM_SETPAGESIZE, 0, 1); @@ -6902,14 +6905,24 @@ static INT_PTR CALLBACK SoundDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM SendDlgItemMessage (hDlg, IDC_SOUNDCARDLIST, CB_RESETCONTENT, 0, 0L); numdevs = enumerate_sound_devices (); - for (card = 0; card < numdevs; card++) - SendDlgItemMessage (hDlg, IDC_SOUNDCARDLIST, CB_ADDSTRING, 0, (LPARAM)sound_devices[card].name); + for (card = 0; card < numdevs; card++) { + if (sound_devices[card].type != SOUND_DEVICE_DS) + gotnonds = 1; + } + for (card = 0; card < numdevs; card++) { + char tmp[MAX_DPATH]; + if (gotnonds) + sprintf (tmp, "%s: %s", sound_devices[card].type == SOUND_DEVICE_DS ? "DS" : "AL", sound_devices[card].name); + else + strcpy (tmp, sound_devices[card].name); + SendDlgItemMessage (hDlg, IDC_SOUNDCARDLIST, CB_ADDSTRING, 0, (LPARAM)tmp); + } if (numdevs == 0) workprefs.produce_sound = 0; /* No sound card in system, enable_for_sounddlg will accomodate this */ pages[SOUND_ID] = hDlg; currentpage = SOUND_ID; - + } case WM_USER: recursive++; values_to_sounddlg (hDlg); diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index b0fc9cf3..8535eca8 100755 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -300,14 +300,14 @@ /> + + diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 74d6a97d..67db2547 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,5 +1,23 @@ -Final +Beta 1: (crashing bug = this will be quick beta series, really!) + +- 4th floppy drive track display number was clipped in windowed mode +- non-vsync RTG mode run in "warp"-mode if native mode was set to + fullscreen+vsync +- USB "non-friendly" name buffer overflow, caused random crashes + and weird behavior.. (1.5.1) +- OpenAL sound support (experimental, OpenAL may be better API for + new AHI driver than DSound) Note that OpenAL uses internally + DirectSound if sound card does not have native OpenAL support. + "Generic Hardware" = DSound wrapper, "Generic Software" = WaveOut + wrapper (really bad), something else = native support. OpenAL sound + devices only available if OpenAL is installed. DO NOT ASK something + like "What is OpenAL". Learn to use search engines first or ignore + this feature. +- sprite garbage was possible if sprite(s) active during resolution + change from higher to lower resolution (AGA only) (1.5.0) + +Final 1.5.1 - compiled with August 2008 DXSDK, shader files modified (old ones are not compatible anymore) D3D filter now requires August 2008 or newer