UnitInfo *ui = getuip (p, index);
struct uaedev_config_data *uci = &p->mountconfig[index];
UnitInfo uitmp;
+ TCHAR filepath[MAX_DPATH];
memset (mi, 0, sizeof (struct mountedinfo));
memset (&uitmp, 0, sizeof uitmp);
- _tcscpy (mi->rootdir, uci->ci.rootdir);
+ cfgfile_resolve_path_out(uci->ci.rootdir, filepath, MAX_DPATH, PATH_DIR);
+ _tcscpy(mi->rootdir, filepath);
if (!ui) {
ui = &uitmp;
if (uci->ci.type == UAEDEV_DIR) {
mi->ismounted = 1;
- if (uci->ci.rootdir[0] == 0)
+ if (filepath[0] == 0)
return FILESYS_VIRTUAL;
- if (my_existsfile (uci->ci.rootdir)) {
+ if (my_existsfile (filepath)) {
mi->ismedia = 1;
return FILESYS_VIRTUAL;
}
- if (my_getvolumeinfo (uci->ci.rootdir) < 0)
+ if (my_getvolumeinfo (filepath) < 0)
return -1;
mi->ismedia = true;
return FILESYS_VIRTUAL;
} else if (uci->ci.type == UAEDEV_HDF) {
ui->hf.ci.readonly = true;
ui->hf.ci.blocksize = uci->ci.blocksize;
- int err = hdf_open (&ui->hf, uci->ci.rootdir);
+ int err = hdf_open (&ui->hf, filepath);
if (err <= 0) {
mi->ismedia = false;
mi->ismounted = true;
} else {
struct scsi_data_tape *tape;
unitnum = 0;
- tape = tape_alloc (unitnum, uci->ci.rootdir, uci->ci.readonly);
+ tape = tape_alloc (unitnum, filepath, uci->ci.readonly);
if (tape) {
if (tape_get_info (unitnum, &di)) {
mi->ismedia = di.media_inserted != 0;
TCHAR *nvol = NULL;
int i, archivehd;
TCHAR *p = NULL;
+ TCHAR path[MAX_DPATH];
+
+ cfgfile_resolve_path_out(rootdir, path, MAX_DPATH, PATH_DIR);
archivehd = -1;
- if (my_existsfile (rootdir))
+ if (my_existsfile (path))
archivehd = 1;
- else if (my_existsdir (rootdir))
+ else if (my_existsdir (path))
archivehd = 0;
if (zv && zv->volumename && _tcslen(zv->volumename) > 0) {
return nvol;
}
- if ((!volname || _tcslen (volname) == 0) && rootdir && archivehd >= 0) {
- p = my_strdup (rootdir);
+ if ((!volname || _tcslen (volname) == 0) && path && archivehd >= 0) {
+ p = my_strdup (path);
for (i = _tcslen (p) - 1; i >= 0; i--) {
TCHAR c = p[i];
if (c == ':' || c == '/' || c == '\\') {
if (!_tcscmp (p + i, _T(":\\"))) {
xfree (p);
p = xmalloc (TCHAR, 10);
- p[0] = rootdir[0];
+ p[0] = path[0];
p[1] = 0;
i = 0;
} else {
return ret == 0;
}
-static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci)
+static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci, bool custom)
{
UnitInfo *ui;
int i;
return nr;
}
- my_resolvesoftlink (c.rootdir, MAX_DPATH);
+ if (!custom)
+ cfgfile_resolve_path(c.rootdir, MAX_DPATH, PATH_DIR);
+
iscd = nr >= cd_unit_offset && nr < cd_unit_offset + cd_unit_number;
for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
return -1;
}
-static int set_filesys_unit (int nr, struct uaedev_config_info *ci)
+static int set_filesys_unit (int nr, struct uaedev_config_info *ci, bool custom)
{
int ret;
- ret = set_filesys_unit_1 (nr, ci);
+ ret = set_filesys_unit_1 (nr, ci, custom);
return ret;
}
-static int add_filesys_unit (struct uaedev_config_info *ci)
+static int add_filesys_unit (struct uaedev_config_info *ci, bool custom)
{
int nr;
if (nr_units () >= MAX_FILESYSTEM_UNITS)
return -1;
- nr = set_filesys_unit_1 (-1, ci);
+ nr = set_filesys_unit_1 (-1, ci, custom);
#ifdef RETROPLATFORM
if (nr >= 0) {
UnitInfo *ui = &mountinfo.ui[nr];
struct uaedev_config_info ci;
memcpy (&ci, &uci->ci, sizeof (struct uaedev_config_info));
ci.flags = MYVOLUMEINFO_REUSABLE;
- int idx = set_filesys_unit_1 (-1, &ci);
+ int idx = set_filesys_unit_1 (-1, &ci, false);
allocuci (&currprefs, nr, idx);
}
}
ci.sectors = 1;
ci.surfaces = 1;
ci.blocksize = 2048;
- int idx = set_filesys_unit_1 (i + cd_unit_offset, &ci);
+ int idx = set_filesys_unit_1 (i + cd_unit_offset, &ci, true);
allocuci (&currprefs, nr, idx);
nr++;
}
memcpy (&ci, &uci->ci, sizeof (struct uaedev_config_info));
int unitnum = scsi_add_tape (&uci->ci);
if (unitnum >= 0) {
- int idx = set_filesys_unit_1 (-1, &ci);
+ int idx = set_filesys_unit_1 (-1, &ci, false);
allocuci (&currprefs, nr, idx, unitnum);
}
}
_tcscpy (ci.volname, volptr);
_tcscpy (ci.rootdir, rootdir);
ci.flags = MYVOLUMEINFO_REUSABLE;
- nr = add_filesys_unit (&ci);
+ nr = add_filesys_unit (&ci, true);
if (nr < 0)
return 0;
if (inserted > 1)
uae_u8 *buf;
uae_u8 buf_array[260] = { 0 };
- if (trap_is_indirect() || !valid_address(info, (sizeof buf_array) - 36)) {
+ if (trap_is_indirect() || !valid_address(info, (sizeof buf_array) - 36) || !real_address_allowed()) {
buf = buf_array;
} else {
buf = get_real_address(info);
return;
}
- if (trap_is_indirect()) {
+ if (trap_is_indirect() || !real_address_allowed()) {
uae_u8 buf[RTAREA_TRAP_DATA_EXTRA_SIZE];
actual = 0;
return;
}
- if (trap_is_indirect()) {
+ if (trap_is_indirect() || !real_address_allowed()) {
uae_u8 buf[RTAREA_TRAP_DATA_EXTRA_SIZE];
actual = 0;
_tcscpy (ci->volname, volname ? volname : _T(""));
_tcscpy (ci->filesys, filesysdir);
- if (set_filesys_unit (devno, ci) < 0) {
+ if (set_filesys_unit (devno, ci, false) < 0) {
write_log (_T("filesys '%s' failed to restore\n"), rootdir);
goto end;
}
int ret;
uae_u8 tmp[512], tmp2[512];
uae_u32 v;
+ TCHAR filepath[MAX_DPATH];
if ((!pname || pname[0] == 0) && hfd->ci.rootdir[0] == 0)
return 0;
hfd->virtual_rdb = NULL;
if (!pname)
pname = hfd->ci.rootdir;
+ cfgfile_resolve_path_out(pname, filepath, MAX_DPATH, PATH_HDF);
#ifdef WITH_CHD
TCHAR nametmp[MAX_DPATH];
- _tcscpy (nametmp, pname);
+ _tcscpy (nametmp, filepath);
TCHAR *ext = _tcsrchr (nametmp, '.');
if (ext && !_tcsicmp (ext, _T(".chd"))) {
bool chd_readonly = false;
hfd->ci.readonly = true;
hfd->virtsize = cf->logical_bytes();
hfd->handle_valid = -1;
- write_log(_T("CHD '%s' mounted as %s, %s.\n"), pname, chdf ? _T("HD") : _T("OTHER"), hfd->ci.readonly ? _T("read only") : _T("read/write"));
+ write_log(_T("CHD '%s' mounted as %s, %s.\n"), filepath, chdf ? _T("HD") : _T("OTHER"), hfd->ci.readonly ? _T("read only") : _T("read/write"));
return 1;
}
}
#endif
- ret = hdf_open_target (hfd, pname);
+ ret = hdf_open_target (hfd, filepath);
if (ret <= 0)
return ret;
if (hdf_read_target (hfd, tmp, 0, 512) != 512)