From: Toni Wilen Date: Thu, 1 Jan 2015 11:32:27 +0000 (+0200) Subject: 3010b1 X-Git-Tag: 3100~147 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=db0d9660666076db92bcce2162a6144e47634e79;p=francis%2Fwinuae.git 3010b1 --- diff --git a/catweasel.cpp b/catweasel.cpp index e154d80c..cdfc6f74 100644 --- a/catweasel.cpp +++ b/catweasel.cpp @@ -405,7 +405,6 @@ static int catweasel4_configure (void) #define PCI_CW_MK4 _T("PCI\\VEN_E159&DEV_0001&SUBSYS_00035213") #define PCI_CW_MK4_BUG _T("PCI\\VEN_E159&DEV_0001&SUBSYS_00025213") -extern int os_winnt; int force_direct_catweasel; static int direct_detect(void) { @@ -415,8 +414,6 @@ static int direct_detect(void) int devIndex; int cw = 0; - if (!os_winnt) - return 0; devs = SetupDiGetClassDevsEx(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT, NULL, NULL, NULL); if (devs == INVALID_HANDLE_VALUE) return 0; diff --git a/cdtv.cpp b/cdtv.cpp index e1222cae..bdd211ae 100644 --- a/cdtv.cpp +++ b/cdtv.cpp @@ -1044,7 +1044,7 @@ static void dmac_start_dma (void) if (!(dmac_cntr & CNTR_PDMD)) { // non-scsi dma write_comm_pipe_u32 (&requests, 0x0100, 1); } else { - scsi_dmac_start_dma (&wd_cdtv); + scsi_dmac_a2091_start_dma (&wd_cdtv); } } static void dmac_stop_dma (void) @@ -1052,7 +1052,7 @@ static void dmac_stop_dma (void) if (!(dmac_cntr & CNTR_PDMD)) { // non-scsi dma ; } else { - scsi_dmac_stop_dma (&wd_cdtv); + scsi_dmac_a2091_stop_dma (&wd_cdtv); } } @@ -1065,7 +1065,7 @@ static void checkint (void) { int irq = 0; - if (currprefs.cs_cdtvscsi && (wdscsi_getauxstatus (&wd_cdtv) & 0x80)) { + if (currprefs.cs_cdtvscsi && (wdscsi_getauxstatus (&wd_cdtv.wc) & 0x80)) { dmac_istr |= ISTR_INTS; if ((dmac_cntr & CNTR_INTEN) && (dmac_istr & ISTR_INTS)) irq = 1; @@ -1257,11 +1257,11 @@ static uae_u32 dmac_bget2 (uaecptr addr) break; case 0x91: if (currprefs.cs_cdtvscsi) - v = wdscsi_getauxstatus (&wd_cdtv); + v = wdscsi_getauxstatus (&wd_cdtv.wc); break; case 0x93: if (currprefs.cs_cdtvscsi) { - v = wdscsi_get (&wd_cdtv); + v = wdscsi_get (&wd_cdtv.wc, &wd_cdtv); checkint (); } break; @@ -1364,13 +1364,13 @@ static void dmac_bput2 (uaecptr addr, uae_u32 b) break; case 0x91: if (currprefs.cs_cdtvscsi) { - wdscsi_sasr (&wd_cdtv, b); + wdscsi_sasr (&wd_cdtv.wc, b); checkint (); } break; case 0x93: if (currprefs.cs_cdtvscsi) { - wdscsi_put (&wd_cdtv, b); + wdscsi_put (&wd_cdtv.wc, &wd_cdtv, b); checkint (); } break; diff --git a/cfgfile.cpp b/cfgfile.cpp index b04d03e6..249d5974 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -221,6 +221,8 @@ static const TCHAR *cpuboards[] = { _T("WarpEngineA4000"), _T("TekMagic"), _T("A2630"), + _T("DKB12x0"), + _T("FusionForty"), NULL }; static const TCHAR *ppc_implementations[] = { @@ -252,7 +254,7 @@ static const TCHAR *lacer[] = { _T("off"), _T("i"), _T("p"), 0 }; static const TCHAR *hdcontrollers[] = { _T("uae"), _T("ide%d"), - _T("scsi%d"), _T("scsi%d_a2091"), _T("scsi%d_a2091-2"), _T("scsi%d_a4091"), _T("scsi%d_a4091-2"), + _T("scsi%d"), _T("scsi%d_a2091"), _T("scsi%d_a2091-2"), _T("scsi%d_gvp"), _T("scsi%d_gvp-2"), _T("scsi%d_a4091"), _T("scsi%d_a4091-2"), _T("scsi%d_fastlane"), _T("scsi%d_fastlane-2"), _T("scsi%d_oktagon2008"), _T("scsi%d_oktagon2008-2"), _T("scsi%d_a3000"), _T("scsi%d_a4000t"), _T("scsi%d_cdtv"), _T("scsi%d_cpuboard"), @@ -1026,6 +1028,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write_str (f, _T("kickstart_ext_rom="), p->romextident); cfgfile_write_board_rom(f, &p->path_rom, &p->a2091rom, _T("a2091")); + cfgfile_write_board_rom(f, &p->path_rom, &p->gvprom, _T("gvp")); cfgfile_write_board_rom(f, &p->path_rom, &p->a4091rom, _T("a4091")); cfgfile_write_board_rom(f, &p->path_rom, &p->fastlanerom, _T("fastlane")); cfgfile_write_board_rom(f, &p->path_rom, &p->oktagonrom, _T("oktagon2008")); @@ -1575,6 +1578,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite (f, _T("catweasel"), _T("0x%x"), p->catweasel); else cfgfile_dwrite (f, _T("catweasel"), _T("%d"), p->catweasel); + cfgfile_write_bool(f, _T("toccata"), p->sound_toccata); + cfgfile_write_str (f, _T("kbd_lang"), (p->keyboard_lang == KBD_LANG_DE ? _T("de") : p->keyboard_lang == KBD_LANG_DK ? _T("dk") @@ -1597,6 +1602,10 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite (f, _T("filesys_max_size"), _T("%d"), p->filesys_limit); cfgfile_dwrite (f, _T("filesys_max_name_length"), _T("%d"), p->filesys_max_name); cfgfile_dwrite (f, _T("filesys_max_file_size"), _T("%d"), p->filesys_max_file_size); + cfgfile_dwrite_bool (f, _T("filesys_inject_icons"), p->filesys_inject_icons); + cfgfile_dwrite_str (f, _T("filesys_inject_icons_drawer"), p->filesys_inject_icons_drawer); + cfgfile_dwrite_str (f, _T("filesys_inject_icons_project"), p->filesys_inject_icons_project); + cfgfile_dwrite_str (f, _T("filesys_inject_icons_tool"), p->filesys_inject_icons_tool); cfgfile_dwrite_str (f, _T("scsidev_mode"), uaescsidevmodes[p->uaescsidevmode]); #endif @@ -2126,6 +2135,10 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_intval (option, value, _T("filesys_max_size"), &p->filesys_limit, 1) || cfgfile_intval (option, value, _T("filesys_max_name_length"), &p->filesys_max_name, 1) || cfgfile_intval (option, value, _T("filesys_max_file_size"), &p->filesys_max_file_size, 1) + || cfgfile_yesno (option, value, _T("filesys_inject_icons"), &p->filesys_inject_icons) + || cfgfile_string (option, value, _T("filesys_inject_icons_drawer"), p->filesys_inject_icons_drawer, sizeof p->filesys_inject_icons_drawer / sizeof (TCHAR)) + || cfgfile_string (option, value, _T("filesys_inject_icons_project"), p->filesys_inject_icons_project, sizeof p->filesys_inject_icons_project / sizeof (TCHAR)) + || cfgfile_string (option, value, _T("filesys_inject_icons_tool"), p->filesys_inject_icons_tool, sizeof p->filesys_inject_icons_tool / sizeof (TCHAR)) || cfgfile_intval (option, value, _T("gfx_luminance"), &p->gfx_luminance, 1) || cfgfile_intval (option, value, _T("gfx_contrast"), &p->gfx_contrast, 1) @@ -3694,6 +3707,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH || cfgfile_yesno (option, value, _T("rtg_nocustom"), &p->picasso96_nocustom) || cfgfile_yesno (option, value, _T("floppy_write_protect"), &p->floppy_read_only) || cfgfile_yesno (option, value, _T("uae_hide_autoconfig"), &p->uae_hide_autoconfig) + || cfgfile_yesno (option, value, _T("toccata"), &p->sound_toccata) || cfgfile_yesno (option, value, _T("uaeserial"), &p->uaeserial)) return 1; @@ -3813,9 +3827,11 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH return 1; } - if (cfgfile_read_board_rom(option, value, &p->path_rom, &p->a2091rom, _T("a2091"), ROMTYPE_A2091BOOT)) + if (cfgfile_read_board_rom(option, value, &p->path_rom, &p->a2091rom, _T("a2091"), ROMTYPE_A2091)) + return 1; + if (cfgfile_read_board_rom(option, value, &p->path_rom, &p->gvprom, _T("gvp"), ROMTYPE_GVP)) return 1; - if (cfgfile_read_board_rom(option, value, &p->path_rom, &p->a4091rom, _T("a4091"), ROMTYPE_A4091BOOT)) + if (cfgfile_read_board_rom(option, value, &p->path_rom, &p->a4091rom, _T("a4091"), ROMTYPE_A4091)) return 1; if (cfgfile_read_board_rom(option, value, &p->path_rom, &p->fastlanerom, _T("fastlane"), ROMTYPE_FASTLANE)) return 1; @@ -4406,9 +4422,10 @@ static int cfgfile_load_2 (struct uae_prefs *p, const TCHAR *filename, bool real subst(p->path_rom.path[0], p->acceleratorextromfile, sizeof p->acceleratorextromfile / sizeof(TCHAR)); for (i = 0; i < MAX_BOARD_ROMS; i++) { - subst (p->path_rom.path[0], p->a2091rom.roms[i].romfile, MAX_DPATH / sizeof (TCHAR)); - subst (p->path_rom.path[0], p->a4091rom.roms[i].romfile, MAX_DPATH / sizeof (TCHAR)); - subst (p->path_rom.path[0], p->fastlanerom.roms[i].romfile, MAX_DPATH / sizeof (TCHAR)); + subst(p->path_rom.path[0], p->a2091rom.roms[i].romfile, MAX_DPATH / sizeof(TCHAR)); + subst(p->path_rom.path[0], p->gvprom.roms[i].romfile, MAX_DPATH / sizeof(TCHAR)); + subst(p->path_rom.path[0], p->a4091rom.roms[i].romfile, MAX_DPATH / sizeof(TCHAR)); + subst(p->path_rom.path[0], p->fastlanerom.roms[i].romfile, MAX_DPATH / sizeof (TCHAR)); } return 1; diff --git a/cpummu.cpp b/cpummu.cpp index 4b2067fc..eec7c75a 100644 --- a/cpummu.cpp +++ b/cpummu.cpp @@ -373,8 +373,7 @@ void mmu_bus_error(uaecptr addr, int fc, bool write, int size, bool rmw, uae_u32 } } - if (mmu040_movem && !write) { - // save EA when MOVEM is something like + if (mmu040_movem) { ssw |= MMU_SSW_CM; regs.mmu_effective_addr = mmu040_movem_ea; mmu040_movem = 0; diff --git a/custom.cpp b/custom.cpp index 474ad185..947af5d2 100644 --- a/custom.cpp +++ b/custom.cpp @@ -62,6 +62,7 @@ #include "sampler.h" #include "clipboard.h" #include "cpuboard.h" +#include "sndboard.h" #ifdef RETROPLATFORM #include "rp.h" #endif @@ -2554,40 +2555,20 @@ static void start_bpl_dma (int hpos, int hstart) last_fetch_hpos = hstart; } -#if 0 -/* this may turn on datafetch if program turns dma on during the ddf */ -static void maybe_start_bpl_dma (int hpos) -{ - /* OCS: BPL DMA never restarts if DMA is turned on during DDF - * ECS/AGA: BPL DMA restarts but only if DMA was turned off - outside of DDF or during current line, otherwise display - processing jumps immediately to "DDFSTOP passed"-condition */ - if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) { - bitplane_dma_turned_on = hpos; - return; - } - if (fetch_state != fetch_not_started) - return; - if (diwstate != DIW_waiting_stop) - return; - if (hpos <= plfstrt) - return; - if (hpos >= plfstop) - return; - if (ddfstate != DIW_waiting_start) - plf_state = plf_passed_stop; - start_bpl_dma (hpos, hpos); -} -#endif - STATIC_INLINE bool cant_this_last_line (void) { + // Last line.. + // ..works normally if A1000 Agnus + if (currprefs.cs_dipagnus) + return false; + // ..inhibits bitplane and sprite DMA if later Agnus revision. return vpos + 1 >= maxvpos + lof_store; } /* This function is responsible for turning on datafetch if necessary. */ static void decide_line (int hpos) { + /* Take care of the vertical DIW. */ if (vpos == plffirstline) { // A1000 Agnus won't start bitplane DMA if vertical diw is zero. @@ -2621,6 +2602,7 @@ static void decide_line (int hpos) } if (diwstate == DIW_waiting_stop) { + bool strtpassed = false; if (dmaecs) { if (last_decide_line_hpos < plfstrt && hpos >= plfstrt) { @@ -2629,19 +2611,35 @@ static void decide_line (int hpos) if (plf_state == plf_start && hpos - 2 != ddfstrt_old_hpos) plf_state = plf_active; bplstart = plfstrt; + /* needed to handle non-cycle exact situation where single call to + * decide_line() handles both start and stop conditions + */ + strtpassed = true; + } + } + + if (dma) { + if (plf_state == plf_active && (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS) || hpos >= 0x18 || HARD_DDF_LIMITS_DISABLED)) { + start_bpl_dma (hpos, bplstart); + last_decide_line_hpos = hpos; +#ifndef CUSTOM_SIMPLE + do_sprites (hpos); +#endif + return; } } if (dmaecs) { // did we just match ddfstop - 3 but missed ddfstrt? DMA starts from passed plfstop state. - if (last_decide_line_hpos > plfstrt && (plf_state == plf_active || plf_state == plf_wait_stop) && diwstate == DIW_waiting_stop) { - int stop = get_ddfstop_to_test (last_decide_line_hpos); + if ((last_decide_line_hpos > plfstrt || (strtpassed && plfstop >= plfstrt)) && (plf_state == plf_active || plf_state == plf_wait_stop) && diwstate == DIW_waiting_stop) { + int stop = get_ddfstop_to_test(last_decide_line_hpos); if (last_decide_line_hpos < stop && hpos >= stop - 3) { if (dma) { // we did, fetches start! bplstart = plfstop; plf_state = plf_active; - } else { + } + else { // line done plf_state = plf_end; } @@ -2649,16 +2647,6 @@ static void decide_line (int hpos) } } - if (dma) { - if (plf_state == plf_active && (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS) || hpos >= 0x18 || HARD_DDF_LIMITS_DISABLED)) { - start_bpl_dma (hpos, bplstart); - last_decide_line_hpos = hpos; -#ifndef CUSTOM_SIMPLE - do_sprites (hpos); -#endif - return; - } - } } } @@ -3556,6 +3544,7 @@ void compute_vsynctime (void) double clk = svpos * shpos * fake_vblank_hz; //write_log (_T("SNDRATE %.1f*%.1f*%.6f=%.6f\n"), svpos, shpos, fake_vblank_hz, clk); update_sound (clk); + update_sndboard_sound (clk); } cd32_fmv_set_sync(svpos); } @@ -4635,6 +4624,9 @@ static void rethink_intreq (void) #endif #ifdef NCR9X ncr9x_rethink(); +#endif +#ifdef WITH_TOCCATA + sndboard_rethink(); #endif rethink_gayle (); /* cpuboard_rethink must be last */ @@ -4850,7 +4842,6 @@ static void BPLxPTL (int hpos, uae_u16 v, int num) decide_line (hpos); decide_fetch_safe (hpos); reset_dbplh (hpos, num); - //v += corrupt_offset; /* chipset feature: BPLxPTL write and next cycle doing DMA fetch using same pointer register -> * this write goes nowhere (same happens with all DMA channels, not just BPL) * (intro MoreNewStuffy by PlasmaForce) @@ -6217,6 +6208,7 @@ void blitter_done_notify (int hpos) cop_state.hpos = hpos; cop_state.vpos = vp; cop_state.state = COP_wait; + /* No need to check blitter state again */ cop_state.saved_i2 |= 0x8000; #ifdef DEBUGGER @@ -6232,30 +6224,6 @@ void blitter_done_notify (int hpos) } else { unset_special (SPCFLAG_COPPER); } - -#if 0 - hpos += 3; - hpos &= ~1; - if (hpos >= maxhpos) { - hpos -= maxhpos; - vp++; - } - cop_state.hpos = hpos; - cop_state.vpos = vp; - cop_state.state = COP_read1; - -#ifdef DEBUGGER - if (debug_dma) - record_dma_event (DMA_EVENT_COPPERWAKE, hpos, vp); - if (debug_copper) - record_copper_blitwait (cop_state.ip - 4, hpos, vp); -#endif - - if (dmaen (DMA_COPPER) && vp == vpos) { - copper_enabled_thisline = 1; - set_special (SPCFLAG_COPPER); - } -#endif } void do_copper (void) @@ -6337,12 +6305,12 @@ static void do_sprites_1(int num, int cycle, int hpos) // fetch both sprite pairs even if DMA was switched off between sprites int isdma = dmaen (DMA_SPRITE) || ((num & 1) && spr[num & ~1].dmacycle); - // A1000 Agnus off by one. - if (cant_this_last_line() && !currprefs.cs_dipagnus) + if (cant_this_last_line()) return; - if (isdma && vpos == sprite_vblank_endline) - spr_arm (num, 0); +// see SPRxCTRL below +// if (isdma && vpos == sprite_vblank_endline) +// spr_arm (num, 0); #ifdef AGA if (isdma && s->dblscan && (fmode & 0x8000) && (vpos & 1) != (s->vstart & 1) && s->dmastate) { @@ -6396,6 +6364,10 @@ static void do_sprites_1(int num, int cycle, int hpos) SPRxPOS_1 (data, num, hpos); s->dmacycle = 1; } else { + // This is needed to disarm previous field's sprite. + // It can be seen on OCS Agnus + ECS Denise combination where + // this cycle is disabled due to weird DDFTSTR=$18 copper list + // which causes corrupted sprite to "wrap around" the display. SPRxCTL_1 (data, num, hpos); s->dmastate = 0; sprstartstop (s); @@ -7233,7 +7205,9 @@ static void vsync_handler_post (void) if (!picasso_on) gfxboard_vsync_handler (); #endif - +#ifdef WITH_TOCCATA + sndboard_vsync(); +#endif if (varsync_changed || (beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80))) { init_hz (); } else if (vpos_count > 0 && abs (vpos_count - vpos_count_diff) > 1 && vposw_change < 4) { @@ -7539,6 +7513,9 @@ static void hsync_handler_pre (bool onvsync) #ifdef WITH_PPC uae_ppc_hsync_handler(); cpuboard_hsync(); +#endif +#ifdef WITH_TOCCATA + sndboard_hsync(); #endif DISK_hsync (); if (currprefs.produce_sound) @@ -7709,9 +7686,20 @@ static void hsync_handler_post (bool onvsync) } #endif if (currprefs.m68k_speed < 0 && !currprefs.cpu_cycle_exact) { + static int sleeps_remaining; if (is_last_line ()) { + sleeps_remaining = (165 - currprefs.cpu_idle) / 6; + if (sleeps_remaining < 0) + sleeps_remaining = 0; /* really last line, just run the cpu emulation until whole vsync time has been used */ - if (currprefs.m68k_speed_throttle) { + if (regs.stopped && currprefs.cpu_idle) { + // CPU in STOP state: sleep if enough time left. + frame_time_t rpt = read_processor_time (); + while (!vsync_isdone () && (int)vsyncmintime - (int)(rpt + vsynctimebase / 10) > 0 && (int)vsyncmintime - (int)rpt < vsynctimebase) { + cpu_sleep_millis(1); + rpt = read_processor_time (); + } + } else if (currprefs.m68k_speed_throttle) { vsyncmintime = read_processor_time (); /* end of CPU emulation time */ is_syncline = 0; } else { @@ -7731,15 +7719,21 @@ static void hsync_handler_post (bool onvsync) frame_time_t rpt = read_processor_time (); /* Extra time left? Do some extra CPU emulation */ if ((int)vsyncmintime - (int)rpt > 0) { - is_syncline = 1; - /* limit extra time */ - is_syncline_end = rpt + vsynctimeperline; - linecounter = 0; + if (regs.stopped && currprefs.cpu_idle && sleeps_remaining > 0) { + // STOP STATE: sleep. + cpu_sleep_millis(1); + sleeps_remaining--; + } else { + is_syncline = 1; + /* limit extra time */ + is_syncline_end = rpt + vsynctimeperline; + linecounter = 0; + } } } if (!isvsync ()) { // extra cpu emulation time if previous 10 lines without extra time. - if (!is_syncline && linecounter >= 10) { + if (!is_syncline && linecounter >= 10 && (!regs.stopped || !currprefs.cpu_idle)) { is_syncline = -1; is_syncline_end = read_processor_time () + vsynctimeperline; linecounter = 0; @@ -8045,10 +8039,14 @@ void custom_reset (bool hardreset, bool keyboardreset) gayle_reset (0); #ifdef A2091 a2091_reset (); + gvp_reset (); #endif #ifdef GFXBOARD gfxboard_reset (); #endif +#ifdef WITH_TOCCATA + sndboard_reset(); +#endif #ifdef NCR ncr710_reset(); ncr_reset(); @@ -9237,7 +9235,7 @@ uae_u8 *save_custom_extra (int *len, uae_u8 *dstptr) else dstbak = dst = xmalloc (uae_u8, 1000); - SL ((currprefs.cs_compatible << 24) | (&get_mem_bank (0) != &chipmem_bank ? 2 : 0) | 1); + SL ((currprefs.cs_compatible << 24) | (get_mem_bank_real(0) != &chipmem_bank ? 2 : 0) | 1); SB (currprefs.genlock ? 1 : 0); SB (currprefs.cs_rtc); SL (currprefs.cs_rtc_adjust); diff --git a/debug.cpp b/debug.cpp index 4aaf2a3e..6de6ba52 100644 --- a/debug.cpp +++ b/debug.cpp @@ -1882,7 +1882,11 @@ static int debug_mem_off (uaecptr *addrp) uaecptr addr = *addrp; addrbank *ba; int offset = munge24 (addr) >> 16; + if (!debug_mem_banks) + return offset; ba = debug_mem_banks[offset]; + if (!ba) + return offset; addr = (addr & ba->mask) | ba->startmask; *addrp = addr; return offset; @@ -2463,6 +2467,7 @@ static void memwatch_remap (uaecptr addr) TCHAR tmp[200]; _stprintf (tmp, _T("%s [D]"), bank->name); ms->addr = bank; + ms->banknr = banknr; newbank = &ms->newbank; memcpy (newbank, bank, sizeof addrbank); newbank->bget = mode ? mmu_bget : debug_bget; @@ -2591,6 +2596,17 @@ int debug_bankchange (int mode) return -1; } +addrbank *get_mem_bank_real(uaecptr addr) +{ + addrbank *ab = &get_mem_bank(addr); + if (!memwatch_enabled) + return ab; + addrbank *ab2 = debug_mem_banks[addr >> 16]; + if (ab2) + return ab2; + return ab; +} + struct mw_acc { uae_u32 mask; diff --git a/drawing.cpp b/drawing.cpp index e068b103..d4d59571 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2449,6 +2449,7 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in int do_double = 0; bool have_color_changes; enum double_how dh; + int ls = linestate[lineno]; dp_for_drawing = line_decisions + lineno; dip_for_drawing = curr_drawinfo + lineno; @@ -2458,7 +2459,7 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in resolution_count[dp_for_drawing->bplres]++; } - switch (linestate[lineno]) + switch (ls) { case LINE_REMEMBERED_AS_PREVIOUS: // if (!warned) // happens when program messes up with VPOSW @@ -2648,8 +2649,8 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in int tmp = hposblank; hposblank = 1; fill_line_border (); - do_flush_line (vb, gfx_ypos); hposblank = tmp; + do_flush_line(vb, gfx_ypos); } } @@ -2900,7 +2901,8 @@ static void init_drawing_frame (void) maxline = ((maxvpos_display + 1) << linedbl) + 2; #ifdef SMART_UPDATE for (i = 0; i < maxline; i++) { - switch (linestate[i]) { + int ls = linestate[i]; + switch (ls) { case LINE_DONE_AS_PREVIOUS: linestate[i] = LINE_REMEMBERED_AS_PREVIOUS; break; @@ -3086,6 +3088,8 @@ static void lightpen_update (struct vidbuffer *vb) struct vidbuffer *xvbin, *xvbout; +#define LARGEST_LINE_DEBUG 0 + static void draw_frame2 (struct vidbuffer *vbin, struct vidbuffer *vbout) { int i; @@ -3093,23 +3097,32 @@ static void draw_frame2 (struct vidbuffer *vbin, struct vidbuffer *vbout) xvbin = vbin; xvbout = vbout; -// int largest = 0; +#if LARGEST_LINE_DEBUG + int largest = 0; +#endif for (i = 0; i < max_ypos_thisframe; i++) { int i1 = i + min_ypos_for_screen; int line = i + thisframe_y_adjust_real; - int where2 = amiga2aspect_line_map[i1]; + int whereline = amiga2aspect_line_map[i1]; + int wherenext = amiga2aspect_line_map[i1 + 1]; - if (where2 >= vbin->inheight) + if (whereline >= vbin->inheight) break; - if (where2 < 0) + if (whereline < 0) continue; -// if (largest < where2) -// largest = where2; +#if LARGEST_LINE_DEBUG + if (largest < whereline) + largest = whereline; +#endif + hposblank = 0; - pfield_draw_line (vbout, line, where2, amiga2aspect_line_map[i1 + 1]); + pfield_draw_line(vbout, line, whereline, wherenext); } + +#if LARGEST_LINE_DEBUG //write_log (_T("%d\n"), largest); +#endif } bool draw_frame (struct vidbuffer *vb) @@ -3412,20 +3425,28 @@ void hsync_record_line_state (int lineno, enum nln_how how, int changed) case nln_lower_black_always: state[1] = LINE_BLACK; *state = LINE_DECIDED; +// if (lineno == (maxvpos + lof_store) * 2 - 1) +// *state = LINE_BLACK; break; case nln_lower_black: changed += state[0] != LINE_DONE; state[1] = LINE_DONE; *state = changed ? LINE_DECIDED : LINE_DONE; +// if (lineno == (maxvpos + lof_store) * 2 - 1) +// *state = LINE_BLACK; break; case nln_upper_black_always: *state = LINE_DECIDED; state[-1] = LINE_BLACK; + if (!interlace_seen && lineno == (maxvpos + lof_store) * 2 - 2) + state[1] = LINE_BLACK; break; case nln_upper_black: changed += state[0] != LINE_DONE; *state = changed ? LINE_DECIDED : LINE_DONE; state[-1] = LINE_DONE; + if (!interlace_seen && lineno == (maxvpos + lof_store) * 2 - 2) + state[1] = LINE_DONE; break; } } diff --git a/expansion.cpp b/expansion.cpp index 43dd95d5..9971f525 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -33,6 +33,7 @@ #include "debug.h" #include "gayle.h" #include "cpuboard.h" +#include "sndboard.h" #include "uae/ppc.h" #define EXP_DEBUG 0 @@ -461,7 +462,8 @@ void expamem_next (addrbank *mapped, addrbank *next) if (ecard < cardno) { call_card_init(ecard); } else { - expamem_init_clear2 (); + expamem_init_clear2(); + expamem_init_last(); } } @@ -1061,6 +1063,7 @@ static addrbank *expamem_init_fastcard_2 (int boardnum) uae_u8 pid; uae_u8 type = add_memory | zorroII | (cfgfile_board_enabled(&currprefs.a2091rom) && !boardnum ? chainedconfig : 0); int allocated = boardnum ? fastmem2_bank.allocated : fastmem_bank.allocated; + uae_u32 serial = 1; expamem_init_clear (); if (allocated == 65536) @@ -1090,6 +1093,11 @@ static addrbank *expamem_init_fastcard_2 (int boardnum) } else if (cfgfile_board_enabled(&currprefs.a2091rom) || currprefs.uae_hide) { pid = commodore_a2091_ram; mid = commodore; + serial = 0; + } else if (cfgfile_board_enabled(&currprefs.gvprom)) { + pid = 10; + mid = 2017; + serial = 0; } else { pid = currprefs.maprom && !currprefs.cpuboard_type ? 1 : 81; mid = uae_id; @@ -1104,10 +1112,10 @@ static addrbank *expamem_init_fastcard_2 (int boardnum) expamem_write (0x10, mid >> 8); expamem_write (0x14, mid & 0xff); - expamem_write (0x18, 0x00); /* ser.no. Byte 0 */ - expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */ - expamem_write (0x20, 0x00); /* ser.no. Byte 2 */ - expamem_write (0x24, 0x01); /* ser.no. Byte 3 */ + expamem_write (0x18, serial >> 24); /* ser.no. Byte 0 */ + expamem_write (0x1c, serial >> 16); /* ser.no. Byte 1 */ + expamem_write (0x20, serial >> 8); /* ser.no. Byte 2 */ + expamem_write (0x24, serial >> 0); /* ser.no. Byte 3 */ expamem_write (0x28, 0x00); /* Rom-Offset hi */ expamem_write (0x2c, 0x00); /* ROM-Offset lo */ @@ -1627,6 +1635,12 @@ uaecptr need_uae_boot_rom (void) return v; } +#ifdef WITH_TOCCATA +static addrbank *expamem_init_toccata(void) +{ + return sndboard_init(); +} +#endif #ifdef A2065 static addrbank *expamem_init_a2065(void) { @@ -1651,6 +1665,18 @@ static addrbank *expamem_init_a2091_2(void) return a2091_init (1); } #endif +#ifdef A2091 +static addrbank *expamem_init_gvp(void) +{ + return gvp_init(0); +} +#endif +#ifdef A2091 +static addrbank *expamem_init_gvp_2(void) +{ + return gvp_init(1); +} +#endif #ifdef NCR static addrbank *expamem_init_a4091(void) { @@ -1680,6 +1706,10 @@ static addrbank *expamem_init_warpengine(void) { return ncr710_warpengine_autoconfig_init(); } +static addrbank *expamem_init_dkb1200(void) +{ + return ncr_dkb_autoconfig_init(); +} #endif #ifdef GFXBOARD static addrbank *expamem_init_gfxboard_memory(void) @@ -1767,6 +1797,17 @@ void expamem_reset (void) card_map[cardno++] = NULL; } #endif +#ifdef A2091 + if (cfgfile_board_enabled(&currprefs.gvprom)) { + card_flags[cardno] = 0; + card_name[cardno] = _T("GVP"); + card_init[cardno] = expamem_init_gvp; + card_map[cardno++] = NULL; + card_name[cardno] = _T("GVP #2"); + card_init[cardno] = expamem_init_gvp_2; + card_map[cardno++] = NULL; + } +#endif #ifdef NCR if (cfgfile_board_enabled(&currprefs.oktagonrom)) { card_name[cardno] = _T("Oktagon 2008"); @@ -1845,6 +1886,14 @@ void expamem_reset (void) } } #endif +#ifdef WITH_TOCCATA + if (currprefs.sound_toccata) { + card_flags[cardno] = 0; + card_name[cardno] = _T("Toccata"); + card_init[cardno] = expamem_init_toccata; + card_map[cardno++] = NULL; + } +#endif /* Z3 boards last */ if (!currprefs.address_space_24) { @@ -1855,6 +1904,11 @@ void expamem_reset (void) card_init[cardno] = expamem_init_warpengine; card_map[cardno++] = NULL; } + if (currprefs.cpuboard_type == BOARD_DKB1200) { + card_name[cardno] = _T("DKB SCSI"); + card_init[cardno] = expamem_init_dkb1200; + card_map[cardno++] = NULL; + } if (z3fastmem_bank.baseaddr != NULL) { z3num = 0; card_flags[cardno] = 2 | 1; @@ -1918,13 +1972,6 @@ void expamem_reset (void) #endif } - if (cardno > 0 && cardno < MAX_EXPANSION_BOARDS) { - card_flags[cardno] = 0; - card_name[cardno] = _T("Empty"); - card_init[cardno] = expamem_init_last; - card_map[cardno++] = expamem_map_clear; - } - expamem_z3_pointer = 0; expamem_z3_sum = 0; if (cardno == 0 || savestate_state) diff --git a/filesys.cpp b/filesys.cpp index 73955e20..9d8e7c84 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -134,6 +134,7 @@ static uae_u32 cdfs_devname, cdfs_handlername; static int filesys_in_interrupt; static uae_u32 mountertask; static int automountunit = -1; +static int autocreatedunit; static int cd_unit_offset, cd_unit_number; #define FS_STARTUP 0 @@ -789,6 +790,9 @@ static bool add_cpuboard_scsi_unit(int unit, struct uaedev_config_info *uci) if (currprefs.cpuboard_type == BOARD_WARPENGINE_A4000) { warpengine_add_scsi_unit(unit, uci); added = true; + } else if (currprefs.cpuboard_type == BOARD_DKB1200) { + cpuboard_dkb_add_scsi_unit(unit, uci); + added = true; } else if (currprefs.cpuboard_type == BOARD_TEKMAGIC) { tekmagic_add_scsi_unit(unit, uci); added = true; @@ -839,14 +843,29 @@ static bool add_scsi_unit(int type, int unit, struct uaedev_config_info *uci) } else if (type == HD_CONTROLLER_TYPE_SCSI_A2091) { #ifdef A2091 if (cfgfile_board_enabled(&currprefs.a2091rom)) { - a2091_add_scsi_unit (unit, uci, 0); + a2091_add_scsi_unit(unit, uci, 0); added = true; } #endif } else if (type == HD_CONTROLLER_TYPE_SCSI_A2091_2) { #ifdef A2091 if (cfgfile_board_enabled(&currprefs.a2091rom)) { - a2091_add_scsi_unit (unit, uci, 1); + a2091_add_scsi_unit(unit, uci, 1); + added = true; + } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_GVP) { +#ifdef A2091 + if (cfgfile_board_enabled(&currprefs.gvprom)) { + gvp_add_scsi_unit(unit, uci, 0); + added = true; + } +#endif + } + else if (type == HD_CONTROLLER_TYPE_SCSI_GVP_2) { +#ifdef A2091 + if (cfgfile_board_enabled(&currprefs.gvprom)) { + gvp_add_scsi_unit(unit, uci, 1); added = true; } #endif @@ -903,6 +922,7 @@ static void initialize_mountinfo (void) UnitInfo *uip = &mountinfo.ui[0]; cd_unit_offset = MAX_FILESYSTEM_UNITS; + autocreatedunit = 0; for (nr = 0; nr < currprefs.mountitems; nr++) { struct uaedev_config_data *uci = &currprefs.mountconfig[nr]; @@ -1551,6 +1571,19 @@ static uae_u32 fs_fsize (struct fs_filehandle *fsf) return (uae_u32)fs_fsize64 (fsf); } +static uae_s64 key_filesize(Key *k) +{ + if (k->aino->vfso) + return k->aino->vfso->size; + return fs_fsize64 (k->fd); +} +static uae_s64 key_seek(Key *k, uae_s64 offset, int whence) +{ + if (k->aino->vfso) + return k->file_pos; + return fs_lseek64 (k->fd, offset, whence); +} + static void set_highcyl (UnitInfo *ui, uae_u32 blocks) { uaecptr startup = get_long (ui->devicenode + 7 * 4) << 2; @@ -1945,7 +1978,7 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf if (uci) _tcscpy (devname, uci->ci.devname); else - _stprintf (devname, _T("RDH%d"), nr_units ()); + _stprintf (devname, _T("RDH%d"), autocreatedunit++); _tcscpy (ci.devname, devname); _tcscpy (ci.volname, volptr); _tcscpy (ci.rootdir, rootdir); @@ -2644,7 +2677,7 @@ static a_inode *lookup_child_aino (Unit *unit, a_inode *base, TCHAR *rel, int *e } /* Different version because for this one, REL is an nname. */ -static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR *rel, uae_u32 *err, uae_u64 uniq_external) +static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR *rel, uae_u32 *err, uae_u64 uniq_external, struct virtualfilesysobject *vfso) { a_inode *c = base->child; int l0 = _tcslen (rel); @@ -2664,7 +2697,7 @@ static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR * } if (c != 0) return c; - if (!isvirtual) + if (!isvirtual && !vfso) c = fsdb_lookup_aino_nname (base, rel); if (c == 0) { c = xcalloc (a_inode, 1); @@ -2678,12 +2711,17 @@ static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR * c->comment = 0; c->uniq_external = uniq_external; c->has_dbentry = 0; - if (!fill_file_attrs (unit, base, c)) { + if (vfso) { + c->dir = vfso->dir; + c->comment = my_strdup(vfso->comment); + c->amigaos_mode = vfso->amigaos_mode; + c->vfso = vfso; + } else if (!fill_file_attrs (unit, base, c)) { xfree (c); *err = ERROR_NO_FREE_STORE; return 0; } - if (c->dir && !isvirtual) + if (c->dir && !isvirtual && !vfso) fsdb_clean_dir (c); } init_child_aino (unit, base, c); @@ -3755,7 +3793,13 @@ static void TCHAR *xs; char *x, *x2; - if (!get_statinfo(unit, aino, &statbuf)) { + if (aino->vfso) { + fsdb_can = 1; + statbuf.mode = aino->vfso->amigaos_mode; + statbuf.mtime.tv_sec = 0; + statbuf.mtime.tv_usec = 0; + statbuf.size = aino->vfso->size; + } else if (!get_statinfo(unit, aino, &statbuf)) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_NOT_A_DOS_DISK); return; @@ -4195,6 +4239,18 @@ static bool filesys_name_invalid (const TCHAR *fn) return _tcslen (fn) > currprefs.filesys_max_name; } +static int filesys_readdir(struct fs_dirhandle *d, TCHAR *fn, uae_u64 *uniq) +{ + int ok = 0; + if (d->fstype == FS_ARCHIVE) + ok = zfile_readdir_archive(d->zd, fn); + else if (d->fstype == FS_DIRECTORY) + ok = my_readdir(d->od, fn); + else if (d->fstype == FS_CDFS) + ok = isofs_readdir(d->isod, fn, uniq); + return ok; +} + static int action_examine_all_do (Unit *unit, uaecptr lock, ExAllKey *eak, uaecptr exalldata, uae_u32 exalldatasize, uae_u32 type, uaecptr control) { a_inode *aino, *base = NULL; @@ -4212,14 +4268,7 @@ static int action_examine_all_do (Unit *unit, uaecptr lock, ExAllKey *eak, uaecp d = eak->dirhandle; if (!eak->fn) { do { - if (d->fstype == FS_ARCHIVE) - ok = zfile_readdir_archive (d->zd, fn); - else if (d->fstype == FS_DIRECTORY) - ok = my_readdir (d->od, fn); - else if (d->fstype == FS_CDFS) - ok = isofs_readdir (d->isod, fn, &uniq); - else - ok = 0; + ok = filesys_readdir(d, fn, &uniq); } while (ok && d->fstype == FS_DIRECTORY && (filesys_name_invalid (fn) || fsdb_name_invalid_dir (fn))); if (!ok) return 0; @@ -4228,7 +4277,7 @@ static int action_examine_all_do (Unit *unit, uaecptr lock, ExAllKey *eak, uaecp xfree (eak->fn); eak->fn = NULL; } - aino = lookup_child_aino_for_exnext (unit, base, fn, &err, uniq); + aino = lookup_child_aino_for_exnext (unit, base, fn, &err, uniq, NULL); if (!aino) return 0; eak->id = unit->exallid++; @@ -4451,6 +4500,72 @@ static void action_examine_object (Unit *unit, dpacket packet) get_fileinfo (unit, packet, info, aino, false); } +extern unsigned char def_tool[]; +extern unsigned int def_tool_len; +extern unsigned char def_project[]; +extern unsigned int def_project_len; +extern unsigned char def_drawer[]; +extern unsigned int def_drawer_len; +static struct virtualfilesysobject vfso_icon_tool; +static struct virtualfilesysobject vfso_icon_project; +static struct virtualfilesysobject vfso_icon_drawer; + +static void load_injected_icon(struct virtualfilesysobject *vfso, const TCHAR *fn, uae_u8 *default_data, int default_size) +{ + uae_u8 *data = NULL; + int size; + + xfree(vfso->data); + if (fn && fn[0]) + data = zfile_load_file(fn, &size); + if (!data) { + vfso->data = xmalloc(uae_u8, default_size); + memcpy(vfso->data, default_data, default_size); + vfso->size = default_size; + return; + } + vfso->data = data; + vfso->size = size; +} + +static void load_injected_icons(void) +{ + load_injected_icon(&vfso_icon_tool, currprefs.filesys_inject_icons_tool, def_tool, def_tool_len); + load_injected_icon(&vfso_icon_project, currprefs.filesys_inject_icons_project, def_project, def_project_len); + load_injected_icon(&vfso_icon_drawer, currprefs.filesys_inject_icons_drawer, def_drawer, def_drawer_len); +} + +static void inject_icons_to_directory(Unit *unit, a_inode *base) +{ + for (a_inode *aino = base->child; aino; aino = aino->sibling) { + int len = _tcslen(aino->aname); + if (len >= 5 && !_tcsicmp(aino->aname + len - 5, _T(".info"))) + continue; + TCHAR tmp[256]; + _stprintf(tmp, _T("%s.info"), aino->aname); + bool match = false; + for (a_inode *aino2 = base->child; aino2; aino2 = aino2->sibling) { + if (!_tcsicmp(aino2->aname, tmp)) + match = true; + } + if (match) + continue; + uae_u32 err; + struct virtualfilesysobject *vfso; + if (aino->dir) { + vfso = &vfso_icon_drawer; + } else { + struct mystat statbuf; + get_statinfo(unit, aino, &statbuf); + if (statbuf.mode & A_FIBF_EXECUTE) + vfso = &vfso_icon_tool; + else + vfso = &vfso_icon_project; + } + lookup_child_aino_for_exnext(unit, base, tmp, &err, 0, vfso); + } +} + /* Read a directory's contents, create a_inodes for each file, and mark them as locked in memory so that recycle_aino will not reap them. @@ -4481,22 +4596,17 @@ static void populate_directory (Unit *unit, a_inode *base) /* Find next file that belongs to the Amiga fs (skipping things like "..", "." etc. */ do { - if (d->fstype == FS_ARCHIVE) - ok = zfile_readdir_archive (d->zd, fn); - else if (d->fstype == FS_DIRECTORY) - ok = my_readdir (d->od, fn); - else if (d->fstype == FS_CDFS) - ok = isofs_readdir (d->isod, fn, &uniq); - else - ok = 0; + ok = filesys_readdir(d, fn, &uniq); } while (ok && d->fstype == FS_DIRECTORY && (filesys_name_invalid (fn) || fsdb_name_invalid_dir (fn))); if (!ok) break; /* This calls init_child_aino, which will notice that the parent is being ExNext()ed, and it will increment the locked counts. */ - aino = lookup_child_aino_for_exnext (unit, base, fn, &err, uniq); + aino = lookup_child_aino_for_exnext (unit, base, fn, &err, uniq, NULL); } fs_closedir (d); + if (currprefs.filesys_inject_icons) + inject_icons_to_directory(unit, base); } static bool do_examine (Unit *unit, dpacket packet, a_inode *aino, uaecptr info, bool longfilesize) @@ -4507,7 +4617,7 @@ static bool do_examine (Unit *unit, dpacket packet, a_inode *aino, uaecptr info, break; name = aino->nname; get_fileinfo (unit, packet, info, aino, longfilesize); - if (!(unit->volflags & (MYVOLUMEINFO_ARCHIVE | MYVOLUMEINFO_CDFS)) && !fsdb_exists(name)) { + if (!aino->vfso && !(unit->volflags & (MYVOLUMEINFO_ARCHIVE | MYVOLUMEINFO_CDFS)) && !fsdb_exists(name)) { TRACE ((_T("%s orphaned"), name)); return false; } @@ -4520,6 +4630,8 @@ static bool do_examine (Unit *unit, dpacket packet, a_inode *aino, uaecptr info, return true; } +#define EXNEXT_DEBUG 0 + static void action_examine_next (Unit *unit, dpacket packet, bool largefilesize) { uaecptr lock = GET_PCK_ARG1 (packet) << 2; @@ -4551,11 +4663,39 @@ static void action_examine_next (Unit *unit, dpacket packet, bool largefilesize) } else { daino = lookup_aino(unit, uniq); if (!daino) { - // deleted? Look for next larger uniq in same directory +#if EXNEXT_DEBUG + write_log(_T("EXNEXT but next entry is missing! (%d)\n"), uniq); +#endif + // deleted? Look for next larger uniq in same directory. daino = aino->child; - while (daino && daino->uniq < uniq) { + while (daino && uniq >= daino->uniq) { daino = daino->sibling; } +#if EXNEXT_DEBUG + if (daino) { + write_log(_T("Using next found entry %d\n"), uniq); + } +#endif + // didn't find, what about previous? + if (!daino) { + daino = aino->child; + while (daino && uniq >= daino->uniq) { + if (daino->sibling && daino->sibling->uniq >= uniq) { +#if EXNEXT_DEBUG + write_log(_T("Using previous entry %d\n"), uniq); +#endif + break; + } + daino = daino->sibling; + } + } + // didn't find any but there are still entries? restart from beginning. + if (!daino && aino->child) { + daino = aino->child; +#if EXNEXT_DEBUG + write_log(_T("Re-starting from beginning %d\n"), daino->uniq); +#endif + } } else { daino = daino->sibling; } @@ -4587,7 +4727,7 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb uaecptr name = GET_PCK_ARG3 (packet) << 2; a_inode *aino; Key *k; - struct fs_filehandle *fd; + struct fs_filehandle *fd = NULL; int err; mode_t openmode; int aino_created = 0; @@ -4621,6 +4761,11 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb PUT_PCK_RES2 (packet, ERROR_OBJECT_IN_USE); return; } + if (create && aino->vfso) { + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, ERROR_DELETE_PROTECTED); + return; + } if (create == 2 && (aino->amigaos_mode & A_FIBF_DELETE) != 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DELETE_PROTECTED); @@ -4669,20 +4814,22 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb prepare_for_open (aino->nname); - openmode = (((mode & A_FIBF_READ) == 0 ? O_WRONLY - : (mode & A_FIBF_WRITE) == 0 ? O_RDONLY - : O_RDWR) - | (create ? O_CREAT : 0) - | (create == 2 ? O_TRUNC : 0)); - - fd = fs_openfile (unit, aino, openmode | O_BINARY); - if (fd == NULL) { - if (aino_created) - delete_aino (unit, aino); - PUT_PCK_RES1 (packet, DOS_FALSE); - /* archive and fd == NULL = corrupt archive or out of memory */ - PUT_PCK_RES2 (packet, isvirtual ? ERROR_OBJECT_NOT_AROUND : dos_errno ()); - return; + if (!aino->vfso) { + openmode = (((mode & A_FIBF_READ) == 0 ? O_WRONLY + : (mode & A_FIBF_WRITE) == 0 ? O_RDONLY + : O_RDWR) + | (create ? O_CREAT : 0) + | (create == 2 ? O_TRUNC : 0)); + + fd = fs_openfile (unit, aino, openmode | O_BINARY); + if (fd == NULL) { + if (aino_created) + delete_aino (unit, aino); + PUT_PCK_RES1 (packet, DOS_FALSE); + /* archive and fd == NULL = corrupt archive or out of memory */ + PUT_PCK_RES2 (packet, isvirtual ? ERROR_OBJECT_NOT_AROUND : dos_errno ()); + return; + } } k = new_key (unit); @@ -4860,11 +5007,20 @@ static void if (size == 0) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, 0); + } else if (k->aino->vfso) { + uae_s64 filesize = k->aino->vfso->size; + for (int i = 0; i < size && k->file_pos < filesize; i++) { + put_byte(addr + i, k->aino->vfso->data[k->file_pos]); + k->file_pos++; + actual++; + } + PUT_PCK_RES1 (packet, actual); + size = 0; } else if (!valid_address (addr, size)) { /* check if filesize < size */ uae_s64 filesize, cur; - filesize = fs_fsize64 (k->fd); + filesize = key_filesize(k); cur = k->file_pos; if (size > filesize - cur) size = filesize - cur; @@ -4879,7 +5035,7 @@ static void write_log (_T("unixfs warning: Bad pointer passed for read: %08x, size %d\n"), addr, size); /* ugh this is inefficient but easy */ - if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + if (key_seek(k, k->file_pos, SEEK_SET) < 0) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, dos_errno ()); return; @@ -4913,7 +5069,7 @@ static void /* normal fast read */ uae_u8 *realpt = get_real_address (addr); - if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + if (key_seek(k, k->file_pos, SEEK_SET) < 0) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, dos_errno ()); return; @@ -4956,7 +5112,7 @@ static void gui_flicker_led (UNIT_LED(unit), unit->unit, 2); TRACE((_T("ACTION_WRITE(%s,0x%lx,%ld)\n"), k->aino->nname, addr, size)); - if (unit->ui.readonly || unit->ui.locked) { + if (unit->ui.readonly || unit->ui.locked || k->aino->vfso) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); return; @@ -4969,7 +5125,7 @@ static void } else if (valid_address (addr, size)) { uae_u8 *realpt = get_real_address (addr); - if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + if (key_seek(k, k->file_pos, SEEK_SET) < 0) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, dos_errno ()); return; @@ -4980,7 +5136,7 @@ static void write_log (_T("unixfs warning: Bad pointer passed for write: %08x, size %d\n"), addr, size); /* ugh this is inefficient but easy */ - if (fs_lseek64 (k->fd, k->file_pos, SEEK_SET) < 0) { + if (key_seek(k, k->file_pos, SEEK_SET) < 0) { PUT_PCK_RES1 (packet, 0); PUT_PCK_RES2 (packet, dos_errno ()); return; @@ -5036,7 +5192,7 @@ static void TRACE((_T("ACTION_SEEK(%s,%d,%d)=%d\n"), k->aino->nname, pos, mode, cur)); gui_flicker_led (UNIT_LED(unit), unit->unit, 1); - filesize = fs_fsize64 (k->fd); + filesize = key_filesize(k); if (whence == SEEK_CUR) temppos = cur + pos; if (whence == SEEK_SET) @@ -5049,14 +5205,14 @@ static void return; } - res = fs_lseek64 (k->fd, pos, whence); + res = key_seek(k, pos, whence); if (-1 == res || cur > MAXFILESIZE32) { PUT_PCK_RES1 (packet, -1); PUT_PCK_RES2 (packet, ERROR_SEEK_ERROR); - fs_lseek64 (k->fd, cur, SEEK_SET); + key_seek(k, cur, SEEK_SET); } else { PUT_PCK_RES1 (packet, cur); - k->file_pos = fs_lseek64 (k->fd, 0, SEEK_CUR); + k->file_pos = key_seek(k, 0, SEEK_CUR); } } @@ -5390,9 +5546,14 @@ static void PUT_PCK_RES2 (packet, ERROR_OBJECT_NOT_AROUND); return; } + if (k->aino->vfso) { + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, ERROR_DISK_WRITE_PROTECTED); + return; + } /* Fail if file is >=2G, it is not safe operation. */ - if (fs_fsize64 (k->fd) > MAXFILESIZE32_2G) { + if (key_filesize(k) > MAXFILESIZE32_2G) { PUT_PCK_RES1 (packet, DOS_TRUE); PUT_PCK_RES2 (packet, ERROR_BAD_NUMBER); /* ? */ return; @@ -5474,7 +5635,7 @@ static void relock_re (Unit *unit, a_inode *a1, a_inode *a2, int failed) write_log (_T("relocking failed '%s' -> '%s'\n"), a1->nname, a2->nname); free_key (unit, k1); } else { - fs_lseek64 (k1->fd, k1->file_pos, SEEK_SET); + key_seek(k1, k1->file_pos, SEEK_SET); } } } @@ -5513,19 +5674,21 @@ static void PUT_PCK_RES2 (packet, ERROR_OBJECT_IN_USE); return; } - if (a->dir) { - /* This should take care of removing the fsdb if no files remain. */ - fsdb_dir_writeback (a); - if (my_rmdir (a->nname) == -1) { - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, dos_errno ()); - return; - } - } else { - if (my_unlink (a->nname) == -1) { - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, dos_errno ()); - return; + if (!a->vfso) { + if (a->dir) { + /* This should take care of removing the fsdb if no files remain. */ + fsdb_dir_writeback (a); + if (my_rmdir (a->nname) == -1) { + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, dos_errno ()); + return; + } + } else { + if (my_unlink (a->nname) == -1) { + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, dos_errno ()); + return; + } } } notify_check (unit, a); @@ -5548,7 +5711,7 @@ static void uaecptr date = GET_PCK_ARG4 (packet); a_inode *a; struct mytimeval tv; - int err; + int err = 0; TRACE((_T("ACTION_SET_DATE(0x%lx,\"%s\")\n"), lock, bstr (unit, name))); @@ -5568,10 +5731,12 @@ static void handle_softlink (unit, packet, a); return; } - amiga_to_timeval (&tv, get_long (date), get_long (date + 4), get_long (date + 8), 50); - //write_log (_T("%llu.%u (%d,%d,%d) %s\n"), tv.tv_sec, tv.tv_usec, get_long (date), get_long (date + 4), get_long (date + 8), a->nname); - if (!my_utime (a->nname, &tv)) - err = dos_errno (); + if (!a->vfso) { + amiga_to_timeval (&tv, get_long (date), get_long (date + 4), get_long (date + 8), 50); + //write_log (_T("%llu.%u (%d,%d,%d) %s\n"), tv.tv_sec, tv.tv_usec, get_long (date), get_long (date + 4), get_long (date + 8), a->nname); + if (!my_utime (a->nname, &tv)) + err = dos_errno (); + } if (err != 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, err); @@ -5610,7 +5775,6 @@ static void PUT_PCK_RES2 (packet, err1); return; } - /* rename always fails if file is open for writing */ for (k1 = unit->keys; k1; k1 = knext) { knext = k1->next; @@ -5647,20 +5811,22 @@ static void return; } - if (-1 == my_rename (a1->nname, a2->nname)) { - int ret = -1; - /* maybe we have open file handles that caused failure? */ - write_log (_T("rename '%s' -> '%s' failed, trying relocking..\n"), a1->nname, a2->nname); - wehavekeys = relock_do (unit, a1); - /* try again... */ - ret = my_rename (a1->nname, a2->nname); - /* restore locks */ - relock_re (unit, a1, a2, ret == -1 ? 1 : 0); - if (ret == -1) { - delete_aino (unit, a2); - PUT_PCK_RES1 (packet, DOS_FALSE); - PUT_PCK_RES2 (packet, dos_errno ()); - return; + if (!a1->vfso) { + if (-1 == my_rename (a1->nname, a2->nname)) { + int ret = -1; + /* maybe we have open file handles that caused failure? */ + write_log (_T("rename '%s' -> '%s' failed, trying relocking..\n"), a1->nname, a2->nname); + wehavekeys = relock_do (unit, a1); + /* try again... */ + ret = my_rename (a1->nname, a2->nname); + /* restore locks */ + relock_re (unit, a1, a2, ret == -1 ? 1 : 0); + if (ret == -1) { + delete_aino (unit, a2); + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, dos_errno ()); + return; + } } } @@ -5675,6 +5841,7 @@ static void a2->has_dbentry = a1->has_dbentry; a2->db_offset = a1->db_offset; a2->dirty = 0; + a2->vfso = a1->vfso; move_exkeys (unit, a1, a2); move_aino_children (unit, a1, a2); delete_aino (unit, a1); @@ -5803,7 +5970,7 @@ static void action_change_file_position64 (Unit *unit, dpacket packet) cur = k->file_pos; { uae_s64 temppos; - uae_s64 filesize = fs_fsize64 (k->fd); + uae_s64 filesize = key_filesize(k); if (whence == SEEK_CUR) temppos = cur + pos; @@ -5818,7 +5985,7 @@ static void action_change_file_position64 (Unit *unit, dpacket packet) return; } } - res = fs_lseek64 (k->fd, pos, whence); + res = key_seek(k, pos, whence); if (-1 == res) { PUT_PCK64_RES1 (packet, DOS_FALSE); @@ -5826,7 +5993,7 @@ static void action_change_file_position64 (Unit *unit, dpacket packet) } else { PUT_PCK64_RES1 (packet, TRUE); PUT_PCK64_RES2 (packet, 0); - k->file_pos = fs_lseek64 (k->fd, 0, SEEK_CUR); + k->file_pos = key_seek(k, 0, SEEK_CUR); } TRACE((_T("= oldpos %lld newpos %lld\n"), cur, k->file_pos)); } @@ -5883,11 +6050,11 @@ static void action_change_file_size64 (Unit *unit, dpacket packet) /* Write one then truncate: that should give the right size in all cases. */ fs_lseek (k->fd, offset, whence); - offset = fs_lseek64 (k->fd, offset, whence); + offset = key_seek(k, offset, whence); fs_write (k->fd, /* whatever */(uae_u8*)&k1, 1); if (k->file_pos > offset) k->file_pos = offset; - fs_lseek64 (k->fd, k->file_pos, SEEK_SET); + key_seek(k, k->file_pos, SEEK_SET); if (my_truncate (k->aino->nname, offset) == -1) { PUT_PCK64_RES1 (packet, DOS_FALSE); @@ -5911,7 +6078,7 @@ static void action_get_file_size64 (Unit *unit, dpacket packet) PUT_PCK64_RES2 (packet, ERROR_INVALID_LOCK); return; } - filesize = fs_fsize64 (k->fd); + filesize = key_filesize(k); TRACE((_T("ACTION_GET_FILE_SIZE64(%s)=%lld\n"), k->aino->nname, filesize)); if (filesize >= 0) { PUT_PCK64_RES1 (packet, filesize); @@ -5975,11 +6142,11 @@ static void action_set_file_size64(Unit *unit, dpacket packet) /* Write one then truncate: that should give the right size in all cases. */ fs_lseek (k->fd, offset, whence); - offset = fs_lseek64 (k->fd, offset, whence); + offset = key_seek(k, offset, whence); fs_write (k->fd, /* whatever */(uae_u8*)&k1, 1); if (k->file_pos > offset) k->file_pos = offset; - fs_lseek64 (k->fd, k->file_pos, SEEK_SET); + key_seek(k, k->file_pos, SEEK_SET); if (my_truncate (k->aino->nname, offset) == -1) { PUT_PCK_RES1 (packet, DOS_FALSE); @@ -6016,7 +6183,7 @@ static void action_seek64(Unit *unit, dpacket packet) cur = k->file_pos; { uae_s64 temppos; - uae_s64 filesize = fs_fsize64 (k->fd); + uae_s64 filesize = key_filesize(k); if (whence == SEEK_CUR) temppos = cur + pos; @@ -6031,7 +6198,7 @@ static void action_seek64(Unit *unit, dpacket packet) return; } } - res = fs_lseek64 (k->fd, pos, whence); + res = key_seek(k, pos, whence); if (-1 == res) { PUT_PCK_RES1 (packet, DOS_FALSE); @@ -6039,7 +6206,7 @@ static void action_seek64(Unit *unit, dpacket packet) } else { PUT_PCK_RES1 (packet, TRUE); set_quadp(GET_PCK_ARG3(packet), cur); - k->file_pos = fs_lseek64 (k->fd, 0, SEEK_CUR); + k->file_pos = key_seek(k, 0, SEEK_CUR); } TRACE((_T("= oldpos %lld newpos %lld\n"), cur, k->file_pos)); } @@ -6554,6 +6721,7 @@ void filesys_reset (void) { if (isrestore ()) return; + load_injected_icons(); filesys_reset2 (); initialize_mountinfo (); } @@ -8112,14 +8280,14 @@ static uae_u8 *restore_key (UnitInfo *ui, Unit *u, uae_u8 *src) missing = 1; } else { uae_s64 s; - s = fs_fsize64 (k->fd); + s = key_filesize(k); if (s != savedsize) write_log (_T("FS: restored file '%s' size changed! orig=%llu, now=%lld!!\n"), p, savedsize, s); if (k->file_pos > s) { write_log (_T("FS: restored filepos larger than size of file '%s'!! %llu > %lld\n"), p, k->file_pos, s); k->file_pos = s; } - fs_lseek64 (k->fd, k->file_pos, SEEK_SET); + key_seek(k, k->file_pos, SEEK_SET); } } xfree (p); diff --git a/gencpu.cpp b/gencpu.cpp index cc07a6aa..8c476c58 100644 --- a/gencpu.cpp +++ b/gencpu.cpp @@ -584,9 +584,17 @@ static void check_ipl (void) return; if (using_ce || isce020()) printf ("\tipl_fetch ();\n"); - ipl_fetched = true; + ipl_fetched = 1; } +static void single_check_ipl(void) +{ + check_ipl(); + ipl_fetched = 2; + +} +/* this is not true, it seems to be microcode controller */ + /* Apparently interrupt state is sampled * during any memory access. Because we don't * know if there are future memory accesses, @@ -595,7 +603,7 @@ static void check_ipl (void) */ static void check_ipl_again (void) { - if (!ipl_fetched) + if (ipl_fetched != 1) return; if (using_ce) printf ("\tipl_fetch ();\n"); @@ -3501,6 +3509,16 @@ static void gen_opcode (unsigned int opcode) } if (curi->mnemo == i_MOVE) genflags (flag_logical, curi->size, "src", "", ""); + + if (curi->size == sz_long) { + if ((curi->dmode == Ad16 || curi->dmode == PC16) && curi->smode == imm) { + // lots more needed.. + // move.l x,absl + // move.l (an),x(an) + single_check_ipl(); + } + } + genastore ("src", curi->dmode, "dstreg", curi->size, "dst"); sync_m68k_pc (); if (dualprefetch) { diff --git a/include/filesys.h b/include/filesys.h index 1128bfb9..beead53d 100644 --- a/include/filesys.h +++ b/include/filesys.h @@ -93,23 +93,25 @@ struct hd_hardfiledata { #define HD_CONTROLLER_TYPE_SCSI_AUTO 2 #define HD_CONTROLLER_TYPE_SCSI_A2091 3 #define HD_CONTROLLER_TYPE_SCSI_A2091_2 4 -#define HD_CONTROLLER_TYPE_SCSI_A4091 5 -#define HD_CONTROLLER_TYPE_SCSI_A4091_2 6 -#define HD_CONTROLLER_TYPE_SCSI_FASTLANE 7 -#define HD_CONTROLLER_TYPE_SCSI_FASTLANE_2 8 -#define HD_CONTROLLER_TYPE_SCSI_OKTAGON 9 -#define HD_CONTROLLER_TYPE_SCSI_OKTAGON_2 10 -#define HD_CONTROLLER_TYPE_SCSI_A3000 11 -#define HD_CONTROLLER_TYPE_SCSI_A4000T 12 -#define HD_CONTROLLER_TYPE_SCSI_CDTV 13 -#define HD_CONTROLLER_TYPE_SCSI_CPUBOARD 14 -#define HD_CONTROLLER_TYPE_PCMCIA_SRAM 15 -#define HD_CONTROLLER_TYPE_PCMCIA_IDE 16 +#define HD_CONTROLLER_TYPE_SCSI_GVP 5 +#define HD_CONTROLLER_TYPE_SCSI_GVP_2 6 +#define HD_CONTROLLER_TYPE_SCSI_A4091 7 +#define HD_CONTROLLER_TYPE_SCSI_A4091_2 8 +#define HD_CONTROLLER_TYPE_SCSI_FASTLANE 9 +#define HD_CONTROLLER_TYPE_SCSI_FASTLANE_2 10 +#define HD_CONTROLLER_TYPE_SCSI_OKTAGON 11 +#define HD_CONTROLLER_TYPE_SCSI_OKTAGON_2 12 +#define HD_CONTROLLER_TYPE_SCSI_A3000 13 +#define HD_CONTROLLER_TYPE_SCSI_A4000T 14 +#define HD_CONTROLLER_TYPE_SCSI_CDTV 15 +#define HD_CONTROLLER_TYPE_SCSI_CPUBOARD 16 +#define HD_CONTROLLER_TYPE_PCMCIA_SRAM 17 +#define HD_CONTROLLER_TYPE_PCMCIA_IDE 18 #define HD_CONTROLLER_TYPE_IDE_FIRST 1 #define HD_CONTROLLER_TYPE_IDE_LAST 1 #define HD_CONTROLLER_TYPE_SCSI_FIRST 2 -#define HD_CONTROLLER_TYPE_SCSI_LAST 14 +#define HD_CONTROLLER_TYPE_SCSI_LAST 16 #define FILESYS_VIRTUAL 0 #define FILESYS_HARDFILE 1 diff --git a/include/fsdb.h b/include/fsdb.h index a3223b4d..55db4e56 100644 --- a/include/fsdb.h +++ b/include/fsdb.h @@ -54,6 +54,15 @@ #define A_FIBF_EXECUTE (1<<1) #define A_FIBF_DELETE (1<<0) +struct virtualfilesysobject +{ + int dir; + TCHAR *comment; + uae_u32 amigaos_mode; + uae_u8 *data; + int size; +}; + /* AmigaOS "keys" */ typedef struct a_inode_struct { #ifdef AINO_DEBUG @@ -99,6 +108,7 @@ typedef struct a_inode_struct { /* not equaling unit.mountcount -> not in this volume */ unsigned int mountcount; uae_u64 uniq_external; + struct virtualfilesysobject *vfso; #ifdef AINO_DEBUG uae_u32 checksum2; #endif diff --git a/include/gfxboard.h b/include/gfxboard.h index 1de866f1..ae11ac5f 100644 --- a/include/gfxboard.h +++ b/include/gfxboard.h @@ -13,6 +13,7 @@ extern bool gfxboard_is_registers (int); extern int gfxboard_get_vram_min (int); extern int gfxboard_get_vram_max (int); extern bool gfxboard_need_byteswap (int type); +extern int gfxboard_get_autoconfig_size(int type); extern double gfxboard_get_vsync (void); extern void gfxboard_refresh (void); extern bool gfxboard_toggle (int mode); diff --git a/include/memory.h b/include/memory.h index 3cd3c56c..bc4165c3 100644 --- a/include/memory.h +++ b/include/memory.h @@ -392,6 +392,7 @@ extern uae_u8 *baseaddr[MEMORY_BANKS]; #endif #define get_mem_bank(addr) (*mem_banks[bankindex(addr)]) +extern addrbank *get_mem_bank_real(uaecptr); #ifdef JIT #define put_mem_bank(addr, b, realstart) do { \ diff --git a/include/options.h b/include/options.h index f56a5ae0..5fd1ce5b 100644 --- a/include/options.h +++ b/include/options.h @@ -11,7 +11,7 @@ #define UAE_OPTIONS_H #define UAEMAJOR 3 -#define UAEMINOR 0 +#define UAEMINOR 1 #define UAESUBREV 0 typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang; @@ -430,6 +430,10 @@ struct uae_prefs { int filesys_limit; int filesys_max_name; int filesys_max_file_size; + bool filesys_inject_icons; + TCHAR filesys_inject_icons_tool[MAX_DPATH]; + TCHAR filesys_inject_icons_project[MAX_DPATH]; + TCHAR filesys_inject_icons_drawer[MAX_DPATH]; int uaescsidevmode; bool reset_delay; @@ -474,6 +478,7 @@ struct uae_prefs { struct boardromconfig a4091rom; struct boardromconfig fastlanerom; struct boardromconfig oktagonrom; + struct boardromconfig gvprom; TCHAR romfile[MAX_DPATH]; TCHAR romident[256]; @@ -554,6 +559,7 @@ struct uae_prefs { bool native_code; bool uae_hide_autoconfig; int z3_mapping_mode; + bool sound_toccata; int mountitems; struct uaedev_config_data mountconfig[MOUNT_CONFIG_SIZE]; diff --git a/include/zfile.h b/include/zfile.h index f9c6b44e..e9970ba9 100644 --- a/include/zfile.h +++ b/include/zfile.h @@ -46,6 +46,7 @@ extern struct zfile *zfile_fopen_empty (struct zfile*, const TCHAR *name); extern struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, const uae_u8 *data); extern struct zfile *zfile_fopen_load_zfile (struct zfile *f); extern uae_u8 *zfile_load_data (const TCHAR *name, const uae_u8 *data,int datalen, int *outlen); +extern uae_u8 *zfile_load_file(const TCHAR *name, int *outlen); extern struct zfile *zfile_fopen_parent (struct zfile*, const TCHAR*, uae_u64 offset, uae_u64 size); extern int zfile_exists (const TCHAR *name); diff --git a/main.cpp b/main.cpp index 9d206cb7..c5c02568 100644 --- a/main.cpp +++ b/main.cpp @@ -62,6 +62,7 @@ #include "uaenative.h" #include "tabletlibrary.h" #include "cpuboard.h" +#include "sndboard.h" #include "uae/ppc.h" #ifdef RETROPLATFORM #include "rp.h" @@ -1014,6 +1015,7 @@ void do_leave_program (void) #endif #ifdef A2091 a2091_free (); + gvp_free (); a3000scsi_free (); #endif #ifdef NCR @@ -1048,6 +1050,9 @@ void do_leave_program (void) #endif #ifdef WITH_PPC uae_ppc_free(); +#endif +#ifdef WITH_TOCCATA + sndboard_free(); #endif gfxboard_free(); savestate_free (); diff --git a/memory.cpp b/memory.cpp index 2618ef18..796be89c 100644 --- a/memory.cpp +++ b/memory.cpp @@ -2051,6 +2051,11 @@ static void fill_ce_banks (void) ce_banktype[i] = CE_MEMBANK_FAST16; } + // A4000T NCR is 32-bit + if (currprefs.cs_mbdmac == 2) { + ce_banktype[0xdd0000 >> 16] = CE_MEMBANK_FAST32; + } + if (currprefs.address_space_24) { for (i = 1; i < 256; i++) memcpy (&ce_banktype[i * 256], &ce_banktype[0], 256); @@ -2094,10 +2099,10 @@ void map_overlay (int chip) addrbank *rb = NULL; if (size < 32) size = 32; - cb = &get_mem_bank (0xf00000); + cb = get_mem_bank_real(0xf00000); if (!rb && cb && (cb->flags & ABFLAG_ROM) && get_word (0xf00000) == 0x1114) rb = cb; - cb = &get_mem_bank (0xe00000); + cb = get_mem_bank_real(0xe00000); if (!rb && cb && (cb->flags & ABFLAG_ROM) && get_word (0xe00000) == 0x1114) rb = cb; if (!rb) @@ -2137,6 +2142,12 @@ ULONG getz2endaddr (void) return start + 2 * 1024 * 1024; } +void map_banks_set(addrbank *bank, int start, int size, int realsize) +{ + bank->startmask = start << 16; + map_banks(bank, start, size, realsize); +} + void memory_clear (void) { mem_hardreset = 0; @@ -2353,20 +2364,20 @@ void memory_reset (void) map_banks (&cardmem_bank, cardmem_bank.start >> 16, cardmem_bank.allocated >> 16, 0); #endif cpuboard_map(); - map_banks (&kickmem_bank, 0xF8, 8, 0); + map_banks_set(&kickmem_bank, 0xF8, 8, 0); if (currprefs.maprom) { if (!cpuboard_maprom()) - map_banks (&kickram_bank, currprefs.maprom >> 16, extendedkickmem2_bank.allocated ? 32 : (extendedkickmem_bank.allocated ? 16 : 8), 0); + map_banks_set(&kickram_bank, currprefs.maprom >> 16, extendedkickmem2_bank.allocated ? 32 : (extendedkickmem_bank.allocated ? 16 : 8), 0); } /* map beta Kickstarts at 0x200000/0xC00000/0xF00000 */ if (kickmem_bank.baseaddr[0] == 0x11 && kickmem_bank.baseaddr[2] == 0x4e && kickmem_bank.baseaddr[3] == 0xf9 && kickmem_bank.baseaddr[4] == 0x00) { uae_u32 addr = kickmem_bank.baseaddr[5]; if (addr == 0x20 && currprefs.chipmem_size <= 0x200000 && currprefs.fastmem_size == 0) - map_banks (&kickmem_bank, addr, 8, 0); + map_banks_set(&kickmem_bank, addr, 8, 0); if (addr == 0xC0 && currprefs.bogomem_size == 0) - map_banks (&kickmem_bank, addr, 8, 0); + map_banks_set(&kickmem_bank, addr, 8, 0); if (addr == 0xF0) - map_banks (&kickmem_bank, addr, 8, 0); + map_banks_set(&kickmem_bank, addr, 8, 0); } if (a1000_bootrom) @@ -2377,45 +2388,45 @@ void memory_reset (void) #endif if (a3000_f0) - map_banks (&extendedkickmem_bank, 0xf0, 1, 0); + map_banks_set(&extendedkickmem_bank, 0xf0, 1, 0); /* Map the chipmem into all of the lower 8MB */ map_overlay (1); switch (extendedkickmem_type) { case EXTENDED_ROM_KS: - map_banks (&extendedkickmem_bank, 0xE0, 8, 0); + map_banks_set(&extendedkickmem_bank, 0xE0, 8, 0); break; #ifdef CDTV case EXTENDED_ROM_CDTV: - map_banks (&extendedkickmem_bank, 0xF0, extendedkickmem_bank.allocated == 2 * ROM_SIZE_512 ? 16 : 8, 0); + map_banks_set(&extendedkickmem_bank, 0xF0, extendedkickmem_bank.allocated == 2 * ROM_SIZE_512 ? 16 : 8, 0); break; #endif #ifdef CD32 case EXTENDED_ROM_CD32: - map_banks (&extendedkickmem_bank, 0xE0, 8, 0); + map_banks_set(&extendedkickmem_bank, 0xE0, 8, 0); break; #endif } #ifdef AUTOCONFIG if (need_uae_boot_rom ()) - map_banks (&rtarea_bank, rtarea_base >> 16, 1, 0); + map_banks_set(&rtarea_bank, rtarea_base >> 16, 1, 0); #endif if ((cloanto_rom || currprefs.cs_ksmirror_e0) && (currprefs.maprom != 0xe00000) && !extendedkickmem_type) - map_banks (&kickmem_bank, 0xE0, 8, 0); + map_banks(&kickmem_bank, 0xE0, 8, 0); if (currprefs.cs_ksmirror_a8) { if (extendedkickmem2_bank.allocated) { - map_banks (&extendedkickmem2_bank, 0xa8, 16, 0); + map_banks_set(&extendedkickmem2_bank, 0xa8, 16, 0); } else { struct romdata *rd = getromdatabypath (currprefs.cartfile); if (!rd || rd->id != 63) { if (extendedkickmem_type == EXTENDED_ROM_CD32 || extendedkickmem_type == EXTENDED_ROM_KS) - map_banks (&extendedkickmem_bank, 0xb0, 8, 0); + map_banks(&extendedkickmem_bank, 0xb0, 8, 0); else - map_banks (&kickmem_bank, 0xb0, 8, 0); - map_banks (&kickmem_bank, 0xa8, 8, 0); + map_banks(&kickmem_bank, 0xb0, 8, 0); + map_banks(&kickmem_bank, 0xa8, 8, 0); } } } diff --git a/newcpu.cpp b/newcpu.cpp index 271fa900..86d51022 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -2092,6 +2092,22 @@ Interrupt: */ +static int iack_cycle(int nr) +{ + int vector; + + if (1) { + // non-autovectored + vector = x_get_byte(0x00fffff1 | ((nr - 24) << 1)); + if (currprefs.cpu_cycle_exact) + x_do_cycles(4 * cpucycleunit); + } else { + // autovectored + + } + return vector; +} + static void Exception_ce000 (int nr) { uae_u32 currpc = m68k_getpc (), newpc; @@ -2134,29 +2150,23 @@ static void Exception_ce000 (int nr) x_put_word (m68k_areg (regs, 7) + 0, mode); x_put_word (m68k_areg (regs, 7) + 2, last_fault_for_exception_3 >> 16); x_do_cycles (2 * cpucycleunit); - write_log (_T("Exception %d (%x) at %x -> %x!\n"), nr, last_addr_for_exception_3, currpc, get_long (4 * nr)); + write_log (_T("Exception %d (%x) at %x -> %x!\n"), nr, last_addr_for_exception_3, currpc, get_long_debug (4 * nr)); goto kludge_me_do; } if (currprefs.cpu_model == 68010) { // 68010 creates only format 0 and 8 stack frames m68k_areg (regs, 7) -= 8; x_put_word (m68k_areg (regs, 7) + 4, currpc); // write low address - if (interrupt) { - // fetch interrupt vector number - nr = x_get_byte (0x00fffff1 | ((nr - 24) << 1)); - x_do_cycles (4 * cpucycleunit); - } + if (interrupt) + nr = iack_cycle(nr); x_put_word (m68k_areg (regs, 7) + 0, regs.sr); // write SR x_put_word (m68k_areg (regs, 7) + 2, currpc >> 16); // write high address x_put_word (m68k_areg (regs, 7) + 6, nr * 4); } else { m68k_areg (regs, 7) -= 6; x_put_word (m68k_areg (regs, 7) + 4, currpc); // write low address - if (interrupt) { - // fetch interrupt vector number - nr = x_get_byte (0x00fffff1 | ((nr - 24) << 1)); - x_do_cycles (4 * cpucycleunit); - } + if (interrupt) + nr = iack_cycle(nr); x_put_word (m68k_areg (regs, 7) + 0, regs.sr); // write SR x_put_word (m68k_areg (regs, 7) + 2, currpc >> 16); // write high address } @@ -2516,7 +2526,7 @@ static void Exception_normal (int nr) interrupt = nr >= 24 && nr < 24 + 8; if (interrupt && currprefs.cpu_model <= 68010) - nr = x_get_byte (0x00fffff1 | (nr << 1)); + nr = iack_cycle(nr); exception_debug (nr); MakeSR (); @@ -2644,7 +2654,7 @@ static void Exception_normal (int nr) m68k_areg (regs, 7) -= 2; x_put_word (m68k_areg (regs, 7), 0xb000 + nr * 4); } - write_log (_T("Exception %d (%x) at %x -> %x!\n"), nr, regs.instruction_pc, currpc, x_get_long (regs.vbr + 4*nr)); + write_log (_T("Exception %d (%x) at %x -> %x!\n"), nr, regs.instruction_pc, currpc, get_long_debug (regs.vbr + 4*nr)); } else if (nr ==5 || nr == 6 || nr == 7 || nr == 9) { m68k_areg (regs, 7) -= 4; x_put_long (m68k_areg (regs, 7), regs.instruction_pc); @@ -2681,7 +2691,7 @@ static void Exception_normal (int nr) x_put_word (m68k_areg (regs, 7) + 6, last_op_for_exception_3); x_put_word (m68k_areg (regs, 7) + 8, regs.sr); x_put_long (m68k_areg (regs, 7) + 10, last_addr_for_exception_3); - write_log (_T("Exception %d (%x) at %x -> %x!\n"), nr, last_fault_for_exception_3, currpc, x_get_long (regs.vbr + 4*nr)); + write_log (_T("Exception %d (%x) at %x -> %x!\n"), nr, last_fault_for_exception_3, currpc, get_long_debug (regs.vbr + 4*nr)); goto kludge_me_do; } } @@ -2937,7 +2947,7 @@ uae_u32 REGPARAM2 op_illg (uae_u32 opcode) if ((opcode & 0xF000) == 0xF000) { if (warned < 20) { - write_log (_T("B-Trap %x at %x (%p)\n"), opcode, pc, regs.pc_p); + write_log(_T("B-Trap %04X at %08X -> %08X\n"), opcode, pc, get_long_debug(regs.vbr + 0x2c)); warned++; } Exception (0xB); @@ -2946,7 +2956,7 @@ uae_u32 REGPARAM2 op_illg (uae_u32 opcode) } if ((opcode & 0xF000) == 0xA000) { if (warned < 20) { - write_log (_T("A-Trap %x at %x (%p)\n"), opcode, pc, regs.pc_p); + write_log(_T("A-Trap %04X at %08X -> %08X\n"), opcode, pc, get_long_debug(regs.vbr + 0x28)); warned++; } Exception (0xA); @@ -2954,7 +2964,7 @@ uae_u32 REGPARAM2 op_illg (uae_u32 opcode) return 4; } if (warned < 20) { - write_log (_T("Illegal instruction: %04x at %08X -> %08X\n"), opcode, pc, get_long (regs.vbr + 0x10)); + write_log (_T("Illegal instruction: %04x at %08X -> %08X\n"), opcode, pc, get_long_debug(regs.vbr + 0x10)); warned++; //activate_debugger(); } @@ -3577,6 +3587,7 @@ isstopped: } #endif +#if 0 if (!uae_int_requested && !uaenet_int_requested && currprefs.cpu_idle && currprefs.m68k_speed != 0 && (regs.spcflags & SPCFLAG_STOP) #ifdef WITH_PPC && ppc_state != PPC_STATE_ACTIVE @@ -3606,6 +3617,7 @@ isstopped: } } } +#endif } if (regs.spcflags & SPCFLAG_TRACE) @@ -4740,9 +4752,10 @@ void m68k_go (int may_quit) if (regs.halted) { cpu_halt (regs.halted); - if (regs.halted < 0) + if (regs.halted < 0) { haltloop(); - continue; + continue; + } } #if 0 diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index a945bfa6..16807458 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -2259,7 +2259,12 @@ static const TCHAR *D3D_init2 (HWND ahwnd, int w_w, int w_h, int depth, int *fre d3dx = LoadLibrary (D3DX9DLL); if (d3dx == NULL) { - _tcscpy (errmsg, _T("Direct3D: Newer DirectX Runtime required.\n\nhttp://go.microsoft.com/fwlink/?linkid=56513")); + if (os_vista) + _tcscpy(errmsg, _T("Direct3D: Optional DirectX9 components are not installed.\n") + _T("\nhttp://go.microsoft.com/fwlink/?linkid=56513")); + else + _tcscpy (errmsg, _T("Direct3D: Newer DirectX Runtime required or optional DirectX9 components are not installed.\n") + _T("\nhttp://go.microsoft.com/fwlink/?linkid=56513")); if (isfullscreen () <= 0) ShellExecute(NULL, _T("open"), _T("http://go.microsoft.com/fwlink/?linkid=56513"), NULL, NULL, SW_SHOWNORMAL); return errmsg; diff --git a/od-win32/fsdb_mywin32.cpp b/od-win32/fsdb_mywin32.cpp index 0e5c4daa..7bddfef6 100644 --- a/od-win32/fsdb_mywin32.cpp +++ b/od-win32/fsdb_mywin32.cpp @@ -519,7 +519,7 @@ int my_getvolumeinfo (const TCHAR *root) if (v == INVALID_FILE_ATTRIBUTES) return -1; if (!(v & FILE_ATTRIBUTE_DIRECTORY)) - return -1; + return -2; /* if (v & FILE_ATTRIBUTE_READONLY) ret |= MYVOLUMEINFO_READONLY; diff --git a/od-win32/fsdb_win32.cpp b/od-win32/fsdb_win32.cpp index 4d91eb84..0823ff5e 100644 --- a/od-win32/fsdb_win32.cpp +++ b/od-win32/fsdb_win32.cpp @@ -473,6 +473,9 @@ int fsdb_set_file_attrs (a_inode *aino) uae_u8 fsdb[UAEFSDB2_LEN]; uae_u32 mode; + if (aino->vfso) + return 1; + tmpmask = filesys_parse_mask (aino->amigaos_mode); mode = GetFileAttributesSafe (aino->nname); @@ -507,6 +510,8 @@ int fsdb_set_file_attrs (a_inode *aino) int fsdb_mode_supported (const a_inode *aino) { int mask = aino->amigaos_mode; + if (aino->vfso) + return mask; if (0 && aino->dir) return 0; if (fsdb_mode_representable_p (aino, mask)) @@ -532,6 +537,8 @@ int fsdb_mode_representable_p (const a_inode *aino, int amigaos_mode) if (0 && aino->dir) return amigaos_mode == 0; + if (aino->vfso) + return 1; if (mask & A_FIBF_SCRIPT) /* script */ return 0; if ((mask & 15) == 15) /* xxxxRWED == OK */ diff --git a/od-win32/mman.cpp b/od-win32/mman.cpp index 38abda18..a19609de 100644 --- a/od-win32/mman.cpp +++ b/od-win32/mman.cpp @@ -375,11 +375,13 @@ static int doinit_shm (void) p96mem_offset = NULL; p96mem_size = z3rtgmem_size; p96base_offset = 0; + uae_u32 z3rtgallocsize = 0; if (changed_prefs.rtgmem_size && gfxboard_is_z3 (changed_prefs.rtgmem_type)) { + z3rtgallocsize = gfxboard_get_autoconfig_size(changed_prefs.rtgmem_type) < 0 ? changed_prefs.rtgmem_size : gfxboard_get_autoconfig_size(changed_prefs.rtgmem_type); if (changed_prefs.z3autoconfig_start == Z3BASE_UAE) p96base_offset = natmemsize + startbarrier + z3offset; else - p96base_offset = expansion_startaddress(natmemsize + startbarrier + z3offset, changed_prefs.rtgmem_size); + p96base_offset = expansion_startaddress(natmemsize + startbarrier + z3offset, z3rtgallocsize); } else if (changed_prefs.rtgmem_size && !gfxboard_is_z3 (changed_prefs.rtgmem_type)) { p96base_offset = getz2rtgaddr (changed_prefs.rtgmem_size); } @@ -395,7 +397,9 @@ static int doinit_shm (void) } addr = expansion_startaddress(addr, changed_prefs.z3fastmem_size); addr += changed_prefs.z3fastmem_size; - addr = expansion_startaddress(addr, changed_prefs.rtgmem_size); + addr = expansion_startaddress(addr, changed_prefs.z3fastmem2_size); + addr += changed_prefs.z3fastmem2_size; + addr = expansion_startaddress(addr, z3rtgallocsize); if (gfxboard_is_z3(changed_prefs.rtgmem_type)) { p96base_offset = addr; // adjust p96mem_offset to beginning of natmem @@ -660,6 +664,9 @@ void *shmat (addrbank *ab, int shmid, void *shmaddr, int shmflg) } else if (!_tcscmp(shmids[shmid].name, _T("ramsey_high"))) { shmaddr = natmem_offset + 0x08000000; got = TRUE; + } else if (!_tcscmp(shmids[shmid].name, _T("fusionforty"))) { + shmaddr = natmem_offset + 0x11000000; + got = TRUE; } else if (!_tcscmp(shmids[shmid].name, _T("blizzard_40"))) { shmaddr = natmem_offset + 0x40000000; got = TRUE; diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index 3834dead..e8766938 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -4043,6 +4043,7 @@ uae_u8 *getrtgbuffer (int *widthp, int *heightp, int *pitch, int *depth, uae_u8 return NULL; hmode = pixbytes == 1 ? RGBFB_CLUT : RGBFB_B8G8R8A8; convert = getconvert (picasso96_state.RGBFormat, pixbytes); + alloc_colors_picasso(8, 8, 8, 16, 8, 0, picasso96_state.RGBFormat); if (pixbytes > 1 && hmode != convert) { copyall (src + off, dst, width, height, picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel, width * pixbytes, pixbytes, false, convert); @@ -4063,11 +4064,14 @@ uae_u8 *getrtgbuffer (int *widthp, int *heightp, int *pitch, int *depth, uae_u8 } } + gfx_set_picasso_colors(picasso96_state.RGBFormat); + *widthp = width; *heightp = height; *pitch = width * pixbytes; *depth = pixbytes * 8; + return dst; } void freertgbuffer (uae_u8 *dst) diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 75943992..54586601 100644 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -1102,6 +1102,7 @@ #define IDC_CS_CD32FMV 1771 #define IDC_CS_SCSIMODE 1772 #define IDC_DF0ENABLE 1773 +#define IDC_CS_TOCCATA 1773 #define IDC_DF1ENABLE 1774 #define IDC_FS_SELECT_DIR 1774 #define IDC_FS_SELECT_FILE 1775 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 4ee68a6d..c28174b6 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -366,15 +366,15 @@ FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN COMBOBOX IDC_SOUNDCARDLIST,1,1,393,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP GROUPBOX "Sound Emulation",IDC_SOUNDSETTINGS,1,19,132,112 - CONTROL "Disabled",IDC_SOUND0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,35,108,10 - CONTROL "Disabled, but emulated",IDC_SOUND1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,53,107,10 - CONTROL "Enabled",IDC_SOUND2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,71,108,10 - CONTROL "Automatic switching",IDC_SOUND_AUTO,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,13,89,108,10 - GROUPBOX "Volume",IDC_STATIC,139,19,255,69 - RTEXT "Paula Audio",IDC_STATIC,152,38,51,10,SS_CENTERIMAGE + CONTROL "Disabled",IDC_SOUND0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,46,108,10 + CONTROL "Disabled, but emulated",IDC_SOUND1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,64,107,10 + CONTROL "Enabled",IDC_SOUND2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,82,108,10 + CONTROL "Automatic switching",IDC_SOUND_AUTO,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,13,100,108,10 + GROUPBOX "Master Volume",IDC_STATIC,139,19,255,69 + RTEXT "Paula/AHI",IDC_STATIC,152,38,51,10,SS_CENTERIMAGE CONTROL "",IDC_SOUNDVOLUME,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,207,32,105,20 EDITTEXT IDC_SOUNDVOLUME2,329,35,48,12,ES_CENTER | ES_READONLY - RTEXT "CD Audio",IDC_STATIC,152,67,51,10,SS_CENTERIMAGE + RTEXT "CD",IDC_STATIC,152,67,51,10,SS_CENTERIMAGE CONTROL "",IDC_SOUNDVOLUMECD,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,207,61,105,20 EDITTEXT IDC_SOUNDVOLUMECD2,329,64,48,12,ES_CENTER | ES_READONLY GROUPBOX "Sound Buffer Size",IDC_STATIC,140,90,254,42 @@ -1130,6 +1130,7 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,241,187,11 COMBOBOX IDC_NETDEVICE,202,256,178,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "CD32 Full Motion Video cartridge",IDC_CS_CD32FMV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,242,151,11 + CONTROL "Toccata Z2 sound card emulation",IDC_CS_TOCCATA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,255,151,11 END IDD_INPUTMAP DIALOGEX 0, 0, 421, 341 @@ -1220,8 +1221,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,0,0,0 - PRODUCTVERSION 3,0,0,0 + FILEVERSION 3,1,0,0 + PRODUCTVERSION 3,1,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -1237,12 +1238,12 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "WinUAE" - VALUE "FileVersion", "3.0.0.0" + VALUE "FileVersion", "3.1.0.0" VALUE "InternalName", "WinUAE" - VALUE "LegalCopyright", "© 1996-2014 under the GNU Public License (GPL)" + VALUE "LegalCopyright", "© 1996-2015 under the GNU Public License (GPL)" VALUE "OriginalFilename", "WinUAE.exe" VALUE "ProductName", "WinUAE" - VALUE "ProductVersion", "3.0.0.0" + VALUE "ProductVersion", "3.1.0.0" END END BLOCK "VarFileInfo" diff --git a/od-win32/sysconfig.h b/od-win32/sysconfig.h index c6a5e728..36a6954d 100644 --- a/od-win32/sysconfig.h +++ b/od-win32/sysconfig.h @@ -92,6 +92,7 @@ #define WITH_UAENET_PCAP #define WITH_PPC #define WITH_QEMU_CPU +#define WITH_TOCCATA #else diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index d738cb8c..e4d7d99a 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include "resource.h" @@ -95,6 +96,7 @@ #include "cloanto/RetroPlatformIPC.h" #endif #include "uae/ppc.h" +#include "fsdb.h" extern int harddrive_dangerous, do_rdbdump; extern int no_rawinput, no_directinput, no_windowsmouse; @@ -1100,6 +1102,51 @@ static void handleXbutton (WPARAM wParam, int updown) setmousebuttonstate (dinput_winmouse (), num, updown); } +#define MEDIA_INSERT_QUEUE_SIZE 10 +static TCHAR *media_insert_queue[MEDIA_INSERT_QUEUE_SIZE]; +static int media_insert_queue_type[MEDIA_INSERT_QUEUE_SIZE]; +static int media_change_timer; +static int device_change_timer; + +static int is_in_media_queue(const TCHAR *drvname) +{ + for (int i = 0; i < MEDIA_INSERT_QUEUE_SIZE; i++) { + if (media_insert_queue[i] != NULL) { + if (!_tcsicmp(drvname, media_insert_queue[i])) + return i; + } + } + return -1; +} + +static void start_media_insert_timer(HWND hwnd) +{ + if (!media_change_timer) { + media_change_timer = 1; + SetTimer(hwnd, 2, 1000, NULL); + } +} + +static void add_media_insert_queue(HWND hwnd, const TCHAR *drvname, int retrycnt) +{ + int idx = is_in_media_queue(drvname); + if (idx >= 0) { + if (retrycnt > media_insert_queue_type[idx]) + media_insert_queue_type[idx] = retrycnt; + write_log(_T("%s already queued for insertion, cnt=%d.\n"), drvname, retrycnt); + start_media_insert_timer(hwnd); + return; + } + for (int i = 0; i < MEDIA_INSERT_QUEUE_SIZE; i++) { + if (media_insert_queue[i] == NULL) { + media_insert_queue[i] = my_strdup(drvname); + media_insert_queue_type[i] = retrycnt; + start_media_insert_timer(hwnd); + return; + } + } +} + #define MSGDEBUG 1 static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) @@ -1279,9 +1326,60 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, return 0; case WM_TIMER: + if (wParam == 2) { + bool restart = false; + KillTimer(hWnd, 2); + media_change_timer = 0; + DWORD r = CMP_WaitNoPendingInstallEvents(0); + write_log(_T("filesys timer, CMP_WaitNoPendingInstallEvents=%d\n"), r); + if (r == WAIT_OBJECT_0) { + for (int i = 0; i < MEDIA_INSERT_QUEUE_SIZE; i++) { + if (media_insert_queue[i]) { + TCHAR *drvname = media_insert_queue[i]; + int r = my_getvolumeinfo (drvname); + if (r < 0) { + if (media_insert_queue_type[i] > 0) { + write_log(_T("Mounting %s but drive is not ready, %d.. retrying %d..\n"), drvname, r, media_insert_queue_type[i]); + media_insert_queue_type[i]--; + restart = true; + continue; + } else { + write_log(_T("Mounting %s but drive is not ready, %d.. aborting..\n"), drvname, r); + } + } else { + int inserted = 1; + DWORD type = GetDriveType(drvname); + if (type == DRIVE_CDROM) + inserted = -1; + r = filesys_media_change (drvname, inserted, NULL); + if (r < 0) { + write_log(_T("Mounting %s but previous media change is still in progress..\n"), drvname); + restart = true; + break; + } else if (r > 0) { + write_log(_T("%s mounted\n"), drvname); + } else { + write_log(_T("%s mount failed\n"), drvname); + } + } + xfree(media_insert_queue[i]); + media_insert_queue[i] = NULL; + } + } + } else if (r == WAIT_TIMEOUT) { + restart = true; + } + if (restart) + start_media_insert_timer(hWnd); + } else if (wParam == 4) { + device_change_timer = 0; + KillTimer(hWnd, 4); + inputdevice_devicechange (&changed_prefs); + } else if (wParam == 1) { #ifdef PARALLEL_PORT - finishjob (); + finishjob (); #endif + } return 0; case WM_CREATE: @@ -1296,6 +1394,9 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, return 0; case WM_DESTROY: + if (device_change_timer) + KillTimer(hWnd, 4); + device_change_timer = 0; ChangeClipboardChain (hWnd, hwndNextViewer); close_tablet (tablet); wait_keyrelease (); @@ -1407,30 +1508,29 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, #ifdef FILESYS case WM_USER + 2: { - typedef struct { - DWORD dwItem1; // dwItem1 contains the previous PIDL or name of the folder. - DWORD dwItem2; // dwItem2 contains the new PIDL or name of the folder. - } SHNOTIFYSTRUCT; - TCHAR path[MAX_PATH]; - - if (lParam == SHCNE_MEDIAINSERTED || lParam == SHCNE_DRIVEADD || lParam == SHCNE_MEDIAREMOVED || lParam == SHCNE_DRIVEREMOVED) { - SHNOTIFYSTRUCT *shns = (SHNOTIFYSTRUCT*)wParam; - if (SHGetPathFromIDList ((struct _ITEMIDLIST *)(shns->dwItem1), path)) { - int inserted = lParam == SHCNE_MEDIAINSERTED || lParam == SHCNE_DRIVEADD ? 1 : 0; - UINT errormode = SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); - write_log (_T("Shell Notification %d '%s'\n"), inserted, path); - if (!win32_hardfile_media_change (path, inserted)) { - if ((inserted && CheckRM (path)) || !inserted) { + LONG lEvent; + PIDLIST_ABSOLUTE *ppidl; + HANDLE lock = SHChangeNotification_Lock((HANDLE)wParam, (DWORD)lParam, &ppidl, &lEvent); + if (lock) { + if (lEvent == SHCNE_MEDIAINSERTED || lEvent == SHCNE_DRIVEADD || lEvent == SHCNE_MEDIAREMOVED || lEvent == SHCNE_DRIVEREMOVED) { + TCHAR drvpath[MAX_PATH + 1]; + if (SHGetPathFromIDList(ppidl[0], drvpath)) { + int inserted = (lEvent == SHCNE_MEDIAINSERTED || lEvent == SHCNE_DRIVEADD) ? 1 : 0; + write_log (_T("Shell Notification %d '%s'\n"), inserted, drvpath); + if (!win32_hardfile_media_change (drvpath, inserted)) { if (inserted) { - DWORD type = GetDriveType(path); - if (type == DRIVE_CDROM) - inserted = -1; + add_media_insert_queue(hWnd, drvpath, 5); + } else { + if (is_in_media_queue(drvpath) >= 0) { + write_log(_T("Insertion queued, removal event dropped\n")); + } else { + filesys_media_change (drvpath, inserted, NULL); + } } - filesys_media_change (path, inserted, NULL); } } - SetErrorMode (errormode); } + SHChangeNotification_Unlock(lock); } } return TRUE; @@ -1439,18 +1539,16 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, extern bool win32_spti_media_change (TCHAR driveletter, int insert); extern bool win32_ioctl_media_change (TCHAR driveletter, int insert); DEV_BROADCAST_HDR *pBHdr = (DEV_BROADCAST_HDR *)lParam; - static int waitfornext; + int devicechange = 0; if (wParam == DBT_DEVNODES_CHANGED && lParam == 0) { - if (waitfornext) - inputdevice_devicechange (&changed_prefs); - waitfornext = 0; + devicechange = 1; } else if (pBHdr && pBHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { DEV_BROADCAST_DEVICEINTERFACE *dbd = (DEV_BROADCAST_DEVICEINTERFACE*)lParam; if (wParam == DBT_DEVICEREMOVECOMPLETE) - inputdevice_devicechange (&changed_prefs); + devicechange = 1; else if (wParam == DBT_DEVICEARRIVAL) - waitfornext = 1; + devicechange = 1; } else if (pBHdr && pBHdr->dbch_devicetype == DBT_DEVTYP_VOLUME) { DEV_BROADCAST_VOLUME *pBVol = (DEV_BROADCAST_VOLUME *)lParam; if (wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE) { @@ -1472,18 +1570,20 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, inserted = 0; if (pBVol->dbcv_flags & DBTF_MEDIA) { bool matched = false; -#ifdef WINDDK matched |= win32_spti_media_change (drive, inserted); matched |= win32_ioctl_media_change (drive, inserted); -#endif } if (type == DRIVE_REMOVABLE || type == DRIVE_CDROM || !inserted) { write_log (_T("WM_DEVICECHANGE '%s' type=%d inserted=%d\n"), drvname, type, inserted); if (!win32_hardfile_media_change (drvname, inserted)) { - if ((inserted && CheckRM (drvname)) || !inserted) { - if (type == DRIVE_CDROM && inserted) - inserted = -1; - filesys_media_change (drvname, inserted, NULL); + if (inserted) { + add_media_insert_queue(hWnd, drvname, 0); + } else { + if (is_in_media_queue(drvname) >= 0) { + write_log(_T("Insertion queued, removal event dropped\n")); + } else { + filesys_media_change (drvname, inserted, NULL); + } } } } @@ -1493,6 +1593,12 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, } } } + if (devicechange) { + if (device_change_timer) + KillTimer(hWnd, 4); + device_change_timer = 1; + SetTimer(hWnd, 4, 2000, NULL); + } } #endif return TRUE; @@ -1751,6 +1857,7 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, case WM_ENABLE: case WT_PACKET: case WM_WTSSESSION_CHANGE: + case WM_TIMER: return AmigaWindowProc (hWnd, message, wParam, lParam); #if 0 case WM_DISPLAYCHANGE: @@ -2582,13 +2689,13 @@ void logging_init (void) write_log (_T("\n%s (%d.%d %s%s[%d])"), VersionStr, osVersion.dwMajorVersion, osVersion.dwMinorVersion, osVersion.szCSDVersion, - _tcslen (osVersion.szCSDVersion) > 0 ? _T(" ") : _T(""), os_winnt_admin); + _tcslen (osVersion.szCSDVersion) > 0 ? _T(" ") : _T(""), os_admin); write_log (_T(" %d-bit %X.%X.%X %d %s"), wow64 ? 64 : 32, SystemInfo.wProcessorArchitecture, SystemInfo.wProcessorLevel, SystemInfo.wProcessorRevision, SystemInfo.dwNumberOfProcessors, filedate); write_log (_T("\n(c) 1995-2001 Bernd Schmidt - Core UAE concept and implementation.") - _T("\n(c) 1998-2014 Toni Wilen - Win32 port, core code updates.") + _T("\n(c) 1998-2015 Toni Wilen - Win32 port, core code updates.") _T("\n(c) 1996-2001 Brian King - Win32 port, Picasso96 RTG, and GUI.") _T("\n(c) 1996-1999 Mathias Ortmann - Win32 port and bsdsocket support.") _T("\n(c) 2000-2001 Bernd Meyer - JIT engine.") @@ -4000,7 +4107,7 @@ static int shell_deassociate (const TCHAR *extension) return 0; _tcscpy (progid2, progid); _tcscat (progid2, extension); - if (os_winnt_admin > 1) + if (os_admin > 1) rkey = HKEY_LOCAL_MACHINE; else rkey = HKEY_CURRENT_USER; @@ -4036,7 +4143,7 @@ static int shell_associate_2 (const TCHAR *extension, TCHAR *shellcommand, TCHAR _tcscpy (progid2, progid); _tcscat (progid2, ext2 ? ext2 : extension); - if (os_winnt_admin > 1) + if (os_admin > 1) rkey = HKEY_LOCAL_MACHINE; else rkey = HKEY_CURRENT_USER; @@ -4140,7 +4247,7 @@ static int shell_associate_is (const TCHAR *extension) _tcscpy (progid2, progid); _tcscat (progid2, extension); - if (os_winnt_admin > 1) + if (os_admin > 1) rkey = HKEY_LOCAL_MACHINE; else rkey = HKEY_CURRENT_USER; @@ -4214,7 +4321,7 @@ static void associate_init_extensions (void) regsetstr (fkey, exts[0].ext, _T("")); regclosetree (fkey); } - if (os_winnt_admin > 1) { + if (os_admin > 1) { DWORD disposition; TCHAR rpath[MAX_DPATH]; HKEY rkey = HKEY_LOCAL_MACHINE; @@ -4513,7 +4620,7 @@ static int dxdetect (void) #endif } -int os_winnt, os_winnt_admin, os_64bit, os_win7, os_vista, os_winxp, cpu_number; +int os_admin, os_64bit, os_win7, os_vista, cpu_number; static int isadminpriv (void) { @@ -4590,19 +4697,6 @@ static int osdetect (void) pGetNativeSystemInfo (&SystemInfo); osVersion.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); if (GetVersionEx (&osVersion)) { - if ((osVersion.dwPlatformId == VER_PLATFORM_WIN32_NT) && - (osVersion.dwMajorVersion <= 4)) - { - /* WinUAE not supported on this version of Windows... */ - TCHAR szWrongOSVersion[MAX_DPATH]; - WIN32GUI_LoadUIString (IDS_WRONGOSVERSION, szWrongOSVersion, MAX_DPATH); - pre_gui_message (szWrongOSVersion); - return FALSE; - } - if (osVersion.dwPlatformId == VER_PLATFORM_WIN32_NT) - os_winnt = 1; - if (osVersion.dwMajorVersion > 5 || (osVersion.dwMajorVersion == 5 && osVersion.dwMinorVersion >= 1)) - os_winxp = 1; if (osVersion.dwMajorVersion >= 6) os_vista = 1; if (osVersion.dwMajorVersion >= 7 || (osVersion.dwMajorVersion == 6 && osVersion.dwMinorVersion >= 1)) @@ -4611,15 +4705,13 @@ static int osdetect (void) os_64bit = 1; } cpu_number = SystemInfo.dwNumberOfProcessors; - if (!os_winnt) - return 0; - os_winnt_admin = isadminpriv (); - if (os_winnt_admin) { + os_admin = isadminpriv (); + if (os_admin) { if (pIsUserAnAdmin) { if (pIsUserAnAdmin ()) - os_winnt_admin++; + os_admin++; } else { - os_winnt_admin++; + os_admin++; } } @@ -5812,7 +5904,7 @@ static void create_dump (struct _EXCEPTION_POINTERS *pExceptionPointers) struct tm when; __time64_t now; - if (os_winnt && GetModuleFileName (NULL, path, MAX_DPATH)) { + if (GetModuleFileName (NULL, path, MAX_DPATH)) { TCHAR dumpfilename[100]; TCHAR beta[100]; TCHAR path3[MAX_DPATH]; @@ -5979,22 +6071,11 @@ LONG WINAPI WIN32_ExceptionFilter (struct _EXCEPTION_POINTERS *pExceptionPointer const static GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2L, 0xF16F, 0x11CF, { 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } }; -typedef ULONG (CALLBACK *SHCHANGENOTIFYREGISTER) - (HWND hwnd, - int fSources, - LONG fEvents, - UINT wMsg, - int cEntries, - const SHChangeNotifyEntry *pshcne); -typedef BOOL (CALLBACK *SHCHANGENOTIFYDEREGISTER)(ULONG ulID); - void addnotifications (HWND hwnd, int remove, int isgui) { static ULONG ret; static HDEVNOTIFY hdn; static int wtson; - LPITEMIDLIST ppidl; - if (remove) { if (ret > 0) @@ -6003,24 +6084,23 @@ void addnotifications (HWND hwnd, int remove, int isgui) if (hdn) UnregisterDeviceNotification (hdn); hdn = 0; - if (os_winxp && wtson && !isgui) + if (wtson && !isgui) WTSUnRegisterSessionNotification (hwnd); wtson = 0; } else { DEV_BROADCAST_DEVICEINTERFACE NotificationFilter = { 0 }; - if(SHGetSpecialFolderLocation (hwnd, CSIDL_DESKTOP, &ppidl) == NOERROR) { - SHChangeNotifyEntry shCNE; - shCNE.pidl = ppidl; - shCNE.fRecursive = TRUE; - ret = SHChangeNotifyRegister (hwnd, SHCNE_DISKEVENTS, SHCNE_MEDIAINSERTED | SHCNE_MEDIAREMOVED | SHCNE_DRIVEREMOVED | SHCNE_DRIVEADD, - WM_USER + 2, 1, &shCNE); - } + SHChangeNotifyEntry shCNE = { 0 }; + shCNE.pidl = NULL; + shCNE.fRecursive = TRUE; + ret = SHChangeNotifyRegister (hwnd, SHCNRF_ShellLevel | SHCNRF_InterruptLevel | SHCNRF_NewDelivery, + SHCNE_MEDIAREMOVED | SHCNE_MEDIAINSERTED | SHCNE_DRIVEREMOVED | SHCNE_DRIVEADD, + WM_USER + 2, 1, &shCNE); NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE); NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; NotificationFilter.dbcc_classguid = GUID_DEVINTERFACE_HID; - hdn = RegisterDeviceNotification (hwnd, &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE); - if (os_winxp && !isgui) + hdn = RegisterDeviceNotification (hwnd, &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES); + if (!isgui) wtson = WTSRegisterSessionNotification (hwnd, NOTIFY_FOR_THIS_SESSION); } } diff --git a/od-win32/win32.h b/od-win32/win32.h index 90bf3b06..bbeafb50 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,17 +15,17 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEPUBLICBETA 0 +#define WINUAEPUBLICBETA 1 #define LANG_DLL 1 #define LANG_DLL_FULL_VERSION_MATCH 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("0") +#define WINUAEBETA _T("1") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2014, 12, 17) +#define WINUAEDATE MAKEBD(2015, 1, 1) //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") @@ -89,7 +89,7 @@ extern int sound_available; extern int framecnt; extern TCHAR VersionStr[256]; extern TCHAR BetaStr[64]; -extern int os_winnt_admin, os_64bit, os_vista, os_winxp, os_win7, cpu_number; +extern int os_admin, os_64bit, os_vista, os_win7, cpu_number; extern OSVERSIONINFO osVersion; extern int paraport_mask; extern int gui_active; diff --git a/od-win32/win32_filesys.cpp b/od-win32/win32_filesys.cpp index 0bc0fd18..e3f5f73b 100644 --- a/od-win32/win32_filesys.cpp +++ b/od-win32/win32_filesys.cpp @@ -7,7 +7,7 @@ int CheckRM (const TCHAR *DriveName) DWORD dwHold; BOOL result = FALSE; - _stprintf (filename, _T("%s."), DriveName); + _stprintf (filename, _T("\\\\?\\%s"), DriveName); dwHold = GetFileAttributes (filename); if(dwHold != 0xFFFFFFFF) result = TRUE; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index e25e9d27..863a6c71 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include "resource.h" #include "sysconfig.h" @@ -187,8 +188,9 @@ struct scsiromselect }; static struct scsiromselect scsiromdata[] = { - { workprefs.a2091rom.roms[0].romfile, ROMTYPE_A2091BOOT | ROMTYPE_NONE }, - { workprefs.a4091rom.roms[0].romfile, ROMTYPE_A4091BOOT }, + { workprefs.a2091rom.roms[0].romfile, ROMTYPE_A2091 | ROMTYPE_NONE }, + { workprefs.gvprom.roms[0].romfile, ROMTYPE_GVP }, + { workprefs.a4091rom.roms[0].romfile, ROMTYPE_A4091 }, { workprefs.fastlanerom.roms[0].romfile, ROMTYPE_FASTLANE }, { workprefs.oktagonrom.roms[0].romfile, ROMTYPE_OKTAGON }, { workprefs.acceleratorextromfile, ROMTYPE_CPUBOARDEXT }, @@ -1654,6 +1656,8 @@ static void show_rom_list (void) 49, 50, 75, 51, 76, 77, -1, 5, 4, -1, -2, // ARCADIA 53, 54, 55, 56, -1, -1, // A590/A2091 + 111, -1, -1, // GVP Series I + 109, 110, -1, -1, // GVP Series II 57, 58, -1, -1, // A4091 102, -1, -1, // Fastlane 103, -1, -1, // Oktagon @@ -1668,6 +1672,8 @@ static void show_rom_list (void) 92, -1, -1, // 2060 93, -1, -1, // Warp Engine 105, -1, -1, // TekMagic + 112, -1, -1, // DKB 12x0 + 113, -1, -1, // Fusion Forty 95, 101, -1, -1, // CS MK I 96, -1, -1, // CS MK II 97, -1, -1, // CS MK III @@ -1688,7 +1694,7 @@ static void show_rom_list (void) p1 = _T("A500 Boot ROM 1.2\0A500 Boot ROM 1.3\0A500+\0A600\0A1000\0A1200\0A3000\0A4000\0A4000T\0") _T("CD32\0CDTV\0CDTV-CR\0Arcadia Multi Select\0") - _T("A590/A2091 SCSI\0A4091 SCSI\0Fastlane\0Oktagon 2008\0") + _T("A590/A2091 SCSI\0GVP Series I SCSI\0GVP Series II SCSI\0A4091 SCSI\0Fastlane\0Oktagon 2008\0") _T("CD32 Full Motion Video\0") _T("Picasso IV\0") @@ -1696,6 +1702,7 @@ static void show_rom_list (void) _T("Blizzard 1230-IV\0Blizzard 1260\0") _T("Blizzard 1230-IV/SCSI\0Blizzard 1260/SCSI\0") _T("Blizzard 2060\0Warp Engine\0TekMagic 2040/2060\0") + _T("DKB 1230/1240\0Fusion Forty\0") _T("CyberStorm MK I\0CyberStorm MK II\0CyberStorm MK III\0") _T("Blizzard PPC\0CyberStorm PPC\0") @@ -4298,6 +4305,8 @@ void InitializeListView (HWND hDlg) _T("SCSI:%s"), _T("A2091:%s"), _T("A2091 2nd:%s"), + _T("GVP: %s"), + _T("GVP 2nd: %s"), _T("A4091:%s"), _T("A4091 2nd:%s"), _T("Fastlane:%s"), @@ -7934,6 +7943,7 @@ static void enable_for_expansiondlg (HWND hDlg) ew (hDlg, IDC_RTG_HWSPRITE, rtg3 && workprefs.gfx_api); ShowWindow (GetDlgItem(hDlg, IDC_CS_SCSIMODE), SW_HIDE); ew(hDlg, IDC_CS_CD32FMV, en); + ew(hDlg, IDC_CS_TOCCATA, en); ew (hDlg, IDC_CS_SCSIMODE, FALSE); } @@ -7947,6 +7957,7 @@ static void values_to_expansiondlg (HWND hDlg) CheckDlgButton (hDlg, IDC_SANA2, workprefs.sana2); CheckDlgButton (hDlg, IDC_A2065, workprefs.a2065name[0] ? 1 : 0); CheckDlgButton(hDlg, IDC_CS_CD32FMV, workprefs.cs_cd32fmv); + CheckDlgButton(hDlg, IDC_CS_TOCCATA, workprefs.sound_toccata); CheckDlgButton(hDlg, IDC_CS_SCSIMODE, workprefs.scsi == 2); SendDlgItemMessage (hDlg, IDC_RTG_BUFFERCNT, CB_SETCURSEL, workprefs.gfx_apmode[1].gfx_backbuffers == 0 ? 0 : workprefs.gfx_apmode[1].gfx_backbuffers - 1, 0); cw = catweasel_detect (); @@ -8116,6 +8127,9 @@ static INT_PTR CALLBACK ExpansionDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP case IDC_CS_CD32FMV: workprefs.cs_cd32fmv = ischecked(hDlg, IDC_CS_CD32FMV) ? 1 : 0; break; + case IDC_CS_TOCCATA: + workprefs.sound_toccata = ischecked(hDlg, IDC_CS_TOCCATA) ? 1 : 0; + break; } if (HIWORD (wParam) == CBN_SELENDOK || HIWORD (wParam) == CBN_KILLFOCUS || HIWORD (wParam) == CBN_EDITCHANGE) { uae_u32 mask = workprefs.picasso96_modeflags; @@ -8291,6 +8305,8 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA SendDlgItemMessage(hDlg, IDC_CPUBOARD_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("Warp Engine")); SendDlgItemMessage(hDlg, IDC_CPUBOARD_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("Tek Magic")); SendDlgItemMessage(hDlg, IDC_CPUBOARD_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("A2620/A2630")); + SendDlgItemMessage(hDlg, IDC_CPUBOARD_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("DKB 1230/1240")); + SendDlgItemMessage(hDlg, IDC_CPUBOARD_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("Fusion Forty")); setcpuboardmemsize(hDlg); case WM_USER: @@ -8473,12 +8489,13 @@ static void init_kickstart (HWND hDlg) #endif ew(hDlg, IDC_CPUBOARDROMFILE, workprefs.cpuboard_type != 0); - SendDlgItemMessage (hDlg, IDC_SCSIROMSELECT, CB_RESETCONTENT, 0, 0); - SendDlgItemMessage (hDlg, IDC_SCSIROMSELECT, CB_ADDSTRING, 0, (LPARAM)_T("A590/A2091")); - SendDlgItemMessage (hDlg, IDC_SCSIROMSELECT, CB_ADDSTRING, 0, (LPARAM)_T("A4091")); - SendDlgItemMessage (hDlg, IDC_SCSIROMSELECT, CB_ADDSTRING, 0, (LPARAM)_T("Fastlane")); - SendDlgItemMessage (hDlg, IDC_SCSIROMSELECT, CB_ADDSTRING, 0, (LPARAM)_T("Oktagon 2008")); - SendDlgItemMessage (hDlg, IDC_SCSIROMSELECT, CB_ADDSTRING, 0, (LPARAM)_T("Blizzard SCSI Kit IV")); + SendDlgItemMessage(hDlg, IDC_SCSIROMSELECT, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hDlg, IDC_SCSIROMSELECT, CB_ADDSTRING, 0, (LPARAM)_T("A590/A2091")); + SendDlgItemMessage(hDlg, IDC_SCSIROMSELECT, CB_ADDSTRING, 0, (LPARAM)_T("GVP Series II")); + SendDlgItemMessage(hDlg, IDC_SCSIROMSELECT, CB_ADDSTRING, 0, (LPARAM)_T("A4091")); + SendDlgItemMessage(hDlg, IDC_SCSIROMSELECT, CB_ADDSTRING, 0, (LPARAM)_T("Fastlane")); + SendDlgItemMessage(hDlg, IDC_SCSIROMSELECT, CB_ADDSTRING, 0, (LPARAM)_T("Oktagon 2008")); + SendDlgItemMessage(hDlg, IDC_SCSIROMSELECT, CB_ADDSTRING, 0, (LPARAM)_T("Blizzard SCSI Kit IV")); int found = -1; for (int i = 0; scsiromdata[i].name; i++) { @@ -8525,7 +8542,7 @@ static void kickstartfilebuttons (HWND hDlg, WPARAM wParam, TCHAR *path) values_to_kickstartdlg (hDlg); break; case IDC_SCSIROMCHOOSER: - DiskSelection(hDlg, IDC_SCSIROMCHOOSER, 6, &workprefs, path); + DiskSelection(hDlg, IDC_SCSIROMFILE, 6, &workprefs, path); values_to_kickstartdlg (hDlg); break; case IDC_CPUBOARDROMCHOOSER: @@ -10286,25 +10303,27 @@ static void sethardfile (HWND hDlg) static void inithdcontroller (HWND hDlg, int ctype, int devtype) { - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_RESETCONTENT, 0, 0); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("UAE")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("IDE")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("SCSI (Auto)")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A590/A2091 SCSI")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A590/A2091 #2 SCSI")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A4091 SCSI")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A4091 #2 SCSI")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("Fastlane SCSI")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("Fastlane #2 SCSI")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("Oktagon 2008 SCSI")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("Oktagon 2008 #2 SCSI")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A3000 SCSI")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A4000T SCSI")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("CDTV SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("UAE")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("IDE")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("SCSI (Auto)")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A590/A2091 SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A590/A2091 #2 SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("GVP SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("GVP #2 SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A4091 SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A4091 #2 SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("Fastlane SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("Fastlane #2 SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("Oktagon 2008 SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("Oktagon 2008 #2 SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A3000 SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A4000T SCSI")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("CDTV SCSI")); SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("Accelerator board SCSI")); SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("PCMCIA SRAM")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("PCMCIA IDE")); - SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, ctype, 0); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("PCMCIA IDE")); + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, ctype, 0); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_RESETCONTENT, 0, 0); if (ctype >= HD_CONTROLLER_TYPE_IDE_FIRST && ctype <= HD_CONTROLLER_TYPE_SCSI_LAST) { @@ -10594,7 +10613,7 @@ static INT_PTR CALLBACK CDDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, case WM_INITDIALOG: recursive++; if (current_cddlg.ci.controller_type == HD_CONTROLLER_TYPE_UAE) - current_cddlg.ci.controller_type = (cfgfile_board_enabled(&workprefs.a2091rom) || cfgfile_board_enabled(&workprefs.a4091rom) || workprefs.cs_cdtvscsi || (workprefs.cs_mbdmac & 3)) ? HD_CONTROLLER_TYPE_SCSI_AUTO : HD_CONTROLLER_TYPE_IDE_AUTO; + current_cddlg.ci.controller_type = (cfgfile_board_enabled(&workprefs.a2091rom) || cfgfile_board_enabled(&workprefs.gvprom) || cfgfile_board_enabled(&workprefs.a4091rom) || workprefs.cs_cdtvscsi || (workprefs.cs_mbdmac & 3)) ? HD_CONTROLLER_TYPE_SCSI_AUTO : HD_CONTROLLER_TYPE_IDE_AUTO; inithdcontroller(hDlg, current_cddlg.ci.controller_type, UAEDEV_CD); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_cddlg.ci.controller_unit, 0); InitializeListView (hDlg); @@ -16747,7 +16766,7 @@ static int dialogreturn; static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static int recursive = 0; - static int waitfornext; + static int devicechangetimer; static int oldwidth, oldheight; switch (msg) @@ -16787,8 +16806,7 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l DEV_BROADCAST_HDR *pBHdr = (DEV_BROADCAST_HDR *)lParam; int doit = 0; if (wParam == DBT_DEVNODES_CHANGED && lParam == 0) { - if (waitfornext) - doit = 1; + doit = 1; } else if (pBHdr && pBHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { DEV_BROADCAST_DEVICEINTERFACE *dbd = (DEV_BROADCAST_DEVICEINTERFACE*)lParam; write_log (_T("%s: %s\n"), wParam == DBT_DEVICEREMOVECOMPLETE ? _T("Removed") : _T("Inserted"), @@ -16796,19 +16814,32 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l if (wParam == DBT_DEVICEREMOVECOMPLETE) doit = 1; else if (wParam == DBT_DEVICEARRIVAL) - waitfornext = 1; /* DirectInput enumeration does not yet show the new device.. */ + doit = 1; } if (doit) { - inputdevice_devicechange (&workprefs); - updatePanel (currentpage); - waitfornext = 0; + if (devicechangetimer) + KillTimer(hDlg, 3); + devicechangetimer = 1; + SetTimer(hDlg, 3, 2000, NULL); } } return TRUE; + case WM_TIMER: + if (wParam == 3) { + KillTimer(hDlg, 3); + devicechangetimer = 0; + inputdevice_devicechange (&workprefs); + updatePanel (currentpage); + break; + } + case WM_DESTROY: PostQuitMessage (0); return TRUE; case WM_CLOSE: + if (devicechangetimer) + KillTimer(hDlg, 3); + devicechangetimer = 0; addnotifications (hDlg, TRUE, TRUE); updatePanel (-1); DestroyWindow(hDlg); @@ -16821,7 +16852,6 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l } return TRUE; case WM_INITDIALOG: - waitfornext = 0; guiDlg = hDlg; scaleresource_setfont (hDlg); SendMessage (hDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon (GetModuleHandle (NULL), MAKEINTRESOURCE(IDI_APPICON))); diff --git a/od-win32/winuae_msvc11/winuae_msvc.vcxproj b/od-win32/winuae_msvc11/winuae_msvc.vcxproj index 54de8842..0d4e767b 100644 --- a/od-win32/winuae_msvc11/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc11/winuae_msvc.vcxproj @@ -804,6 +804,7 @@ + @@ -845,6 +846,7 @@ + diff --git a/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters b/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters index 5b08fe48..b2058040 100644 --- a/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters +++ b/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters @@ -715,6 +715,12 @@ common + + common + + + common + diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 3b707de1..fe8a664d 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -18,6 +18,78 @@ Things that may happen in 2015: - restore only single input target to default. +- Lowered disk motor startup delay, more closer match with real hardware (at least matches some random drive + in my A500) +- Memwatch points in KS ROM address space crashed during reset. (Wrong ROM mirror selection) +- A4000T NCR SCSI data bus width become 16-bit in cycle-exact mode. Caused write triggerable registers + to start operation before full 32-bit value was written. +- Memwatch points didn't work in ROM addresses. +- CPU HALT state caused infinite loop in some configurations. +- 2900b16 68040 MMU MOVEM stack frame update was incorrect. (NetBSD crash, probably other Unix-likes too) +- Some 68000 MOVE variants seem to sample interrupt lines before writes and some after writes. Added special + case for one variant, allows Made in Croatia / Binary to work in cycle-exact mode. Need more testing later, + there does not seem to be any pattern. +- Last line sometimes flickered with random colors in "Double, fields/+" non-interlaced mode. +- RTG mode screenshots in 16-bit host color depth mode had wrong colors. +- Non-cycle exact modes with display vertical diw open but bitplane DMA disabled: in some situations display was + corrupted or shifted. (Gloom AGA, Worms Directors Cut title screens) +- Directory filesystem exnext packet update didn't always work correctly if file was deleted during directory + enumeration. (Which is technically illegal but it accidentally worked with OFS/FFS and become a feature..) +- Autoconfig space was not unmapped after it finished, broke during previous autoconfig rewrite. +- GUI didn't allow selection of custom SCSI ROM file. +- Completely rewritten CPU idle function, max CPU idle setting should now work without any slowdown side-effects, + also lowest CPU idle state should be less than 10%. Please test. +- Last line is not special if A1000 Agnus. I was expecting this result when I noticed that A1000 sprite behavior + is different in last line vs later Agnus models. A1000 Agnus: all visible lines are normal, later revisions: + last line inhibits bitplane and sprite DMA. Real A1000 confirmed. I think this is last A1000 vs later Agnus + revision undocumented difference. +- Small sprite update, only writes to SPRxCTL disarms sprite (I had special case for first DMA write to SPRxPOS + too, only because it worked around another old bug..). Now OCS Agnus + ECS Denise + KS3.1 combination mouse + cursor sprite corruption is 100% correct. +- On the fly media insertions are now serialized and only processed when Windows PnP manager reports idle + state (Media mounting works even if it causes "installing drivers" phase) and multiple simultaneous media + insertions also work reliably now (for example USB reader connected with multiple cards already inserted) +- First on the fly inserted device name becomes RDH0:, second RDH1: and so on. Previously number was next + available directory filesystem unit number. +- Delay enumeration of inserted/removed input devices by 2 seconds. One removal or insertion can cause + multiple device events (which is harmless but sometimes annoying) +- Picasso IV autoconfig missed special case, other boards are 16M in Z3 mode but PIV is 32M. Fixes incorrect + address alignment if Z3 fast RAM is also enabled and size is less than 32M. (OS4 black screen hang) +- Picasso IV byteswap VRAM space didn't handle byte reads or writes correctly, only words and longs worked. + (OS4 1024*768*16 screen mode glitches, possibly also other 16 bit modes) + +New hardware emulated: + +- GVP SCSI Series I and II hardware emulation (WD33C93), HC+8 board. v3.15 and v4.15 boot ROMs added to ROM + scanner (gvpscsi.device). GVP SCSI enabled + Z2 fast RAM: use GVP Z2 fast ram autoconfig ID. +- DKB 1230/1240 accelerator board + SCSI emulation (FAS246 which appears to be compatible with 53C94/FAS216). + SCSI is non-DMA (dkbscsi.device). v1.23 ROM added to ROM scanner. RAM not emulated, no idea about address space. +- Fusion Forty accelerator board emulation. It has interesting menu and graphics in boot ROM, press right + mouse button when booting. v3.4 ROM images added to ROM scanner. RAM expansion emulated. +- Toccata Z2 sound card emulation. + +Toccata hardware features emulated: +- Mono and stereo channel modes. +- 8-bit and 16-bit linear PCM. Companded (ulaw/alaw) modes are not supported. +- Left and right output channel volume control and mute. +- All AD1848 supported output frequencies. +- Output only. Input channels are not supported. + +Technical details: +- Has 1024x9bit FIFO chip, one for output and one for input. +- No DMA. Uses level 6 interrupt to fill FIFO, 512 bytes/interrupt. Interrupt triggers when FIFO has 512 bytes or less + data available. (Which makes about 7 interrupts/frame at 44100Hz/16bit/stereo) + +Notes: +- Different implementation than uae ahi and CD audio. Audio goes to Paula emulation backend (after Paula 8 to 16-bit + conversions and filters). Very good latency but glitches are possible if configured buffer size is too small or + not enough CPU power available (just like with Paula audio). It should be usable for (game) sound effect, not just + for music. +- Because it uses Paula audio path, Toccata audio is included with sound recording. Same method may be used with + CD audio in future. (Possibly optionally). +- It is best to set same sample rate in both AHI and UAE sound settings to reduce possible resampling artifacts. +- Does any DMA capable simple sound cards exist? (Simple = basic CODEC chip only, no DSP chip) + 3.0.0 Beta 28: (RC3) diff --git a/zfile.cpp b/zfile.cpp index 34407a86..92443ded 100644 --- a/zfile.cpp +++ b/zfile.cpp @@ -2107,6 +2107,22 @@ uae_u8 *zfile_load_data (const TCHAR *name, const uae_u8 *data,int datalen, int return out; } +uae_u8 *zfile_load_file(const TCHAR *name, int *outlen) +{ + struct zfile *zf; + int size; + uae_u8 *out; + + zf = zfile_fopen(name, _T("rb")); + if (!zf) + return NULL; + size = zfile_size(zf); + out = xmalloc (uae_u8, size); + zfile_fread(out, 1, size, zf); + zfile_fclose(zf); + *outlen = size; + return out; +} int zfile_truncate (struct zfile *z, uae_s64 size) {