mirror of
https://github.com/LIV2/WinUAE.git
synced 2025-12-06 00:12:52 +00:00
Quickstart disk image/executable drag&drop check, insert in harddrives if archive with multiple executables.
This commit is contained in:
parent
2a2fa845ed
commit
e611573153
@ -119,6 +119,7 @@ extern int zfile_truncate(struct zfile *z, uae_s64 size);
|
||||
#define ZFILE_NVR 7
|
||||
#define ZFILE_HDFRDB 8
|
||||
#define ZFILE_CDIMAGE 9
|
||||
#define ZFILE_EXECUTABLE 10
|
||||
|
||||
extern const TCHAR *uae_archive_extensions[];
|
||||
extern const TCHAR *uae_ignoreextensions[];
|
||||
|
||||
3
main.cpp
3
main.cpp
@ -885,7 +885,8 @@ static int diskswapper_cb (struct zfile *f, void *vrsd)
|
||||
int *num = (int*)vrsd;
|
||||
if (*num >= MAX_SPARE_DRIVES)
|
||||
return 1;
|
||||
if (zfile_gettype (f) == ZFILE_DISKIMAGE) {
|
||||
int type = zfile_gettype(f);
|
||||
if (type == ZFILE_DISKIMAGE || type == ZFILE_EXECUTABLE) {
|
||||
_tcsncpy (currprefs.dfxlist[*num], zfile_getname (f), 255);
|
||||
(*num)++;
|
||||
}
|
||||
|
||||
@ -7220,6 +7220,7 @@ static int process_arg (TCHAR *cmdline, TCHAR **xargv, TCHAR ***xargv3)
|
||||
_stprintf (tmp, _T("-cdimage=%s"), f);
|
||||
break;
|
||||
case ZFILE_DISKIMAGE:
|
||||
case ZFILE_EXECUTABLE:
|
||||
if (fd < 4)
|
||||
_stprintf (tmp, _T("-cfgparam=floppy%d=%s"), fd++, f);
|
||||
break;
|
||||
|
||||
@ -17325,8 +17325,9 @@ static void diskswapper_addfile (struct uae_prefs *prefs, const TCHAR *file)
|
||||
struct zfile *zf = zfile_fopen (out, _T("rb"), ZFD_NORMAL);
|
||||
if (zf) {
|
||||
int type = zfile_gettype (zf);
|
||||
if (type == ZFILE_DISKIMAGE)
|
||||
if (type == ZFILE_DISKIMAGE || type == ZFILE_EXECUTABLE) {
|
||||
diskswapper_addfile2 (prefs, out);
|
||||
}
|
||||
zfile_fclose (zf);
|
||||
}
|
||||
}
|
||||
@ -22377,7 +22378,7 @@ static int floppyslot_addfile (struct uae_prefs *prefs, const TCHAR *filepath, c
|
||||
struct zfile *zf = zfile_fopen (out, _T("rb"), ZFD_NORMAL);
|
||||
if (zf) {
|
||||
int type = zfile_gettype (zf);
|
||||
if (type == ZFILE_DISKIMAGE) {
|
||||
if (type == ZFILE_DISKIMAGE || type == ZFILE_EXECUTABLE) {
|
||||
drv = floppyslot_addfile2 (prefs, out, drv, firstdrv, maxdrv);
|
||||
if (drv < 0)
|
||||
break;
|
||||
@ -22540,7 +22541,11 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
|
||||
type = zfile_gettype (z);
|
||||
if (type == ZFILE_ROM) {
|
||||
rd = getromdatabyzfile (z);
|
||||
}
|
||||
} else if (currentpage == QUICKSTART_ID) {
|
||||
if (type == ZFILE_UNKNOWN && iszip(z)) {
|
||||
type = ZFILE_HDF;
|
||||
}
|
||||
}
|
||||
// replace with decrunched path but only if
|
||||
// floppy insert and decrunched path is deeper (longer)
|
||||
if (type > 0 && _tcslen(z->name) > _tcslen(file) && drv >= 0) {
|
||||
@ -22563,7 +22568,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
|
||||
|
||||
if (drvdrag) {
|
||||
type = ZFILE_DISKIMAGE;
|
||||
} else if ((zip || harddrive) && type != ZFILE_DISKIMAGE) {
|
||||
} else if ((zip || harddrive) && type != ZFILE_DISKIMAGE && type != ZFILE_EXECUTABLE) {
|
||||
if (do_filesys_insert (file, cnt))
|
||||
continue;
|
||||
if (zip) {
|
||||
@ -22582,6 +22587,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
|
||||
switch (type)
|
||||
{
|
||||
case ZFILE_DISKIMAGE:
|
||||
case ZFILE_EXECUTABLE:
|
||||
if (currentpage == DISK_ID) {
|
||||
diskswapper_addfile (prefs, file);
|
||||
} else if (currentpage == HARDDISK_ID) {
|
||||
|
||||
@ -329,7 +329,7 @@ int zfile_gettype (struct zfile *z)
|
||||
zfile_fread (buf, 8, 1, z);
|
||||
zfile_fseek (z, -8, SEEK_CUR);
|
||||
if (!memcmp (buf, exeheader, sizeof (buf)))
|
||||
return ZFILE_DISKIMAGE;
|
||||
return ZFILE_EXECUTABLE;
|
||||
if (!memcmp (buf, "CAPS", 4))
|
||||
return ZFILE_DISKIMAGE;
|
||||
if (!memcmp (buf, "SCP", 3))
|
||||
|
||||
@ -112,6 +112,7 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns
|
||||
int mask = zf->zfdmask;
|
||||
int canhistory = (mask & ZFD_DISKHISTORY) && !(mask & ZFD_CHECKONLY);
|
||||
int getflag = (mask & ZFD_DELAYEDOPEN) ? FILE_DELAYEDOPEN : 0;
|
||||
int execnt = 0;
|
||||
|
||||
if (retcode)
|
||||
*retcode = 0;
|
||||
@ -125,6 +126,7 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns
|
||||
zv = getzvolume (parent, zf, id);
|
||||
if (!zv)
|
||||
return NULL;
|
||||
retry:;
|
||||
we_have_file = 0;
|
||||
tmphist[0] = 0;
|
||||
zipcnt = 1;
|
||||
@ -189,8 +191,24 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns
|
||||
ft = ZFILE_CDIMAGE;
|
||||
}
|
||||
} else {
|
||||
zt = archive_getzfile (zn, id, getflag);
|
||||
ft = zfile_gettype (zt);
|
||||
zt = archive_getzfile(zn, id, getflag);
|
||||
ft = zfile_gettype(zt);
|
||||
// if more than 1 exe: do not mount as disk image
|
||||
if (ft == ZFILE_EXECUTABLE) {
|
||||
if (execnt < 0) {
|
||||
ft = ZFILE_UNKNOWN;
|
||||
zfile_fclose(z);
|
||||
z = NULL;
|
||||
zfile_fclose(zt);
|
||||
zt = NULL;
|
||||
} else {
|
||||
if (execnt > 0) {
|
||||
execnt = -1;
|
||||
goto retry;
|
||||
}
|
||||
execnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((select < 0 || ft) && whf > we_have_file) {
|
||||
if (!zt)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user