update_drive_gui (num, true);
}
-int DISK_history_add (const TCHAR *name, int idx, int type, int donotcheck)
+int DISK_history_add(const TCHAR *name, int idx, int type, int nopathfix)
{
int i;
+ TCHAR path[MAX_DPATH];
if (idx >= MAX_PREVIOUS_IMAGES)
return 0;
}
if (name[0] == 0)
return 0;
-#if 0
- if (!donotcheck) {
- if (!zfile_exists (name)) {
- for (i = 0; i < MAX_PREVIOUS_IMAGES; i++) {
- if (!_tcsicmp (dfxhistory[type][i], name)) {
- while (i < MAX_PREVIOUS_IMAGES - 1) {
- _tcscpy (dfxhistory[type][i], dfxhistory[type][i + 1]);
- i++;
- }
- dfxhistory[type][MAX_PREVIOUS_IMAGES - 1][0] = 0;
- break;
- }
- }
- return 0;
- }
+ _tcscpy(path, name);
+ if (!nopathfix) {
+ fullpath(path, sizeof(path) / sizeof(TCHAR));
}
-#endif
if (idx >= 0) {
if (idx >= MAX_PREVIOUS_IMAGES)
return 0;
dfxhistory[type][idx][0] = 0;
for (i = 0; i < MAX_PREVIOUS_IMAGES; i++) {
- if (!_tcsicmp (dfxhistory[type][i], name))
+ if (!_tcsicmp (dfxhistory[type][i], path))
return 0;
}
- _tcscpy (dfxhistory[type][idx], name);
+ _tcscpy (dfxhistory[type][idx], path);
return 1;
}
for (i = 0; i < MAX_PREVIOUS_IMAGES; i++) {
- if (!_tcscmp (dfxhistory[type][i], name)) {
+ TCHAR *h = dfxhistory[type][i];
+ if (!_tcscmp(h, path)) {
while (i < MAX_PREVIOUS_IMAGES - 1) {
_tcscpy (dfxhistory[type][i], dfxhistory[type][i + 1]);
i++;
}
for (i = MAX_PREVIOUS_IMAGES - 2; i >= 0; i--)
_tcscpy (dfxhistory[type][i + 1], dfxhistory[type][i]);
- _tcscpy (dfxhistory[type][0], name);
+ _tcscpy (dfxhistory[type][0], path);
return 1;
}
if (_tcslen (tmp) == 7) {
idx2 = _tstol (tmp + 5) - 1;
if (idx2 >= 0)
- DISK_history_add (tmp2, idx2, type, type != HISTORY_FLOPPY && type != HISTORY_CD);
+ DISK_history_add (tmp2, idx2, type, 1);
}
idx++;
}
pathname[0] = 0;
if (name) {
_tcscpy (pathname, name);
- if (getregmode ())
- abspathtorelative (pathname);
}
if (rd->crc32 == 0xffffffff) {
if (rd->configname)
return 1;
}
}
+ fullpath(pathname, sizeof(pathname) / sizeof(TCHAR));
if (pathname[0]) {
_tcscat(tmp2, _T(" / \""));
_tcscat(tmp2, pathname);
}
}
-static void setstatefilename (HWND hDlg)
+static void addstatefilename(HWND hDlg)
{
- TCHAR *s = _tcsrchr (workprefs.statefile, '\\');
- if (s) {
- s++;
- } else {
- s = _tcsrchr (workprefs.statefile, '/');
- if (s)
- s++;
- }
- if (!s)
- s = workprefs.statefile;
- SetDlgItemText (hDlg, IDC_STATENAME, s);
- ew (hDlg, IDC_STATECLEAR, workprefs.statefile[0] != 0);
- setchecked (hDlg, IDC_STATECLEAR, workprefs.statefile[0] != 0);
+ DISK_history_add(workprefs.statefile, -1, HISTORY_STATEFILE, 0);
+ addhistorymenu(hDlg, workprefs.statefile, IDC_STATENAME, HISTORY_STATEFILE, true, -1);
+ ew(hDlg, IDC_STATECLEAR, workprefs.statefile[0] != 0);
+ setchecked(hDlg, IDC_STATECLEAR, workprefs.statefile[0] != 0);
}
static void getguidefaultsize(int *wp, int *hp)
InitializeListView (hDlg);
values_to_miscdlg (hDlg);
enable_for_miscdlg (hDlg);
- addhistorymenu(hDlg, NULL, IDC_STATENAME, HISTORY_STATEFILE, true, -1);
- setstatefilename(hDlg);
+ addstatefilename(hDlg);
recursive--;
return TRUE;
}
}
_tcscpy(workprefs.statefile, savestate_fname);
- setstatefilename(hDlg);
+ addstatefilename(hDlg);
}
}
}
case IDC_STATECLEAR:
savestate_initsave (NULL, 0, 0, false);
_tcscpy (workprefs.statefile, savestate_fname);
- setstatefilename (hDlg);
+ addstatefilename (hDlg);
break;
case IDC_DOSAVESTATE:
workprefs.statefile[0] = 0;
save_state (savestate_fname, _T("Description!"));
_tcscpy (workprefs.statefile, savestate_fname);
}
- setstatefilename (hDlg);
+ addstatefilename (hDlg);
break;
case IDC_DOLOADSTATE:
if (DiskSelection(hDlg, wParam, 10, &workprefs, NULL, NULL)) {
savestate_state = STATE_DORESTORE;
+ fullpath(savestate_fname, sizeof(savestate_fname) / sizeof(TCHAR));
_tcscpy (workprefs.statefile, savestate_fname);
- setstatefilename (hDlg);
+ addstatefilename (hDlg);
}
break;
case IDC_INACTIVE_NOJOY:
WIN32GUI_LoadUIString (IDS_SELECTFILESYSROOT, szTitle, MAX_DPATH);
if (DirectorySelection (hDlg, &volumeguid, directory_path)) {
newdir = 1;
- DISK_history_add (directory_path, -1, HISTORY_DIR, 1);
+ DISK_history_add (directory_path, -1, HISTORY_DIR, 0);
regsetstr (NULL, _T("FilesystemDirectoryPath"), directory_path);
}
}
if (ask) {
DiskSelection (hDlg, IDC_PATH_NAME, 2, &workprefs, NULL, newpath);
GetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.ci.rootdir, sizeof current_hfdlg.ci.rootdir / sizeof (TCHAR));
- DISK_history_add(current_hfdlg.ci.rootdir, -1, HISTORY_HDF, 1);
+ DISK_history_add(current_hfdlg.ci.rootdir, -1, HISTORY_HDF, 0);
}
fullpath (current_hfdlg.ci.rootdir, sizeof current_hfdlg.ci.rootdir / sizeof (TCHAR));
if (newhd) {
case IDC_TAPE_SELECT_FILE:
DiskSelection (hDlg, IDC_PATH_NAME, 18, &workprefs, NULL, NULL);
GetDlgItemText (hDlg, IDC_PATH_NAME, current_tapedlg.ci.rootdir, sizeof current_tapedlg.ci.rootdir / sizeof (TCHAR));
- DISK_history_add(current_tapedlg.ci.rootdir, -1, HISTORY_TAPE, 1);
+ DISK_history_add(current_tapedlg.ci.rootdir, -1, HISTORY_TAPE, 0);
fullpath (current_tapedlg.ci.rootdir, sizeof current_tapedlg.ci.rootdir / sizeof (TCHAR));
readonly = !tape_can_write(current_tapedlg.ci.rootdir);
ew (hDlg, IDC_TAPE_RW, !readonly);
SetDlgItemText (hDlg, IDC_PATH_NAME, directory_path);
}
_tcscpy (current_tapedlg.ci.rootdir, directory_path);
- DISK_history_add(current_tapedlg.ci.rootdir, -1, HISTORY_TAPE, 1);
+ DISK_history_add(current_tapedlg.ci.rootdir, -1, HISTORY_TAPE, 0);
readonly = !tape_can_write(current_tapedlg.ci.rootdir);
ew (hDlg, IDC_TAPE_RW, !readonly);
if (readonly)
case IDC_FILESYS_SELECTOR:
DiskSelection (hDlg, IDC_PATH_FILESYS, 12, &workprefs, NULL, NULL);
getcomboboxtext(hDlg, IDC_PATH_FILESYS, current_hfdlg.ci.filesys, sizeof current_hfdlg.ci.filesys / sizeof(TCHAR));
- DISK_history_add(current_hfdlg.ci.filesys, -1, HISTORY_FS, 1);
+ DISK_history_add(current_hfdlg.ci.filesys, -1, HISTORY_FS, 0);
break;
case IDOK:
CustomDialogClose(hDlg, -1);
break;
case IDC_PATH_GEOMETRY_SELECTOR:
if (DiskSelection (hDlg, IDC_PATH_GEOMETRY, 23, &workprefs, NULL, current_hfdlg.ci.geometry)) {
- DISK_history_add(current_hfdlg.ci.geometry, -1, HISTORY_GEO, 1);
+ DISK_history_add(current_hfdlg.ci.geometry, -1, HISTORY_GEO, 0);
sethardfile(hDlg);
updatehdfinfo (hDlg, true, false, false);
}
case IDC_PATH_GEOMETRY_SELECTOR:
if (DiskSelection (hDlg, IDC_PATH_GEOMETRY, 23, &workprefs, NULL, current_hfdlg.ci.geometry)) {
getcomboboxtext(hDlg, IDC_PATH_GEOMETRY, current_hfdlg.ci.geometry, sizeof current_hfdlg.ci.geometry / sizeof(TCHAR));
- DISK_history_add(current_hfdlg.ci.geometry, -1, HISTORY_GEO, 1);
+ DISK_history_add(current_hfdlg.ci.geometry, -1, HISTORY_GEO, 0);
setharddrive(hDlg);
updatehdfinfo (hDlg, true, false, true);
}
}
}
if (psresult > 0 && config_pathfilename[0]) {
- DISK_history_add(config_pathfilename, -1, HISTORY_CONFIGFILE, false);
+ DISK_history_add(config_pathfilename, -1, HISTORY_CONFIGFILE, 0);
}
if (closed) {