From: Toni Wilen Date: Sat, 24 Sep 2016 11:47:26 +0000 (+0300) Subject: 3400b8 X-Git-Tag: 3400~79 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=c2b0d5433870d9fd6321baa1e85679e3c405c5cf;p=francis%2Fwinuae.git 3400b8 --- diff --git a/blkdev.cpp b/blkdev.cpp index 9d72e33c..8ec3676e 100644 --- a/blkdev.cpp +++ b/blkdev.cpp @@ -419,9 +419,9 @@ static void cd_statusline_label(int unitnum) struct device_info di; const TCHAR *fname = my_getfilepart(p); if (sys_command_info(unitnum, &di, 0) && di.volume_id[0]) - statusline_add_message(_T("CD%d: [%s] %s"), unitnum, di.volume_id, fname); + statusline_add_message(STATUSTYPE_CD, _T("CD%d: [%s] %s"), unitnum, di.volume_id, fname); else - statusline_add_message(_T("CD%d: %s"), unitnum, fname); + statusline_add_message(STATUSTYPE_CD, _T("CD%d: %s"), unitnum, fname); } } @@ -638,7 +638,7 @@ static void check_changes (int unitnum) } write_log (_T("CD: eject (%s) open=%d\n"), pollmode ? _T("slow") : _T("fast"), st->wasopen ? 1 : 0); if (wasimage) - statusline_add_message(_T("CD%d: -"), unitnum); + statusline_add_message(STATUSTYPE_CD, _T("CD%d: -"), unitnum); #ifdef RETROPLATFORM rp_cd_image_change (unitnum, NULL); diff --git a/cfgfile.cpp b/cfgfile.cpp index aceb68c2..2c1c85ca 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -1679,7 +1679,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write (f, _T("parallel_autoflush"), _T("%d"), p->parallel_autoflush_time); cfgfile_dwrite (f, _T("uae_hide"), _T("%d"), p->uae_hide); cfgfile_dwrite_bool (f, _T("uae_hide_autoconfig"), p->uae_hide_autoconfig); - cfgfile_dwrite_bool (f, _T("magic_mouse"), p->input_magic_mouse); + cfgfile_dwrite_bool (f, _T("magic_mouse"), (p->input_mouse_untrap & MOUSEUNTRAP_MAGIC) != 0); cfgfile_dwrite_str (f, _T("magic_mousecursor"), magiccursors[p->input_magic_mouse_cursor]); cfgfile_dwrite_str (f, _T("absolute_mouse"), abspointers[p->input_tablet]); cfgfile_dwrite_bool (f, _T("tablet_library"), p->tablet_library); @@ -2840,7 +2840,6 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_yesno(option, value, _T("gfx_flickerfixer"), &p->gfx_scandoubler) || cfgfile_yesno(option, value, _T("gfx_autoresolution_vga"), &p->gfx_autoresolution_vga) || cfgfile_yesno(option, value, _T("show_refresh_indicator"), &p->refresh_indicator) - || cfgfile_yesno(option, value, _T("magic_mouse"), &p->input_magic_mouse) || cfgfile_yesno(option, value, _T("warp"), &p->turbo_emulation) || cfgfile_yesno(option, value, _T("headless"), &p->headless) || cfgfile_yesno(option, value, _T("clipboard_sharing"), &p->clipboard_sharing) @@ -2878,6 +2877,12 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_strval (option, value, _T("absolute_mouse"), &p->input_tablet, abspointers, 0)) return 1; + if (cfgfile_yesno(option, value, _T("magic_mouse"), &vb)) { + p->input_mouse_untrap |= MOUSEUNTRAP_MAGIC; + return 1; + } + + #ifdef GFXFILTER for (int j = 0; j < 2; j++) { struct gfx_filterdata *gf = &p->gf[j]; @@ -4563,12 +4568,12 @@ static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, con return false; } -static void addbcromtype(struct uae_prefs *p, int romtype, bool add, const TCHAR *romfile) +static void addbcromtype(struct uae_prefs *p, int romtype, bool add, const TCHAR *romfile, int devnum) { if (!add) { - clear_device_rom(p, romtype, 0, true); + clear_device_rom(p, romtype, devnum, true); } else { - struct boardromconfig *brc = get_device_rom_new(p, romtype, 0, NULL); + struct boardromconfig *brc = get_device_rom_new(p, romtype, devnum, NULL); if (brc && !brc->roms[0].romfile[0]) { _tcscpy(brc->roms[0].romfile, romfile ? romfile : _T(":ENABLED")); } @@ -4624,7 +4629,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH if (cfgfile_string(option, value, _T("a2065"), p->a2065name, sizeof p->a2065name / sizeof(TCHAR))) { if (p->a2065name[0]) - addbcromtype(p, ROMTYPE_A2065, true, NULL); + addbcromtype(p, ROMTYPE_A2065, true, NULL, 0); return 1; } @@ -4778,65 +4783,65 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH if (cfgfile_yesno(option, value, _T("pcmcia"), &p->cs_pcmcia)) { if (p->cs_pcmcia) - addbcromtype(p, ROMTYPE_MB_PCMCIA, true, NULL); + addbcromtype(p, ROMTYPE_MB_PCMCIA, true, NULL, 0); return 1; } if (cfgfile_strval(option, value, _T("ide"), &p->cs_ide, idemode, 0)) { if (p->cs_ide) - addbcromtype(p, ROMTYPE_MB_IDE, true, NULL); + addbcromtype(p, ROMTYPE_MB_IDE, true, NULL, 0); return 1; } if (cfgfile_yesno(option, value, _T("scsi_a3000"), &dummybool)) { if (dummybool) { - addbcromtype(p, ROMTYPE_SCSI_A3000, true, NULL); + addbcromtype(p, ROMTYPE_SCSI_A3000, true, NULL, 0); p->cs_mbdmac = 1; } return 1; } if (cfgfile_yesno(option, value, _T("scsi_a4000t"), &dummybool)) { if (dummybool) { - addbcromtype(p, ROMTYPE_SCSI_A4000T, true, NULL); + addbcromtype(p, ROMTYPE_SCSI_A4000T, true, NULL, 0); p->cs_mbdmac = 2; } return 1; } if (cfgfile_yesno(option, value, _T("cd32fmv"), &p->cs_cd32fmv)) { if (p->cs_cd32fmv) { - addbcromtype(p, ROMTYPE_CD32CART, true, p->cartfile); + addbcromtype(p, ROMTYPE_CD32CART, true, p->cartfile, 0); } return 1; } if (cfgfile_intval(option, value, _T("catweasel"), &p->catweasel, 1)) { if (p->catweasel) { - addbcromtype(p, ROMTYPE_CATWEASEL, true, NULL); + addbcromtype(p, ROMTYPE_CATWEASEL, true, NULL, 0); } return 1; } if (cfgfile_yesno(option, value, _T("toccata"), &dummybool)) { if (dummybool) { - addbcromtype(p, ROMTYPE_TOCCATA, true, NULL); + addbcromtype(p, ROMTYPE_TOCCATA, true, NULL, 0); } return 1; } if (cfgfile_yesno(option, value, _T("es1370_pci"), &dummybool)) { if (dummybool) { - addbcromtype(p, ROMTYPE_ES1370, true, NULL); + addbcromtype(p, ROMTYPE_ES1370, true, NULL, 0); } return 1; } if (cfgfile_yesno(option, value, _T("fm801_pci"), &dummybool)) { if (dummybool) { - addbcromtype(p, ROMTYPE_FM801, true, NULL); + addbcromtype(p, ROMTYPE_FM801, true, NULL, 0); } return 1; } if (cfgfile_yesno(option, value, _T("toccata_mixer"), &dummybool)) { if (dummybool) { - addbcromtype(p, ROMTYPE_TOCCATA, true, NULL); + addbcromtype(p, ROMTYPE_TOCCATA, true, NULL, 0); } return 1; } @@ -5109,7 +5114,7 @@ static void romtype_restricted(struct uae_prefs *p, int *list) while (list[i]) { romtype = list[i]; if (cfgfile_board_enabled(p, romtype, 0)) { - addbcromtype(p, romtype, false, NULL); + addbcromtype(p, romtype, false, NULL, 0); } i++; return; @@ -5185,11 +5190,33 @@ void cfgfile_compatibility_rtg(struct uae_prefs *p) } } } + int rtgs[MAX_RTG_BOARDS] = { 0 }; + for (int i = 0; i < MAX_RTG_BOARDS; i++) { + if (p->rtgboards[i].rtgmem_size && !rtgs[i]) { + uae_u32 romtype = gfxboard_get_romtype(&p->rtgboards[i]); + if (romtype) { + int devnum = 0; + for (int j = i; j < MAX_RTG_BOARDS; j++) { + rtgs[j] = 1; + if (gfxboard_get_romtype(&p->rtgboards[j]) == romtype) { + addbcromtype(p, romtype, true, NULL, devnum); + devnum++; + } + } + while (devnum < MAX_DUPLICATE_EXPANSION_BOARDS) { + addbcromtype(p, romtype, false, NULL, devnum); + devnum++; + } + } + } + } for (int i = 0; i < MAX_RTG_BOARDS; i++) { - if (p->rtgboards[i].rtgmem_size) { + if (!rtgs[i]) { uae_u32 romtype = gfxboard_get_romtype(&p->rtgboards[i]); if (romtype) { - addbcromtype(p, romtype, true, NULL); + for (int devnum = 0; devnum < MAX_DUPLICATE_EXPANSION_BOARDS; devnum++) { + addbcromtype(p, romtype, false, NULL, devnum); + } } } } @@ -5197,31 +5224,31 @@ void cfgfile_compatibility_rtg(struct uae_prefs *p) void cfgfile_compatibility_romtype(struct uae_prefs *p) { - addbcromtype(p, ROMTYPE_MB_PCMCIA, p->cs_pcmcia, NULL); + addbcromtype(p, ROMTYPE_MB_PCMCIA, p->cs_pcmcia, NULL, 0); - addbcromtype(p, ROMTYPE_MB_IDE, p->cs_ide != 0, NULL); + addbcromtype(p, ROMTYPE_MB_IDE, p->cs_ide != 0, NULL, 0); if (p->cs_mbdmac == 1) { - addbcromtype(p, ROMTYPE_SCSI_A4000T, false, NULL); - addbcromtype(p, ROMTYPE_SCSI_A3000, true, NULL); + addbcromtype(p, ROMTYPE_SCSI_A4000T, false, NULL, 0); + addbcromtype(p, ROMTYPE_SCSI_A3000, true, NULL, 0); } else if (p->cs_mbdmac == 2) { - addbcromtype(p, ROMTYPE_SCSI_A3000, false, NULL); - addbcromtype(p, ROMTYPE_SCSI_A4000T, true, NULL); + addbcromtype(p, ROMTYPE_SCSI_A3000, false, NULL, 0); + addbcromtype(p, ROMTYPE_SCSI_A4000T, true, NULL, 0); } else { - addbcromtype(p, ROMTYPE_SCSI_A3000, false, NULL); - addbcromtype(p, ROMTYPE_SCSI_A4000T, false, NULL); + addbcromtype(p, ROMTYPE_SCSI_A3000, false, NULL, 0); + addbcromtype(p, ROMTYPE_SCSI_A4000T, false, NULL, 0); } - addbcromtype(p, ROMTYPE_CDTVDMAC, p->cs_cdtvcd && !p->cs_cdtvcr, NULL); - addbcromtype(p, ROMTYPE_CDTVSCSI, p->cs_cdtvscsi, NULL); + addbcromtype(p, ROMTYPE_CDTVDMAC, p->cs_cdtvcd && !p->cs_cdtvcr, NULL, 0); + addbcromtype(p, ROMTYPE_CDTVSCSI, p->cs_cdtvscsi, NULL, 0); - addbcromtype(p, ROMTYPE_CDTVCR, p->cs_cdtvcr, NULL); + addbcromtype(p, ROMTYPE_CDTVCR, p->cs_cdtvcr, NULL, 0); - addbcromtype(p, ROMTYPE_CD32CART, p->cs_cd32fmv, p->cartfile); + addbcromtype(p, ROMTYPE_CD32CART, p->cs_cd32fmv, p->cartfile,0); - addbcromtype(p, ROMTYPE_A2065, p->a2065name[0] != 0, NULL); - addbcromtype(p, ROMTYPE_NE2KPCMCIA, p->ne2000pcmcianame[0] != 0, NULL); - addbcromtype(p, ROMTYPE_NE2KPCI, p->ne2000pciname[0] != 0, NULL); + addbcromtype(p, ROMTYPE_A2065, p->a2065name[0] != 0, NULL, 0); + addbcromtype(p, ROMTYPE_NE2KPCMCIA, p->ne2000pcmcianame[0] != 0, NULL, 0); + addbcromtype(p, ROMTYPE_NE2KPCI, p->ne2000pciname[0] != 0, NULL, 0); static int restricted_net[] = { ROMTYPE_A2065, ROMTYPE_NE2KPCMCIA, ROMTYPE_NE2KPCI, ROMTYPE_NE2KISA, 0 }; static int restricted_x86[] = { ROMTYPE_A1060, ROMTYPE_A2088, ROMTYPE_A2088T, ROMTYPE_A2286, ROMTYPE_A2386, 0 }; @@ -6850,7 +6877,7 @@ void default_prefs (struct uae_prefs *p, bool reset, int type) p->input_tablet = TABLET_OFF; p->tablet_library = false; - p->input_magic_mouse = 0; + p->input_mouse_untrap = MOUSEUNTRAP_NONE; p->input_magic_mouse_cursor = 0; inputdevice_default_prefs (p); diff --git a/custom.cpp b/custom.cpp index 98fdd1da..7e9b6c42 100644 --- a/custom.cpp +++ b/custom.cpp @@ -6806,7 +6806,7 @@ static void cursorsprite (void) sprite_0_colors[3] = xcolors[current_colors.color_regs_ecs[19]]; } sprite_0_width = sprite_width; - if (currprefs.input_tablet && currprefs.input_magic_mouse) { + if (currprefs.input_tablet && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC)) { if (currprefs.input_magic_mouse_cursor == MAGICMOUSE_HOST_ONLY && mousehack_alive ()) magic_sprite_mask &= ~1; else diff --git a/devices.cpp b/devices.cpp index 0b082845..5a948096 100644 --- a/devices.cpp +++ b/devices.cpp @@ -146,7 +146,7 @@ void devices_vsync_post(void) { #ifdef GFXBOARD if (!picasso_on) - gfxboard_vsync_handler (); + gfxboard_vsync_handler(false); #endif #ifdef WITH_TOCCATA sndboard_vsync(); diff --git a/disk.cpp b/disk.cpp index 24813378..df1e01af 100644 --- a/disk.cpp +++ b/disk.cpp @@ -1077,9 +1077,9 @@ static void update_disk_statusline(int num) if (!fname) fname = _T("?"); if (disk_info_data.diskname[0]) - statusline_add_message(_T("DF%d: [%s] %s"), num, disk_info_data.diskname, my_getfilepart(fname)); + statusline_add_message(STATUSTYPE_FLOPPY, _T("DF%d: [%s] %s"), num, disk_info_data.diskname, my_getfilepart(fname)); else - statusline_add_message(_T("DF%d: %s"), num, my_getfilepart(fname)); + statusline_add_message(STATUSTYPE_FLOPPY, _T("DF%d: %s"), num, my_getfilepart(fname)); } static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname, bool fake, bool forcedwriteprotect) @@ -1614,7 +1614,7 @@ static void mfmcode (uae_u16 * mfm, int words) } } -static uae_u8 mfmencodetable[16] = { +static const uae_u8 mfmencodetable[16] = { 0x2a, 0x29, 0x24, 0x25, 0x12, 0x11, 0x14, 0x15, 0x4a, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55 }; @@ -2475,7 +2475,7 @@ static void drive_eject (drive * drv) driveclick_insert (drv - floppy, 1); #endif if (drv->diskfile || drv->filetype >= 0) - statusline_add_message(_T("DF%d: -"), drv - floppy); + statusline_add_message(STATUSTYPE_FLOPPY, _T("DF%d: -"), drv - floppy); gui_disk_image_change(drv - floppy, NULL, drv->wrprot); drive_image_free (drv); drv->dskeject = false; @@ -2729,7 +2729,6 @@ int disk_setwriteprotect (struct uae_prefs *p, int num, const TCHAR *name, bool if (!needwritefile) diskfile_readonly (name, writeprotected); diskfile_readonly (name2, writeprotected); - DISK_reinsert (num); return 1; } diff --git a/drawing.cpp b/drawing.cpp index 2ec5777c..cd7447df 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -3867,6 +3867,7 @@ void check_prefs_picasso(void) notice_screen_contents_lost (); notice_new_xcolors (); count_frame (); + compute_framesync(); #endif } diff --git a/expansion.cpp b/expansion.cpp index 727186ae..b4a1d508 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -3231,10 +3231,11 @@ static void expansion_add_autoconfig(struct uae_prefs *p) struct rtgboardconfig *rbc = &p->rtgboards[i]; if (rbc->rtgmem_size && rbc->rtgmem_type >= GFXBOARD_HARDWARE && gfxboard_get_configtype(rbc) <= 2) { cards_set[cardno].flags = 4 | (i << 16); - if (rbc->rtgmem_type == GFXBOARD_A2410) { + if (gfxboard_get_func(rbc)) { cards_set[cardno].name = _T("Z2RTG"); cards_set[cardno].zorro = 2; - cards_set[cardno++].initnum = tms_init; + cards_set[cardno].flags = (i << 16); + cards_set[cardno++].initnum = gfxboard_init_board; } else { cards_set[cardno].name = _T("Z2RTG"); cards_set[cardno].zorro = 2; @@ -3943,7 +3944,7 @@ static const struct expansionboardsettings ne2k_isa_settings[] = { static const struct expansionboardsettings toccata_soundcard_settings[] = { { _T("Paula/CD audio mixer"), - _T("mixer"), + _T("mixer") }, { NULL @@ -3961,6 +3962,28 @@ static const struct expansionboardsettings x86_athdxt_settings[] = { } }; + +static const struct expansionboardsettings harlequin_settings[] = { + { + _T("Model\0") _T("Harlequin (PAL)\0") _T("Harlequin (NTSC)\0") _T("Harlequin Plus (PAL)\0") _T("Harlequin Plus (NTSC)\0"), + _T("model\0") _T("pal\0") _T("ntsc\0") _T("pluspal\0") _T("plusntsc\0"), + true + }, + { + _T("VRAM\0") _T("1.5M\0") _T("2M\0") _T("3M\0") _T("4M\0"), + _T("vram\0") _T("1.5m\0") _T("2m\0") _T("3m\0") _T("4m\0"), + true + }, + { + _T("Genlock"), + _T("genlock") + }, + { + NULL + } +}; + + static void fastlane_memory_callback(struct romconfig *rc, uae_u8 *ac, int size) { struct zfile *z = read_device_from_romconfig(rc, NULL); @@ -4192,10 +4215,16 @@ const struct expansionromtype expansionroms[] = { }, { _T("dataflyerscsiplus"), _T("DataFlyer SCSI+"), _T("Expansion Systems"), - dataflyer_init, NULL, dataflyer_add_scsi_unit, ROMTYPE_DATAFLYER | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, + dataflyer_init, NULL, dataflyer_add_scsi_unit, ROMTYPE_DATAFLYERP | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, NULL, 0, false, EXPANSIONTYPE_SCSI }, + { + _T("dataflyerplus"), _T("DataFlyer Plus"), _T("Expansion Systems"), + dataflyerplus_init, NULL, dataflyerplus_add_idescsi_unit, ROMTYPE_DATAFLYER, 0, 0, BOARD_AUTOCONFIG_Z2, false, + NULL, 0, + true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_IDE + }, { _T("gvp1"), _T("GVP Series I"), _T("Great Valley Products"), gvp_init_s1, NULL, gvp_s1_add_scsi_unit, ROMTYPE_GVPS1 | ROMTYPE_NONE, ROMTYPE_GVPS12, 0, BOARD_AUTOCONFIG_Z2, false, @@ -4282,7 +4311,7 @@ const struct expansionromtype expansionroms[] = { true, EXPANSIONTYPE_SCSI, 4096, 4, 0, false, NULL, false, 0, NULL, - { 0xd1, 3, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00 } + { 0xd1, 3, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00 } }, { _T("scram5394"), _T("SCRAM (NCR53C94)"), _T("MegaMicro"), @@ -4291,7 +4320,7 @@ const struct expansionromtype expansionroms[] = { true, EXPANSIONTYPE_SCSI, 4096, 4, 0, false, NULL, false, 0, NULL, - { 0xd1, 7, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00 } + { 0xd1, 7, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00 } }, { _T("paradox"), _T("Paradox SCSI"), _T("Mainhattan Data"), @@ -4515,7 +4544,7 @@ const struct expansionromtype expansionroms[] = { false, 0, x86at386_bridge_settings }, - // only here for rom selection + // only here for rom selection and settings { _T("picassoiv"), _T("Picasso IV"), _T("Village Tronic"), NULL, NULL, NULL, ROMTYPE_PICASSOIV | ROMTYPE_NONE, 0, 0, BOARD_IGNORE, true, @@ -4528,6 +4557,14 @@ const struct expansionromtype expansionroms[] = { NULL, 0, false, EXPANSIONTYPE_RTG }, + { + _T("harlequin"), _T("Harlequin"), _T("ACS"), + NULL, NULL, NULL, ROMTYPE_HARLEQUIN | ROMTYPE_NOT, 0, 0, BOARD_IGNORE, false, + NULL, 0, + false, EXPANSIONTYPE_RTG, + 0, 0, 0, false, NULL, + false, 0, harlequin_settings + }, /* Sound Cards */ diff --git a/gfxboard.cpp b/gfxboard.cpp index 98221082..353545ea 100644 --- a/gfxboard.cpp +++ b/gfxboard.cpp @@ -99,6 +99,8 @@ struct gfxboard int irq; bool swap; uae_u32 romtype; + uae_u8 er_type; + struct gfxboard_func *func; }; #define ISP4() (gb->rbc->rtgmem_type == GFXBOARD_PICASSO4_Z2 || gb->rbc->rtgmem_type == GFXBOARD_PICASSO4_Z3) @@ -164,7 +166,8 @@ static const struct gfxboard boards[] = { _T("A2410"), _T("Commodore"), _T("A2410"), 1030, 0, 0, - 0x00000000, 0x00200000, 0x00200000, 0x00000000, 0, 0, 2, false + 0x00000000, 0x00200000, 0x00200000, 0x10000, 0, 0, 2, false, + 0, 0xc1, &a2410_func }, { _T("x86 bridgeboard VGA"), _T("x86"), _T("VGA"), @@ -172,6 +175,12 @@ static const struct gfxboard boards[] = 0x00000000, 0x00100000, 0x00100000, 0x00000000, CIRRUS_ID_CLGD5426, 0, 0, false, ROMTYPE_x86_VGA }, + { + _T("Harlequin"), _T("ACS"), _T("Harlequin_PAL"), + 2118, 100, 0, + 0x00000000, 0x00200000, 0x00200000, 0x10000, 0, 0, 2, false, + ROMTYPE_HARLEQUIN, 0xc2, &harlequin_func + }, { NULL } @@ -240,6 +249,11 @@ struct rtggfxboard addrbank *gfxmem_bank; uae_u8 *vram_back; + + struct autoconfig_info *aci; + + struct gfxboard_func *func; + void *userdata; }; static struct rtggfxboard rtggfxboards[MAX_RTG_BOARDS]; @@ -315,6 +329,31 @@ static const addrbank tmpl_gfxboard_bank_special = { ABFLAG_IO | ABFLAG_SAFE, S_READ, S_WRITE }; +static void ew(struct rtggfxboard *gb, int addr, uae_u32 value) +{ + addr &= 0xffff; + if (addr == 00 || addr == 02 || addr == 0x40 || addr == 0x42) { + gb->automemory[addr] = (value & 0xf0); + gb->automemory[addr + 2] = (value & 0x0f) << 4; + } else { + gb->automemory[addr] = ~(value & 0xf0); + gb->automemory[addr + 2] = ~((value & 0x0f) << 4); + } +} + +int gfxboard_get_devnum(struct uae_prefs *p, int index) +{ + int devnum = 0; + uae_u32 romtype = gfxboard_get_romtype(&p->rtgboards[index]); + if (!romtype) + return devnum; + for (int i = 0; i < index; i++) { + if (gfxboard_get_romtype(&p->rtgboards[i]) == romtype) + devnum++; + } + return devnum; +} + void gfxboard_get_a8_vram(int index) { addrbank *ab = gfxmem_banks[index]; @@ -397,6 +436,61 @@ static void init_board (struct rtggfxboard *gb) picasso_allocatewritewatch(gb->rbc->rtg_index, gb->rbc->rtgmem_size); } +static int GetBytesPerPixel(RGBFTYPE RGBfmt) +{ + switch (RGBfmt) + { + case RGBFB_CLUT: + return 1; + + case RGBFB_A8R8G8B8: + case RGBFB_A8B8G8R8: + case RGBFB_R8G8B8A8: + case RGBFB_B8G8R8A8: + return 4; + + case RGBFB_B8G8R8: + case RGBFB_R8G8B8: + return 3; + + case RGBFB_R5G5B5: + case RGBFB_R5G6B5: + case RGBFB_R5G6B5PC: + case RGBFB_R5G5B5PC: + case RGBFB_B5G6R5PC: + case RGBFB_B5G5R5PC: + return 2; + } + return 0; +} + +static bool gfxboard_setmode(struct rtggfxboard *gb, struct gfxboard_mode *mode) +{ + picasso96_state.Width = mode->width; + picasso96_state.Height = mode->height; + int bpp = GetBytesPerPixel(mode->mode); + picasso96_state.BytesPerPixel = bpp; + picasso96_state.RGBFormat = mode->mode; + write_log(_T("GFXBOARD %dx%dx%d\n"), mode->width, mode->height, bpp); + if (!picasso_requested_on && !picasso_on) + picasso_requested_on = true; + //gfx_set_picasso_modeinfo(width, height, bpp, RGBFB_NONE); + return true; +} + +static void gfxboard_free_slot2(struct rtggfxboard *gb) +{ + gb->active = false; + if (rtg_visible == gb->rtg_index) { + rtg_visible = -1; + picasso_requested_on = false; + } + gb->userdata = NULL; + gb->func = NULL; + xfree(gb->automemory); + gb->automemory = NULL; +} + bool gfxboard_allocate_slot(int board, int idx) { struct rtggfxboard *gb = &rtggfxboards[idx]; @@ -409,12 +503,102 @@ bool gfxboard_allocate_slot(int board, int idx) void gfxboard_free_slot(int idx) { struct rtggfxboard *gb = &rtggfxboards[idx]; - gb->active = false; - if (rtg_visible == idx) { - rtg_visible = -1; - picasso_requested_on = false; + gfxboard_free_slot2(gb); +} + +static int gfx_temp_bank_idx; + +static uae_u32 REGPARAM2 gtb_wget(uaecptr addr) +{ + struct rtggfxboard *gb = &rtggfxboards[gfx_temp_bank_idx]; + addr &= gb->banksize_mask; + return 0; +} +static uae_u32 REGPARAM2 gtb_bget(uaecptr addr) +{ + struct rtggfxboard *gb = &rtggfxboards[gfx_temp_bank_idx]; + addr &= gb->banksize_mask; + if (addr < GFXBOARD_AUTOCONFIG_SIZE) + return gb->automemory[addr]; + return 0xff; +} +static void REGPARAM2 gtb_bput(uaecptr addr, uae_u32 b) +{ + struct rtggfxboard *gb = &rtggfxboards[gfx_temp_bank_idx]; + b &= 0xff; + addr &= gb->banksize_mask; + if (addr == 0x48) { + gfx_temp_bank_idx++; + map_banks_z2(gb->gfxmem_bank, expamem_board_pointer >> 16, expamem_board_size >> 16); + gb->func->configured(gb->userdata, expamem_board_pointer); + expamem_next(gb->gfxmem_bank, NULL); + return; + } + if (addr == 0x4c) { + expamem_shutup(gb->gfxmem_bank); + return; } } +static void REGPARAM2 gtb_wput(uaecptr addr, uae_u32 b) +{ + struct rtggfxboard *gb = &rtggfxboards[gfx_temp_bank_idx]; + b &= 0xffff; + addr &= gb->banksize_mask; + if (addr == 0x44) { + gfx_temp_bank_idx++; + map_banks_z3(gb->gfxmem_bank, expamem_board_pointer >> 16, expamem_board_size >> 16); + gb->func->configured(gb->userdata, expamem_board_pointer); + expamem_next(gb->gfxmem_bank, NULL); + return; + } +} + +static addrbank gfx_temp_bank = +{ + gtb_wget, gtb_wget, gtb_bget, + gtb_wput, gtb_wput, gtb_bput, + default_xlate, default_check, NULL, NULL, _T("GFXBOARD_AUTOCONFIG"), + gtb_wget, gtb_wget, + ABFLAG_IO, S_READ, S_WRITE +}; + +bool gfxboard_init_board(struct autoconfig_info *aci) +{ + const struct gfxboard *gfxb = &boards[aci->prefs->rtgboards[aci->devnum].rtgmem_type - GFXBOARD_HARDWARE]; + struct rtggfxboard *gb = &rtggfxboards[aci->devnum]; + gb->func = gfxb->func; + memset(aci->autoconfig_bytes, 0xff, sizeof aci->autoconfig_bytes); + if (!gb->automemory) + gb->automemory = xmalloc(uae_u8, GFXBOARD_AUTOCONFIG_SIZE); + memset(gb->automemory, 0xff, GFXBOARD_AUTOCONFIG_SIZE); + ew(gb, 0x00, gfxb->er_type); + ew(gb, 0x04, gfxb->model_memory); + ew(gb, 0x10, (gfxb->manufacturer >> 8) & 0xff); + ew(gb, 0x14, (gfxb->manufacturer >> 0) & 0xff); + ew(gb, 0x18, (gfxb->serial >> 24) & 0xff); + ew(gb, 0x1c, (gfxb->serial >> 16) & 0xff); + ew(gb, 0x20, (gfxb->serial >> 8) & 0xff); + ew(gb, 0x24, (gfxb->serial >> 0) & 0xff); + memcpy(aci->autoconfig_raw, gb->automemory, sizeof aci->autoconfig_raw); + if (!gb->func->init(aci)) + return false; + for(int i = 0; i < sizeof aci->autoconfig_bytes; i++) { + if (aci->autoconfig_bytes[i] != 0xff) + ew(gb, i * 4, aci->autoconfig_bytes[i]); + } + memcpy(aci->autoconfig_raw, gb->automemory, sizeof aci->autoconfig_raw); + if (!aci->doinit) + return true; + gb->banksize_mask = gfxb->banksize - 1; + gb->userdata = aci->userdata; + gb->active = true; + gb->rtg_index = aci->devnum; + gb->board = gfxb; + gfx_temp_bank_idx = aci->devnum; + gb->gfxmem_bank = aci->addrbank; + aci->addrbank = &gfx_temp_bank; + return true; +} static void vga_update_size(struct rtggfxboard *gb) { @@ -423,7 +607,7 @@ static void vga_update_size(struct rtggfxboard *gb) gb->vga.vga.hw_ops->gfx_update(&gb->vga); } -static bool gfxboard_setmode(struct rtggfxboard *gb) +static bool gfxboard_setmode_qemu(struct rtggfxboard *gb) { int bpp = gb->vga.vga.get_bpp(&gb->vga.vga); if (bpp == 0) @@ -431,12 +615,18 @@ static bool gfxboard_setmode(struct rtggfxboard *gb) vga_update_size(gb); if (gb->vga_width <= 16 || gb->vga_height <= 16) return false; - picasso96_state.Width = gb->vga_width; - picasso96_state.Height = gb->vga_height; - picasso96_state.BytesPerPixel = bpp / 8; - picasso96_state.RGBFormat = RGBFB_CLUT; - write_log(_T("GFXBOARD %dx%dx%d\n"), gb->vga_width, gb->vga_height, bpp); - gfx_set_picasso_modeinfo(gb->vga_width, gb->vga_height, bpp, RGBFB_NONE); + struct gfxboard_mode mode; + mode.width = gb->vga_width; + mode.height = gb->vga_height; + mode.mode = RGBFB_NONE; + for (int i = 0; i < RGBFB_MaxFormats; i++) { + RGBFTYPE t = (RGBFTYPE)i; + if (GetBytesPerPixel(t) == bpp / 8) { + mode.mode = t; + } + } + gfxboard_setmode(gb, &mode); + gfx_set_picasso_modeinfo(mode.mode); gb->fullrefresh = 2; gb->vga_changed = false; return true; @@ -448,10 +638,8 @@ void gfxboard_rtg_disable(int index) { if (index == rtg_visible && rtg_visible >= 0) { struct rtggfxboard *gb = &rtggfxboards[index]; - if (rtg_visible >= 0) { - if (currprefs.rtgboards[rtg_visible].rtgmem_type == GFXBOARD_A2410) { - tms_toggle(0); - } + if (rtg_visible >= 0 && gb->func) { + gb->func->toggle(gb->userdata, 0); } rtg_visible = -1; } @@ -465,7 +653,7 @@ bool gfxboard_rtg_enable_initial(int index) if (picasso_on) return false; rtg_initial = index; - picasso_requested_on = true; + gfxboard_toggle(index, false); // check_prefs_picasso() calls gfxboard_toggle when ready return true; } @@ -491,11 +679,13 @@ int gfxboard_toggle (int index, int log) if (index < 0) goto end; - if (currprefs.rtgboards[index].rtgmem_type == GFXBOARD_A2410) { - bool r = tms_toggle(1); + if (gb->func) { + bool r = gb->func->toggle(gb->userdata, 1); if (r) { rtg_initial = MAX_RTG_BOARDS; rtg_visible = gb->rtg_index; + if (log) + statusline_add_message(STATUSTYPE_DISPLAY, _T("RTG %d: %s"), index + 1, gb->board->name); return index; } goto end; @@ -505,15 +695,14 @@ int gfxboard_toggle (int index, int log) return -1; vga_update_size(gb); if (gb->vga_width > 16 && gb->vga_height > 16) { - if (!gfxboard_setmode(gb)) + if (!gfxboard_setmode_qemu(gb)) goto end; rtg_initial = MAX_RTG_BOARDS; rtg_visible = gb->rtg_index; gb->monswitch_new = true; gb->monswitch_delay = 1; - picasso_requested_on = 1; - if (log && currprefs.rtgboards[1].rtgmem_size) - statusline_add_message(_T("RTG %d: %s"), index + 1, gb->board->name); + if (log) + statusline_add_message(STATUSTYPE_DISPLAY, _T("RTG %d: %s"), index + 1, gb->board->name); return index; } end: @@ -645,23 +834,38 @@ void gfxboard_refresh (void) void gfxboard_hsync_handler(void) { for (int i = 0; i < MAX_RTG_BOARDS; i++) { - if (currprefs.rtgboards[i].rtgmem_type == GFXBOARD_A2410) { - tms_hsync_handler(); - break; + struct rtggfxboard *gb = &rtggfxboards[i]; + if (gb->func && gb->userdata) { + gb->func->hsync(gb->userdata); } } } -bool gfxboard_vsync_handler (void) +bool gfxboard_vsync_handler (bool redraw_required) { bool flushed = false; for (int i = 0; i < MAX_RTG_BOARDS; i++) { struct rtggfxboard *gb = &rtggfxboards[i]; - if (currprefs.rtgboards[i].rtgmem_type == GFXBOARD_A2410) { - - flushed = tms_vsync_handler(); + if (gb->func) { + + if (gb->userdata) { + struct gfxboard_mode mode = { 0 }; + mode.redraw_required = redraw_required; + flushed = gb->func->vsync(gb->userdata, &mode); + if (mode.mode && mode.width && mode.height) { + if (picasso96_state.Width != mode.width || + picasso96_state.Height != mode.height || + picasso96_state.RGBFormat != mode.mode || + !picasso_on) { + if (mode.width && mode.height && mode.mode) { + gfxboard_setmode(gb, &mode); + gfx_set_picasso_modeinfo(mode.mode); + } + } + } + } } else if (gb->configured_mem > 0 && gb->configured_regs > 0) { @@ -714,7 +918,7 @@ bool gfxboard_vsync_handler (void) if (gb->monswitch_current && (gb->modechanged || gfxboard_checkchanged(gb))) { gb->modechanged = false; - if (!gfxboard_setmode (gb)) { + if (!gfxboard_setmode_qemu(gb)) { gfxboard_rtg_disable(rtg_visible); return false; } @@ -1983,8 +2187,10 @@ static void REGPARAM2 gfxboard_bput_regs_autoconfig (uaecptr addr, uae_u32 b) static void gfxboard_free_board(struct rtggfxboard *gb) { if (gb->rbc) { - if (gb->rbc->rtgmem_type == GFXBOARD_A2410) { - tms_free(); + if (gb->func) { + if (gb->userdata) + gb->func->free(gb->userdata); + gfxboard_free_slot2(gb); gb->rbc = NULL; return; } @@ -2025,8 +2231,11 @@ void gfxboard_reset (void) for (int i = 0; i < MAX_RTG_BOARDS; i++) { struct rtggfxboard *gb = &rtggfxboards[i]; gb->rbc = &currprefs.rtgboards[gb->rtg_index]; - if (gb->rbc->rtgmem_type == GFXBOARD_A2410) { - tms_reset(); + if (gb->func) { + if (gb->userdata) { + gb->func->reset(gb->userdata); + } + gfxboard_free_board(gb); } else { if (gb->rbc->rtgmem_type >= GFXBOARD_HARDWARE) { gb->board = &boards[gb->rbc->rtgmem_type - GFXBOARD_HARDWARE]; @@ -2403,6 +2612,16 @@ const TCHAR *gfxboard_get_configname(int type) return boards[type - GFXBOARD_HARDWARE].configname; } +struct gfxboard_func *gfxboard_get_func(struct rtgboardconfig *rbc) +{ + int type = rbc->rtgmem_type; + if (type == GFXBOARD_UAE_Z2) + return NULL; + if (type == GFXBOARD_UAE_Z3) + return NULL; + return boards[type - GFXBOARD_HARDWARE].func; +} + int gfxboard_get_configtype(struct rtgboardconfig *rbc) { int type = rbc->rtgmem_type; @@ -2540,18 +2759,6 @@ static void loadp4rom (struct rtggfxboard *gb) write_log (_T("PICASSOIV: flash rom loaded\n")); } -static void ew (struct rtggfxboard *gb, int addr, uae_u32 value) -{ - addr &= 0xffff; - if (addr == 00 || addr == 02 || addr == 0x40 || addr == 0x42) { - gb->automemory[addr] = (value & 0xf0); - gb->automemory[addr + 2] = (value & 0x0f) << 4; - } else { - gb->automemory[addr] = ~(value & 0xf0); - gb->automemory[addr + 2] = ~((value & 0x0f) << 4); - } -} - bool gfxboard_init_memory (struct autoconfig_info *aci) { struct rtggfxboard *gb = &rtggfxboards[aci->devnum]; diff --git a/include/gfxboard.h b/include/gfxboard.h index 20ef6f75..3f60654c 100644 --- a/include/gfxboard.h +++ b/include/gfxboard.h @@ -1,12 +1,14 @@ #ifndef UAE_GFXBOARD_H #define UAE_GFXBOARD_H +#include "picasso96.h" + extern bool gfxboard_init_memory (struct autoconfig_info*); extern bool gfxboard_init_memory_p4_z2(struct autoconfig_info*); extern bool gfxboard_init_registers(struct autoconfig_info*); extern void gfxboard_free (void); extern void gfxboard_reset (void); -extern bool gfxboard_vsync_handler (void); +extern bool gfxboard_vsync_handler (bool); extern void gfxboard_hsync_handler(void); extern int gfxboard_get_configtype (struct rtgboardconfig*); extern bool gfxboard_is_registers (struct rtgboardconfig*); @@ -22,17 +24,16 @@ extern uae_u32 gfxboard_get_romtype(struct rtgboardconfig*); extern const TCHAR *gfxboard_get_name(int); extern const TCHAR *gfxboard_get_manufacturername(int); extern const TCHAR *gfxboard_get_configname(int); +extern struct gfxboard_func *gfxboard_get_func(struct rtgboardconfig *rbc); + extern bool gfxboard_allocate_slot(int, int); extern void gfxboard_free_slot(int); extern bool gfxboard_rtg_enable_initial(int); extern void gfxboard_rtg_disable(int); +extern bool gfxboard_init_board(struct autoconfig_info*); -extern bool tms_init(struct autoconfig_info *aci); -extern void tms_free(void); -extern void tms_reset(void); -extern void tms_hsync_handler(void); -extern bool tms_vsync_handler(void); -extern bool tms_toggle(int); +extern struct gfxboard_func a2410_func; +extern struct gfxboard_func harlequin_func; extern void vga_io_put(int board, int portnum, uae_u8 v); extern uae_u8 vga_io_get(int board, int portnum); @@ -42,6 +43,8 @@ extern uae_u8 vga_ram_get(int board, int offset); void gfxboard_get_a8_vram(int index); void gfxboard_free_vram(int index); +int gfxboard_get_devnum(struct uae_prefs *p, int index); + #define GFXBOARD_UAE_Z2 0 #define GFXBOARD_UAE_Z3 1 #define GFXBOARD_HARDWARE 2 @@ -59,4 +62,32 @@ void gfxboard_free_vram(int index); #define GFXBOARD_A2410 12 #define GFXBOARD_VGA 13 +struct gfxboard_mode +{ + int width; + int height; + RGBFTYPE mode; + bool redraw_required; +}; + +typedef bool(*GFXBOARD_INIT)(struct autoconfig_info*); +typedef void(*GFXBOARD_FREE)(void*); +typedef void(*GFXBOARD_RESET)(void*); +typedef void(*GFXBOARD_HSYNC)(void*); +typedef bool(*GFXBOARD_VSYNC)(void*, struct gfxboard_mode*); +typedef bool(*GFXBOARD_TOGGLE)(void*, int); +typedef void(*GFXBOARD_CONFIGURED)(void*, uae_u32); + +struct gfxboard_func +{ + GFXBOARD_INIT init; + GFXBOARD_FREE free; + GFXBOARD_RESET reset; + GFXBOARD_HSYNC hsync; + GFXBOARD_VSYNC vsync; + GFXBOARD_TOGGLE toggle; + GFXBOARD_CONFIGURED configured; +}; + + #endif /* UAE_GFXBOARD_H */ diff --git a/include/keyboard.h b/include/keyboard.h index 59f39ddf..63eb2e07 100644 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -165,7 +165,7 @@ enum aks { AKS_ENTERGUI = 0x200, AKS_DECREASEREFRESHRATE, AKS_INCREASEREFRESHRATE, AKS_ARCADIADIAGNOSTICS, AKS_ARCADIAPLY1, AKS_ARCADIAPLY2, AKS_ARCADIACOIN1, AKS_ARCADIACOIN2, - AKS_TOGGLEMOUSEGRAB, AKS_SWITCHINTERPOL, AKS_TOGGLERTG, + AKS_TOGGLEMOUSEGRAB, AKS_SWITCHINTERPOL, AKS_INPUT_CONFIG_1,AKS_INPUT_CONFIG_2,AKS_INPUT_CONFIG_3,AKS_INPUT_CONFIG_4, AKS_SWAPJOYPORTS, AKS_PASTE, @@ -173,6 +173,8 @@ enum aks { AKS_ENTERGUI = 0x200, AKS_DISKSWAPPER_INSERT0,AKS_DISKSWAPPER_INSERT1,AKS_DISKSWAPPER_INSERT2,AKS_DISKSWAPPER_INSERT3, AKS_DISK_PREV0, AKS_DISK_PREV1, AKS_DISK_PREV2, AKS_DISK_PREV3, AKS_DISK_NEXT0, AKS_DISK_NEXT1, AKS_DISK_NEXT2, AKS_DISK_NEXT3, + AKS_RTG_PREV, AKS_RTG_NEXT, + AKS_RTG_C, AKS_RTG_0, AKS_RTG_1, AKS_RTG_2, AKS_RTG_3, AKS_CDTV_FRONT_PANEL_STOP, AKS_CDTV_FRONT_PANEL_PLAYPAUSE, AKS_CDTV_FRONT_PANEL_PREV, AKS_CDTV_FRONT_PANEL_NEXT, AKS_CDTV_FRONT_PANEL_REW, AKS_CDTV_FRONT_PANEL_FF, AKS_QUALIFIER1, AKS_QUALIFIER2, AKS_QUALIFIER3, AKS_QUALIFIER4, diff --git a/include/memory.h b/include/memory.h index 759d1940..3a259f66 100644 --- a/include/memory.h +++ b/include/memory.h @@ -155,6 +155,7 @@ struct autoconfig_info bool hardwired; bool (*get_params)(struct uae_prefs*, struct expansion_params*); bool (*set_params)(struct uae_prefs*, struct expansion_params*); + void *userdata; }; #define CE_MEMBANK_FAST32 0 diff --git a/include/options.h b/include/options.h index ce853b8c..ec189b78 100644 --- a/include/options.h +++ b/include/options.h @@ -112,6 +112,11 @@ struct jport { #define CONFIG_TYPE_NORESET 4 #define CONFIG_BLEN 2560 +#define MOUSEUNTRAP_NONE 0 +#define MOUSEUNTRAP_MIDDLEBUTTON 1 +#define MOUSEUNTRAP_MAGIC 2 +#define MOUSEUNTRAP_BOTH 3 + #define TABLET_OFF 0 #define TABLET_MOUSEHACK 1 #define TABLET_REAL 2 @@ -695,7 +700,6 @@ struct uae_prefs { /* Target specific options */ - bool win32_middle_mouse; bool win32_logfile; bool win32_notaskbarbutton; bool win32_nonotificationicon; @@ -774,7 +778,7 @@ struct uae_prefs { int input_mouse_speed; int input_tablet; bool tablet_library; - bool input_magic_mouse; + int input_mouse_untrap; int input_magic_mouse_cursor; int input_keyboard_type; int input_autoswitch; diff --git a/include/statusline.h b/include/statusline.h index 950e5c2a..1a03604d 100644 --- a/include/statusline.h +++ b/include/statusline.h @@ -31,10 +31,15 @@ extern void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth extern void statusline_single_erase(uae_u8 *buf, int bpp, int y, int totalwidth); extern void statusline_getpos(int *x, int *y, int width, int height); +#define STATUSTYPE_FLOPPY 1 +#define STATUSTYPE_DISPLAY 2 +#define STATUSTYPE_INPUT 3 +#define STATUSTYPE_CD 4 + extern bool createstatusline(void); extern void deletestatusline(void); extern void statusline_render(uae_u8 *buf, int bpp, int pitch, int width, int height, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); -extern void statusline_add_message(const TCHAR *format, ...); +extern void statusline_add_message(int statustype, const TCHAR *format, ...); extern void statusline_clear(void); extern void statusline_vsync(void); extern void statusline_updated(void); diff --git a/inputdevice.cpp b/inputdevice.cpp index ab8f6200..dc374abe 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -2585,7 +2585,7 @@ static void mousehack_helper (uae_u32 buttonmask) //write_log (_T("mousehack_helper %08X\n"), buttonmask); - if (currprefs.input_magic_mouse == 0 && currprefs.input_tablet < TABLET_MOUSEHACK) + if (!(currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && currprefs.input_tablet < TABLET_MOUSEHACK) return; #if 0 if (kickstart_version >= 36) { @@ -2640,7 +2640,7 @@ static int mouseedge (void) static int melast_x, melast_y; static int isnonzero; - if (currprefs.input_magic_mouse == 0 || currprefs.input_tablet > 0) + if (!(currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) || currprefs.input_tablet > 0) return 0; if (magicmouse_ibase == 0xffffffff) return 0; @@ -4012,9 +4012,6 @@ static bool inputdevice_handle_inputcode2 (int code, int state) case AKS_TOGGLEMOUSEGRAB: toggle_mousegrab(); break; - case AKS_TOGGLERTG: - toggle_rtg (newstate); - break; case AKS_SWAPJOYPORTS: if (state == 1) inputdevice_swap_compa_ports(&changed_prefs, 0); @@ -4096,6 +4093,19 @@ static bool inputdevice_handle_inputcode2 (int code, int state) case AKS_DISK_NEXT3: disk_prevnext (code - AKS_DISK_NEXT0, 1); break; + case AKS_RTG_PREV: + toggle_rtg(-1); + break; + case AKS_RTG_NEXT: + toggle_rtg(MAX_RTG_BOARDS + 1); + break; + case AKS_RTG_C: + case AKS_RTG_0: + case AKS_RTG_1: + case AKS_RTG_2: + case AKS_RTG_3: + toggle_rtg(code - AKS_RTG_C); + break; #ifdef CDTV case AKS_CDTV_FRONT_PANEL_STOP: case AKS_CDTV_FRONT_PANEL_PLAYPAUSE: @@ -4773,9 +4783,9 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode) inputdevice_unacquire (); if (fname) { if (newslot >= 0) { - statusline_add_message(_T("Port %d: Custom %d"), newport, newslot + 1); + statusline_add_message(STATUSTYPE_INPUT, _T("Port %d: Custom %d"), newport, newslot + 1); } else { - statusline_add_message(_T("Port %d: %s"), newport, fname); + statusline_add_message(STATUSTYPE_INPUT, _T("Port %d: %s"), newport, fname); } } @@ -4919,7 +4929,7 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode) write_log (_T("inputdevice input change '%s':%d->%d\n"), name, num, newport); inputdevice_unacquire (); if (fname) - statusline_add_message(_T("Port %d: %s"), newport, fname); + statusline_add_message(STATUSTYPE_INPUT, _T("Port %d: %s"), newport, fname); inputdevice_copyconfig (&currprefs, &changed_prefs); inputdevice_validate_jports (&changed_prefs, -1, NULL); inputdevice_copyconfig (&changed_prefs, &currprefs); diff --git a/inputevents.def b/inputevents.def index 4ac4b046..5349ffad 100644 --- a/inputevents.def +++ b/inputevents.def @@ -368,7 +368,6 @@ DEFEVENT(SPC_TOGGLEMOUSEGRAB,_T("Toggle between mouse grabbed and un-grabbed"),A DEFEVENT(SPC_DECREASE_REFRESHRATE,_T("Decrease emulation speed"),AM_K,0,0,AKS_DECREASEREFRESHRATE) DEFEVENT(SPC_INCREASE_REFRESHRATE,_T("Increase emulation speed"),AM_K,0,0,AKS_INCREASEREFRESHRATE) DEFEVENT(SPC_SWITCHINTERPOL,_T("Switch between audio interpolation methods"),AM_KT,0,0,AKS_SWITCHINTERPOL) -DEFEVENT(SPC_TOGGLERTG,_T("Toggle chipset/RTG screen"),AM_KT,0,0,AKS_TOGGLERTG) DEFEVENT(SPC_SWAPJOYPORTS,_T("Swap joystick ports"),AM_KT,0,0,AKS_SWAPJOYPORTS) DEFEVENT(SPC_PASTE,_T("Paste from host clipboard"),AM_KT,0,0,AKS_PASTE) @@ -388,6 +387,15 @@ DEFEVENT(SPC_DISK_NEXT1,_T("Next disk image in DF1:"),AM_K,0,0,AKS_DISK_NEXT1) DEFEVENT(SPC_DISK_NEXT2,_T("Next disk image in DF2:"),AM_K,0,0,AKS_DISK_NEXT2) DEFEVENT(SPC_DISK_NEXT3,_T("Next disk image in DF3:"),AM_K,0,0,AKS_DISK_NEXT3) +DEFEVENT(SPC_RTG_PREV,_T("Previous display"),AM_K,0,0,AKS_RTG_PREV) +DEFEVENT(SPC_TOGGLERTG,_T("Next display"),AM_KT,0,0,AKS_RTG_NEXT) +DEFEVENT(SPC_RTG_C,_T("Chipset Display"),AM_K,0,0,AKS_RTG_C) +DEFEVENT(SPC_RTG_0,_T("RTG Display #1"),AM_K,0,0,AKS_RTG_0) +DEFEVENT(SPC_RTG_1,_T("RTG Display #2"),AM_K,0,0,AKS_RTG_1) +DEFEVENT(SPC_RTG_2,_T("RTG Display #3"),AM_K,0,0,AKS_RTG_2) +DEFEVENT(SPC_RTG_3,_T("RTG Display #4"),AM_K,0,0,AKS_RTG_3) + + DEFEVENT(SPC_INPUT_CONFIG1,_T("Select Input Configuration #1"),AM_K,0,0,AKS_INPUT_CONFIG_1) DEFEVENT(SPC_INPUT_CONFIG2,_T("Select Input Configuration #2"),AM_K,0,0,AKS_INPUT_CONFIG_2) DEFEVENT(SPC_INPUT_CONFIG3,_T("Select Input Configuration #3"),AM_K,0,0,AKS_INPUT_CONFIG_3) diff --git a/mame/a2410.cpp b/mame/a2410.cpp index d69c4cc5..fb474193 100644 --- a/mame/a2410.cpp +++ b/mame/a2410.cpp @@ -14,12 +14,10 @@ #include "options.h" #include "memory.h" #include "custom.h" -#include "picasso96.h" #include "statusline.h" #include "newcpu.h" #include "gfxboard.h" -static int tms_vp, tms_hp; rectangle tms_rectangle; static mscreen tms_screen; static tms340x0_device tms_device; @@ -28,42 +26,60 @@ mscreen *m_screen; #define OVERLAY_WIDTH 1024 -static int fullrefresh; -static int request_fullrefresh; -static uae_u8 *program_ram; -static int a2410_palette_index; -static uae_u8 a2410_palette[4 * (256 + 4)]; -static uae_u32 a2410_palette_32[256 + 4]; -static uae_u8 a2410_palette_temp[4]; -static uae_u8 a2410_palette_control[4]; -static uae_u16 a2410_control; -static bool a2410_modified[1024]; -static int a2410_displaywidth; -static int a2410_displayend; -static int a2410_vertical_start; -static bool a2410_enabled; -static uae_u8 a2410_overlay_mask[2]; -static int a2410_overlay_blink_rate_on; -static int a2410_overlay_blink_rate_off; -static int a2410_overlay_blink_cnt; -static int tms_configured; -static uae_u8 tms_config[128]; -static int a2410_gfxboard = -1; +struct a2410_struct +{ + int tms_vp, tms_hp; + int fullrefresh; + int request_fullrefresh; + uae_u8 *program_ram; + int a2410_palette_index; + uae_u8 a2410_palette[4 * (256 + 4)]; + uae_u32 a2410_palette_32[256 + 4]; + uae_u8 a2410_palette_temp[4]; + uae_u8 a2410_palette_control[4]; + uae_u16 a2410_control; + bool a2410_modified[1024]; + int a2410_displaywidth; + int a2410_displayend; + int a2410_vertical_start; + bool a2410_enabled; + uae_u8 a2410_overlay_mask[2]; + int a2410_overlay_blink_rate_on; + int a2410_overlay_blink_rate_off; + int a2410_overlay_blink_cnt; + uae_u32 tms_configured; + int a2410_gfxboard; + + bool a2410_modechanged; + int a2410_gotmode; + int a2410_width, a2410_height; + int a2410_vram_start_offset; + uae_u8 *a2410_surface; + int a2410_interlace; + int a2410_interrupt; + int a2410_hsync_max; + bool a2410_visible; + + addrbank *gfxbank; +}; + +static struct a2410_struct a2410_data; + extern addrbank tms_bank; int mscreen::hpos() { - if (a2410_displayend) { - tms_hp++; - tms_hp %= a2410_displayend; + if (a2410_data.a2410_displayend) { + a2410_data.tms_hp++; + a2410_data.tms_hp %= a2410_data.a2410_displayend; } else { - tms_hp = 0; + a2410_data.tms_hp = 0; } - return tms_hp; + return a2410_data.tms_hp; } int mscreen::vpos() { - return tms_vp; + return a2410_data.tms_vp; } static void tms_execute_single(void) @@ -119,9 +135,9 @@ static uaecptr makeaddr(UINT32 a, int *bank) * bit 7 - LGBACK when read, VS_INV when write (Vertical Sync Invert) - LGBACK: A2410 owns the Zorro bus now. */ -static uae_u8 get_a2410_control(void) +static uae_u8 get_a2410_control(struct a2410_struct *data) { - uae_u8 v = a2410_control; + uae_u8 v = data->a2410_control; v &= ~(0x10 | 0x40 | 0x80); v |= 0x20; if (v & 0x08) // SBR @@ -140,11 +156,11 @@ UINT32 total_cycles(void) void m_to_shiftreg_cb(address_space space, offs_t offset, UINT16 *shiftreg) { - memcpy(shiftreg, &gfxmem_banks[a2410_gfxboard]->baseaddr[TOWORD(offset)], 256 * sizeof(UINT16)); + memcpy(shiftreg, &gfxmem_banks[a2410_data.a2410_gfxboard]->baseaddr[TOWORD(offset)], 256 * sizeof(UINT16)); } void m_from_shiftreg_cb(address_space space, offs_t offset, UINT16* shiftreg) { - memcpy(&gfxmem_banks[a2410_gfxboard]->baseaddr[TOWORD(offset)], shiftreg, 256 * sizeof(UINT16)); + memcpy(&gfxmem_banks[a2410_data.a2410_gfxboard]->baseaddr[TOWORD(offset)], shiftreg, 256 * sizeof(UINT16)); } UINT16 direct_read_data::read_decrypted_word(UINT32 pc) @@ -152,8 +168,8 @@ UINT16 direct_read_data::read_decrypted_word(UINT32 pc) uae_u16 v = 0; int bank; uaecptr addr = makeaddr(pc, &bank); - v = program_ram[addr] << 8; - v |= program_ram[addr + 1]; + v = a2410_data.program_ram[addr] << 8; + v |= a2410_data.program_ram[addr + 1]; //write_log(_T("TMS instruction word read RAM %08x (%08x) =%04x\n"), pc, addr, v); return v; } @@ -162,36 +178,36 @@ UINT16 direct_read_data::read_raw_word(UINT32 pc) uae_u16 v = 0; int bank; uaecptr addr = makeaddr(pc, &bank); - v = program_ram[addr] << 8; - v |= program_ram[addr + 1]; + v = a2410_data.program_ram[addr] << 8; + v |= a2410_data.program_ram[addr + 1]; //write_log(_T("TMS instruction word read RAM %08x (%08x) =%04x\n"), pc, addr, v); return v; } -static void mark_overlay(int addr) +static void mark_overlay(struct a2410_struct *data, int addr) { - if (!a2410_enabled) + if (!data->a2410_enabled) return; addr &= 0x1ffff; addr /= OVERLAY_WIDTH / 8; - a2410_modified[addr] = true; + data->a2410_modified[addr] = true; } -static void a2410_create_palette32(int offset) +static void a2410_create_palette32(struct a2410_struct *data, int offset) { - int idx = a2410_palette_index / 4 + offset; - if (a2410_palette[idx * 4 + 0] != a2410_palette_temp[0] || - a2410_palette[idx * 4 + 1] != a2410_palette_temp[1] || - a2410_palette[idx * 4 + 2] != a2410_palette_temp[2]) { - request_fullrefresh = 1; + int idx = data->a2410_palette_index / 4 + offset; + if (data->a2410_palette[idx * 4 + 0] != data->a2410_palette_temp[0] || + data->a2410_palette[idx * 4 + 1] != data->a2410_palette_temp[1] || + data->a2410_palette[idx * 4 + 2] != data->a2410_palette_temp[2]) { + data->request_fullrefresh = 1; } - a2410_palette[idx * 4 + 0] = a2410_palette_temp[0]; - a2410_palette[idx * 4 + 1] = a2410_palette_temp[1]; - a2410_palette[idx * 4 + 2] = a2410_palette_temp[2]; - a2410_palette_32[idx] = - (a2410_palette_temp[0] << 16) | - (a2410_palette_temp[1] << 8) | - (a2410_palette_temp[2] << 0); + data->a2410_palette[idx * 4 + 0] = data->a2410_palette_temp[0]; + data->a2410_palette[idx * 4 + 1] = data->a2410_palette_temp[1]; + data->a2410_palette[idx * 4 + 2] = data->a2410_palette_temp[2]; + data->a2410_palette_32[idx] = + (data->a2410_palette_temp[0] << 16) | + (data->a2410_palette_temp[1] << 8) | + (data->a2410_palette_temp[2] << 0); #if 0 write_log(_T("PAL %d: %02x %02x %02x = %08x\n"), idx, @@ -202,64 +218,64 @@ static void a2410_create_palette32(int offset) #endif } -static void write_ramdac(int addr, uae_u8 v) +static void write_ramdac(struct a2410_struct *data, int addr, uae_u8 v) { - int coloridx = a2410_palette_index & 3; + int coloridx = data->a2410_palette_index & 3; switch (addr) { case 0: - a2410_palette_index = v * 4; + data->a2410_palette_index = v * 4; break; case 1: - a2410_palette_temp[coloridx] = v; - a2410_palette_index++; - if ((a2410_palette_index & 3) == 3) { - a2410_create_palette32(0); - a2410_palette_index++; + data->a2410_palette_temp[coloridx] = v; + data->a2410_palette_index++; + if ((data->a2410_palette_index & 3) == 3) { + a2410_create_palette32(data, 0); + data->a2410_palette_index++; } - if (a2410_palette_index >= 256 * 4) - a2410_palette_index = 0; + if (data->a2410_palette_index >= 256 * 4) + data->a2410_palette_index = 0; break; case 2: - if (a2410_palette_index >= 4 * 4 && a2410_palette_index < 8 * 4) { - a2410_palette_control[a2410_palette_index / 4 - 4] = v; + if (data->a2410_palette_index >= 4 * 4 && data->a2410_palette_index < 8 * 4) { + data->a2410_palette_control[data->a2410_palette_index / 4 - 4] = v; } - a2410_overlay_mask[0] = 0xff; - a2410_overlay_mask[1] = 0xff; - if (!(a2410_palette_control[6 - 4] & 1)) - a2410_overlay_mask[0] = 0; - if (!(a2410_palette_control[6 - 4] & 2)) - a2410_overlay_mask[1] = 0; - switch((a2410_palette_control[6 - 4] >> 4) & 3) + data->a2410_overlay_mask[0] = 0xff; + data->a2410_overlay_mask[1] = 0xff; + if (!(data->a2410_palette_control[6 - 4] & 1)) + data->a2410_overlay_mask[0] = 0; + if (!(data->a2410_palette_control[6 - 4] & 2)) + data->a2410_overlay_mask[1] = 0; + switch((data->a2410_palette_control[6 - 4] >> 4) & 3) { case 0: - a2410_overlay_blink_rate_on = 16; - a2410_overlay_blink_rate_off = 48; + data->a2410_overlay_blink_rate_on = 16; + data->a2410_overlay_blink_rate_off = 48; break; case 1: - a2410_overlay_blink_rate_on = 16; - a2410_overlay_blink_rate_off = 16; + data->a2410_overlay_blink_rate_on = 16; + data->a2410_overlay_blink_rate_off = 16; break; case 2: - a2410_overlay_blink_rate_on = 32; - a2410_overlay_blink_rate_off = 32; + data->a2410_overlay_blink_rate_on = 32; + data->a2410_overlay_blink_rate_off = 32; break; case 3: - a2410_overlay_blink_rate_on = 64; - a2410_overlay_blink_rate_off = 64; + data->a2410_overlay_blink_rate_on = 64; + data->a2410_overlay_blink_rate_off = 64; break; } break; case 3: - if (a2410_palette_index < 4 * 4) { - a2410_palette_temp[coloridx] = v; - a2410_palette_index++; - if ((a2410_palette_index & 3) == 3) { - a2410_create_palette32(256); - a2410_palette_index++; + if (data->a2410_palette_index < 4 * 4) { + data->a2410_palette_temp[coloridx] = v; + data->a2410_palette_index++; + if ((data->a2410_palette_index & 3) == 3) { + a2410_create_palette32(data, 256); + data->a2410_palette_index++; } - if (a2410_palette_index >= 4 * 4) - a2410_palette_index = 0; + if (data->a2410_palette_index >= 4 * 4) + data->a2410_palette_index = 0; } break; default: @@ -267,35 +283,35 @@ static void write_ramdac(int addr, uae_u8 v) break; } } -static uae_u8 read_ramdac(int addr) +static uae_u8 read_ramdac(struct a2410_struct *data, int addr) { uae_u8 v = 0; switch (addr) { case 0: - v = a2410_palette_index / 4; + v = data->a2410_palette_index / 4; break; case 1: - v = a2410_palette[a2410_palette_index]; - a2410_palette_index++; - if ((a2410_palette_index & 3) == 3) - a2410_palette_index++; - if (a2410_palette_index >= 256 * 4) - a2410_palette_index = 0; + v = data->a2410_palette[data->a2410_palette_index]; + data->a2410_palette_index++; + if ((data->a2410_palette_index & 3) == 3) + data->a2410_palette_index++; + if (data->a2410_palette_index >= 256 * 4) + data->a2410_palette_index = 0; break; case 2: - if (a2410_palette_index >= 4 * 4 && a2410_palette_index < 8 * 4) { - v = a2410_palette_control[a2410_palette_index / 4 - 4]; + if (data->a2410_palette_index >= 4 * 4 && data->a2410_palette_index < 8 * 4) { + v = data->a2410_palette_control[data->a2410_palette_index / 4 - 4]; } break; case 3: - if (a2410_palette_index < 4 * 4) { - v = a2410_palette[a2410_palette_index + 256 * 4]; - a2410_palette_index++; - if ((a2410_palette_index & 3) == 3) - a2410_palette_index = 0; - if (a2410_palette_index >= 4 * 4) - a2410_palette_index = 0; + if (data->a2410_palette_index < 4 * 4) { + v = data->a2410_palette[data->a2410_palette_index + 256 * 4]; + data->a2410_palette_index++; + if ((data->a2410_palette_index & 3) == 3) + data->a2410_palette_index = 0; + if (data->a2410_palette_index >= 4 * 4) + data->a2410_palette_index = 0; } break; default: @@ -305,14 +321,15 @@ static uae_u8 read_ramdac(int addr) return v; } -static bool valid_dma(uaecptr addr) +static bool valid_dma(struct a2410_struct *data, uaecptr addr) { // prevent recursive DMA - return addr < (tms_configured << 16) || addr >= ((tms_configured + 1) << 16); + return addr < data->tms_configured || addr >= (data->tms_configured + 65536); } UINT8 address_space::read_byte(UINT32 a) { + struct a2410_struct *data = &a2410_data; int bank; uae_u8 v = 0; UINT32 aa = a << 3; @@ -322,24 +339,24 @@ UINT8 address_space::read_byte(UINT32 a) switch (bank) { case A2410_BANK_PROGRAM: - v = program_ram[addr]; + v = data->program_ram[addr]; //write_log(_T("TMS byte read RAM %08x (%08x) =%02x PC=%08x\n"), aa, addr, v, M68K_GETPC); break; case A2410_BANK_FRAMEBUFFER: - v = gfxmem_banks[a2410_gfxboard]->baseaddr[addr]; + v = data->gfxbank->baseaddr[addr]; //write_log(_T("TMS byte read framebuffer %08x (%08x) = %02x PC=%08x\n"), aa, addr, v, M68K_GETPC); break; case A2410_BANK_RAMDAC: - v = read_ramdac(addr); + v = read_ramdac(data, addr); //write_log(_T("RAMDAC READ %08x = %02x PC=%08x\n"), aa, v, M68K_GETPC); break; case A2410_BANK_CONTROL: - v = get_a2410_control(); + v = get_a2410_control(data); write_log(_T("CONTROL READ %08x = %02x PC=%08x\n"), aa, v, M68K_GETPC); break; case A2410_BANK_DMA: - if (valid_dma(addr)) { - if (a2410_control & 4) + if (valid_dma(data, addr)) { + if (data->a2410_control & 4) addr ^= 1; v = get_byte(addr); } @@ -353,6 +370,7 @@ UINT8 address_space::read_byte(UINT32 a) } UINT16 address_space::read_word(UINT32 a) { + struct a2410_struct *data = &a2410_data; int bank; uae_u16 v = 0; UINT32 aa = a << 3; @@ -365,27 +383,27 @@ UINT16 address_space::read_word(UINT32 a) //write_log(_T("TMS IO word read %08x (%08x) = %04x PC=%08x PC=%08x\n"), aa, addr, v, M68K_GETPC); break; case A2410_BANK_PROGRAM: - v = program_ram[addr] << 8; - v |= program_ram[addr + 1]; + v = data->program_ram[addr] << 8; + v |= data->program_ram[addr + 1]; //write_log(_T("TMS program word read RAM %08x (%08x) = %04x PC=%08x\n"), aa, addr, v, M68K_GETPC); break; case A2410_BANK_FRAMEBUFFER: - v = gfxmem_banks[a2410_gfxboard]->baseaddr[addr] << 8; - v |= gfxmem_banks[a2410_gfxboard]->baseaddr[addr + 1]; + v = data->gfxbank->baseaddr[addr] << 8; + v |= data->gfxbank->baseaddr[addr + 1]; //write_log(_T("TMS gfx word read %08x (%08x) = %04x PC=%08x\n"), aa, addr, v, M68K_GETPC); break; case A2410_BANK_RAMDAC: - v = read_ramdac(addr); + v = read_ramdac(data, addr); //write_log(_T("RAMDAC READ %08x = %02x PC=%08x\n"), aa, v, M68K_GETPC); break; case A2410_BANK_CONTROL: - v = get_a2410_control(); + v = get_a2410_control(data); write_log(_T("CONTROL READ %08x = %02x PC=%08x\n"), aa, v, M68K_GETPC); break; case A2410_BANK_DMA: - if (valid_dma(addr)) { + if (valid_dma(data, addr)) { v = get_word(addr); - if (a2410_control & 4) + if (data->a2410_control & 4) v = (v >> 8) | (v << 8); } break; @@ -398,6 +416,7 @@ UINT16 address_space::read_word(UINT32 a) void address_space::write_byte(UINT32 a, UINT8 b) { + struct a2410_struct *data = &a2410_data; int bank; UINT32 aa = a << 3; uaecptr addr = makeaddr(a, &bank); @@ -405,26 +424,26 @@ void address_space::write_byte(UINT32 a, UINT8 b) switch (bank) { case A2410_BANK_PROGRAM: - program_ram[addr] = b; + data->program_ram[addr] = b; if (addr < 0x40000) - mark_overlay(addr); + mark_overlay(data, addr); //write_log(_T("TMS program byte write %08x (%08x) = %02x PC=%08x\n"), aa, addr, b, M68K_GETPC); break; case A2410_BANK_FRAMEBUFFER: - gfxmem_banks[a2410_gfxboard]->baseaddr[addr] = b; + data->gfxbank->baseaddr[addr] = b; //write_log(_T("TMS gfx byte write %08x (%08x) = %02x PC=%08x\n"), aa, addr, b, M68K_GETPC); break; case A2410_BANK_RAMDAC: //write_log(_T("RAMDAC WRITE %08x = %02x PC=%08x\n"), aa, b, M68K_GETPC); - write_ramdac(addr, b); + write_ramdac(data, addr, b); break; case A2410_BANK_CONTROL: write_log(_T("CONTROL WRITE %08x = %02x PC=%08x\n"), aa, b, M68K_GETPC); - a2410_control = b; + data->a2410_control = b; break; case A2410_BANK_DMA: - if (valid_dma(addr)) { - if (a2410_control & 4) + if (valid_dma(data, addr)) { + if (data->a2410_control & 4) addr ^= 1; put_byte(addr, b); } @@ -437,6 +456,7 @@ void address_space::write_byte(UINT32 a, UINT8 b) void address_space::write_word(UINT32 a, UINT16 b) { + struct a2410_struct *data = &a2410_data; int bank; UINT32 aa = a << 3; uaecptr addr = makeaddr(a, &bank); @@ -447,28 +467,28 @@ void address_space::write_word(UINT32 a, UINT16 b) //write_log(_T("TMS IO word write %08x (%08x) = %04x PC=%08x\n"), aa, addr, b, M68K_GETPC); break; case A2410_BANK_PROGRAM: - program_ram[addr] = b >> 8; - program_ram[addr + 1] = b & 0xff; + data->program_ram[addr] = b >> 8; + data->program_ram[addr + 1] = b & 0xff; if (addr < 0x40000) - mark_overlay(addr); + mark_overlay(data, addr); //write_log(_T("TMS program word write RAM %08x (%08x) = %04x PC=%08x\n"), aa, addr, b, M68K_GETPC); break; case A2410_BANK_FRAMEBUFFER: - gfxmem_banks[a2410_gfxboard]->baseaddr[addr] = b >> 8; - gfxmem_banks[a2410_gfxboard]->baseaddr[addr + 1] = b & 0xff; + data->gfxbank->baseaddr[addr] = b >> 8; + data->gfxbank->baseaddr[addr + 1] = b & 0xff; //write_log(_T("TMS gfx word write %08x (%08x) = %04x PC=%08x\n"), aa, addr, b, M68K_GETPC); break; case A2410_BANK_RAMDAC: //write_log(_T("RAMDAC WRITE %08x = %04x IDX=%d/%d PC=%08x\n"), aa, b, a2410_palette_index / 4, a2410_palette_index & 3, M68K_GETPC); - write_ramdac(addr, b); + write_ramdac(data, addr, b); break; case A2410_BANK_CONTROL: write_log(_T("CONTROL WRITE %08x = %04x PC=%08x\n"), aa, b, M68K_GETPC); - a2410_control = b; + data->a2410_control = b; break; case A2410_BANK_DMA: - if (valid_dma(addr)) { - if (a2410_control & 4) + if (valid_dma(data, addr)) { + if (data->a2410_control & 4) b = (b >> 8) | (b << 8); put_word(addr, b); } @@ -481,32 +501,25 @@ void address_space::write_word(UINT32 a, UINT16 b) static uae_u32 REGPARAM2 tms_bget(uaecptr addr) { + struct a2410_struct *data = &a2410_data; uae_u32 v = 0xff; addr &= 65535; - if (!tms_configured) { - v = tms_config[addr]; - } else { - uae_u16 vv = tms_device.host_r(tms_space, addr >> 1); - if (!(addr & 1)) - vv >>= 8; - v = (uae_u8)vv; - //write_log(_T("TMS read %08x = %02x PC=%08x\n"), addr, v & 0xff, M68K_GETPC); - tms_execute_single(); - } + uae_u16 vv = tms_device.host_r(tms_space, addr >> 1); + if (!(addr & 1)) + vv >>= 8; + v = (uae_u8)vv; + //write_log(_T("TMS read %08x = %02x PC=%08x\n"), addr, v & 0xff, M68K_GETPC); + tms_execute_single(); return v; } static uae_u32 REGPARAM2 tms_wget(uaecptr addr) { + struct a2410_struct *data = &a2410_data; uae_u16 v; addr &= 65535; - if (tms_configured) { - v = tms_device.host_r(tms_space, addr >> 1); - //write_log(_T("TMS read %08x = %04x PC=%08x\n"), addr, v & 0xffff, M68K_GETPC); - tms_execute_single(); - } else { - v = tms_bget(addr) << 8; - v |= tms_bget(addr + 1); - } + v = tms_device.host_r(tms_space, addr >> 1); + //write_log(_T("TMS read %08x = %04x PC=%08x\n"), addr, v & 0xffff, M68K_GETPC); + tms_execute_single(); return v; } static uae_u32 REGPARAM2 tms_lget(uaecptr addr) @@ -521,12 +534,11 @@ static uae_u32 REGPARAM2 tms_lget(uaecptr addr) static void REGPARAM2 tms_wput(uaecptr addr, uae_u32 w) { + struct a2410_struct *data = &a2410_data; addr &= 65535; - if (tms_configured) { - //write_log(_T("TMS write %08x = %04x PC=%08x\n"), addr, w & 0xffff, M68K_GETPC); - tms_device.host_w(tms_space, addr >> 1, w); - tms_execute_single(); - } + //write_log(_T("TMS write %08x = %04x PC=%08x\n"), addr, w & 0xffff, M68K_GETPC); + tms_device.host_w(tms_space, addr >> 1, w); + tms_execute_single(); } static void REGPARAM2 tms_lput(uaecptr addr, uae_u32 l) @@ -538,28 +550,15 @@ static void REGPARAM2 tms_lput(uaecptr addr, uae_u32 l) static void REGPARAM2 tms_bput(uaecptr addr, uae_u32 b) { + struct a2410_struct *data = &a2410_data; b &= 0xff; addr &= 65535; - if (!tms_configured) { - if (addr == 0x48 && !tms_configured) { - map_banks_z2(&tms_bank, b, 0x10000 >> 16); - tms_configured = b; - expamem_next(&tms_bank, NULL); - return; - } - if (addr == 0x4c && !tms_configured) { - tms_configured = 0xff; - expamem_shutup(&tms_bank); - return; - } - return; - } //write_log(_T("tms_bput %08x=%02x PC=%08x\n"), addr, b, M68K_GETPC); tms_device.host_w(tms_space, addr >> 1, (b << 8) | b); tms_execute_single(); } -addrbank tms_bank = { +static addrbank tms_bank = { tms_lget, tms_wget, tms_bget, tms_lput, tms_wput, tms_bput, default_xlate, default_check, NULL, NULL, _T("A2410"), @@ -567,349 +566,320 @@ addrbank tms_bank = { ABFLAG_IO, S_READ, S_WRITE }; -static bool a2410_modechanged; -static int a2410_gotmode; -static int a2410_width, a2410_height; -static int a2410_vram_start_offset; -static uae_u8 *a2410_surface; -static int a2410_interlace; -static int a2410_interrupt; -static int a2410_hsync_max; -static bool a2410_visible; - -void tms_reset(void) +static void tms_reset(void *userdata) { - if (a2410_surface) + struct a2410_struct *data = (struct a2410_struct*)userdata; + + if (data->a2410_surface) gfx_unlock_picasso(true); - a2410_surface = NULL; + data->a2410_surface = NULL; - a2410_modechanged = false; - a2410_gotmode = 0; - a2410_interlace = 0; - a2410_interrupt = 0; - a2410_hsync_max = 2; + data->a2410_modechanged = false; + data->a2410_gotmode = 0; + data->a2410_interlace = 0; + data->a2410_interrupt = 0; + data->a2410_hsync_max = 2; + data->a2410_visible = false; + data->a2410_enabled = false; - if (program_ram) + if (data->program_ram) tms_device.device_reset(); - tms_configured = 0; + data->tms_configured = 0; } -static void ew(int addr, uae_u32 value) +static void tms_configured(void *userdata, uae_u32 address) { - addr &= 0xffff; - if (addr == 00 || addr == 02 || addr == 0x40 || addr == 0x42) { - tms_config[addr] = (value & 0xf0); - tms_config[addr + 2] = (value & 0x0f) << 4; - } else { - tms_config[addr] = ~(value & 0xf0); - tms_config[addr + 2] = ~((value & 0x0f) << 4); - } + struct a2410_struct *data = (struct a2410_struct*)userdata; + data->tms_configured = address; } -void tms_free(void) +static void tms_free(void *userdata) { - if (a2410_surface) + struct a2410_struct *data = (struct a2410_struct*)userdata; + + if (data->a2410_surface) gfx_unlock_picasso(true); - a2410_surface = NULL; - if (a2410_gfxboard >= 0) { - gfxboard_free_vram(a2410_gfxboard); - gfxboard_free_slot(a2410_gfxboard); + data->a2410_surface = NULL; + if (data->a2410_gfxboard >= 0) { + gfxboard_free_vram(data->a2410_gfxboard); } - a2410_gfxboard = -1; - xfree(program_ram); - program_ram = NULL; + data->a2410_gfxboard = -1; + xfree(data->program_ram); + data->program_ram = NULL; + data->gfxbank = NULL; } -bool tms_init(struct autoconfig_info *aci) +static bool tms_init(struct autoconfig_info *aci) { - memset(tms_config, 0xff, sizeof tms_config); - ew(0x00, 0xc0 | 0x01); - // product id - ew(0x04, 0x00); - // manufacturer id - ew(0x10, 1030 >> 8); - ew(0x14, 1030 & 0xff); + struct a2410_struct *data = &a2410_data; aci->addrbank = &tms_bank; aci->label = _T("A2410"); if (!aci->doinit) { - memcpy(aci->autoconfig_raw, tms_config, sizeof tms_config); return true; } - for (int i = 0; i < MAX_RTG_BOARDS; i++) { - if (currprefs.rtgboards[i].rtgmem_type == GFXBOARD_A2410) { - a2410_gfxboard = currprefs.rtgboards[i].rtg_index; - break; - } - } + data->a2410_gfxboard = aci->prefs->rtgboards[aci->devnum].rtg_index; - if (a2410_gfxboard < 0) + if (data->a2410_gfxboard < 0) return false; - gfxboard_allocate_slot(currprefs.rtgboards[a2410_gfxboard].rtgmem_type, a2410_gfxboard); + data->gfxbank = gfxmem_banks[data->a2410_gfxboard]; - mapped_free(gfxmem_banks[a2410_gfxboard]); - xfree(program_ram); + mapped_free(data->gfxbank); + xfree(data->program_ram); - gfxmem_banks[a2410_gfxboard]->label = _T("ram_a8"); - gfxmem_banks[a2410_gfxboard]->reserved_size = 1 * 1024 * 1024; - gfxboard_get_a8_vram(a2410_gfxboard); + data->gfxbank->label = _T("ram_a8"); + data->gfxbank->reserved_size = 1 * 1024 * 1024; + gfxboard_get_a8_vram(data->a2410_gfxboard); - picasso_allocatewritewatch(a2410_gfxboard, gfxmem_banks[a2410_gfxboard]->allocated_size); - gfxmem_banks[a2410_gfxboard]->start = 0xa80000; + picasso_allocatewritewatch(data->a2410_gfxboard, data->gfxbank->allocated_size); + data->gfxbank->start = 0xa80000; - program_ram = xcalloc(uae_u8, 1 * 1024 * 1024); + data->program_ram = xcalloc(uae_u8, 1 * 1024 * 1024); m_screen = &tms_screen; tms_device.device_start(); - tms_reset(); + tms_reset(data); + aci->userdata = data; return true; } void mscreen::configure(int width, int height, rectangle vis) { - int ow = a2410_width, oh = a2410_height; - a2410_width = vis.max_x - vis.min_x + 1; - a2410_height = vis.max_y - vis.min_y + 1; - a2410_interlace = vis.interlace ? 1 : 0; - if (a2410_interlace) - a2410_height *= 2; - a2410_modechanged = true; - a2410_gotmode = true; + struct a2410_struct *data = &a2410_data; + + int ow = data->a2410_width, oh = data->a2410_height; + data->a2410_width = vis.max_x - vis.min_x + 1; + data->a2410_height = vis.max_y - vis.min_y + 1; + data->a2410_interlace = vis.interlace ? 1 : 0; + if (data->a2410_interlace) + data->a2410_height *= 2; + data->a2410_modechanged = true; + data->a2410_gotmode = true; m_screen->height_v = height; m_screen->width_v = width; tms_rectangle = vis; - write_log(_T("A2410 %d*%d -> %d*%d\n"), ow, oh, a2410_width, a2410_height); - a2410_hsync_max = a2410_height / 300; + write_log(_T("A2410 %d*%d -> %d*%d\n"), ow, oh, data->a2410_width, data->a2410_height); + data->a2410_hsync_max = data->a2410_height / 300; } -static void get_a2410_surface(void) +static void get_a2410_surface(struct a2410_struct *data) { bool gotsurf = false; if (picasso_on) { - if (a2410_surface == NULL) { - a2410_surface = gfx_lock_picasso(false, false); + if (data->a2410_surface == NULL) { + data->a2410_surface = gfx_lock_picasso(false, false); gotsurf = true; } - if (a2410_surface && gotsurf) { + if (data->a2410_surface && gotsurf) { if (!(currprefs.leds_on_screen & STATUSLINE_TARGET)) - picasso_statusline(a2410_surface); + picasso_statusline(data->a2410_surface); } } } -bool tms_toggle(int mode) +static bool tms_toggle(void *userdata, int mode) { - if (!tms_configured) + struct a2410_struct *data = (struct a2410_struct*)userdata; + + if (!data->tms_configured) return false; if (!mode) { - if (!a2410_enabled) + if (!data->a2410_enabled) return false; - a2410_enabled = false; - a2410_modechanged = false; - a2410_gotmode = -1; - a2410_visible = false; + data->a2410_enabled = false; + data->a2410_modechanged = false; + data->a2410_gotmode = -1; + data->a2410_visible = false; return true; } else { - if (!a2410_gotmode) + if (!data->a2410_gotmode) return false; - if (a2410_enabled) + if (data->a2410_enabled) return false; - a2410_gotmode = 1; - a2410_modechanged = true; - a2410_visible = true; - if (currprefs.rtgboards[1].rtgmem_size) - statusline_add_message(_T("RTG %d: A2410"), a2410_gfxboard + 1); + data->a2410_gotmode = 1; + data->a2410_modechanged = true; + data->a2410_visible = true; return true; } return false; } -static void a2410_setmode(void) +static void tms_vsync_handler2(struct a2410_struct *data, bool internalsync) { - picasso96_state.Width = a2410_width; - picasso96_state.Height = a2410_height; - picasso96_state.BytesPerPixel = 1; - picasso96_state.RGBFormat = RGBFB_CLUT; - write_log(_T("A2410 %d*%d\n"), a2410_width, a2410_height); - gfx_set_picasso_modeinfo(a2410_width, a2410_height, 1, RGBFB_NONE); - init_hz_p96(); -} - -static void tms_vsync_handler2(bool internalsync) -{ - if (!tms_configured) + if (!data->tms_configured) return; tms34010_display_params parms; tms_device.get_display_params(&parms); - bool enabled = parms.enabled != 0 && a2410_gotmode > 0; + bool enabled = parms.enabled != 0 && data->a2410_gotmode > 0; - if (!a2410_visible && a2410_modechanged) { - if (gfxboard_rtg_enable_initial(a2410_gfxboard)) { - a2410_setmode(); - return; - } + if (!data->a2410_visible && data->a2410_modechanged) { + gfxboard_rtg_enable_initial(data->a2410_gfxboard); } - if (a2410_visible) { - if (enabled != a2410_enabled || a2410_modechanged) { - if (a2410_surface) + if (data->a2410_visible) { + if (enabled != data->a2410_enabled || data->a2410_modechanged) { + if (data->a2410_surface) gfx_unlock_picasso(false); - a2410_surface = NULL; + data->a2410_surface = NULL; if (enabled) { - if (a2410_modechanged) { - a2410_setmode(); - if (!picasso_on) - picasso_requested_on = true; - } - a2410_modechanged = false; - fullrefresh = 2; + data->a2410_modechanged = false; + data->fullrefresh = 2; } - a2410_enabled = enabled; - write_log(_T("A2410 ACTIVE=%d\n"), a2410_enabled); + data->a2410_enabled = enabled; + write_log(_T("A2410 ACTIVE=%d\n"), data->a2410_enabled); } if (picasso_on) { if (currprefs.leds_on_screen & STATUSLINE_RTG) { - get_a2410_surface(); + get_a2410_surface(data); } if (internalsync) { - if (request_fullrefresh) { - fullrefresh = 2; - request_fullrefresh = 0; + if (data->request_fullrefresh) { + data->fullrefresh = 2; + data->request_fullrefresh = 0; } } } - if (a2410_surface) + if (data->a2410_surface) gfx_unlock_picasso(true); - a2410_surface = NULL; + data->a2410_surface = NULL; } - a2410_interlace = -a2410_interlace; + data->a2410_interlace = -data->a2410_interlace; - a2410_overlay_blink_cnt++; - if (a2410_overlay_blink_cnt == 0 || a2410_overlay_blink_cnt == a2410_overlay_blink_rate_on) { + data->a2410_overlay_blink_cnt++; + if (data->a2410_overlay_blink_cnt == 0 || data->a2410_overlay_blink_cnt == data->a2410_overlay_blink_rate_on) { // any blink mode enabled? - if (a2410_palette_control[5 - 4] != 0 || (a2410_palette_control[6 - 4] & (4 | 8))) - fullrefresh = 2; + if (data->a2410_palette_control[5 - 4] != 0 || (data->a2410_palette_control[6 - 4] & (4 | 8))) + data->fullrefresh = 2; } - if (a2410_overlay_blink_cnt > a2410_overlay_blink_rate_off + a2410_overlay_blink_rate_on) { - a2410_overlay_blink_cnt = 0; + if (data->a2410_overlay_blink_cnt > data->a2410_overlay_blink_rate_off + data->a2410_overlay_blink_rate_on) { + data->a2410_overlay_blink_cnt = 0; } } -static void a2410_rethink(void) +static void a2410_rethink(struct a2410_struct *data) { - if (a2410_interrupt) + if (data->a2410_interrupt) INTREQ_0(0x8000 | 0x0008); } -bool tms_vsync_handler(void) +static bool tms_vsync(void *userdata, struct gfxboard_mode *mode) { + struct a2410_struct *data = (struct a2410_struct*)userdata; + bool flushed = false; - if (!a2410_enabled) - tms_vsync_handler2(false); + if (!data->a2410_enabled) + tms_vsync_handler2(data, false); - if (a2410_surface) { + if (data->a2410_surface) { gfx_unlock_picasso(false); flushed = true; } - a2410_surface = NULL; + data->a2410_surface = NULL; + + if (data->a2410_visible) { + mode->width = data->a2410_width; + mode->height = data->a2410_height; + mode->mode = RGBFB_CLUT; + } + return flushed; } -static void tms_hsync_handler2(void) +static void tms_hsync_handler2(struct a2410_struct *data) { - if (!tms_configured) + if (!data->tms_configured) return; tms_device.m_icount = 100; tms_device.execute_run(); - int a2410_vpos = tms_vp; - tms_vp = tms_device.scanline_callback(NULL, tms_vp, a2410_interlace < 0); + int a2410_vpos = data->tms_vp; + data->tms_vp = tms_device.scanline_callback(NULL, data->tms_vp, data->a2410_interlace < 0); - a2410_rethink(); + a2410_rethink(data); - if (!a2410_enabled) + if (!data->a2410_enabled) return; if (a2410_vpos == 0) { - tms_vsync_handler2(true); - picasso_getwritewatch(a2410_gfxboard, a2410_vram_start_offset); + tms_vsync_handler2(data, true); + picasso_getwritewatch(data->a2410_gfxboard, data->a2410_vram_start_offset); } - if (a2410_modechanged || !picasso_on) + if (data->a2410_modechanged || !picasso_on) return; - if (a2410_vpos == 0 && fullrefresh > 0) { - fullrefresh--; + if (a2410_vpos == 0 && data->fullrefresh > 0) { + data->fullrefresh--; } tms34010_display_params parms; tms_device.get_display_params(&parms); - a2410_displaywidth = parms.hsblnk - parms.heblnk; - a2410_displayend = parms.heblnk; - a2410_vertical_start = parms.veblnk; + data->a2410_displaywidth = parms.hsblnk - parms.heblnk; + data->a2410_displayend = parms.heblnk; + data->a2410_vertical_start = parms.veblnk; - int overlay_yoffset = a2410_vpos - a2410_vertical_start; + int overlay_yoffset = a2410_vpos - data->a2410_vertical_start; int coladdr = parms.coladdr; int vramoffset = ((parms.rowaddr << 8) & 0x7ffff); - uae_u16 *vram = (uae_u16*)gfxmem_banks[a2410_gfxboard]->baseaddr + vramoffset; + uae_u16 *vram = (uae_u16*)data->gfxbank->baseaddr + vramoffset; int overlayoffset = a2410_vpos - parms.veblnk; if (overlay_yoffset < 0) return; - if (a2410_interlace) { + if (data->a2410_interlace) { overlay_yoffset *= 2; - if (a2410_interlace < 0) + if (data->a2410_interlace < 0) overlay_yoffset++; } - if (overlay_yoffset >= a2410_height || overlay_yoffset >= picasso_vidinfo.height) + if (overlay_yoffset >= data->a2410_height || overlay_yoffset >= picasso_vidinfo.height) return; - - if (!fullrefresh && !a2410_modified[overlay_yoffset]) { - if (!picasso_is_vram_dirty(a2410_gfxboard, gfxmem_banks[a2410_gfxboard]->start + (vramoffset << 1), a2410_displaywidth)) { - if (!picasso_is_vram_dirty(a2410_gfxboard, gfxmem_banks[a2410_gfxboard]->start + ((vramoffset + 0x200) << 1), a2410_displaywidth)) { + if (!data->fullrefresh && !data->a2410_modified[overlay_yoffset]) { + if (!picasso_is_vram_dirty(data->a2410_gfxboard, data->gfxbank->start + (vramoffset << 1), data->a2410_displaywidth)) { + if (!picasso_is_vram_dirty(data->a2410_gfxboard, data->gfxbank->start + ((vramoffset + 0x200) << 1), data->a2410_displaywidth)) { return; } } } - a2410_modified[overlay_yoffset] = false; - - get_a2410_surface(); - uae_u8 *dst = a2410_surface; + get_a2410_surface(data); + uae_u8 *dst = data->a2410_surface; if (!dst) return; + + data->a2410_modified[overlay_yoffset] = false; + dst += overlay_yoffset * picasso_vidinfo.rowbytes; uae_u32 *dst32 = (uae_u32*)dst; - uae_u8 *overlay0 = program_ram + overlayoffset * OVERLAY_WIDTH / 8; + uae_u8 *overlay0 = data->program_ram + overlayoffset * OVERLAY_WIDTH / 8; uae_u8 *overlay1 = overlay0 + 0x20000; - bool overlay0color = !(a2410_palette_control[6 - 4] & 0x40); - uae_u16 bitmap_mask = a2410_palette_control[4 - 4]; + bool overlay0color = !(data->a2410_palette_control[6 - 4] & 0x40); + uae_u16 bitmap_mask = data->a2410_palette_control[4 - 4]; - uae_u8 overlay_mask[2] = { a2410_overlay_mask[0], a2410_overlay_mask[1] }; - if (a2410_overlay_blink_cnt >= a2410_overlay_blink_rate_on) { - if (a2410_palette_control[6 - 4] & 4) + uae_u8 overlay_mask[2] = { data->a2410_overlay_mask[0], data->a2410_overlay_mask[1] }; + if (data->a2410_overlay_blink_cnt >= data->a2410_overlay_blink_rate_on) { + if (data->a2410_palette_control[6 - 4] & 4) overlay_mask[0] = 0; - if (a2410_palette_control[6 - 4] & 8) + if (data->a2410_palette_control[6 - 4] & 8) overlay_mask[1] = 0; - bitmap_mask &= ~a2410_palette_control[5 - 4]; + bitmap_mask &= ~data->a2410_palette_control[5 - 4]; } int xx = 0; @@ -922,8 +892,8 @@ static void tms_hsync_handler2(void) if (a2410_vpos >= parms.veblnk && a2410_vpos < parms.vsblnk) { if (!overlay_bitcount && overlayoffset >= 0) { - opix0 = overlay0[overlay_offset ^ 1] & a2410_overlay_mask[0]; - opix1 = overlay1[overlay_offset ^ 1] & a2410_overlay_mask[1]; + opix0 = overlay0[overlay_offset ^ 1] & data->a2410_overlay_mask[0]; + opix1 = overlay1[overlay_offset ^ 1] & data->a2410_overlay_mask[1]; overlay_offset++; } @@ -940,7 +910,7 @@ static void tms_hsync_handler2(void) ov |= (opix1 & 1) << 1; if (ov || overlay0color) pal = 256 + ov; - *dst32++ = a2410_palette_32[pal]; + *dst32++ = data->a2410_palette_32[pal]; opix0 >>= 1; opix1 >>= 1; @@ -949,15 +919,15 @@ static void tms_hsync_handler2(void) ov |= (opix1 & 1) << 1; if (ov || overlay0color) pal = 256 + ov; - *dst32++ = a2410_palette_32[pal]; + *dst32++ = data->a2410_palette_32[pal]; opix0 >>= 1; opix1 >>= 1; } else { - *dst32++ = a2410_palette_32[pix >> 8]; - *dst32++ = a2410_palette_32[pix & 0xff]; + *dst32++ = data->a2410_palette_32[pix >> 8]; + *dst32++ = data->a2410_palette_32[pix & 0xff]; opix0 >>= 2; opix1 >>= 2; @@ -976,14 +946,29 @@ static void tms_hsync_handler2(void) } -void tms_hsync_handler(void) +static void tms_hsync(void *userdata) { - for (int i = 0; i < a2410_hsync_max; i++) - tms_hsync_handler2(); + struct a2410_struct *data = (struct a2410_struct*)userdata; + + for (int i = 0; i < data->a2410_hsync_max; i++) + tms_hsync_handler2(data); } void standard_irq_callback(int level) { - a2410_interrupt = level; - a2410_rethink(); + struct a2410_struct *data = &a2410_data; + + data->a2410_interrupt = level; + a2410_rethink(data); } + +struct gfxboard_func a2410_func +{ + tms_init, + tms_free, + tms_reset, + tms_hsync, + tms_vsync, + tms_toggle, + tms_configured +}; \ No newline at end of file diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index 3c667c62..49fe3112 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -2125,7 +2125,7 @@ static void handle_rawinput_2 (RAWINPUT *raw) for (i = 0; i < (5 > did->buttons ? did->buttons : 5); i++) { if (rm->usButtonFlags & (3 << (i * 2))) { int state = (rm->usButtonFlags & (1 << (i * 2))) ? 1 : 0; - if (!istest && i == 2 && currprefs.win32_middle_mouse) + if (!istest && i == 2 && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON)) continue; setmousebuttonstate (num, i, state); } @@ -2179,7 +2179,7 @@ static void handle_rawinput_2 (RAWINPUT *raw) } if (isfocus () && !istest) { if (did->buttons >= 3 && (rm->usButtonFlags & RI_MOUSE_MIDDLE_BUTTON_DOWN)) { - if (currprefs.win32_middle_mouse) { + if (currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON) { if ((isfullscreen() < 0 && currprefs.win32_minimize_inactive) || isfullscreen() > 0) minimizewindow (); if (mouseactive) @@ -2532,7 +2532,7 @@ static void handle_rawinput_2 (RAWINPUT *raw) return; if (!isfocus ()) return; - if (isfocus () < 2 && currprefs.input_tablet >= TABLET_MOUSEHACK && currprefs.input_magic_mouse) + if (isfocus () < 2 && currprefs.input_tablet >= TABLET_MOUSEHACK && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC)) return; di_keycodes[num][scancode] = pressed; if (stopoutput == 0) { @@ -3141,13 +3141,9 @@ static int di_do_init (void) IsXInputDevice(NULL); #endif - if (!no_rawinput) { - write_log (_T("RawInput enumeration..\n")); - if (!initialize_rawinput ()) - rawinput_enabled_hid = 0; - } else { + write_log (_T("RawInput enumeration..\n")); + if (!initialize_rawinput ()) rawinput_enabled_hid = 0; - } if (!rawinput_decided) { rawinput_enabled_keyboard = true; @@ -3492,13 +3488,13 @@ static void read_mouse (void) if (k == 0) uae_quit (); #endif - if ((currprefs.win32_middle_mouse && k != 2) || !currprefs.win32_middle_mouse || istest) + if (((currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON) && k != 2) || !(currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON) || istest) setmousebuttonstate (i, k, state); } } } } - if (!istest && isfocus () && currprefs.win32_middle_mouse && dimofs == DIMOFS_BUTTON2 && state) { + if (!istest && isfocus () && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON) && dimofs == DIMOFS_BUTTON2 && state) { if ((isfullscreen() < 0 && currprefs.win32_minimize_inactive) || isfullscreen() > 0) minimizewindow (); if (mouseactive) diff --git a/od-win32/keyboard_win32.cpp b/od-win32/keyboard_win32.cpp index 0b4c405b..5693f8c2 100644 --- a/od-win32/keyboard_win32.cpp +++ b/od-win32/keyboard_win32.cpp @@ -423,7 +423,7 @@ bool my_kbd_handler (int keyboard, int scancode, int newstate) if (scancode == DIK_F9 && specialpressed ()) { if (newstate) - toggle_rtg (-1); + toggle_rtg (MAX_RTG_BOARDS + 1); return true; } diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index d8d046b7..a9e70cff 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -742,16 +742,21 @@ void picasso_trigger_vblank(void) static bool rtg_render (void) { bool flushed = false; - bool uaegfx = currprefs.rtgboards[0].rtgmem_type < GFXBOARD_HARDWARE && currprefs.rtgboards[0].rtgmem_size; + bool uaegfx_active = rtg_index == 0 && currprefs.rtgboards[0].rtgmem_type < GFXBOARD_HARDWARE && currprefs.rtgboards[0].rtgmem_size; if (doskip () && p96skipmode == 0) { ; } else { - if (uaegfx) { + bool full = full_refresh > 0; + if (uaegfx_active) { flushed = picasso_flushpixels (rtg_index, gfxmem_banks[rtg_index]->start + natmem_offset, picasso96_state.XYOffset - gfxmem_banks[rtg_index]->start); } else { - flushed = gfxboard_vsync_handler (); + if (full_refresh < 0) + full_refresh = 0; + if (full_refresh > 0) + full_refresh--; } + flushed |= gfxboard_vsync_handler(full); } return flushed; } @@ -1610,7 +1615,7 @@ int createwindowscursor(uaecptr src, int w, int h, int hiressprite, int doubleds ret = 0; wincursor_shown = 0; - if (isfullscreen () > 0 || currprefs.input_tablet == 0 || currprefs.input_magic_mouse == 0) + if (isfullscreen () > 0 || currprefs.input_tablet == 0 || !(currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC)) goto exit; if (currprefs.input_magic_mouse_cursor != MAGICMOUSE_HOST_ONLY) goto exit; @@ -1747,7 +1752,7 @@ end: write_log (_T("RTG Windows color cursor creation failed\n")); exit: - if (currprefs.input_tablet && currprefs.input_magic_mouse && currprefs.input_magic_mouse_cursor == MAGICMOUSE_NATIVE_ONLY) { + if (currprefs.input_tablet && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && currprefs.input_magic_mouse_cursor == MAGICMOUSE_NATIVE_ONLY) { if (GetCursor () != NULL) SetCursor (NULL); } else { @@ -2577,7 +2582,8 @@ static uae_u32 REGPARAM2 picasso_SetSwitch (TrapContext *ctx) void picasso_enablescreen (int on) { - if (rtg_index == 0) { + bool uaegfx = currprefs.rtgboards[0].rtgmem_type < GFXBOARD_HARDWARE && currprefs.rtgboards[0].rtgmem_size; + if (rtg_index == 0 && uaegfx) { selectuaegfx(); if (!init_picasso_screen_called) init_picasso_screen (); @@ -2675,8 +2681,7 @@ static void init_picasso_screen (void) picasso96_state_uaegfx.Extent = picasso96_state_uaegfx.Address + picasso96_state_uaegfx.BytesPerRow * picasso96_state_uaegfx.VirtualHeight; } if (set_gc_called) { - gfx_set_picasso_modeinfo (picasso96_state_uaegfx.Width, picasso96_state_uaegfx.Height, - picasso96_state_uaegfx.GC_Depth, picasso96_state_uaegfx.RGBFormat); + gfx_set_picasso_modeinfo (picasso96_state_uaegfx.RGBFormat); set_gc_called = 0; } if((picasso_vidinfo.width == picasso96_state_uaegfx.Width) && @@ -3991,10 +3996,10 @@ void picasso_statusline (uae_u8 *dst) } } -static void copyrow (uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, bool direct, int convert_mode) +static void copyrow (uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcbytesperrow, int srcpixbytes, int dy, int dstbytesperrow, int dstpixbytes, bool direct, int convert_mode) { uae_u8 *src2 = src + y * srcbytesperrow; - uae_u8 *dst2 = dst + y * dstbytesperrow; + uae_u8 *dst2 = dst + dy * dstbytesperrow; int endx = x + width, endx4; int dstpix = dstpixbytes; int srcpix = srcpixbytes; @@ -4232,6 +4237,11 @@ static void copyrow (uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcb } } +void fb_copyrow(uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcpixbytes, int dy) +{ + copyrow(src, dst, x, y, width, 0, srcpixbytes, dy, picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes, picasso96_state.RGBFormat == host_mode, picasso_convert); +} + static void copyallinvert (uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, bool direct, int mode_convert) { int x, y, w; @@ -4249,7 +4259,7 @@ static void copyallinvert (uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, in for (y = 0; y < pheight; y++) { for (x = 0; x < w; x++) src2[x] ^= 0xff; - copyrow (src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, dstbytesperrow, dstpixbytes, direct, mode_convert); + copyrow (src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, y, dstbytesperrow, dstpixbytes, direct, mode_convert); for (x = 0; x < w; x++) src2[x] ^= 0xff; src2 += srcbytesperrow; @@ -4270,7 +4280,7 @@ static void copyall (uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, int srcb } } else { for (y = 0; y < pheight; y++) - copyrow (src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, dstbytesperrow, dstpixbytes, direct, mode_convert); + copyrow (src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, y, dstbytesperrow, dstpixbytes, direct, mode_convert); } } @@ -4444,7 +4454,7 @@ bool picasso_flushpixels (int index, uae_u8 *src, int off) if (x < pwidth) { copyrow (src + off, dst, x, y, pwidth - x, picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel, - picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes, + y, picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes, picasso96_state.RGBFormat == host_mode, picasso_convert); flushlines++; } @@ -4456,7 +4466,7 @@ bool picasso_flushpixels (int index, uae_u8 *src, int off) int maxw = w > pwidth ? pwidth : w; copyrow (src + off, dst, 0, y, maxw, picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel, - picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes, + y, picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes, picasso96_state.RGBFormat == host_mode, picasso_convert); w -= maxw; y++; @@ -4888,6 +4898,7 @@ static void inituaegfxfuncs(TrapContext *ctx, uaecptr start, uaecptr ABI) void picasso_reset (void) { + rtg_index = -1; if (savestate_state != STATE_RESTORE) { uaegfx_base = 0; uaegfx_old = 0; diff --git a/od-win32/picasso96_win.h b/od-win32/picasso96_win.h index 6a57909a..9b4f9591 100644 --- a/od-win32/picasso96_win.h +++ b/od-win32/picasso96_win.h @@ -578,7 +578,7 @@ struct picasso_vidbuf_description { extern struct picasso_vidbuf_description picasso_vidinfo; -extern void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 d, RGBFTYPE rgbfmt); +extern void gfx_set_picasso_modeinfo (RGBFTYPE rgbfmt); extern void gfx_set_picasso_colors (RGBFTYPE rgbfmt); extern void gfx_set_picasso_baseaddr (uaecptr); extern void gfx_set_picasso_state (int on); @@ -586,6 +586,8 @@ extern uae_u8 *gfx_lock_picasso (bool, bool); extern void gfx_unlock_picasso (bool); extern int createwindowscursor (uaecptr src, int w, int h, int hiressprite, int doubledsprite, int chipset); +void fb_copyrow(uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcpixbytes, int dy); + extern int p96refresh_active; extern int p96hsync_counter; diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 1ae361d5..ada084d8 100644 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -451,6 +451,7 @@ #define IDC_PARALLEL 1033 #define IDC_PORT0_AF 1033 #define IDC_PORT1_AF 1034 +#define IDC_MOUSE_UNTRAPMODE 1035 #define IDC_FOCUSMINIMIZE 1041 #define IDC_FASTTEXT 1043 #define IDC_FASTRAM 1044 @@ -852,7 +853,6 @@ #define IDC_SCSIROMSELECTED 1612 #define IDC_AVIOUTPUT_VIDEO 1613 #define IDC_INPUTAUTOFIRE 1613 -#define IDC_PORT_MOUSETRICK 1613 #define IDC_EXPANSIONBOARDCHECKBOX 1613 #define IDC_AVIOUTPUT_AUDIO 1614 #define IDC_INPUTCOPYFROM 1614 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 9b3d19e5..5f36aaff 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -532,11 +532,10 @@ BEGIN COMBOBOX IDC_PORT3_JOYS,45,178,342,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Remap / Test [] Remap or test Parallel port joystick port 2 configurarion.",IDC_PORT3_REMAP,310,194,78,14 GROUPBOX "Mouse extra settings",IDC_STATIC,1,219,393,68 - RTEXT "Mouse speed:",IDC_STATIC,19,237,82,10,SS_CENTERIMAGE - EDITTEXT IDC_INPUTSPEEDM,115,237,25,13,ES_NUMBER - CONTROL "Magic Mouse",IDC_PORT_MOUSETRICK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,235,160,11 - RTEXT "Magic Mouse cursor mode:",IDC_STATIC,45,254,138,10,SS_CENTERIMAGE - COMBOBOX IDC_PORT_TABLET_CURSOR,195,251,119,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "Mouse speed:",IDC_STATIC,13,237,70,10,SS_CENTERIMAGE + EDITTEXT IDC_INPUTSPEEDM,97,237,25,13,ES_NUMBER + RTEXT "Magic Mouse cursor mode:",IDC_STATIC,143,254,110,10,SS_CENTERIMAGE + COMBOBOX IDC_PORT_TABLET_CURSOR,268,251,119,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Install virtual mouse driver",IDC_PORT_TABLET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,270,116,11 CONTROL "Full tablet input emulation",IDC_PORT_TABLET_FULL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,270,106,11 @@ -544,6 +543,8 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,271,117,11 CONTROL "Mouse/Joystick autoswitching [] Press button to automatically insert inactive input device in to joystick/mouse port",IDC_PORT_AUTOSWITCH, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,102,172,11 + COMBOBOX IDC_MOUSE_UNTRAPMODE,268,234,119,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "Mouse untrap mode:",IDC_STATIC,143,239,110,10,SS_CENTERIMAGE END IDD_CONTRIBUTORS DIALOGEX 0, 0, 530, 345 @@ -1189,13 +1190,13 @@ BEGIN CONTROL "",IDC_INPUTMAPLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,1,418,257 EDITTEXT IDC_INPUTMAPOUT,1,261,418,14,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED EDITTEXT IDC_INPUTMAPOUTM,1,277,418,29,ES_MULTILINE | ES_READONLY | WS_DISABLED - COMBOBOX IDC_INPUTMAPADD,2,309,345,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Add",IDC_INPUTMAP_CUSTOM,351,308,66,14 - PUSHBUTTON "Test",IDC_INPUTMAP_TEST,2,324,80,14 - PUSHBUTTON "Remap",IDC_INPUTMAP_CAPTURE,86,324,80,14 - PUSHBUTTON "Delete",IDC_INPUTMAP_DELETE,170,324,80,14 - PUSHBUTTON "Delete all",IDC_INPUTMAP_DELETEALL,254,324,80,14 - PUSHBUTTON "Exit",IDC_INPUTMAP_EXIT,338,324,80,14 + COMBOBOX IDC_INPUTMAPADD,2,309,331,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Add Event",IDC_INPUTMAP_CUSTOM,338,309,79,14 + PUSHBUTTON "Test",IDC_INPUTMAP_TEST,1,325,80,14 + PUSHBUTTON "Remap",IDC_INPUTMAP_CAPTURE,85,325,80,14 + PUSHBUTTON "Delete",IDC_INPUTMAP_DELETE,169,325,80,14 + PUSHBUTTON "Delete all",IDC_INPUTMAP_DELETEALL,253,325,80,14 + PUSHBUTTON "Exit",IDC_INPUTMAP_EXIT,338,325,79,14 END IDD_INFOBOX DIALOGEX 0, 0, 420, 68 @@ -2082,7 +2083,7 @@ BEGIN IDS_AUTOSCALE_OVERSCAN_BLANK "Overscan blanking" IDS_SCREEN_ADAPTIVE_SYNC "Variable Sync" IDS_NUMSG_NOMEMORY "Out of memory or too much Z3 autoconfig space configured.\nIf 64-bit, make sure RTG board is first in board list." - IDS_EXPANSION_CATEGORY "Built-in expansions\nSCSI controllers\nIDE controllers\nSASI controllers\nCustom controllers\nPCI bridgeboards\nx86 bridgeboards\nRTG boards\nSound cards\nNetwork adapters\nDisk controllers" + IDS_EXPANSION_CATEGORY "Built-in expansions\nSCSI controllers\nIDE controllers\nSASI controllers\nCustom controllers\nPCI bridgeboards\nx86 bridgeboards\nGraphics boards\nSound cards\nNetwork adapters\nDisk controllers" END #endif // English resources diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index eb4f326d..efe774b1 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -1163,6 +1163,8 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM int num = HIBYTE(wParam); if (lParam == RP_DEVICE_READONLY || lParam == RP_DEVICE_READWRITE) { ret = disk_setwriteprotect (&currprefs, num, currprefs.floppyslots[num].df, lParam == RP_DEVICE_READONLY); + if (ret) + DISK_reinsert(num); } } return ret ? (LPARAM)1 : 0; diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 373ce18f..cf61f70b 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -382,7 +382,7 @@ static void setcursor (int oldx, int oldy) if (windowmouse_max_h < 10) windowmouse_max_h = 10; - if (currprefs.input_magic_mouse && currprefs.input_tablet > 0 && mousehack_alive () && isfullscreen () <= 0) { + if ((currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && currprefs.input_tablet > 0 && mousehack_alive () && isfullscreen () <= 0) { mouseposx = mouseposy = 0; return; } @@ -517,7 +517,7 @@ static void setmaintitle (HWND hwnd) _tcscat (txt, _T("WinUAE")); txt2[0] = 0; if (mouseactive > 0) { - WIN32GUI_LoadUIString (currprefs.win32_middle_mouse ? IDS_WINUAETITLE_MMB : IDS_WINUAETITLE_NORMAL, + WIN32GUI_LoadUIString ((currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON) ? IDS_WINUAETITLE_MMB : IDS_WINUAETITLE_NORMAL, txt2, sizeof (txt2) / sizeof (TCHAR)); } if (_tcslen (WINUAEBETA) > 0) { @@ -560,7 +560,7 @@ void setpriority (struct threadpriorities *pri) static void setcursorshape (void) { - if (currprefs.input_tablet && currprefs.input_magic_mouse && currprefs.input_magic_mouse_cursor == MAGICMOUSE_NATIVE_ONLY) { + if (currprefs.input_tablet && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && currprefs.input_magic_mouse_cursor == MAGICMOUSE_NATIVE_ONLY) { if (GetCursor () != NULL) SetCursor (NULL); } else if (!picasso_setwincursor ()) { @@ -672,7 +672,7 @@ static void setmouseactive2 (int active, bool allowpause) if (mouseactive == active && active >= 0) return; - if (!isrp && active == 1 && !currprefs.input_magic_mouse) { + if (!isrp && active == 1 && !(currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC)) { HANDLE c = GetCursor (); if (c != normalcursor) return; @@ -692,7 +692,7 @@ static void setmouseactive2 (int active, bool allowpause) releasecapture (); recapture = 0; - if (isfullscreen () <= 0 && currprefs.input_magic_mouse && currprefs.input_tablet > 0) { + if (isfullscreen () <= 0 && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && currprefs.input_tablet > 0) { if (mousehack_alive ()) return; SetCursor (normalcursor); @@ -1029,7 +1029,7 @@ int isfocus (void) return 2; return 0; } - if (currprefs.input_tablet >= TABLET_MOUSEHACK && currprefs.input_magic_mouse) { + if (currprefs.input_tablet >= TABLET_MOUSEHACK && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC)) { if (mouseinside) return 2; if (focus) @@ -1482,7 +1482,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, return 0; case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: - if (!mouseactive && !gui_active && (!mousehack_alive () || currprefs.input_tablet != TABLET_MOUSEHACK || (currprefs.input_tablet == TABLET_MOUSEHACK && !currprefs.input_magic_mouse) || isfullscreen () > 0)) { + if (!mouseactive && !gui_active && (!mousehack_alive () || currprefs.input_tablet != TABLET_MOUSEHACK || (currprefs.input_tablet == TABLET_MOUSEHACK && !(currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC)) || isfullscreen () > 0)) { // borderless = do not capture with single-click if (ignorelbutton) { ignorelbutton = 0; @@ -1509,14 +1509,14 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, setmousebuttonstate (dinput_winmouse (), 1, 1); return 0; case WM_MBUTTONUP: - if (!currprefs.win32_middle_mouse) { + if (!(currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON)) { if (dinput_winmouse () >= 0 && isfocus ()) setmousebuttonstate (dinput_winmouse (), 2, 0); } return 0; case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK: - if (currprefs.win32_middle_mouse) { + if (currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON) { activationtoggle(true); } else { if (dinput_winmouse () >= 0 && isfocus () > 0) @@ -1678,7 +1678,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, case WM_SETCURSOR: { - if ((HWND)wParam == hAmigaWnd && currprefs.input_tablet > 0 && currprefs.input_magic_mouse && isfullscreen () <= 0) { + if ((HWND)wParam == hAmigaWnd && currprefs.input_tablet > 0 && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && isfullscreen () <= 0) { if (mousehack_alive ()) { setcursorshape (); return 1; @@ -1912,12 +1912,12 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, switch (nm->code) { /* status bar clicks */ - case NM_CLICK: - case NM_RCLICK: + case NM_CLICK: + case NM_RCLICK: { LPNMMOUSE lpnm = (LPNMMOUSE) lParam; int num = (int)lpnm->dwItemSpec; - int df0 = 8; + int df0 = 9; if (num >= df0 && num <= df0 + 3) { // DF0-DF3 num -= df0; if (nm->code == NM_RCLICK) { @@ -3542,7 +3542,6 @@ void target_default_options (struct uae_prefs *p, int type) { TCHAR buf[MAX_DPATH]; if (type == 2 || type == 0 || type == 3) { - p->win32_middle_mouse = 1; p->win32_logfile = 0; p->win32_active_nocapture_pause = 0; p->win32_active_nocapture_nosound = 0; @@ -3632,7 +3631,7 @@ void target_save_options (struct zfile *f, struct uae_prefs *p) { struct midiportinfo *midp; - cfgfile_target_dwrite_bool (f, _T("middle_mouse"), p->win32_middle_mouse); + cfgfile_target_dwrite_bool (f, _T("middle_mouse"), (p->input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON) != 0); cfgfile_target_dwrite_bool (f, _T("logfile"), p->win32_logfile); cfgfile_target_dwrite_bool (f, _T("map_drives"), p->win32_automount_drives); cfgfile_target_dwrite_bool (f, _T("map_drives_auto"), p->win32_automount_removable); @@ -3798,8 +3797,12 @@ int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR * int i, v; bool tbool; - if (cfgfile_yesno(option, value, _T("middle_mouse"), &p->win32_middle_mouse) - || cfgfile_yesno(option, value, _T("map_drives"), &p->win32_automount_drives) + if (cfgfile_yesno(option, value, _T("middle_mouse"), &tbool)) { + p->input_mouse_untrap |= MOUSEUNTRAP_MIDDLEBUTTON; + return 1; + } + + if (cfgfile_yesno(option, value, _T("map_drives"), &p->win32_automount_drives) || cfgfile_yesno(option, value, _T("map_drives_auto"), &p->win32_automount_removable) || cfgfile_yesno(option, value, _T("map_cd_drives"), &p->win32_automount_cddrives) || cfgfile_yesno(option, value, _T("map_net_drives"), &p->win32_automount_netdrives) diff --git a/od-win32/win32.h b/od-win32/win32.h index a8068171..9fc1bbb0 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -20,12 +20,12 @@ #define LANG_DLL_FULL_VERSION_MATCH 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("7") +#define WINUAEBETA _T("8") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2016, 9, 17) +#define WINUAEDATE MAKEBD(2016, 9, 24) //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 74368efb..c04cf858 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -7,6 +7,8 @@ * Copyright 1997-2000 Brian King */ +#define FORCE16BIT 0 + #include "sysconfig.h" #include @@ -1724,7 +1726,11 @@ static void update_gfxparams (void) #ifdef PICASSO96 } #endif +#if FORCE16BIT + currentmode->current_depth = 16; +#else currentmode->current_depth = currprefs.color_mode < 5 ? 16 : 32; +#endif if (screen_is_picasso && currprefs.win32_rtgmatchdepth && isfullscreen () > 0) { int pbits = picasso96_state.BytesPerPixel * 8; if (pbits <= 8) { @@ -1785,7 +1791,7 @@ static void update_gfxparams (void) if ((currprefs.gfx_size.width != picasso96_state.Width || currprefs.gfx_size.height != picasso96_state.Height) && currprefs.win32_rtgallowscaling) { scalepicasso = 1; } else if (currprefs.gfx_size.width < picasso96_state.Width || currprefs.gfx_size.height < picasso96_state.Height) { - // no always scaling and smaller? Back to normal size + // no always scaling and smaller? Back to normal size and set new configured max size currentmode->current_width = changed_prefs.gfx_size_win.width = picasso96_state.Width; currentmode->current_height = changed_prefs.gfx_size_win.height = picasso96_state.Height; } else if (currprefs.gfx_size.width == picasso96_state.Width || currprefs.gfx_size.height == picasso96_state.Height) { @@ -1818,8 +1824,10 @@ static int open_windows (bool mousecapture) screen_is_initialized = 0; inputdevice_unacquire (); - wait_keyrelease (); reset_sound (); + if (hAmigaWnd == NULL) + wait_keyrelease(); + in_sizemove = 0; updatewinfsmode (&currprefs); @@ -1898,6 +1906,8 @@ static int open_windows (bool mousecapture) if (startpaused) setpaused (1); + statusline_updated(); + started = true; return ret; } @@ -2276,8 +2286,8 @@ int check_prefs_changed_gfx (void) currprefs.keyboard_leds[0] != changed_prefs.keyboard_leds[0] || currprefs.keyboard_leds[1] != changed_prefs.keyboard_leds[1] || currprefs.keyboard_leds[2] != changed_prefs.keyboard_leds[2] || + currprefs.input_mouse_untrap != changed_prefs.input_mouse_untrap || currprefs.win32_minimize_inactive != changed_prefs.win32_minimize_inactive || - currprefs.win32_middle_mouse != changed_prefs.win32_middle_mouse || currprefs.win32_active_capture_priority != changed_prefs.win32_active_capture_priority || currprefs.win32_inactive_priority != changed_prefs.win32_inactive_priority || currprefs.win32_iconified_priority != changed_prefs.win32_iconified_priority || @@ -2297,7 +2307,7 @@ int check_prefs_changed_gfx (void) currprefs.keyboard_leds[0] = changed_prefs.keyboard_leds[0]; currprefs.keyboard_leds[1] = changed_prefs.keyboard_leds[1]; currprefs.keyboard_leds[2] = changed_prefs.keyboard_leds[2]; - currprefs.win32_middle_mouse = changed_prefs.win32_middle_mouse; + currprefs.input_mouse_untrap = changed_prefs.input_mouse_untrap; currprefs.win32_active_capture_priority = changed_prefs.win32_active_capture_priority; currprefs.win32_inactive_priority = changed_prefs.win32_inactive_priority; currprefs.win32_iconified_priority = changed_prefs.win32_iconified_priority; @@ -2764,7 +2774,7 @@ end: #endif } -void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgbfmt) +void gfx_set_picasso_modeinfo (RGBFTYPE rgbfmt) { int need; if (!screen_is_picasso) @@ -4653,6 +4663,11 @@ void updatewinfsmode (struct uae_prefs *p) int rtg_index = -1; +// -2 = default +// -1 = prev +// 0 = chipset +// 1..4 = rtg +// 5 = next bool toggle_rtg (int mode) { int old_index = rtg_index; @@ -4661,15 +4676,23 @@ bool toggle_rtg (int mode) return true; for (;;) { - rtg_index++; + if (mode == -1) { + rtg_index--; + } else if (mode >= 0 && mode <= MAX_RTG_BOARDS) { + rtg_index = mode - 1; + } else { + rtg_index++; + } if (rtg_index >= MAX_RTG_BOARDS) { rtg_index = -1; + } else if (rtg_index < -1) { + rtg_index = MAX_RTG_BOARDS - 1; } if (rtg_index < 0) { if (picasso_on) { gfxboard_rtg_disable(old_index); picasso_requested_on = false; - statusline_add_message(_T("Chipset display")); + statusline_add_message(STATUSTYPE_DISPLAY, _T("Chipset display")); return false; } return false; @@ -4691,22 +4714,27 @@ bool toggle_rtg (int mode) if (mode < -1) return true; gfxboard_rtg_disable(old_index); - picasso_enablescreen(1); // can always switch from RTG to custom if (picasso_requested_on && picasso_on) { picasso_requested_on = false; + rtg_index = -1; return true; } if (picasso_on) return false; // can only switch from custom to RTG if there is some mode active if (picasso_is_active ()) { + picasso_enablescreen(1); picasso_requested_on = true; - statusline_add_message(_T("RTG %d: %s"), rtg_index + 1, _T("UAEGFX")); + statusline_add_message(STATUSTYPE_DISPLAY, _T("RTG %d: %s"), rtg_index + 1, _T("UAEGFX")); return true; } } } + if (mode >= 0 && mode <= MAX_RTG_BOARDS) { + rtg_index = old_index; + return false; + } } return false; } diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 2803e6a0..df4a335f 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -286,6 +286,18 @@ static void hide (HWND hDlg, DWORD id, int hide) static int scsiromselect_table[256]; +static bool getcomboboxtext(HWND hDlg, int id, TCHAR *out, int maxlen) +{ + out[0] = 0; + int posn = SendDlgItemMessage(hDlg, id, CB_GETCURSEL, 0, 0L); + if (posn == CB_ERR) { + GetDlgItemText(hDlg, id, out, maxlen); + return true; + } + SendDlgItemMessage(hDlg, id, CB_GETLBTEXT, posn, (LPARAM)out); + return true; +} + static void gui_add_string(int *table, HWND hDlg, int item, int id, const TCHAR *str) { while (*table >= 0) @@ -4048,8 +4060,10 @@ struct miscentry int ival, imask; }; +static bool win32_middle_mouse_obsolete; + static const struct miscentry misclist[] = { - { 0, 1, _T("Untrap = middle button"), &workprefs.win32_middle_mouse }, + { 0, 1, _T("Untrap = middle button"), &win32_middle_mouse_obsolete }, { 0, 0, _T("Show GUI on startup"), &workprefs.start_gui }, { 0, 1, _T("Use CTRL-F11 to quit"), &workprefs.win32_ctrl_F11_is_quit }, { 0, 1, _T("Don't show taskbar button"), &workprefs.win32_notaskbarbutton }, @@ -4372,6 +4386,8 @@ void InitializeListView (HWND hDlg) int type = me->type; bool checked = false; + win32_middle_mouse_obsolete = (workprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON) != 0; + if (me->b) { checked = *me->b; } else if (me->i) { @@ -10908,6 +10924,9 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) if (checked) *me->i |= me->ival & me->imask; } + workprefs.input_mouse_untrap &= ~MOUSEUNTRAP_MIDDLEBUTTON; + if (win32_middle_mouse_obsolete) + workprefs.input_mouse_untrap |= MOUSEUNTRAP_MIDDLEBUTTON; } } } @@ -12195,6 +12214,21 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, break; case WM_COMMAND: + + if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_KILLFOCUS) { + switch (LOWORD(wParam)) + { + case IDC_PATH_NAME: + getcomboboxtext(hDlg, IDC_PATH_NAME, current_fsvdlg.ci.rootdir, sizeof current_fsvdlg.ci.rootdir / sizeof(TCHAR)); + break; + case IDC_VOLUME_NAME: + GetDlgItemText(hDlg, IDC_VOLUME_NAME, current_fsvdlg.ci.volname, sizeof current_fsvdlg.ci.volname / sizeof(TCHAR)); + break; + case IDC_VOLUME_DEVICE: + GetDlgItemText(hDlg, IDC_VOLUME_DEVICE, current_fsvdlg.ci.devname, sizeof current_fsvdlg.ci.devname / sizeof(TCHAR)); + break; + } + } if (recursive) break; recursive++; @@ -12204,15 +12238,19 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, case IDC_FS_SELECT_EJECT: SetDlgItemText (hDlg, IDC_PATH_NAME, _T("")); SetDlgItemText (hDlg, IDC_VOLUME_NAME, _T("")); + current_fsvdlg.ci.rootdir[0] = 0; + current_fsvdlg.ci.volname[0] = 0; CheckDlgButton (hDlg, IDC_FS_RW, TRUE); ew (hDlg, IDC_FS_RW, TRUE); archivehd = -1; break; case IDC_FS_SELECT_FILE: volumeselectfile (hDlg); + getcomboboxtext(hDlg, IDC_PATH_NAME, current_fsvdlg.ci.rootdir, sizeof current_fsvdlg.ci.rootdir / sizeof(TCHAR)); break; case IDC_FS_SELECT_DIR: volumeselectdir (hDlg, 0); + getcomboboxtext(hDlg, IDC_PATH_NAME, current_fsvdlg.ci.rootdir, sizeof current_fsvdlg.ci.rootdir / sizeof(TCHAR)); break; case IDOK: EndDialog (hDlg, 1); @@ -12222,9 +12260,6 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, break; } } - GetDlgItemText (hDlg, IDC_PATH_NAME, current_fsvdlg.ci.rootdir, sizeof current_fsvdlg.ci.rootdir / sizeof (TCHAR)); - GetDlgItemText (hDlg, IDC_VOLUME_NAME, current_fsvdlg.ci.volname, sizeof current_fsvdlg.ci.volname / sizeof (TCHAR)); - GetDlgItemText (hDlg, IDC_VOLUME_DEVICE, current_fsvdlg.ci.devname, sizeof current_fsvdlg.ci.devname / sizeof (TCHAR)); current_fsvdlg.ci.readonly = !ischecked (hDlg, IDC_FS_RW); current_fsvdlg.ci.bootpri = GetDlgItemInt (hDlg, IDC_VOLUME_BOOTPRI, NULL, TRUE); if(LOWORD (wParam) == IDC_FS_AUTOBOOT) { @@ -12631,20 +12666,18 @@ static INT_PTR CALLBACK TapeDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara customDlg = hDlg; return TRUE; case WM_COMMAND: - if (recursive) - break; - recursive++; if (HIWORD (wParam) == CBN_SELCHANGE || HIWORD (wParam) == CBN_KILLFOCUS) { switch (LOWORD (wParam)) { case IDC_PATH_NAME: - GetDlgItemText (hDlg, IDC_PATH_NAME, tmp, sizeof tmp / sizeof (TCHAR)); - if (_tcscmp (tmp, current_tapedlg.ci.rootdir)) { - _tcscpy (current_tapedlg.ci.rootdir, tmp); - readonly = my_existsfile (current_tapedlg.ci.rootdir); - ew (hDlg, IDC_TAPE_RW, !readonly); - if (readonly) - CheckDlgButton (hDlg, IDC_TAPE_RW, FALSE); + if (getcomboboxtext(hDlg, IDC_PATH_NAME, tmp, sizeof tmp / sizeof(TCHAR))) { + if (_tcscmp (tmp, current_tapedlg.ci.rootdir)) { + _tcscpy (current_tapedlg.ci.rootdir, tmp); + readonly = my_existsfile (current_tapedlg.ci.rootdir); + ew (hDlg, IDC_TAPE_RW, !readonly); + if (readonly) + CheckDlgButton (hDlg, IDC_TAPE_RW, FALSE); + } } break; case IDC_HDF_CONTROLLER: @@ -12667,6 +12700,9 @@ static INT_PTR CALLBACK TapeDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara break; } } + if (recursive) + break; + recursive++; switch (LOWORD (wParam)) { case IDC_TAPE_EJECT: @@ -12793,12 +12829,30 @@ static void set_phys_cyls(HWND hDlg) } } +static void restore_hd_geom(struct uaedev_config_info *dst, struct uaedev_config_info *src) +{ + _tcscpy(dst->filesys, src->filesys); + _tcscpy(dst->devname, src->devname); + dst->controller_type = src->controller_type; + dst->controller_type_unit = src->controller_type_unit; + dst->controller_unit = src->controller_unit; + dst->controller_media_type = src->controller_media_type; + dst->unit_feature_level = src->unit_feature_level; + dst->bootpri = src->bootpri; + dst->readonly = src->readonly; + dst->physical_geometry = src->physical_geometry; + if (src->physical_geometry) { + dst->pcyls = src->pcyls; + dst->pheads = src->pheads; + dst->psecs = src->psecs; + } +} + static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static int recursive = 0; LRESULT res, posn; - TCHAR tmp[MAX_DPATH], fs[MAX_DPATH], dev[MAX_DPATH]; - int hdctrlr, hdunit; + TCHAR tmp[MAX_DPATH]; int v; int *p; @@ -12849,19 +12903,28 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam break; case WM_COMMAND: - if (recursive) - break; - recursive++; if (HIWORD (wParam) == CBN_SELCHANGE || HIWORD (wParam) == CBN_KILLFOCUS) { switch (LOWORD (wParam)) { case IDC_PATH_NAME: - GetDlgItemText (hDlg, IDC_PATH_NAME, tmp, sizeof tmp / sizeof (TCHAR)); - if (_tcscmp (tmp, current_hfdlg.ci.rootdir)) { - _tcscpy (current_hfdlg.ci.rootdir, tmp); - hardfileselecthdf (hDlg, NULL, false); + if (getcomboboxtext(hDlg, IDC_PATH_NAME, tmp, sizeof tmp / sizeof(TCHAR))) { + if (_tcscmp (tmp, current_hfdlg.ci.rootdir)) { + _tcscpy (current_hfdlg.ci.rootdir, tmp); + recursive++; + hardfileselecthdf (hDlg, NULL, false); + recursive--; + } } break; + } + } + + if (recursive) + break; + recursive++; + + if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_KILLFOCUS) { + switch (LOWORD(wParam)) { case IDC_HDF_CONTROLLER: posn = gui_get_string_cursor(hdmenutable, hDlg, IDC_HDF_CONTROLLER); if (posn != CB_ERR) { @@ -12895,8 +12958,12 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam sethardfile(hDlg); } break; + case IDC_PATH_FILESYS: + getcomboboxtext(hDlg, IDC_PATH_FILESYS, current_hfdlg.ci.filesys, sizeof current_hfdlg.ci.filesys / sizeof(TCHAR)); + break; } } + switch (LOWORD (wParam)) { case IDC_HF_SIZE: ew (hDlg, IDC_HF_CREATE, CalculateHardfileSize (hDlg) > 0); @@ -12907,32 +12974,26 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam ew (hDlg, IDC_HF_DOSTYPE, res >= 4); break; case IDC_HF_CREATE: - _tcscpy (fs, current_hfdlg.ci.filesys); - default_hfdlg (¤t_hfdlg, false); - _tcscpy (current_hfdlg.ci.filesys, fs); - hardfilecreatehdf (hDlg, NULL); + { + struct uaedev_config_info citmp; + memcpy(&citmp, ¤t_hfdlg.ci, sizeof citmp); + default_hfdlg (¤t_hfdlg, false); + restore_hd_geom(¤t_hfdlg.ci, &citmp); + hardfilecreatehdf (hDlg, NULL); + } break; case IDC_SELECTOR: { - _tcscpy (fs, current_hfdlg.ci.filesys); - _tcscpy (dev, current_hfdlg.ci.devname); - bool rw = current_hfdlg.ci.readonly; - int bootpri = current_hfdlg.ci.bootpri; - hdctrlr = current_hfdlg.ci.controller_type; - hdunit = current_hfdlg.ci.controller_unit; + struct uaedev_config_info citmp; + memcpy(&citmp, ¤t_hfdlg.ci, sizeof citmp); default_hfdlg (¤t_hfdlg, false); - _tcscpy (current_hfdlg.ci.filesys, fs); - _tcscpy (current_hfdlg.ci.devname, dev); - current_hfdlg.ci.controller_type = hdctrlr; - current_hfdlg.ci.controller_unit = hdunit; - current_hfdlg.ci.bootpri = bootpri; - current_hfdlg.ci.readonly = rw; + restore_hd_geom(¤t_hfdlg.ci, &citmp); hardfileselecthdf (hDlg, NULL, true); } break; case IDC_FILESYS_SELECTOR: DiskSelection (hDlg, IDC_PATH_FILESYS, 12, &workprefs, 0); - GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.ci.filesys, sizeof current_hfdlg.ci.filesys / sizeof (TCHAR)); + getcomboboxtext(hDlg, IDC_PATH_FILESYS, current_hfdlg.ci.filesys, sizeof current_hfdlg.ci.filesys / sizeof(TCHAR)); DISK_history_add(current_hfdlg.ci.filesys, -1, HISTORY_FS, 1); break; case IDOK: @@ -13020,9 +13081,6 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam if (current_hfdlg.ci.bootpri > 127) current_hfdlg.ci.bootpri = 127; break; - case IDC_PATH_FILESYS: - GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.ci.filesys, sizeof current_hfdlg.ci.filesys / sizeof (TCHAR)); - break; case IDC_HARDFILE_DEVICE: GetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.ci.devname, sizeof current_hfdlg.ci.devname / sizeof (TCHAR)); break; @@ -13978,7 +14036,10 @@ static void addallfloppies (HWND hDlg) static void floppysetwriteprotect (HWND hDlg, int n, bool writeprotected) { if (!iscd (n)) { - disk_setwriteprotect (&workprefs, n, workprefs.floppyslots[n].df, writeprotected); + if (disk_setwriteprotect (&workprefs, n, workprefs.floppyslots[n].df, writeprotected)) { + if (!full_property_sheet) + DISK_reinsert(n); + } addfloppytype (hDlg, n); } } @@ -13991,7 +14052,8 @@ static void deletesaveimage (HWND hDlg, int num) p = DISK_get_saveimagepath(workprefs.floppyslots[num].df, -2); if (zfile_exists (p)) { DeleteFile (p); - DISK_reinsert (num); + if (!full_property_sheet) + DISK_reinsert (num); addfloppytype (hDlg, num); } xfree(p); @@ -14682,7 +14744,6 @@ static void updatejoyport (HWND hDlg, int changedport) TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH]; SetDlgItemInt (hDlg, IDC_INPUTSPEEDM, workprefs.input_mouse_speed, FALSE); - CheckDlgButton (hDlg, IDC_PORT_MOUSETRICK, workprefs.input_magic_mouse); SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_SETCURSEL, workprefs.input_magic_mouse_cursor, 0); CheckDlgButton (hDlg, IDC_PORT_TABLET, workprefs.input_tablet > 0); CheckDlgButton (hDlg, IDC_PORT_TABLET_FULL, workprefs.input_tablet == TABLET_REAL); @@ -14762,7 +14823,7 @@ static void values_from_gameportsdlg (HWND hDlg, int d, int changedport) if (success) currprefs.input_mouse_speed = workprefs.input_mouse_speed = i; - currprefs.input_magic_mouse = workprefs.input_magic_mouse = ischecked (hDlg, IDC_PORT_MOUSETRICK); + workprefs.input_mouse_untrap = SendDlgItemMessage(hDlg, IDC_MOUSE_UNTRAPMODE, CB_GETCURSEL, 0, 0L); workprefs.input_magic_mouse_cursor = SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_GETCURSEL, 0, 0L); workprefs.input_autoswitch = ischecked (hDlg, IDC_PORT_AUTOSWITCH); workprefs.input_tablet = 0; @@ -15221,6 +15282,13 @@ static INT_PTR CALLBACK GamePortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP WIN32GUI_LoadUIString (IDS_TABLET_HOST_CURSOR, tmp, MAX_DPATH); SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_ADDSTRING, 0, (LPARAM)tmp); + SendDlgItemMessage(hDlg, IDC_MOUSE_UNTRAPMODE, CB_RESETCONTENT, 0, 0L); + SendDlgItemMessage(hDlg, IDC_MOUSE_UNTRAPMODE, CB_ADDSTRING, 0, (LPARAM)_T("None (Alt-Tab)")); + SendDlgItemMessage(hDlg, IDC_MOUSE_UNTRAPMODE, CB_ADDSTRING, 0, (LPARAM)_T("Middle button")); + SendDlgItemMessage(hDlg, IDC_MOUSE_UNTRAPMODE, CB_ADDSTRING, 0, (LPARAM)_T("Magic mouse")); + SendDlgItemMessage(hDlg, IDC_MOUSE_UNTRAPMODE, CB_ADDSTRING, 0, (LPARAM)_T("Both")); + SendDlgItemMessage(hDlg, IDC_MOUSE_UNTRAPMODE, CB_SETCURSEL, workprefs.input_mouse_untrap, 0); + for (i = 0; i < 2; i++) { int id = i == 0 ? IDC_PORT0_JOYSMODE : IDC_PORT1_JOYSMODE; SendDlgItemMessage (hDlg, id, CB_RESETCONTENT, 0, 0L); diff --git a/od-win32/winuae_msvc14/winuae_msvc.vcxproj b/od-win32/winuae_msvc14/winuae_msvc.vcxproj index ebfc7eb9..21748d3e 100644 --- a/od-win32/winuae_msvc14/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc14/winuae_msvc.vcxproj @@ -1,6 +1,6 @@  - + Debug @@ -704,7 +704,7 @@ Full - OnlyExplicitInline + AnySuitable true Speed true @@ -845,6 +845,7 @@ + @@ -1124,6 +1125,6 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/od-win32/winuae_msvc14/winuae_msvc.vcxproj.filters b/od-win32/winuae_msvc14/winuae_msvc.vcxproj.filters index 8dd17569..ad7a4a76 100644 --- a/od-win32/winuae_msvc14/winuae_msvc.vcxproj.filters +++ b/od-win32/winuae_msvc14/winuae_msvc.vcxproj.filters @@ -820,6 +820,9 @@ support + + common + diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index b08e6766..0d0c2707 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -5,6 +5,35 @@ JIT Direct current rules are less complex now. It automatically switches off onl - RTG VRAM is outside of reserved natmem space. Workaround: Move RTG in earlier position using Hardware info GUI panel. Note that in 64-bit version RTG VRAM must be inside of reserved natmem space. (Outside = error message and return back to GUI) +Beta 8: + +- Do not initiate disk eject+reinsert sequence when changing write protection state that requires saveimage and emulation has not + been started yet. +- Window border DF0:<>N mouse hotspot offset fixed. +- Do not reset HDF parameters when changing hardfile. +- Some combo boxes (text box with select menu) didn't accept select menu selection without also selecting the text first. +- Made "RTG board" support more modularized to enable easier implementation of new boards. END+F9 switching improved. +- Implemented Harlequin frame buffer graphics board emulation. Multiple boards supported simultaneously. Plus revision features + only partially emulated, BT RAMDAC has lots of features that no known Harlequin software use. +- Added show Prev/Next/Native/RTG 1/RTG 2/RTG 3/RTG 4 input events. Old toggle chipset/RTG was renamed to Next display. +- -norawinput now only disables raw hid, keyboard and mouse always use rawinput since 3.3.0. +- Windowed mode statusbar message was only randomly visible when switching modes. +- Currently visible status bar message will be immediately overridden by new message if both messages have same type. +- END+F9 mode switch to programmed mode custom mode was not correctly positioned. +- Expansion Systems Dataflyer Plus SCSI/IDE controller emulated. (Not same as Dataflyer SCSI Plus which is A1200/A4000 IDE port SCSI adapter) +- Moved middle button untrap and "magic mouse" untrap/mouse sync to single select menu in gameports panel. (Misc panel middle + button is kept because it is commonly used but now it only changes gameports option) + +Expansion Systems Dataflyer Plus: +- SCSI-only, IDE-only or SCSI+IDE configuration. +- SCSI is 5380 based, fake DMA (byte wide) +- Boot ROM is basically only a small driver loader, main driver is stored in RDB blocks. +- RDB compatible but can't autoboot from non-Dataflyer partitioned drive. +- It seems IDE partitioned HDF does not work in SCSI controller and vice versa, probably something geometry related that + prevents boot rom to find RDB embedded driver. + +Beta 7: + - CD32 FMV ROM image was not loaded correctly from pre-3.4 config files. - CD32 first CD audio track play attempt from the beginning was confused with TOC subchannel read. - Z2/Z3 autoconfig data first byte's upper 5 bits was not editable. Only low 3 size bits should be forced (board size). @@ -26,7 +55,7 @@ JIT Direct current rules are less complex now. It automatically switches off onl - Disable ROM panel UAE MapROM option if accelerator board emulation is enabled. They are incompatible. - Accelerator boards that required ROM but nothing was selected: crashed during expansion tree building. - DD-only drive + turbo floppy mode + standard ADF HD floppy image: valid MFM was returned. -- Ignore all write attempts if standard ADF HD image in DD-only flpppy drive. +- Ignore all write attempts if standard ADF HD image in DD-only floppy drive. Beta 6: diff --git a/statusline.cpp b/statusline.cpp index 483c5db5..6253716a 100644 --- a/statusline.cpp +++ b/statusline.cpp @@ -303,7 +303,12 @@ void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u } #define MAX_STATUSLINE_QUEUE 8 -static TCHAR *statusline_text[MAX_STATUSLINE_QUEUE]; +struct statusline_struct +{ + TCHAR *text; + int type; +}; +struct statusline_struct statusline_data[MAX_STATUSLINE_QUEUE]; static TCHAR *statusline_text_active; static int statusline_delay; static bool statusline_had_changed; @@ -326,8 +331,8 @@ void statusline_clear(void) statusline_text_active = NULL; statusline_delay = 0; for (int i = 0; i < MAX_STATUSLINE_QUEUE; i++) { - xfree(statusline_text[i]); - statusline_text[i] = NULL; + xfree(statusline_data[i].text); + statusline_data[i].text = NULL; } statusline_update_notification(); } @@ -337,7 +342,7 @@ const TCHAR *statusline_fetch(void) return statusline_text_active; } -void statusline_add_message(const TCHAR *format, ...) +void statusline_add_message(int statustype, const TCHAR *format, ...) { va_list parms; TCHAR buffer[256]; @@ -350,63 +355,77 @@ void statusline_add_message(const TCHAR *format, ...) _vsntprintf(buffer + 1, 256 - 2, format, parms); _tcscat(buffer, _T(" ")); - if (statusline_text[1]) { + for (int i = 0; i < MAX_STATUSLINE_QUEUE; i++) { + if (statusline_data[i].text != NULL && statusline_data[i].type == statustype) { + xfree(statusline_data[i].text); + statusline_data[i].text = NULL; + for (int j = i + 1; j < MAX_STATUSLINE_QUEUE; j++) { + memcpy(&statusline_data[j - 1], &statusline_data[j], sizeof(struct statusline_struct)); + } + statusline_data[MAX_STATUSLINE_QUEUE - 1].text = NULL; + } + } + + if (statusline_data[1].text) { for (int i = 0; i < MAX_STATUSLINE_QUEUE; i++) { - if (statusline_text[i] && !_tcscmp(statusline_text[i], buffer)) { - xfree(statusline_text[i]); + if (statusline_data[i].text && !_tcscmp(statusline_data[i].text, buffer)) { + xfree(statusline_data[i].text); for (int j = i + 1; j < MAX_STATUSLINE_QUEUE; j++) { - statusline_text[j - 1] = statusline_text[j]; + memcpy(&statusline_data[j - 1], &statusline_data[j], sizeof(struct statusline_struct)); } - statusline_text[MAX_STATUSLINE_QUEUE - 1] = NULL; + statusline_data[MAX_STATUSLINE_QUEUE - 1].text = NULL; i = 0; } } - } else if (statusline_text[0]) { - if (!_tcscmp(statusline_text[0], buffer)) + } else if (statusline_data[0].text) { + if (!_tcscmp(statusline_data[0].text, buffer)) return; } for (int i = 0; i < MAX_STATUSLINE_QUEUE; i++) { - if (statusline_text[i] == NULL) { - statusline_text[i] = my_strdup(buffer); + if (statusline_data[i].text == NULL) { + statusline_data[i].text = my_strdup(buffer); + statusline_data[i].type = statustype; if (i == 0) statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1); - statusline_text_active = statusline_text[0]; + statusline_text_active = statusline_data[0].text; statusline_update_notification(); return; } } statusline_text_active = NULL; - xfree(statusline_text[0]); + xfree(statusline_data[0].text); for (int i = 1; i < MAX_STATUSLINE_QUEUE; i++) { - statusline_text[i - 1] = statusline_text[i]; + memcpy(&statusline_data[i - 1], &statusline_data[i], sizeof(struct statusline_struct)); } - statusline_text[MAX_STATUSLINE_QUEUE - 1] = my_strdup(buffer); - statusline_text_active = statusline_text[0]; + statusline_data[MAX_STATUSLINE_QUEUE - 1].text = my_strdup(buffer); + statusline_data[MAX_STATUSLINE_QUEUE - 1].type = statustype; + statusline_text_active = statusline_data[0].text; statusline_update_notification(); + va_end(parms); } void statusline_vsync(void) { - if (!statusline_text[0]) + if (!statusline_data[0].text) return; if (statusline_delay == 0) statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1); if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000 * 1)) statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1); - if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000 * 3) && statusline_text[1]) + if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000 * 3) && statusline_data[1].text) statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 3); statusline_delay--; if (statusline_delay) return; statusline_text_active = NULL; - xfree(statusline_text[0]); + xfree(statusline_data[0].text); for (int i = 1; i < MAX_STATUSLINE_QUEUE; i++) { - statusline_text[i - 1] = statusline_text[i]; + statusline_data[i - 1].text = statusline_data[i].text; } - statusline_text[MAX_STATUSLINE_QUEUE - 1] = NULL; - statusline_text_active = statusline_text[0]; + statusline_data[MAX_STATUSLINE_QUEUE - 1].text = NULL; + statusline_text_active = statusline_data[0].text; statusline_update_notification(); }