return NULL;
memcpy (&uci->ci, ci, sizeof (struct uaedev_config_info));
- validatedevicename (uci->ci.devname);
- validatevolumename (uci->ci.volname);
+ validatedevicename (uci->ci.devname, NULL);
+ validatevolumename (uci->ci.volname, NULL);
if (!uci->ci.devname[0] && ci->type != UAEDEV_CD && ci->type != UAEDEV_TAPE) {
TCHAR base[32];
TCHAR base2[32];
}
}
_tcscpy (uci->ci.devname, base2);
- validatedevicename (uci->ci.devname);
+ validatedevicename (uci->ci.devname, NULL);
}
if (ci->type == UAEDEV_DIR) {
- TCHAR *s = filesys_createvolname (uci->ci.volname, uci->ci.rootdir, _T("Harddrive"));
+ TCHAR *s = filesys_createvolname (uci->ci.volname, uci->ci.rootdir, NULL, _T("Harddrive"));
_tcscpy (uci->ci.volname, s);
xfree (s);
}
#include "uaeserial.h"
#include "fsdb.h"
#include "zfile.h"
+#include "zarchive.h"
#include "gui.h"
#include "gayle.h"
#include "savestate.h"
au_fs_copy (s, strlen (tmp) + 1, tmp);
}
-TCHAR *validatevolumename (TCHAR *s)
+TCHAR *validatevolumename (TCHAR *s, const TCHAR *def)
{
stripsemicolon (s);
fixcharset (s);
striplength (s, 30);
+ if (_tcslen(s) == 0 && def)
+ _tcscpy(s, def);
return s;
}
-TCHAR *validatedevicename (TCHAR *s)
+TCHAR *validatedevicename (TCHAR *s, const TCHAR *def)
{
stripsemicolon (s);
stripspace (s);
fixcharset (s);
striplength (s, 30);
+ if (_tcslen(s) == 0 && def)
+ _tcscpy(s, def);
return s;
}
-TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, const TCHAR *def)
+TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, struct zvolume *zv, const TCHAR *def)
{
TCHAR *nvol = NULL;
int i, archivehd;
else if (my_existsdir (rootdir))
archivehd = 0;
+ if (zv && zv->volumename && _tcslen(zv->volumename) > 0) {
+ nvol = my_strdup(zv->volumename);
+ validatevolumename (nvol, def);
+ return nvol;
+ }
+
if ((!volname || _tcslen (volname) == 0) && rootdir && archivehd >= 0) {
p = my_strdup (rootdir);
for (i = _tcslen (p) - 1; i >= 0; i--) {
else
nvol = my_strdup (_T(""));
}
- validatevolumename (nvol);
+ validatevolumename (nvol, def);
xfree (p);
return nvol;
}
if (set_filesys_volume (c.rootdir, &flags, &c.readonly, &emptydrive, &ui->zarchive) < 0)
return -1;
}
- ui->volname = filesys_createvolname (c.volname, c.rootdir, _T("harddrive"));
+ ui->volname = filesys_createvolname (c.volname, c.rootdir, ui->zarchive, _T("harddrive"));
ui->volflags = flags;
} else {
ui->unit_type = UNIT_FILESYSTEM;
if (emptydrive)
return 0;
xfree (u->ui.volname);
- ui->volname = u->ui.volname = filesys_createvolname (u->mount_volume, u->mount_rootdir, _T("removable"));
+ ui->volname = u->ui.volname = filesys_createvolname (u->mount_volume, u->mount_rootdir, u->zarchive, _T("removable"));
#ifdef RETROPLATFORM
rp_harddrive_image_change (nr, u->mount_readonly, u->mount_rootdir);
#endif
}
}
if (!volptr) {
- volptr = filesys_createvolname (NULL, rootdir, _T("removable"));
+ volptr = filesys_createvolname (NULL, rootdir, NULL, _T("removable"));
_tcscpy (volname, volptr);
xfree (volptr);
volptr = volname;
extern int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo*);
extern int kill_filesys_unitconfig (struct uae_prefs *p, int nr);
extern int move_filesys_unitconfig (struct uae_prefs *p, int nr, int to);
-extern TCHAR *validatedevicename (TCHAR *s);
-extern TCHAR *validatevolumename (TCHAR *s);
+extern TCHAR *validatedevicename (TCHAR *s, const TCHAR *def);
+extern TCHAR *validatevolumename (TCHAR *s, const TCHAR *def);
int filesys_insert (int nr, const TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags);
int filesys_eject (int nr);
int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_config_data *uci);
-extern TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, const TCHAR *def);
+extern TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, struct zvolume *zv, const TCHAR *def);
extern int target_get_volume_name (struct uaedev_mount_info *mtinf, const TCHAR *volumepath, TCHAR *volumename, int size, bool inserted, bool fullcheck);
extern int sprintf_filesys_unit (TCHAR *buffer, int num);
v = v->next;
}
}
- xfree (zv);
+ xfree(zv->volumename);
+ xfree(zv);
}
struct zdirectory {
{
struct zvolume *zv;
struct adfhandle *adf;
- TCHAR *volname = NULL;
TCHAR name[MAX_DPATH];
int gotroot = 0;
goto fail;
adf->blocksize = bs;
adf->highblock = adf->size / adf->blocksize;
- volname = getBSTR (adf->block + adf->blocksize - 20 * 4);
zv = zvolume_alloc (z, ArchiveFormatADF, NULL, NULL);
zv->method = ArchiveFormatADF;
zv->handle = adf;
+ zv->volumename = getBSTR (adf->block + adf->blocksize - 20 * 4);
name[0] = 0;
recurseadf (&zv->root, adf->rootblock, name);
goto fail;
}
-
- xfree (volname);
return zv;
fail:
xfree (adf);