while (rs) {
if (rs->changed) {
+ int type = -1;
rs->changed = 0;
fetch_ripperpath (path, sizeof (path) / sizeof (TCHAR));
name[0] = 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 (currprefs.floppyslots[0].dfxtype >= 0) {
+ _tcscpy(name, currprefs.floppyslots[0].df);
+ type = PATH_FLOPPY;
+ } else if (currprefs.cdslots[0].inuse) {
+ _tcscpy(name, currprefs.cdslots[0].name);
+ type = PATH_CD;
+ }
if (!name[0])
underline[0] = 0;
+ if (type >= 0)
+ cfgfile_resolve_path(name, sizeof(name) / sizeof(TCHAR), type);
namesplit (name);
_tcscpy (extension, _T("wav"));
_stprintf (filename, _T("%s%s%s%03d.%s"), path, name, underline, cnt, extension);
{
TCHAR *p = currprefs.cdslots[unitnum].name;
if (p[0]) {
+ TCHAR name[MAX_DPATH];
struct device_info di;
- const TCHAR *fname = my_getfilepart(p);
+ cfgfile_resolve_path_out(p, name, sizeof(name) / sizeof(TCHAR), PATH_CD);
+ const TCHAR *fname = my_getfilepart(name);
if (sys_command_info(unitnum, &di, 0) && di.volume_id[0])
statusline_add_message(STATUSTYPE_CD, _T("CD%d: [%s] %s"), unitnum, di.volume_id, fname);
else
int cdda_delay, cdda_delay_frames;
bool thread_active;
- TCHAR imgname[MAX_DPATH];
+ TCHAR imgname_in[MAX_DPATH];
+ TCHAR imgname_out[MAX_DPATH];
uae_sem_t sub_sem;
struct device_info di;
#ifdef WITH_CHD
di->sectorspertrack = (int)(cdu->cdsize / di->bytespersector);
if (ismedia (unitnum, 1)) {
di->media_inserted = 1;
- _tcscpy (di->mediapath, cdu->imgname);
+ _tcscpy (di->mediapath, cdu->imgname_out);
di->audio_playing = cdu->cdda_play > 0;
}
memset (&di->toc, 0, sizeof (struct cd_toc_head));
if (!cdu->open) {
uae_sem_init (&cdu->sub_sem, 0, 1);
- cdu->imgname[0] = 0;
- if (ident)
- _tcscpy (cdu->imgname, ident);
+ cdu->imgname_out[0] = 0;
+ cdu->imgname_in[0] = 0;
+ if (ident) {
+ _tcscpy(cdu->imgname_in, ident);
+ cfgfile_resolve_path_out(cdu->imgname_in, cdu->imgname_out, MAX_DPATH, PATH_CD);
+ }
parse_image (cdu, ident);
cdu->open = true;
cdu->enabled = true;
}
ret = 1;
}
- blkdev_cd_change (unitnum, cdu->imgname);
+ blkdev_cd_change (unitnum, cdu->imgname_in);
return ret;
}
unload_image (cdu);
uae_sem_destroy (&cdu->sub_sem);
}
- blkdev_cd_change (unitnum, cdu->imgname);
+ blkdev_cd_change (unitnum, cdu->imgname_in);
}
static void close_bus (void)
s = cfgfile_subst_path_load(UNEXPANDED, &p->path_hardfile, path, true);
break;
case PATH_HDF:
- s = cfgfile_subst_path_load(UNEXPANDED, &p->path_hardfile, path, true);
+ s = cfgfile_subst_path_load(UNEXPANDED, &p->path_hardfile, path, false);
+ break;
+ case PATH_CD:
+ s = cfgfile_subst_path_load(UNEXPANDED, &p->path_cd, path, false);
break;
case PATH_FLOPPY:
_tcscpy(out, path);
} else if (ci->type == UAEDEV_HDF || ci->type == UAEDEV_CD || ci->type == UAEDEV_TAPE) {
TCHAR filesyspath[MAX_DPATH];
_tcscpy(filesyspath, ci->filesys);
- cfgfile_adjust_path(filesyspath, MAX_DPATH, NULL);
TCHAR *sfilesys = cfgfile_escape_min(filesyspath);
TCHAR *sgeometry = cfgfile_escape(ci->geometry, NULL, true);
_stprintf (tmp, _T("%s,%s:%s,%d,%d,%d,%d,%d,%s,%s"),
p->nr_floppies = 4;
for (i = 0; i < 4; i++) {
_stprintf (tmp, _T("floppy%d"), i);
- cfgfile_write_path (f, &p->path_floppy, tmp, p->floppyslots[i].df);
+ cfgfile_write_str(f, tmp, p->floppyslots[i].df);
_stprintf (tmp, _T("floppy%dwp"), i);
cfgfile_dwrite_bool (f, tmp, p->floppyslots[i].forcedwriteprotect);
_stprintf (tmp, _T("floppy%dtype"), i);
for (i = 0; i < MAX_SPARE_DRIVES; i++) {
if (p->dfxlist[i][0]) {
_stprintf (tmp, _T("diskimage%d"), i);
- cfgfile_dwrite_path (f, &p->path_floppy, tmp, p->dfxlist[i]);
+ cfgfile_dwrite_str(f, tmp, p->dfxlist[i]);
}
}
if (p->cdslots[i].name[0] || p->cdslots[i].inuse) {
TCHAR tmp2[MAX_DPATH];
_stprintf (tmp, _T("cdimage%d"), i);
- TCHAR *s = cfgfile_put_multipath (&p->path_cd, p->cdslots[i].name);
- _tcscpy (tmp2, s);
- xfree (s);
+ _tcscpy (tmp2, p->cdslots[i].name);
if (p->cdslots[i].type != SCSI_UNIT_DEFAULT || _tcschr (p->cdslots[i].name, ',') || p->cdslots[i].delayed) {
_tcscat (tmp2, _T(","));
if (p->cdslots[i].delayed) {
return cfgfile_path (option, value, name, location, maxsz, NULL);
}
-static int cfgfile_pathext(const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz)
-{
- if (!cfgfile_string(option, value, name, location, maxsz))
- return 0;
- if (_tcschr(value, '/') || _tcschr(value, '\\') || _tcschr(value, ':'))
- return cfgfile_path(option, value, name, location, maxsz, NULL);
- return 1;
-}
-
-static int cfgfile_multipath (const TCHAR *option, const TCHAR *value, const TCHAR *name, struct multipath *mp)
+static int cfgfile_multipath (const TCHAR *option, const TCHAR *value, const TCHAR *name, struct multipath *mp, struct uae_prefs *p)
{
TCHAR tmploc[MAX_DPATH];
- if (!cfgfile_string (option, value, name, tmploc, 256))
+ if (!cfgfile_string (option, value, name, tmploc, PATH_MAX))
return 0;
for (int i = 0; i < MAX_PATHS; i++) {
if (mp->path[i][0] == 0 || (i == 0 && (!_tcscmp (mp->path[i], _T(".\\")) || !_tcscmp (mp->path[i], _T("./"))))) {
TCHAR *s = target_expand_environment (tmploc, NULL, 0);
- _tcsncpy (mp->path[i], s, 256 - 1);
- mp->path[i][256 - 1] = 0;
+ _tcsncpy (mp->path[i], s, PATH_MAX - 1);
+ mp->path[i][PATH_MAX - 1] = 0;
fixtrailing (mp->path[i]);
xfree (s);
+ target_multipath_modified(p);
return 1;
}
}
*tmpp = '\0';
if (_tcscmp (section, TARGET_NAME) == 0) {
/* We special case the various path options here. */
- if (cfgfile_multipath (option, value, _T("rom_path"), &p->path_rom)
- || cfgfile_multipath (option, value, _T("floppy_path"), &p->path_floppy)
- || cfgfile_multipath (option, value, _T("cd_path"), &p->path_cd)
- || cfgfile_multipath (option, value, _T("hardfile_path"), &p->path_hardfile))
+ if (cfgfile_multipath (option, value, _T("rom_path"), &p->path_rom, p)
+ || cfgfile_multipath (option, value, _T("floppy_path"), &p->path_floppy, p)
+ || cfgfile_multipath (option, value, _T("cd_path"), &p->path_cd, p)
+ || cfgfile_multipath (option, value, _T("hardfile_path"), &p->path_hardfile, p))
return 1;
return target_parse_option (p, option, value);
}
for (i = 0; i < MAX_SPARE_DRIVES; i++) {
_stprintf (tmpbuf, _T("diskimage%d"), i);
- if (cfgfile_path (option, value, tmpbuf, p->dfxlist[i], sizeof p->dfxlist[i] / sizeof (TCHAR), &p->path_floppy)) {
-#if 0
- if (i < 4 && !p->df[i][0])
- _tcscpy (p->df[i], p->dfxlist[i]);
-#endif
+ if (cfgfile_string(option, value, tmpbuf, p->dfxlist[i], sizeof p->dfxlist[i] / sizeof(TCHAR))) {
return 1;
}
}
cfgfile_intval (option, next, tmp, &unitnum, 1);
}
if (_tcslen (value) > 0) {
- TCHAR *s = cfgfile_get_multipath (&p->path_cd, NULL, value, false);
- _tcsncpy (p->cdslots[i].name, s, sizeof p->cdslots[i].name / sizeof (TCHAR));
- xfree (s);
+ _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;
|| cfgfile_intval (option, value, _T("floppy_channel_mask"), &p->dfxclickchannelmask, 1))
return 1;
- if (cfgfile_pathext (option, value, _T("floppy0soundext"), p->floppyslots[0].dfxclickexternal, sizeof p->floppyslots[0].dfxclickexternal / sizeof (TCHAR))
- || cfgfile_pathext (option, value, _T("floppy1soundext"), p->floppyslots[1].dfxclickexternal, sizeof p->floppyslots[1].dfxclickexternal / sizeof (TCHAR))
- || cfgfile_pathext (option, value, _T("floppy2soundext"), p->floppyslots[2].dfxclickexternal, sizeof p->floppyslots[2].dfxclickexternal / sizeof (TCHAR))
- || cfgfile_pathext (option, value, _T("floppy3soundext"), p->floppyslots[3].dfxclickexternal, sizeof p->floppyslots[3].dfxclickexternal / sizeof (TCHAR))
+ if (cfgfile_string(option, value, _T("floppy0soundext"), p->floppyslots[0].dfxclickexternal, sizeof p->floppyslots[0].dfxclickexternal / sizeof (TCHAR))
+ || cfgfile_string(option, value, _T("floppy1soundext"), p->floppyslots[1].dfxclickexternal, sizeof p->floppyslots[1].dfxclickexternal / sizeof (TCHAR))
+ || cfgfile_string(option, value, _T("floppy2soundext"), p->floppyslots[2].dfxclickexternal, sizeof p->floppyslots[2].dfxclickexternal / sizeof (TCHAR))
+ || cfgfile_string(option, value, _T("floppy3soundext"), p->floppyslots[3].dfxclickexternal, sizeof p->floppyslots[3].dfxclickexternal / sizeof (TCHAR))
|| cfgfile_string(option, value, _T("debugging_options"), p->debugging_options, sizeof p->debugging_options / sizeof(TCHAR))
- || cfgfile_string (option, value, _T("config_window_title"), p->config_window_title, sizeof p->config_window_title / sizeof (TCHAR))
- || cfgfile_string (option, value, _T("config_info"), p->info, sizeof p->info / sizeof (TCHAR))
- || cfgfile_string (option, value, _T("config_description"), p->description, sizeof p->description / sizeof (TCHAR)))
+ || cfgfile_string(option, value, _T("config_window_title"), p->config_window_title, sizeof p->config_window_title / sizeof (TCHAR))
+ || cfgfile_string(option, value, _T("config_info"), p->info, sizeof p->info / sizeof (TCHAR))
+ || cfgfile_string(option, value, _T("config_description"), p->description, sizeof p->description / sizeof (TCHAR)))
return 1;
if (cfgfile_yesno(option, value, _T("use_debugger"), &p->start_debugger)
TCHAR tmp[200], section[200];
struct ini_data *ini;
bool ret = false;
+ TCHAR tgname[MAX_DPATH];
- ini = ini_load(tname);
+ cfgfile_resolve_path_out(tname, tgname, MAX_DPATH, PATH_HDF);
+ ini = ini_load(tgname);
if (!ini)
return ret;
if (found) {
ret = true;
- write_log(_T("Geometry file '%s' section '%s' found\n"), tname, section);
+ write_log(_T("Geometry file '%s' section '%s' found\n"), tgname, section);
if (addgeom) {
_tcscpy(uci->geometry, tname);
}
memmove (uci.rootdir, uci.rootdir + 2, (_tcslen (uci.rootdir + 2) + 1) * sizeof (TCHAR));
uci.rootdir[0] = ':';
}
-#if 0
- str = cfgfile_subst_path_load (UNEXPANDED, &p->path_hardfile, uci.rootdir, false);
- _tcscpy (uci.rootdir, str);
-#endif
}
if (uci.geometry[0]) {
parse_geo(uci.geometry, &uci, NULL, false, true);
for (i = 0; i < 4; i++) {
_stprintf (tmpbuf, _T("floppy%d"), i);
- if (cfgfile_path (option, value, tmpbuf, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof (TCHAR), &p->path_floppy))
+ if (cfgfile_string(option, value, tmpbuf, p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof(TCHAR)))
return 1;
}
cfgfile_path (line1b, line2b, _T("config_all_path"), p->config_all_path, sizeof p->config_all_path / sizeof(TCHAR));
cfgfile_string (line1b, line2b, _T("config_window_title"), p->config_window_title, sizeof p->config_window_title / sizeof (TCHAR));
// boxart checks
- cfgfile_path(line1b, line2b, _T("floppy0"), p->floppyslots[0].df, sizeof p->floppyslots[0].df / sizeof(TCHAR));
+ cfgfile_string(line1b, line2b, _T("floppy0"), p->floppyslots[0].df, sizeof p->floppyslots[0].df / sizeof(TCHAR));
+ cfgfile_resolve_path(p->floppyslots[0].df, MAX_DPATH, PATH_FLOPPY);
TCHAR tmp[MAX_DPATH];
if (!p->mountitems && (cfgfile_string(line1b, line2b, _T("hardfile2"), tmp, sizeof tmp / sizeof(TCHAR)) || cfgfile_string(line1b, line2b, _T("filesystem2"), tmp, sizeof tmp / sizeof(TCHAR)))) {
const TCHAR *s = _tcschr(tmp, ':');
if (s) {
+ bool isvsys = false;
if (!_tcscmp(line1b, _T("filesystem2"))) {
s++;
s = _tcschr(s, ':');
+ isvsys = true;
}
if (s) {
s++;
if (se) {
tmp[se - tmp] = 0;
_tcscpy(p->mountconfig[0].ci.rootdir, s);
- cfgfile_adjust_path(p->mountconfig[0].ci.rootdir, MAX_DPATH, NULL);
+ cfgfile_resolve_path(p->mountconfig[0].ci.rootdir, MAX_DPATH, isvsys ? PATH_DIR : PATH_HDF);
p->mountitems = 1;
}
}
if (se)
tmp[se - tmp] = 0;
}
- cfgfile_adjust_path(s, MAX_DPATH, NULL);
_tcscpy(p->cdslots[0].name, s);
+ cfgfile_resolve_path(p->cdslots[0].name, MAX_DPATH, PATH_CD);
p->cdslots[0].inuse = 1;
}
}
cfgfile_parse_line (p, line, 0);
}
- for (i = 0; i < 4; i++)
- subst (p->path_floppy.path[0], p->floppyslots[i].df, sizeof p->floppyslots[i].df / sizeof (TCHAR));
subst (p->path_rom.path[0], p->romfile, sizeof p->romfile / sizeof (TCHAR));
subst (p->path_rom.path[0], p->romextfile, sizeof p->romextfile / sizeof (TCHAR));
subst (p->path_rom.path[0], p->romextfile2, sizeof p->romextfile2 / sizeof (TCHAR));
return false;
}
-int cfgfile_configuration_change (int v)
-{
- static int mode;
- if (v >= 0)
- mode = v;
- return mode;
-}
-
void cfgfile_show_usage (void)
{
int i;
for (int i = 0; i < MAX_SPARE_DRIVES; i++) {
_stprintf(tmp, _T("diskimage%d"), i);
if (!_tcscmp(option, tmp)) {
- cfgfile_path(option, value, tmp, p->dfxlist[i], sizeof p->dfxlist[i] / sizeof(TCHAR), &p->path_floppy);
+ cfgfile_string(option, value, tmp, p->dfxlist[i], sizeof p->dfxlist[i] / sizeof(TCHAR));
break;
}
}
static void drive_fill_bigbuf (drive * drv,int);
-int DISK_validate_filename (struct uae_prefs *p, const TCHAR *fname, int leave_open, bool *wrprot, uae_u32 *crc32, struct zfile **zf)
+int DISK_validate_filename (struct uae_prefs *p, const TCHAR *fname_in, TCHAR *outfname, int leave_open, bool *wrprot, uae_u32 *crc32, struct zfile **zf)
{
+ TCHAR outname[MAX_DPATH];
+
if (zf)
*zf = NULL;
if (crc32)
*crc32 = 0;
if (wrprot)
*wrprot = p->floppy_read_only ? 1 : 0;
+
+ cfgfile_resolve_path_out(fname_in, outname, MAX_DPATH, PATH_FLOPPY);
+ if (outfname)
+ _tcscpy(outfname, outname);
+
if (leave_open || !zf) {
- struct zfile *f = zfile_fopen (fname, _T("r+b"), ZFD_NORMAL | ZFD_DISKHISTORY);
+ struct zfile *f = zfile_fopen (outname, _T("r+b"), ZFD_NORMAL | ZFD_DISKHISTORY);
if (!f) {
if (wrprot)
*wrprot = 1;
- f = zfile_fopen (fname, _T("rb"), ZFD_NORMAL | ZFD_DISKHISTORY);
+ f = zfile_fopen (outname, _T("rb"), ZFD_NORMAL | ZFD_DISKHISTORY);
}
if (f && crc32)
*crc32 = zfile_crc32 (f);
*zf = f;
return f ? 1 : 0;
} else {
- if (zfile_exists (fname)) {
+ if (zfile_exists (outname)) {
if (wrprot && !p->floppy_read_only)
*wrprot = 0;
if (crc32) {
- struct zfile *f = zfile_fopen (fname, _T("rb"), ZFD_NORMAL | ZFD_DISKHISTORY);
+ struct zfile *f = zfile_fopen (outname, _T("rb"), ZFD_NORMAL | ZFD_DISKHISTORY);
if (f)
*crc32 = zfile_crc32 (f);
zfile_fclose (f);
{
struct zfile *zf = NULL;
TCHAR *path;
+ TCHAR outname[MAX_DPATH];
+
path = DISK_get_saveimagepath(name, saveimageoriginalpath);
- DISK_validate_filename (p, path, 1, wrprot, NULL, &zf);
+ DISK_validate_filename (p, path, outname, 1, wrprot, NULL, &zf);
xfree(path);
if (zf)
return zf;
path = DISK_get_saveimagepath(name, !saveimageoriginalpath);
- DISK_validate_filename (p, path, 1, wrprot, NULL, &zf);
+ DISK_validate_filename (p, path, outname, 1, wrprot, NULL, &zf);
xfree(path);
return zf;
}
return drv->writediskfile ? 1 : 0;
}
-static bool diskfile_iswriteprotect (struct uae_prefs *p, const TCHAR *fname, int *needwritefile, drive_type *drvtype)
+static bool diskfile_iswriteprotect (struct uae_prefs *p, const TCHAR *fname_in, int *needwritefile, drive_type *drvtype)
{
struct zfile *zf1, *zf2;
bool wrprot1 = 0, wrprot2 = 1;
uae_char buffer[25];
+ TCHAR outname[MAX_DPATH];
*needwritefile = 0;
*drvtype = DRV_35_DD;
- DISK_validate_filename (p, fname, 1, &wrprot1, NULL, &zf1);
+ DISK_validate_filename (p, fname_in, outname, 1, &wrprot1, NULL, &zf1);
if (!zf1)
return 1;
if (zfile_iscompressed (zf1)) {
wrprot1 = 1;
*needwritefile = 1;
}
- zf2 = getexistingwritefile(p, fname, &wrprot2);
+ zf2 = getexistingwritefile(p, fname_in, &wrprot2);
zfile_fclose (zf2);
zfile_fread (buffer, sizeof (char), 25, zf1);
zfile_fclose (zf1);
statusline_add_message(STATUSTYPE_FLOPPY, _T("DF%d: %s"), num, my_getfilepart(fname));
}
-static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname, bool fake, bool forcedwriteprotect)
+static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname_in, bool fake, bool forcedwriteprotect)
{
uae_u8 buffer[2 + 2 + 4 + 4];
trackid *tid;
int num_tracks, size;
int canauto;
+ TCHAR outname[MAX_DPATH];
drive_image_free (drv);
if (!fake)
DISK_examine_image(p, dnum, &disk_info_data);
- DISK_validate_filename (p, fname, 1, &drv->wrprot, &drv->crc32, &drv->diskfile);
+ DISK_validate_filename (p, fname_in, outname, 1, &drv->wrprot, &drv->crc32, &drv->diskfile);
drv->forcedwrprot = forcedwriteprotect;
if (drv->forcedwrprot)
drv->wrprot = true;
drv->indexoffset = 0;
if (!fake) {
drv->dskeject = false;
- gui_disk_image_change (dnum, fname, drv->wrprot);
+ gui_disk_image_change (dnum, outname, drv->wrprot);
}
if (!drv->motoroff) {
}
if (!fake) {
- inprec_recorddiskchange (dnum, fname, drv->wrprot);
+ inprec_recorddiskchange (dnum, fname_in, drv->wrprot);
- if (currprefs.floppyslots[dnum].df != fname) {
- _tcsncpy (currprefs.floppyslots[dnum].df, fname, 255);
+ if (currprefs.floppyslots[dnum].df != fname_in) {
+ _tcsncpy (currprefs.floppyslots[dnum].df, fname_in, 255);
currprefs.floppyslots[dnum].df[255] = 0;
}
currprefs.floppyslots[dnum].forcedwriteprotect = forcedwriteprotect;
- _tcsncpy (changed_prefs.floppyslots[dnum].df, fname, 255);
+ _tcsncpy (changed_prefs.floppyslots[dnum].df, fname_in, 255);
changed_prefs.floppyslots[dnum].df[255] = 0;
changed_prefs.floppyslots[dnum].forcedwriteprotect = forcedwriteprotect;
- _tcscpy (drv->newname, fname);
+ _tcscpy (drv->newname, fname_in);
drv->newnamewriteprotected = forcedwriteprotect;
- gui_filename (dnum, fname);
+ gui_filename (dnum, outname);
}
memset (buffer, 0, sizeof buffer);
}
canauto = 0;
- if (isrecognizedext (fname))
+ if (isrecognizedext (outname))
canauto = 1;
if (!canauto && drv->diskfile && isrecognizedext (zfile_getname (drv->diskfile)))
canauto = 1;
- // if PC-only drive, make sure PC-like floppies are alwayss detected
+ // if PC-only drive, make sure PC-like floppies are always detected
if (!canauto && ispcbridgedrive(dnum))
canauto = 1;
setdskchangetime (&floppy[num], 2 * 50 * 312);
}
-int disk_setwriteprotect (struct uae_prefs *p, int num, const TCHAR *name, bool writeprotected)
+int disk_setwriteprotect (struct uae_prefs *p, int num, const TCHAR *fname_in, bool writeprotected)
{
int needwritefile, oldprotect;
struct zfile *zf1, *zf2;
int i;
TCHAR *name2;
drive_type drvtype;
+ TCHAR outfname[MAX_DPATH];
- write_log(_T("disk_setwriteprotect %d '%s' %d\n"), num, name, writeprotected);
+ write_log(_T("disk_setwriteprotect %d '%s' %d\n"), num, fname_in, writeprotected);
- oldprotect = diskfile_iswriteprotect (p, name, &needwritefile, &drvtype);
- DISK_validate_filename (p, name, 1, &wrprot1, NULL, &zf1);
+ oldprotect = diskfile_iswriteprotect (p, fname_in, &needwritefile, &drvtype);
+ DISK_validate_filename (p, fname_in, outfname, 1, &wrprot1, NULL, &zf1);
if (!zf1)
return 0;
if (zfile_iscompressed (zf1))
wrprot1 = 1;
zfile_fclose (zf1);
- zf2 = getexistingwritefile(p, name, &wrprot2);
- name2 = DISK_get_saveimagepath(name, -2);
+ zf2 = getexistingwritefile(p, fname_in, &wrprot2);
+ name2 = DISK_get_saveimagepath(fname_in, -2);
if (needwritefile && zf2 == 0)
disk_creatediskfile (p, name2, 1, drvtype, -1, NULL, false, false, NULL);
zfile_fclose (zf2);
- if (writeprotected && iswritefileempty (p, name)) {
+ if (writeprotected && iswritefileempty (p, fname_in)) {
for (i = 0; i < MAX_FLOPPY_DRIVES; i++) {
- if (!_tcscmp (name, floppy[i].newname))
+ if (!_tcscmp (fname_in, floppy[i].newname))
drive_eject (&floppy[i]);
}
_wunlink (name2);
}
if (!needwritefile)
- diskfile_readonly (name, writeprotected);
+ diskfile_readonly (outfname, writeprotected);
diskfile_readonly (name2, writeprotected);
return 1;
}
write_log (_T("-> '%s'\n"), s);
_tcscpy (old, currprefs.floppyslots[num].df);
_tcsncpy (changed_prefs.floppyslots[num].df, s, 255);
- xfree (s);
+ xfree(s);
int dskready_up_time = restore_u16 ();
int dskready_down_time = restore_u16 ();
newis = changed_prefs.floppyslots[num].df[0] ? 1 : 0;
memset (mi, 0, sizeof (struct mountedinfo));
memset (&uitmp, 0, sizeof uitmp);
- cfgfile_resolve_path_out(uci->ci.rootdir, filepath, MAX_DPATH, PATH_DIR);
- _tcscpy(mi->rootdir, filepath);
+ _tcscpy(mi->rootdir, uci->ci.rootdir);
if (!ui) {
ui = &uitmp;
if (uci->ci.type == UAEDEV_DIR) {
+ cfgfile_resolve_path_out(uci->ci.rootdir, filepath, MAX_DPATH, PATH_DIR);
+ _tcscpy(mi->rootdir, filepath);
mi->ismounted = 1;
if (filepath[0] == 0)
return FILESYS_VIRTUAL;
mi->ismedia = true;
return FILESYS_VIRTUAL;
} else if (uci->ci.type == UAEDEV_HDF) {
+ cfgfile_resolve_path_out(uci->ci.rootdir, filepath, MAX_DPATH, PATH_HDF);
+ _tcscpy(mi->rootdir, filepath);
ui->hf.ci.readonly = true;
ui->hf.ci.blocksize = uci->ci.blocksize;
int err = hdf_open (&ui->hf, filepath);
mi->ismedia = 0;
hdf_close (&ui->hf);
} else if (uci->ci.type == UAEDEV_CD) {
+ cfgfile_resolve_path_out(uci->ci.rootdir, filepath, MAX_DPATH, PATH_CD);
+ _tcscpy(mi->rootdir, filepath);
struct device_info di;
ui->hf.ci.readonly = true;
ui->hf.ci.blocksize = uci->ci.blocksize;
}
}
if (uci->ci.type == UAEDEV_TAPE) {
+ cfgfile_resolve_path_out(uci->ci.rootdir, filepath, MAX_DPATH, PATH_TAPE);
+ _tcscpy(mi->rootdir, filepath);
struct device_info di;
int unitnum = getuindex (p, index);
mi->size = -1;
return nr;
}
- if (!custom)
- cfgfile_resolve_path(c.rootdir, MAX_DPATH, PATH_DIR);
-
iscd = nr >= cd_unit_offset && nr < cd_unit_offset + cd_unit_number;
+ if (!custom)
+ cfgfile_resolve_path(c.rootdir, MAX_DPATH, iscd ? PATH_CD : (ci->volname[0] ? PATH_DIR : PATH_HDF));
+
for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
if (nr == i || !mountinfo.ui[i].open || mountinfo.ui[i].rootdir == NULL || is_hardfile (i) == FILESYS_CD)
continue;
tmp[0] = 0;
if (uip->filesysdir && _tcslen (uip->filesysdir) > 0) {
- _tcscpy (tmp, uip->filesysdir);
+ cfgfile_resolve_path_out(uip->filesysdir, tmp, MAX_DPATH, PATH_HDF);
} else if ((dostype & 0xffffff00) == DISK_TYPE_DOS) {
_tcscpy (tmp, currprefs.romfile);
int i = _tcslen (tmp);
if (hfd->ci.filesys[0]) {
struct zfile *f = NULL;
- filesys = zfile_load_file(hfd->ci.filesys, &filesyslen);
+ TCHAR fspath[MAX_DPATH];
+ cfgfile_resolve_path_out(hfd->ci.filesys, fspath, MAX_DPATH, PATH_HDF);
+ filesys = zfile_load_file(fspath, &filesyslen);
if (filesys) {
fsver = get_filesys_version(filesys, filesyslen);
if (fsver == 0xffffffff)
extern void disk_insert (int num, const TCHAR *name, bool forcedwriteprotect);
extern void disk_insert_force (int num, const TCHAR *name, bool forcedwriteprotect);
extern void DISK_vsync (void);
-extern int DISK_validate_filename (struct uae_prefs *p, const TCHAR *fname, int leave_open, bool *wrprot, uae_u32 *crc32, struct zfile **zf);
+extern int DISK_validate_filename (struct uae_prefs *p, const TCHAR *fname, TCHAR *outfname, int leave_open, bool *wrprot, uae_u32 *crc32, struct zfile **zf);
extern void DISK_handler (uae_u32);
extern void DISK_update (int hpos);
extern void DISK_update_adkcon (int hpos, uae_u16 v);
TCHAR path[MAX_PATHS][PATH_MAX];
};
+#define PATH_NONE -1
#define PATH_FLOPPY 0
#define PATH_CD 1
#define PATH_DIR 2
extern void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type);
extern int target_get_display (const TCHAR*);
extern const TCHAR *target_get_display_name (int, bool);
+extern void target_multipath_modified(struct uae_prefs *);
extern void cfgfile_resolve_path_out(const TCHAR *path, TCHAR *out, int size, int type);
extern void cfgfile_resolve_path(TCHAR *path, int size, int type);
extern int built_in_chipset_prefs (struct uae_prefs *p);
extern int built_in_cpuboard_prefs(struct uae_prefs *p);
extern int cmdlineparser (const TCHAR *s, TCHAR *outp[], int max);
-extern int cfgfile_configuration_change (int);
extern void fixup_prefs_dimensions (struct uae_prefs *prefs);
extern void fixup_prefs (struct uae_prefs *prefs, bool userconfig);
extern void fixup_cpu (struct uae_prefs *prefs);
int keepfsmode =
currprefs.gfx_apmode[0].gfx_fullscreen == changed_prefs.gfx_apmode[0].gfx_fullscreen &&
currprefs.gfx_apmode[1].gfx_fullscreen == changed_prefs.gfx_apmode[1].gfx_fullscreen;
- cfgfile_configuration_change (1);
currprefs.gfx_autoresolution = changed_prefs.gfx_autoresolution;
currprefs.gfx_autoresolution_vga = changed_prefs.gfx_autoresolution_vga;
return 0;
}
+void target_multipath_modified(struct uae_prefs *p)
+{
+ if (p != &workprefs)
+ return;
+ memcpy(&currprefs.path_hardfile, &p->path_hardfile, sizeof(struct multipath));
+ memcpy(&currprefs.path_floppy, &p->path_floppy, sizeof(struct multipath));
+ memcpy(&currprefs.path_cd, &p->path_cd, sizeof(struct multipath));
+}
+
int target_cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int type, int isdefault)
{
int v, i, type2;
ct2 = 0;
regqueryint (NULL, _T("ConfigFile_NoAuto"), &ct2);
v = cfgfile_load (p, fname, &type2, ct2, isdefault ? 0 : 1);
+ if (p == &workprefs) {
+ memcpy(&currprefs.path_hardfile, &p->path_hardfile, sizeof(struct multipath));
+ memcpy(&currprefs.path_floppy, &p->path_floppy, sizeof(struct multipath));
+ }
if (!v)
return v;
if (type > 0)
if (opengui) {
DirectDraw_FlipToGDISurface();
} else {
- if (uae_quit)
+ if (quit_program)
return;
full_redraw_all();
}
static void infofloppy (HWND hDlg, int n)
{
struct diskinfo di;
- TCHAR tmp2[MAX_DPATH];
+ TCHAR tmp2[MAX_DPATH], tmp1[MAX_DPATH];
TCHAR text[20000];
DISK_examine_image (&workprefs, n, &di);
+ DISK_validate_filename(&workprefs, workprefs.floppyslots[n].df, tmp1, 0, NULL, NULL, NULL);
_stprintf (tmp2,
_T("'%s'\r\nDisk readable: %s\r\nCRC32: %08X\r\nBoot block checksum valid: %s\r\nBoot block type: %s\r\n"),
- workprefs.floppyslots[n].df,
+ tmp1,
di.unreadable ? _T("No") : _T("Yes"),
di.crc32,
di.bb_crc_valid ? _T("Yes") : _T("No"),
CheckDlgButton (hDlg, f_wp, chk);
if (f_info >= 0)
ew (hDlg, f_info, text[0] != 0);
- chk = !showcd && state && DISK_validate_filename (&workprefs, text, 0, NULL, NULL, NULL) ? TRUE : FALSE;
+ chk = !showcd && state && DISK_validate_filename (&workprefs, text, NULL, 0, NULL, NULL, NULL) ? TRUE : FALSE;
if (f_wp >= 0) {
ew (hDlg, f_wp, chk && !workprefs.floppy_read_only);
if (f_wptext >= 0)
#include "threaddep/thread.h"
#include "a2091.h"
#include "devices.h"
+#include "fsdb.h"
int savestate_state = 0;
static int savestate_first_capture;
xfree (to);
return s;
}
+
+static bool state_path_exists(const TCHAR *path, int type)
+{
+ if (type == SAVESTATE_PATH_VDIR)
+ return my_existsdir(path);
+ return my_existsfile(path);
+}
+
TCHAR *restore_path_func (uae_u8 **dstp, int type)
{
TCHAR *newpath;
return s;
if (type == SAVESTATE_PATH_HD)
return s;
+#if 0
+ _tcscpy(tmp, s);
+ fullpath(tmp, sizeof(tmp) / sizeof(TCHAR));
+ if (state_path_exists(tmp, type)) {
+ xfree(s);
+ return my_strdup(tmp);
+ }
+#endif
getfilepart (tmp, sizeof tmp / sizeof (TCHAR), s);
- if (zfile_exists (tmp)) {
+ if (state_path_exists(tmp, type)) {
xfree (s);
return my_strdup (tmp);
}
fixtrailing (tmp2);
_tcscat (tmp2, tmp);
fullpath (tmp2, sizeof tmp2 / sizeof (TCHAR));
- if (zfile_exists (tmp2)) {
+ if (state_path_exists(tmp2, type)) {
xfree (s);
return my_strdup (tmp2);
}
}
getpathpart (tmp2, sizeof tmp2 / sizeof (TCHAR), savestate_fname);
_tcscat (tmp2, tmp);
- if (zfile_exists (tmp2)) {
+ if (state_path_exists(tmp2, type)) {
xfree (s);
return my_strdup (tmp2);
}
input_record++;
for (i = 0; i < 4; i++) {
bool wp = true;
- DISK_validate_filename (&currprefs, currprefs.floppyslots[i].df, false, &wp, NULL, NULL);
+ DISK_validate_filename (&currprefs, currprefs.floppyslots[i].df, NULL, false, &wp, NULL, NULL);
inprec_recorddiskchange (i, currprefs.floppyslots[i].df, wp);
}
input_record--;
static void tape_init (int unit, struct scsi_data_tape *tape, const TCHAR *tape_directory, bool readonly)
{
TCHAR path[MAX_DPATH];
+ TCHAR tape_dir_path[MAX_DPATH];
memset (tape, 0, sizeof (struct scsi_data_tape));
- _tcscpy (tape->tape_dir, tape_directory);
+ cfgfile_resolve_path_out(tape_directory, tape_dir_path, MAX_DPATH, PATH_TAPE);
+ _tcscpy(tape->tape_dir, tape_dir_path);
path[0] = 0;
tape->blocksize = 512;
if (my_existsdir(tape->tape_dir)) {
tape->realdir = true;
} else {
- _tcscpy(tape->tape_dir, tape_directory);
+ _tcscpy(tape->tape_dir, tape_dir_path);
zfile_fclose(tape->index);
tape->index = NULL;
}
}
if (!tape->index) {
- _tcscpy(path, tape_directory);
+ _tcscpy(path, tape_dir_path);
_tcscat(path, FSDB_DIR_SEPARATOR_S);
_tcscat(path, TAPE_INDEX);
tape->index = zfile_fopen(path, _T("rb"), ZFD_NORMAL);