diff --git a/src/akiko.c b/src/akiko.c index 6204106..ea5d675 100644 --- a/src/akiko.c +++ b/src/akiko.c @@ -567,7 +567,7 @@ static int statusfunc (int status) if (status == -1) return 0; if (status == -2) - return 150; + return 10; if (cdrom_audiostatus != status) { if (status == AUDIO_STATUS_IN_PROGRESS) { cdrom_playing = 1; diff --git a/src/audio.c b/src/audio.c index e659c9f..79f5db8 100644 --- a/src/audio.c +++ b/src/audio.c @@ -45,6 +45,7 @@ #define MAX_EV ~0u #define DEBUG_AUDIO 0 +#define DEBUG_AUDIO_HACK 0 #define DEBUG_CHANNEL_MASK 15 #define TEST_AUDIO 0 @@ -58,7 +59,7 @@ STATIC_INLINE bool isaudio (void) return currprefs.produce_sound != 0; } -#if DEBUG_AUDIO > 0 +#if DEBUG_AUDIO > 0 || DEBUG_AUDIO_HACK > 0 static bool debugchannel (int ch) { return ((1 << ch) & DEBUG_CHANNEL_MASK) != 0; @@ -328,9 +329,7 @@ STATIC_INLINE int FINISH_DATA (int data, int bits) data >>= bits - 16; } else { int shift = 16 - bits; - int right = data & ((1 << shift) - 1); data <<= shift; - data |= right; } return data; } @@ -1310,7 +1309,7 @@ static void audio_state_channel2 (int nr, bool perfin) if ((cdp->state == 2 || cdp->state == 3) && usehacks1 () && !chan_ena && old_dma) { // DMA switched off, state=2/3 and "too fast CPU": kill DMA instantly // or CPU timed DMA wait routines in common tracker players will lose notes -#if DEBUG_AUDIO > 0 +#if DEBUG_AUDIO_HACK > 0 if (debugchannel (nr)) write_log (_T("%d: INSTADMAOFF\n"), nr, M68K_GETPC); #endif @@ -1907,13 +1906,17 @@ void AUDxLCH (int nr, uae_u16 v) if (usehacks1 () && ((cdp->ptx_tofetch && cdp->state == 1) || cdp->ptx_written)) { cdp->ptx = cdp->lc; cdp->ptx_written = true; +#if DEBUG_AUDIO_HACK > 0 + if (debugchannel (nr)) + write_log (_T("AUD%dLCH HACK: %04X %08X (%d) (%d %d %08x)\n"), nr, v, M68K_GETPC, cdp->state, cdp->dsr, cdp->ptx_written, cdp->ptx); +#endif } else { cdp->lc = (cdp->lc & 0xffff) | ((uae_u32)v << 16); - } #if DEBUG_AUDIO > 0 if (debugchannel (nr)) write_log (_T("AUD%dLCH: %04X %08X (%d) (%d %d %08x)\n"), nr, v, M68K_GETPC, cdp->state, cdp->dsr, cdp->ptx_written, cdp->ptx); #endif + } } void AUDxLCL (int nr, uae_u16 v) @@ -1924,13 +1927,17 @@ void AUDxLCL (int nr, uae_u16 v) if (usehacks1 () && ((cdp->ptx_tofetch && cdp->state == 1) || cdp->ptx_written)) { cdp->ptx = cdp->lc; cdp->ptx_written = true; +#if DEBUG_AUDIO_HACK > 0 + if (debugchannel (nr)) + write_log (_T("AUD%dLCL HACK: %04X %08X (%d) (%d %d %08x)\n"), nr, v, M68K_GETPC, cdp->state, cdp->dsr, cdp->ptx_written, cdp->ptx); +#endif } else { cdp->lc = (cdp->lc & ~0xffff) | (v & 0xFFFE); - } #if DEBUG_AUDIO > 0 if (debugchannel (nr)) write_log (_T("AUD%dLCL: %04X %08X (%d) (%d %d %08x)\n"), nr, v, M68K_GETPC, cdp->state, cdp->dsr, cdp->ptx_written, cdp->ptx); #endif + } } void AUDxPER (int nr, uae_u16 v) @@ -1949,8 +1956,10 @@ void AUDxPER (int nr, uae_u16 v) /* smaller values would cause extremely high cpu usage */ per = PERIOD_MIN * CYCLE_UNIT; } - if (per < PERIOD_MIN_NONCE * CYCLE_UNIT && !currprefs.cpu_cycle_exact && (cdp->dmaenstore || cdp->state == 0)) { - /* DMAL emulation and low period can cause very very high cpu usage on slow performance PCs */ + if (per < PERIOD_MIN_NONCE * CYCLE_UNIT && !currprefs.cpu_cycle_exact && cdp->dmaenstore) { + /* DMAL emulation and low period can cause very very high cpu usage on slow performance PCs + * Only do this hack if audio DMA is active. + */ per = PERIOD_MIN_NONCE * CYCLE_UNIT; } diff --git a/src/cfgfile.c b/src/cfgfile.c index b266f86..24a7987 100644 --- a/src/cfgfile.c +++ b/src/cfgfile.c @@ -203,6 +203,8 @@ static const TCHAR *specialmonitors[] = { _T("none"), _T("autodetect"), _T("a202 static const TCHAR *rtgtype[] = { _T("ZorroII"), _T("ZorroIII"), 0 }; static const TCHAR *waitblits[] = { _T("disabled"), _T("automatic"), _T("noidleonly"), _T("always"), 0 }; static const TCHAR *autoext2[] = { _T("disabled"), _T("copy"), _T("replace"), 0 }; +static const TCHAR *leds[] = { _T("power"), _T("df0"), _T("df1"), _T("df2"), _T("df3"), _T("hd"), _T("cd"), _T("fps"), _T("cpu"), _T("snd"), _T("md"), 0 }; +static int leds_order[] = { 3, 6, 7, 8, 9, 4, 5, 2, 1, 0, 9 }; static const TCHAR *obsolete[] = { _T("accuracy"), _T("gfx_opengl"), _T("gfx_32bit_blits"), _T("32bit_blits"), @@ -589,6 +591,30 @@ static void write_compatibility_cpu (struct zfile *f, struct uae_prefs *p) cfgfile_write (f, _T("cpu_type"), tmp); } +static void write_leds (struct zfile *f, const TCHAR *name, int mask) +{ + TCHAR tmp[MAX_DPATH]; + tmp[0] = 0; + for (int i = 0; leds[i]; i++) { + bool got = false; + for (int j = 0; leds[j]; j++) { + if (leds_order[j] == i) { + if (mask & (1 << j)) { + if (got) + _tcscat (tmp, _T(":")); + _tcscat (tmp, leds[j]); + got = true; + } + } + } + if (leds[i + 1] && got) + _tcscat (tmp, _T(",")); + } + while (tmp[0] && tmp[_tcslen (tmp) - 1] == ',') + tmp[_tcslen (tmp) - 1] = 0; + cfgfile_dwrite_str (f, name, tmp); +} + void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) { struct strlist *sl; @@ -947,13 +973,17 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write_bool (f, _T("ntsc"), p->ntscmode); cfgfile_write_bool (f, _T("genlock"), p->genlock); cfgfile_dwrite_str (f, _T("monitoremu"), specialmonitors[p->monitoremu]); + cfgfile_dwrite_bool (f, _T("show_leds"), !!(p->leds_on_screen & STATUSLINE_CHIPSET)); + cfgfile_dwrite_bool (f, _T("show_leds_rtg"), !!(p->leds_on_screen & STATUSLINE_RTG)); + write_leds(f, _T("show_leds_enabled"), p->leds_on_screen_mask[0]); + write_leds(f, _T("show_leds_enabled_rtg"), p->leds_on_screen_mask[1]); + if (p->osd_pos.y || p->osd_pos.x) { cfgfile_dwrite (f, _T("osd_position"), _T("%.1f%s:%.1f%s"), p->osd_pos.x >= 20000 ? (p->osd_pos.x - 30000) / 10.0 : (float)p->osd_pos.x, p->osd_pos.x >= 20000 ? _T("%") : _T(""), p->osd_pos.y >= 20000 ? (p->osd_pos.y - 30000) / 10.0 : (float)p->osd_pos.y, p->osd_pos.y >= 20000 ? _T("%") : _T("")); } - cfgfile_dwrite_bool (f, _T("show_leds_rtg"), !!(p->leds_on_screen & STATUSLINE_RTG)); cfgfile_dwrite (f, _T("keyboard_leds"), _T("numlock:%s,capslock:%s,scrolllock:%s"), kbleds[p->keyboard_leds[0]], kbleds[p->keyboard_leds[1]], kbleds[p->keyboard_leds[2]]); if (p->chipset_mask & CSMASK_AGA) @@ -1064,6 +1094,10 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write_bool (f, _T("gfxcard_hardware_sprite"), p->rtg_hardwaresprite); cfgfile_write (f, _T("chipmem_size"), _T("%d"), p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000)); cfgfile_dwrite (f, _T("megachipmem_size"), _T("%d"), p->z3chipmem_size / 0x100000); + if (p->custom_memory_sizes[0]) + cfgfile_write (f, _T("addmem1"), _T("0x%x,0x%x"), p->custom_memory_addrs[0], p->custom_memory_sizes[0]); + if (p->custom_memory_sizes[1]) + cfgfile_write (f, _T("addmem2"), _T("0x%x,0x%x"), p->custom_memory_addrs[1], p->custom_memory_sizes[1]); if (p->m68k_speed > 0) { cfgfile_write (f, _T("finegrain_cpu_speed"), _T("%d"), p->m68k_speed); @@ -1575,6 +1609,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_string (option, value, _T("gfx_filter_mask"), p->gfx_filtermask, sizeof p->gfx_filtermask / sizeof (TCHAR)) || cfgfile_intval (option, value, _T("filesys_max_size"), &p->filesys_limit, 1) + || cfgfile_intval (option, value, _T("rtg_vert_zoom_mult"), &p->rtg_vert_zoom_mult, 1) + || cfgfile_intval (option, value, _T("rtg_horiz_zoom_mult"), &p->rtg_horiz_zoom_mult, 1) #endif #ifdef DRIVESOUND || cfgfile_intval (option, value, _T("floppy0sound"), &p->floppyslots[0].dfxclick, 1) @@ -1724,6 +1760,31 @@ cfgfile_path (option, value, _T("floppy0soundext"), p->floppyslots[0].dfxclickex p->leds_on_screen &= ~STATUSLINE_RTG; return 1; } + if (_tcscmp (option, _T("show_leds_enabled")) == 0 || _tcscmp (option, _T("show_leds_enabled_rtg")) == 0) { + TCHAR tmp[MAX_DPATH]; + int idx = _tcscmp (option, _T("show_leds_enabled")) == 0 ? 0 : 1; + p->leds_on_screen_mask[idx] = 0; + _tcscpy (tmp, value); + _tcscat (tmp, _T(",")); + TCHAR *s = tmp; + for (;;) { + TCHAR *s2 = s; + TCHAR *s3 = _tcschr (s, ':'); + s = _tcschr (s, ','); + if (!s) + break; + if (s3 && s3 < s) + s = s3; + *s = 0; + for (int i = 0; leds[i]; i++) { + if (!_tcsicmp (s2, leds[i])) { + p->leds_on_screen_mask[idx] |= 1 << i; + } + } + s++; + } + return 1; + } if (!_tcscmp (option, _T("osd_position"))) { TCHAR *s = value; @@ -4353,6 +4414,7 @@ void default_prefs (struct uae_prefs *p, int type) p->waiting_blits = 0; p->collision_level = 2; p->leds_on_screen = 0; + p->leds_on_screen_mask[0] = p->leds_on_screen_mask[1] = (1 << LED_MAX) - 1; p->keyboard_leds_in_use = 0; p->keyboard_leds[0] = p->keyboard_leds[1] = p->keyboard_leds[2] = 0; p->scsi = 0; @@ -4409,6 +4471,9 @@ void default_prefs (struct uae_prefs *p, int type) p->gfx_filteroverlay_overscan = 0; #endif + p->rtg_horiz_zoom_mult = 1000; + p->rtg_vert_zoom_mult = 1000; + _tcscpy (p->floppyslots[0].df, _T("df0.adf")); _tcscpy (p->floppyslots[1].df, _T("df1.adf")); _tcscpy (p->floppyslots[2].df, _T("df2.adf")); diff --git a/src/include/options.h b/src/include/options.h index fe8ece6..4a043a8 100644 --- a/src/include/options.h +++ b/src/include/options.h @@ -316,6 +316,9 @@ struct uae_prefs { int gfx_filter_autoscale; int gfx_filter_keep_autoscale_aspect; + int rtg_horiz_zoom_mult; + int rtg_vert_zoom_mult; + bool immediate_blits; int waiting_blits; unsigned int chipset_mask; @@ -327,6 +330,7 @@ struct uae_prefs { int cr_selected; int collision_level; int leds_on_screen; + int leds_on_screen_mask[2]; struct wh osd_pos; int keyboard_leds[3]; bool keyboard_leds_in_use; diff --git a/src/inputdevice.c b/src/inputdevice.c index 7151d71..1215f8b 100644 --- a/src/inputdevice.c +++ b/src/inputdevice.c @@ -6187,7 +6187,7 @@ void inputdevice_testrecord (int type, int num, int wtype, int wnum, int state, j++; } if (j >= MAX_INPUT_DEVICE_EVENTS || na->extra[j] < 0) - type = -1; + return; } } // wait until previous event is released before accepting new ones @@ -6260,7 +6260,10 @@ int inputdevice_testread (int *devnum, int *wtype, int *state, bool doread) testmode_count--; struct teststore *ts = &testmode_data[testmode_count]; *devnum = getdevnum (ts->testmode_type, ts->testmode_num); - *wtype = idev[ts->testmode_type].get_widget_first (ts->testmode_num, ts->testmode_wtype) + ts->testmode_wnum; + if (ts->testmode_wnum >= 0 && ts->testmode_wnum < MAX_INPUT_DEVICE_EVENTS) + *wtype = idev[ts->testmode_type].get_widget_first (ts->testmode_num, ts->testmode_wtype) + ts->testmode_wnum; + else + *wtype = ts->testmode_wnum; *state = ts->testmode_state; if (ts->testmode_state) memcpy (&testmode_wait[testmode_count], ts, sizeof (struct teststore)); diff --git a/src/picasso96.c b/src/picasso96.c index 6b7b56b..e0ebfd5 100644 --- a/src/picasso96.c +++ b/src/picasso96.c @@ -3809,7 +3809,8 @@ static bool flushpixels (void) lock = 1; } if (dst) { - statusline (dst); + if (!(currprefs.leds_on_screen & STATUSLINE_TARGET)) + statusline (dst); maxy = picasso_vidinfo.height; if (miny > picasso_vidinfo.height - TD_TOTAL_HEIGHT) miny = picasso_vidinfo.height - TD_TOTAL_HEIGHT; diff --git a/src/statusline.c b/src/statusline.c index 3fbf04f..25dee5a 100644 --- a/src/statusline.c +++ b/src/statusline.c @@ -95,6 +95,9 @@ void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u xcolnr on_rgb, on_rgb2, off_rgb, pen_rgb; int half = 0; + if (!(currprefs.leds_on_screen_mask[picasso_on ? 1 : 0] & (1 << led))) + continue; + pen_rgb = c1; if (led >= LED_DF0 && led <= LED_DF3) { int pled = led - LED_DF0;