From: Toni Wilen Date: Fri, 26 Sep 2008 15:59:46 +0000 (+0300) Subject: imported winuaesrc1530b01.zip X-Git-Tag: 2100~120 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=2bb38ac185d62e666337a8a90400442bd0a2686d;p=francis%2Fwinuae.git imported winuaesrc1530b01.zip --- diff --git a/akiko.c b/akiko.c index db86e8bb..3cc9dd0b 100755 --- a/akiko.c +++ b/akiko.c @@ -697,6 +697,9 @@ static void cdrom_return_data (int len) static int cdrom_command_something (void) { + int v = cdrom_command_buffer[1]; + if (v & 0x80) + return 1; return 0; } @@ -884,7 +887,7 @@ static void cdrom_run_command_run (void) int len; cdrom_command_offset_complete = (cdrom_command_offset_complete + cdrom_command_length + 1) & 0xff; - memset (cdrom_result_buffer, 0, sizeof(cdrom_result_buffer)); + memset (cdrom_result_buffer, 0, sizeof (cdrom_result_buffer)); switch (cdrom_command & 0x0f) { case 2: diff --git a/audio.c b/audio.c index 7b0a3a3e..2e20164e 100755 --- a/audio.c +++ b/audio.c @@ -1116,7 +1116,7 @@ static void state23 (struct audio_channel_data *cdp) cdp->pt = cdp->lc; cdp->intreq2 = 1; if (sampleripper_enabled) - do_samplerip(cdp); + do_samplerip (cdp); #ifdef DEBUG_AUDIO if (debugchannel (cdp - audio_channel)) write_log ("Channel %d looped, LC=%08X LEN=%d\n", cdp - audio_channel, cdp->pt, cdp->wlen); @@ -1135,7 +1135,7 @@ static void audio_handler (int nr) int napnav = (!audav && !audap) || audav; int evtime = cdp->evtime; - audio_activate(); + audio_activate (); cdp->evtime = MAX_EV; switch (cdp->state) { @@ -1568,21 +1568,21 @@ void audio_hsync (int dmaaction) int nr, handle; static int old_dma; - if (!isaudio()) + if (!isaudio ()) return; if (old_dma != (dmacon & (DMA_MASTER | 15))) { old_dma = dmacon & (DMA_MASTER | 15); - audio_activate(); + audio_activate (); } if (audio_work_to_do > 0 && currprefs.sound_auto) { audio_work_to_do--; if (audio_work_to_do == 0) - audio_deactivate(); + audio_deactivate (); } - if (!is_audio_active()) + if (!is_audio_active ()) return; update_audio (); @@ -1603,7 +1603,7 @@ void audio_hsync (int dmaaction) if (cdp->state == 5) { cdp->pt = cdp->lc; if (sampleripper_enabled) - do_samplerip(cdp); + do_samplerip (cdp); #ifdef DEBUG_AUDIO if (debugchannel (nr)) write_log ("%d:>5: LEN=%d PT=%08X\n", nr, cdp->wlen, cdp->pt); diff --git a/cfgfile.c b/cfgfile.c index 34f73a3a..20c1570a 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -3220,7 +3220,6 @@ static int bip_a3000 (struct uae_prefs *p, int config, int compa, int romcheck) p->produce_sound = 2; p->cachesize = 8192; p->dfxtype[0] = DRV_35_HD; - p->dfxtype[1] = DRV_35_HD; p->floppy_speed = 0; p->cpu_idle = 150; p->cs_compatible = CP_A3000; diff --git a/custom.c b/custom.c index eb4ea13d..24e70be1 100755 --- a/custom.c +++ b/custom.c @@ -171,7 +171,7 @@ uae_u16 intena, intreq, intreqr; uae_u16 dmacon; uae_u16 adkcon; /* used by audio code */ -static uae_u32 cop1lc,cop2lc,copcon; +static uae_u32 cop1lc, cop2lc, copcon; int maxhpos = MAXHPOS_PAL; int maxvpos = MAXVPOS_PAL; @@ -248,7 +248,7 @@ enum diw_states }; static int plffirstline, plflastline; -static int plfstrt, plfstop; +static int plfstrt_start, plfstrt, plfstop; static int sprite_minx, sprite_maxx; static int first_bpl_vpos; static int last_diw_pix_hpos, last_ddf_pix_hpos; @@ -350,7 +350,17 @@ static uae_u32 thisline_changed; #endif static struct decision thisline_decision; -static int passed_plfstop, fetch_cycle, fetch_modulo_cycle; +static int fetch_cycle, fetch_modulo_cycle; + +enum plfstate +{ + plf_idle, + plf_start, + plf_active, + plf_passed_stop, + plf_passed_stop2, + plf_end +} plfstate; enum fetchstate { fetch_not_started, @@ -577,7 +587,7 @@ STATIC_INLINE int GET_PLANES_LIMIT (uae_u16 bc0) #ifdef NEWHSYNC #define HARD_DDF_STOP 0xd8 -#define HARD_DDF_START 0x14 +#define HARD_DDF_START 0x18 #else /* The HRM says 0xD8, but that can't work... */ #define HARD_DDF_STOP 0xd4 @@ -739,7 +749,7 @@ static void estimate_last_fetch_cycle (int hpos) { int fetchunit = fetchunits[fetchmode * 4 + bplcon0_res]; - if (! passed_plfstop) { + if (plfstate < plf_passed_stop) { int stop = plfstop < hpos || plfstop > HARD_DDF_STOP ? HARD_DDF_STOP : plfstop; /* We know that fetching is up-to-date up until hpos, so we can use fetch_cycle. */ int fetch_cycle_at_stop = fetch_cycle + (stop - hpos); @@ -748,7 +758,7 @@ static void estimate_last_fetch_cycle (int hpos) estimated_last_fetch_cycle = hpos + (starting_last_block_at - fetch_cycle) + fetchunit; } else { int starting_last_block_at = (fetch_cycle + fetchunit - 1) & ~(fetchunit - 1); - if (passed_plfstop == 2) + if (plfstate == plf_passed_stop2) starting_last_block_at -= fetchunit; estimated_last_fetch_cycle = hpos + (starting_last_block_at - fetch_cycle) + fetchunit; @@ -781,7 +791,12 @@ static int delayoffset; STATIC_INLINE void compute_delay_offset (void) { - delayoffset = (16 << fetchmode) - (((plfstrt - HARD_DDF_START) & fetchstart_mask) << 1); +#ifdef NEWHSYNC + int v = 4; +#else + int v = 0; +#endif + delayoffset = (16 << fetchmode) - (((plfstrt - v - HARD_DDF_START) & fetchstart_mask) << 1); #if 0 /* maybe we can finally get rid of this stupid table.. */ if (tmp == 4) @@ -880,7 +895,7 @@ STATIC_INLINE void fetch (int nr, int fm) break; #endif } - if (passed_plfstop == 2 && fetch_cycle >= (fetch_cycle & ~fetchunit_mask) + fetch_modulo_cycle) { + if (plfstate == plf_passed_stop2 && fetch_cycle >= (fetch_cycle & ~fetchunit_mask) + fetch_modulo_cycle) { int mod; if (fmode & 0x4000) { if (((diwstrt >> 8) ^ vpos) & 1) @@ -1096,6 +1111,14 @@ static int flush_plane_data (int fm) toscr_1 (16, fm); toscr_1 (16, fm); + + if (fm == 2) { + /* flush full 64-bits */ + i += 32; + toscr_1 (16, fm); + toscr_1 (16, fm); + } + return i >> (1 + toscr_res); } @@ -1334,9 +1357,9 @@ static void finish_final_fetch (int i, int fm) { if (thisline_decision.plfleft == -1) return; - if (passed_plfstop == 3) + if (plfstate == plf_end) return; - passed_plfstop = 3; + plfstate = plf_end; ddfstate = DIW_waiting_start; i += flush_plane_data (fm); thisline_decision.plfright = i; @@ -1346,16 +1369,16 @@ static void finish_final_fetch (int i, int fm) STATIC_INLINE int one_fetch_cycle_0 (int i, int ddfstop_to_test, int dma, int fm) { - if (! passed_plfstop && i == ddfstop_to_test) - passed_plfstop = 1; + if (plfstate < plf_passed_stop && i == ddfstop_to_test) + plfstate = plf_passed_stop; if ((fetch_cycle & fetchunit_mask) == 0) { - if (passed_plfstop == 2) { + if (plfstate == plf_passed_stop2) { finish_final_fetch (i, fm); return 1; } - if (passed_plfstop) - passed_plfstop++; + if (plfstate >= plf_passed_stop) + plfstate++; } if (dma) { @@ -1428,7 +1451,7 @@ STATIC_INLINE void update_fetch (int until, int fm) int ddfstop_to_test; - if (nodraw() || passed_plfstop == 3) + if (nodraw() || plfstate == plf_end) return; /* We need an explicit test against HARD_DDF_STOP here to guard against @@ -1467,7 +1490,7 @@ STATIC_INLINE void update_fetch (int until, int fm) #ifdef SPEEDUP /* Unrolled version of the for loop below. */ - if (! passed_plfstop && ddf_change != vpos && ddf_change + 1 != vpos + if (plfstate < plf_passed_stop && ddf_change != vpos && ddf_change + 1 != vpos && dma && (fetch_cycle & fetchstart_mask) == (fm_maxplane & fetchstart_mask) && toscr_delay1 == toscr_delay1x && toscr_delay2 == toscr_delay2x @@ -1503,9 +1526,9 @@ STATIC_INLINE void update_fetch (int until, int fm) maybe_first_bpl1dat (pos); if (pos <= ddfstop_to_test && pos + count > ddfstop_to_test) - passed_plfstop = 1; + plfstate = plf_passed_stop; if (pos <= ddfstop_to_test && pos + count > ddf2) - passed_plfstop = 2; + plfstate = plf_passed_stop2; if (pos <= ddf2 && pos + count >= ddf2 + fm_maxplane) add_modulos (); pos += count; @@ -1513,7 +1536,6 @@ STATIC_INLINE void update_fetch (int until, int fm) } } else { #endif - //maybe_first_bpl1dat (pos); #ifdef SPEEDUP } #endif @@ -1597,7 +1619,7 @@ static void maybe_start_bpl_dma (int hpos) if (hpos > plfstop - fetchunit) return; if (ddfstate != DIW_waiting_start) - passed_plfstop = 1; + plfstate = plf_passed_stop; start_bpl_dma (hpos, hpos); } @@ -1617,22 +1639,28 @@ STATIC_INLINE void decide_line (int hpos) if (dmaen (DMA_BITPLANE) && diwstate == DIW_waiting_stop) { int ok = 0; - /* Test if we passed the start of the DDF window. */ + if (last_decide_line_hpos < plfstrt_start && hpos >= plfstrt_start) { + if (plfstate == plf_idle) + plfstate = plf_start; + } if (last_decide_line_hpos < plfstrt && hpos >= plfstrt) { - ok = 1; + if (plfstate == plf_start) + plfstate = plf_active; + if (plfstate == plf_active) + ok = 1; /* hack warning.. Writing to DDFSTRT when DMA should start must be ignored * (correct fix would be emulate this delay for every custom register, but why bother..) */ if (hpos - 2 == ddfstrt_old_hpos && ddfstrt_old_vpos == vpos) ok = 0; - if (ok) { - start_bpl_dma (hpos, plfstrt); - estimate_last_fetch_cycle (plfstrt); - last_decide_line_hpos = hpos; + } + if (ok) { + start_bpl_dma (hpos, plfstrt); + estimate_last_fetch_cycle (plfstrt); + last_decide_line_hpos = hpos; #ifndef CUSTOM_SIMPLE - do_sprites (plfstrt); + do_sprites (plfstrt); #endif - return; - } + return; } } @@ -1690,7 +1718,7 @@ static void record_register_change (int hpos, int regno, unsigned long value) { //magic_centering (regno, value, vpos); if (regno == 0x100) { - if (passed_plfstop >= 3) + if (plfstate >= plf_end) return; if (value & 0x800) thisline_decision.ham_seen = 1; @@ -2295,7 +2323,11 @@ static void reset_decisions (void) last_sprite_point = 0; fetch_state = fetch_not_started; - passed_plfstop = 0; + + if (plfstate > plf_active) + plfstate = plf_idle; + if (plfstate == plf_active && !(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) + plfstate = plf_idle; memset (todisplay, 0, sizeof todisplay); memset (fetched, 0, sizeof fetched); @@ -2506,18 +2538,20 @@ static void calcdiw (void) plfstrt += 4; plfstop += 4; #endif - /* probably not the correct place.. */ + /* probably not the correct place.. should use plfstate instead */ if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { /* ECS/AGA and ddfstop > maxhpos == always-on display */ if (plfstop > maxhpos) plfstrt = 0; + if (plfstrt < HARD_DDF_START) + plfstrt = HARD_DDF_START; + plfstrt_start = plfstrt - 4; } else { - /* OCS and ddfstop >= ddfstrt == ddsftop = max */ - if (plfstrt >= plfstop) + /* OCS and ddfstrt >= ddfstop == ddfstop = max */ + if (plfstrt >= plfstop && plfstrt >= HARD_DDF_START) plfstop = 0xff; + plfstrt_start = HARD_DDF_START - 2; } - if (plfstrt < HARD_DDF_START) - plfstrt = HARD_DDF_START; } /* display mode changed (lores, doubling etc..), recalculate everything */ @@ -2951,7 +2985,7 @@ int is_bitplane_dma (int hpos) { if (fetch_state == fetch_not_started || hpos < thisline_decision.plfleft) return 0; - if ((passed_plfstop == 3 && hpos >= thisline_decision.plfright) + if ((plfstate == plf_end && hpos >= thisline_decision.plfright) || hpos >= estimated_last_fetch_cycle) return 0; return curr_diagram[(hpos - cycle_diagram_shift) & fetchstart_mask]; @@ -2961,7 +2995,7 @@ STATIC_INLINE int is_bitplane_dma_inline (int hpos) { if (fetch_state == fetch_not_started || hpos < thisline_decision.plfleft) return 0; - if ((passed_plfstop == 3 && hpos >= thisline_decision.plfright) + if ((plfstate == plf_end && hpos >= thisline_decision.plfright) || hpos >= estimated_last_fetch_cycle) return 0; return curr_diagram[(hpos - cycle_diagram_shift) & fetchstart_mask]; @@ -2971,7 +3005,7 @@ static void BPLxPTH (int hpos, uae_u16 v, int num) { decide_line (hpos); decide_fetch (hpos); - bplpt[num] = (bplpt[num] & 0xffff) | ((uae_u32)v << 16); + bplpt[num] = (bplpt[num] & 0x0000ffff) | ((uae_u32)v << 16); //write_log ("%d:%d:BPL%dPTH %08X\n", hpos, vpos, num, v); } static void BPLxPTL (int hpos, uae_u16 v, int num) @@ -2981,9 +3015,10 @@ static void BPLxPTL (int hpos, uae_u16 v, int num) decide_fetch (hpos); /* fix for "bitplane dma fetch at the same time while updating BPLxPTL" */ /* fixes "3v Demo" by Cave and "New Year Demo" by Phoenix */ - if (is_bitplane_dma(hpos - 1) == num + 1 && num > 0) + if (is_bitplane_dma (hpos - 1) == num + 1 && num > 0) { delta = 2 << fetchmode; - bplpt[num] = (bplpt[num] & ~0xffff) | ((v + delta) & 0xfffe); + } + bplpt[num] = (bplpt[num] & 0xffff0000) | ((v + delta) & 0x0000fffe); //write_log ("%d:%d:BPL%dPTL %08X\n", hpos, vpos, num, v); } @@ -4576,10 +4611,10 @@ static void hsync_handler (void) decide_blitter (hpos); memset (cycle_line, 0, sizeof cycle_line); #ifdef NEWHSYNC - alloc_cycle (5, CYCLE_REFRESH); /* strobe */ + alloc_cycle (3, CYCLE_REFRESH); /* strobe */ + alloc_cycle (5, CYCLE_REFRESH); alloc_cycle (7, CYCLE_REFRESH); alloc_cycle (9, CYCLE_REFRESH); - alloc_cycle (11, CYCLE_REFRESH); #else alloc_cycle (1, CYCLE_REFRESH); /* strobe */ alloc_cycle (3, CYCLE_REFRESH); diff --git a/driveclick.c b/driveclick.c index d53420d0..40f5e27c 100755 --- a/driveclick.c +++ b/driveclick.c @@ -132,7 +132,7 @@ static void processclicks(struct drvsample *ds) } } } -void driveclick_init(void) +void driveclick_init (void) { int v, vv, i, j; char tmp[MAX_DPATH]; @@ -213,6 +213,7 @@ void driveclick_init(void) void driveclick_reset (void) { xfree (clickbuffer); + clickbuffer = NULL; if (!wave_initialized) return; clickbuffer = xmalloc (sndbufsize); @@ -228,6 +229,10 @@ void driveclick_free (void) for (i = 0; i < 4; i++) { for (j = 0; j < DS_END; j++) freesample (&drvs[i][j]); + drv_starting[i] = 0; + drv_spinning[i] = 0; + drv_has_spun[i] = 0; + drv_has_disk[i] = 0; } memset (drvs, 0, sizeof (drvs)); xfree (clickbuffer); @@ -236,7 +241,7 @@ void driveclick_free (void) wave_initialized = 0; } -static int driveclick_active(void) +static int driveclick_active (void) { int i; for (i = 0; i < 4; i++) { @@ -248,7 +253,7 @@ static int driveclick_active(void) return 0; } -STATIC_INLINE uae_s16 getsample(void) +STATIC_INLINE uae_s16 getsample (void) { uae_s32 smp = 0; int div = 0, i; @@ -371,7 +376,7 @@ void driveclick_mix (uae_s16 *sndbuffer, int size) } } -static void dr_audio_activate(void) +static void dr_audio_activate (void) { if (audio_activate ()) clickcnt = 0; diff --git a/gencpu.c b/gencpu.c index c6e076a2..812cba63 100755 --- a/gencpu.c +++ b/gencpu.c @@ -1767,6 +1767,7 @@ static void gen_opcode (unsigned long int opcode) printf ("\tif ((format & 0xF000) == 0x0000) { break; }\n"); printf ("\telse if ((format & 0xF000) == 0x1000) { ; }\n"); printf ("\telse if ((format & 0xF000) == 0x2000) { m68k_areg (regs, 7) += 4; break; }\n"); + printf ("\telse if ((format & 0xF000) == 0x4000) { m68k_areg (regs, 7) += 8; break; }\n"); printf ("\telse if ((format & 0xF000) == 0x8000) { m68k_areg (regs, 7) += 50; break; }\n"); printf ("\telse if ((format & 0xF000) == 0x7000) { m68k_areg (regs, 7) += 52; break; }\n"); printf ("\telse if ((format & 0xF000) == 0x9000) { m68k_areg (regs, 7) += 12; break; }\n"); diff --git a/include/drawing.h b/include/drawing.h index 836612bf..4a514e85 100755 --- a/include/drawing.h +++ b/include/drawing.h @@ -230,7 +230,6 @@ struct decision { uae_u8 bplres; unsigned int ham_seen:1; unsigned int ham_at_start:1; -// unsigned int valid:1; }; /* Anything related to changes in hw registers during the DDF for one diff --git a/include/options.h b/include/options.h index b9d51e3c..3f14a9ce 100755 --- a/include/options.h +++ b/include/options.h @@ -9,7 +9,7 @@ #define UAEMAJOR 1 #define UAEMINOR 5 -#define UAESUBREV 2 +#define UAESUBREV 3 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 40b67e7c..5dda6dde 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -394,7 +394,9 @@ static int pot_cap[2][2]; static uae_u8 pot_dat[2][2]; static int pot_dat_act[2][2]; static int analog_port[2][2]; -#define POTDAT_DELAY 8 +static int digital_port[2][2]; +#define POTDAT_DELAY_PAL 8 +#define POTDAT_DELAY_NTSC 7 static int use_joysticks[MAX_INPUT_DEVICES]; static int use_mice[MAX_INPUT_DEVICES]; @@ -1324,12 +1326,15 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor) if (cd32_shifter[i] >= 2 && (joybutton[i] & ((1 << JOYBUTTON_CD32_PLAY) << (cd32_shifter[i] - 2)))) potgor &= ~p9dat; } else { + potgor &= ~p5dat; if (pot_cap[i][0] > 100) potgor |= p5dat; + potgor &= ~p9dat; if (pot_cap[i][1] > 100) potgor |= p9dat; + } } return potgor; @@ -1348,11 +1353,6 @@ static void charge_cap (int joy, int idx, int charge) pot_cap[joy][idx] = 511; } -static int calcexp (int v) -{ - return v; -} - void inputdevice_hsync (void) { int joy, i; @@ -1362,30 +1362,37 @@ void inputdevice_hsync (void) int charge = 0; uae_u16 pdir = 0x0200 << (joy * 4 + i * 2); /* output enable */ uae_u16 pdat = 0x0100 << (joy * 4 + i * 2); /* data */ + int isbutton = getbuttonstate (joy, i == 0 ? JOYBUTTON_3 : JOYBUTTON_2); - if (analog_port[joy][i] && pot_cap[joy][i] < calcexp (joydirpot[joy][i])) + if (analog_port[joy][i] && pot_cap[joy][i] < joydirpot[joy][i]) charge = 1; // slow charge via pot variable resistor + if (digital_port[joy][i]) + charge = 1; // slow charge via pull-up resistor if (!(potgo_value & pdir)) { // input? if (pot_dat_act[joy][i]) pot_dat[joy][i]++; - /* first 8 lines after potgo has started = discharge cap */ + /* first 8 lines after potgo has been started = discharge cap */ if (pot_dat_act[joy][i] == 1) { - if (pot_dat[joy][i] < POTDAT_DELAY) { + if (pot_dat[joy][i] < (currprefs.ntscmode ? POTDAT_DELAY_NTSC : POTDAT_DELAY_PAL)) { charge = -2; /* fast discharge delay */ } else { pot_dat_act[joy][i] = 2; pot_dat[joy][i] = 0; } } - if (analog_port[joy][i] && pot_dat_act[joy][i] == 2 && pot_cap[joy][i] >= calcexp (joydirpot[joy][i])) + if (analog_port[joy][i] && pot_dat_act[joy][i] == 2 && pot_cap[joy][i] >= joydirpot[joy][i]) pot_dat_act[joy][i] = 0; + if (digital_port[joy][i] && pot_dat_act[joy][i] == 2) { + if (pot_cap[joy][i] >= 10 && !isbutton) + pot_dat_act[joy][i] = 0; + } } else { // output? charge = (potgo_value & pdat) ? 2 : -2; /* fast (dis)charge if output */ if ((potgo_value & pdat) && (potgo_value & pdir)) pot_dat_act[joy][i] = 0; // instant stop if output+high } - if (getbuttonstate (joy, i == 0 ? JOYBUTTON_3 : JOYBUTTON_2)) + if (isbutton) charge = -2; // button press overrides everything if (currprefs.cs_cdtvcd) { @@ -1395,10 +1402,14 @@ void inputdevice_hsync (void) } /* official Commodore mouse has pull-up resistors in button lines * NOTE: 3rd party mice may not have pullups! */ - if (mouse_port[joy]) { - if (charge == 0) - charge = 2; - } + if (mouse_port[joy] && charge == 0) + charge = 2; + /* emulate pullup resistor if button mapped because there too many broken + * programs that read second button in input-mode (and most 2+ button pads have + * pullups) + */ + if (digital_port[joy][i] && charge == 0) + charge = 2; charge_cap (joy, i, charge); } @@ -1418,7 +1429,7 @@ void inputdevice_hsync (void) static uae_u16 POTDAT (int joy) { - uae_u16 v = (pot_dat[joy][0] << 8) | pot_dat[joy][1]; + uae_u16 v = (pot_dat[joy][1] << 8) | pot_dat[joy][0]; if (inputdevice_logging & 16) write_log ("POTDAT%d: %04X %08X\n", joy, v, M68K_GETPC); return v; @@ -2286,6 +2297,27 @@ static int isanalog (int ei) return 0; } +static int isdigitalbutton (int ei) +{ + if (ei == INPUTEVENT_JOY1_2ND_BUTTON) { + digital_port[0][0] = 1; + return 1; + } + if (ei == INPUTEVENT_JOY1_3RD_BUTTON) { + digital_port[0][1] = 1; + return 1; + } + if (ei == INPUTEVENT_JOY2_2ND_BUTTON) { + digital_port[1][0] = 1; + return 1; + } + if (ei == INPUTEVENT_JOY2_3RD_BUTTON) { + digital_port[1][1] = 1; + return 1; + } + return 0; +} + static void scanevents(struct uae_prefs *p) { int i, j, k, ei; @@ -2299,8 +2331,9 @@ static void scanevents(struct uae_prefs *p) for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) { + digital_port[i][j] = 0; analog_port[i][j] = 0; - joydirpot[i][j] = (128 * currprefs.input_analog_joystick_mult / 100) + currprefs.input_analog_joystick_offset; + joydirpot[i][j] = 128 / (312 * 100 / currprefs.input_analog_joystick_mult) + (128 * currprefs.input_analog_joystick_mult / 100) + currprefs.input_analog_joystick_offset; } } @@ -2319,6 +2352,7 @@ static void scanevents(struct uae_prefs *p) iscd32 (ei); isparport (ei); ismouse (ei); + isdigitalbutton (ei); if (joysticks[i].eventid[ID_BUTTON_OFFSET + j][k] > 0) use_joysticks[i] = 1; } @@ -2328,6 +2362,7 @@ static void scanevents(struct uae_prefs *p) iscd32 (ei); isparport (ei); ismouse (ei); + isdigitalbutton (ei); if (mice[i].eventid[ID_BUTTON_OFFSET + j][k] > 0) use_mice[i] = 1; } @@ -2342,6 +2377,7 @@ static void scanevents(struct uae_prefs *p) isparport (ei); ismouse (ei); isanalog (ei); + isdigitalbutton (ei); if (ei > 0) use_joysticks[i] = 1; } @@ -2351,6 +2387,7 @@ static void scanevents(struct uae_prefs *p) isparport (ei); ismouse (ei); isanalog (ei); + isdigitalbutton (ei); if (ei > 0) use_mice[i] = 1; } @@ -2368,6 +2405,7 @@ static void scanevents(struct uae_prefs *p) iscd32 (ei); isparport (ei); ismouse (ei); + isdigitalbutton (ei); } j++; } diff --git a/inputevents.def b/inputevents.def index 13b0299c..f94c901b 100755 --- a/inputevents.def +++ b/inputevents.def @@ -20,10 +20,10 @@ DEFEVENT(MOUSE1_WHEEL,"Mouse1 Wheel",AM_MOUSE_AXIS|AM_JOY_AXIS,8,1,2) DEFEVENT(JOY1_HORIZ,"Joy1 Horizontal",AM_JOY_AXIS,0,1,DIR_LEFT|DIR_RIGHT) DEFEVENT(JOY1_VERT,"Joy1 Vertical",AM_JOY_AXIS,0,1,DIR_UP|DIR_DOWN) -DEFEVENT(JOY1_HORIZ_POT,"Joy1 Horizontal (Analog)",AM_JOY_AXIS,128,1,0) -DEFEVENT(JOY1_VERT_POT,"Joy1 Vertical (Analog)",AM_JOY_AXIS,128,1,1) -DEFEVENT(JOY1_HORIZ_POT_INV,"Joy1 Horizontal (Analog, inverted)",AM_JOY_AXIS,128,1,0|IE_INVERT) -DEFEVENT(JOY1_VERT_POT_INV,"Joy1 Vertical (Analog, inverted)",AM_JOY_AXIS,128,1,1|IE_INVERT) +DEFEVENT(JOY1_HORIZ_POT,"Joy1 Horizontal (Analog)",AM_JOY_AXIS,128,1,1) +DEFEVENT(JOY1_VERT_POT,"Joy1 Vertical (Analog)",AM_JOY_AXIS,128,1,0) +DEFEVENT(JOY1_HORIZ_POT_INV,"Joy1 Horizontal (Analog, inverted)",AM_JOY_AXIS,128,1,1|IE_INVERT) +DEFEVENT(JOY1_VERT_POT_INV,"Joy1 Vertical (Analog, inverted)",AM_JOY_AXIS,128,1,0|IE_INVERT) DEFEVENT(JOY1_LEFT,"Joy1 Left",AM_K,16,1,DIR_LEFT) DEFEVENT(JOY1_RIGHT,"Joy1 Right",AM_K,16,1,DIR_RIGHT) @@ -65,10 +65,10 @@ DEFEVENT(MOUSE2_RIGHT,"Mouse2 Right",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,64,2,DIR_RIG DEFEVENT(JOY2_HORIZ,"Joy2 Horizontal",AM_JOY_AXIS,0,2,DIR_LEFT|DIR_RIGHT) DEFEVENT(JOY2_VERT,"Joy2 Vertical",AM_JOY_AXIS,0,2,DIR_UP|DIR_DOWN) -DEFEVENT(JOY2_HORIZ_POT,"Joy2 Horizontal (Analog)",AM_JOY_AXIS,128,2,0) -DEFEVENT(JOY2_VERT_POT,"Joy2 Vertical (Analog)",AM_JOY_AXIS,128,2,1) -DEFEVENT(JOY2_HORIZ_POT_INV,"Joy2 Horizontal (Analog, inverted)",AM_JOY_AXIS,128,2,0|IE_INVERT) -DEFEVENT(JOY2_VERT_POT_INV,"Joy2 Vertical (Analog, inverted)",AM_JOY_AXIS,128,2,1|IE_INVERT) +DEFEVENT(JOY2_HORIZ_POT,"Joy2 Horizontal (Analog)",AM_JOY_AXIS,128,2,1) +DEFEVENT(JOY2_VERT_POT,"Joy2 Vertical (Analog)",AM_JOY_AXIS,128,2,0) +DEFEVENT(JOY2_HORIZ_POT_INV,"Joy2 Horizontal (Analog, inverted)",AM_JOY_AXIS,128,2,1|IE_INVERT) +DEFEVENT(JOY2_VERT_POT_INV,"Joy2 Vertical (Analog, inverted)",AM_JOY_AXIS,128,2,0|IE_INVERT) DEFEVENT(JOY2_LEFT,"Joy2 Left",AM_K,16,2,DIR_LEFT) DEFEVENT(JOY2_RIGHT,"Joy2 Right",AM_K,16,2,DIR_RIGHT) diff --git a/jit/compemu_support.c b/jit/compemu_support.c index b92a3cae..86848d45 100755 --- a/jit/compemu_support.c +++ b/jit/compemu_support.c @@ -20,7 +20,7 @@ // %%% BRIAN KING WAS HERE %%% extern int canbang; #include - +extern void jit_abort(const char*,...); compop_func *compfunctbl[65536]; compop_func *nfcompfunctbl[65536]; #ifdef NOFLAGS_SUPPORT @@ -318,8 +318,7 @@ STATIC_INLINE void create_jmpdep(blockinfo* bi, int i, uae_u32* jmpaddr, uae_u32 blockinfo* tbi=get_blockinfo_addr((void*)target); Dif(!tbi) { - write_log ("JIT: Could not create jmpdep!\n"); - abort(); + jit_abort ("JIT: Could not create jmpdep!\n"); } bi->dep[i].jmp_off=jmpaddr; bi->dep[i].target=tbi; @@ -387,8 +386,7 @@ STATIC_INLINE blockinfo* get_blockinfo_addr_new(void* addr, int setstate) } } if (!bi) { - write_log ("JIT: Looking for blockinfo, can't find free one\n"); - abort(); + jit_abort ("JIT: Looking for blockinfo, can't find free one\n"); } #if USE_MATCHSTATE @@ -603,8 +601,7 @@ static void make_flags_live_internal(void) if (live.flags_in_flags==VALID) return; Dif (live.flags_on_stack==TRASH) { - write_log ("JIT: Want flags, got something on stack, but it is TRASH\n"); - abort(); + jit_abort ("JIT: Want flags, got something on stack, but it is TRASH\n"); } if (live.flags_on_stack==VALID) { int tmp; @@ -615,9 +612,8 @@ static void make_flags_live_internal(void) live.flags_in_flags=VALID; return; } - write_log ("JIT: Huh? live.flags_in_flags=%d, live.flags_on_stack=%d, but need to make live\n", + jit_abort ("JIT: Huh? live.flags_in_flags=%d, live.flags_on_stack=%d, but need to make live\n", live.flags_in_flags,live.flags_on_stack); - abort(); } static void flags_to_stack(void) @@ -629,7 +625,7 @@ static void flags_to_stack(void) return; } Dif (live.flags_in_flags!=VALID) - abort(); + jit_abort("flags_to_stack != VALID"); else { int tmp; tmp=writereg_specific(FLAGTMP,4,FLAG_NREG1); @@ -797,8 +793,7 @@ STATIC_INLINE void writeback_const(int r) if (!isconst(r)) return; Dif (live.state[r].needflush==NF_HANDLER) { - write_log ("JIT: Trying to write back constant NF_HANDLER!\n"); - abort(); + jit_abort ("JIT: Trying to write back constant NF_HANDLER!\n"); } raw_mov_l_mi((uae_u32)live.state[r].mem,live.state[r].val); @@ -826,8 +821,7 @@ static void evict(int r) Dif (live.nat[rr].locked && live.nat[rr].nholds==1) { - write_log ("JIT: register %d in nreg %d is locked!\n",r,live.state[r].realreg); - abort(); + jit_abort ("JIT: register %d in nreg %d is locked!\n",r,live.state[r].realreg); } live.nat[rr].nholds--; @@ -853,8 +847,7 @@ STATIC_INLINE void free_nreg(int r) evict(vr); } Dif (live.nat[r].nholds!=0) { - write_log ("JIT: Failed to free nreg %d, nholds is %d\n",r,live.nat[r].nholds); - abort(); + jit_abort ("JIT: Failed to free nreg %d, nholds is %d\n",r,live.nat[r].nholds); } } @@ -916,7 +909,7 @@ static int alloc_reg_hinted(int r, int size, int willclobber, int hint) } } Dif (bestreg==-1) - abort(); + jit_abort("alloc_reg_hinted bestreg=-1"); if (live.nat[bestreg].nholds>0) { free_nreg(bestreg); @@ -926,9 +919,9 @@ static int alloc_reg_hinted(int r, int size, int willclobber, int hint) /* This will happen if we read a partially dirty register at a bigger size */ Dif (willclobber || live.state[r].validsize>=size) - abort(); + jit_abort("willclobber || live.state[r].validsize>=size"); Dif (live.nat[rr].nholds!=1) - abort(); + jit_abort("live.nat[rr].nholds!=1"); if (size==4 && live.state[r].validsize==2) { log_isused(bestreg); raw_mov_l_rm(bestreg,(uae_u32)live.state[r].mem); @@ -1016,7 +1009,7 @@ static int alloc_reg(int r, int size, int willclobber) static void unlock(int r) { Dif (!live.nat[r].locked) - abort(); + jit_abort("unlock %d not locked", r); live.nat[r].locked--; } @@ -1083,9 +1076,8 @@ STATIC_INLINE void make_exclusive(int r, int size, int spec) } } Dif (live.nat[rr].nholds!=1) { - write_log ("JIT: natreg %d holds %d vregs, %d not exclusive\n", + jit_abort ("JIT: natreg %d holds %d vregs, %d not exclusive\n", rr,live.nat[rr].nholds,r); - abort(); } return; } @@ -1145,8 +1137,7 @@ STATIC_INLINE void remove_offset(int r, int spec) alloc_reg_hinted(r,4,0,spec); Dif (live.state[r].validsize!=4) { - write_log ("JIT: Validsize=%d in remove_offset\n",live.state[r].validsize); - abort(); + jit_abort ("JIT: Validsize=%d in remove_offset\n",live.state[r].validsize); } make_exclusive(r,0,-1); /* make_exclusive might have done the job already */ @@ -1164,8 +1155,7 @@ STATIC_INLINE void remove_offset(int r, int spec) set_status(r,DIRTY); return; } - write_log ("JIT: Failed in remove_offset\n"); - abort(); + jit_abort ("JIT: Failed in remove_offset\n"); } STATIC_INLINE void remove_all_offsets(void) @@ -1258,7 +1248,7 @@ STATIC_INLINE int writereg_general(int r, int size, int spec) n=live.state[r].realreg; Dif (live.nat[n].nholds!=1) - abort(); + jit_abort("live.nat[%d].nholds!=1", n); switch(size) { case 1: if (live.nat[n].canbyte || spec>=0) { @@ -1305,8 +1295,7 @@ STATIC_INLINE int writereg_general(int r, int size, int spec) } else { Dif (live.state[r].val) { - write_log ("JIT: Problem with val\n"); - abort(); + jit_abort ("JIT: Problem with val\n"); } } set_status(r,DIRTY); @@ -1335,13 +1324,12 @@ STATIC_INLINE int rmw_general(int r, int wsize, int rsize, int spec) make_exclusive(r,0,spec); Dif (wsize=rsize) { n=live.state[r].realreg; Dif (live.nat[n].nholds!=1) - abort(); + jit_abort("live.nat[n].nholds!=1", n); switch(rsize) { case 1: @@ -1383,8 +1371,7 @@ STATIC_INLINE int rmw_general(int r, int wsize, int rsize, int spec) live.nat[answer].touched=touchcnt++; Dif (live.state[r].val) { - write_log ("JIT: Problem with val(rmw)\n"); - abort(); + jit_abort ("JIT: Problem with val(rmw)\n"); } return answer; } @@ -1459,8 +1446,7 @@ static void f_evict(int r) Dif (live.fat[rr].locked && live.fat[rr].nholds==1) { - write_log ("JIT: FPU register %d in nreg %d is locked!\n",r,live.fate[r].realreg); - abort(); + jit_abort ("JIT: FPU register %d in nreg %d is locked!\n",r,live.fate[r].realreg); } live.fat[rr].nholds--; @@ -1486,8 +1472,7 @@ STATIC_INLINE void f_free_nreg(int r) f_evict(vr); } Dif (live.fat[r].nholds!=0) { - write_log ("JIT: Failed to free nreg %d, nholds is %d\n",r,live.fat[r].nholds); - abort(); + jit_abort ("JIT: Failed to free nreg %d, nholds is %d\n",r,live.fat[r].nholds); } } @@ -1563,7 +1548,7 @@ static int f_alloc_reg(int r, int willclobber) static void f_unlock(int r) { Dif (!live.fat[r].locked) - abort(); + jit_abort("unlock %d", r); live.fat[r].locked--; } @@ -1626,7 +1611,7 @@ STATIC_INLINE void f_make_exclusive(int r, int clobber) live.fate[live.fat[rr].holds[i]].realind); } write_log ("\n"); - abort(); + jit_abort("x"); } return; } @@ -1983,8 +1968,7 @@ MIDFUNC(2,rol_l_rr,(RW4 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,4,4); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_rol_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_rol_b\n",r); } raw_rol_l_rr(d,r) ; unlock(r); @@ -2003,8 +1987,7 @@ MIDFUNC(2,rol_w_rr,(RW2 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,2,2); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_rol_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_rol_b\n",r); } raw_rol_w_rr(d,r) ; unlock(r); @@ -2024,8 +2007,7 @@ MIDFUNC(2,rol_b_rr,(RW1 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,1,1); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_rol_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_rol_b\n",r); } raw_rol_b_rr(d,r) ; unlock(r); @@ -2044,8 +2026,7 @@ MIDFUNC(2,shll_l_rr,(RW4 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,4,4); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_rol_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_rol_b\n",r); } raw_shll_l_rr(d,r) ; unlock(r); @@ -2064,8 +2045,7 @@ MIDFUNC(2,shll_w_rr,(RW2 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,2,2); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_shll_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_shll_b\n",r); } raw_shll_w_rr(d,r) ; unlock(r); @@ -2085,8 +2065,7 @@ MIDFUNC(2,shll_b_rr,(RW1 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,1,1); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_shll_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_shll_b\n",r); } raw_shll_b_rr(d,r) ; unlock(r); @@ -2184,8 +2163,7 @@ MIDFUNC(2,shrl_l_rr,(RW4 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,4,4); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_rol_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_rol_b\n",r); } raw_shrl_l_rr(d,r) ; unlock(r); @@ -2204,8 +2182,7 @@ MIDFUNC(2,shrl_w_rr,(RW2 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,2,2); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_shrl_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_shrl_b\n",r); } raw_shrl_w_rr(d,r) ; unlock(r); @@ -2225,8 +2202,7 @@ MIDFUNC(2,shrl_b_rr,(RW1 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,1,1); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_shrl_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_shrl_b\n",r); } raw_shrl_b_rr(d,r) ; unlock(r); @@ -2351,8 +2327,7 @@ MIDFUNC(2,shra_l_rr,(RW4 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,4,4); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_rol_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_rol_b\n",r); } raw_shra_l_rr(d,r) ; unlock(r); @@ -2371,8 +2346,7 @@ MIDFUNC(2,shra_w_rr,(RW2 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,2,2); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_shra_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_shra_b\n",r); } raw_shra_w_rr(d,r) ; unlock(r); @@ -2392,8 +2366,7 @@ MIDFUNC(2,shra_b_rr,(RW1 d, R1 r)) r=readreg_specific(r,1,SHIFTCOUNT_NREG); d=rmw(d,1,1); Dif (r!=1) { - write_log ("JIT: Illegal register %d in raw_shra_b\n",r); - abort(); + jit_abort ("JIT: Illegal register %d in raw_shra_b\n",r); } raw_shra_b_rr(d,r) ; unlock(r); @@ -2466,9 +2439,8 @@ MIDFUNC(1,setzflg_l,(RW4 r)) } else { Dif (live.flags_in_flags!=VALID) { - write_log ("JIT: setzflg() wanted flags in native flags, they are %d\n", + jit_abort ("JIT: setzflg() wanted flags in native flags, they are %d\n", live.flags_in_flags); - abort(); } r=readreg(r,4); { @@ -2746,7 +2718,7 @@ MIDFUNC(3,mov_l_mrr_indexed,(R4 baser, R4 index, R4 s)) s=readreg(s,4); Dif (baser==s || index==s) - abort(); + jit_abort("mov_l_mrr_indexed"); raw_mov_l_mrr_indexed(baser,index,s); unlock(s); @@ -4468,8 +4440,7 @@ uae_u32 get_const(int r) if (!reg_alloc_run) #endif Dif (!isconst(r)) { - write_log ("JIT: Register %d should be constant, but isn't\n",r); - abort(); + jit_abort ("JIT: Register %d should be constant, but isn't\n",r); } return live.state[r].val; } @@ -4585,12 +4556,11 @@ static void vinton(int i, uae_s8* vton, int depth) int rr; Dif (vton[i]==-1) { - write_log ("JIT: Asked to load register %d, but nowhere to go\n",i); - abort(); + jit_abort ("JIT: Asked to load register %d, but nowhere to go\n",i); } n=vton[i]; Dif (live.nat[n].nholds>1) - abort(); + jit_abort("vinton"); if (live.nat[n].nholds && depthcount,bi->optlevel,bi->handler_to_use, cache_tags[cl].handler); - abort(); } Dif (bi->count!=-1 && bi->status!=BI_TARGETTED) { /* What the heck? We are not supposed to be here! */ - abort(); + jit_abort("BI_TARGETTED"); } } if (bi->count==-1) { diff --git a/newcpu.c b/newcpu.c index 5e1692ae..35bdd0d3 100755 --- a/newcpu.c +++ b/newcpu.c @@ -1917,7 +1917,7 @@ static void do_trace (void) m68k_setpc (®s, m68k_getpc (®s)); fill_prefetch_slow (®s); opcode = get_word (regs.pc); - if (opcode == 0x4e72 /* RTE */ + if (opcode == 0x4e73 /* RTE */ || opcode == 0x4e74 /* RTD */ || opcode == 0x4e75 /* RTS */ || opcode == 0x4e77 /* RTR */ diff --git a/od-win32/ahidsound_new.c b/od-win32/ahidsound_new.c index 168450f9..e3b66279 100755 --- a/od-win32/ahidsound_new.c +++ b/od-win32/ahidsound_new.c @@ -41,12 +41,12 @@ #define AHI_STRUCT_VERSION 1 -static int ahi_debug = 1; +static int ahi_debug = 2; #define UAE_MAXCHANNELS 24 #define UAE_MAXSOUNDS 256 -#define RECORDSAMPLES 2048 -#define PLAYSAMPLES 1536 +#define UAE_RECORDSAMPLES 2048 +#define UAE_MAXPLAYSAMPLES 2048 #define ub_Flags 34 #define ub_Pad1 (ub_Flags + 1) @@ -216,7 +216,21 @@ struct AHIAudioCtrlDrv #define AHI_TagBase (0x80000000) #define AHI_TagBaseR (AHI_TagBase|0x8000) - /* AHI_ControlAudioA tags */ + /* AHI_AllocAudioA tags */ +#define AHIA_AudioID (AHI_TagBase+1) /* Desired audio mode */ +#define AHIA_MixFreq (AHI_TagBase+2) /* Suggested mixing frequency */ +#define AHIA_Channels (AHI_TagBase+3) /* Suggested number of channels */ +#define AHIA_Sounds (AHI_TagBase+4) /* Number of sounds to use */ +#define AHIA_SoundFunc (AHI_TagBase+5) /* End-of-Sound Hook */ +#define AHIA_PlayerFunc (AHI_TagBase+6) /* Player Hook */ +#define AHIA_PlayerFreq (AHI_TagBase+7) /* Frequency for player Hook (Fixed)*/ +#define AHIA_MinPlayerFreq (AHI_TagBase+8) /* Minimum Frequency for player Hook */ +#define AHIA_MaxPlayerFreq (AHI_TagBase+9) /* Maximum Frequency for player Hook */ +#define AHIA_RecordFunc (AHI_TagBase+10) /* Sample recording Hook */ +#define AHIA_UserData (AHI_TagBase+11) /* What to put in ahiac_UserData */ +#define AHIA_AntiClickSamples (AHI_TagBase+13) /* # of samples to smooth (V6) */ + +/* AHI_ControlAudioA tags */ #define AHIC_Play (AHI_TagBase+80) /* Boolean */ #define AHIC_Record (AHI_TagBase+81) /* Boolean */ #define AHIC_MonitorVolume (AHI_TagBase+82) @@ -315,6 +329,7 @@ struct dssample { int ch; int bitspersample; int bytespersample; + int dynamic; uae_u32 addr; uae_u32 len; uae_u32 type; @@ -340,6 +355,9 @@ struct dschannel { int dsplaying; ALuint al_source; int samplecounter; + int buffertoggle; + int maxplaysamples; + int totalsamples; }; struct DSAHI { @@ -355,6 +373,7 @@ struct DSAHI { int channels; int sounds; int playerfreq; + uae_u32 audioid; int enabledisable; struct dssample *sample; struct dschannel *channel; @@ -362,12 +381,13 @@ struct DSAHI { evt evttime; uae_u32 signalchannelmask; - ALCdevice *al_dev; + ALCdevice *al_dev, *al_recorddev; ALCcontext *al_ctx; int al_bufferformat; uae_u8 *tmpbuffer; int tmpbuffer_size; int dsrecording; + int record_samples; int record_ch; int record_bytespersample; int record_wait; @@ -451,9 +471,10 @@ static int sendsignal (struct DSAHI *dsahip) if (ch > UAE_MAXCHANNELS) ch = UAE_MAXCHANNELS; for (i = 0; i < ch; i++) { + struct dschannel *dc = &dsahip->channel[i]; int v; - alGetSourcei (dsahip->channel[i].al_source, AL_SAMPLE_OFFSET, &v); - put_long (channelinfo + ahieci_Offset + i * 4, v); + alGetSourcei (dc->al_source, AL_SAMPLE_OFFSET, &v); + put_long (channelinfo + ahieci_Offset + i * 4, v + dc->samplecounter * dc->maxplaysamples); } } @@ -581,34 +602,64 @@ static void ds_free (struct DSAHI *dsahip) static void ds_free_record (struct DSAHI *dsahip) { + if (dsahip->al_recorddev) + alcCaptureCloseDevice (dsahip->al_recorddev); + dsahip->al_recorddev = NULL; } static int ds_init_record (struct DSAHI *dsahip) { uae_u32 pbase = get_long (dsahip->audioctrl + ahiac_DriverData); int freq = get_long (dsahip->audioctrl + ahiac_MixFreq); + struct sound_device *sd; + int device; if (!freq) return 0; + device = dsahip->input; + sd = record_devices; + for (;;) { + if (sd->type == SOUND_DEVICE_AL) { + if (device <= 0) + break; + device--; + } + sd++; + if (sd->name == NULL) + return 0; + } + dsahip->record_samples = UAE_RECORDSAMPLES; + dsahip->record_ch = 2; + dsahip->record_bytespersample = 2; + alClear (); + dsahip->al_recorddev = alcCaptureOpenDevice (sd->alname, freq, AL_FORMAT_STEREO16, dsahip->record_samples); + if (dsahip->al_recorddev == NULL) + goto error; + return 1; +error: + if (ahi_debug) + write_log ("AHI: OPENAL recording initialization failed\n"); return 0; } static int ds_init (struct DSAHI *dsahip) { int freq = 44100; - int v, wrapped; + int v; struct sound_device *sd; + int device; - sd = &sound_devices[currprefs.win32_soundcard]; - wrapped = 0; - while (sd->type != SOUND_DEVICE_AL) { - sd++; - if (sd->name == NULL) { - if (wrapped) - return 0; - wrapped = 1; - sd = sound_devices; + device = dsahip->output; + sd = sound_devices; + for (;;) { + if (sd->type == SOUND_DEVICE_AL) { + if (device <= 0) + break; + device--; } + sd++; + if (sd->name == NULL) + return 0; } dsahip->al_dev = alcOpenDevice (sd->alname); if (!dsahip->al_dev) @@ -620,15 +671,18 @@ static int ds_init (struct DSAHI *dsahip) dsahip->chout = 2; dsahip->al_bufferformat = AL_FORMAT_STEREO16; - if (v = alGetEnumValue ("AL_FORMAT_QUAD16")) { - dsahip->chout = 4; - cansurround = 1; - dsahip->al_bufferformat = v; - } - if (v = alGetEnumValue ("AL_FORMAT_51CHN16")) { - dsahip->chout = 6; - cansurround = 1; - dsahip->al_bufferformat = v; + cansurround = 0; + if ((dsahip->audioid & 0xff) == 2) { + if (v = alGetEnumValue ("AL_FORMAT_QUAD16")) { + dsahip->chout = 4; + cansurround = 1; + dsahip->al_bufferformat = v; + } + if (v = alGetEnumValue ("AL_FORMAT_51CHN16")) { + dsahip->chout = 6; + cansurround = 1; + dsahip->al_bufferformat = v; + } } dsahip->bitspersampleout = dsahip->bits24 ? 24 : 16; dsahip->bytespersampleout = dsahip->bitspersampleout / 8; @@ -637,7 +691,7 @@ static int ds_init (struct DSAHI *dsahip) write_log("AHI: CH=%d BLEN=%d\n", dsahip->chout, dsahip->channellength); - dsahip->tmpbuffer_size = 2000000; + dsahip->tmpbuffer_size = 1000000; dsahip->tmpbuffer = xmalloc (dsahip->tmpbuffer_size); if (ahi_debug) write_log ("AHI: OpenAL initialized: %s\n", sound_devices[dsahip->output].name); @@ -901,67 +955,27 @@ static int copysampledata (struct DSAHI *dsahip, struct dschannel *dc, struct ds static void dorecord (struct DSAHI *dsahip) { -#if 0 uae_u32 pbase = get_long (dsahip->audioctrl + ahiac_DriverData); - HRESULT hr; - DWORD cpos, rpos, diff; - void *buf1, *buf2; - DWORD size1, size2; uae_u32 recordbuf; - int mixlength_bytes; + int bytes; - if (dsahip->dscb == NULL) + if (dsahip->al_recorddev == NULL) return; if (dsahip->record_wait && !get_word (pbase + pub_RecordHookDone)) return; dsahip->record_wait = 0; - mixlength_bytes = dsahip->mixlength_record * dsahip->record_ch * dsahip->record_bytespersample; + bytes = dsahip->record_samples * dsahip->record_ch * dsahip->record_bytespersample; recordbuf = get_long (pbase + pub_RecordBuffer); - if (recordbuf == 0 || !valid_address (recordbuf, mixlength_bytes)) + if (recordbuf == 0 || !valid_address (recordbuf, bytes)) return; - hr = IDirectSoundCaptureBuffer_GetCurrentPosition (dsahip->dscb, &cpos, &rpos); - if (FAILED (hr)) { - write_log ("AHI: IDirectSoundCaptureBuffer_GetCurrentPosition() failed %s\n", DXError (hr)); - return; - } - if (rpos < dsahip->recordingcursor) - rpos += dsahip->channellength_record; - diff = rpos - dsahip->recordingcursor; - if (diff < mixlength_bytes) + alClear (); + alcCaptureSamples (dsahip->al_recorddev, (void*)recordbuf, dsahip->record_samples); + if (alGetError () != AL_NO_ERROR) return; - hr = IDirectSoundCaptureBuffer_Lock (dsahip->dscb, dsahip->recordingcursor, mixlength_bytes, &buf1, &size1, &buf2, &size2, 0); - if (SUCCEEDED (hr)) { - uae_u8 *addr = get_real_address (recordbuf); - uae_u8 *b = (uae_u8*)buf1; - int s; - b = (uae_u8*)buf1; - s = size1; - while (s > 0) { - addr[0] = b[1]; - addr[1] = b[0]; - addr += 2; - b += 2; - s -= 2; - } - b = (uae_u8*)buf2; - s = size2; - while (s > 0) { - addr[0] = b[1]; - addr[1] = b[0]; - addr += 2; - b += 2; - s -= 2; - } - IDirectSoundCaptureBuffer_Unlock (dsahip->dscb, buf1, size1, buf2, size2); - put_word (pbase + pub_RecordHookDone, 0); - dsahip->record_wait = 1; - put_word (pbase + pub_FuncMode, get_word (pbase + pub_FuncMode) | FUNCMODE_RECORD); - sendsignal (dsahip); - } - dsahip->recordingcursor += mixlength_bytes; - if (dsahip->recordingcursor >= dsahip->channellength_record) - dsahip->recordingcursor -= dsahip->channellength_record; -#endif + put_word (pbase + pub_RecordHookDone, 0); + dsahip->record_wait = 1; + put_word (pbase + pub_FuncMode, get_word (pbase + pub_FuncMode) | FUNCMODE_RECORD); + sendsignal (dsahip); } @@ -974,7 +988,6 @@ static void al_setloop (struct dschannel *dc, int state) static void al_startplay (struct dschannel *dc) { - al_setloop (dc, TRUE); alClear (); alSourcePlay (dc->al_source); alError ("AHI: ds_play() alSourcePlay"); @@ -984,25 +997,32 @@ static void preparesample (struct DSAHI *dsahip, struct dschannel *dc) { uae_u8 *p, *ps, *pe; struct dssample *ds; - int num, slen, dlen, offset; + int slen, dlen; - memcpy (&dc->cs, &dc->csnext, sizeof (struct chsample)); - dc->csnext.ds = NULL; ds = dc->cs.ds; ps = p = get_real_address (ds->addr); pe = ps + ds->len * ds->bytespersample * ds->ch; - num = ds->len / dsahip->maxplaysamples; - offset = dsahip->maxplaysamples * dc->samplecounter; - slen = dsahip->maxplaysamples; - if (dc->samplecounter == num - 1) - slen = ds->len - dsahip->maxplaysamples * (num - 1); - p += (offset + dc->cs.srcplayoffset) * ds->bytespersample * ds->ch; + + slen = dc->maxplaysamples; + if (dc->samplecounter == dc->totalsamples - 1) + slen = ds->len - dc->maxplaysamples * (dc->totalsamples - 1); + + p += (dc->maxplaysamples * dc->samplecounter + dc->cs.srcplayoffset) * ds->bytespersample * ds->ch; dlen = copysampledata (dsahip, dc, ds, &p, pe, ps, dsahip->tmpbuffer, slen); alClear (); - alBufferData (ds->al_buffer[dc->samplecounter], dsahip->al_bufferformat, dsahip->tmpbuffer, dlen, dc->cs.frequency); - alError ("AHI: preparesample:alBufferData()"); + alBufferData (ds->al_buffer[dc->buffertoggle], dsahip->al_bufferformat, dsahip->tmpbuffer, dlen, dc->cs.frequency); + alError ("AHI: preparesample:alBufferData(len=%d,freq=%d)", dlen, dc->cs.frequency); + 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) + write_log ("AHI: sample queued %d: %d/%d\n", + dc->num, dc->samplecounter, dc->totalsamples); + dc->samplecounter++; + dc->buffertoggle ^= 1; } +/* called when sample is started for the first time */ static void al_initsample (struct DSAHI *dsahip, struct dschannel *dc) { struct dssample *ds; @@ -1011,26 +1031,41 @@ static void al_initsample (struct DSAHI *dsahip, struct dschannel *dc) alClear (); alSourcei (dc->al_source, AL_BUFFER, AL_NONE); alError ("AHI: al_initsample:AL_BUFFER=AL_NONE"); + + memcpy (&dc->cs, &dc->csnext, sizeof (struct chsample)); + dc->csnext.ds = NULL; + 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); - ds = dc->cs.ds; - alClear (); - alSourceQueueBuffers (dc->al_source, 1, &ds->al_buffer[dc->samplecounter]); - alError ("AHI: al_initsample:alSourceQueueBuffers(freq=%d)", dc->cs.frequency); + /* queue second half */ + preparesample (dsahip, dc); + if (dc->dsplaying) { dc->dsplaying = 1; al_startplay (dc); setchannelevent (dsahip, dc); } - dc->samplecounter++; } +/* called when previous sample is still playing */ static void al_queuesample (struct DSAHI *dsahip, struct dschannel *dc) { int v, restart; - al_setloop (dc, FALSE); - if (!dc->csnext.ds) + if (!dc->cs.ds) return; restart = 0; if (dc->dsplaying) { @@ -1044,19 +1079,15 @@ static void al_queuesample (struct DSAHI *dsahip, struct dschannel *dc) restart = 1; if (ahi_debug) write_log ("AHI: queuesample, play restart\n"); + preparesample (dsahip, dc); } } - dc->samplecounter = 0; preparesample (dsahip, dc); - alClear (); - alSourceQueueBuffers (dc->al_source, 1, &dc->cs.ds->al_buffer[dc->samplecounter]); - alError ("AHI: al_queuesample:alSourceQueueBuffers(freq=%d)", dc->cs.frequency); if (dc->dsplaying) dc->dsplaying = 1; if (restart) al_startplay (dc); - al_setloop (dc, FALSE); - if (ahi_debug) + if (ahi_debug > 1) write_log ("AHI: sample %d queued to channel %d\n", dc->cs.ds->num, dc->num); } @@ -1110,18 +1141,27 @@ void ahi_hsync (void) if (v != AL_PLAYING) { setchannelevent (dsahip, dc); if (ahi_debug) - write_log ("AHI: channel %d stopped state=%d\n", dc->num, v); - if (dc->csnext.ds) - al_queuesample (dsahip, dc); - else - dc->dsplaying = 2; + write_log ("AHI: ********* channel %d stopped state=%d!\n", dc->num, v); + removed = 1; + dc->dsplaying = 2; } if (removed) { - if (ahi_debug) - write_log ("sample end channel %d\n", dc->num); - setchannelevent (dsahip, dc); - if (dc->csnext.ds) - al_queuesample (dsahip, dc); + int evt = 0; + if (ahi_debug > 1) + 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) + write_log ("sample finished channel %d: %d\n", dc->num, dc->totalsamples); + dc->samplecounter = 0; + if (dc->csnext.ds) { + memcpy (&dc->cs, &dc->csnext, sizeof (struct chsample)); + dc->csnext.ds = NULL; + } + } + al_queuesample (dsahip, dc); + if (evt) + setchannelevent (dsahip, dc); } } put_long (pbase + pub_ChannelSignalAck, flags); @@ -1129,6 +1169,16 @@ void ahi_hsync (void) static void ds_record (struct DSAHI *dsahip, int start) { + alClear (); + if (start) { + if (!dsahip->dsrecording) + alcCaptureStart (dsahip->al_recorddev); + dsahip->dsrecording = 1; + } else { + alcCaptureStop (dsahip->al_recorddev); + dsahip->dsrecording = 0; + } + alError ("AHI: alcCapture%s failed", start ? "Start" : "Stop"); } static void ds_stop (struct DSAHI *dsahip, struct dschannel *dc) @@ -1228,7 +1278,6 @@ static uae_u32 AHIsub_AllocAudio (TrapContext *ctx) return AHISF_ERROR; } - v = get_long (pbase + pub_Index); if (v != -1) { write_log ("AHI: corrupted memory\n"); @@ -1237,26 +1286,36 @@ static uae_u32 AHIsub_AllocAudio (TrapContext *ctx) put_long (pbase + pub_Index, dsahip - dsahi); dsahip->audioctrl = audioctrl; - if (!ds_init (dsahip)) - return AHISF_ERROR; - dsahip->maxplaysamples = PLAYSAMPLES; + dsahip->maxplaysamples = UAE_MAXPLAYSAMPLES; dsahip->sounds = UAE_MAXSOUNDS; dsahip->channels = UAE_MAXCHANNELS; - if (xahi_input_num) - ret |= AHISF_CANRECORD; - if (cansurround) - ret |= AHISF_KNOWMULTICHANNEL; - + dsahip->audioid = 0x003b0001; while ((tag = gettag (&tags, &data))) { if (ahi_debug) write_log ("- TAG %08x=%d: %08x=%u\n", tag, tag & 0x7fff, data, data); + switch (tag) + { + case AHIA_AudioID: + dsahip->audioid = data; + break; + } } - if (dsahip->sounds < 0 || dsahip->sounds > 1000) { - ds_free (dsahip); - ds_free_record (dsahip); + + if ((dsahip->audioid >> 16) != 0x3b) return AHISF_ERROR; - } + + if (dsahip->sounds < 0 || dsahip->sounds > 1000) + return AHISF_ERROR; + + if (!ds_init (dsahip)) + return AHISF_ERROR; + + if (xahi_input_num) + ret |= AHISF_CANRECORD; + if (cansurround) + ret |= AHISF_KNOWMULTICHANNEL; + dsahip->sample = xcalloc (sizeof (struct dssample), dsahip->sounds); dsahip->channel = xcalloc (sizeof (struct dschannel), dsahip->channels); for (i = 0; i < dsahip->channels; i++) { @@ -1384,7 +1443,7 @@ static uae_u32 getattr2 (struct DSAHI *dsahip, uae_u32 attribute, uae_u32 argume case AHIDB_FullDuplex: return -1; case AHIDB_MaxRecordSamples: - return RECORDSAMPLES; + return UAE_RECORDSAMPLES; case AHIDB_MaxPlaySamples: if (def < dsahip->maxplaysamples) def = dsahip->maxplaysamples; @@ -1596,8 +1655,6 @@ static uae_u32 AHIsub_SetSound (TrapContext *ctx) ds_setvolume (dsahip, dc); if (dc->cs.ds == NULL) al_initsample (dsahip, dc); - else - al_queuesample (dsahip, dc); return 0; } @@ -1657,6 +1714,7 @@ static uae_u32 AHIsub_LoadSound (TrapContext *ctx) ds->sampletype = sampletype; ds->type = type; ds->len = len; + ds->dynamic = type == AHIST_DYNAMICSAMPLE; switch (sampletype) { diff --git a/od-win32/bsdsock.c b/od-win32/bsdsock.c index 71dc017c..a93d4449 100755 --- a/od-win32/bsdsock.c +++ b/od-win32/bsdsock.c @@ -902,24 +902,23 @@ static unsigned int sock_thread2(void *blah) if(bsd->hSockWnd) { // Make sure we're outrunning the wolves - int pri = THREAD_PRIORITY_ABOVE_NORMAL; - SetThreadPriority(GetCurrentThread(), pri); + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); while(bsd->hSockThread && bsd->hSockWnd) { DWORD wait; WaitHandle = bsd->hSockReq; wait = MsgWaitForMultipleObjects (1, &WaitHandle, FALSE, INFINITE, QS_POSTMESSAGE); + if (wait == WAIT_ABANDONED_0) + break; if (wait == WAIT_OBJECT_0) { if (!bsd->hSockThread || !bsd->hSockWnd) break; - if(HandleStuff()) // See if its time to quit... + if (HandleStuff()) // See if its time to quit... break; - } - if (wait == WAIT_OBJECT_0 + 1) { + } else if (wait == WAIT_OBJECT_0 + 1) { if (!bsd->hSockThread || !bsd->hSockWnd) break; - Sleep(10); - while(PeekMessage(&msg, NULL, WM_USER, 0xB000 + MAXPENDINGASYNC * 2, PM_REMOVE) > 0) { + while(PeekMessage(&msg, NULL, WM_USER, 0xB000 + MAXPENDINGASYNC * 2, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } diff --git a/od-win32/dinput.c b/od-win32/dinput.c index 133326f8..6e90b6e5 100755 --- a/od-win32/dinput.c +++ b/od-win32/dinput.c @@ -1823,7 +1823,10 @@ static int refresh_kb (LPDIRECTINPUTDEVICE8 lpdi, int num) for (i = 0; i < sizeof (kc); i++) { if (i == 0x80) /* USB KB led causes this, better ignore it */ continue; - if (kc[i] & 0x80) kc[i] = 1; else kc[i] = 0; + if (kc[i] & 0x80) + kc[i] = 1; + else + kc[i] = 0; if (kc[i] != di_keycodes[num][i]) { write_log ("%02X -> %d\n", i, kc[i]); di_keycodes[num][i] = kc[i]; @@ -1873,6 +1876,7 @@ static void read_kb (void) for (j = 0; j < elements; j++) { int scancode = didod[j].dwOfs; int pressed = (didod[j].dwData & 0x80) ? 1 : 0; + //write_log ("%d: %02X %d\n", j, scancode, pressed); if (!istest) scancode = keyhack (scancode, pressed, i); if (scancode < 0) diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index f5710587..bae7af8e 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,2,0 - PRODUCTVERSION 1,5,2,0 + FILEVERSION 1,5,3,0 + PRODUCTVERSION 1,5,3,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -958,12 +958,12 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "WinUAE" - VALUE "FileVersion", "1.5.2" + VALUE "FileVersion", "1.5.3" VALUE "InternalName", "WinUAE" VALUE "LegalCopyright", "© 1996-2008 under the GNU Public License (GPL)" VALUE "OriginalFilename", "WinUAE.exe" VALUE "ProductName", "WinUAE" - VALUE "ProductVersion", "1.5.2" + VALUE "ProductVersion", "1.5.3" END END BLOCK "VarFileInfo" diff --git a/od-win32/win32.c b/od-win32/win32.c index e027bb74..0c5a71a1 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -128,8 +128,11 @@ int mouseactive, focus; static int mm_timerres; static int timermode, timeon; -static HANDLE timehandle; +#define MAX_TIMEHANDLES 8 +static int timehandlecounter; +static HANDLE timehandle[MAX_TIMEHANDLES]; int sleep_resolution; +static CRITICAL_SECTION cs_time; char start_path_data[MAX_DPATH]; char start_path_exe[MAX_DPATH]; @@ -169,12 +172,17 @@ static int timebegin (void) static int init_mmtimer (void) { TIMECAPS tc; + int i; + mm_timerres = 0; if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) != TIMERR_NOERROR) return 0; mm_timerres = min (max (tc.wPeriodMin, 1), tc.wPeriodMax); sleep_resolution = 1000 / mm_timerres; - timehandle = CreateEvent (NULL, TRUE, FALSE, NULL); + for (i = 0; i < MAX_TIMEHANDLES; i++) + timehandle[i] = CreateEvent (NULL, TRUE, FALSE, NULL); + InitializeCriticalSection(&cs_time); + timehandlecounter = 0; return 1; } @@ -182,11 +190,17 @@ void sleep_millis (int ms) { UINT TimerEvent; int start; + int cnt; start = read_processor_time (); - TimerEvent = timeSetEvent (ms, 0, timehandle, 0, TIME_ONESHOT | TIME_CALLBACK_EVENT_SET); - WaitForSingleObject (timehandle, ms); - ResetEvent (timehandle); + EnterCriticalSection (&cs_time); + cnt = timehandlecounter++; + if (timehandlecounter >= MAX_TIMEHANDLES) + timehandlecounter = 0; + LeaveCriticalSection (&cs_time); + TimerEvent = timeSetEvent (ms, 0, timehandle[cnt], 0, TIME_ONESHOT | TIME_CALLBACK_EVENT_SET); + WaitForSingleObject (timehandle[cnt], ms); + ResetEvent (timehandle[cnt]); timeKillEvent (TimerEvent); idletime += read_processor_time () - start; } @@ -328,7 +342,6 @@ static void setcursor (int oldx, int oldy) return; } mouseposx = mouseposy = 0; -// if (oldx < amigawin_rect.left || oldy < amigawin_rect.top || oldx > amigawin_rect.right || oldy > amigawin_rect.bottom) { if (oldx < 0 || oldy < 0 || oldx > amigawin_rect.right - amigawin_rect.left || oldy > amigawin_rect.bottom - amigawin_rect.top) { write_log ("Mouse out of range: %dx%d (%dx%d %dx%d)\n", oldx, oldy, amigawin_rect.left, amigawin_rect.top, amigawin_rect.right, amigawin_rect.bottom); @@ -421,7 +434,7 @@ static void setmaintitle (HWND hwnd) WIN32GUI_LoadUIString (currprefs.win32_middle_mouse ? IDS_WINUAETITLE_MMB : IDS_WINUAETITLE_NORMAL, txt2, sizeof (txt2)); } - if (WINUAEBETA > 0) { + if (strlen (WINUAEBETA) > 0) { strcat (txt, BetaStr); if (strlen (WINUAEEXTRA) > 0) { strcat (txt, " "); @@ -1963,9 +1976,9 @@ void target_save_options (struct zfile *f, struct uae_prefs *p) cfgfile_target_dwrite (f, "map_cd_drives=%s\n", p->win32_automount_cddrives ? "true" : "false"); cfgfile_target_dwrite (f, "map_net_drives=%s\n", p->win32_automount_netdrives ? "true" : "false"); serdevtoname (p->sername); - cfgfile_target_dwrite (f, "serial_port=%s\n", p->sername[0] ? p->sername : "none" ); + cfgfile_target_dwrite (f, "serial_port=%s\n", p->sername[0] ? p->sername : "none"); sernametodev (p->sername); - cfgfile_target_dwrite (f, "parallel_port=%s\n", p->prtname[0] ? p->prtname : "none" ); + cfgfile_target_dwrite (f, "parallel_port=%s\n", p->prtname[0] ? p->prtname : "none"); cfgfile_target_dwrite (f, "active_priority=%d\n", priorities[p->win32_active_priority].value); cfgfile_target_dwrite (f, "inactive_priority=%d\n", priorities[p->win32_inactive_priority].value); @@ -2989,15 +3002,15 @@ static int getval(char *s) static void makeverstr(char *s) { -#if WINUAEBETA > 0 - sprintf (BetaStr, " (%sBeta %d, %d.%02d.%02d)", WINUAEPUBLICBETA > 0 ? "Public " : "", WINUAEBETA, - GETBDY(WINUAEDATE), GETBDM(WINUAEDATE), GETBDD(WINUAEDATE)); - sprintf (s, "WinUAE %d.%d.%d%s%s", - UAEMAJOR, UAEMINOR, UAESUBREV, WINUAEREV, BetaStr); -#else - sprintf(s, "WinUAE %d.%d.%d%s (%d.%02d.%02d)", - UAEMAJOR, UAEMINOR, UAESUBREV, WINUAEREV, GETBDY(WINUAEDATE), GETBDM(WINUAEDATE), GETBDD(WINUAEDATE)); -#endif + if (strlen (WINUAEBETA) > 0) { + sprintf (BetaStr, " (%sBeta %s, %d.%02d.%02d)", WINUAEPUBLICBETA > 0 ? "Public " : "", WINUAEBETA, + GETBDY(WINUAEDATE), GETBDM(WINUAEDATE), GETBDD(WINUAEDATE)); + sprintf (s, "WinUAE %d.%d.%d%s%s", + UAEMAJOR, UAEMINOR, UAESUBREV, WINUAEREV, BetaStr); + } else { + sprintf(s, "WinUAE %d.%d.%d%s (%d.%02d.%02d)", + UAEMAJOR, UAEMINOR, UAESUBREV, WINUAEREV, GETBDY(WINUAEDATE), GETBDM(WINUAEDATE), GETBDD(WINUAEDATE)); + } if (strlen (WINUAEEXTRA) > 0) { strcat (s, " "); strcat (s, WINUAEEXTRA); diff --git a/od-win32/win32.h b/od-win32/win32.h index d12ad0ee..9db09074 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,15 +15,15 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEPUBLICBETA 0 +#define WINUAEPUBLICBETA 1 -#define WINUAEBETA 0 -#define WINUAEDATE MAKEBD(2008, 9, 5) +#define WINUAEBETA "0.1" +#define WINUAEDATE MAKEBD(2008, 9, 26) #define WINUAEEXTRA "" #define WINUAEREV "" #define IHF_WINDOWHIDDEN 6 -#define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX) +#define NORMAL_WINDOW_STYLE (WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX) extern HMODULE hUIDLL; extern HWND hAmigaWnd, hMainWnd, hHiddenWnd, hGUIWnd; diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index ccb03af3..cf9c5d1b 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -1034,8 +1034,9 @@ int check_prefs_changed_gfx (void) c |= currprefs.gfx_lores_mode != changed_prefs.gfx_lores_mode ? (2 | 8) : 0; c |= currprefs.gfx_display != changed_prefs.gfx_display ? (2|4|8) : 0; c |= strcmp (currprefs.gfx_display_name, changed_prefs.gfx_display_name) ? (2|4|8) : 0; - c |= currprefs.win32_alwaysontop != changed_prefs.win32_alwaysontop ? 1 : 0; - c |= currprefs.win32_borderless != changed_prefs.win32_borderless ? 1 : 0; + c |= currprefs.win32_alwaysontop != changed_prefs.win32_alwaysontop ? 32 : 0; + c |= currprefs.win32_notaskbarbutton != changed_prefs.win32_notaskbarbutton ? 32 : 0; + c |= currprefs.win32_borderless != changed_prefs.win32_borderless ? 32 : 0; c |= currprefs.win32_rtgmatchdepth != changed_prefs.win32_rtgmatchdepth ? 2 : 0; c |= currprefs.win32_rtgscaleifsmall != changed_prefs.win32_rtgscaleifsmall ? 8 : 0; c |= currprefs.win32_rtgallowscaling != changed_prefs.win32_rtgallowscaling ? 8 : 0; @@ -1091,6 +1092,7 @@ int check_prefs_changed_gfx (void) currprefs.gfx_display = changed_prefs.gfx_display; strcpy (currprefs.gfx_display_name, changed_prefs.gfx_display_name); currprefs.win32_alwaysontop = changed_prefs.win32_alwaysontop; + currprefs.win32_notaskbarbutton = changed_prefs.win32_notaskbarbutton; currprefs.win32_borderless = changed_prefs.win32_borderless; currprefs.win32_rtgmatchdepth = changed_prefs.win32_rtgmatchdepth; currprefs.win32_rtgscaleifsmall = changed_prefs.win32_rtgscaleifsmall; @@ -1103,7 +1105,7 @@ int check_prefs_changed_gfx (void) if (reopen (c & 2)) c |= 2; } - if ((c & 2) && !keepfsmode) { + if ((c & 32) || ((c & 2) && !keepfsmode)) { close_windows (); graphics_init (); } @@ -1616,7 +1618,7 @@ int machdep_init (void) void machdep_free (void) { #ifdef LOGITECHLCD - lcd_close(); + lcd_close (); #endif } @@ -1630,9 +1632,9 @@ int graphics_setup (void) { if (!DirectDraw_Start (NULL)) return 0; - DirectDraw_Release(); + DirectDraw_Release (); #ifdef PICASSO96 - InitPicasso96(); + InitPicasso96 (); #endif return 1; } @@ -1795,9 +1797,9 @@ static int create_windows_2 (void) int dxfs = currentmode->flags & (DM_DX_FULLSCREEN); int d3dfs = currentmode->flags & (DM_D3D_FULLSCREEN); int fsw = currentmode->flags & (DM_W_FULLSCREEN); - DWORD exstyle = currprefs.win32_notaskbarbutton ? 0 : WS_EX_APPWINDOW; + DWORD exstyle = currprefs.win32_notaskbarbutton ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW; DWORD flags = 0; - HWND hhWnd = currprefs.win32_notaskbarbutton ? hHiddenWnd : NULL; + HWND hhWnd = NULL;//currprefs.win32_notaskbarbutton ? hHiddenWnd : NULL; int borderless = currprefs.win32_borderless; DWORD style = NORMAL_WINDOW_STYLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; int cymenu = GetSystemMetrics (SM_CYMENU); @@ -1875,6 +1877,9 @@ static int create_windows_2 (void) if (d3dfs || dxfs) SetCursorPos (x + w / 2, y + h / 2); write_log ("window already open\n"); +#ifdef RETROPLATFORM + rp_set_hwnd (hAmigaWnd); +#endif return 1; } diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index d4e0fa1b..492c0377 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -1863,7 +1863,7 @@ static void setguititle (HWND phwnd) hwnd = phwnd; if (hwnd && !title[0]) { GetWindowText (hwnd, title, sizeof (title)); - if (WINUAEBETA > 0) { + if (strlen (WINUAEBETA) > 0) { strcat (title, BetaStr); if (strlen(WINUAEEXTRA) > 0) { strcat (title, " "); @@ -4306,7 +4306,7 @@ static void init_frequency_combo (HWND hDlg, int dmode) LRESULT index; i = 0; index = 0; - while ((freq = DisplayModes[dmode].refresh[i]) > 0 && index < MAX_REFRESH_RATES) { + while (dmode >= 0 && (freq = DisplayModes[dmode].refresh[i]) > 0 && index < MAX_REFRESH_RATES) { storedrefreshrates[index++] = freq; i++; } @@ -4446,6 +4446,7 @@ static int gui_display_depths[3]; static void init_display_mode (HWND hDlg) { int d, d2, index; + int i, cnt; switch (workprefs.color_mode) { @@ -4482,25 +4483,27 @@ static void init_display_mode (HWND hDlg) d = d / 8; } - if ((index = display_mode_index (workprefs.gfx_size_fs.width, workprefs.gfx_size_fs.height, d)) >= 0) { - int i, cnt; + index = display_mode_index (workprefs.gfx_size_fs.width, workprefs.gfx_size_fs.height, d); + if (index >= 0) SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_SETCURSEL, DisplayModes[index].residx, 0); - SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_RESETCONTENT, 0, 0); - cnt = 0; - gui_display_depths[0] = gui_display_depths[1] = gui_display_depths[2] = -1; - for (i = 0; DisplayModes[i].depth >= 0; i++) { - if (DisplayModes[i].depth > 1 && DisplayModes[i].residx == DisplayModes[index].residx) { - char tmp[64]; - sprintf (tmp, "%d", DisplayModes[i].depth * 8); - SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_ADDSTRING, 0, (LPARAM)tmp); - if (DisplayModes[i].depth == d) - SendDlgItemMessage (hDlg, IDC_RESOLUTIONDEPTH, CB_SETCURSEL, cnt, 0); - gui_display_depths[cnt] = DisplayModes[i].depth; - cnt++; - } + else + index = 0; + SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_RESETCONTENT, 0, 0); + cnt = 0; + gui_display_depths[0] = gui_display_depths[1] = gui_display_depths[2] = -1; + for (i = 0; DisplayModes[i].depth >= 0; i++) { + if (DisplayModes[i].depth > 1 && DisplayModes[i].residx == DisplayModes[index].residx) { + char tmp[64]; + sprintf (tmp, "%d", DisplayModes[i].depth * 8); + SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_ADDSTRING, 0, (LPARAM)tmp); + if (DisplayModes[i].depth == d) + SendDlgItemMessage (hDlg, IDC_RESOLUTIONDEPTH, CB_SETCURSEL, cnt, 0); + gui_display_depths[cnt] = DisplayModes[i].depth; + cnt++; } - init_frequency_combo (hDlg, index); } + init_frequency_combo (hDlg, index); + } static int display_toselect(int fs, int vsync, int p96) @@ -9086,6 +9089,10 @@ static INT_PTR CALLBACK PortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM { case IDC_PORT0_JOYS: case IDC_PORT1_JOYS: + case IDC_PRINTERLIST: + case IDC_SERIAL: + case IDC_MIDIOUTLIST: + case IDC_MIDIINLIST: values_from_portsdlg (hDlg); updatejoyport (hDlg); inputdevice_updateconfig (&workprefs); @@ -9307,11 +9314,10 @@ static void doinputcustom (HWND hDlg, int newcustom) } } -static void values_from_inputdlg (HWND hDlg, int inputchange) +static void values_from_inputdlgbottom (HWND hDlg) { - int doselect = 0, v; + int v; BOOL success; - LRESULT item; v = GetDlgItemInt (hDlg, IDC_INPUTDEADZONE, &success, FALSE); if (success) { @@ -9330,6 +9336,12 @@ static void values_from_inputdlg (HWND hDlg, int inputchange) v = GetDlgItemInt (hDlg, IDC_INPUTSPEEDM, &success, FALSE); if (success) currprefs.input_mouse_speed = workprefs.input_mouse_speed = v; +} + +static void values_from_inputdlg (HWND hDlg, int inputchange) +{ + int doselect = 0; + LRESULT item; item = SendDlgItemMessage (hDlg, IDC_INPUTAMIGACNT, CB_GETCURSEL, 0, 0L); if (item != CB_ERR && input_selected_sub_num != item) { @@ -9479,6 +9491,16 @@ static INT_PTR CALLBACK InputDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM inputdevice_set_device_status (input_selected_device, IsDlgButtonChecked( hDlg, IDC_INPUTDEVICEDISABLE) ? 1 : 0); break; default: + switch (LOWORD (wParam)) + { + case IDC_INPUTDEADZONE: + case IDC_INPUTAUTOFIRERATE: + case IDC_INPUTSPEEDD: + case IDC_INPUTSPEEDA: + case IDC_INPUTSPEEDM: + values_from_inputdlgbottom (hDlg); + break; + } if (HIWORD (wParam) == CBN_SELCHANGE || HIWORD (wParam) == CBN_KILLFOCUS) { switch (LOWORD (wParam)) { @@ -10020,9 +10042,8 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM switch (msg) { case WM_INITDIALOG: - #if WINUAEBETA == 0 - ShowWindow (GetDlgItem(hDlg, IDC_FILTERAUTORES), SW_HIDE); - #endif + if (strlen (WINUAEBETA) == 0) + ShowWindow (GetDlgItem(hDlg, IDC_FILTERAUTORES), SW_HIDE); pages[HW3D_ID] = hDlg; currentpage = HW3D_ID; SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_RESETCONTENT, 0, 0); @@ -10945,7 +10966,7 @@ static int do_filesys_insert (const char *root) int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) { - int cnt, i, drv, firstdrv, list; + int cnt, i, drv, drvdrag, firstdrv, list; char file[MAX_DPATH]; int dfxtext[] = { IDC_DF0TEXT, IDC_DF0TEXTQ, IDC_DF1TEXT, IDC_DF1TEXTQ, IDC_DF2TEXT, -1, IDC_DF3TEXT, -1 }; POINT pt; @@ -10959,6 +10980,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) if (!cnt) return 0; drv = 0; + drvdrag = 0; if (currentpage < 0) { GetClientRect (hMainWnd, &r2); GetClientRect (hStatusWnd, &r); @@ -10966,6 +10988,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) if (pt.x >= window_led_drives && pt.x < window_led_drives_end && window_led_drives > 0) { drv = pt.x - window_led_drives; drv /= (window_led_drives_end - window_led_drives) / 4; + drvdrag = 1; if (drv < 0 || drv > 3) drv = 0; } @@ -11018,7 +11041,9 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) } } - if (zip) { + if (drvdrag) { + type = ZFILE_DISKIMAGE; + } else if (zip) { do_filesys_insert (file); continue; } diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index c3fee835..ceb874a2 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,5 +1,37 @@ -Final +Beta 0.1: + +- "always on top" change works on the fly +- "no taskbar button" works on the fly +- missing stack frame type 4 added to RTE +- dragging zipped adf to floppy leds mounted it as a filesystem, not + as a disk image (I guess zip containing only disk image(s) dropped to + WinUAE window should also mount as a disk image?) +- emulated OCS-only "scanline" effect if DDFSTRT < 0x18. (Music disks + Ode to Ramon I and II by Digital Force. ECS = scroller is unreadable + and without "scanline" effect) +- "latest news/abandon"-fix broke "nakudemo"-fix, both work now +- parallel/serial/midi select menus didn't work +- Input-panel numeric boxes at the bottom didn't work (same as above) +- sleep_millis() was not thread-safe (could have caused random timing + glitches in some very rare cases) +- emulate joystick 2nd/3rd button pullup resistor because some games + require it (and apparently some/many Amiga compatible 2+ button pads + have it). For example BC.Kid 2-button mode won't work without + joystick/pad with pullup resistor in second button pin. (regular + single button joysticks don't have pullups) Analog joystick update in + 1.5.x "broke" this. +- POTxDAT X and Y counter bytes were inverted (Aladdin second button) +- reset current disk sound parameters when on the fly drive sound + settings are changed (does not fix missing motor sound until drive + motor restarts, not worth the trouble, at least not yet) +- replaced "shouldn't happen" abort()'s in JIT with error dialog and + forced hard reset +- highgfx superhires mode missing pixels fixed (also possible in some + normal max overscanned AGA-only screenmodes) + + +Final 1.5.2 - uaescsi.device only updated CMD_GETGEOMETRY parameters when emulation was started (and also broke CMD_READ if there was no CD in drive) diff --git a/od-win32/writelog.c b/od-win32/writelog.c index 87854960..42f1cc48 100755 --- a/od-win32/writelog.c +++ b/od-win32/writelog.c @@ -11,6 +11,7 @@ #include "debug_win32.h" #include "win32.h" #include "registry.h" +#include "uae.h" #define SHOW_CONSOLE 0 @@ -365,3 +366,23 @@ void log_close (void *f) { fclose (f); } + +void jit_abort (const char *format,...) +{ + static int happened; + int count; + char buffer[WRITE_LOG_BUF_SIZE]; + va_list parms; + va_start (parms, format); + + count = _vsnprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms); + writeconsole (buffer); + va_end (parms); + if (!happened) + gui_message ("JIT: Serious error:\n%s", buffer); + happened = 1; + uae_reset (1); +} + + +