From: Toni Wilen Date: Tue, 3 Aug 2010 15:50:09 +0000 (+0300) Subject: 2300b9 X-Git-Tag: 2300~15 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=3649b6782b23d8b8261ba1311c2aed9acf54ce13;p=francis%2Fwinuae.git 2300b9 --- diff --git a/akiko.cpp b/akiko.cpp index 06a292ff..b0b26e46 100644 --- a/akiko.cpp +++ b/akiko.cpp @@ -456,8 +456,9 @@ static void cdaudiostop_do (void) static void cdaudiostop (void) { - cdrom_playing = 0; + cdrom_audiotimeout = 0; cdrom_paused = 0; + cdrom_playing = 0; write_comm_pipe_u32 (&requests, 0x0104, 1); } @@ -543,7 +544,7 @@ static int cd_play_audio (int startlsn, int endlsn, int scan) if (!cdrom_toc_cd_buffer.points) return 0; - for (i = 0; i < cdrom_toc_cd_buffer.points; i++) { + for (i = cdrom_toc_cd_buffer.first_track_offset; i <= cdrom_toc_cd_buffer.last_track_offset; i++) { s = &cdrom_toc_cd_buffer.toc[i]; addr = s->paddress; if (s->track > 0 && s->track < 100 && addr >= startlsn) @@ -557,6 +558,7 @@ static int cd_play_audio (int startlsn, int endlsn, int scan) endlsn = s->paddress; return 0; } + qcode_valid = 0; last_play_end = endlsn; cdrom_audiotimeout = 0; cdrom_paused = 0; @@ -579,6 +581,9 @@ static int cd_qcode (uae_u8 *d) last_play_pos = 0; buf = qcode_buf; as = buf[1]; + buf[2] = 0x80; + if (!qcode_valid) + return 0; if (cdrom_playing) // fake it! as = AUDIO_STATUS_IN_PROGRESS; if (as != AUDIO_STATUS_IN_PROGRESS && as != AUDIO_STATUS_PAUSED && as != AUDIO_STATUS_PLAY_COMPLETE && as != AUDIO_STATUS_NO_STATUS) /* audio status ok? */ @@ -587,6 +592,7 @@ static int cd_qcode (uae_u8 *d) last_play_pos = msf2lsn (fromlongbcd (s + 7)); if (!d) return 0; + buf[2] = 0; /* ??? */ d[0] = 0; /* CtlAdr */ @@ -614,6 +620,8 @@ static int cd_qcode (uae_u8 *d) d[10] = tobcd ((uae_u8)(msf >> 0)); } } +// write_log (L"%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X\n", +// d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11]); return 0; } @@ -869,11 +877,11 @@ static int cdrom_command_multi (void) write_log (L"PLAY FROM %06X (%d) to %06X (%d) SCAN=%d\n", seekpos, msf2lsn (seekpos), endpos, msf2lsn (endpos), scan); #endif + cdrom_playing = 1; + cdrom_result_buffer[1] |= CDS_PLAYING; if (!cd_play_audio (seekpos, endpos, 0)) { - cdrom_result_buffer[1] = CDS_ERROR; - } else { - cdrom_playing = 1; - cdrom_result_buffer[1] |= CDS_PLAYING; + // play didn't start, report it in next status packet + cdrom_audiotimeout = -3; } } else { #if AKIKO_DEBUG_IO_CMD @@ -887,10 +895,10 @@ static int cdrom_command_multi (void) return 2; } -static int cdrom_playend_notify (void) +static int cdrom_playend_notify (int err) { cdrom_result_buffer[0] = 4; - cdrom_result_buffer[1] = 0x80; + cdrom_result_buffer[1] = err ? 0x80 : 0x00; return 2; } @@ -1093,7 +1101,11 @@ static void akiko_handler (void) } } if (cdrom_audiotimeout == -2 && qcode_buf[1] != AUDIO_STATUS_IN_PROGRESS) { - cdrom_start_return_data (cdrom_playend_notify ()); + cdrom_start_return_data (cdrom_playend_notify (0)); + cdrom_audiotimeout = 0; + } + if (cdrom_audiotimeout == -3) { + cdrom_start_return_data (cdrom_playend_notify (1)); cdrom_audiotimeout = 0; } @@ -1616,7 +1628,7 @@ void akiko_reset (void) cdcomtxinx = 0; cdcomrxinx = 0; cdcomtxcmp = 0; - lastmediastate = 0; + lastmediastate = -1; } cdrom_led = 0; cdrom_receive_started = 0; diff --git a/audio.cpp b/audio.cpp index b9f0c203..dbaecb1f 100644 --- a/audio.cpp +++ b/audio.cpp @@ -204,8 +204,10 @@ void audio_sampleripper (int mode) rs->changed = 0; fetch_ripperpath (path, sizeof (path)); name[0] = 0; - if (currprefs.dfxtype[0] >= 0) - _tcscpy (name, currprefs.df[0]); + if (currprefs.floppyslots[0].dfxtype >= 0) + _tcscpy (name, currprefs.floppyslots[0].df); + else if (currprefs.cdslots[0].inuse) + _tcscpy (name, currprefs.cdslots[0].name); if (!name[0]) underline[0] = 0; namesplit (name); diff --git a/blkdev.cpp b/blkdev.cpp index 7a06304e..390b1f4a 100644 --- a/blkdev.cpp +++ b/blkdev.cpp @@ -20,11 +20,14 @@ #include "rp.h" #endif +#define PRE_INSERT_DELAY (3 * (currprefs.ntscmode ? 60 : 50)) + static int scsiemu[MAX_TOTAL_SCSI_DEVICES]; static struct device_functions *device_func[MAX_TOTAL_SCSI_DEVICES]; static int openlist[MAX_TOTAL_SCSI_DEVICES]; static int waspaused[MAX_TOTAL_SCSI_DEVICES], wasslow[MAX_TOTAL_SCSI_DEVICES]; +static int delayed[MAX_TOTAL_SCSI_DEVICES]; /* convert minutes, seconds and frames -> logical sector number */ int msf2lsn (int msf) @@ -232,9 +235,50 @@ static int sys_command_open_internal (int unitnum, const TCHAR *ident, cd_standa return ret; } -int get_standard_cd_unit (enum cd_standard_unit csu) +static int getunitinfo (int unitnum, int drive, cd_standard_unit csu, int *isaudio) +{ + struct device_info di; + if (sys_command_info (unitnum, &di, 0)) { + write_log (L"Scanning drive %s: ", di.label); + if (di.media_inserted) { + if (isaudiotrack (&di.toc, 0)) { + if (*isaudio == 0) + *isaudio = drive; + write_log (L"CDA"); + } + uae_u8 buffer[2048]; + if (sys_command_cd_read (unitnum, buffer, 16, 1)) { + if (!memcmp (buffer + 8, "CDTV", 4) || !memcmp (buffer + 8, "CD32", 4)) { + uae_u32 crc; + write_log (L"CD32 or CDTV"); + if (sys_command_cd_read (unitnum, buffer, 21, 1)) { + crc = get_crc32 (buffer, sizeof buffer); + if (crc == 0xe56c340f) { + write_log (L" [CD32.TM]"); + if (csu == CD_STANDARD_UNIT_CD32) { + write_log (L"\n"); + return 1; + } + } + } + if (csu == CD_STANDARD_UNIT_CDTV || csu == CD_STANDARD_UNIT_CD32) { + write_log (L"\n"); + return 1; + } + } + } + } else { + write_log (L"no media"); + } + } + write_log (L"\n"); + return 0; +} + +static int get_standard_cd_unit2 (cd_standard_unit csu) { int unitnum = 0; + int isaudio = 0; if (currprefs.cdslots[unitnum].name[0] || currprefs.cdslots[unitnum].inuse) { device_func_init (SCSI_UNIT_IOCTL); if (!sys_command_open_internal (unitnum, currprefs.cdslots[unitnum].name, csu)) { @@ -242,9 +286,9 @@ int get_standard_cd_unit (enum cd_standard_unit csu) if (!sys_command_open_internal (unitnum, currprefs.cdslots[unitnum].name, csu)) goto fallback; } + getunitinfo (unitnum, 0, csu, &isaudio); return unitnum; } - int isaudio = 0; device_func_init (SCSI_UNIT_IOCTL); for (int drive = 'C'; drive <= 'Z'; ++drive) { TCHAR vol[100]; @@ -252,41 +296,8 @@ int get_standard_cd_unit (enum cd_standard_unit csu) int drivetype = GetDriveType (vol); if (drivetype == DRIVE_CDROM) { if (sys_command_open_internal (unitnum, vol, csu)) { - struct device_info di; - write_log (L"Scanning drive %s: ", vol); - if (sys_command_info (unitnum, &di, 0)) { - if (di.media_inserted) { - if (isaudiotrack (&di.toc, 0)) { - if (isaudio == 0) - isaudio = drive; - write_log (L"CDA"); - } - uae_u8 buffer[2048]; - if (sys_command_cd_read (unitnum, buffer, 16, 1)) { - if (!memcmp (buffer + 8, "CDTV", 4) || !memcmp (buffer + 8, "CD32", 4)) { - uae_u32 crc; - write_log (L"CD32 or CDTV"); - if (sys_command_cd_read (unitnum, buffer, 21, 1)) { - crc = get_crc32 (buffer, sizeof buffer); - if (crc == 0xe56c340f) { - write_log (L" [CD32.TM]"); - if (csu == CD_STANDARD_UNIT_CD32) { - write_log (L"\n"); - return unitnum; - } - } - } - if (csu == CD_STANDARD_UNIT_CDTV || csu == CD_STANDARD_UNIT_CD32) { - write_log (L"\n"); - return unitnum; - } - } - } - } else { - write_log (L"no media"); - } - } - write_log (L"\n"); + if (getunitinfo (unitnum, drive, csu, &isaudio)) + return unitnum; sys_command_close (unitnum); } } @@ -305,6 +316,19 @@ fallback: } return unitnum; } + +int get_standard_cd_unit (cd_standard_unit csu) +{ + int unitnum = get_standard_cd_unit2 (csu); + if (unitnum < 0) + return -1; + delayed[unitnum] = 0; + if (currprefs.cdslots[unitnum].delayed) { + delayed[unitnum] = PRE_INSERT_DELAY; + } + return unitnum; +} + void close_standard_cd_unit (int unitnum) { sys_command_close (unitnum); @@ -390,6 +414,16 @@ static void check_changes (int unitnum) { bool changed = false; + if (device_func[unitnum] == NULL) + return; + + if (delayed[unitnum]) { + delayed[unitnum]--; + if (delayed[unitnum] == 0) + write_log (L"CD: startup delayed insert '%s'\n", currprefs.cdslots[unitnum].name[0] ? currprefs.cdslots[unitnum].name : L""); + return; + } + if (_tcscmp (changed_prefs.cdslots[unitnum].name, currprefs.cdslots[unitnum].name) != 0) changed = true; if (!changed && changed_prefs.cdslots[unitnum].name[0] == 0 && changed_prefs.cdslots[unitnum].inuse != currprefs.cdslots[unitnum].inuse) @@ -676,6 +710,8 @@ int sys_command_ismedia (int unitnum, int quick) { if (failunit (unitnum)) return -1; + if (delayed[unitnum]) + return 0; if (device_func[unitnum] == NULL) { uae_u8 cmd[6] = { 0, 0, 0, 0, 0, 0 }; return do_scsi (unitnum, cmd, sizeof cmd); @@ -688,7 +724,10 @@ struct device_info *sys_command_info (int unitnum, struct device_info *di, int q { if (failunit (unitnum)) return NULL; - return device_func[unitnum]->info (unitnum, di, quick); + struct device_info *di2 = device_func[unitnum]->info (unitnum, di, quick); + if (di2 && delayed[unitnum]) + di2->media_inserted = 0; + return di2; } #define MODE_SELECT_6 0x15 diff --git a/cfgfile.cpp b/cfgfile.cpp index d72fcc89..75bbdbfe 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -144,7 +144,7 @@ static const TCHAR *lorestype1[] = { L"lores", L"hires", L"superhires" }; static const TCHAR *lorestype2[] = { L"true", L"false" }; static const TCHAR *loresmode[] = { L"normal", L"filtered", 0 }; #ifdef GFXFILTER -static const TCHAR *filtermode2[] = { L"0x", L"1x", L"2x", L"3x", L"4x", 0 }; +static const TCHAR *filtermode2[] = { L"1x", L"2x", L"3x", L"4x", 0 }; #endif static const TCHAR *cartsmode[] = { L"none", L"hrtmon", 0 }; static const TCHAR *idemode[] = { L"none", L"a600/a1200", L"a4000", 0 }; @@ -543,19 +543,19 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) p->nr_floppies = 4; for (i = 0; i < 4; i++) { - str = cfgfile_subst_path (p->path_floppy, UNEXPANDED, p->df[i]); + str = cfgfile_subst_path (p->path_floppy, UNEXPANDED, p->floppyslots[i].df); _stprintf (tmp, L"floppy%d", i); cfgfile_write_str (f, tmp, str); xfree (str); _stprintf (tmp, L"floppy%dtype", i); - cfgfile_dwrite (f, tmp, L"%d", p->dfxtype[i]); + cfgfile_dwrite (f, tmp, L"%d", p->floppyslots[i].dfxtype); _stprintf (tmp, L"floppy%dsound", i); - cfgfile_dwrite (f, tmp, L"%d", p->dfxclick[i]); - if (p->dfxclick[i] < 0 && p->dfxclickexternal[i][0]) { + cfgfile_dwrite (f, tmp, L"%d", p->floppyslots[i].dfxclick); + if (p->floppyslots[i].dfxclick < 0 && p->floppyslots[i].dfxclickexternal[0]) { _stprintf (tmp, L"floppy%dsoundext", i); - cfgfile_dwrite (f, tmp, p->dfxclickexternal[i]); + cfgfile_dwrite (f, tmp, p->floppyslots[i].dfxclickexternal); } - if (p->dfxtype[i] < 0 && p->nr_floppies > i) + if (p->floppyslots[i].dfxtype < 0 && p->nr_floppies > i) p->nr_floppies = i; } for (i = 0; i < MAX_SPARE_DRIVES; i++) { @@ -570,9 +570,15 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) TCHAR tmp2[MAX_DPATH]; _stprintf (tmp, L"cdimage%d", i); _tcscpy (tmp2, p->cdslots[i].name); - if (p->cdslots[i].type != SCSI_UNIT_DEFAULT || _tcschr (p->cdslots[i].name, ',')) { + if (p->cdslots[i].type != SCSI_UNIT_DEFAULT || _tcschr (p->cdslots[i].name, ',') || p->cdslots[i].delayed) { _tcscat (tmp2, L","); - _tcscat (tmp2, cdmodes[p->cdslots[i].type + 1]); + if (p->cdslots[i].delayed) { + _tcscat (tmp2, L"delay"); + _tcscat (tmp2, L":"); + } + if (p->cdslots[i].type != SCSI_UNIT_DEFAULT) { + _tcscat (tmp2, cdmodes[p->cdslots[i].type + 1]); + } } cfgfile_write_str (f, tmp, tmp2); } @@ -722,29 +728,13 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) uf = &uaefilters[i]; if (uf->type == p->gfx_filter) { cfgfile_dwrite_str (f, L"gfx_filter", uf->cfgname); - if (uf->type == p->gfx_filter) { - if (uf->x[0]) { - cfgfile_dwrite_str (f, L"gfx_filter_mode", filtermode2[1]); - } else { - int mt[4], i = 0; - if (uf->x[1]) - mt[i++] = 1; - if (uf->x[2]) - mt[i++] = 2; - if (uf->x[3]) - mt[i++] = 3; - if (uf->x[4]) - mt[i++] = 4; - cfgfile_dwrite (f, L"gfx_filter_mode", L"%dx", mt[p->gfx_filter_filtermode]); - } - } } i++; } } else { cfgfile_dwrite (f, L"gfx_filter", L"no"); } - + cfgfile_dwrite_str (f, L"gfx_filter_mode", filtermode2[p->gfx_filter_filtermode]); cfgfile_dwrite (f, L"gfx_filter_vert_zoom", L"%d", p->gfx_filter_vert_zoom); cfgfile_dwrite (f, L"gfx_filter_horiz_zoom", L"%d", p->gfx_filter_horiz_zoom); cfgfile_dwrite (f, L"gfx_filter_vert_zoom_mult", L"%d", p->gfx_filter_vert_zoom_mult); @@ -1152,22 +1142,36 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) TCHAR tmp[20]; _stprintf (tmp, L"cdimage%d", i); if (!_tcsicmp (option, tmp)) { + p->cdslots[i].delayed = false; TCHAR *next = _tcsrchr (value, ','); int type = SCSI_UNIT_DEFAULT; int mode = 0; int unitnum = 0; - if (next) { + for (;;) { + if (!next) + break; *next++ = 0; TCHAR *next2 = _tcschr (next, ':'); if (next2) *next2++ = 0; int tmpval = 0; + if (!_tcsicmp (next, L"delay")) { + p->cdslots[i].delayed = true; + next = next2; + if (!next) + break; + next2 = _tcschr (next, ':'); + if (next2) + *next2++ = 0; + } type = match_string (cdmodes, next); if (type < 0) type = SCSI_UNIT_DEFAULT; else type--; next = next2; + if (!next) + break; next2 = _tcschr (next, ':'); if (next2) *next2++ = 0; @@ -1175,12 +1179,14 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) if (mode < 0) mode = 0; next = next2; + if (!next) + break; next2 = _tcschr (next, ':'); if (next2) *next2++ = 0; cfgfile_intval (option, next, tmp, &unitnum, 1); } - _tcsncpy (p->cdslots[i].name, value, sizeof p->cdslots[i].name); + _tcsncpy (p->cdslots[i].name, value, sizeof p->cdslots[i].name / sizeof (TCHAR)); p->cdslots[i].name[sizeof p->cdslots[i].name - 1] = 0; p->cdslots[i].inuse = true; p->cdslots[i].type = type; @@ -1248,18 +1254,18 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_intval (option, value, L"gfx_gamma", &p->gfx_gamma, 1) || cfgfile_string (option, value, L"gfx_filter_mask", p->gfx_filtermask, sizeof p->gfx_filtermask / sizeof (TCHAR)) #endif - || cfgfile_intval (option, value, L"floppy0sound", &p->dfxclick[0], 1) - || cfgfile_intval (option, value, L"floppy1sound", &p->dfxclick[1], 1) - || cfgfile_intval (option, value, L"floppy2sound", &p->dfxclick[2], 1) - || cfgfile_intval (option, value, L"floppy3sound", &p->dfxclick[3], 1) + || cfgfile_intval (option, value, L"floppy0sound", &p->floppyslots[0].dfxclick, 1) + || cfgfile_intval (option, value, L"floppy1sound", &p->floppyslots[1].dfxclick, 1) + || cfgfile_intval (option, value, L"floppy2sound", &p->floppyslots[2].dfxclick, 1) + || cfgfile_intval (option, value, L"floppy3sound", &p->floppyslots[3].dfxclick, 1) || cfgfile_intval (option, value, L"floppy_channel_mask", &p->dfxclickchannelmask, 1) || cfgfile_intval (option, value, L"floppy_volume", &p->dfxclickvolume, 1)) return 1; - if (cfgfile_path (option, value, L"floppy0soundext", p->dfxclickexternal[0], sizeof p->dfxclickexternal[0] / sizeof (TCHAR)) - || cfgfile_path (option, value, L"floppy1soundext", p->dfxclickexternal[1], sizeof p->dfxclickexternal[1] / sizeof (TCHAR)) - || cfgfile_path (option, value, L"floppy2soundext", p->dfxclickexternal[2], sizeof p->dfxclickexternal[2] / sizeof (TCHAR)) - || cfgfile_path (option, value, L"floppy3soundext", p->dfxclickexternal[3], sizeof p->dfxclickexternal[3] / sizeof (TCHAR)) + if (cfgfile_path (option, value, L"floppy0soundext", p->floppyslots[0].dfxclickexternal, sizeof p->floppyslots[0].dfxclickexternal / sizeof (TCHAR)) + || cfgfile_path (option, value, L"floppy1soundext", p->floppyslots[1].dfxclickexternal, sizeof p->floppyslots[1].dfxclickexternal / sizeof (TCHAR)) + || cfgfile_path (option, value, L"floppy2soundext", p->floppyslots[2].dfxclickexternal, sizeof p->floppyslots[2].dfxclickexternal / sizeof (TCHAR)) + || cfgfile_path (option, value, L"floppy3soundext", p->floppyslots[3].dfxclickexternal, sizeof p->floppyslots[3].dfxclickexternal / sizeof (TCHAR)) || cfgfile_string (option, value, L"gfx_display_name", p->gfx_display_name, sizeof p->gfx_display_name / sizeof (TCHAR)) || cfgfile_string (option, value, L"config_info", p->info, sizeof p->info / sizeof (TCHAR)) || cfgfile_string (option, value, L"config_description", p->description, sizeof p->description / sizeof (TCHAR))) @@ -1414,37 +1420,10 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) return 1; } if (_tcscmp (option, L"gfx_filter_mode") == 0) { - p->gfx_filter_filtermode = 0; - if (p->gfx_filter > 0) { - struct uae_filter *uf; - int i = 0; - while(uaefilters[i].name) { - uf = &uaefilters[i]; - if (uf->type == p->gfx_filter) { - if (!uf->x[0]) { - int mt[4], j; - i = 0; - if (uf->x[1]) - mt[i++] = 1; - if (uf->x[2]) - mt[i++] = 2; - if (uf->x[3]) - mt[i++] = 3; - if (uf->x[4]) - mt[i++] = 4; - cfgfile_strval (option, value, L"gfx_filter_mode", &i, filtermode2, 0); - for (j = 0; j < i; j++) { - if (mt[j] == i) - p->gfx_filter_filtermode = j; - } - } - break; - } - i++; - } - } + cfgfile_strval (option, value, L"gfx_filter_mode", &p->gfx_filter_filtermode, filtermode2, 0); return 1; } + if (cfgfile_string (option, value, L"gfx_filter_aspect_ratio", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) { int v1, v2; TCHAR *s; @@ -1909,10 +1888,10 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va || cfgfile_intval (option, value, L"floppy_random_bits_min", &p->floppy_random_bits_min, 1) || cfgfile_intval (option, value, L"floppy_random_bits_max", &p->floppy_random_bits_max, 1) || cfgfile_intval (option, value, L"nr_floppies", &p->nr_floppies, 1) - || cfgfile_intval (option, value, L"floppy0type", &p->dfxtype[0], 1) - || cfgfile_intval (option, value, L"floppy1type", &p->dfxtype[1], 1) - || cfgfile_intval (option, value, L"floppy2type", &p->dfxtype[2], 1) - || cfgfile_intval (option, value, L"floppy3type", &p->dfxtype[3], 1) + || cfgfile_intval (option, value, L"floppy0type", &p->floppyslots[0].dfxtype, 1) + || cfgfile_intval (option, value, L"floppy1type", &p->floppyslots[1].dfxtype, 1) + || cfgfile_intval (option, value, L"floppy2type", &p->floppyslots[2].dfxtype, 1) + || cfgfile_intval (option, value, L"floppy3type", &p->floppyslots[3].dfxtype, 1) || cfgfile_intval (option, value, L"maprom", &p->maprom, 1) || cfgfile_intval (option, value, L"parallel_autoflush", &p->parallel_autoflush_time, 1) || cfgfile_intval (option, value, L"uae_hide", &p->uae_hide, 1) @@ -1968,7 +1947,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va for (i = 0; i < 4; i++) { _stprintf (tmpbuf, L"floppy%d", i); - if (cfgfile_path (option, value, tmpbuf, p->df[i], sizeof p->df[i] / sizeof (TCHAR))) + if (cfgfile_path (option, value, tmpbuf, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof (TCHAR))) return 1; } @@ -2544,7 +2523,7 @@ static int cfgfile_load_2 (struct uae_prefs *p, const TCHAR *filename, bool real } for (i = 0; i < 4; i++) - subst (p->path_floppy, p->df[i], sizeof p->df[i] / sizeof (TCHAR)); + subst (p->path_floppy, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof (TCHAR)); subst (p->path_rom, p->romfile, sizeof p->romfile / sizeof (TCHAR)); subst (p->path_rom, p->romextfile, sizeof p->romextfile / sizeof (TCHAR)); @@ -2896,10 +2875,10 @@ int parse_cmdline_option (struct uae_prefs *p, TCHAR c, const TCHAR *arg) switch (c) { case 'h': usage (); exit (0); - case '0': cmdpath (p->df[0], arg, 255); break; - case '1': cmdpath (p->df[1], arg, 255); break; - case '2': cmdpath (p->df[2], arg, 255); break; - case '3': cmdpath (p->df[3], arg, 255); break; + case '0': cmdpath (p->floppyslots[0].df, arg, 255); break; + case '1': cmdpath (p->floppyslots[1].df, arg, 255); break; + case '2': cmdpath (p->floppyslots[2].df, arg, 255); break; + case '3': cmdpath (p->floppyslots[3].df, arg, 255); break; case 'r': cmdpath (p->romfile, arg, 255); break; case 'K': cmdpath (p->romextfile, arg, 255); break; case 'p': _tcsncpy (p->prtname, arg, 255); p->prtname[255] = 0; break; @@ -3432,8 +3411,8 @@ static void default_prefs_mini (struct uae_prefs *p, int type) _tcscpy (p->description, L"UAE default A500 configuration"); p->nr_floppies = 1; - p->dfxtype[0] = DRV_35_DD; - p->dfxtype[1] = DRV_NONE; + p->floppyslots[0].dfxtype = DRV_35_DD; + p->floppyslots[1].dfxtype = DRV_NONE; p->cpu_model = 68000; p->address_space_24 = 1; p->chipmem_size = 0x00080000; @@ -3601,10 +3580,10 @@ void default_prefs (struct uae_prefs *p, int type) p->gfx_filter_keep_aspect = 0; p->gfx_filter_autoscale = 0; - _tcscpy (p->df[0], L"df0.adf"); - _tcscpy (p->df[1], L"df1.adf"); - _tcscpy (p->df[2], L"df2.adf"); - _tcscpy (p->df[3], L"df3.adf"); + _tcscpy (p->floppyslots[0].df, L"df0.adf"); + _tcscpy (p->floppyslots[1].df, L"df1.adf"); + _tcscpy (p->floppyslots[2].df, L"df2.adf"); + _tcscpy (p->floppyslots[3].df, L"df3.adf"); configure_rom (p, roms, 0); _tcscpy (p->romextfile, L""); @@ -3649,10 +3628,10 @@ void default_prefs (struct uae_prefs *p, int type) p->custom_memory_sizes[1] = 0; p->nr_floppies = 2; - p->dfxtype[0] = DRV_35_DD; - p->dfxtype[1] = DRV_35_DD; - p->dfxtype[2] = DRV_NONE; - p->dfxtype[3] = DRV_NONE; + p->floppyslots[0].dfxtype = DRV_35_DD; + p->floppyslots[1].dfxtype = DRV_35_DD; + p->floppyslots[2].dfxtype = DRV_NONE; + p->floppyslots[3].dfxtype = DRV_NONE; p->floppy_speed = 100; p->floppy_write_length = 0; p->floppy_random_bits_min = 1; @@ -3713,12 +3692,12 @@ static void buildin_default_prefs (struct uae_prefs *p) { buildin_default_host_prefs (p); - p->dfxtype[0] = DRV_35_DD; + p->floppyslots[0].dfxtype = DRV_35_DD; if (p->nr_floppies != 1 && p->nr_floppies != 2) p->nr_floppies = 2; - p->dfxtype[1] = p->nr_floppies >= 2 ? DRV_35_DD : DRV_NONE; - p->dfxtype[2] = DRV_NONE; - p->dfxtype[3] = DRV_NONE; + p->floppyslots[1].dfxtype = p->nr_floppies >= 2 ? DRV_35_DD : DRV_NONE; + p->floppyslots[2].dfxtype = DRV_NONE; + p->floppyslots[3].dfxtype = DRV_NONE; p->floppy_speed = 100; p->fpu_model = 0; @@ -3855,7 +3834,7 @@ static int bip_a3000 (struct uae_prefs *p, int config, int compa, int romcheck) p->immediate_blits = 0; p->produce_sound = 2; p->cachesize = 8192; - p->dfxtype[0] = DRV_35_HD; + p->floppyslots[0].dfxtype = DRV_35_HD; p->floppy_speed = 0; p->cpu_idle = 150; p->cs_compatible = CP_A3000; @@ -3887,8 +3866,8 @@ static int bip_a4000 (struct uae_prefs *p, int config, int compa, int romcheck) p->immediate_blits = 0; p->produce_sound = 2; p->cachesize = 8192; - p->dfxtype[0] = DRV_35_HD; - p->dfxtype[1] = DRV_35_HD; + p->floppyslots[0].dfxtype = DRV_35_HD; + p->floppyslots[1].dfxtype = DRV_35_HD; p->floppy_speed = 0; p->cpu_idle = 150; p->cs_compatible = CP_A4000; @@ -3919,8 +3898,8 @@ static int bip_a4000t (struct uae_prefs *p, int config, int compa, int romcheck) p->immediate_blits = 0; p->produce_sound = 2; p->cachesize = 8192; - p->dfxtype[0] = DRV_35_HD; - p->dfxtype[1] = DRV_35_HD; + p->floppyslots[0].dfxtype = DRV_35_HD; + p->floppyslots[1].dfxtype = DRV_35_HD; p->floppy_speed = 0; p->cpu_idle = 150; p->cs_compatible = CP_A4000T; @@ -3940,7 +3919,7 @@ static int bip_a1000 (struct uae_prefs *p, int config, int compa, int romcheck) p->bogomem_size = 0; p->sound_filter = FILTER_SOUND_ON; set_68000_compa (p, compa); - p->dfxtype[1] = DRV_NONE; + p->floppyslots[1].dfxtype = DRV_NONE; p->cs_compatible = CP_A1000; p->cs_slowmemisfast = 1; p->cs_dipagnus = 1; @@ -3976,10 +3955,10 @@ static int bip_cdtv (struct uae_prefs *p, int config, int compa, int romcheck) p->cs_cdtvcard = 64; p->cs_rtc = 1; p->nr_floppies = 0; - p->dfxtype[0] = DRV_NONE; + p->floppyslots[0].dfxtype = DRV_NONE; if (config > 0) - p->dfxtype[0] = DRV_35_DD; - p->dfxtype[1] = DRV_NONE; + p->floppyslots[0].dfxtype = DRV_35_DD; + p->floppyslots[1].dfxtype = DRV_NONE; set_68000_compa (p, compa); p->cs_compatible = CP_CDTV; built_in_chipset_prefs (p); @@ -4011,8 +3990,8 @@ static int bip_cd32 (struct uae_prefs *p, int config, int compa, int romcheck) } p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 1; p->nr_floppies = 0; - p->dfxtype[0] = DRV_NONE; - p->dfxtype[1] = DRV_NONE; + p->floppyslots[0].dfxtype = DRV_NONE; + p->floppyslots[1].dfxtype = DRV_NONE; set_68020_compa (p, compa, 1); p->cs_compatible = CP_CD32; built_in_chipset_prefs (p); @@ -4112,7 +4091,7 @@ static int bip_a500 (struct uae_prefs *p, int config, int compa, int romcheck) p->bogomem_size = 0; p->chipset_mask = 0; p->cs_rtc = 0; - p->dfxtype[1] = DRV_NONE; + p->floppyslots[1].dfxtype = DRV_NONE; break; case 4: // KS 1.2, OCS Agnus, 0.5M Chip roms[0] = 5; @@ -4121,7 +4100,7 @@ static int bip_a500 (struct uae_prefs *p, int config, int compa, int romcheck) p->bogomem_size = 0; p->chipset_mask = 0; p->cs_rtc = 0; - p->dfxtype[1] = DRV_NONE; + p->floppyslots[1].dfxtype = DRV_NONE; break; case 5: // KS 1.2, OCS Agnus, 0.5M Chip + 0.5M Slow roms[0] = 5; @@ -4160,8 +4139,8 @@ static int bip_super (struct uae_prefs *p, int config, int compa, int romcheck) p->immediate_blits = 1; p->produce_sound = 2; p->cachesize = 8192; - p->dfxtype[0] = DRV_35_HD; - p->dfxtype[1] = DRV_35_HD; + p->floppyslots[0].dfxtype = DRV_35_HD; + p->floppyslots[1].dfxtype = DRV_35_HD; p->floppy_speed = 0; p->cpu_idle = 150; p->scsi = 1; @@ -4186,8 +4165,8 @@ static int bip_arcadia (struct uae_prefs *p, int config, int compa, int romcheck p->chipset_mask = 0; p->cs_rtc = 0; p->nr_floppies = 0; - p->dfxtype[0] = DRV_NONE; - p->dfxtype[1] = DRV_NONE; + p->floppyslots[0].dfxtype = DRV_NONE; + p->floppyslots[1].dfxtype = DRV_NONE; set_68000_compa (p, compa); p->cs_compatible = CP_A500; built_in_chipset_prefs (p); @@ -4219,7 +4198,7 @@ static int bip_arcadia (struct uae_prefs *p, int config, int compa, int romcheck int built_in_prefs (struct uae_prefs *p, int model, int config, int compa, int romcheck) { - int v = 0, i; + int v = 0; buildin_default_prefs (p); switch (model) @@ -4261,10 +4240,6 @@ int built_in_prefs (struct uae_prefs *p, int model, int config, int compa, int r v = bip_super (p, config, compa, romcheck); break; } - for (i = 0; i < 4; i++) { - if (p->dfxtype[i] < 0) - p->df[i][0] = DRV_35_DD; - } return v; } diff --git a/consolehook.cpp b/consolehook.cpp index c8897d4a..a492556f 100644 --- a/consolehook.cpp +++ b/consolehook.cpp @@ -40,7 +40,7 @@ void consolehook_config (struct uae_prefs *p) p->fastmem_size = 0x00800000; p->bogomem_size = 0; p->nr_floppies = 1; - p->dfxtype[1] = DRV_NONE; + p->floppyslots[1].dfxtype = DRV_NONE; p->floppy_speed = 0; p->start_gui = 0; p->gfx_size_win.width = 320; diff --git a/custom.cpp b/custom.cpp index 4a995fcc..d42f8464 100644 --- a/custom.cpp +++ b/custom.cpp @@ -5620,9 +5620,9 @@ static void hsync_handler (void) } while (input_recording < 0 && inprec_pstart (INPREC_DISKINSERT)) { int drv = inprec_pu8 (); - inprec_pstr (currprefs.df[drv]); - _tcscpy (changed_prefs.df[drv], currprefs.df[drv]); - disk_insert_force (drv, currprefs.df[drv]); + inprec_pstr (currprefs.floppyslots[drv].df); + _tcscpy (changed_prefs.floppyslots[drv].df, currprefs.floppyslots[drv].df); + disk_insert_force (drv, currprefs.floppyslots[drv].df); inprec_pend (); } diff --git a/debug.cpp b/debug.cpp index 7e67ff08..cbb05e57 100644 --- a/debug.cpp +++ b/debug.cpp @@ -2050,7 +2050,7 @@ void memwatch_dump2 (TCHAR *buf, int bufsize, int num) struct memwatch_node *mwn; if (buf) - memset (buf, 0, bufsize); + memset (buf, 0, bufsize * sizeof (TCHAR)); for (i = 0; i < MEMWATCH_TOTAL; i++) { if ((num >= 0 && num == i) || (num < 0)) { mwn = &mwnodes[i]; diff --git a/disk.cpp b/disk.cpp index 8778c7bb..2ef4e976 100644 --- a/disk.cpp +++ b/disk.cpp @@ -515,7 +515,7 @@ static TCHAR *drive_id_name(drive *drv) */ static void drive_settype_id (drive *drv) { - int t = currprefs.dfxtype[drv - &floppy[0]]; + int t = currprefs.floppyslots[drv - &floppy[0]].dfxtype; switch (t) { @@ -571,13 +571,13 @@ static void drive_image_free (drive *drv) static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname); -static void reset_drive_gui (int i) +static void reset_drive_gui (int num) { - gui_data.drive_disabled[i] = 0; - gui_data.df[i][0] = 0; - gui_data.crc32[i] = 0; - if (currprefs.dfxtype[i] < 0) - gui_data.drive_disabled[i] = 1; + gui_data.drive_disabled[num] = 0; + gui_data.df[num][0] = 0; + gui_data.crc32[num] = 0; + if (currprefs.floppyslots[num].dfxtype < 0) + gui_data.drive_disabled[num] = 1; } static void setamax (void) @@ -600,33 +600,33 @@ static void setamax (void) #endif } -static void reset_drive (int i) +static void reset_drive (int num) { - drive *drv = &floppy[i]; + drive *drv = &floppy[num]; drv->amax = 0; drive_image_free (drv); drv->motoroff = 1; - disabled &= ~(1 << i); - if (currprefs.dfxtype[i] < 0) - disabled |= 1 << i; - reset_drive_gui(i); + disabled &= ~(1 << num); + if (currprefs.floppyslots[num].dfxtype < 0) + disabled |= 1 << num; + reset_drive_gui (num); /* most internal Amiga floppy drives won't enable * diskready until motor is running at full speed * and next indexsync has been passed */ drv->indexhackmode = 0; - if (i == 0 && currprefs.dfxtype[i] == 0) + if (num == 0 && currprefs.floppyslots[num].dfxtype == 0) drv->indexhackmode = 1; drv->dskchange_time = 0; drv->buffered_cyl = -1; drv->buffered_side = -1; - gui_led (i + LED_DF0, 0); + gui_led (num + LED_DF0, 0); drive_settype_id (drv); - _tcscpy (currprefs.df[i], changed_prefs.df[i]); + _tcscpy (currprefs.floppyslots[num].df, changed_prefs.floppyslots[num].df); drv->newname[0] = 0; - if (!drive_insert (drv, &currprefs, i, currprefs.df[i])) - disk_eject (i); + if (!drive_insert (drv, &currprefs, num, currprefs.floppyslots[num].df)) + disk_eject (num); } /* code for track display */ @@ -640,9 +640,9 @@ static void update_drive_gui (int num) && side == gui_data.drive_side && drv->crc32 == gui_data.crc32[num] && writ == gui_data.drive_writing[num] - && !_tcscmp (gui_data.df[num], currprefs.df[num])) + && !_tcscmp (gui_data.df[num], currprefs.floppyslots[num].df)) return; - _tcscpy (gui_data.df[num], currprefs.df[num]); + _tcscpy (gui_data.df[num], currprefs.floppyslots[num].df); gui_data.crc32[num] = drv->crc32; gui_data.drive_motor[num] = drv->state; gui_data.drive_track[num] = drv->cyl; @@ -808,7 +808,7 @@ static int openwritefile (drive *drv, int create) { bool wrprot = 0; - drv->writediskfile = getwritefile (currprefs.df[drv - &floppy[0]], &wrprot); + drv->writediskfile = getwritefile (currprefs.floppyslots[drv - &floppy[0]].df, &wrprot); if (drv->writediskfile) { drv->wrprot = wrprot; if (!read_header_ext2 (drv->writediskfile, drv->writetrackdata, &drv->write_num_tracks, 0)) { @@ -881,7 +881,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR DISK_validate_filename (fname, 1, &drv->wrprot, &drv->crc32, &drv->diskfile); drv->ddhd = 1; drv->num_secs = 0; - drv->hard_num_cyls = p->dfxtype[dnum] == DRV_525_SD ? 40 : 80; + drv->hard_num_cyls = p->floppyslots[dnum].dfxtype == DRV_525_SD ? 40 : 80; drv->tracktiming[0] = 0; drv->useturbo = 0; drv->indexoffset = 0; @@ -910,10 +910,10 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR inprec_rend (); } - _tcsncpy (currprefs.df[dnum], fname, 255); - currprefs.df[dnum][255] = 0; - _tcsncpy (changed_prefs.df[dnum], fname, 255); - changed_prefs.df[dnum][255] = 0; + _tcsncpy (currprefs.floppyslots[dnum].df, fname, 255); + currprefs.floppyslots[dnum].df[255] = 0; + _tcsncpy (changed_prefs.floppyslots[dnum].df, fname, 255); + changed_prefs.floppyslots[dnum].df[255] = 0; _tcscpy (drv->newname, fname); gui_filename (dnum, fname); @@ -2212,7 +2212,7 @@ void disk_eject (int num) config_changed = 1; gui_filename (num, L""); drive_eject (floppy + num); - *currprefs.df[num] = *changed_prefs.df[num] = 0; + *currprefs.floppyslots[num].df = *changed_prefs.floppyslots[num].df = 0; floppy[num].newname[0] = 0; update_drive_gui (num); } @@ -2286,10 +2286,10 @@ static void disk_insert_2 (int num, const TCHAR *name, int forced) drive_insert (drv, &currprefs, num, name); return; } - if (!_tcscmp (currprefs.df[num], name)) + if (!_tcscmp (currprefs.floppyslots[num].df, name)) return; _tcscpy (drv->newname, name); - _tcscpy (currprefs.df[num], name); + _tcscpy (currprefs.floppyslots[num].df, name); DISK_history_add (name, -1, HISTORY_FLOPPY, 0); if (name[0] == 0) { disk_eject (num); @@ -2325,15 +2325,15 @@ void DISK_check_change (void) for (i = 0; i < MAX_FLOPPY_DRIVES; i++) { drive *drv = floppy + i; gui_lock (); - if (currprefs.dfxtype[i] != changed_prefs.dfxtype[i]) { - currprefs.dfxtype[i] = changed_prefs.dfxtype[i]; + if (currprefs.floppyslots[i].dfxtype != changed_prefs.floppyslots[i].dfxtype) { + currprefs.floppyslots[i].dfxtype = changed_prefs.floppyslots[i].dfxtype; reset_drive (i); #ifdef RETROPLATFORM - rp_floppydrive_change (i, currprefs.dfxtype[i] >= 0 ? 1 : 0); + rp_floppydrive_change (i, currprefs.floppyslots[i].dfxtype >= 0 ? 1 : 0); #endif } - if (drv->dskchange_time == 0 && _tcscmp (currprefs.df[i], changed_prefs.df[i])) - disk_insert (i, changed_prefs.df[i]); + if (drv->dskchange_time == 0 && _tcscmp (currprefs.floppyslots[i].df, changed_prefs.floppyslots[i].df)) + disk_insert (i, changed_prefs.floppyslots[i].df); gui_unlock (); if (drv->dskready_down_time > 0) drv->dskready_down_time--; @@ -2481,13 +2481,13 @@ uae_u8 DISK_status (void) st &= ~0x20; #endif } else { - if (drv->dskready && !drv->indexhack && currprefs.dfxtype[dr] != DRV_35_DD_ESCOM) + if (drv->dskready && !drv->indexhack && currprefs.floppyslots[dr].dfxtype != DRV_35_DD_ESCOM) st &= ~0x20; } } else { if (currprefs.cs_df0idhw || dr > 0) { /* report drive ID */ - if (drv->idbit && currprefs.dfxtype[dr] != DRV_35_DD_ESCOM) + if (drv->idbit && currprefs.floppyslots[dr].dfxtype != DRV_35_DD_ESCOM) st &= ~0x20; } else { /* non-ID internal drive: mirror real dskready */ @@ -2507,7 +2507,7 @@ uae_u8 DISK_status (void) if (catweasel_disk_changed (drv->catweasel)) st &= ~4; #endif - } else if (drv->dskchange && currprefs.dfxtype[dr] != DRV_525_SD) { + } else if (drv->dskchange && currprefs.floppyslots[dr].dfxtype != DRV_525_SD) { st &= ~4; } } else if (!(selected & (1 << dr))) { @@ -3343,7 +3343,7 @@ void DISK_init (void) drive *drv = &floppy[dr]; /* reset all drive types to 3.5 DD */ drive_settype_id (drv); - if (!drive_insert (drv, &currprefs, dr, currprefs.df[dr])) + if (!drive_insert (drv, &currprefs, dr, currprefs.floppyslots[dr].df)) disk_eject (dr); } if (disk_empty (0)) @@ -3380,7 +3380,7 @@ int DISK_examine_image (struct uae_prefs *p, int num, uae_u32 *crc32) drv->cyl = 0; side = 0; *crc32 = 0; - if (!drive_insert (drv, p, num, p->df[num])) + if (!drive_insert (drv, p, num, p->floppyslots[num].df)) return 1; if (!drv->diskfile) return 1; @@ -3424,7 +3424,7 @@ end: drive_image_free (drv); if (wasdelayed > 1) { drive_eject (drv); - currprefs.df[num][0] = 0; + currprefs.floppyslots[num].df[0] = 0; drv->dskchange_time = wasdelayed; disk_insert (num, drv->newname); } @@ -3482,7 +3482,7 @@ uae_u8 *restore_disk (int num,uae_u8 *src) disabled |= 1 << num; if (changed_prefs.nr_floppies > num) changed_prefs.nr_floppies = num; - changed_prefs.dfxtype[num] = -1; + changed_prefs.floppyslots[num].dfxtype = -1; } else { drv->motoroff = (state & 1) ? 0 : 1; drv->idbit = (state & 4) ? 1 : 0; @@ -3500,10 +3500,10 @@ uae_u8 *restore_disk (int num,uae_u8 *src) dfxtype = DRV_35_DD; break; } - changed_prefs.dfxtype[num] = dfxtype; + changed_prefs.floppyslots[num].dfxtype = dfxtype; } drv->indexhackmode = 0; - if (num == 0 && currprefs.dfxtype[num] == 0) + if (num == 0 && currprefs.floppyslots[num].dfxtype == 0) drv->indexhackmode = 1; drv->buffered_cyl = -1; drv->buffered_side = -1; @@ -3515,19 +3515,19 @@ uae_u8 *restore_disk (int num,uae_u8 *src) drv->dskchange_time = 0; restore_u32 (); s = restore_string (); - _tcscpy (old, currprefs.df[num]); - _tcsncpy (changed_prefs.df[num], s, 255); + _tcscpy (old, currprefs.floppyslots[num].df); + _tcsncpy (changed_prefs.floppyslots[num].df, s, 255); xfree (s); - newis = changed_prefs.df[num][0] ? 1 : 0; + newis = changed_prefs.floppyslots[num].df[0] ? 1 : 0; if (!(disabled & (1 << num))) { if (!newis) { drv->dskchange = 1; } else { - drive_insert (floppy + num, &currprefs, num, changed_prefs.df[num]); + drive_insert (floppy + num, &currprefs, num, changed_prefs.floppyslots[num].df); if (drive_empty (floppy + num)) { if (newis && old[0]) { - _tcscpy (changed_prefs.df[num], old); - drive_insert (floppy + num, &currprefs, num, changed_prefs.df[num]); + _tcscpy (changed_prefs.floppyslots[num].df, old); + drive_insert (floppy + num, &currprefs, num, changed_prefs.floppyslots[num].df); if (drive_empty (floppy + num)) drv->dskchange = 1; } @@ -3575,7 +3575,7 @@ uae_u8 *save_disk (int num, int *len, uae_u8 *dstptr) save_u8 (drv->drive_id_scnt); /* id mode position */ save_u32 (drv->mfmpos); /* disk position */ save_u32 (getadfcrc (drv)); /* CRC of disk image */ - save_string (currprefs.df[num]);/* image name */ + save_string (currprefs.floppyslots[num].df);/* image name */ *len = dst - dstbak; return dstbak; @@ -3782,12 +3782,12 @@ int disk_prevnext (int drive, int dir) { TCHAR img[MAX_DPATH]; - _tcscpy (img, currprefs.df[drive]); + _tcscpy (img, currprefs.floppyslots[drive].df); if (!img[0]) return 0; disk_prevnext_name (img, dir); - _tcscpy (changed_prefs.df[drive], img); + _tcscpy (changed_prefs.floppyslots[drive].df, img); return 1; } diff --git a/drawing.cpp b/drawing.cpp index 628f9002..da4c2a6d 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2188,6 +2188,7 @@ static void center_image (void) } else { visible_left_border = max_diwlastword - gfxvidinfo.width; } + if (currprefs.gfx_xcenter_pos >= 0) { int val = currprefs.gfx_xcenter_pos >> RES_MAX; #if 0 diff --git a/driveclick.cpp b/driveclick.cpp index 4b177ab9..ad7da8b1 100644 --- a/driveclick.cpp +++ b/driveclick.cpp @@ -141,56 +141,57 @@ void driveclick_init (void) driveclick_free (); vv = 0; for (i = 0; i < 4; i++) { + struct floppyslot *fs = &currprefs.floppyslots[i]; for (j = 0; j < CLICK_TRACKS; j++) { drvs[i][DS_CLICK].indexes[j] = 0; drvs[i][DS_CLICK].lengths[j] = 0; } - if (currprefs.dfxclick[i]) { - if (currprefs.dfxclick[i] > 0) { + if (fs->dfxclick) { + if (fs->dfxclick > 0) { v = 0; - switch(currprefs.dfxclick[i]) + switch(fs->dfxclick) { case 1: - if (driveclick_loadresource (drvs[i], currprefs.dfxclick[i])) + if (driveclick_loadresource (drvs[i], fs->dfxclick)) v = 3; for (j = 0; j < CLICK_TRACKS; j++) drvs[i][DS_CLICK].lengths[j] = drvs[i][DS_CLICK].len; wave_initialized = 1; break; default: - if (driveclick_fdrawcmd_open (currprefs.dfxclick[i] - 2)) + if (driveclick_fdrawcmd_open (fs->dfxclick - 2)) v = 1; break; } - } else if (currprefs.dfxclick[i] == -1) { + } else if (fs->dfxclick == -1) { TCHAR path2[MAX_DPATH]; wave_initialized = 1; for (j = 0; j < CLICK_TRACKS; j++) drvs[i][DS_CLICK].lengths[j] = drvs[i][DS_CLICK].len; get_plugin_path (path2, sizeof path2 / sizeof (TCHAR), L"floppysounds"); _stprintf (tmp, L"%sdrive_click_%s", - path2, currprefs.dfxclickexternal[i]); + path2, fs->dfxclickexternal); v = loadsample (tmp, &drvs[i][DS_CLICK]); if (v) processclicks (&drvs[i][DS_CLICK]); _stprintf (tmp, L"%sdrive_spin_%s", - path2, currprefs.dfxclickexternal[i]); + path2, fs->dfxclickexternal); v += loadsample (tmp, &drvs[i][DS_SPIN]); _stprintf (tmp, L"%sdrive_spinnd_%s", - path2, currprefs.dfxclickexternal[i]); + path2, fs->dfxclickexternal); v += loadsample (tmp, &drvs[i][DS_SPINND]); _stprintf (tmp, L"%sdrive_startup_%s", - path2, currprefs.dfxclickexternal[i]); + path2, fs->dfxclickexternal); v += loadsample (tmp, &drvs[i][DS_START]); _stprintf (tmp, L"%sdrive_snatch_%s", - path2, currprefs.dfxclickexternal[i]); + path2, fs->dfxclickexternal); v += loadsample (tmp, &drvs[i][DS_SNATCH]); } if (v == 0) { int j; for (j = 0; j < DS_END; j++) freesample (&drvs[i][j]); - currprefs.dfxclick[i] = changed_prefs.dfxclick[i] = 0; + fs->dfxclick = changed_prefs.floppyslots[i].dfxclick = 0; } else { vv++; } @@ -239,7 +240,7 @@ static int driveclick_active (void) { int i; for (i = 0; i < 4; i++) { - if (currprefs.dfxclick[i]) { + if (currprefs.floppyslots[i].dfxclick) { if (drv_spinning[i] || drv_starting[i]) return 1; } @@ -253,7 +254,7 @@ STATIC_INLINE uae_s16 getsample (void) int div = 0, i; for (i = 0; i < 4; i++) { - if (currprefs.dfxclick[i]) { + if (currprefs.floppyslots[i].dfxclick) { struct drvsample *ds_start = &drvs[i][DS_START]; struct drvsample *ds_spin = drv_has_disk[i] ? &drvs[i][DS_SPIN] : &drvs[i][DS_SPINND]; struct drvsample *ds_click = &drvs[i][DS_CLICK]; @@ -422,14 +423,14 @@ void driveclick_click (int drive, int cyl) if (!click_initialized) return; - if (!currprefs.dfxclick[drive]) + if (!currprefs.floppyslots[drive].dfxclick) return; if (prevcyl[drive] == 0 && cyl == 0) // "noclick" check return; dr_audio_activate (); prevcyl[drive] = cyl; if (!wave_initialized) { - driveclick_fdrawcmd_seek (currprefs.dfxclick[drive] - 2, cyl); + driveclick_fdrawcmd_seek (currprefs.floppyslots[drive].dfxclick - 2, cyl); return; } mix (); @@ -441,10 +442,10 @@ void driveclick_motor (int drive, int running) { if (!click_initialized) return; - if (!currprefs.dfxclick[drive]) + if (!currprefs.floppyslots[drive].dfxclick) return; if (!wave_initialized) { - driveclick_fdrawcmd_motor (currprefs.dfxclick[drive] - 2, running); + driveclick_fdrawcmd_motor (currprefs.floppyslots[drive].dfxclick - 2, running); return; } mix (); @@ -471,7 +472,7 @@ void driveclick_insert (int drive, int eject) return; if (!wave_initialized) return; - if (!currprefs.dfxclick[drive]) + if (!currprefs.floppyslots[drive].dfxclick) return; if (eject) drv_has_spun[drive] = 0; @@ -490,19 +491,19 @@ void driveclick_check_prefs (void) if (driveclick_active ()) dr_audio_activate (); if (currprefs.dfxclickvolume != changed_prefs.dfxclickvolume || - currprefs.dfxclick[0] != changed_prefs.dfxclick[0] || - currprefs.dfxclick[1] != changed_prefs.dfxclick[1] || - currprefs.dfxclick[2] != changed_prefs.dfxclick[2] || - currprefs.dfxclick[3] != changed_prefs.dfxclick[3] || - _tcscmp (currprefs.dfxclickexternal[0], changed_prefs.dfxclickexternal[0]) || - _tcscmp (currprefs.dfxclickexternal[1], changed_prefs.dfxclickexternal[1]) || - _tcscmp (currprefs.dfxclickexternal[2], changed_prefs.dfxclickexternal[2]) || - _tcscmp (currprefs.dfxclickexternal[3], changed_prefs.dfxclickexternal[3])) + currprefs.floppyslots[0].dfxclick != changed_prefs.floppyslots[0].dfxclick || + currprefs.floppyslots[1].dfxclick != changed_prefs.floppyslots[1].dfxclick || + currprefs.floppyslots[2].dfxclick != changed_prefs.floppyslots[2].dfxclick || + currprefs.floppyslots[3].dfxclick != changed_prefs.floppyslots[3].dfxclick || + _tcscmp (currprefs.floppyslots[0].dfxclickexternal, changed_prefs.floppyslots[0].dfxclickexternal) || + _tcscmp (currprefs.floppyslots[1].dfxclickexternal, changed_prefs.floppyslots[1].dfxclickexternal) || + _tcscmp (currprefs.floppyslots[2].dfxclickexternal, changed_prefs.floppyslots[2].dfxclickexternal) || + _tcscmp (currprefs.floppyslots[3].dfxclickexternal, changed_prefs.floppyslots[3].dfxclickexternal)) { currprefs.dfxclickvolume = changed_prefs.dfxclickvolume; for (i = 0; i < 4; i++) { - currprefs.dfxclick[i] = changed_prefs.dfxclick[i]; - _tcscpy (currprefs.dfxclickexternal[i], changed_prefs.dfxclickexternal[i]); + currprefs.floppyslots[i].dfxclick = changed_prefs.floppyslots[i].dfxclick; + _tcscpy (currprefs.floppyslots[i].dfxclickexternal, changed_prefs.floppyslots[i].dfxclickexternal); } driveclick_init (); } diff --git a/include/gfxfilter.h b/include/gfxfilter.h index 423817be..73150e5e 100644 --- a/include/gfxfilter.h +++ b/include/gfxfilter.h @@ -7,7 +7,7 @@ typedef unsigned long u32; extern void S2X_refresh (void); extern void S2X_render (void); -extern void S2X_init (int dw, int dh, int aw, int ah, int mult, int ad, int dd); +extern void S2X_init (int dw, int dh, int aw, int ah, int ad, int dd); extern void S2X_free (void); extern int S2X_getmult (void); @@ -49,12 +49,14 @@ extern "C" #define UAE_FILTER_NULL 1 #define UAE_FILTER_SCALE2X 2 -#define UAE_FILTER_HQ 3 -#define UAE_FILTER_SUPEREAGLE 4 -#define UAE_FILTER_SUPER2XSAI 5 -#define UAE_FILTER_2XSAI 6 -#define UAE_FILTER_PAL 7 -#define UAE_FILTER_LAST 7 +#define UAE_FILTER_HQ2X 3 +#define UAE_FILTER_HQ3X 4 +#define UAE_FILTER_HQ4X 5 +#define UAE_FILTER_SUPEREAGLE 6 +#define UAE_FILTER_SUPER2XSAI 7 +#define UAE_FILTER_2XSAI 8 +#define UAE_FILTER_PAL 9 +#define UAE_FILTER_LAST 9 #define UAE_FILTER_MODE_16 16 #define UAE_FILTER_MODE_16_16 16 @@ -68,7 +70,7 @@ struct uae_filter { int type, yuv, intmul; TCHAR *name, *cfgname; - int x[6]; + int flags; }; extern struct uae_filter uaefilters[]; diff --git a/include/options.h b/include/options.h index 76379520..3dfd5d62 100644 --- a/include/options.h +++ b/include/options.h @@ -73,8 +73,16 @@ struct cdslot { TCHAR name[MAX_DPATH]; bool inuse; + bool delayed; int type; }; +struct floppyslot +{ + TCHAR df[MAX_DPATH]; + int dfxtype; + int dfxclick; + TCHAR dfxclickexternal[256]; +}; struct wh { int x, y; @@ -276,8 +284,6 @@ struct uae_prefs { bool cs_dipagnus; bool cs_agnusbltbusybug; - TCHAR df[4][MAX_DPATH]; - TCHAR dfxlist[MAX_SPARE_DRIVES][MAX_DPATH]; TCHAR romfile[MAX_DPATH]; TCHAR romident[256]; TCHAR romextfile[MAX_DPATH]; @@ -332,9 +338,8 @@ struct uae_prefs { struct uaedev_config_info mountconfig[MOUNT_CONFIG_SIZE]; int nr_floppies; - int dfxtype[4]; - int dfxclick[4]; - TCHAR dfxclickexternal[4][256]; + struct floppyslot floppyslots[4]; + TCHAR dfxlist[MAX_SPARE_DRIVES][MAX_DPATH]; int dfxclickvolume; int dfxclickchannelmask; diff --git a/include/zfile.h b/include/zfile.h index 4fef64eb..e7ae0b60 100644 --- a/include/zfile.h +++ b/include/zfile.h @@ -101,6 +101,7 @@ extern const TCHAR *uae_ignoreextensions[]; extern const TCHAR *uae_diskimageextensions[]; extern struct zvolume *zfile_fopen_archive (const TCHAR *filename); +extern struct zvolume *zfile_fopen_archive (const TCHAR *filename, bool norecurse); extern struct zvolume *zfile_fopen_archive_root (const TCHAR *filename); extern void zfile_fclose_archive (struct zvolume *zv); extern int zfile_fs_usage_archive (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp); @@ -108,6 +109,7 @@ extern int zfile_stat_archive (const TCHAR *path, struct _stat64 *statbuf); extern struct zdirectory *zfile_opendir_archive (const TCHAR *path); extern void zfile_closedir_archive (struct zdirectory *); extern int zfile_readdir_archive (struct zdirectory *, TCHAR*); +extern int zfile_readdir_archive (struct zdirectory *, TCHAR*, bool fullpath); extern void zfile_resetdir_archive (struct zdirectory *); extern int zfile_fill_file_attrs_archive (const TCHAR *path, int *isdir, int *flags, TCHAR **comment); extern uae_s64 zfile_lseek_archive (struct zfile *d, uae_s64 offset, int whence); diff --git a/inputdevice.cpp b/inputdevice.cpp index 5e1e0e00..15074d00 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -2226,7 +2226,7 @@ void handle_cd32_joystick_cia (uae_u8 pra, uae_u8 dra) uae_u8 but = 0x40 << i; uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */ uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */ - if (!(potgo_value & p5dir) || !(potgo_value & p5dat)) { + if (cd32padmode (p5dir, p5dat)) { if ((dra & but) && (pra & but) != oldstate[i]) { if (!(pra & but)) { cd32_shifter[i]--; @@ -2714,7 +2714,7 @@ void inputdevice_handle_inputcode (void) case AKS_DISKSWAPPER_INSERT1: case AKS_DISKSWAPPER_INSERT2: case AKS_DISKSWAPPER_INSERT3: - _tcscpy (changed_prefs.df[code - AKS_DISKSWAPPER_INSERT0], currprefs.dfxlist[swapperslot]); + _tcscpy (changed_prefs.floppyslots[code - AKS_DISKSWAPPER_INSERT0].df, currprefs.dfxlist[swapperslot]); config_changed = 1; break; diff --git a/main.cpp b/main.cpp index 1917238e..702b818d 100644 --- a/main.cpp +++ b/main.cpp @@ -309,10 +309,10 @@ void fixup_prefs (struct uae_prefs *p) if (p->nr_floppies < 0 || p->nr_floppies > 4) { write_log (L"Invalid number of floppies. Using 4.\n"); p->nr_floppies = 4; - p->dfxtype[0] = 0; - p->dfxtype[1] = 0; - p->dfxtype[2] = 0; - p->dfxtype[3] = 0; + p->floppyslots[0].dfxtype = 0; + p->floppyslots[1].dfxtype = 0; + p->floppyslots[2].dfxtype = 0; + p->floppyslots[3].dfxtype = 0; err = 1; } if (p->floppy_speed > 0 && p->floppy_speed < 10) { diff --git a/newcpu.cpp b/newcpu.cpp index bc703f3f..2962088e 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -2792,20 +2792,20 @@ static void out_cd32io (uae_u32 pc) { case 0xe57cc0: case 0xf04c34: - _stprintf (out, "opendevice"); + _stprintf (out, L"opendevice"); break; case 0xe57ce6: case 0xf04c56: - _stprintf (out, "closedevice"); + _stprintf (out, L"closedevice"); break; case 0xe57e44: case 0xf04f2c: - _stprintf (out, "beginio"); + _stprintf (out, L"beginio"); ioreq = 1; break; case 0xe57ef2: case 0xf0500e: - _stprintf (out, "abortio"); + _stprintf (out, L"abortio"); ioreq = -1; break; } @@ -2819,7 +2819,7 @@ static void out_cd32io (uae_u32 pc) if (ioreq) { static int cnt = 0; int cmd = get_word (request + 28); -#if 1 +#if 0 if (cmd == 37) { cnt--; if (cnt <= 0) @@ -3032,7 +3032,7 @@ static void opcodedebug (uae_u32 pc, uae_u16 opcode) if (!fault) { TCHAR buf[100]; write_log (L"mmufixup=%d %04x %04x\n", mmufixup[0].reg, regs.wb3_status, regs.mmu_ssw); - m68k_disasm_2 (buf, 100, addr, NULL, 1, NULL, NULL, 0); + m68k_disasm_2 (buf, sizeof buf / sizeof (TCHAR), addr, NULL, 1, NULL, NULL, 0); write_log (L"%s\n", buf); m68k_dumpstate (stdout, NULL); } diff --git a/od-win32/avioutput.cpp b/od-win32/avioutput.cpp index 4841d403..194a2239 100644 --- a/od-win32/avioutput.cpp +++ b/od-win32/avioutput.cpp @@ -922,7 +922,7 @@ void AVIOutput_WriteVideo (void) v = getFromBuffer (ae, 1); } else { #if defined (GFXFILTER) - if (!usedfilter || (usedfilter && usedfilter->x[0]) || WIN32GFX_IsPicassoScreen ()) + if (!usedfilter || WIN32GFX_IsPicassoScreen ()) v = getFromDC (ae); else v = getFromBuffer (ae, 0); diff --git a/od-win32/blkdev_win32_aspi.cpp b/od-win32/blkdev_win32_aspi.cpp index ac1d4b34..15a675b5 100644 --- a/od-win32/blkdev_win32_aspi.cpp +++ b/od-win32/blkdev_win32_aspi.cpp @@ -770,6 +770,8 @@ static uae_u8 *execscsicmd_out (int unitnum, uae_u8 *data, int len) SCSI *scgp = si[unitnum].handle; int v; + if (!scgp) + return NULL; uae_sem_wait (&scgp_sem); memset(scgp->scmd, 0, sizeof(struct scg_cmd)); scgp->scmd->cdb_len = len; @@ -795,6 +797,8 @@ static uae_u8 *execscsicmd_in (int unitnum, uae_u8 *data, int len, int *outlen) SCSI *scgp = si[unitnum].handle; int v; + if (!scgp) + return NULL; uae_sem_wait (&scgp_sem); memset(scgp->scmd, 0, sizeof(struct scg_cmd)); scgp->scmd->cdb_len = len; @@ -812,7 +816,7 @@ static uae_u8 *execscsicmd_in (int unitnum, uae_u8 *data, int len, int *outlen) aspi_led (unitnum); uae_sem_post (&scgp_sem); if (v) - return 0; + return NULL; if (outlen) *outlen = scgp->scmd->size; return si[unitnum].buf; diff --git a/od-win32/clipboard_win32.cpp b/od-win32/clipboard_win32.cpp index 7ff7a03f..a739d40b 100644 --- a/od-win32/clipboard_win32.cpp +++ b/od-win32/clipboard_win32.cpp @@ -239,7 +239,8 @@ static void to_iff_ilbm (HBITMAP hbmp) w = bmp.bmWidth; h = bmp.bmHeight; bpp = bmp.bmBitsPixel; - if (bpp < 8) + + if (bpp != 8 && bpp != 32) return; bmpw = (w * bpp / 8 + 3) & ~3; size = bmpw * h; @@ -363,7 +364,7 @@ static void to_iff_ilbm (HBITMAP hbmp) p += ((w + 15) & ~15) / 8; } } - } else { + } else if (bpp == 32) { for (y = 0; y < h; y++) { uae_u32 *s = (uae_u32*)(((uae_u8*)bmp.bmBits) + y * bmpw); int b, bb; diff --git a/od-win32/debug_win32.cpp b/od-win32/debug_win32.cpp index 26431382..9c6db138 100644 --- a/od-win32/debug_win32.cpp +++ b/od-win32/debug_win32.cpp @@ -518,7 +518,7 @@ static void ShowBreakpoints(void) for (i = 0; i < BREAKPOINT_TOTAL; i++) { if (!bpnodes[i].enabled) continue; - m68k_disasm_2(outbp, sizeof(outbp), bpnodes[i].addr, NULL, 1, NULL, NULL, 0); + m68k_disasm_2(outbp, sizeof outbp / sizeof (TCHAR), bpnodes[i].addr, NULL, 1, NULL, NULL, 0); ULBS(outbp); got = 1; } @@ -531,7 +531,7 @@ static void ShowBreakpoints(void) for (i = 0; i < MEMWATCH_TOTAL; i++) { if (mwnodes[i].size == 0) continue; - memwatch_dump2(outw, sizeof(outw), i); + memwatch_dump2(outw, sizeof outw / sizeof (TCHAR), i); ULBS(outw); got = 1; } @@ -620,7 +620,7 @@ static void ShowDasm(int direction) lines_old = SendMessage(hDasm, LB_GETCOUNT, 0, 0); lines_new = GetLBOutputLines(hDasm); for (i = 0; i < lines_new; i++) { - m68k_disasm_2(out, sizeof(out), addr, &addr, 1, NULL, NULL, 0); + m68k_disasm_2(out, sizeof out / sizeof (TCHAR), addr, &addr, 1, NULL, NULL, 0); if (addr > dbgpage[currpage].dasmaddr) UpdateListboxString(hDasm, i, out, FALSE); else diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index 02f486bf..f17f7556 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -9,6 +9,7 @@ #define EFFECT_VERSION 2 #define D3DX9DLL L"d3dx9_43.dll" +#define TWOPASS 1 #include "options.h" #include "xwin.h" @@ -64,9 +65,9 @@ static D3DXMATRIX postproj; static D3DXVECTOR4 maskmult, maskshift; static int ledwidth, ledheight; -static int twidth, theight, max_texture_w, max_texture_h; -static int tin_w, tin_h, window_h, window_w; -static int t_depth, mult; +static int max_texture_w, max_texture_h; +static int tin_w, tin_h, tout_w, tout_h, window_h, window_w; +static int t_depth, mult, multx; static int required_sl_texture_w, required_sl_texture_h; static int vsync2, guimode; static int resetcount; @@ -89,12 +90,12 @@ static void ddraw_fs_hack_free (void) if (!ddraw_fs) return; if (ddraw_fs == 2) - IDirectDraw7_RestoreDisplayMode (ddraw); - hr = IDirectDraw7_SetCooperativeLevel (ddraw, d3dhwnd, DDSCL_NORMAL); + ddraw->RestoreDisplayMode (); + hr = ddraw->SetCooperativeLevel (d3dhwnd, DDSCL_NORMAL); if (FAILED (hr)) { write_log (L"IDirectDraw7_SetCooperativeLevel CLEAR: %s\n", DXError (hr)); } - IDirectDraw7_Release (ddraw); + ddraw->Release (); ddraw = NULL; ddraw_fs = 0; @@ -115,13 +116,13 @@ static int ddraw_fs_hack_init (void) return 0; } ddraw_fs = 1; - hr = IDirectDraw7_SetCooperativeLevel (ddraw, d3dhwnd, DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + hr = ddraw->SetCooperativeLevel (d3dhwnd, DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); if (FAILED (hr)) { write_log (L"IDirectDraw7_SetCooperativeLevel SET: %s\n", DXError (hr)); ddraw_fs_hack_free (); return 0; } - hr = IDirectDraw7_SetDisplayMode (ddraw, dpp.BackBufferWidth, dpp.BackBufferHeight, t_depth, dpp.FullScreen_RefreshRateInHz, 0); + hr = ddraw->SetDisplayMode (dpp.BackBufferWidth, dpp.BackBufferHeight, t_depth, dpp.FullScreen_RefreshRateInHz, 0); if (FAILED (hr)) { write_log (L"IDirectDraw7_SetDisplayMode: %s\n", DXError (hr)); ddraw_fs_hack_free (); @@ -179,11 +180,14 @@ static TCHAR *D3DX_ErrorString (HRESULT hr, LPD3DXBUFFER Errors) static TCHAR buffer[1000]; TCHAR *s = NULL; + buffer[0] = 0; if (Errors) s = au ((char*)Errors->GetBufferPointer ()); - _tcscpy (buffer, D3D_ErrorString (hr)); + if (hr != S_OK) + _tcscpy (buffer, D3D_ErrorString (hr)); if (s) { - _tcscat (buffer, L" "); + if (buffer[0]) + _tcscat (buffer, L" "); _tcscat (buffer, s); } xfree (s); @@ -264,8 +268,12 @@ static int psEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DX INT Depth = D3DX_DEFAULT; hParam = effect->GetParameter (NULL, iParam); - effect->GetParameterDesc (hParam, &ParamDesc); - + hr = effect->GetParameterDesc (hParam, &ParamDesc); + if (FAILED (hr)) { + write_log (L"GetParameterDescParm(%d) failed: %s\n", D3DHEAD, iParam, D3DX_ErrorString (hr, NULL)); + return 0; + } + hr = S_OK; if(ParamDesc.Semantic != NULL) { if(ParamDesc.Class == D3DXPC_MATRIX_ROWS || ParamDesc.Class == D3DXPC_MATRIX_COLUMNS) { if(strcmpi(ParamDesc.Semantic, "world") == 0) @@ -287,7 +295,7 @@ static int psEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DX m_TexelSizeEffectHandle = hParam; } else if(ParamDesc.Class == D3DXPC_SCALAR && ParamDesc.Type == D3DXPT_FLOAT) { if(strcmpi(ParamDesc.Semantic, "SCALING") == 0) - effect->GetFloat(hParam, &m_scale); + hr = effect->GetFloat(hParam, &m_scale); } else if(ParamDesc.Class == D3DXPC_OBJECT && ParamDesc.Type == D3DXPT_TEXTURE) { if(strcmpi(ParamDesc.Semantic, "SOURCETEXTURE") == 0) m_SourceTextureEffectHandle = hParam; @@ -301,39 +309,52 @@ static int psEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DX LPCSTR pstrTechnique = NULL; if(strcmpi(ParamDesc.Semantic, "COMBINETECHNIQUE") == 0) { - effect->GetString(hParam, &pstrTechnique); + hr = effect->GetString(hParam, &pstrTechnique); m_CombineTechniqueEffectHandle = effect->GetTechniqueByName(pstrTechnique); } else if(strcmpi(ParamDesc.Semantic, "PREPROCESSTECHNIQUE") == 0) { - effect->GetString(hParam, &pstrTechnique); + hr = effect->GetString(hParam, &pstrTechnique); m_PreprocessTechnique1EffectHandle = effect->GetTechniqueByName(pstrTechnique); } else if(strcmpi(ParamDesc.Semantic, "PREPROCESSTECHNIQUE1") == 0) { - effect->GetString(hParam, &pstrTechnique); + hr = effect->GetString(hParam, &pstrTechnique); m_PreprocessTechnique2EffectHandle = effect->GetTechniqueByName(pstrTechnique); } else if(strcmpi(ParamDesc.Semantic, "NAME") == 0) - effect->GetString(hParam, &m_strName); + hr = effect->GetString(hParam, &m_strName); + } + if (FAILED (hr)) { + write_log (L"ParamDesc.Semantic failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, NULL)); + return 0; } } for(iAnnot = 0; iAnnot < ParamDesc.Annotations; iAnnot++) { hAnnot = effect->GetAnnotation (hParam, iAnnot); - effect->GetParameterDesc(hAnnot, &AnnotDesc); + hr = effect->GetParameterDesc(hAnnot, &AnnotDesc); + if (FAILED (hr)) { + write_log (L"GetParameterDescAnnot(%d) failed: %s\n", D3DHEAD, iAnnot, D3DX_ErrorString (hr, NULL)); + return 0; + } + hr = S_OK; if(strcmpi(AnnotDesc.Name, "name") == 0) - effect->GetString(hAnnot, &pstrName); + hr = effect->GetString(hAnnot, &pstrName); else if(strcmpi(AnnotDesc.Name, "function") == 0) - effect->GetString(hAnnot, &pstrFunction); + hr = effect->GetString(hAnnot, &pstrFunction); else if(strcmpi(AnnotDesc.Name, "target") == 0) - effect->GetString(hAnnot, &pstrTarget); + hr = effect->GetString(hAnnot, &pstrTarget); else if(strcmpi(AnnotDesc.Name, "width") == 0) - effect->GetInt(hAnnot, &Width); + hr = effect->GetInt(hAnnot, &Width); else if(strcmpi(AnnotDesc.Name, "height") == 0) - effect->GetInt(hAnnot, &Height); + hr = effect->GetInt(hAnnot, &Height); else if(strcmpi(AnnotDesc.Name, "depth") == 0) - effect->GetInt(hAnnot, &Depth); + hr = effect->GetInt(hAnnot, &Depth); else if(strcmpi(AnnotDesc.Name, "type") == 0) - effect->GetString(hAnnot, &pstrTextureType); + hr = effect->GetString(hAnnot, &pstrTextureType); + if (FAILED (hr)) { + write_log (L"GetString/GetInt(%d) failed: %s\n", D3DHEAD, iAnnot, D3DX_ErrorString (hr, NULL)); + return 0; + } } if(pstrFunction != NULL) { @@ -725,6 +746,7 @@ static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full) } } } else { + write_log (L"%s: Attempting to load '%s'\n", D3DHEAD, tmp); hr = D3DXCreateEffectCompilerFromFile (tmp, NULL, NULL, compileflags, &EffectCompiler, &Errors); if (FAILED (hr)) { write_log (L"%s: D3DXCreateEffectCompilerFromFile failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors)); @@ -732,14 +754,21 @@ static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full) } } + if (Errors) { + write_log (L"%s: '%s' warning: %s\n", D3DHEAD, shaderfile, D3DX_ErrorString (hr, Errors)); + Errors->Release(); + Errors = NULL; + } + hr = EffectCompiler->CompileEffect (0, &BufferEffect, &Errors); if (FAILED (hr)) { write_log (L"%s: CompileEffect failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors)); goto end; } + void *bp = BufferEffect->GetBufferPointer (); + int bplen = BufferEffect->GetBufferSize (); hr = D3DXCreateEffect (d3ddev, - BufferEffect->GetBufferPointer (), - BufferEffect->GetBufferSize (), + bp, bplen, NULL, NULL, 0, NULL, &effect, &Errors); @@ -747,7 +776,11 @@ static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full) write_log (L"%s: D3DXCreateEffect failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors)); goto end; } - effect->GetDesc (&EffectDesc); + hr = effect->GetDesc (&EffectDesc); + if (FAILED (hr)) { + write_log (L"%s: effect->GetDesc() failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors)); + goto end; + } if (full) { if (!psEffect_ParseParameters (EffectCompiler, effect)) goto end; @@ -1000,29 +1033,36 @@ static LPDIRECT3DTEXTURE9 createtext (int w, int h, D3DFORMAT format) return t; } -static int createtexture (int w, int h) +static int createtexture (int iw, int ih, int ow, int oh, int win_w, int win_h) { HRESULT hr; - texture = createtext (w, h, tformat); + texture = createtext (iw, ih, tformat); if (!texture) return 0; - twidth = w; - theight = h; - write_log (L"%s: %d*%d texture allocated, bits per pixel %d\n", D3DHEAD, w, h, t_depth); + write_log (L"%s: %d*%d texture allocated, bits per pixel %d\n", D3DHEAD, iw, ih, t_depth); + int w, h; + if (ow > win_w * multx && oh > win_h * multx) { + w = ow; + h = oh; + } else { + w = win_w * multx; + h = win_h * multx; + } if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpTempTexture, NULL))) { write_log (L"%s: Failed to create working texture1: %s\n", D3DHEAD, D3D_ErrorString (hr)); return 0; } + write_log (L"%s: %d*%d working texture allocated, bits per pixel %d\n", D3DHEAD, w, h, t_depth); if (psActive) { D3DLOCKED_BOX lockedBox; - if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, + if (FAILED (hr = d3ddev->CreateTexture (iw, ih, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture1, NULL))) { write_log (L"%s: Failed to create temp texture: %s\n", D3DHEAD, D3D_ErrorString (hr)); return 0; } - if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, + if (FAILED (hr = d3ddev->CreateTexture (iw, ih, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture2, NULL))) { write_log (L"%s: Failed to create working texture2: %s\n", D3DHEAD, D3D_ErrorString (hr)); return 0; @@ -1036,7 +1076,7 @@ static int createtexture (int w, int h) write_log (L"%s: Failed to lock box of volume texture: %s\n", D3DHEAD, D3D_ErrorString (hr)); return 0; } - BuildHq2xLookupTexture (w, h, w, h, (unsigned char*)lockedBox.pBits); + BuildHq2xLookupTexture (w, h, iw, ih, (unsigned char*)lockedBox.pBits); lpHq2xLookupTexture->UnlockBox (0); } @@ -1336,7 +1376,7 @@ static void setupscenecoords (void) float dw, dh; static RECT sr2, dr2, zr2; - //write_log (L"%dx%d %dx%d %dx%d\n", twidth, theight, tin_w, tin_h, window_w, window_h); + //write_log (L"%dx%d %dx%d %dx%d\n", tin_w, tin_h, tin_w, tin_h, window_w, window_h); getfilterrect2 (&dr, &sr, &zr, window_w, window_h, tin_w / mult, tin_h / mult, mult, tin_w, tin_h); @@ -1357,7 +1397,6 @@ static void setupscenecoords (void) w = sr.right - sr.left; h = sr.bottom - sr.top; - //write_log (L"%.1fx%.1f %.1fx%.1f\n", dw, dh, w, h); MatrixOrthoOffCenterLH (&m_matProj, 0, w, 0, h, 0.0f, 1.0f); @@ -1366,13 +1405,47 @@ static void setupscenecoords (void) +0.5f + dh * tin_h / window_h / 2 - zr.top - (tin_h - 2 * zr.top - h) + sr.top, // <- ??? 0); - float sw = dw * tin_w / window_w + 0.5f; - float sh = dh * tin_h / window_h + 0.5f; + float sw = dw * tin_w / window_w; + float sh = dh * tin_h / window_h; MatrixScaling (&m_matWorld, sw, sh, 1.0f); +#if 0 + + MatrixOrthoOffCenterLH (&m_matProj, 0, w, 0, h, 0.0f, 1.0f); + + float ww = dw * tin_w / window_w; + float hh = dh * tin_h / window_h; + + MatrixTranslation (&m_matView, + -0.5f + ww / 2 - zr.left - sr.left, // - (tin_w - 2 * zr.left - w), + 0.5f + hh / 2- zr.top - (tin_h - 2 * zr.top - h) + sr.top, // <- ??? + 0); + + MatrixOrthoOffCenterLH (&m_matProj, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); + MatrixOrthoOffCenterLH (&m_matProj, 0, dw, 0, dh, 0.0f, 1.0f); + + float mx = w / ww; + float my = h / hh; + + MatrixTranslation (&m_matView, 0.5f - 0.5f / window_w, 0.5f + 0.5f / window_h, 0.0f); + MatrixTranslation (&m_matView, + 0.5f + (dw / 2) - (zr.left - sr.left), + 0.5f + (dh / 2) - (zr.top - (tin_h - 2 * zr.top - h) + sr.top) * 0, // <- ??? + 0); + + + MatrixScaling (&m_matWorld, ww / w * dw, hh / h * dh, 1.0f); +#endif + + + //write_log (L"%.1fx%.1f %.1fx%.1f %.1fx%.1f\n", dw, dh, w, h, ww, hh); + + float ww = dw * tin_w / window_w; + float hh = dh * tin_h / window_h; + // ratio between Amiga texture and overlay texture - maskmult.x = sw * maskmult_x / w; - maskmult.y = sh * maskmult_y / h; + maskmult.x = ww * maskmult_x / w; + maskmult.y = hh * maskmult_y / h; maskshift.x = 1.0f / maskmult_x; maskshift.y = 1.0f / maskmult_y; @@ -1390,7 +1463,7 @@ uae_u8 *getfilterbuffer3d (int *widthp, int *heightp, int *pitch, int *depth) int w, h; *depth = t_depth; - getfilterrect2 (&dr, &sr, &zr, window_w, window_h, tin_w, tin_h, mult, tin_w, tin_h); + getfilterrect2 (&dr, &sr, &zr, window_w, window_h, tin_w / mult, tin_h / mult, mult, tin_w, tin_h); w = sr.right - sr.left; h = sr.bottom - sr.top; p = gfxvidinfo.bufmem; @@ -1408,8 +1481,8 @@ static void createvertex (void) struct TLVERTEX *vertices; float sizex, sizey; - sizex = 1.0; - sizey = 1.0; + sizex = 1.0f; + sizey = 1.0f; if (FAILED (hr = vertexBuffer->Lock (0, 0, (void**)&vertices, 0))) { write_log (L"%s: Vertexbuffer lock failed: %s\n", D3DHEAD, D3D_ErrorString (hr)); return; @@ -1448,10 +1521,14 @@ static void settransform (void) // Projection is (0,0,0) -> (1,1,1) MatrixOrthoOffCenterLH (&m_matPreProj, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); // Align texels with pixels - MatrixTranslation (&m_matPreView, -0.5f / twidth, 0.5f / theight, 0.0f); + MatrixTranslation (&m_matPreView, -0.5f / tin_w, 0.5f / tin_h, 0.0f); // Identity for world D3DXMatrixIdentity (&m_matPreWorld); psEffect_SetMatrices (&m_matProj, &m_matView, &m_matWorld); + + MatrixOrthoOffCenterLH (&m_matProj2, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); + MatrixTranslation (&m_matView2, 0.5f - 0.5f / window_w, 0.5f + 0.5f / window_h, 0.0f); + D3DXMatrixIdentity (&m_matWorld2); } static void invalidatedeviceobjects (void) @@ -1539,7 +1616,7 @@ static int restoredeviceobjects (void) HRESULT hr; invalidatedeviceobjects (); - while (shaderon) { + while (shaderon > 0) { postEffect = psEffect_LoadEffect (psEnabled ? L"_winuae.fx" : L"_winuae_old.fx", false); if (!postEffect) { shaderon = 0; @@ -1548,7 +1625,6 @@ static int restoredeviceobjects (void) if (currprefs.gfx_filtershader[0]) { if (!(pEffect = psEffect_LoadEffect (currprefs.gfx_filtershader, true))) { currprefs.gfx_filtershader[0] = changed_prefs.gfx_filtershader[0] = 0; - shaderon = 0; break; } } @@ -1564,7 +1640,7 @@ static int restoredeviceobjects (void) createmask2texture (currprefs.gfx_filteroverlay); - if (!createtexture (tin_w, tin_h)) + if (!createtexture (tin_w, tin_h, tout_w, tout_h, window_w, window_h)) return 0; createledtexture (); @@ -1625,7 +1701,7 @@ void D3D_free (void) ddraw_fs_hack_free (); } -const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth) +const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth, int mmult) { HRESULT ret, hr; static TCHAR errmsg[100] = { 0 }; @@ -1779,7 +1855,7 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth write_log (L"%s\n", errmsg); write_log (L"%s: Retrying fullscreen with DirectDraw\n", D3DHEAD); if (ddraw_fs_hack_init ()) { - const TCHAR *err2 = D3D_init (ahwnd, w_w, w_h, t_w, t_h, depth); + const TCHAR *err2 = D3D_init (ahwnd, w_w, w_h, t_w, t_h, depth, mult); if (err2) ddraw_fs_hack_free (); return err2; @@ -1788,7 +1864,7 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth if (d3d_ex && D3DEX) { write_log (L"%s\n", errmsg); D3DEX = 0; - return D3D_init (ahwnd, w_w, w_h, t_w, t_h, depth); + return D3D_init (ahwnd, w_w, w_h, t_w, t_h, depth, mult); } D3D_free (); return errmsg; @@ -1829,20 +1905,25 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth if ((d3dCaps.PixelShaderVersion < D3DPS_VERSION(3,0) || d3dCaps.VertexShaderVersion < D3DVS_VERSION(3,0) || !psEnabled || max_texture_w < 4096 || max_texture_h < 4096 || !shaderon) && d3d_ex) { D3DEX = 0; write_log (L"Disabling D3D9Ex\n"); - return D3D_init (ahwnd, w_w, w_h, t_w, t_h, depth); + return D3D_init (ahwnd, w_w, w_h, t_w, t_h, depth, mult); } if (!shaderon) write_log (L"Using non-shader version\n"); + multx = mmult; mult = S2X_getmult (); - t_w *= mult; - t_h *= mult; + tin_w = t_w * mult; + tin_h = t_h * mult; + tout_w = tin_w * multx; + tout_h = tin_h * multx; - if (max_texture_w < t_w || max_texture_h < t_h) { + if (max_texture_w < w_w || max_texture_h < w_h) { _stprintf (errmsg, L"%s: %d * %d or bigger texture support required\nYour card's maximum texture size is only %d * %d", D3DHEAD, t_w, t_h, max_texture_w, max_texture_h); return errmsg; } + while (multx > 1 && (w_w * multx > max_texture_w || w_h * multx > max_texture_h)) + multx--; required_sl_texture_w = w_w; required_sl_texture_h = w_h; @@ -1868,15 +1949,9 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth } window_w = w_w; window_h = w_h; - tin_w = t_w; - tin_h = t_h; changed_prefs.leds_on_screen = currprefs.leds_on_screen = currprefs.leds_on_screen | STATUSLINE_TARGET; - MatrixOrthoOffCenterLH (&m_matProj2, 0, window_w, 0, window_h, 0.0f, 1.0f); - MatrixTranslation (&m_matView2, -0.5f + window_w / 2, 0.5f + window_h / 2, 0); - MatrixScaling (&m_matWorld2, window_w, window_h, 1.0f); - if (!restoredeviceobjects ()) { D3D_free (); _stprintf (errmsg, L"%s: initialization failed.", D3DHEAD); @@ -1971,15 +2046,13 @@ static void D3D_render22 (void) if (!isd3d ()) return; - setupscenecoords (); - hr = d3ddev->Clear (0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, d3ddebug ? 0x80 : 0, 0), 0, 0); if (FAILED (hr = d3ddev->BeginScene ())) { write_log (L"%s: BeginScene: %s\n", D3DHEAD, D3D_ErrorString (hr)); return; } - if (shaderon && postEffect) { + if (shaderon > 0 && postEffect) { if (psActive) { LPDIRECT3DSURFACE9 lpRenderTarget; LPDIRECT3DSURFACE9 lpNewRenderTarget; @@ -2014,27 +2087,27 @@ static void D3D_render22 (void) } psEffect_End (pEffect); } + if (FAILED (hr = d3ddev->SetRenderTarget (0, lpRenderTarget))) + write_log (L"%s: Effect RenderTarget reset failed: %s\n", D3DHEAD, D3D_ErrorString (hr)); + lpNewRenderTarget->Release (); + lpNewRenderTarget = NULL; if (psEffect_hasPreProcess2 () && lpWorkTexture == lpWorkTexture1) { lpWorkTexture = lpWorkTexture2; - lpNewRenderTarget->Release (); - lpNewRenderTarget = NULL; goto pass2; } - if (FAILED (hr = d3ddev->SetRenderTarget (0, lpRenderTarget))) - write_log (L"%s: Effect RenderTarget reset failed: %s\n", D3DHEAD, D3D_ErrorString (hr)); lpRenderTarget->Release (); lpRenderTarget = NULL; - lpNewRenderTarget->Release (); - lpNewRenderTarget = NULL; } psEffect_SetMatrices (&m_matProj2, &m_matView2, &m_matWorld2); +#if TWOPASS if (FAILED (hr = d3ddev->GetRenderTarget (0, &lpRenderTarget))) write_log (L"%s: GetRenderTarget: %s\n", D3DHEAD, D3D_ErrorString (hr)); if (FAILED (hr = lpTempTexture->GetSurfaceLevel (0, &lpNewRenderTarget))) write_log (L"%s: GetSurfaceLevel: %s\n", D3DHEAD, D3D_ErrorString (hr)); if (FAILED (hr = d3ddev->SetRenderTarget (0, lpNewRenderTarget))) write_log (L"%s: SetRenderTarget: %s\n", D3DHEAD, D3D_ErrorString (hr)); +#endif hr = d3ddev->Clear (0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, d3ddebug ? 0x80 : 0), 0, 0); uPasses = 0; @@ -2048,11 +2121,12 @@ static void D3D_render22 (void) } psEffect_End (pEffect); } - +#if TWOPASS if (FAILED (hr = d3ddev->SetRenderTarget (0, lpRenderTarget))) write_log (L"%s: SetRenderTarget: %s\n", D3DHEAD, D3D_ErrorString (hr)); lpNewRenderTarget->Release (); lpRenderTarget->Release (); +#endif srctex = lpTempTexture; } else { @@ -2061,6 +2135,10 @@ static void D3D_render22 (void) } + } +#if TWOPASS + if (shaderon > 0 && postEffect) { + if (masktexture) { if (FAILED (hr = postEffect->SetTechnique (postTechnique))) write_log (L"%s: SetTechnique(postTechnique) failed: %s\n", D3DHEAD, D3D_ErrorString (hr)); @@ -2099,10 +2177,11 @@ static void D3D_render22 (void) } else { // non-shader version + setupscenecoords (); hr = d3ddev->SetTransform (D3DTS_PROJECTION, &m_matProj); hr = d3ddev->SetTransform (D3DTS_VIEW, &m_matView); hr = d3ddev->SetTransform (D3DTS_WORLD, &m_matWorld); - hr = d3ddev->SetTexture (0, texture); + hr = d3ddev->SetTexture (0, srctex); hr = d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 0, 2); int bl = currprefs.gfx_filter_bilinear ? D3DTEXF_LINEAR : D3DTEXF_POINT; hr = d3ddev->SetSamplerState (0, D3DSAMP_MINFILTER, bl); @@ -2123,7 +2202,7 @@ static void D3D_render22 (void) if (cursorsurfaced3d && cursor_v) { D3DXMATRIX t; - MatrixScaling (&t, ((float)(window_w) / (tin_w + 2 * cursor_offset_x)), ((float)(window_h) / (tin_h + 2 * cursor_offset_y)), 0); + MatrixScaling (&t, ((float)(window_w) / (tout_w + 2 * cursor_offset_x)), ((float)(window_h) / (tout_h + 2 * cursor_offset_y)), 0); v.x = cursor_x + cursor_offset_x; v.y = cursor_y + cursor_offset_y; v.z = 0; @@ -2185,7 +2264,7 @@ static void D3D_render22 (void) } sprite->End (); } - +#endif hr = d3ddev->EndScene (); if (FAILED (hr)) @@ -2238,9 +2317,9 @@ void D3D_flushtexture (int miny, int maxy) RECT r; maxy++; r.left = 0; - r.right = twidth; + r.right = tin_w; r.top = miny <= 0 ? 0 : miny; - r.bottom = maxy <= theight ? maxy : theight; + r.bottom = maxy <= tin_h ? maxy : tin_h; if (r.top <= r.bottom) { HRESULT hr = texture->AddDirtyRect (&r); if (FAILED (hr)) diff --git a/od-win32/direct3d.h b/od-win32/direct3d.h index 4f5c3a6e..04d5d64c 100644 --- a/od-win32/direct3d.h +++ b/od-win32/direct3d.h @@ -1,6 +1,6 @@ extern void D3D_resize (int width, int height); extern void D3D_free (void); -extern const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth); +extern const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth, int mult); extern void D3D_getpixelformat (int depth,int *rb, int *bb, int *gb, int *rs, int *bs, int *gs, int *ab, int *ar, int *a); extern void D3D_refresh (void); extern void D3D_flip (void); diff --git a/od-win32/keyboard_win32.cpp b/od-win32/keyboard_win32.cpp index 7fdd8f07..f5bdf926 100644 --- a/od-win32/keyboard_win32.cpp +++ b/od-win32/keyboard_win32.cpp @@ -362,10 +362,10 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) } else { int i; for (i = 0; i < 4; i++) { - if (!_tcscmp (currprefs.df[i], currprefs.dfxlist[num])) - changed_prefs.df[i][0] = 0; + if (!_tcscmp (currprefs.floppyslots[i].df, currprefs.dfxlist[num])) + changed_prefs.floppyslots[i].df[0] = 0; } - _tcscpy (changed_prefs.df[swapperdrive], currprefs.dfxlist[num]); + _tcscpy (changed_prefs.floppyslots[swapperdrive].df, currprefs.dfxlist[num]); config_changed = 1; } } diff --git a/od-win32/lib/prowizard.lib b/od-win32/lib/prowizard.lib index 9ad0d0d7..46893986 100644 Binary files a/od-win32/lib/prowizard.lib and b/od-win32/lib/prowizard.lib differ diff --git a/od-win32/mp3decoder.cpp b/od-win32/mp3decoder.cpp index 2887b77a..5b1b6590 100644 --- a/od-win32/mp3decoder.cpp +++ b/od-win32/mp3decoder.cpp @@ -231,8 +231,10 @@ uae_u32 mp3decoder::getsize (struct zfile *zf) firstframe = zfile_ftell (zf); ver = (header[1] >> 3) & 3; - if (ver == 1) + if (ver == 1) { + write_log (L"MP3: ver==1?!\n"); return 0; + } if (ver == 0) ver = 2; else if (ver == 2) @@ -240,13 +242,17 @@ uae_u32 mp3decoder::getsize (struct zfile *zf) else if (ver == 3) ver = 0; layer = 4 - ((header[1] >> 1) & 3); - if (layer == 4) + if (layer == 4) { + write_log (L"MP3: layer==4?!\n"); return 0; + } iscrc = ((header[1] >> 0) & 1) ? 0 : 2; bitrateidx = (header[2] >> 4) & 15; freq = mp3_frequencies[(header[2] >> 2) & 3]; - if (!freq) + if (!freq) { + write_log (L"MP3: reserved frequency?!\n"); return 0; + } channelmode = (header[3] >> 6) & 3; isstereo = channelmode != 3; if (ver == 0) { @@ -258,14 +264,18 @@ uae_u32 mp3decoder::getsize (struct zfile *zf) bitindex = 4; } bitrate = mp3_bitrates[bitindex * 16 + bitrateidx] * 1000; - if (bitrate <= 0) + if (bitrate <= 0) { + write_log (L"MP3: reserved bitrate?!\n"); return 0; + } padding = (header[2] >> 1) & 1; samplerate = mp3_samplesperframe[(layer - 1) * 3 + ver]; framelen = ((samplerate / 8 * bitrate) / freq) + padding; - if (framelen <= 4) + if (framelen <= 4) { + write_log (L"MP3: too small frame size?!\n"); return 0; - zfile_fseek(zf, framelen + iscrc - 4, SEEK_CUR); + } + zfile_fseek(zf, framelen - 4, SEEK_CUR); frames++; if (timelen > 0) { size = ((uae_u64)timelen * freq * 2 * (isstereo ? 2 : 1)) / 1000; diff --git a/od-win32/resources/resource b/od-win32/resources/resource index b366c9ed..ce6eb8d9 100644 --- a/od-win32/resources/resource +++ b/od-win32/resources/resource @@ -262,6 +262,7 @@ #define IDS_QS_CD_IMAGE 267 #define IDS_REMAPTITLE 268 #define IDS_FILTER_NOOVERLAYS 269 +#define IDS_STMENUNOCD 270 #define IDS_NUMSG_NEEDEXT2 300 #define IDS_NUMSG_NOROMKEY 301 #define IDS_NUMSG_KSROMCRCERROR 302 @@ -1018,7 +1019,6 @@ #define IDC_RTG_24BIT 1789 #define IDC_ASSOCIATELIST 1789 #define IDC_PORT_TABLET 1789 -#define IDC_PATHS_CONFIGCACHE2 1789 #define IDC_PATHS_RELATIVE 1789 #define IDC_RTG_32BIT 1790 #define IDC_ASSOCIATE_OFF 1790 @@ -1084,6 +1084,11 @@ #define ID_DBG_TOGGLEBP 40042 #define ID_DBG_DELETEBPS 40043 #define ID_DBG_SETTOPC 40044 +#define ID_MENU_CDDRIVES 40045 +#define ID_CDDRIVES_EJECT 40046 +#define ID_ST_CDEJECTALL 40047 +#define ID_CDDRIVES_CD 40048 +#define ID_ST_CD0 40049 // Next default values for new objects // @@ -1092,7 +1097,7 @@ #define _APS_NO_MFC 1 #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 356 -#define _APS_NEXT_COMMAND_VALUE 40045 +#define _APS_NEXT_COMMAND_VALUE 40050 #define _APS_NEXT_CONTROL_VALUE 1808 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 805acf16..4cd76b47 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -742,8 +742,8 @@ STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN GROUPBOX "Filter Settings",-1,0,1,295,134 - COMBOBOX IDC_FILTERMODE,20,15,103,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_FILTERFILTER,132,15,83,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_FILTERMODE,20,15,149,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_FILTERFILTER,176,15,39,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Reset to defaults",IDC_FILTERDEFAULT,221,15,67,14 RTEXT "Horiz. size:",-1,7,61,46,10,SS_CENTERIMAGE CONTROL "Slider1",IDC_FILTERHZ,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,99,54,152,19 @@ -1110,6 +1110,11 @@ BEGIN MENUITEM "DF2:", ID_ST_DF2 MENUITEM "DF3:", ID_ST_DF3 END + POPUP "CD drives" + BEGIN + MENUITEM "Eject", ID_ST_CDEJECTALL + MENUITEM "CD", ID_ST_CD0 + END MENUITEM "Reset", ID_ST_RESET MENUITEM "Help", ID_ST_HELP MENUITEM "Quit WinUAE", ID_ST_QUIT @@ -1446,6 +1451,7 @@ BEGIN IDS_QS_CD_IMAGE "Image mode" IDS_REMAPTITLE "Input captured. F12 = Exit. F11 = Skip current event in Remap mode." IDS_FILTER_NOOVERLAYS "No overlays available" + IDS_STMENUNOCD "No CD inserted" END STRINGTABLE diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index 865306d4..872c4221 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -805,7 +805,7 @@ void rp_fixup_options (struct uae_prefs *p) /* floppy drives */ floppy_mask = 0; for (i = 0; i < 4; i++) { - if (p->dfxtype[i] >= 0) + if (p->floppyslots[i].dfxtype >= 0) floppy_mask |= 1 << i; } RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_FLOPPY, floppy_mask, NULL, 0, &guestinfo, NULL); diff --git a/od-win32/screenshot.cpp b/od-win32/screenshot.cpp index c1061cd5..be06ab32 100644 --- a/od-win32/screenshot.cpp +++ b/od-win32/screenshot.cpp @@ -347,8 +347,10 @@ int screenshotf (const TCHAR *spath, int mode, int doprepare) fetch_path (L"ScreenshotPath", path, sizeof (path) / sizeof (TCHAR)); CreateDirectory (path, NULL); name[0] = 0; - if (currprefs.dfxtype[0] >= 0) - _tcscpy (name, currprefs.df[0]); + if (currprefs.floppyslots[0].dfxtype >= 0) + _tcscpy (name, currprefs.floppyslots[0].df); + else if (currprefs.cdslots[0].inuse) + _tcscpy (name, currprefs.cdslots[0].name); if (!name[0]) underline[0] = 0; namesplit (name); diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 13ae05e6..ec482f91 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -1211,9 +1211,9 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, num -= 7; if (nm->code == NM_RCLICK) { disk_eject (num); - } else if (changed_prefs.dfxtype[num] >= 0) { + } else if (changed_prefs.floppyslots[num].dfxtype >= 0) { DiskSelection (hWnd, IDC_DF0 + num, 0, &changed_prefs, 0); - disk_insert (num, changed_prefs.df[num]); + disk_insert (num, changed_prefs.floppyslots[num].df); } } else if (num == 4) { if (nm->code == NM_CLICK) // POWER @@ -1538,6 +1538,15 @@ static LRESULT CALLBACK HiddenWindowProc (HWND hWnd, UINT message, WPARAM wParam case ID_ST_RESET: uae_reset (0); break; + + case ID_ST_CDEJECTALL: + changed_prefs.cdslots[0].name[0] = 0; + changed_prefs.cdslots[0].inuse = false; + break; + case ID_ST_CD0: + DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_CD_SELECT, 17, &changed_prefs, 0); + break; + case ID_ST_EJECTALL: disk_eject (0); disk_eject (1); @@ -1546,20 +1555,21 @@ static LRESULT CALLBACK HiddenWindowProc (HWND hWnd, UINT message, WPARAM wParam break; case ID_ST_DF0: DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF0, 0, &changed_prefs, 0); - disk_insert (0, changed_prefs.df[0]); + disk_insert (0, changed_prefs.floppyslots[0].df); break; case ID_ST_DF1: DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF1, 0, &changed_prefs, 0); - disk_insert (1, changed_prefs.df[0]); + disk_insert (1, changed_prefs.floppyslots[0].df); break; case ID_ST_DF2: DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF2, 0, &changed_prefs, 0); - disk_insert (2, changed_prefs.df[0]); + disk_insert (2, changed_prefs.floppyslots[0].df); break; case ID_ST_DF3: DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF3, 0, &changed_prefs, 0); - disk_insert (3, changed_prefs.df[0]); + disk_insert (3, changed_prefs.floppyslots[0].df); break; + } break; } @@ -4998,30 +5008,47 @@ void systray (HWND hwnd, int remove) static void systraymenu (HWND hwnd) { POINT pt; - HMENU menu, menu2, drvmenu; + HMENU menu, menu2, drvmenu, cdmenu; int drvs[] = { ID_ST_DF0, ID_ST_DF1, ID_ST_DF2, ID_ST_DF3, -1 }; int i; - TCHAR text[100]; + TCHAR text[100], text2[100]; WIN32GUI_LoadUIString (IDS_STMENUNOFLOPPY, text, sizeof (text) / sizeof (TCHAR)); + WIN32GUI_LoadUIString (IDS_STMENUNOCD, text2, sizeof (text2) / sizeof (TCHAR)); GetCursorPos (&pt); menu = LoadMenu (hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDM_SYSTRAY)); if (!menu) return; menu2 = GetSubMenu (menu, 0); drvmenu = GetSubMenu (menu2, 1); + cdmenu = GetSubMenu (menu2, 2); EnableMenuItem (menu2, ID_ST_HELP, pHtmlHelp ? MF_ENABLED : MF_GRAYED); i = 0; while (drvs[i] >= 0) { TCHAR s[MAX_DPATH]; - if (currprefs.df[i][0]) - _stprintf (s, L"DF%d: [%s]", i, currprefs.df[i]); + if (currprefs.floppyslots[i].df[0]) + _stprintf (s, L"DF%d: [%s]", i, currprefs.floppyslots[i].df); else _stprintf (s, L"DF%d: [%s]", i, text); ModifyMenu (drvmenu, drvs[i], MF_BYCOMMAND | MF_STRING, drvs[i], s); - EnableMenuItem (menu2, drvs[i], currprefs.dfxtype[i] < 0 ? MF_GRAYED : MF_ENABLED); + EnableMenuItem (menu2, drvs[i], currprefs.floppyslots[i].dfxtype < 0 ? MF_GRAYED : MF_ENABLED); i++; } + { + TCHAR s[MAX_DPATH]; + if (currprefs.cdslots[0].inuse && currprefs.cdslots[0].name[0]) + _stprintf (s, L"CD: [%s]", currprefs.cdslots[0].name); + else + _stprintf (s, L"CD: [%s]", text2); + ModifyMenu (cdmenu, ID_ST_CD0, MF_BYCOMMAND | MF_STRING, ID_ST_CD0, s); + int open = 0; + struct device_info di; + if (sys_command_info (0, &di, 1) && di.open) + open = 1; + EnableMenuItem (menu2, ID_ST_CD0, open == 0 ? MF_GRAYED : MF_ENABLED); + } + + if (isfullscreen () <= 0) SetForegroundWindow (hwnd); TrackPopupMenu (menu2, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, @@ -5030,7 +5057,7 @@ static void systraymenu (HWND hwnd) DestroyMenu (menu); } -static void LLError(HMODULE m, const TCHAR *s) +static void LLError (HMODULE m, const TCHAR *s) { DWORD err; diff --git a/od-win32/win32.h b/od-win32/win32.h index 1fc9b9fd..0563258a 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -18,8 +18,8 @@ #define WINUAEPUBLICBETA 1 #define LANG_DLL 1 -#define WINUAEBETA L"8" -#define WINUAEDATE MAKEBD(2010, 7, 30) +#define WINUAEBETA L"9" +#define WINUAEDATE MAKEBD(2010, 8, 3) #define WINUAEEXTRA L"" #define WINUAEREV L"" diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index f220bba5..b07e91c7 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -20,19 +20,23 @@ struct uae_filter uaefilters[] = { - { UAE_FILTER_NULL, 0, 1, L"Null filter", L"null", 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0, 0 }, + { UAE_FILTER_NULL, 0, 1, L"Null filter", L"null", UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32 }, - { UAE_FILTER_SCALE2X, 0, 2, L"Scale2X", L"scale2x", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0, 0 }, + { UAE_FILTER_SCALE2X, 0, 2, L"Scale2X", L"scale2x", UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32 }, - { UAE_FILTER_HQ, 0, 2, L"hq2x/3x/4x", L"hqx", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32 }, + { UAE_FILTER_HQ2X, 0, 2, L"hq2x", L"hq2x", UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, }, - { UAE_FILTER_SUPEREAGLE, 0, 2, L"SuperEagle", L"supereagle", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 }, + { UAE_FILTER_HQ3X, 0, 3, L"hq3x", L"hq3x", UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32 }, - { UAE_FILTER_SUPER2XSAI, 0, 2, L"Super2xSaI", L"super2xsai", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 }, + { UAE_FILTER_HQ4X, 0, 4, L"hq4x", L"hq4x", UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32 }, - { UAE_FILTER_2XSAI, 0, 2, L"2xSaI", L"2xsai", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 }, + { UAE_FILTER_SUPEREAGLE, 0, 2, L"SuperEagle", L"supereagle", UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32 }, - { UAE_FILTER_PAL, 1, 1, L"PAL", L"pal", 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0, 0 }, + { UAE_FILTER_SUPER2XSAI, 0, 2, L"Super2xSaI", L"super2xsai", UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32 }, + + { UAE_FILTER_2XSAI, 0, 2, L"2xSaI", L"2xsai", UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32 }, + + { UAE_FILTER_PAL, 1, 1, L"PAL", L"pal", UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32 }, { 0 } }; @@ -107,7 +111,7 @@ static int vblscale2 (int v) static void fixh (int *ah, int *th) { if (!(beamcon0 & 0x80)) { - int max = (572 / 2) << currprefs.gfx_vresolution; + int max = ((572 / 2) * scale) << currprefs.gfx_vresolution; if (*ah > max) *ah = max; if (*th > max) @@ -508,9 +512,10 @@ void S2X_free (void) filteroffsety = 0; filterxmult = 1000; filterymult = 1000; + scale = 1; } -void S2X_init (int dw, int dh, int aw, int ah, int mult, int ad, int dd) +void S2X_init (int dw, int dh, int aw, int ah, int ad, int dd) { int flags = 0; int res_shift; @@ -530,12 +535,13 @@ void S2X_init (int dw, int dh, int aw, int ah, int mult, int ad, int dd) if (!currprefs.gfx_filter || !usedfilter) { usedfilter = &uaefilters[0]; - mult = 1; - } else if (mult) { - flags = usedfilter->x[mult]; + scale = 1; + } else { + scale = usedfilter->intmul; + flags = usedfilter->flags; if ((ad == 16 && !(flags & UAE_FILTER_MODE_16)) || (ad == 32 && !(flags & UAE_FILTER_MODE_32))) { usedfilter = &uaefilters[0]; - mult = 1; + scale = 1; changed_prefs.gfx_filter = usedfilter->type; } } @@ -553,11 +559,13 @@ void S2X_init (int dw, int dh, int aw, int ah, int mult, int ad, int dd) amiga_width = aw; amiga_height = ah; amiga_depth = ad; - scale = mult; if (d3d) { - temp_width = dst_width * mult; - temp_height = dst_height * mult; + int m = currprefs.gfx_filter_filtermode + 1; + if (m < scale) + m = scale; + temp_width = dst_width * m; + temp_height = dst_height * m; } else { temp_width = dst_width * 3; if (temp_width > dxcaps.maxwidth) @@ -571,7 +579,7 @@ void S2X_init (int dw, int dh, int aw, int ah, int mult, int ad, int dd) temp_height = dst_height; } - if (usedfilter->type == UAE_FILTER_HQ) { + if (usedfilter->type == UAE_FILTER_HQ2X || usedfilter->type == UAE_FILTER_HQ3X || usedfilter->type == UAE_FILTER_HQ4X) { int w = amiga_width > dst_width ? amiga_width : dst_width; int h = amiga_height > dst_height ? amiga_height : dst_height; tempsurf2 = xmalloc (uae_u8, w * h * (amiga_depth / 8) * ((scale + 1) / 2)); @@ -648,7 +656,7 @@ void S2X_render (void) ok = 1; } - } else if (usedfilter->type == UAE_FILTER_HQ) { /* 32/2X+3X+4X */ + } else if (usedfilter->type == UAE_FILTER_HQ2X || usedfilter->type == UAE_FILTER_HQ3X || usedfilter->type == UAE_FILTER_HQ4X) { /* 32/2X+3X+4X */ #ifndef CPU_64_BIT @@ -664,19 +672,19 @@ void S2X_render (void) sptr += gfxvidinfo.rowbytes; } if (amiga_depth == 16 && dst_depth == 32) { - if (scale == 2) + if (usedfilter->type == UAE_FILTER_HQ2X) hq2x_32 (tempsurf2, tempsurf3, aw, ah, aws * 4); - else if (scale == 3) + else if (usedfilter->type == UAE_FILTER_HQ3X) hq3x_32 (tempsurf2, tempsurf3, aw, ah, aws * 4); - else if (scale == 4) + else if (usedfilter->type == UAE_FILTER_HQ4X) hq4x_32 (tempsurf2, tempsurf3, aw, ah, aws * 4); ok = 1; } else if (amiga_depth == 16 && dst_depth == 16) { - if (scale == 2) + if (usedfilter->type == UAE_FILTER_HQ2X) hq2x_16 (tempsurf2, tempsurf3, aw, ah, aws * 2); - else if (scale == 3) + else if (usedfilter->type == UAE_FILTER_HQ3X) hq3x_16 (tempsurf2, tempsurf3, aw, ah, aws * 2); - else if (scale == 4) + else if (usedfilter->type == UAE_FILTER_HQ4X) hq4x_16 (tempsurf2, tempsurf3, aw, ah, aws * 2); ok = 1; } @@ -781,26 +789,9 @@ void S2X_refresh (void) int S2X_getmult (void) { - int j, i; - if (!usedfilter) return 1; - j = 0; - for (i = 1; i <= 4; i++) { - if (usedfilter->x[i]) - j++; - } - i = currprefs.gfx_filter_filtermode; - if (i >= j) - i = 0; - j = 0; - while (i >= 0) { - while (!usedfilter->x[j]) - j++; - if(i-- > 0) - j++; - } - return j; + return usedfilter->intmul; } #endif diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 26603c21..d7a5c249 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -1100,11 +1100,9 @@ static void updatemodes (void) flags |= DM_W_FULLSCREEN; #if defined (GFXFILTER) if (usedfilter) { - if (!usedfilter->x[0]) { - flags |= DM_SWSCALE; - if (currentmode->current_depth < 15) - currentmode->current_depth = 16; - } + flags |= DM_SWSCALE; + if (currentmode->current_depth < 15) + currentmode->current_depth = 16; } #endif if (currprefs.gfx_api) { @@ -2367,7 +2365,6 @@ static BOOL doInit (void) RGBFTYPE colortype; int tmp_depth; int ret = 0; - int mult = 0; if (wasfullwindow_a == 0) wasfullwindow_a = currprefs.gfx_afullscreen == GFX_FULLWINDOW ? 1 : -1; @@ -2444,11 +2441,10 @@ static BOOL doInit (void) if (currentmode->amiga_height > 960) currentmode->amiga_height = 960; if (usedfilter) { - mult = S2X_getmult (); - if ((usedfilter->x[mult] & (UAE_FILTER_MODE_16 | UAE_FILTER_MODE_32)) == (UAE_FILTER_MODE_16 | UAE_FILTER_MODE_32)) { + if ((usedfilter->flags & (UAE_FILTER_MODE_16 | UAE_FILTER_MODE_32)) == (UAE_FILTER_MODE_16 | UAE_FILTER_MODE_32)) { currentmode->current_depth = currentmode->native_depth; } else { - currentmode->current_depth = (usedfilter->x[mult] & UAE_FILTER_MODE_32) ? 32 : 16; + currentmode->current_depth = (usedfilter->flags & UAE_FILTER_MODE_32) ? 32 : 16; } } currentmode->pitch = currentmode->amiga_width * currentmode->current_depth >> 3; @@ -2523,12 +2519,12 @@ static BOOL doInit (void) if (currentmode->flags & DM_SWSCALE) { S2X_init (currentmode->native_width, currentmode->native_height, currentmode->amiga_width, currentmode->amiga_height, - mult, currentmode->current_depth, currentmode->native_depth); + currentmode->current_depth, currentmode->native_depth); } #ifdef D3D if (currentmode->flags & DM_D3D) { const TCHAR *err = D3D_init (hAmigaWnd, currentmode->native_width, currentmode->native_height, - currentmode->amiga_width, currentmode->amiga_height, currentmode->current_depth); + currentmode->amiga_width, currentmode->amiga_height, currentmode->current_depth, currprefs.gfx_filter_filtermode + 1); if (err) { D3D_free (); gui_message (err); diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index e1c3f08b..57c321b5 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -940,22 +940,22 @@ static TCHAR *favoritepopup (HWND hwnd, int drive) if (srcdrive >= 0 && srcdrive <= 4) { if (!morefiles) { for (i = 0; i < 4; i++) { - if (workprefs.df[i][0] && srcdrive != i) { + if (workprefs.floppyslots[i].df[0] && srcdrive != i) { TCHAR tmp[100]; _stprintf (tmp, L"[DF%c:]", i + '0'); fitem[idx].value = my_strdup (tmp); - fitem[idx].path = my_strdup (workprefs.df[i]); + fitem[idx].path = my_strdup (workprefs.floppyslots[i].df); fitem[idx].type = 3 + i; idx++; fitem[idx].type = 0; } } } - if (workprefs.df[srcdrive][0]) { + if (workprefs.floppyslots[srcdrive].df[0]) { if (morefiles > 0) { - idx = getdeepfavdiskimage (workprefs.df[srcdrive], fitem, idx); + idx = getdeepfavdiskimage (workprefs.floppyslots[srcdrive].df, fitem, idx); } else { - idx = getfavdiskimage (workprefs.df[srcdrive], fitem, idx); + idx = getfavdiskimage (workprefs.floppyslots[srcdrive].df, fitem, idx); morefiles = -1; } } @@ -967,8 +967,8 @@ static TCHAR *favoritepopup (HWND hwnd, int drive) break; if (ret <= idx) { if (fitem[ret - 1].type == 2) { - _tcscpy (workprefs.df[dstdrive], fitem[ret - 1].value); - disk_insert (dstdrive, workprefs.df[dstdrive]); + _tcscpy (workprefs.floppyslots[dstdrive].df, fitem[ret - 1].value); + disk_insert (dstdrive, workprefs.floppyslots[dstdrive].df); ret = 0; } break; @@ -1956,7 +1956,7 @@ static void ejectfloppy (int n) if (iscd (n)) { eject_cd (); } else { - workprefs.df[n][0] = 0; + workprefs.floppyslots[n].df[0] = 0; } } @@ -1977,9 +1977,9 @@ static void selectdisk (struct uae_prefs *prefs, HWND hDlg, int num, int id, con return; } SetDlgItemText (hDlg, id, full_path); - _tcscpy(prefs->df[num], full_path); - fullpath (prefs->df[num], sizeof prefs->df[num] / sizeof (TCHAR)); - DISK_history_add (prefs->df[num], -1, HISTORY_FLOPPY, 0); + _tcscpy(prefs->floppyslots[num].df, full_path); + fullpath (prefs->floppyslots[num].df, sizeof prefs->floppyslots[num].df / sizeof (TCHAR)); + DISK_history_add (prefs->floppyslots[num].df, -1, HISTORY_FLOPPY, 0); } static void setdpath (const TCHAR *name, const TCHAR *path) @@ -3238,7 +3238,7 @@ static int disk_in_drive (int entry) { int i; for (i = 0; i < 4; i++) { - if (_tcslen (workprefs.dfxlist[entry]) > 0 && !_tcscmp (workprefs.dfxlist[entry], workprefs.df[i])) + if (_tcslen (workprefs.dfxlist[entry]) > 0 && !_tcscmp (workprefs.dfxlist[entry], workprefs.floppyslots[i].df)) return i; } return -1; @@ -3255,36 +3255,36 @@ static int disk_swap (int entry, int mode) } if ((drv = disk_in_drive (entry)) >= 0) { if (mode < 0) { - workprefs.df[drv][0] = 0; + workprefs.floppyslots[drv].df[0] = 0; return 1; } - if (_tcscmp (workprefs.df[drv], currprefs.df[drv])) { - _tcscpy (workprefs.df[drv], currprefs.df[drv]); - disk_insert (drv, workprefs.df[drv]); + if (_tcscmp (workprefs.floppyslots[drv].df, currprefs.floppyslots[drv].df)) { + _tcscpy (workprefs.floppyslots[drv].df, currprefs.floppyslots[drv].df); + disk_insert (drv, workprefs.floppyslots[drv].df); } else { - workprefs.df[drv][0] = 0; + workprefs.floppyslots[drv].df[0] = 0; } if (drvs[0] < 0 || drvs[1] < 0 || drvs[2] < 0 || drvs[3] < 0) { drv++; while (drv < 4 && drvs[drv] >= 0) drv++; - if (drv < 4 && workprefs.dfxtype[drv] >= 0) { - _tcscpy (workprefs.df[drv], workprefs.dfxlist[entry]); - disk_insert (drv, workprefs.df[drv]); + if (drv < 4 && workprefs.floppyslots[drv].dfxtype >= 0) { + _tcscpy (workprefs.floppyslots[drv].df, workprefs.dfxlist[entry]); + disk_insert (drv, workprefs.floppyslots[drv].df); } } return 1; } for (i = 0; i < 4; i++) { - if (drvs[i] < 0 && workprefs.dfxtype[i] >= 0) { - _tcscpy (workprefs.df[i], workprefs.dfxlist[entry]); - disk_insert (i, workprefs.df[i]); + if (drvs[i] < 0 && workprefs.floppyslots[i].dfxtype >= 0) { + _tcscpy (workprefs.floppyslots[i].df, workprefs.dfxlist[entry]); + disk_insert (i, workprefs.floppyslots[i].df); return 1; } } - _tcscpy (workprefs.df[0], workprefs.dfxlist[entry]); - disk_insert (0, workprefs.df[0]); + _tcscpy (workprefs.floppyslots[0].df, workprefs.dfxlist[entry]); + disk_insert (0, workprefs.floppyslots[0].df); return 1; } @@ -4774,7 +4774,7 @@ static void load_quickstart (HWND hDlg, int romcheck) workprefs.nr_floppies = quickstart_floppy; quickstart_ok = built_in_prefs (&workprefs, quickstart_model, quickstart_conf, quickstart_compa, romcheck); workprefs.ntscmode = quickstart_ntsc != 0; - quickstart_cd = workprefs.dfxtype[1] == DRV_NONE && (quickstart_model == 8 || quickstart_model == 9); + quickstart_cd = workprefs.floppyslots[1].dfxtype == DRV_NONE && (quickstart_model == 8 || quickstart_model == 9); enable_for_quickstart (hDlg); addfloppytype (hDlg, 0); addfloppytype (hDlg, 1); @@ -4829,10 +4829,10 @@ static void init_quickstartdlg (HWND hDlg) regquerystr (NULL, L"QuickStartCDDrive", quickstart_cddrive, &size); regqueryint (NULL, L"QuickStartNTSC", &quickstart_ntsc); if (quickstart) { - workprefs.df[0][0] = 0; - workprefs.df[1][0] = 0; - workprefs.df[2][0] = 0; - workprefs.df[3][0] = 0; + workprefs.floppyslots[0].df[0] = 0; + workprefs.floppyslots[1].df[0] = 0; + workprefs.floppyslots[2].df[0] = 0; + workprefs.floppyslots[3].df[0] = 0; workprefs.cdslots[0].name[0] = 0; workprefs.cdslots[0].inuse = quickstart_cdtype > 0; load_quickstart (hDlg, 1); @@ -4944,11 +4944,11 @@ static void testimage (HWND hDlg, int num) floppytooltip (hDlg, num, 0); quickstart_ok_floppy = 0; - if (workprefs.dfxtype[0] < 0) { + if (workprefs.floppyslots[0].dfxtype < 0) { quickstart_ok_floppy = 1; return; } - if (!workprefs.df[num][0]) + if (!workprefs.floppyslots[num].df[0]) return; ret = DISK_examine_image (&workprefs, num, &crc32); if (!ret) @@ -5006,12 +5006,12 @@ static void addallfloppies (HWND hDlg); static void setfloppytexts (HWND hDlg, int qs) { - SetDlgItemText (hDlg, IDC_DF0TEXT, workprefs.df[0]); - SetDlgItemText (hDlg, IDC_DF1TEXT, workprefs.df[1]); - SetDlgItemText (hDlg, IDC_DF2TEXT, workprefs.df[2]); - SetDlgItemText (hDlg, IDC_DF3TEXT, workprefs.df[3]); - SetDlgItemText (hDlg, IDC_DF0TEXTQ, workprefs.df[0]); - SetDlgItemText (hDlg, IDC_DF1TEXTQ, workprefs.df[1]); + SetDlgItemText (hDlg, IDC_DF0TEXT, workprefs.floppyslots[0].df); + SetDlgItemText (hDlg, IDC_DF1TEXT, workprefs.floppyslots[1].df); + SetDlgItemText (hDlg, IDC_DF2TEXT, workprefs.floppyslots[2].df); + SetDlgItemText (hDlg, IDC_DF3TEXT, workprefs.floppyslots[3].df); + SetDlgItemText (hDlg, IDC_DF0TEXTQ, workprefs.floppyslots[0].df); + SetDlgItemText (hDlg, IDC_DF1TEXTQ, workprefs.floppyslots[1].df); if (!qs) addallfloppies (hDlg); } @@ -5192,15 +5192,15 @@ static INT_PTR CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, L } if (recursive == 0 && quickstart) { recursive++; - if (_tcscmp (workprefs.df[0], df0) || workprefs.dfxtype[0] != dfxtype[0]) { - _tcscpy (df0, workprefs.df[0]); - dfxtype[0] = workprefs.dfxtype[0]; + if (_tcscmp (workprefs.floppyslots[0].df, df0) || workprefs.floppyslots[0].dfxtype != dfxtype[0]) { + _tcscpy (df0, workprefs.floppyslots[0].df); + dfxtype[0] = workprefs.floppyslots[0].dfxtype; testimage (hDlg, 0); enable_for_quickstart (hDlg); } - if (_tcscmp (workprefs.df[1], df1) || workprefs.dfxtype[1] != dfxtype[1]) { - _tcscpy (df1, workprefs.df[1]); - dfxtype[1] = workprefs.dfxtype[1]; + if (_tcscmp (workprefs.floppyslots[1].df, df1) || workprefs.floppyslots[1].dfxtype != dfxtype[1]) { + _tcscpy (df1, workprefs.floppyslots[1].df); + dfxtype[1] = workprefs.floppyslots[1].dfxtype; testimage (hDlg, 1); } recursive--; @@ -8183,11 +8183,11 @@ static void values_to_sounddlg (HWND hDlg) p += _tcslen (p) + 1; } } - if (workprefs.dfxclick[idx] < 0) { + if (workprefs.floppyslots[idx].dfxclick < 0) { p = drivesounds; i = DS_BUILD_IN_SOUNDS + (driveclick_pcdrivemask ? 2 : 0) + 1; while (p && p[0]) { - if (!_tcsicmp (p, workprefs.dfxclickexternal[idx])) { + if (!_tcsicmp (p, workprefs.floppyslots[idx].dfxclickexternal)) { SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_SETCURSEL, i, 0); break; } @@ -8196,7 +8196,7 @@ static void values_to_sounddlg (HWND hDlg) } } else { - SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_SETCURSEL, workprefs.dfxclick[idx], 0); + SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_SETCURSEL, workprefs.floppyslots[idx].dfxclick, 0); } update_soundgui (hDlg); @@ -8295,11 +8295,11 @@ static void values_from_sounddlg (HWND hDlg) TCHAR *p = drivesounds; while (j-- > 0) p += _tcslen (p) + 1; - workprefs.dfxclick[idx] = -1; - _tcscpy (workprefs.dfxclickexternal[idx], p); + workprefs.floppyslots[idx].dfxclick = -1; + _tcscpy (workprefs.floppyslots[idx].dfxclickexternal, p); } else { - workprefs.dfxclick[idx] = res; - workprefs.dfxclickexternal[idx][0] = 0; + workprefs.floppyslots[idx].dfxclick = res; + workprefs.floppyslots[idx].dfxclickexternal[0] = 0; } } } @@ -9421,8 +9421,8 @@ static void addfloppyhistory_2 (HWND hDlg, int n, int f_text, int type) nn = 1; text = workprefs.cdslots[0].name; } else { - nn = workprefs.dfxtype[n] + 1; - text = workprefs.df[n]; + nn = workprefs.floppyslots[n].dfxtype + 1; + text = workprefs.floppyslots[n].df; } SendDlgItemMessage (hDlg, f_text, WM_SETTEXT, 0, (LPARAM)text); fkey = read_disk_history (type); @@ -9524,7 +9524,7 @@ static void addcdtype (HWND hDlg, int id) static void addfloppytype (HWND hDlg, int n) { int state, chk; - int nn = workprefs.dfxtype[n] + 1; + int nn = workprefs.floppyslots[n].dfxtype + 1; int showcd = 0; TCHAR *text; @@ -9537,7 +9537,7 @@ static void addfloppytype (HWND hDlg, int n) int f_si = floppybuttons[n][6]; int f_enable = floppybuttons[n][7]; - text = workprefs.df[n]; + text = workprefs.floppyslots[n].df; if (currentpage == QUICKSTART_ID) { TCHAR tmp[MAX_DPATH]; f_text = floppybuttonsq[n][0]; @@ -9614,8 +9614,8 @@ static void getfloppytype (HWND hDlg, int n) int f_type = floppybuttons[n][3]; LRESULT val = SendDlgItemMessage (hDlg, f_type, CB_GETCURSEL, 0, 0L); - if (val != CB_ERR && workprefs.dfxtype[n] != val - 1) { - workprefs.dfxtype[n] = (int)val - 1; + if (val != CB_ERR && workprefs.floppyslots[n].dfxtype != val - 1) { + workprefs.floppyslots[n].dfxtype = (int)val - 1; addfloppytype (hDlg, n); } } @@ -9629,8 +9629,8 @@ static void getfloppytypeq (HWND hDlg, int n) if (iscd (n)) return; chk = ischecked (hDlg, f_enable) ? 0 : -1; - if (chk != workprefs.dfxtype[n]) { - workprefs.dfxtype[n] = chk; + if (chk != workprefs.floppyslots[n].dfxtype) { + workprefs.floppyslots[n].dfxtype = chk; addfloppytype (hDlg, n); } if (currentpage == QUICKSTART_ID) { @@ -9685,7 +9685,7 @@ static void getfloppyname (HWND hDlg, int n, int cd, int f_text) if (getfloppybox (hDlg, f_text, tmp, sizeof (tmp) / sizeof (TCHAR), cd ? HISTORY_CD : HISTORY_FLOPPY)) { if (!cd) { disk_insert (n, tmp); - _tcscpy (workprefs.df[n], tmp); + _tcscpy (workprefs.floppyslots[n].df, tmp); } else { if (quickstart_cddrive[0]) eject_cd (); @@ -9712,7 +9712,7 @@ static void addallfloppies (HWND hDlg) static void floppysetwriteprotect (HWND hDlg, int n, int protect) { if (!iscd (n)) { - disk_setwriteprotect (n, workprefs.df[n], protect); + disk_setwriteprotect (n, workprefs.floppyslots[n].df, protect); addfloppytype (hDlg, n); } } @@ -9722,7 +9722,7 @@ static void deletesaveimage (HWND hDlg, int num) TCHAR *p; if (!iscd (num)) return; - p = DISK_get_saveimagepath (workprefs.df[num]); + p = DISK_get_saveimagepath (workprefs.floppyslots[num].df); if (zfile_exists (p)) { DeleteFile (p); DISK_reinsert (num); @@ -9735,10 +9735,10 @@ static void diskselect (HWND hDlg, WPARAM wParam, struct uae_prefs *p, int drv, int cd = iscd (drv); MultiDiskSelection (hDlg, wParam, cd ? 17 : 0, &workprefs, defaultpath); if (!cd) { - disk_insert (0, p->df[0]); - disk_insert (1, p->df[1]); - disk_insert (2, p->df[2]); - disk_insert (3, p->df[3]); + disk_insert (0, p->floppyslots[0].df); + disk_insert (1, p->floppyslots[1].df); + disk_insert (2, p->floppyslots[2].df); + disk_insert (3, p->floppyslots[3].df); } addfloppytype (hDlg, drv); addfloppyhistory (hDlg); @@ -10031,6 +10031,46 @@ static void addswapperfile (HWND hDlg, int entry, TCHAR *newpath) } } +static void diskswapper_addfile2 (struct uae_prefs *prefs, const TCHAR *file) +{ + int list = 0; + while (list < MAX_SPARE_DRIVES) { + if (!strcasecmp (prefs->dfxlist[list], file)) + break; + list++; + } + if (list == MAX_SPARE_DRIVES) { + list = 0; + while (list < MAX_SPARE_DRIVES) { + if (!prefs->dfxlist[list][0]) { + _tcscpy (prefs->dfxlist[list], file); + break; + } + list++; + } + } +} + +static void diskswapper_addfile (struct uae_prefs *prefs, const TCHAR *file) +{ + struct zdirectory *zd = zfile_opendir_archive (file); + if (zd) { + TCHAR out[MAX_DPATH]; + while (zfile_readdir_archive (zd, out, true)) { + struct zfile *zf = zfile_fopen (out, L"rb", ZFD_NORMAL); + if (zf) { + int type = zfile_gettype (zf); + if (type == ZFILE_DISKIMAGE) + diskswapper_addfile2 (prefs, out); + zfile_fclose (zf); + } + } + zfile_closedir_archive (zd); + } else { + diskswapper_addfile2 (prefs, file); + } +} + static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static int recursive = 0; @@ -10135,13 +10175,13 @@ static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR { int drv = LOWORD (wParam) - 10201; int i; - if (workprefs.dfxtype[drv] >= 0 && entry >= 0) { + if (workprefs.floppyslots[drv].dfxtype >= 0 && entry >= 0) { for (i = 0; i < 4; i++) { - if (!_tcscmp (workprefs.df[i], workprefs.dfxlist[entry])) - workprefs.df[i][0] = 0; + if (!_tcscmp (workprefs.floppyslots[i].df, workprefs.dfxlist[entry])) + workprefs.floppyslots[i].df[0] = 0; } - _tcscpy (workprefs.df[drv], workprefs.dfxlist[entry]); - disk_insert (drv, workprefs.df[drv]); + _tcscpy (workprefs.floppyslots[drv].df, workprefs.dfxlist[entry]); + disk_insert (drv, workprefs.floppyslots[drv].df); InitializeListView (hDlg); swapperhili (hDlg, entry); } @@ -10153,7 +10193,7 @@ static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR case 10208: { int drv = LOWORD (wParam) - 10201; - workprefs.df[drv][0] = 0; + workprefs.floppyslots[drv].df[0] = 0; InitializeListView (hDlg); swapperhili (hDlg, entry); } @@ -11944,7 +11984,7 @@ static int filterpreset_selected = -1, filterpreset_builtin = -1; static void enable_for_hw3ddlg (HWND hDlg) { int v = workprefs.gfx_filter ? TRUE : FALSE; - int vv = FALSE, vv2 = FALSE, vv3 = FALSE, vv4 = FALSE; + int vv = FALSE, vv2 = FALSE, vv3 = FALSE; int as = workprefs.gfx_filter_autoscale == 1 || workprefs.gfx_filter_autoscale == 2; struct uae_filter *uf; int i, isfilter; @@ -11960,16 +12000,12 @@ static void enable_for_hw3ddlg (HWND hDlg) } i++; } - if (v && (uf->x[0] || uf->x[1] || uf->x[2] || uf->x[3] || uf->x[4])) + if (v && uf->intmul) vv = TRUE; - if (v && (uf->x[0] || uf->yuv)) + if (v && uf->yuv) vv2 = TRUE; - if (v && (uf->x[0] && !uf->yuv)) - vv3 = TRUE; - if (v && uf->x[0]) - vv4 = TRUE; if (workprefs.gfx_api) - v = vv = vv2 = vv3 = vv4 = TRUE; + v = vv = vv2 = vv3 = TRUE; ew (hDlg, IDC_FILTERHZ, v); ew (hDlg, IDC_FILTERVZ, v); @@ -11982,7 +12018,7 @@ static void enable_for_hw3ddlg (HWND hDlg) ew (hDlg, IDC_FILTERXLV, vv2); ew (hDlg, IDC_FILTERXTRA, vv2); ew (hDlg, IDC_FILTERDEFAULT, v); - ew (hDlg, IDC_FILTERFILTER, vv); + ew (hDlg, IDC_FILTERFILTER, workprefs.gfx_api); ew (hDlg, IDC_FILTERKEEPASPECT, v); ew (hDlg, IDC_FILTERASPECT, v); ew (hDlg, IDC_FILTERASPECT2, v && workprefs.gfx_filter_keep_aspect); @@ -11994,19 +12030,6 @@ static void enable_for_hw3ddlg (HWND hDlg) ew (hDlg, IDC_FILTERPRESETDELETE, filterpreset_selected > 0 && filterpreset_builtin < 0); } -static void makefilter (TCHAR *s, int x, int flags) -{ - _stprintf (s, L"%dx", x); - if ((flags & (UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32)) == (UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32)) { - _tcscat (s, L" (16bit/32bit)"); - return; - } - if (flags & UAE_FILTER_MODE_16) - _tcscat (s, L" (16bit)"); - if (flags & UAE_FILTER_MODE_32) - _tcscat (s, L" (32bit)"); -} - static TCHAR *filtermultnames[] = { L"FS", L"1/2x", L"1x", L"2x", L"4x", L"6x", L"8x", NULL }; static int filtermults[] = { 0, 2000, 1000, 500, 250, 167, 125 }; struct filterxtra { @@ -12077,7 +12100,7 @@ static struct filterpreset filterpresets[] = { NULL } }; -static int getfiltermult(HWND hDlg, DWORD dlg) +static int getfiltermult (HWND hDlg, DWORD dlg) { TCHAR tmp[100]; LRESULT v = SendDlgItemMessage (hDlg, dlg, CB_GETCURSEL, 0, 0L); @@ -12126,7 +12149,7 @@ static void setfiltermult (HWND hDlg) static void values_to_hw3ddlg (HWND hDlg) { TCHAR txt[100], tmp[100]; - int i, j, fltnum, modenum; + int i, j, fltnum; struct uae_filter *uf; int fxidx, fxcnt; UAEREG *fkey; @@ -12243,26 +12266,24 @@ static void values_to_hw3ddlg (HWND hDlg) fxidx = 0; filter_extra[fxidx] = NULL; - SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_RESETCONTENT, 0, 0L); if (workprefs.gfx_api) { filter_extra[fxidx++] = filter_3d_extra; filter_extra[fxidx] = NULL; } - ew (hDlg, IDC_FILTERFILTER, uf != NULL); - if (uf && !uf->x[0]) { - modenum = 0; - for (i = 1; i <= 4; i++) { - if (uf->x[i]) { - makefilter (tmp, i, uf->x[i]); - SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp); - modenum++; - } - } - if (uf->yuv) { - filter_extra[fxidx++] = filter_pal_extra; - filter_extra[fxidx] = NULL; + int filtermodenum = 0; + SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_RESETCONTENT, 0, 0L); + if (workprefs.gfx_api) { + for (i = 0; i < 4; i++) { + TCHAR tmp[100]; + _stprintf (tmp, L"%dx", i + 1); + SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp); + filtermodenum++; } } + if (uf && uf->yuv) { + filter_extra[fxidx++] = filter_pal_extra; + filter_extra[fxidx] = NULL; + } SendDlgItemMessage (hDlg, IDC_FILTERXL, TBM_SETRANGE, TRUE, MAKELONG ( 0, +1000)); SendDlgItemMessage (hDlg, IDC_FILTERXL, TBM_SETPAGESIZE, 0, 1); if (filter_extra[0]) { @@ -12298,11 +12319,9 @@ static void values_to_hw3ddlg (HWND hDlg) SendDlgItemMessage (hDlg, IDC_FILTERXL, TBM_SETPOS, TRUE, *(filter_selected->varw)); SetDlgItemInt (hDlg, IDC_FILTERXLV, *(filter_selected->varw), TRUE); } - - if (workprefs.gfx_filter_filtermode >= modenum) + if (workprefs.gfx_filter_filtermode >= filtermodenum) workprefs.gfx_filter_filtermode = 0; SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_SETCURSEL, workprefs.gfx_filter_filtermode, 0); - setfiltermult (hDlg); SendDlgItemMessage (hDlg, IDC_FILTERSLR, CB_RESETCONTENT, 0, 0L); @@ -12462,14 +12481,20 @@ static void filter_handle (HWND hDlg) { LRESULT item = SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_GETCURSEL, 0, 0L); if (item != CB_ERR) { - TCHAR tmp[MAX_DPATH]; + TCHAR tmp[MAX_DPATH], oldsh[MAX_DPATH]; int of = workprefs.gfx_filter; int off = workprefs.gfx_filter_filtermode; tmp[0] = 0; + _tcscpy (oldsh, workprefs.gfx_filtershader); SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_GETLBTEXT, (WPARAM)item, (LPARAM)tmp); workprefs.gfx_filtershader[0] = 0; workprefs.gfx_filter = 0; workprefs.gfx_filter_filtermode = 0; + if (workprefs.gfx_api) { + LRESULT item2 = SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_GETCURSEL, 0, 0L); + if (item2 != CB_ERR) + workprefs.gfx_filter_filtermode = (int)item2; + } if (item > 0) { if (item > UAE_FILTER_LAST) { _stprintf (workprefs.gfx_filtershader, L"%s.fx", tmp + 5); @@ -12477,11 +12502,6 @@ static void filter_handle (HWND hDlg) item--; workprefs.gfx_filter = uaefilters[item].type; } - if (workprefs.gfx_filter) { - item = SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_GETCURSEL, 0, 0L); - if (item != CB_ERR) - workprefs.gfx_filter_filtermode = (int)item; - } if (of != workprefs.gfx_filter || off != workprefs.gfx_filter_filtermode) { values_to_hw3ddlg (hDlg); hw3d_changed = 1; @@ -13460,6 +13480,42 @@ static void centerWindow (HWND hDlg) SetWindowPos (hDlg, HWND_TOP, x, y, 0, 0, SWP_NOSIZE); } +static int floppyslot_addfile2 (struct uae_prefs *prefs, const TCHAR *file, int drv, int firstdrv, int maxdrv) +{ + _tcscpy (workprefs.floppyslots[drv].df, file); + disk_insert (drv, workprefs.floppyslots[drv].df); + drv++; + if (drv >= (currentpage == QUICKSTART_ID ? 2 : 4)) + drv = 0; + if (workprefs.floppyslots[drv].dfxtype < 0) + drv = 0; + if (drv == firstdrv) + return -1; + return drv; +} +static int floppyslot_addfile (struct uae_prefs *prefs, const TCHAR *file, int drv, int firstdrv, int maxdrv) +{ + struct zdirectory *zd = zfile_opendir_archive (file); + if (zd) { + TCHAR out[MAX_DPATH]; + while (zfile_readdir_archive (zd, out, true)) { + struct zfile *zf = zfile_fopen (out, L"rb", ZFD_NORMAL); + if (zf) { + int type = zfile_gettype (zf); + if (type == ZFILE_DISKIMAGE) { + drv = floppyslot_addfile2 (prefs, out, drv, firstdrv, maxdrv); + if (drv < 0) + break; + } + } + } + zfile_closedir_archive (zd); + } else { + drv = floppyslot_addfile2 (prefs, file, drv, firstdrv, maxdrv); + } + return drv; +} + static int do_filesys_insert (const TCHAR *root) { if (filesys_insert (-1, NULL, root, 0, 0) == 0) @@ -13469,7 +13525,7 @@ static int do_filesys_insert (const TCHAR *root) int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) { - int cnt, i, drv, harddrive, drvdrag, firstdrv, list; + int cnt, i, drv, harddrive, drvdrag, firstdrv; TCHAR file[MAX_DPATH]; int dfxtext[] = { IDC_DF0TEXT, IDC_DF0TEXTQ, IDC_DF1TEXT, IDC_DF1TEXTQ, IDC_DF2TEXT, -1, IDC_DF3TEXT, -1 }; POINT pt; @@ -13502,7 +13558,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) } else if (currentpage == FLOPPY_ID || currentpage == QUICKSTART_ID) { for (i = 0; i < 4; i++) { int id = dfxtext[i * 2 + (currentpage == QUICKSTART_ID ? 1 : 0)]; - if (workprefs.dfxtype[i] >= 0 && id >= 0) { + if (workprefs.floppyslots[i].dfxtype >= 0 && id >= 0) { if (GetPanelRect (GetDlgItem (panelDlg, id), &r)) { if (PtInRect (&r, pt)) { drv = i; @@ -13562,34 +13618,13 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) { case ZFILE_DISKIMAGE: if (currentpage == DISK_ID) { - list = 0; - while (list < MAX_SPARE_DRIVES) { - if (!strcasecmp (prefs->dfxlist[list], file)) - break; - list++; - } - if (list == MAX_SPARE_DRIVES) { - list = 0; - while (list < MAX_SPARE_DRIVES) { - if (!prefs->dfxlist[list][0]) { - _tcscpy (prefs->dfxlist[list], file); - break; - } - list++; - } - } + diskswapper_addfile (prefs, file); } else if (currentpage == HARDDISK_ID) { add_filesys_config (&workprefs, -1, NULL, L"", file, 0, 0, 0, 0, 0, 0, NULL, 0, 0); } else { - _tcscpy (workprefs.df[drv], file); - disk_insert (drv, workprefs.df[drv]); - drv++; - if (drv >= (currentpage == QUICKSTART_ID ? 2 : 4)) - drv = 0; - if (workprefs.dfxtype[drv] < 0) - drv = 0; - if (drv == firstdrv) + drv = floppyslot_addfile (prefs, file, drv, firstdrv, i); + if (drv < 0) i = cnt; } break; diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index e4ad02f4..61a665f7 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,26 @@ +- when attempting to play CD32 data track: return normal "playing" status and "play ended + with error" flag in next status packet (Mission Impossible 2025 CD32) +- return error status when CD32 qcode command packet is received and currently played CD + audio track is about to change (jumping "laser" in CD32 built-in CD player) +- new D3D filter stupid design fault corrected, all 2x or higher D3D shader filters had + bad image quality because both internal source and destination textures had identical + size.. +- select box next to filter name is now D3D shader filter supersampling mode, + 1x = normal, 2x = internal texture is twice the size of display etc.. Big texture + support required, makes some shader filters look more smoother when combined with + bilinear filtering (for example hq2x) +- crash when entering or exiting GUI when ASPI SCSI mode enabled (b6) +- cd32 pad shift register should stay in reset state in 2-button mode (F17 Challenge CD32) +- added cd insert/eject to systray menu +- added configuration file delayed cd insert, add "delay" to end of path ("cdimage0=,delay"), + waits 3 seconds before inserting the cd, workaround for stupid CD32 games that only work + if CD is inserted after boot screen (F17 Challenge and Last Ninja 3, maybe others) +- fixed cue+mp3 size detection if mp3 frames included checksum data +- only accept 8 or 32-bit Windows clipboard image input (instead of crashing..) +- diskswapper and floppy/quickstart archive dragndrop: add all disk images inside the + archive (I don't know why this was done ages ago..) + Beta 8: - GUI configuration panel crash fix (b7) @@ -7,7 +29,7 @@ Beta 8: - removed obsolete 15-bit fullscreen mode support code - statefile restore failed if rarely used 68020 M status register bit was set - added protection against starting new transparent clipboard conversion - if previous hasn't fully finished yet + if previous operation has not finished yet Beta 7: diff --git a/od-win32/writelog.cpp b/od-win32/writelog.cpp index 597892c0..e65ac284 100644 --- a/od-win32/writelog.cpp +++ b/od-win32/writelog.cpp @@ -489,7 +489,7 @@ TCHAR* buf_out (TCHAR *buffer, int *bufsize, const TCHAR *format, ...) if (buffer == NULL) return 0; - count = _vsntprintf (buffer, (*bufsize) / sizeof (TCHAR) - 1, format, parms); + count = _vsntprintf (buffer, (*bufsize) - 1, format, parms); va_end (parms); *bufsize -= _tcslen (buffer); return buffer + _tcslen (buffer); diff --git a/prowizard/rippers/SkytPacker.c b/prowizard/rippers/SkytPacker.c index d7695497..30224247 100644 --- a/prowizard/rippers/SkytPacker.c +++ b/prowizard/rippers/SkytPacker.c @@ -60,7 +60,7 @@ void Rip_SKYT ( void ) Save_Rip ( "SKYT Packed module", SKYT_packer ); if ( Save_Status == GOOD ) - PW_i += (OutputSize - 261); /* 260 could be enough */ + PW_i += 257; } @@ -80,18 +80,21 @@ void Rip_SKYT ( void ) * (thx to Thomas Neumann) * 29 Nov 2003 : Update * - another bug removed :(. + * 2 Aug 2010 : + * - cleaned up a bit + * - track 0 was not correctly handled + * 3 Aug 2010 : + * - rewrote patternlist generation */ void Depack_SKYT ( void ) { - Uchar Pat_Pos; - Uchar *Whatever; + Uchar *Header, *Pattern; Uchar poss[37][2]; - long i=0,j=0,k=0; + long i=0,j=0,k=0,l=0,m=0; long Total_Sample_Size=0; - long Track_Values[128][4]; - long Track_Address; - long Where=PW_Start_Address; /* main pointer to prevent fread() */ + unsigned long ReadTrkPat[128][4], ReadPat[128]; + long Where=PW_Start_Address; long Highest_Track = 0; FILE *out; @@ -100,116 +103,148 @@ void Depack_SKYT ( void ) if ( Save_Status == BAD ) return; - BZERO ( Track_Values , 128*16 ); - sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 ); out = PW_fopen ( Depacked_OutName , "w+b" ); - /* write title */ - Whatever = (Uchar *) malloc (1024); - BZERO ( Whatever , 1024 ); - /* title */ - fwrite ( Whatever , 20 , 1 , out ); + Header = (Uchar *)malloc(1084); + Pattern = (Uchar *)malloc(1024); + BZERO ( Header , 1084 ); + BZERO ( Pattern , 1024 ); /* read and write sample descriptions */ for ( i=0 ; i<31 ; i++ ) { - /*sample name*/ - fwrite ( Whatever , 22 , 1 , out ); Total_Sample_Size += (((in_data[Where]*256)+in_data[Where+1])*2); /* write Size,Fine,Vol & Loop start */ - fwrite ( &in_data[Where] , 6 , 1 , out ); + Header[42+i*30] = in_data[Where]; + Header[43+i*30] = in_data[Where+1]; + Header[44+i*30] = in_data[Where+2]; + Header[45+i*30] = in_data[Where+3]; + Header[46+i*30] = in_data[Where+4]; + Header[47+i*30] = in_data[Where+5]; + Header[48+i*30] = in_data[Where+6]; + Header[49+i*30] = in_data[Where+7]; /* loop size */ - Whatever[32] = in_data[Where+7]; if ( (in_data[Where+6] == 0x00) && (in_data[Where+7] == 0x00) ) - Whatever[32] = 0x01; - fwrite ( &in_data[Where+6] , 1 , 1 , out ); - fwrite ( &Whatever[32] , 1 , 1 , out ); + Header[49+i*30] = 0x01; Where += 8; } /*printf ( "Whole sample size : %ld\n" , Total_Sample_Size );*/ - /* bypass 8 empty bytes and bypass "SKYT" ID*/ + /* go to track addresses list */ Where = PW_Start_Address + 260; /* pattern table lenght */ - Pat_Pos = in_data[Where]+1; + Header[950] = in_data[Where]+1; Where += 1; - fwrite ( &Pat_Pos , 1 , 1 , out ); - /*printf ( "Size of pattern list : %d\n" , Pat_Pos );*/ + /*printf ( "Size of pattern list : %d\n" , Header[950] );*/ /* write NoiseTracker byte */ - Whatever[32] = 0x7f; - fwrite ( &Whatever[32] , 1 , 1 , out ); + Header[951] = 0x7F; - /* read track numbers ... and deduce pattern list */ - for ( i=0 ; i Highest_Track ) - Highest_Track = Track_Values[i][j]; - Where += 2; - } + ReadPat[i] = (in_data[Where+i*8+1]*256*256*256) + + (in_data[Where+3+i*8]*256*256) + + (in_data[Where+5+i*8]*256) + + in_data[Where+7+i*8]; + ReadTrkPat[i][0] = in_data[Where+i*8+1]-1; + ReadTrkPat[i][1] = in_data[Where+i*8+3]-1; + ReadTrkPat[i][2] = in_data[Where+i*8+5]-1; + ReadTrkPat[i][3] = in_data[Where+i*8+7]-1; + if ((ReadTrkPat[i][0] != 0xffffffff) && (ReadTrkPat[i][0] > Highest_Track)) + Highest_Track = ReadTrkPat[i][0]; + if ((ReadTrkPat[i][1] != 0xffffffff) && (ReadTrkPat[i][1] > Highest_Track)) + Highest_Track = ReadTrkPat[i][1]; + if ((ReadTrkPat[i][2] != 0xffffffff) && (ReadTrkPat[i][2] > Highest_Track)) + Highest_Track = ReadTrkPat[i][2]; + if ((ReadTrkPat[i][3] != 0xffffffff) && (ReadTrkPat[i][3] > Highest_Track)) + Highest_Track = ReadTrkPat[i][3]; + /*printf ("%x-%x-%x-%x\n",ReadTrkPat[i][0],ReadTrkPat[i][1],ReadTrkPat[i][2],ReadTrkPat[i][3]);*/ } - /*printf ( "\nHighest track : %ld\n", Highest_Track );*/ + /*printf ("highest track nbr : %lx\n", Highest_Track);*/ + + /* sorting ?*/ + k = 0; /* next min */ + l = 0; - /* write pseudo pattern list */ - for ( Whatever[0]=0x00 ; Whatever[0]k)) + m = ReadPat[i]; + /* if k == m then an already existing ref was found */ + if (k==m) + continue; + /* m is the next minimum */ + k = m; + for (i=0; i 37) + printf ("\nbad note '%x' at %lx (ptk:%lx)(pattern:%ld)(voice:%ld)(row:%ld)(track:%lx)", + note, Where+(ReadTrkPat[j][k]*256)+d*4, k*4+d*16, i,k,d,ReadTrkPat[j][k]);*/ + Pattern[k*4+d*16] = poss[note][0]; + Pattern[k*4+d*16+1] = poss[note][1]; + /* samples */ + Pattern[k*4+d*16] |= (in_data[Where+(ReadTrkPat[j][k]*256)+d*4+1])&0xf0; + Pattern[k*4+d*16+2] = (in_data[Where+(ReadTrkPat[j][k]*256)+d*4+1])<<4; + Pattern[k*4+d*16+2] += in_data[Where+(ReadTrkPat[j][k]*256)+d*4+2]; + Pattern[k*4+d*16+3] = in_data[Where+(ReadTrkPat[j][k]*256)+d*4+3]; } } - fwrite ( Whatever , 1024 , 1 , out ); - /*printf ( "+" );*/ + fwrite ( Pattern , 1024 , 1 , out ); } - free ( Whatever ); - /*printf ( "\n" );*/ + free ( Pattern ); + free ( Header ); /* sample data */ - Where = Track_Address + Highest_Track*256; + Where += (Highest_Track+1)*256; + /*printf ("address of sample data : %ld\n",Where);*/ fwrite ( &in_data[Where] , Total_Sample_Size , 1 , out ); /* crap */ diff --git a/uaelib.cpp b/uaelib.cpp index 983c50ed..7a5cc278 100644 --- a/uaelib.cpp +++ b/uaelib.cpp @@ -198,7 +198,7 @@ static uae_u32 emulib_InsertDisk (uaecptr name, uae_u32 drive) return 0; /* ENAMETOOLONG */ s = au (real_name); - _tcscpy (changed_prefs.df[drive], s); + _tcscpy (changed_prefs.floppyslots[drive].df, s); xfree (s); return 1; @@ -246,7 +246,7 @@ static uae_u32 emulib_GetUaeConfig (uaecptr place) put_byte (place + 35, 1); for (j = 0; j < 4; j++) { - char *s = ua (currprefs.df[j]); + char *s = ua (currprefs.floppyslots[j].df); for (i = 0; i < 256; i++) put_byte (place + 36 + i + j * 256, s[i]); xfree (s); @@ -273,8 +273,8 @@ static uae_u32 emulib_GetDisk (uae_u32 drive, uaecptr name) if (drive > 3) return 0; - for (i = 0;i < 256; i++) { - put_byte (name + i, currprefs.df[drive][i]); + for (i = 0; i < 256; i++) { + put_byte (name + i, currprefs.floppyslots[drive].df[i]); } return 1; } diff --git a/zfile.cpp b/zfile.cpp index ad540aea..c19e16cf 100644 --- a/zfile.cpp +++ b/zfile.cpp @@ -2848,7 +2848,7 @@ struct zvolume *zfile_fopen_directory (const TCHAR *dirname) return zv; } -struct zvolume *zfile_fopen_archive (const TCHAR *filename) +struct zvolume *zfile_fopen_archive (const TCHAR *filename, bool norecurse) { struct zvolume *zv = NULL; struct zfile *zf = zfile_fopen_nozip (filename, L"rb"); @@ -2871,11 +2871,11 @@ struct zvolume *zfile_fopen_archive (const TCHAR *filename) } #endif /* pointless but who cares? */ - if (!zv) + if (!zv && !norecurse) zv = archive_directory_plain (zf); #if RECURSIVE_ARCHIVES - if (zv) + if (zv && !norecurse) zfile_fopen_archive_recurse (zv); #endif @@ -2886,6 +2886,10 @@ struct zvolume *zfile_fopen_archive (const TCHAR *filename) return zv; } +struct zvolume *zfile_fopen_archive (const TCHAR *filename) +{ + return zfile_fopen_archive (filename, false); +} struct zvolume *zfile_fopen_archive_root (const TCHAR *filename) { @@ -2977,19 +2981,34 @@ void zfile_fclose_archive (struct zvolume *zv) } struct zdirectory { + TCHAR *parentpath; struct znode *first; struct znode *n; + bool doclose; + struct zvolume *zv; + int cnt; + int offset; + TCHAR **filenames; }; struct zdirectory *zfile_opendir_archive (const TCHAR *path) { struct zvolume *zv = get_zvolume (path); + bool created = false; + if (zv == NULL) { + zv = zfile_fopen_archive (path, true); + created = true; + } struct znode *zn = get_znode (zv, path, TRUE); struct zdirectory *zd; - - if (!zn || (!zn->child && !zn->vchild)) + if (!zn || (!zn->child && !zn->vchild)) { + if (created) + zfile_fclose_archive (zv); return NULL; - zd = xmalloc (struct zdirectory, 1); + } + zd = xcalloc (struct zdirectory, 1); + if (created) + zd->zv = zv; if (zn->child) { zd->n = zn->child; } else { @@ -3002,23 +3021,68 @@ struct zdirectory *zfile_opendir_archive (const TCHAR *path) } zd->n = zn->vchild->root.next; } + zd->parentpath = my_strdup (path); zd->first = zd->n; return zd; } void zfile_closedir_archive (struct zdirectory *zd) { + if (!zd) + return; + zfile_fclose_archive (zd->zv); + xfree (zd->parentpath); + xfree (zd->filenames); xfree (zd); } -int zfile_readdir_archive (struct zdirectory *zd, TCHAR *out) +int zfile_readdir_archive (struct zdirectory *zd, TCHAR *out, bool fullpath) { - if (!zd->n) + out[0] = 0; + if (!zd->n || (zd->filenames != NULL && zd->offset >= zd->cnt)) return 0; - _tcscpy (out, zd->n->name); - zd->n = zd->n->sibling; + if (zd->filenames == NULL) { + struct znode *n = zd->first; + int cnt = 0, len = 0; + while (n) { + cnt++; + len += _tcslen (n->name) + 1; + n = n->sibling; + } + n = zd->first; + uae_u8 *buf = xmalloc (uae_u8, cnt * sizeof (TCHAR*) + len * sizeof (TCHAR) * cnt); + zd->filenames = (TCHAR**)buf; + buf += cnt * sizeof (TCHAR*); + for (int i = 0; i < cnt; i++) { + zd->filenames[i] = (TCHAR*)buf; + _tcscpy ((TCHAR*)buf, n->name); + buf += (_tcslen (n->name) + 1) * sizeof (TCHAR); + n = n->sibling; + } + for (int i = 0; i < cnt; i++) { + for (int j = i + 1; j < cnt; j++) { + if (_tcscmp (zd->filenames[i], zd->filenames[j]) > 0) { + TCHAR *tmp = zd->filenames[i]; + zd->filenames[i] = zd->filenames[j]; + zd->filenames[j] = tmp; + } + } + } + zd->cnt = cnt; + } + if (fullpath) { + _tcscpy (out, zd->parentpath); + _tcscat (out, L"\\"); + } + _tcscat (out, zd->filenames[zd->offset]); + zd->offset++; return 1; } +int zfile_readdir_archive (struct zdirectory *zd, TCHAR *out) +{ + return zfile_readdir_archive (zd, out, false); +} void zfile_resetdir_archive (struct zdirectory *zd) { + zd->offset = 0; zd->n = zd->first; } diff --git a/zfile_archive.cpp b/zfile_archive.cpp index 6d35afe0..cb080c26 100644 --- a/zfile_archive.cpp +++ b/zfile_archive.cpp @@ -25,6 +25,9 @@ #include #define unpack_log write_log +#undef unpack_log +#define unpack_log + static time_t fromdostime (uae_u32 dd) {