From 60821a7de167197ab2759489e0670900d8edd21e Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 28 Oct 2012 18:52:14 +0200 Subject: [PATCH] 2500b22 --- a2091.cpp | 2 +- akiko.cpp | 12 +-- cfgfile.cpp | 43 +++++++--- cia.cpp | 2 +- consolehook.cpp | 2 +- custom.cpp | 5 +- filesys.cpp | 62 ++++++++------ gayle.cpp | 30 ++++--- hardfile.cpp | 18 +++- include/filesys.h | 5 +- include/gayle.h | 6 +- include/options.h | 10 ++- newcpu.cpp | 7 +- od-win32/hardfile_win32.cpp | 28 ++++++- od-win32/mman.cpp | 7 +- od-win32/resources/winuae.rc | 14 ++-- od-win32/win32.cpp | 30 ++++--- od-win32/win32.h | 4 +- od-win32/win32_filesys.cpp | 2 +- od-win32/win32gui.cpp | 155 ++++++++++++++++++++++++----------- od-win32/win32gui.h | 1 + od-win32/win32gui_extra.cpp | 12 +++ od-win32/winuaechangelog.txt | 15 ++++ od-win32/writelog.cpp | 3 +- 24 files changed, 327 insertions(+), 148 deletions(-) diff --git a/a2091.cpp b/a2091.cpp index 27aa3ac9..fb399317 100644 --- a/a2091.cpp +++ b/a2091.cpp @@ -1221,7 +1221,7 @@ int addscsi (int ch, const TCHAR *path, int blocksize, int readonly, freescsi (scsis[ch]); scsis[ch] = NULL; hfd = xcalloc (struct hd_hardfiledata, 1); - if (!hdf_hd_open (hfd, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys)) + if (!hdf_hd_open (hfd, path, blocksize, readonly, devname, 0, sectors, surfaces, reserved, bootpri, filesys, 0, 0, 0)) return 0; hfd->ansi_version = scsi_level; scsis[ch] = scsi_alloc (ch, hfd); diff --git a/akiko.cpp b/akiko.cpp index b902f14f..291dae46 100644 --- a/akiko.cpp +++ b/akiko.cpp @@ -541,7 +541,7 @@ static void subfunc (uae_u8 *data, int cnt) memset (subcodebufferinuse, 0,sizeof (subcodebufferinuse)); subcodebufferoffsetw = subcodebufferoffset = 0; uae_sem_post (&sub_sem); - write_log (_T("CD32: subcode buffer overflow 1\n")); + //write_log (_T("CD32: subcode buffer overflow 1\n")); return; } int offset = subcodebufferoffsetw; @@ -568,6 +568,7 @@ static int statusfunc (int status) return 0; if (status == -2) return 150; +#if 1 if (cdrom_audiostatus != status) { if (status == AUDIO_STATUS_IN_PROGRESS) { cdrom_playing = 1; @@ -578,6 +579,7 @@ static int statusfunc (int status) } } cdrom_audiostatus = status; +#endif return 0; } @@ -806,7 +808,7 @@ static void cdrom_return_data (void) return; #if AKIKO_DEBUG_IO_CMD - write_log (_T("OUT IDX=0x%02X-0x%02X LEN=%d:"), cdcomrxinx, cdcomrxcmp, cdrom_receive_length); + write_log (_T("OUT IDX=0x%02X-0x%02X LEN=%d,%08x:"), cdcomrxinx, cdcomrxcmp, cdrom_receive_length, cmd_buf); #endif if (cdrom_receive_offset < 0) { @@ -835,7 +837,7 @@ static void cdrom_return_data (void) if (cdcomrxinx == cdcomrxcmp) { set_status (CDINTERRUPT_RXDMADONE); #if AKIKO_DEBUG_IO_CMD - write_log (L"RXDMADONE %d/%d\n", cdrom_receive_offset, cdrom_receive_length); + write_log (_T("RXDMADONE %d/%d\n"), cdrom_receive_offset, cdrom_receive_length); #endif } @@ -1012,12 +1014,12 @@ static int cdrom_command_multi (void) write_log (_T("PLAY FROM %06X (%d) to %06X (%d) SCAN=%d\n"), seekpos, msf2lsn (seekpos), endpos, msf2lsn (endpos), scan); #endif + //cdrom_result_buffer[1] |= CDS_PLAYING; cdrom_playing = 1; if (!cd_play_audio (seekpos, endpos, 0)) { // play didn't start, report it in next status packet cdrom_audiotimeout = -3; } - cdrom_result_buffer[1] |= CDS_PLAYING; } else { #if AKIKO_DEBUG_IO_CMD write_log (_T("SEEKTO %06X\n"),seekpos); @@ -1268,7 +1270,7 @@ static void akiko_handler (bool framesync) cdrom_audiotimeout--; if (cdrom_audiotimeout == 1) { // play start cdrom_playing = 1; - ;//cdrom_start_return_data (cdrom_playend_notify (0)); + //cdrom_start_return_data (cdrom_playend_notify (0)); cdrom_audiotimeout = 0; } if (cdrom_audiotimeout == -1) { // play finished (or disk end) diff --git a/cfgfile.cpp b/cfgfile.cpp index 35693fae..7331922c 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -539,6 +539,10 @@ static void write_filesys_config (struct uae_prefs *p, struct zfile *f) uci->devname ? uci->devname : _T(""), str, uci->sectors, uci->surfaces, uci->reserved, uci->blocksize, bp, uci->filesys ? uci->filesys : _T(""), hdcontrollers[uci->controller]); + if (uci->cyls || (uci->pcyls && uci->pheads && uci->psecs)) { + TCHAR *s = tmp + _tcslen (tmp); + _stprintf (s, _T(",%d,%d/%d/%d"), uci->cyls, uci->pcyls, uci->pheads, uci->psecs); + } cfgfile_write_str (f, _T("hardfile2"), tmp); #if 0 _stprintf (tmp2, _T("hardfile=%s,%d,%d,%d,%d,%s"), @@ -2178,10 +2182,11 @@ static struct uaedev_config_info *getuci (struct uae_prefs *p) } struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index, - TCHAR *devname, TCHAR *volname, TCHAR *rootdir, bool readonly, - int secspertrack, int surfaces, int reserved, + const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly, + int cyls, int secspertrack, int surfaces, int reserved, int blocksize, int bootpri, - TCHAR *filesysdir, int hdc, int flags) + const TCHAR *filesysdir, int hdc, int flag, + int pcyls, int psecs, int pheads) { struct uaedev_config_info *uci; int i; @@ -2210,6 +2215,7 @@ struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index, validatedevicename (uci->devname); validatevolumename (uci->volname); uci->readonly = readonly; + uci->cyls = cyls; uci->sectors = secspertrack; uci->surfaces = surfaces; uci->reserved = reserved; @@ -2217,6 +2223,9 @@ struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index, uci->bootpri = bootpri; uci->donotmount = 0; uci->autoboot = 0; + uci->pcyls = pcyls; + uci->pheads = pheads; + uci->psecs = psecs; if (bootpri < -128) uci->donotmount = 1; else if (bootpri >= -127) @@ -2287,7 +2296,8 @@ static int get_filesys_controller (const TCHAR *hdc) static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, bool hdf, TCHAR *value) { - int secs, heads, reserved, bs, bp, hdcv; + int cyls, secs, heads, reserved, bs, bp, hdcv; + int pcyls, pheads, psecs; bool ro; TCHAR *dname = NULL, *aname = _T(""), *root = NULL, *fs = NULL, *hdc; TCHAR *tmpp = _tcschr (value, ','); @@ -2304,8 +2314,9 @@ static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, bool hdf, TCHA ro = false; else goto invalid_fs; - secs = 0; heads = 0; reserved = 0; bs = 0; bp = 0; + cyls = 0,secs = 0; heads = 0; reserved = 0; bs = 0; bp = 0; fs = 0; hdc = 0; hdcv = 0; + pcyls = pheads = psecs = 0; value = tmpp; if (!hdf) { @@ -2348,7 +2359,17 @@ static int cfgfile_parse_newfilesys (struct uae_prefs *p, int nr, bool hdf, TCHA tmpp = _tcschr (tmpp, ','); if (tmpp != 0) { *tmpp++ = 0; - hdcv = get_filesys_controller (tmpp); + TCHAR *tmpp2 = _tcschr (tmpp, ','); + if (tmpp2) + *tmpp2++ = 0; + hdcv = get_filesys_controller (tmpp); + if (tmpp2) { + if (getintval2 (&tmpp2, &cyls, ',')) { + getintval (&tmpp2, &pcyls, '/'); + getintval (&tmpp2, &pheads, '/'); + getintval2 (&tmpp2, &psecs, '/'); + } + } } } } @@ -2361,7 +2382,7 @@ empty_fs: str = cfgfile_subst_path_load (UNEXPANDED, &p->path_hardfile, root, false); } #ifdef FILESYS - add_filesys_config (p, nr, dname, aname, str, ro, secs, heads, reserved, bs, bp, fs, hdcv, 0); + add_filesys_config (p, nr, dname, aname, str, ro, cyls, secs, heads, reserved, bs, bp, fs, hdcv, 0, pcyls, pheads, psecs); #endif xfree (str); return 1; @@ -2467,7 +2488,7 @@ static int cfgfile_parse_filesys (struct uae_prefs *p, const TCHAR *option, TCHA } str = cfgfile_subst_path_load (UNEXPANDED, &p->path_hardfile, root, true); #ifdef FILESYS - add_filesys_config (p, -1, NULL, aname, str, ro, secs, heads, reserved, bs, 0, NULL, 0, 0); + add_filesys_config (p, -1, NULL, aname, str, ro, 0, secs, heads, reserved, bs, 0, NULL, 0, 0, 0, 0, 0); #endif xfree (str); return 1; @@ -3464,7 +3485,7 @@ static void parse_filesys_spec (struct uae_prefs *p, bool readonly, const TCHAR } #endif #ifdef FILESYS - add_filesys_config (p, -1, NULL, buf, s2, readonly, 0, 0, 0, 0, 0, 0, 0, 0); + add_filesys_config (p, -1, NULL, buf, s2, readonly, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); #endif } else { write_log (_T("Usage: [-m | -M] VOLNAME:mount_point\n")); @@ -3493,7 +3514,7 @@ static void parse_hardfile_spec (struct uae_prefs *p, const TCHAR *spec) goto argh; *x4++ = '\0'; #ifdef FILESYS - add_filesys_config (p, -1, NULL, NULL, x4, 0, _tstoi (x0), _tstoi (x1), _tstoi (x2), _tstoi (x3), 0, 0, 0, 0); + add_filesys_config (p, -1, NULL, NULL, x4, 0, 0, _tstoi (x0), _tstoi (x1), _tstoi (x2), _tstoi (x3), 0, 0, 0, 0, 0, 0, 0); #endif free (x0); return; @@ -5033,7 +5054,7 @@ int built_in_chipset_prefs (struct uae_prefs *p) p->cs_rtc = 2; p->cs_fatgaryrev = 0; p->cs_ide = -1; - p->cs_mbdmac = 1; + p->cs_mbdmac = -1; p->cs_ramseyrev = 0x0f; break; case CP_CDTV: // CDTV diff --git a/cia.cpp b/cia.cpp index 56da618f..1560552c 100644 --- a/cia.cpp +++ b/cia.cpp @@ -1553,7 +1553,7 @@ static uae_u32 REGPARAM2 cia_wget (uaecptr addr) #endif if (!isgaylenocia (addr)) - return 0xffffffff; + return v; cia_wait_pre (); switch ((addr >> 12) & 3) diff --git a/consolehook.cpp b/consolehook.cpp index 73225eed..ded4dddb 100644 --- a/consolehook.cpp +++ b/consolehook.cpp @@ -49,7 +49,7 @@ void consolehook_config (struct uae_prefs *p) //p->win32_automount_drives = 2; //p->win32_automount_cddrives = 2; - add_filesys_config (p, -1, _T("DH0"), _T("CLIBOOT"), _T("."), 1, 0, 0, 0, 0, 15, NULL, 0, 0); + add_filesys_config (p, -1, _T("DH0"), _T("CLIBOOT"), _T("."), 1, 0, 0, 0, 0, 0, 15, NULL, 0, 0, 0, 0, 0); } static void *console_thread (void *v) diff --git a/custom.cpp b/custom.cpp index e94b939b..e047aefb 100644 --- a/custom.cpp +++ b/custom.cpp @@ -6978,7 +6978,10 @@ writeonly: } } } else { - v = 0xffff; + if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) + v = 0xffff; + else + v = l; } #if CUSTOM_DEBUG > 0 write_log (_T("%08X read = %04X. Value written=%04X PC=%08x\n"), 0xdff000 | addr, v, l, M68K_GETPC); diff --git a/filesys.cpp b/filesys.cpp index 9e5ea215..eded1b41 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -59,7 +59,7 @@ #endif #define TRACING_ENABLED 1 -int log_filesys; +int log_filesys = 0; #if TRACING_ENABLED #define TRACE(x) if (log_filesys > 0) { write_log x; } @@ -331,7 +331,11 @@ int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo * } } mi->size = ui->hf.virtsize; - mi->nrcyls = (int)(uci->sectors * uci->surfaces ? (ui->hf.virtsize / uci->blocksize) / (uci->sectors * uci->surfaces) : 0); + if (uci->cyls) { + mi->nrcyls = uci->cyls; + } else { + mi->nrcyls = (int)(uci->sectors * uci->surfaces ? (ui->hf.virtsize / uci->blocksize) / (uci->sectors * uci->surfaces) : 0); + } if (!uci->ishdf) return FILESYS_VIRTUAL; if (uci->reserved == 0 && uci->sectors == 0 && uci->surfaces == 0) { @@ -473,10 +477,10 @@ static int set_filesys_volume (const TCHAR *rootdir, int *flags, bool *readonly, } static int set_filesys_unit_1 (int nr, - TCHAR *devname, TCHAR *volname, const TCHAR *rootdir, bool readonly, - int secspertrack, int surfaces, int reserved, + const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly, + int cyls, int secspertrack, int surfaces, int reserved, int blocksize, int bootpri, bool donotmount, bool autoboot, - TCHAR *filesysdir, int hdc, int flags) + const TCHAR *filesysdir, int hdc, int flags) { UnitInfo *ui; int i; @@ -558,7 +562,11 @@ static int set_filesys_unit_1 (int nr, write_log (_T("Hardfile %s too small\n"), ui->hf.device_name); goto err; } - ui->hf.nrcyls = (int)(ui->hf.secspertrack * ui->hf.surfaces ? (ui->hf.virtsize / ui->hf.blocksize) / (ui->hf.secspertrack * ui->hf.surfaces) : 0); + if (cyls) { + ui->hf.nrcyls = cyls; + } else { + ui->hf.nrcyls = (int)(ui->hf.secspertrack * ui->hf.surfaces ? (ui->hf.virtsize / ui->hf.blocksize) / (ui->hf.secspertrack * ui->hf.surfaces) : 0); + } } } ui->self = 0; @@ -590,23 +598,23 @@ err: } static int set_filesys_unit (int nr, - TCHAR *devname, TCHAR *volname, const TCHAR *rootdir, bool readonly, - int secspertrack, int surfaces, int reserved, + const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly, + int cyls, int secspertrack, int surfaces, int reserved, int blocksize, int bootpri, bool donotmount, bool autoboot, - TCHAR *filesysdir, int hdc, int flags) + const TCHAR *filesysdir, int hdc, int flags) { int ret; ret = set_filesys_unit_1 (nr, devname, volname, rootdir, readonly, - secspertrack, surfaces, reserved, blocksize, bootpri, donotmount, autoboot, + cyls, secspertrack, surfaces, reserved, blocksize, bootpri, donotmount, autoboot, filesysdir, hdc, flags); return ret; } -static int add_filesys_unit (TCHAR *devname, TCHAR *volname, const TCHAR *rootdir, bool readonly, - int secspertrack, int surfaces, int reserved, +static int add_filesys_unit (const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly, + int cyls, int secspertrack, int surfaces, int reserved, int blocksize, int bootpri, bool donotmount, bool autoboot, - TCHAR *filesysdir, int hdc, int flags) + const TCHAR *filesysdir, int hdc, int flags) { int ret; @@ -614,7 +622,7 @@ static int add_filesys_unit (TCHAR *devname, TCHAR *volname, const TCHAR *rootdi return -1; ret = set_filesys_unit_1 (-1, devname, volname, rootdir, readonly, - secspertrack, surfaces, reserved, blocksize, + cyls, secspertrack, surfaces, reserved, blocksize, bootpri, donotmount, autoboot, filesysdir, hdc, flags); #ifdef RETROPLATFORM if (ret >= 0) { @@ -685,7 +693,7 @@ static void initialize_mountinfo (void) struct uaedev_config_info *uci = &currprefs.mountconfig[nr]; if (uci->controller == HD_CONTROLLER_UAE) { int idx = set_filesys_unit_1 (-1, uci->devname, uci->ishdf ? NULL : uci->volname, uci->rootdir, - uci->readonly, uci->sectors, uci->surfaces, uci->reserved, + uci->readonly, uci->cyls, uci->sectors, uci->surfaces, uci->reserved, uci->blocksize, uci->bootpri, uci->donotmount, uci->autoboot, uci->filesys, 0, MYVOLUMEINFO_REUSABLE); allocuci (&currprefs, nr, idx); } @@ -702,7 +710,7 @@ static void initialize_mountinfo (void) TCHAR cdname[30]; _stprintf (cdname, _T("CD%d"), i); cd_unit_number++; - int idx = set_filesys_unit_1 (i + cd_unit_offset, cdname, NULL, _T("/"), true, 1, 1, 0, 2048, 0, false, false, NULL, 0, 0); + int idx = set_filesys_unit_1 (i + cd_unit_offset, cdname, NULL, _T("/"), true, 0, 1, 1, 0, 2048, 0, false, false, NULL, 0, 0); allocuci (&currprefs, nr, idx); nr++; } @@ -716,11 +724,11 @@ static void initialize_mountinfo (void) continue; if (uci->controller <= HD_CONTROLLER_IDE3) { gayle_add_ide_unit (uci->controller - HD_CONTROLLER_IDE0, uci->rootdir, uci->blocksize, uci->readonly, - uci->devname, uci->sectors, uci->surfaces, uci->reserved, - uci->bootpri, uci->filesys); + uci->devname, uci->cyls, uci->sectors, uci->surfaces, uci->reserved, + uci->bootpri, uci->filesys, uci->pcyls, uci->pheads, uci->psecs); allocuci (&currprefs, nr, -1); } else if (uci->controller <= HD_CONTROLLER_SCSI6) { - if (currprefs.cs_mbdmac) { + if (currprefs.cs_mbdmac > 0) { #ifdef A2091 a3000_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci->rootdir, uci->blocksize, uci->readonly, uci->devname, uci->sectors, uci->surfaces, uci->reserved, @@ -1359,6 +1367,9 @@ int filesys_insert (int nr, TCHAR *volume, const TCHAR *rootdir, bool readonly, if (!mountertask) return 0; + + write_log (_T("filesys_insert(%d,'%s','%s','%d','%d)\n"), nr, volume ? volume : _T(""), rootdir, readonly, flags); + if (nr < 0) { for (u = units; u; u = u->next) { if (is_virtual (u->unit)) { @@ -1400,6 +1411,8 @@ int filesys_insert (int nr, TCHAR *volume, const TCHAR *rootdir, bool readonly, u->mount_readonly = readonly; u->mount_flags = flags; + write_log (_T("filesys_insert %d done!\n"), nr); + put_byte (u->volume + 172 - 32, -3); // wait for insert uae_Signal (get_long (u->volume + 176 - 32), 1 << 13); @@ -1535,6 +1548,9 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf return 0; if (automountunit >= 0) return -1; + + write_log (_T("filesys_media_change('%s',%d,%p)\n"), rootdir, inserted, uci); + nr = -1; for (u = units; u; u = u->next) { if (is_virtual (u->unit)) { @@ -1603,7 +1619,7 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf _tcscpy (devname, uci->devname); else _stprintf (devname, _T("RDH%d"), nr_units ()); - nr = add_filesys_unit (devname, volptr, rootdir, 0, 0, 0, 0, 0, 0, 0, 1, NULL, 0, MYVOLUMEINFO_REUSABLE); + nr = add_filesys_unit (devname, volptr, rootdir, 0, 0, 0, 0, 0, 0, 0, 0, 1, NULL, 0, MYVOLUMEINFO_REUSABLE); if (nr < 0) return 0; if (inserted > 1) @@ -2772,8 +2788,8 @@ static void return; } TRACE((_T("{ next=0x%lx, mode=%ld, handler=0x%lx, volume=0x%lx, aino %lx "), - get_long (lock) << 2, get_long (lock+8), - get_long (lock+12), get_long (lock+16), + get_long (lock) << 2, get_long (lock + 8), + get_long (lock + 12), get_long (lock + 16), get_long (lock + 4))); a = lookup_aino (unit, get_long (lock + 4)); if (a == 0) { @@ -7547,7 +7563,7 @@ uae_u8 *restore_filesys (uae_u8 *src) volname = NULL; } if (set_filesys_unit (devno, devname, volname, rootdir, readonly, - ui->hf.secspertrack, ui->hf.surfaces, ui->hf.reservedblocks, ui->hf.blocksize, + ui->hf.cylinders, ui->hf.secspertrack, ui->hf.surfaces, ui->hf.reservedblocks, ui->hf.blocksize, bootpri, false, true, filesysdir[0] ? filesysdir : NULL, 0, 0) < 0) { write_log (_T("filesys '%s' failed to restore\n"), rootdir); goto end; diff --git a/gayle.cpp b/gayle.cpp index ac2e2b08..63a015ab 100644 --- a/gayle.cpp +++ b/gayle.cpp @@ -1541,14 +1541,15 @@ static void alloc_ide_mem (struct ide_hdf **ide, int max) } static struct ide_hdf *add_ide_unit (int ch, const TCHAR *path, int blocksize, int readonly, - const TCHAR *devname, int sectors, int surfaces, int reserved, - int bootpri, TCHAR *filesys) + const TCHAR *devname, int cyls, int sectors, int surfaces, int reserved, + int bootpri, const TCHAR *filesys, + int pcyls, int pheads, int psecs) { struct ide_hdf *ide; alloc_ide_mem (idedrive, TOTAL_IDE * 2); ide = idedrive[ch]; - if (!hdf_hd_open (&ide->hdhfd, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys)) + if (!hdf_hd_open (&ide->hdhfd, path, blocksize, readonly, devname, cyls, sectors, surfaces, reserved, bootpri, filesys, pcyls, pheads, psecs)) return NULL; ide->blocksize = blocksize; ide->lba48 = ide->hdhfd.size >= 128 * (uae_u64)0x40000000 ? 1 : 0; @@ -1941,7 +1942,7 @@ static int initpcmcia (const TCHAR *path, int readonly, int type, int reset) if (type == PCMCIA_SRAM) { if (reset) { if (path) - hdf_hd_open (pcmcia_sram, path, 512, readonly, NULL, 0, 0, 0, 0, NULL); + hdf_hd_open (pcmcia_sram, path, 512, readonly, NULL, 0, 0, 0, 0, 0, NULL, 0, 0, 0); } else { pcmcia_sram->hfd.drive_empty = 0; } @@ -1974,7 +1975,7 @@ static int initpcmcia (const TCHAR *path, int readonly, int type, int reset) if (reset) { if (path) - add_ide_unit (PCMCIA_IDE_ID * 2, path, 512, readonly, NULL, 0, 0, 0, 0, NULL); + add_ide_unit (PCMCIA_IDE_ID * 2, path, 512, readonly, NULL, 0, 0, 0, 0, 0, NULL, 0, 0, 0); } pcmcia_common_size = 0; @@ -2252,19 +2253,22 @@ static void dumphdf (struct hardfiledata *hfd) } #endif -int gayle_add_ide_unit (int ch, TCHAR *path, int blocksize, int readonly, - TCHAR *devname, int sectors, int surfaces, int reserved, - int bootpri, TCHAR *filesys) +int gayle_add_ide_unit (int ch, const TCHAR *path, int blocksize, int readonly, const TCHAR *devname, + int cyls, int sectors, int surfaces, int reserved, int bootpri, const TCHAR *filesys, + int pcyls, int pheads, int psecs) { struct ide_hdf *ide; if (ch >= 2 * 2) return -1; - ide = add_ide_unit (ch, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys); + ide = add_ide_unit (ch, path, blocksize, readonly, devname, cyls, sectors, surfaces, reserved, bootpri, filesys, pcyls, pheads, psecs); if (ide == NULL) return 0; - write_log (_T("GAYLE_IDE%d '%s', CHS=%d,%d,%d. %uM. LBA48=%d\n"), - ch, path, ide->hdhfd.cyls, ide->hdhfd.heads, ide->hdhfd.secspertrack, (int)(ide->hdhfd.size / (1024 * 1024)), ide->lba48); + write_log (_T("GAYLE_IDE%d '%s', LCHS=%d/%d/%d. PCHS=%d/%d/%d %uM. LBA48=%d\n"), + ch, path, + ide->hdhfd.cyls, ide->hdhfd.heads, ide->hdhfd.secspertrack, + pcyls, pheads, psecs, + (int)(ide->hdhfd.size / (1024 * 1024)), ide->lba48); ide->type = IDE_GAYLE; //dumphdf (&ide->hdhfd.hfd); return 1; @@ -2460,9 +2464,9 @@ uae_u8 *restore_ide (uae_u8 *src) ide->hdhfd.bootpri = restore_u32 (); if (ide->hdhfd.hfd.virtual_size) gayle_add_ide_unit (num, path, blocksize, readonly, ide->hdhfd.hfd.device_name, - ide->hdhfd.hfd.secspertrack, ide->hdhfd.hfd.heads, ide->hdhfd.hfd.reservedblocks, ide->hdhfd.bootpri, NULL); + 0, ide->hdhfd.hfd.secspertrack, ide->hdhfd.hfd.heads, ide->hdhfd.hfd.reservedblocks, ide->hdhfd.bootpri, NULL, 0, 0, 0); else - gayle_add_ide_unit (num, path, blocksize, readonly, 0, 0, 0, 0, 0, 0); + gayle_add_ide_unit (num, path, blocksize, readonly, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); xfree (path); return src; } diff --git a/hardfile.cpp b/hardfile.cpp index 6199a965..32800cfe 100644 --- a/hardfile.cpp +++ b/hardfile.cpp @@ -365,8 +365,9 @@ void hdf_hd_close (struct hd_hardfiledata *hfd) } int hdf_hd_open (struct hd_hardfiledata *hfd, const TCHAR *path, int blocksize, int readonly, - const TCHAR *devname, int sectors, int surfaces, int reserved, - int bootpri, const TCHAR *filesys) + const TCHAR *devname, int cyls, int sectors, int surfaces, int reserved, + int bootpri, const TCHAR *filesys, + int pcyls, int pheads, int psecs) { memset (hfd, 0, sizeof (struct hd_hardfiledata)); hfd->bootpri = bootpri; @@ -375,12 +376,23 @@ int hdf_hd_open (struct hd_hardfiledata *hfd, const TCHAR *path, int blocksize, if (!hdf_open (&hfd->hfd, path)) return 0; hfd->path = my_strdup(path); + hfd->hfd.cylinders = cyls; hfd->hfd.heads = surfaces; hfd->hfd.reservedblocks = reserved; hfd->hfd.secspertrack = sectors; if (devname) _tcscpy (hfd->hfd.device_name, devname); - getchshd (&hfd->hfd, &hfd->cyls, &hfd->heads, &hfd->secspertrack); + if (pcyls && pheads && psecs) { + hfd->cyls = pcyls; + hfd->heads = pheads; + hfd->secspertrack = psecs; + } else if (cyls && surfaces && sectors) { + hfd->cyls = cyls; + hfd->heads = surfaces; + hfd->secspertrack = sectors; + } else { + getchshd (&hfd->hfd, &hfd->cyls, &hfd->heads, &hfd->secspertrack); + } hfd->cyls_def = hfd->cyls; hfd->secspertrack_def = hfd->secspertrack; hfd->heads_def = hfd->heads; diff --git a/include/filesys.h b/include/filesys.h index e33af5a5..27c4c9fe 100644 --- a/include/filesys.h +++ b/include/filesys.h @@ -127,8 +127,9 @@ extern void hardfile_do_disk_change (struct uaedev_config_info *uci, int insert) void hdf_hd_close(struct hd_hardfiledata *hfd); int hdf_hd_open(struct hd_hardfiledata *hfd, const TCHAR *path, int blocksize, int readonly, - const TCHAR *devname, int sectors, int surfaces, int reserved, - int bootpri, const TCHAR *filesys); + const TCHAR *devname, int cyls, int sectors, int surfaces, int reserved, + int bootpri, const TCHAR *filesys, + int pcyls, int pheads, int psectors); extern int vhd_create (const TCHAR *name, uae_u64 size, uae_u32); diff --git a/include/gayle.h b/include/gayle.h index cf154ce6..234781ab 100644 --- a/include/gayle.h +++ b/include/gayle.h @@ -1,9 +1,9 @@ extern void gayle_reset (int); extern void gayle_hsync (void); -extern int gayle_add_ide_unit (int ch, TCHAR *path, int blocksize, int readonly, - TCHAR *devname, int sectors, int surfaces, int reserved, - int bootpri, TCHAR *filesys); +extern int gayle_add_ide_unit (int ch, const TCHAR *path, int blocksize, int readonly, + const TCHAR *devname, int cyls, int sectors, int surfaces, int reserved, + int bootpri, const TCHAR *filesys, int pcyls, int pheads, int psecs); extern int gayle_modify_pcmcia_sram_unit (const TCHAR *path, int readonly, int insert); extern int gayle_modify_pcmcia_ide_unit (const TCHAR *path, int readonly, int insert); extern int gayle_add_pcmcia_sram_unit (const TCHAR *path, int readonly); diff --git a/include/options.h b/include/options.h index 74332020..7ca2b163 100644 --- a/include/options.h +++ b/include/options.h @@ -116,12 +116,15 @@ struct uaedev_config_info { bool autoboot; bool donotmount; TCHAR filesys[MAX_DPATH]; + int cyls; // zero if detected from size int surfaces; int sectors; int reserved; int blocksize; int configoffset; int controller; + // zero if default + int pcyls, pheads, psecs; }; enum { CP_GENERIC = 1, CP_CDTV, CP_CD32, CP_A500, CP_A500P, CP_A600, CP_A1000, @@ -544,9 +547,10 @@ extern void cfgfile_target_dwrite_str (struct zfile *f, const TCHAR *option, con extern void cfgfile_backup (const TCHAR *path); extern struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index, - TCHAR *devname, TCHAR *volname, TCHAR *rootdir, bool readonly, - int secspertrack, int surfaces, int reserved, - int blocksize, int bootpri, TCHAR *filesysdir, int hdc, int flags); + const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly, + int cyls, int secspertrack, int surfaces, int reserved, + int blocksize, int bootpri, const TCHAR *filesysdir, int hdc, int flags, + int pcyls, int pheads, int psecs); extern void default_prefs (struct uae_prefs *, int); extern void discard_prefs (struct uae_prefs *, int); diff --git a/newcpu.cpp b/newcpu.cpp index 227f1899..f1a606df 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -4502,8 +4502,10 @@ void m68k_go (int may_quit) } #endif set_x_funcs (); - if (startup) + if (startup) { custom_prepare (); + protect_roms (true); + } startup = 0; if (mmu_enabled && !currprefs.cachesize) { run_func = m68k_run_mmu; @@ -4517,10 +4519,9 @@ void m68k_go (int may_quit) currprefs.cpu_model >= 68020 && currprefs.cpu_cycle_exact ? m68k_run_2ce : currprefs.cpu_compatible ? (currprefs.cpu_model <= 68020 ? m68k_run_2p : m68k_run_2pf) : m68k_run_2; } - protect_roms (true); run_func (); - protect_roms (false); } + protect_roms (false); in_m68k_go--; } diff --git a/od-win32/hardfile_win32.cpp b/od-win32/hardfile_win32.cpp index e6e9b2db..93ecb77a 100644 --- a/od-win32/hardfile_win32.cpp +++ b/od-win32/hardfile_win32.cpp @@ -28,6 +28,7 @@ #include // Device guids #include // for SetupDiXxx functions. #include // for SetupDiXxx functions. +#include #endif #include @@ -380,6 +381,30 @@ static void getserial (HANDLE h) } #endif +#if 0 +static void queryidentifydevice (struct hardfiledata *hfd) +{ + DWORD r, size; + uae_u8 *b; + ATA_PASS_THROUGH_EX *ata; + + size = sizeof (ATA_PASS_THROUGH_EX) + 512; + b = xcalloc (uae_u8, size); + ata = (ATA_PASS_THROUGH_EX*)b; + + ata->Length = sizeof ata; + ata->DataTransferLength = 512; + ata->TimeOutValue = 10; + ata->AtaFlags = ATA_FLAGS_DRDY_REQUIRED | ATA_FLAGS_DATA_IN; + ata->CurrentTaskFile[6] = 0xec; + ata->DataBufferOffset = ata->Length; + + if (!DeviceIoControl (hfd->handle->h, IOCTL_ATA_PASS_THROUGH, b, size, b, size, &r, NULL)) { + write_log (_T("IOCTL_ATA_PASS_THROUGH_DIRECT Identify Device failed %d\n"), GetLastError ()); + } +} +#endif + int hdf_open_target (struct hardfiledata *hfd, const TCHAR *pname) { HANDLE h = INVALID_HANDLE_VALUE; @@ -421,8 +446,9 @@ int hdf_open_target (struct hardfiledata *hfd, const TCHAR *pname) hfd->handle->h = h; if (h == INVALID_HANDLE_VALUE) goto end; - if (!DeviceIoControl(h, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, 0, NULL, 0, &r, NULL)) + if (!DeviceIoControl (h, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, 0, NULL, 0, &r, NULL)) write_log (_T("WARNING: '%s' FSCTL_ALLOW_EXTENDED_DASD_IO returned %d\n"), name, GetLastError ()); + //queryidentifydevice (hfd); _tcsncpy (hfd->vendor_id, udi->vendor_id, 8); _tcsncpy (hfd->product_id, udi->product_id, 16); _tcsncpy (hfd->product_rev, udi->product_rev, 4); diff --git a/od-win32/mman.cpp b/od-win32/mman.cpp index a1f22f03..b3a5483e 100644 --- a/od-win32/mman.cpp +++ b/od-win32/mman.cpp @@ -842,8 +842,11 @@ void protect_roms (bool protect) { struct shmid_ds *shm; - if (!currprefs.cachesize || currprefs.comptrustbyte || currprefs.comptrustword || currprefs.comptrustlong) - return; + if (protect) { + // protect only if JIT enabled, always allow unprotect + if (!currprefs.cachesize || currprefs.comptrustbyte || currprefs.comptrustword || currprefs.comptrustlong) + return; + } for (int i = 0; i < MAX_SHMID; i++) { DWORD old; shm = &shmids[i]; diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index a6b45719..8b4e476d 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -214,11 +214,11 @@ BEGIN CONTROL "Fastest possible",IDC_CS_HOST,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,115,18,195,10 CONTROL "Approximate A500/A1200 or cycle-exact",IDC_CS_68000, "Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,115,32,195,10 - CONTROL "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,116,51,192,20 - RTEXT "CPU Speed",IDC_STATIC,115,76,55,9,SS_CENTERIMAGE - EDITTEXT IDC_CPUTEXT,178,75,30,12,ES_CENTER | ES_READONLY - RTEXT "CPU Idle",IDC_STATIC,213,76,62,9 - CONTROL "",IDC_CPUIDLE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,282,71,69,21 + CONTROL "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,116,50,192,20 + RTEXT "CPU Speed",IDC_STATIC,115,78,55,9,SS_CENTERIMAGE + EDITTEXT IDC_CPUTEXT,178,77,30,12,ES_CENTER | ES_READONLY + RTEXT "CPU Idle",IDC_STATIC,213,78,62,9 + CONTROL "",IDC_CPUIDLE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,282,73,69,21 GROUPBOX "Cycle-exact CPU Emulation Speed",IDC_STATIC,110,105,284,55 RTEXT "CPU Frequency",IDC_STATIC,113,129,67,10,SS_CENTERIMAGE COMBOBOX IDC_CPU_FREQUENCY,189,128,46,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -652,8 +652,8 @@ IDD_CHIPSET2 DIALOGEX 0, 0, 396, 288 STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - CONTROL "Compatible Settings",IDC_CS_COMPATIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,8,234,10 - GROUPBOX "Battery Backed Up Real Time Clock",IDC_STATIC,1,24,393,29 + CONTROL "Compatible Settings",IDC_CS_COMPATIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,6,234,10 + GROUPBOX "Battery Backed Up Real Time Clock",IDC_STATIC,1,22,393,31 CONTROL "None",IDC_CS_RTC1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,40,36,81,10 CONTROL "MSM6242B",IDC_CS_RTC2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,129,36,77,10 CONTROL "RF5C01A",IDC_CS_RTC3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,210,36,67,10 diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 1e1aa3f5..1f051009 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -1267,10 +1267,10 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, } SHNOTIFYSTRUCT; TCHAR path[MAX_PATH]; - if (lParam == SHCNE_MEDIAINSERTED || lParam == SHCNE_MEDIAREMOVED) { + if (lParam == SHCNE_MEDIAINSERTED || lParam == SHCNE_DRIVEADD || lParam == SHCNE_MEDIAREMOVED || lParam == SHCNE_DRIVEREMOVED) { SHNOTIFYSTRUCT *shns = (SHNOTIFYSTRUCT*)wParam; if (SHGetPathFromIDList ((struct _ITEMIDLIST *)(shns->dwItem1), path)) { - int inserted = lParam == SHCNE_MEDIAINSERTED ? 1 : 0; + int inserted = lParam == SHCNE_MEDIAINSERTED || lParam == SHCNE_DRIVEADD ? 1 : 0; UINT errormode = SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); write_log (_T("Shell Notification %d '%s'\n"), inserted, path); if (!win32_hardfile_media_change (path, inserted)) { @@ -2309,12 +2309,16 @@ void toggle_mousegrab (void) #define LOG_NORMAL _T("winuaelog.txt") static bool createbootlog = true; +static bool logging_disabled = false; void logging_open (int bootlog, int append) { TCHAR *outpath; TCHAR debugfilename[MAX_DPATH]; + if (logging_disabled && !winuaelog_temporary_enable) + return; + outpath = logpath; debugfilename[0] = 0; #ifndef SINGLEFILE @@ -5222,6 +5226,12 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR return 0; argv2 = WIN32_InitRegistry (argv); + + if (regqueryint (NULL, _T("log_disabled"), &i)) { + if (i) + logging_disabled = true; + } + getstartpaths (); makeverstr (VersionStr); @@ -5589,17 +5599,11 @@ void addnotifications (HWND hwnd, int remove, int isgui) static HDEVNOTIFY hdn; static int wtson; LPITEMIDLIST ppidl; - SHCHANGENOTIFYREGISTER pSHChangeNotifyRegister; - SHCHANGENOTIFYDEREGISTER pSHChangeNotifyDeregister; - pSHChangeNotifyRegister = (SHCHANGENOTIFYREGISTER)GetProcAddress ( - GetModuleHandle (_T("shell32.dll")), "SHChangeNotifyRegister"); - pSHChangeNotifyDeregister = (SHCHANGENOTIFYDEREGISTER)GetProcAddress ( - GetModuleHandle (_T("shell32.dll")), "SHChangeNotifyDeregister"); if (remove) { - if (ret > 0 && pSHChangeNotifyDeregister) - pSHChangeNotifyDeregister (ret); + if (ret > 0) + SHChangeNotifyDeregister (ret); ret = 0; if (hdn) UnregisterDeviceNotification (hdn); @@ -5609,11 +5613,11 @@ void addnotifications (HWND hwnd, int remove, int isgui) wtson = 0; } else { DEV_BROADCAST_DEVICEINTERFACE NotificationFilter = { 0 }; - if(pSHChangeNotifyRegister && SHGetSpecialFolderLocation (hwnd, CSIDL_DESKTOP, &ppidl) == NOERROR) { + if(SHGetSpecialFolderLocation (hwnd, CSIDL_DESKTOP, &ppidl) == NOERROR) { SHChangeNotifyEntry shCNE; shCNE.pidl = ppidl; shCNE.fRecursive = TRUE; - ret = pSHChangeNotifyRegister (hwnd, SHCNE_DISKEVENTS, SHCNE_MEDIAINSERTED | SHCNE_MEDIAREMOVED, + ret = SHChangeNotifyRegister (hwnd, SHCNE_DISKEVENTS, SHCNE_MEDIAINSERTED | SHCNE_MEDIAREMOVED | SHCNE_DRIVEREMOVED | SHCNE_DRIVEADD, WM_USER + 2, 1, &shCNE); } NotificationFilter.dbcc_size = @@ -5968,7 +5972,7 @@ int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL pChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD); #endif - log_open (NULL, 0, 0, NULL); + log_open (NULL, 0, -1, NULL); __try { WinMain2 (hInstance, hPrevInstance, lpCmdLine, nCmdShow); diff --git a/od-win32/win32.h b/od-win32/win32.h index 538e7b35..35eb8c33 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,8 +19,8 @@ #define LANG_DLL 1 //#define WINUAEBETA _T("") -#define WINUAEBETA _T("21") -#define WINUAEDATE MAKEBD(2012, 10, 21) +#define WINUAEBETA _T("22") +#define WINUAEDATE MAKEBD(2012, 10, 28) #define WINUAEEXTRA _T("") //#define WINUAEEXTRA _T("AmiKit Preview") #define WINUAEREV _T("") diff --git a/od-win32/win32_filesys.cpp b/od-win32/win32_filesys.cpp index a3a6c29a..5ede1b01 100644 --- a/od-win32/win32_filesys.cpp +++ b/od-win32/win32_filesys.cpp @@ -203,7 +203,7 @@ void filesys_addexternals (void) } #endif //write_log (_T("Drive type %d: '%s' '%s'\n"), drivetype, volumepath, volumename); - add_filesys_unit (devname[0] ? devname : NULL, volumename, volumepath, !rw, 0, 0, 0, 0, -20 - drvnum, 0, 1, 0, 0, 0); + add_filesys_unit (devname[0] ? devname : NULL, volumename, volumepath, !rw, 0, 0, 0, 0, 0, -20 - drvnum, 0, 1, 0, 0, 0); drvnum++; } /* if drivemask */ dwDriveMask >>= 1; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 7b01d5c7..af31dfbe 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -1770,7 +1770,7 @@ int target_cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int type, i } static int gui_width, gui_height; -static bool gui_resize; +static bool gui_resize_enabled; static bool gui_resize_allowed; // Internal panel max size: 396, 318 @@ -7961,7 +7961,7 @@ static void values_to_miscdlg (HWND hDlg) misc_kbled (hDlg, IDC_KBLED2, workprefs.keyboard_leds[1]); misc_kbled (hDlg, IDC_KBLED3, workprefs.keyboard_leds[2]); CheckDlgButton (hDlg, IDC_KBLED_USB, workprefs.win32_kbledmode); - CheckDlgButton (hDlg, IDC_GUI_RESIZE, gui_resize); + CheckDlgButton (hDlg, IDC_GUI_RESIZE, gui_resize_enabled); ew (hDlg, IDC_GUI_RESIZE, gui_resize_allowed); misc_scsi (hDlg); @@ -8175,8 +8175,9 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) v--; v = 110 - v * 10; } - gui_width = GUI_INTERNAL_WIDTH * v / 100; - gui_height = GUI_INTERNAL_HEIGHT * v / 100; + double m = scaleresource_getdpimult (); + gui_width = (int)(GUI_INTERNAL_WIDTH * v * m / 100); + gui_height = (int)(GUI_INTERNAL_HEIGHT * v * m / 100); scaleresource_setmult (guiDlg, gui_width, gui_height); gui_size_changed = 1; } @@ -8188,7 +8189,7 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) misc_gui_font (hDlg, 1); break; case IDC_GUI_RESIZE: - gui_resize = ischecked (hDlg, IDC_GUI_RESIZE); + gui_resize_enabled = ischecked (hDlg, IDC_GUI_RESIZE); gui_size_changed = 2; break; case IDC_ASSOCIATE_ON: @@ -9091,7 +9092,7 @@ struct hfdlg_vals int sectors; int reserved; int surfaces; - int cylinders; + int cylinders, forcedcylinders; int blocksize; bool rw; bool rdb; @@ -9342,6 +9343,7 @@ static void hardfile_testrdb (HWND hDlg, struct hfdlg_vals *hdf) } if (!memcmp (tmp, "RDSK\0\0\0", 7) || !memcmp (tmp, "DRKS\0\0", 6) || (tmp[0] == 0x53 && tmp[1] == 0x10 && tmp[2] == 0x9b && tmp[3] == 0x13 && tmp[4] == 0 && tmp[5] == 0)) { // RDSK or ADIDE "encoded" RDSK + hdf->cylinders = hdf->forcedcylinders = 0; hdf->sectors = 0; hdf->surfaces = 0; hdf->reserved = 0; @@ -9357,7 +9359,8 @@ static void hardfile_testrdb (HWND hDlg, struct hfdlg_vals *hdf) sethardfile (hDlg); } -static void updatehdfinfo (HWND hDlg, bool force) + +static void updatehdfinfo (HWND hDlg, bool force, bool defaults) { static uae_u64 bsize; static uae_u8 id[512]; @@ -9365,6 +9368,7 @@ static void updatehdfinfo (HWND hDlg, bool force) TCHAR tmp[200], tmp2[200]; TCHAR idtmp[9]; + bsize = 0; if (force) { bool open = false; struct hardfiledata hfd; @@ -9383,15 +9387,15 @@ static void updatehdfinfo (HWND hDlg, bool force) if (i == 16) hdf_read (&hfd, id, 0, 512); } - if (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces) { + if (defaults && current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces) { getchsgeometry_hdf (open ? &hfd : NULL, bsize, ¤t_hfdlg.cylinders, ¤t_hfdlg.surfaces, ¤t_hfdlg.sectors); current_hfdlg.original = 0; } hdf_close (&hfd); } - cyls = 0; - if (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces) { + cyls = current_hfdlg.forcedcylinders; + if (!cyls && current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces) { cyls = bsize / (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces); } blocks = cyls * (current_hfdlg.sectors * current_hfdlg.surfaces); @@ -9419,8 +9423,9 @@ static void updatehdfinfo (HWND hDlg, bool force) } } _tcscat (tmp, tmp2); + if (hDlg != NULL) + SetDlgItemText (hDlg, IDC_HDFINFO, tmp); } - SetDlgItemText (hDlg, IDC_HDFINFO, tmp); } static void hardfileselecthdf (HWND hDlg, TCHAR *newpath) @@ -9430,7 +9435,7 @@ static void hardfileselecthdf (HWND hDlg, TCHAR *newpath) fullpath (current_hfdlg.filename, sizeof current_hfdlg.filename / sizeof (TCHAR)); inithardfile (hDlg); hardfile_testrdb (hDlg, ¤t_hfdlg); - updatehdfinfo (hDlg, true); + updatehdfinfo (hDlg, true, true); sethardfile (hDlg); } @@ -9457,6 +9462,7 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam LRESULT res, posn; TCHAR tmp[MAX_DPATH], fs[MAX_DPATH], dev[MAX_DPATH]; int hdctrlr; + int v; switch (msg) { case WM_DROPFILES: @@ -9468,7 +9474,7 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam inithardfile (hDlg); sethardfile (hDlg); sethfdostype (hDlg, 0); - updatehdfinfo (hDlg, true); + updatehdfinfo (hDlg, true, false); setac (hDlg, IDC_PATH_NAME); recursive--; customDlgType = IDD_HARDFILE; @@ -9571,24 +9577,49 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam current_hfdlg.donotmount = 0; sethardfile (hDlg); break; + case IDC_SECTORS: + v = current_hfdlg.sectors; + current_hfdlg.sectors = GetDlgItemInt (hDlg, IDC_SECTORS, NULL, FALSE); + if (v != current_hfdlg.sectors) + updatehdfinfo (hDlg, true, false); + break; + case IDC_RESERVED: + current_hfdlg.reserved = GetDlgItemInt (hDlg, IDC_RESERVED, NULL, FALSE); + break; + case IDC_HEADS: + v = current_hfdlg.surfaces; + current_hfdlg.surfaces = GetDlgItemInt (hDlg, IDC_HEADS, NULL, FALSE); + if (v != current_hfdlg.surfaces) + updatehdfinfo (hDlg, true, false); + break; + case IDC_BLOCKSIZE: + v = current_hfdlg.blocksize; + current_hfdlg.blocksize = GetDlgItemInt (hDlg, IDC_BLOCKSIZE, NULL, FALSE); + if (v != current_hfdlg.blocksize) + updatehdfinfo (hDlg, true, false); + break; + case IDC_HARDFILE_BOOTPRI: + current_hfdlg.bootpri = GetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, NULL, TRUE); + break; + case IDC_PATH_FILESYS: + GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.fsfilename, sizeof current_hfdlg.fsfilename / sizeof (TCHAR)); + break; + case IDC_HARDFILE_DEVICE: + GetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.devicename, sizeof current_hfdlg.devicename / sizeof (TCHAR)); + break; + case IDC_HDF_CONTROLLER: + posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0); + if (posn != CB_ERR) + current_hfdlg.controller = posn; + break; + case IDC_PATH_NAME: + GetDlgItemText (hDlg, IDC_PATH_NAME, tmp, sizeof tmp / sizeof (TCHAR)); + if (_tcscmp (tmp, current_hfdlg.filename)) { + _tcscpy (current_hfdlg.filename, tmp); + updatehdfinfo (hDlg, true, false); + } + break; } - - current_hfdlg.sectors = GetDlgItemInt (hDlg, IDC_SECTORS, NULL, FALSE); - current_hfdlg.reserved = GetDlgItemInt (hDlg, IDC_RESERVED, NULL, FALSE); - current_hfdlg.surfaces = GetDlgItemInt (hDlg, IDC_HEADS, NULL, FALSE); - current_hfdlg.blocksize = GetDlgItemInt (hDlg, IDC_BLOCKSIZE, NULL, FALSE); - current_hfdlg.bootpri = GetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, NULL, TRUE); - GetDlgItemText (hDlg, IDC_PATH_NAME, tmp, sizeof tmp / sizeof (TCHAR)); - if (_tcscmp (tmp, current_hfdlg.filename)) { - _tcscpy (current_hfdlg.filename, tmp); - updatehdfinfo (hDlg, true); - } - GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.fsfilename, sizeof current_hfdlg.fsfilename / sizeof (TCHAR)); - GetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.devicename, sizeof current_hfdlg.devicename / sizeof (TCHAR)); - posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0); - if (posn != CB_ERR) - current_hfdlg.controller = posn; - updatehdfinfo (hDlg, false); recursive--; break; @@ -9697,7 +9728,7 @@ static void new_filesys (HWND hDlg, int entry) int bp = tweakbootpri (current_fsvdlg.bootpri, current_fsvdlg.autoboot, current_fsvdlg.donotmount); uci = add_filesys_config (&workprefs, entry, current_fsvdlg.device, current_fsvdlg.volume, - current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, bp, 0, 0, 0); + current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, 0, bp, 0, 0, 0, 0, 0, 0); if (uci) { if (uci->rootdir[0]) filesys_media_change (uci->rootdir, 1, uci); @@ -9713,10 +9744,11 @@ static void new_hardfile (HWND hDlg, int entry) uci = add_filesys_config (&workprefs, entry, current_hfdlg.devicename, 0, current_hfdlg.filename, ! current_hfdlg.rw, - current_hfdlg.sectors, current_hfdlg.surfaces, + 0, current_hfdlg.sectors, current_hfdlg.surfaces, current_hfdlg.reserved, current_hfdlg.blocksize, bp, current_hfdlg.fsfilename, - current_hfdlg.controller, 0); + current_hfdlg.controller, 0, + 0, 0, 0); if (uci) hardfile_do_disk_change (uci, 1); } @@ -9726,8 +9758,9 @@ static void new_harddrive (HWND hDlg, int entry) struct uaedev_config_info *uci; uci = add_filesys_config (&workprefs, entry, 0, 0, - current_hfdlg.filename, ! current_hfdlg.rw, 0, 0, - 0, current_hfdlg.blocksize, 0, 0, current_hfdlg.controller, 0); + current_hfdlg.filename, ! current_hfdlg.rw, 0, 0, 0, + 0, current_hfdlg.blocksize, 0, 0, current_hfdlg.controller, 0, + 0, 0, 0); if (uci) hardfile_do_disk_change (uci, 1); } @@ -9765,6 +9798,7 @@ static void harddisk_edit (HWND hDlg) if(type == FILESYS_HARDFILE || type == FILESYS_HARDFILE_RDB) { + current_hfdlg.forcedcylinders = uci->cyls; current_hfdlg.sectors = uci->sectors; current_hfdlg.surfaces = uci->surfaces; current_hfdlg.reserved = uci->reserved; @@ -14912,7 +14946,8 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) if (customDlgType == IDD_HARDFILE) { _tcscpy (current_hfdlg.filename, file); SetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename); - updatehdfinfo (customDlg, true); + updatehdfinfo (customDlg, true, true); + sethardfile (customDlg); continue; } @@ -14930,7 +14965,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) diskswapper_addfile (prefs, file); } else if (currentpage == HARDDISK_ID) { add_filesys_config (&workprefs, -1, NULL, _T(""), file, 0, - 0, 0, 0, 0, 0, NULL, 0, 0); + 0, 0, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0); } else { drv = floppyslot_addfile (prefs, file, drv, firstdrv, i); if (drv < 0) @@ -14955,15 +14990,22 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) do_filesys_insert (file); else add_filesys_config (&workprefs, -1, NULL, _T(""), file, 0, - 0, 0, 0, 0, 0, NULL, 0, 0); + 0, 0, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0); } else { + current_hfdlg.forcedcylinders = 0; + current_hfdlg.sectors = 32; + current_hfdlg.surfaces = 1; + current_hfdlg.blocksize = 512; + _tcscpy (current_hfdlg.filename, file); + updatehdfinfo (NULL, true, true); add_filesys_config (&workprefs, -1, NULL, NULL, file, 0, - 32, 1, 2, 512, 0, NULL, 0, 0); + 0, current_hfdlg.sectors, current_hfdlg.surfaces, 2, current_hfdlg.blocksize, 0, NULL, 0, 0, + 0, 0, 0); } break; case ZFILE_HDFRDB: add_filesys_config (&workprefs, -1, NULL, NULL, file, 0, - 0, 0, 0, 512, 0, NULL, 0, 0); + 0, 0, 0, 0, 512, 0, NULL, 0, 0, 0, 0, 0); break; case ZFILE_NVR: _tcscpy (prefs->flashfile, file); @@ -14993,7 +15035,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) do_filesys_insert (file); } else if (currentpage == HARDDISK_ID) { add_filesys_config (&workprefs, -1, NULL, _T(""), file, 0, - 0, 0, 0, 0, 0, NULL, 0, 0); + 0, 0, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0); if (!full_property_sheet) do_filesys_insert (file); } else { @@ -15024,7 +15066,7 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l { case WM_SIZING: { - if (!recursive && gui_resize_allowed) { + if (!recursive && gui_resize_enabled) { RECT *r = (RECT*)lParam; if (r->right - r->left < MIN_GUI_INTERNAL_WIDTH) r->right = r->left + MIN_GUI_INTERNAL_WIDTH; @@ -15035,13 +15077,13 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l break; } case WM_ENTERSIZEMOVE: - if (!recursive && gui_resize_allowed) { + if (!recursive && gui_resize_enabled) { getguisize (hDlg, &oldwidth, &oldheight); return FALSE; } break; case WM_EXITSIZEMOVE: - if (!recursive && gui_resize_allowed) { + if (!recursive && gui_resize_enabled) { int w, h; getguisize (hDlg, &w, &h); if (w != oldwidth || h != oldheight) { @@ -15443,9 +15485,11 @@ static int GetSettings (int all_options, HWND hwnd) int fmultx = 0, fmulty = 0; for (;;) { int v = 0; + int regexists; setdefaultguisize (); - regqueryint (NULL, _T("GUIResize"), &v); - gui_resize_allowed = gui_resize = v != 0; + regexists = regqueryint (NULL, _T("GUIResize"), &v); + gui_resize_allowed = true; + gui_resize_enabled = v != 0; if (full_property_sheet || isfullscreen () == 0) { regqueryint (NULL, _T("GUISizeX"), &gui_width); regqueryint (NULL, _T("GUISizeY"), &gui_height); @@ -15459,11 +15503,22 @@ static int GetSettings (int all_options, HWND hwnd) regqueryint (NULL, _T("GUISizeFSY"), &gui_height); scaleresource_init (_T("FS")); } - if (gui_width < 100 || gui_width > 4096 || gui_height < 100 || gui_height > 4096) { + if (!regexists) { scaleresource_setdefaults (); setdefaultguisize (); + double m = scaleresource_getdpimult (); + gui_width = (int)(gui_width * m); + gui_height = (int)(gui_height * m); fmultx = 0; - write_log (_T("GUI size reset\n")); + write_log (_T("GUI default size\n")); + regsetint (NULL, _T("GUIResize"), 0); + } else { + if (gui_width < 100 || gui_width > 4096 || gui_height < 100 || gui_height > 4096) { + scaleresource_setdefaults (); + setdefaultguisize (); + fmultx = 0; + write_log (_T("GUI size reset\n")); + } } if (all_options || !configstore) @@ -15488,7 +15543,7 @@ static int GetSettings (int all_options, HWND hwnd) } } - tres = scaleresource (panelresource, hwnd, gui_resize_allowed); + tres = scaleresource (panelresource, hwnd, gui_resize_enabled); dhwnd = CreateDialogIndirect (tres->inst, tres->resource, hwnd, DialogProc); dialog_rect.top = dialog_rect.left = 0; dialog_rect.right = tres->width; @@ -15592,7 +15647,7 @@ static int GetSettings (int all_options, HWND hwnd) regsetint (NULL, _T("GUISizeFSX"), gui_width); regsetint (NULL, _T("GUISizeFSY"), gui_height); } - regsetint (NULL, _T("GUIResize"), gui_resize ? 1 : 0); + regsetint (NULL, _T("GUIResize"), gui_resize_enabled ? 1 : 0); gui_size_changed = 0; quit_program = 0; } diff --git a/od-win32/win32gui.h b/od-win32/win32gui.h index 7adb5741..6fab491e 100644 --- a/od-win32/win32gui.h +++ b/od-win32/win32gui.h @@ -43,5 +43,6 @@ extern void scaleresource_init (const TCHAR*); extern int scaleresource_choosefont (HWND hDlg, int fonttype); extern void scaleresource_setdefaults (void); extern void scaleresource_setfont (HWND hDlg); +extern double scaleresource_getdpimult (void); #endif diff --git a/od-win32/win32gui_extra.cpp b/od-win32/win32gui_extra.cpp index a546bfcf..eca82a00 100644 --- a/od-win32/win32gui_extra.cpp +++ b/od-win32/win32gui_extra.cpp @@ -406,6 +406,18 @@ void scaleresource_setdefaults (void) static int lpx, lpy; +double scaleresource_getdpimult (void) +{ + HDC hdc = GetDC (NULL); + int m = GetDeviceCaps (hdc, LOGPIXELSY); + ReleaseDC (NULL, hdc); + if (m > 96) { + m -= 96; + return 1.0 + m / 250.0; + } + return 1.0; +} + void scaleresource_init (const TCHAR *prefix) { if (os_vista) diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 9b13e1f9..a7a7efae 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,6 +1,21 @@ - restore only single input target to default. +Beta 22: + +- "Generic" Amiga model incorrectly enabled A3000 DMAC emulation which caused most programs that require UAE Boot ROM in + normal 0xF00000 area to crash. (Old bug, b20 adv.chipset caused it to appear much more commonly) +- Disable ROM protection when switching JIT off on the fly. +- Dragging standard HDF to Hardfiles panel sets correct default geometry. +- Added logical cylinder value to HDF config data, default is zero = calculate from size of the HDF (same as previously) +- Added "physical" CHS values to HDF config data, can be used to override autogenerared IDE emulation CHS values. + (append ",logical cyls,C/H/S" to hardfile2 config entry. No GUI support.) +- GUI resize button was permanently disabled after it was unticked once. +- log_disabled=1 in registry (DWORD) or ini disables winuaebootlog.txt. +- Check DPI value when selecting default GUI size. +- CD32 audio emulation update, Guardian CD32 (and possible some others) had muted audio since b1. Immediate reply + to CD play command should not have "play active" bit set. It should be only set in later status packets. + Beta 21: - Use software volume also in WASAPI non-exclusive because WASAPI main volume control also affects waveOut used by CD audio. diff --git a/od-win32/writelog.cpp b/od-win32/writelog.cpp index 73631989..6b9f48f7 100644 --- a/od-win32/writelog.cpp +++ b/od-win32/writelog.cpp @@ -572,7 +572,6 @@ FILE *log_open (const TCHAR *name, int append, int bootlog, TCHAR *outpath) } } } - bootlogmode = bootlog; } else if (1) { TCHAR *c = GetCommandLine (); if (_tcsstr (c, _T(" -console"))) { @@ -585,7 +584,7 @@ FILE *log_open (const TCHAR *name, int append, int bootlog, TCHAR *outpath) } } } - + bootlogmode = bootlog; return f; } -- 2.47.3