static void cdaudiostop (void)
{
- cdrom_playing = 0;
+ cdrom_audiotimeout = 0;
cdrom_paused = 0;
+ cdrom_playing = 0;
write_comm_pipe_u32 (&requests, 0x0104, 1);
}
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)
endlsn = s->paddress;
return 0;
}
+ qcode_valid = 0;
last_play_end = endlsn;
cdrom_audiotimeout = 0;
cdrom_paused = 0;
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? */
last_play_pos = msf2lsn (fromlongbcd (s + 7));
if (!d)
return 0;
+ buf[2] = 0;
/* ??? */
d[0] = 0;
/* CtlAdr */
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;
}
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
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;
}
}
}
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;
}
cdcomtxinx = 0;
cdcomrxinx = 0;
cdcomtxcmp = 0;
- lastmediastate = 0;
+ lastmediastate = -1;
}
cdrom_led = 0;
cdrom_receive_started = 0;
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);
#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)
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)) {
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];
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);
}
}
}
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);
{
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"<EMPTY>");
+ 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)
{
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);
{
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
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 };
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++) {
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);
}
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);
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;
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;
|| 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)))
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;
|| 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)
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;
}
}
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));
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;
_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;
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"");
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;
{
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;
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;
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;
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;
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;
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);
}
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);
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;
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;
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;
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);
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)
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;
}
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;
}
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 ();
}
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];
*/
static void drive_settype_id (drive *drv)
{
- int t = currprefs.dfxtype[drv - &floppy[0]];
+ int t = currprefs.floppyslots[drv - &floppy[0]].dfxtype;
switch (t)
{
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)
#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 */
&& 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;
{
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)) {
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;
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);
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);
}
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);
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--;
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 */
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))) {
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))
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;
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);
}
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;
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;
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;
}
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;
{
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;
}
} else {
visible_left_border = max_diwlastword - gfxvidinfo.width;
}
+
if (currprefs.gfx_xcenter_pos >= 0) {
int val = currprefs.gfx_xcenter_pos >> RES_MAX;
#if 0
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++;
}
{
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;
}
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];
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 ();
{
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 ();
return;
if (!wave_initialized)
return;
- if (!currprefs.dfxclick[drive])
+ if (!currprefs.floppyslots[drive].dfxclick)
return;
if (eject)
drv_has_spun[drive] = 0;
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 ();
}
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);
#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
{
int type, yuv, intmul;
TCHAR *name, *cfgname;
- int x[6];
+ int flags;
};
extern struct uae_filter uaefilters[];
{
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;
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];
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;
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);
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);
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]--;
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;
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) {
{
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;
}
if (ioreq) {
static int cnt = 0;
int cmd = get_word (request + 28);
-#if 1
+#if 0
if (cmd == 37) {
cnt--;
if (cnt <= 0)
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);
}
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);
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;
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;
aspi_led (unitnum);
uae_sem_post (&scgp_sem);
if (v)
- return 0;
+ return NULL;
if (outlen)
*outlen = scgp->scmd->size;
return si[unitnum].buf;
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;
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;
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;
}
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;
}
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
#define EFFECT_VERSION 2
#define D3DX9DLL L"d3dx9_43.dll"
+#define TWOPASS 1
#include "options.h"
#include "xwin.h"
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;
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;
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 ();
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);
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)
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;
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) {
}
}
} 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));
}
}
+ 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);
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;
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;
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);
}
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);
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);
+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;
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;
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;
// 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)
HRESULT hr;
invalidatedeviceobjects ();
- while (shaderon) {
+ while (shaderon > 0) {
postEffect = psEffect_LoadEffect (psEnabled ? L"_winuae.fx" : L"_winuae_old.fx", false);
if (!postEffect) {
shaderon = 0;
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;
}
}
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 ();
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 };
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;
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;
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;
}
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);
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;
}
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;
}
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 {
}
+ }
+#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));
} 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);
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;
}
sprite->End ();
}
-
+#endif
hr = d3ddev->EndScene ();
if (FAILED (hr))
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))
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);
} 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;
}
}
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)
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) {
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;
#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
#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
#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
//
#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
FONT 8, "MS Sans Serif", 0, 0, 0x1\r
BEGIN\r
GROUPBOX "Filter Settings",-1,0,1,295,134\r
- COMBOBOX IDC_FILTERMODE,20,15,103,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
- COMBOBOX IDC_FILTERFILTER,132,15,83,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
+ COMBOBOX IDC_FILTERMODE,20,15,149,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
+ COMBOBOX IDC_FILTERFILTER,176,15,39,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
PUSHBUTTON "Reset to defaults",IDC_FILTERDEFAULT,221,15,67,14\r
RTEXT "Horiz. size:",-1,7,61,46,10,SS_CENTERIMAGE\r
CONTROL "Slider1",IDC_FILTERHZ,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,99,54,152,19\r
MENUITEM "DF2:", ID_ST_DF2\r
MENUITEM "DF3:", ID_ST_DF3\r
END\r
+ POPUP "CD drives"\r
+ BEGIN\r
+ MENUITEM "Eject", ID_ST_CDEJECTALL\r
+ MENUITEM "CD", ID_ST_CD0\r
+ END\r
MENUITEM "Reset", ID_ST_RESET\r
MENUITEM "Help", ID_ST_HELP\r
MENUITEM "Quit WinUAE", ID_ST_QUIT\r
IDS_QS_CD_IMAGE "Image mode"\r
IDS_REMAPTITLE "Input captured. F12 = Exit. F11 = Skip current event in Remap mode."\r
IDS_FILTER_NOOVERLAYS "No overlays available"\r
+ IDS_STMENUNOCD "No CD inserted"\r
END\r
\r
STRINGTABLE\r
/* 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);
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);
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
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);
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;
}
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,
DestroyMenu (menu);
}
-static void LLError(HMODULE m, const TCHAR *s)
+static void LLError (HMODULE m, const TCHAR *s)
{
DWORD err;
#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""
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 }
};
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)
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;
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;
}
}
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)
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));
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
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;
}
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
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) {
RGBFTYPE colortype;
int tmp_depth;
int ret = 0;
- int mult = 0;
if (wasfullwindow_a == 0)
wasfullwindow_a = currprefs.gfx_afullscreen == GFX_FULLWINDOW ? 1 : -1;
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;
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);
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;
}
}
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;
if (iscd (n)) {
eject_cd ();
} else {
- workprefs.df[n][0] = 0;
+ workprefs.floppyslots[n].df[0] = 0;
}
}
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)
{
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;
}
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;
}
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);
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);
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)
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);
}
}
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--;
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;
}
}
} 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);
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;
}
}
}
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);
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;
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];
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);
}
}
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) {
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 ();
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);
}
}
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);
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);
}
}
+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;
{
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);
}
case 10208:
{
int drv = LOWORD (wParam) - 10201;
- workprefs.df[drv][0] = 0;
+ workprefs.floppyslots[drv].df[0] = 0;
InitializeListView (hDlg);
swapperhili (hDlg, entry);
}
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;
}
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);
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);
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 {
{ 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);
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;
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]) {
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);
{
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);
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;
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)
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;
} 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;
{
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;
+- 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=<path>,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)
- 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:
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);
Save_Rip ( "SKYT Packed module", SKYT_packer );
if ( Save_Status == GOOD )
- PW_i += (OutputSize - 261); /* 260 could be enough */
+ PW_i += 257;
}
* (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;
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<Pat_Pos ; i++ )
+ /* pattern list */
+ /* those are tracks, being saved. Pattern list must be regenerated */
+ /* each track is 256 bytes (4*64 notes) */
+ for (i=0;i<Header[950];i++)
{
- for ( j=0 ; j<4 ; j++ )
- {
- Track_Values[i][j] = in_data[Where+1];
- if ( Track_Values[i][j] > 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]<Pat_Pos ; Whatever[0]+=0x01 )
- {
- fwrite ( &Whatever[0] , 1 , 1 , out );
- }
- Whatever[1] = 0x00;
- while ( Whatever[0] != 128 )
+ /* put the first pattern number */
+ /* could be stored several times */
+ for (j=0; j<Header[950] ; j++)
{
- fwrite ( &Whatever[1] , 1 , 1 , out );
- Whatever[0] += 0x01;
+ m = 0x7fffffff; /* min */
+ /*search for min */
+ for (i=0; i<Header[950] ; i++)
+ if ((ReadPat[i]<m) && (ReadPat[i]>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<Header[950] ; i++)
+ if (ReadPat[i] == k)
+ Header[952+i] = (unsigned char)l;
+ l++;
}
/* write ptk's ID */
- Whatever[0] = 'M';
- Whatever[1] = '.';
- Whatever[2] = 'K';
- Whatever[3] = '.';
- fwrite ( Whatever , 4 , 1 , out );
-
- /* bypass $00 unknown byte */
- /*Where += 1;*/
+ Header[1080] = 'M';
+ Header[1081] = Header[1083] = '.';
+ Header[1082] = 'K';
+ fwrite (Header, 1084, 1, out);
/* get track address */
- Where = PW_Start_Address + 261 + (Pat_Pos*8) + 1;
- Track_Address = Where;
- /*printf ("Track_Address : %ld\n",Track_Address);*/
-
+ Where = PW_Start_Address + 261 + (Header[950]*8) + 1;
+ /*printf ("Address of 1st track : %lx\n",Where);*/
- /* track data */
- for ( i=0 ; i<Pat_Pos ; i++ )
+ /* l is the number of stored patterns */
+ /* rebuild pattern data now */
+ for (i=0;i<l-1;i++)
{
- BZERO ( Whatever , 1024 );
- for ( j=0 ; j<4 ; j++ )
+ long min=50,max=0;
+ BZERO(Pattern,1024);
+ /* which pattern is it now ? */
+ for (j=0;j<Header[950];j++)
+ {
+ if (Header[952+j] == i)
+ break; /* found */
+ }
+ for (k=0;k<4;k++) /* loop on 4 tracks' refs*/
{
- /*Where = PW_Start_Address + Track_Address + (Track_Values[i][j]-1)*256;*/
- Where = Track_Address + (Track_Values[i][j]-1)*256;
- for ( k=0 ; k<64 ; k++ )
+ long d;
+
+ /* empty track */
+ if (ReadTrkPat[j][k] == 0xffffffff)
+ continue;
+
+ /* loop on notes */
+ for (d=0;d<64;d++)
{
- Whatever[k*16+j*4] = in_data[Where+1]&0xf0;
- Whatever[k*16+j*4] |= poss[in_data[Where]][0];
- Whatever[k*16+j*4+1] = poss[in_data[Where]][1];
- Whatever[k*16+j*4+2] = (in_data[Where+1]<<4)&0xf0;
- Whatever[k*16+j*4+2] |= in_data[Where+2];
- Whatever[k*16+j*4+3] = in_data[Where+3];
- Where += 4;
+ unsigned char note = in_data[Where+(ReadTrkPat[j][k]*256)+d*4];
+ /*if (note > 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 */
return 0; /* ENAMETOOLONG */
s = au (real_name);
- _tcscpy (changed_prefs.df[drive], s);
+ _tcscpy (changed_prefs.floppyslots[drive].df, s);
xfree (s);
return 1;
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);
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;
}
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");
}
#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
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)
{
}
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 {
}
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;
}
#include <zlib.h>
#define unpack_log write_log
+#undef unpack_log
+#define unpack_log
+
static time_t fromdostime (uae_u32 dd)
{