summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2022-03-30 21:26:25 +0200
committer Olivier Galibert <galibert@pobox.com>2022-03-30 21:26:37 +0200
commit3728913a4ee0db1c590646cc4f89a9da6a0446f9 (patch)
tree57cd9fba5ba6ad6b30bc498001ec03ef88878084 /src
parentafc735c502c61c1b1560708dc2f309bef20cef50 (diff)
floppy: revisit the identify returns
Diffstat (limited to 'src')
-rw-r--r--src/devices/imagedev/floppy.cpp2
-rw-r--r--src/lib/formats/acorn_dsk.cpp14
-rw-r--r--src/lib/formats/afs_dsk.cpp2
-rw-r--r--src/lib/formats/aim_dsk.cpp2
-rw-r--r--src/lib/formats/ami_dsk.cpp2
-rw-r--r--src/lib/formats/ap2_dsk.cpp85
-rw-r--r--src/lib/formats/ap_dsk35.cpp8
-rw-r--r--src/lib/formats/apd_dsk.cpp4
-rw-r--r--src/lib/formats/ccvf_dsk.cpp2
-rw-r--r--src/lib/formats/concept_dsk.cpp2
-rw-r--r--src/lib/formats/coupedsk.cpp2
-rw-r--r--src/lib/formats/cqm_dsk.cpp2
-rw-r--r--src/lib/formats/d64_dsk.cpp2
-rw-r--r--src/lib/formats/d88_dsk.cpp2
-rw-r--r--src/lib/formats/dcp_dsk.cpp4
-rw-r--r--src/lib/formats/dfi_dsk.cpp2
-rw-r--r--src/lib/formats/dim_dsk.cpp2
-rw-r--r--src/lib/formats/dip_dsk.cpp2
-rw-r--r--src/lib/formats/dmk_dsk.cpp2
-rw-r--r--src/lib/formats/ds9_dsk.cpp2
-rw-r--r--src/lib/formats/dsk_dsk.cpp4
-rw-r--r--src/lib/formats/dvk_mx_dsk.cpp4
-rw-r--r--src/lib/formats/esq16_dsk.cpp2
-rw-r--r--src/lib/formats/esq8_dsk.cpp2
-rw-r--r--src/lib/formats/fdd_dsk.cpp2
-rw-r--r--src/lib/formats/flex_dsk.cpp2
-rw-r--r--src/lib/formats/flopimg.h14
-rw-r--r--src/lib/formats/fsd_dsk.cpp2
-rw-r--r--src/lib/formats/g64_dsk.cpp2
-rw-r--r--src/lib/formats/hpi_dsk.cpp2
-rw-r--r--src/lib/formats/hxchfe_dsk.cpp2
-rw-r--r--src/lib/formats/hxcmfm_dsk.cpp2
-rw-r--r--src/lib/formats/ibmxdf_dsk.cpp2
-rw-r--r--src/lib/formats/imd_dsk.cpp2
-rw-r--r--src/lib/formats/img_dsk.cpp2
-rw-r--r--src/lib/formats/ipf_dsk.cpp2
-rw-r--r--src/lib/formats/jfd_dsk.cpp5
-rw-r--r--src/lib/formats/jvc_dsk.cpp4
-rw-r--r--src/lib/formats/m20_dsk.cpp2
-rw-r--r--src/lib/formats/mdos_dsk.cpp2
-rw-r--r--src/lib/formats/mfi_dsk.cpp2
-rw-r--r--src/lib/formats/nfd_dsk.cpp2
-rw-r--r--src/lib/formats/opd_dsk.cpp2
-rw-r--r--src/lib/formats/oric_dsk.cpp4
-rw-r--r--src/lib/formats/os9_dsk.cpp2
-rw-r--r--src/lib/formats/pasti_dsk.cpp2
-rw-r--r--src/lib/formats/pc98fdi_dsk.cpp2
-rw-r--r--src/lib/formats/poly_dsk.cpp2
-rw-r--r--src/lib/formats/rx50_dsk.cpp2
-rw-r--r--src/lib/formats/sdf_dsk.cpp2
-rw-r--r--src/lib/formats/st_dsk.cpp4
-rw-r--r--src/lib/formats/svi_dsk.cpp2
-rw-r--r--src/lib/formats/td0_dsk.cpp2
-rw-r--r--src/lib/formats/ti99_dsk.cpp8
-rw-r--r--src/lib/formats/trs80_dsk.cpp2
-rw-r--r--src/lib/formats/uniflex_dsk.cpp2
-rw-r--r--src/lib/formats/upd765_dsk.cpp2
-rw-r--r--src/lib/formats/vdk_dsk.cpp2
-rw-r--r--src/lib/formats/victor9k_dsk.cpp2
-rw-r--r--src/lib/formats/vt_dsk.cpp4
-rw-r--r--src/lib/formats/wd177x_dsk.cpp2
-rw-r--r--src/tools/floptool.cpp8
-rw-r--r--src/tools/image_handler.cpp2
63 files changed, 181 insertions, 89 deletions
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index 922fddfbbdc..c1d97d714c6 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -601,6 +601,8 @@ image_init_result floppy_image_device::call_load()
const floppy_image_format_t *best_format = nullptr;
for (const floppy_image_format_t *format : fif_list) {
int score = format->identify(*io, form_factor, variants);
+ if(score && format->extension_matches(filename()))
+ score |= floppy_image_format_t::FIFID_EXT;
if(score > best) {
best = score;
best_format = format;
diff --git a/src/lib/formats/acorn_dsk.cpp b/src/lib/formats/acorn_dsk.cpp
index ff26a1b020a..002c3aa1d37 100644
--- a/src/lib/formats/acorn_dsk.cpp
+++ b/src/lib/formats/acorn_dsk.cpp
@@ -113,7 +113,7 @@ int acorn_ssd_format::identify(util::random_read &io, uint32_t form_factor, cons
int type = find_size(io, form_factor, variants);
if (type != -1)
- return 90;
+ return FIFID_SIZE;
return 0;
}
@@ -246,7 +246,7 @@ int acorn_dsd_format::identify(util::random_read &io, uint32_t form_factor, cons
int type = find_size(io, form_factor, variants);
if (type != -1)
- return 90;
+ return FIFID_SIZE;
return 0;
}
@@ -351,7 +351,7 @@ int opus_ddos_format::identify(util::random_read &io, uint32_t form_factor, cons
int type = find_size(io, form_factor, variants);
if (type != -1)
- return 90;
+ return FIFID_SIZE;
return 0;
}
@@ -448,7 +448,7 @@ int acorn_adfs_old_format::identify(util::random_read &io, uint32_t form_factor,
int type = find_size(io, form_factor, variants);
if(type != -1)
- return 100;
+ return FIFID_SIZE;
return 0;
}
@@ -552,7 +552,7 @@ int acorn_adfs_new_format::identify(util::random_read &io, uint32_t form_factor,
int type = find_size(io, form_factor, variants);
if (type != -1)
- return 100;
+ return FIFID_SIZE;
return 0;
}
@@ -633,7 +633,7 @@ int acorn_dos_format::identify(util::random_read &io, uint32_t form_factor, cons
int type = find_size(io, form_factor, variants);
if (type != -1)
- return 90;
+ return FIFID_SIZE;
return 0;
}
@@ -695,7 +695,7 @@ int opus_ddcpm_format::identify(util::random_read &io, uint32_t form_factor, con
}
if (size == 819200 && memcmp(h, "Slogger ", 8) == 0)
- return 100;
+ return FIFID_SIGN | FIFID_SIZE;
LOG_FORMATS("ddcpm: no match\n");
return 0;
diff --git a/src/lib/formats/afs_dsk.cpp b/src/lib/formats/afs_dsk.cpp
index 762e81b7603..589a641de7e 100644
--- a/src/lib/formats/afs_dsk.cpp
+++ b/src/lib/formats/afs_dsk.cpp
@@ -35,7 +35,7 @@ int afs_format::identify(util::random_read &io, uint32_t form_factor, const std:
int type = find_size(io, form_factor, variants);
if (type != -1)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/aim_dsk.cpp b/src/lib/formats/aim_dsk.cpp
index 04225ad10d8..db69282f06a 100644
--- a/src/lib/formats/aim_dsk.cpp
+++ b/src/lib/formats/aim_dsk.cpp
@@ -47,7 +47,7 @@ int aim_format::identify(util::random_read &io, uint32_t form_factor, const std:
return 0;
if (size == 2068480)
- return 100;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/ami_dsk.cpp b/src/lib/formats/ami_dsk.cpp
index 48b873b128e..13f6e17f43c 100644
--- a/src/lib/formats/ami_dsk.cpp
+++ b/src/lib/formats/ami_dsk.cpp
@@ -44,7 +44,7 @@ int adf_format::identify(util::random_read &io, uint32_t form_factor, const std:
return 0;
if ((size == 901120) || (size == 912384) || (size == 1802240))
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/ap2_dsk.cpp b/src/lib/formats/ap2_dsk.cpp
index 2b6d6c07c88..9e37476b6e4 100644
--- a/src/lib/formats/ap2_dsk.cpp
+++ b/src/lib/formats/ap2_dsk.cpp
@@ -594,12 +594,81 @@ int a2_16sect_format::identify(util::random_read &io, uint32_t form_factor, cons
uint32_t expected_size = APPLE2_TRACK_COUNT * 16 * 256;
// check standard size plus some oddball sizes in our softlist
- if ((size == expected_size) || (size == 35 * 16 * 256) || (size == 143403) || (size == 143363) || (size == 143358))
+ if ((size != expected_size) && (size != 35 * 16 * 256) && (size != 143403) && (size != 143363) && (size != 143358))
{
- return 50;
+ return 0;
}
- return 0;
+ uint8_t sector_data[256*2];
+ static const unsigned char pascal_block1[4] = { 0x08, 0xa5, 0x0f, 0x29 };
+ static const unsigned char pascal2_block1[4] = { 0xff, 0xa2, 0x00, 0x8e };
+ static const unsigned char dos33_block1[4] = { 0xa2, 0x02, 0x8e, 0x52 };
+ static const unsigned char sos_block1[4] = { 0xc9, 0x20, 0xf0, 0x3e };
+ static const unsigned char a3a2emul_block1[6] = { 0x8d, 0xd0, 0x03, 0x4c, 0xc7, 0xa4 };
+ static const unsigned char cpm22_block1[8] = { 0xa2, 0x55, 0xa9, 0x00, 0x9d, 0x00, 0x0d, 0xca };
+ static const unsigned char subnod_block1[8] = { 0x63, 0xaa, 0xf0, 0x76, 0x8d, 0x63, 0xaa, 0x8e };
+
+ size_t actual;
+ io.read_at(0, sector_data, 256*2, actual);
+
+ bool prodos_order = false;
+ // check ProDOS boot block
+ if (!memcmp("PRODOS", &sector_data[0x103], 6))
+ {
+ prodos_order = true;
+ } // check for alternate version ProDOS boot block
+ if (!memcmp("PRODOS", &sector_data[0x121], 6))
+ {
+ prodos_order = true;
+ } // check for ProDOS order SOS disk
+ else if (!memcmp(sos_block1, &sector_data[0x100], 4))
+ {
+ prodos_order = true;
+ } // check for Apple III A2 emulator disk in ProDOS order
+ else if (!memcmp(a3a2emul_block1, &sector_data[0x100], 6))
+ {
+ prodos_order = true;
+ } // check for PCPI Applicard software in ProDOS order
+ else if (!memcmp("COPYRIGHT (C) 1979, DIGITAL RESEARCH", &sector_data[0x118], 36))
+ {
+ prodos_order = true;
+ } // check Apple II Pascal
+ else if (!memcmp("SYSTEM.APPLE", &sector_data[0xd7], 12))
+ {
+ // Pascal discs can still be DOS order.
+ // Check for the second half of the boot code at 0x100
+ // (which means ProDOS order)
+ if (!memcmp(pascal_block1, &sector_data[0x100], 4))
+ {
+ prodos_order = true;
+ }
+ } // check for DOS 3.3 disks in ProDOS order
+ else if (!memcmp(dos33_block1, &sector_data[0x100], 4))
+ {
+ prodos_order = true;
+ } // check for a later version of the Pascal boot block
+ else if (!memcmp(pascal2_block1, &sector_data[0x100], 4))
+ {
+ prodos_order = true;
+ } // check for CP/M disks in ProDOS order
+ else if (!memcmp(cpm22_block1, &sector_data[0x100], 8))
+ {
+ prodos_order = true;
+ } // check for subnodule disk
+ else if (!memcmp(subnod_block1, &sector_data[0x100], 8))
+ {
+ prodos_order = true;
+ } // check for ProDOS 2.5's new boot block
+ else if (!memcmp("PRODOS", &sector_data[0x3a], 6))
+ {
+ prodos_order = true;
+ }
+ else if (!memcmp("PRODOS", &sector_data[0x40], 6))
+ {
+ prodos_order = true;
+ }
+
+ return FIFID_SIZE | (m_prodos_order == prodos_order ? FIFID_HINT : 0);
}
bool a2_16sect_format::load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) const
@@ -984,7 +1053,7 @@ int a2_rwts18_format::identify(util::random_read &io, uint32_t form_factor, cons
if(io.length(size))
return 0;
uint32_t const expected_size = APPLE2_TRACK_COUNT * 16 * 256;
- return size == expected_size;
+ return size == expected_size ? FIFID_SIZE : 0;
}
bool a2_rwts18_format::load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) const
@@ -1465,7 +1534,7 @@ int a2_edd_format::identify(util::random_read &io, uint32_t form_factor, const s
uint64_t size;
if (io.length(size))
return 0;
- return ((size == 2244608) || (size == 2310144)) ? 50 : 0;
+ return ((size == 2244608) || (size == 2310144)) ? FIFID_SIZE : 0;
}
uint8_t a2_edd_format::pick(const uint8_t *data, int pos)
@@ -1592,8 +1661,8 @@ int a2_woz_format::identify(util::random_read &io, uint32_t form_factor, const s
uint8_t header[8];
size_t actual;
io.read_at(0, header, 8, actual);
- if (!memcmp(header, signature, 8)) return 100;
- if (!memcmp(header, signature2, 8)) return 100;
+ if (!memcmp(header, signature, 8)) return FIFID_SIGN;
+ if (!memcmp(header, signature2, 8)) return FIFID_SIGN;
return 0;
}
@@ -1898,7 +1967,7 @@ int a2_nib_format::identify(util::random_read &io, uint32_t form_factor, const s
return 0;
if (size == expected_size_35t || size == expected_size_40t)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/ap_dsk35.cpp b/src/lib/formats/ap_dsk35.cpp
index bb07ba13ca4..984ba6ce046 100644
--- a/src/lib/formats/ap_dsk35.cpp
+++ b/src/lib/formats/ap_dsk35.cpp
@@ -1258,7 +1258,7 @@ int dc42_format::identify(util::random_read &io, uint32_t form_factor, const std
return 0;
}
- return (size == 0x54+tsize+dsize && h[0] < 64 && h[0x52] == 1 && h[0x53] == 0) ? 100 : 0;
+ return (size == 0x54+tsize+dsize && h[0] < 64 && h[0x52] == 1 && h[0x53] == 0) ? FIFID_STRUCT|FIFID_STRUCT : 0;
}
bool dc42_format::load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) const
@@ -1448,7 +1448,7 @@ int apple_gcr_format::identify(util::random_read &io, uint32_t form_factor, cons
return 0;
if(size == 409600 || (size == 819200 && (variants.empty() || has_variant(variants, floppy_image::DSDD))))
- return 50;
+ return FIFID_SIZE;
return 0;
}
@@ -1557,13 +1557,13 @@ int apple_2mg_format::identify(util::random_read &io, uint32_t form_factor, cons
io.read_at(0, signature, 4, actual);
if (!strncmp(reinterpret_cast<char *>(signature), "2IMG", 4))
{
- return 100;
+ return FIFID_SIGN;
}
// Bernie ][ The Rescue wrote 2MGs with the signature byte-flipped, other fields are valid
if (!strncmp(reinterpret_cast<char *>(signature), "GMI2", 4))
{
- return 100;
+ return FIFID_SIGN;
}
return 0;
diff --git a/src/lib/formats/apd_dsk.cpp b/src/lib/formats/apd_dsk.cpp
index b93be8e9372..eb65fb3806d 100644
--- a/src/lib/formats/apd_dsk.cpp
+++ b/src/lib/formats/apd_dsk.cpp
@@ -96,7 +96,7 @@ const char *apd_format::extensions() const
int apd_format::identify(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants) const
{
uint64_t size;
- if (io.length(size))
+ if (io.length(size) || !size)
return 0;
std::vector<uint8_t> img(size);
@@ -129,7 +129,7 @@ int apd_format::identify(util::random_read &io, uint32_t form_factor, const std:
}
if (!memcmp(&img[0], APD_HEADER, sizeof(APD_HEADER))) {
- return 100;
+ return FIFID_SIGN;
}
return 0;
diff --git a/src/lib/formats/ccvf_dsk.cpp b/src/lib/formats/ccvf_dsk.cpp
index f8d0a2526d9..fbdcf17d385 100644
--- a/src/lib/formats/ccvf_dsk.cpp
+++ b/src/lib/formats/ccvf_dsk.cpp
@@ -53,7 +53,7 @@ int ccvf_format::identify(util::random_read &io, uint32_t form_factor, const std
size_t actual;
io.read_at(0, h, 36, actual);
if (!memcmp(h, "Compucolor Virtual Floppy Disk Image", 36))
- return 100;
+ return FIFID_SIGN;
return 0;
}
diff --git a/src/lib/formats/concept_dsk.cpp b/src/lib/formats/concept_dsk.cpp
index 46c071c95f6..e8a12f2a6ff 100644
--- a/src/lib/formats/concept_dsk.cpp
+++ b/src/lib/formats/concept_dsk.cpp
@@ -93,7 +93,7 @@ int cc525dsdd_format::identify(util::random_read &io, uint32_t form_factor, cons
find_size(io, track_count, head_count, sector_count);
if (track_count)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/coupedsk.cpp b/src/lib/formats/coupedsk.cpp
index 60b56dc3efe..90039e8b6cb 100644
--- a/src/lib/formats/coupedsk.cpp
+++ b/src/lib/formats/coupedsk.cpp
@@ -71,7 +71,7 @@ int mgt_format::identify(util::random_read &io, uint32_t form_factor, const std:
return 0;
if(/*size == 737280 || */ size == 819200)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/cqm_dsk.cpp b/src/lib/formats/cqm_dsk.cpp
index 606e9c10623..fdb8ed5042f 100644
--- a/src/lib/formats/cqm_dsk.cpp
+++ b/src/lib/formats/cqm_dsk.cpp
@@ -261,7 +261,7 @@ int cqm_format::identify(util::random_read &io, uint32_t form_factor, const std:
io.read_at(0, h, 3, actual);
if (h[0] == 'C' && h[1] == 'Q' && h[2] == 0x14)
- return 100;
+ return FIFID_SIGN;
return 0;
}
diff --git a/src/lib/formats/d64_dsk.cpp b/src/lib/formats/d64_dsk.cpp
index 01a20b229aa..06a357577d7 100644
--- a/src/lib/formats/d64_dsk.cpp
+++ b/src/lib/formats/d64_dsk.cpp
@@ -107,7 +107,7 @@ int d64_format::identify(util::random_read &io, uint32_t form_factor, const std:
const int type = find_size(io, form_factor);
if (type != -1)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/d88_dsk.cpp b/src/lib/formats/d88_dsk.cpp
index 98fbc57eb77..78077c16007 100644
--- a/src/lib/formats/d88_dsk.cpp
+++ b/src/lib/formats/d88_dsk.cpp
@@ -426,7 +426,7 @@ int d88_format::identify(util::random_read &io, uint32_t form_factor, const std:
io.read_at(0, h, 32, actual);
if((little_endianize_int32(*(uint32_t *)(h+0x1c)) == size) &&
(h[0x1b] == 0x00 || h[0x1b] == 0x10 || h[0x1b] == 0x20 || h[0x1b] == 0x30 || h[0x1b] == 0x40))
- return 100;
+ return FIFID_SIZE|FIFID_STRUCT;
return 0;
}
diff --git a/src/lib/formats/dcp_dsk.cpp b/src/lib/formats/dcp_dsk.cpp
index fbeb5f5ef48..5dff5fd1843 100644
--- a/src/lib/formats/dcp_dsk.cpp
+++ b/src/lib/formats/dcp_dsk.cpp
@@ -108,11 +108,11 @@ int dcp_format::identify(util::random_read &io, uint32_t form_factor, const std:
// in theory track map should be enough (former check), but some images have it wrong!
// hence, if this check fails, we also allow for images with all tracks and wrong track map
if (size - 0xa2 == (heads * count_tracks * spt * bps) || size - 0xa2 == (heads * tracks * spt * bps))
- return 100;
+ return FIFID_STRUCT|FIFID_SIZE;
// for disk type 0x11 the head 0 track 0 has 26 sectors of half width, so we need to compensate calculation
if (is_hdb && (size - 0xa2 + (0x80 * 26) == (heads * count_tracks * spt * bps) || size - 0xa2 + (0x80 * 26) == (heads * tracks * spt * bps)))
- return 100;
+ return FIFID_STRUCT|FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/dfi_dsk.cpp b/src/lib/formats/dfi_dsk.cpp
index ea6b23a43f9..fd1912d2fdf 100644
--- a/src/lib/formats/dfi_dsk.cpp
+++ b/src/lib/formats/dfi_dsk.cpp
@@ -64,7 +64,7 @@ int dfi_format::identify(util::random_read &io, uint32_t form_factor, const std:
char sign[4];
size_t actual;
io.read_at(0, sign, 4, actual);
- return memcmp(sign, "DFE2", 4) ? 0 : 100;
+ return memcmp(sign, "DFE2", 4) ? 0 : FIFID_SIGN;
}
bool dfi_format::load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) const
diff --git a/src/lib/formats/dim_dsk.cpp b/src/lib/formats/dim_dsk.cpp
index d2f10f535e0..9406f80ff8c 100644
--- a/src/lib/formats/dim_dsk.cpp
+++ b/src/lib/formats/dim_dsk.cpp
@@ -41,7 +41,7 @@ int dim_format::identify(util::random_read &io, uint32_t form_factor, const std:
io.read_at(0xab, h, 16, actual);
if(strncmp((const char *)h, "DIFC HEADER", 11) == 0)
- return 100;
+ return FIFID_SIGN;
return 0;
}
diff --git a/src/lib/formats/dip_dsk.cpp b/src/lib/formats/dip_dsk.cpp
index 0270612dea3..36d6d4b2da3 100644
--- a/src/lib/formats/dip_dsk.cpp
+++ b/src/lib/formats/dip_dsk.cpp
@@ -45,7 +45,7 @@ int dip_format::identify(util::random_read &io, uint32_t form_factor, const std:
return 0;
if (size == 0x134000 + 0x100)
- return 100;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/dmk_dsk.cpp b/src/lib/formats/dmk_dsk.cpp
index 82a1f0fd3f3..6af3a15b5f6 100644
--- a/src/lib/formats/dmk_dsk.cpp
+++ b/src/lib/formats/dmk_dsk.cpp
@@ -76,7 +76,7 @@ int dmk_format::identify(util::random_read &io, uint32_t form_factor, const std:
if (size == header_size + heads * tracks * track_size)
{
- return 70;
+ return FIFID_STRUCT|FIFID_SIZE;
}
return 0;
diff --git a/src/lib/formats/ds9_dsk.cpp b/src/lib/formats/ds9_dsk.cpp
index 8224c844801..119de56d371 100644
--- a/src/lib/formats/ds9_dsk.cpp
+++ b/src/lib/formats/ds9_dsk.cpp
@@ -84,7 +84,7 @@ int ds9_format::identify(util::random_read &io, uint32_t form_factor, const std:
find_size(io, track_count, head_count, sector_count);
if (track_count)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/dsk_dsk.cpp b/src/lib/formats/dsk_dsk.cpp
index 5039bde3ebe..9c14f781ef5 100644
--- a/src/lib/formats/dsk_dsk.cpp
+++ b/src/lib/formats/dsk_dsk.cpp
@@ -309,10 +309,10 @@ int dsk_format::identify(util::random_read &io, uint32_t form_factor, const std:
size_t actual;
io.read_at(0, &header, sizeof(header), actual);
if ( memcmp( header, DSK_FORMAT_HEADER, 8 ) ==0) {
- return 100;
+ return FIFID_SIGN;
}
if ( memcmp( header, EXT_FORMAT_HEADER, 16 ) ==0) {
- return 100;
+ return FIFID_SIGN;
}
return 0;
}
diff --git a/src/lib/formats/dvk_mx_dsk.cpp b/src/lib/formats/dvk_mx_dsk.cpp
index 77134d93ea6..ab42fc93f4f 100644
--- a/src/lib/formats/dvk_mx_dsk.cpp
+++ b/src/lib/formats/dvk_mx_dsk.cpp
@@ -126,9 +126,9 @@ int dvk_mx_format::identify(util::random_read &io, uint32_t form_factor, const s
io.read_at(512, sectdata, 512, actual);
// check value in RT-11 home block. see src/tools/imgtool/modules/rt11.cpp
if (pick_integer_le(sectdata, 0724, 2) == 6)
- return 100;
+ return FIFID_SIGN|FIFID_SIZE;
else
- return 75;
+ return FIFID_SIZE;
}
diff --git a/src/lib/formats/esq16_dsk.cpp b/src/lib/formats/esq16_dsk.cpp
index b25ab880184..a8611f3e71c 100644
--- a/src/lib/formats/esq16_dsk.cpp
+++ b/src/lib/formats/esq16_dsk.cpp
@@ -93,7 +93,7 @@ int esqimg_format::identify(util::random_read &io, uint32_t form_factor, const s
find_size(io, track_count, head_count, sector_count);
if(track_count)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/esq8_dsk.cpp b/src/lib/formats/esq8_dsk.cpp
index 0c5ef18204d..c352447dc50 100644
--- a/src/lib/formats/esq8_dsk.cpp
+++ b/src/lib/formats/esq8_dsk.cpp
@@ -98,7 +98,7 @@ int esq8img_format::identify(util::random_read &io, uint32_t form_factor, const
find_size(io, track_count, head_count, sector_count);
if(track_count)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/fdd_dsk.cpp b/src/lib/formats/fdd_dsk.cpp
index a699a605991..98a2cfad7dc 100644
--- a/src/lib/formats/fdd_dsk.cpp
+++ b/src/lib/formats/fdd_dsk.cpp
@@ -66,7 +66,7 @@ int fdd_format::identify(util::random_read &io, uint32_t form_factor, const std:
io.read_at(0, h, 7, actual);
if (strncmp((const char *)h, "VFD1.0", 6) == 0)
- return 100;
+ return FIFID_SIGN;
return 0;
}
diff --git a/src/lib/formats/flex_dsk.cpp b/src/lib/formats/flex_dsk.cpp
index 40957daa972..a4e2ea7b01c 100644
--- a/src/lib/formats/flex_dsk.cpp
+++ b/src/lib/formats/flex_dsk.cpp
@@ -80,7 +80,7 @@ int flex_format::identify(util::random_read &io, uint32_t form_factor, const std
int type = find_size(io, form_factor, variants);
if (type != -1)
- return 75;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/flopimg.h b/src/lib/formats/flopimg.h
index 62daaaa2ac8..69567a4286e 100644
--- a/src/lib/formats/flopimg.h
+++ b/src/lib/formats/flopimg.h
@@ -35,6 +35,18 @@ class floppy_image_format_t
public:
virtual ~floppy_image_format_t() = default;
+ // The result of identify is a binary or of these flags, comparison afterwards is numerical.
+ // If a match is incorrect (bad signature for instance), result must be 0. The non-zero
+ // result helps to decide how reliable the identification is, for choice classification.
+
+ enum {
+ FIFID_HINT = 0x01, // All other things being equal, favorise this format
+ FIFID_EXT = 0x02, // Extension matches one of the list (set outside of identify)
+ FIFID_SIZE = 0x04, // File size matches what is expected
+ FIFID_SIGN = 0x08, // The file signature matches
+ FIFID_STRUCT = 0x10, // Some file internal structure aspects have been verified
+ };
+
/*! @brief Identify an image.
The identify function tests if the image is valid
for this particular format.
@@ -42,7 +54,7 @@ public:
@param form_factor Physical form factor of disk, from the enum
in floppy_image
@param variants the variants from floppy_image the drive can handle
- @return 1 if image valid, 0 otherwise.
+ @return Binary or of FIFID flags, 0 if invalid for that format
*/
virtual int identify(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants) const = 0;
diff --git a/src/lib/formats/fsd_dsk.cpp b/src/lib/formats/fsd_dsk.cpp
index 5047b15c852..23bc7d57481 100644
--- a/src/lib/formats/fsd_dsk.cpp
+++ b/src/lib/formats/fsd_dsk.cpp
@@ -95,7 +95,7 @@ int fsd_format::identify(util::random_read &io, uint32_t form_factor, const std:
size_t actual;
io.read_at(0, h, 3, actual);
if (memcmp(h, "FSD", 3) == 0) {
- return 100;
+ return FIFID_SIGN;
}
LOG_FORMATS("fsd: no match\n");
return 0;
diff --git a/src/lib/formats/g64_dsk.cpp b/src/lib/formats/g64_dsk.cpp
index 2ea460653cf..690706b3939 100644
--- a/src/lib/formats/g64_dsk.cpp
+++ b/src/lib/formats/g64_dsk.cpp
@@ -38,7 +38,7 @@ int g64_format::identify(util::random_read &io, uint32_t form_factor, const std:
size_t actual;
io.read_at(0, h, 8, actual);
if (!memcmp(h, G64_FORMAT_HEADER, 8))
- return 100;
+ return FIFID_SIGN;
return 0;
}
diff --git a/src/lib/formats/hpi_dsk.cpp b/src/lib/formats/hpi_dsk.cpp
index 022a45a1f4f..bb881ab6f38 100644
--- a/src/lib/formats/hpi_dsk.cpp
+++ b/src/lib/formats/hpi_dsk.cpp
@@ -95,7 +95,7 @@ int hpi_format::identify(util::random_read &io, uint32_t form_factor, const std:
unsigned dummy_tracks;
if (((form_factor == floppy_image::FF_8) || (form_factor == floppy_image::FF_UNKNOWN)) &&
geometry_from_size(size , dummy_heads , dummy_tracks)) {
- return 50;
+ return FIFID_SIZE;
} else {
return 0;
}
diff --git a/src/lib/formats/hxchfe_dsk.cpp b/src/lib/formats/hxchfe_dsk.cpp
index 9a8047816c7..54a26cebf8c 100644
--- a/src/lib/formats/hxchfe_dsk.cpp
+++ b/src/lib/formats/hxchfe_dsk.cpp
@@ -142,7 +142,7 @@ int hfe_format::identify(util::random_read &io, uint32_t form_factor, const std:
size_t actual;
io.read_at(0, &header, sizeof(header), actual);
if ( memcmp( header, HFE_FORMAT_HEADER, 8 ) ==0) {
- return 100;
+ return FIFID_SIGN;
}
return 0;
}
diff --git a/src/lib/formats/hxcmfm_dsk.cpp b/src/lib/formats/hxcmfm_dsk.cpp
index 780692d079f..6107280546c 100644
--- a/src/lib/formats/hxcmfm_dsk.cpp
+++ b/src/lib/formats/hxcmfm_dsk.cpp
@@ -67,7 +67,7 @@ int mfm_format::identify(util::random_read &io, uint32_t form_factor, const std:
size_t actual;
io.read_at(0, &header, sizeof(header), actual);
if ( memcmp( header, MFM_FORMAT_HEADER, 6 ) ==0) {
- return 100;
+ return FIFID_SIGN;
}
return 0;
}
diff --git a/src/lib/formats/ibmxdf_dsk.cpp b/src/lib/formats/ibmxdf_dsk.cpp
index c889f61f74e..ec2bc8aa9c1 100644
--- a/src/lib/formats/ibmxdf_dsk.cpp
+++ b/src/lib/formats/ibmxdf_dsk.cpp
@@ -60,7 +60,7 @@ int ibmxdf_format::identify(util::random_read &io, uint32_t form_factor, const s
int type = find_size(io, form_factor, variants);
if (type != -1)
- return 75;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/imd_dsk.cpp b/src/lib/formats/imd_dsk.cpp
index 6a970003a97..b0756ba04f4 100644
--- a/src/lib/formats/imd_dsk.cpp
+++ b/src/lib/formats/imd_dsk.cpp
@@ -420,7 +420,7 @@ int imd_format::identify(util::random_read &io, uint32_t form_factor, const std:
size_t actual;
io.read_at(0, h, 4, actual);
if(!memcmp(h, "IMD ", 4))
- return 100;
+ return FIFID_SIGN;
return 0;
}
diff --git a/src/lib/formats/img_dsk.cpp b/src/lib/formats/img_dsk.cpp
index fa43c898bee..7faf3d31c80 100644
--- a/src/lib/formats/img_dsk.cpp
+++ b/src/lib/formats/img_dsk.cpp
@@ -52,7 +52,7 @@ int img_format::identify(util::random_read &io, uint32_t form_factor, const std:
if (((form_factor == floppy_image::FF_8) || (form_factor == floppy_image::FF_UNKNOWN)) &&
size == IMG_IMAGE_SIZE) {
- return 50;
+ return FIFID_SIZE;
} else {
return 0;
}
diff --git a/src/lib/formats/ipf_dsk.cpp b/src/lib/formats/ipf_dsk.cpp
index a9b1a4b1f2f..15017546abf 100644
--- a/src/lib/formats/ipf_dsk.cpp
+++ b/src/lib/formats/ipf_dsk.cpp
@@ -37,7 +37,7 @@ int ipf_format::identify(util::random_read &io, uint32_t form_factor, const std:
io.read_at(0, h, 12, actual);
if(!memcmp(h, refh, 12))
- return 100;
+ return FIFID_SIGN;
return 0;
}
diff --git a/src/lib/formats/jfd_dsk.cpp b/src/lib/formats/jfd_dsk.cpp
index 08d5dda91b7..b9ea2d55fb4 100644
--- a/src/lib/formats/jfd_dsk.cpp
+++ b/src/lib/formats/jfd_dsk.cpp
@@ -192,8 +192,9 @@ const char *jfd_format::extensions() const
int jfd_format::identify(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants) const
{
uint64_t size;
- if (io.length(size))
+ if (io.length(size) || !size)
return 0;
+
std::vector<uint8_t> img(size);
size_t actual;
io.read_at(0, &img[0], size, actual);
@@ -224,7 +225,7 @@ int jfd_format::identify(util::random_read &io, uint32_t form_factor, const std:
}
if (!memcmp(&img[0], JFD_HEADER, sizeof(JFD_HEADER))) {
- return 100;
+ return FIFID_SIGN;
}
return 0;
diff --git a/src/lib/formats/jvc_dsk.cpp b/src/lib/formats/jvc_dsk.cpp
index 4d88e65cdce..f06fda850b2 100644
--- a/src/lib/formats/jvc_dsk.cpp
+++ b/src/lib/formats/jvc_dsk.cpp
@@ -135,7 +135,7 @@ bool jvc_format::parse_header(util::random_read &io, int &header_size, int &trac
// The JVC format has a header whose size is the size of the image modulo 256. Currently, we only
// handle up to five header bytes
uint64_t size;
- if (io.length(size))
+ if (io.length(size) || !size)
return false;
header_size = size % 256;
uint8_t header[5];
@@ -178,7 +178,7 @@ bool jvc_format::parse_header(util::random_read &io, int &header_size, int &trac
int jvc_format::identify(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants) const
{
int header_size, tracks, heads, sectors, sector_size, sector_base_id;
- return parse_header(io, header_size, tracks, heads, sectors, sector_size, sector_base_id) ? 50 : 0;
+ return parse_header(io, header_size, tracks, heads, sectors, sector_size, sector_base_id) ? FIFID_STRUCT|FIFID_SIZE : 0;
}
bool jvc_format::load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) const
diff --git a/src/lib/formats/m20_dsk.cpp b/src/lib/formats/m20_dsk.cpp
index e6cddd7acab..4daa436c288 100644
--- a/src/lib/formats/m20_dsk.cpp
+++ b/src/lib/formats/m20_dsk.cpp
@@ -50,7 +50,7 @@ int m20_format::identify(util::random_read &io, uint32_t form_factor, const std:
return 0;
if (size == 286720)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/mdos_dsk.cpp b/src/lib/formats/mdos_dsk.cpp
index 2b6b9644ed1..8f54b72aaea 100644
--- a/src/lib/formats/mdos_dsk.cpp
+++ b/src/lib/formats/mdos_dsk.cpp
@@ -79,7 +79,7 @@ int mdos_format::identify(util::random_read &io, uint32_t form_factor, const std
int type = find_size(io, form_factor, variants);
if (type != -1)
- return 75;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/mfi_dsk.cpp b/src/lib/formats/mfi_dsk.cpp
index b3d75a2a60e..3d79ff3636c 100644
--- a/src/lib/formats/mfi_dsk.cpp
+++ b/src/lib/formats/mfi_dsk.cpp
@@ -107,7 +107,7 @@ int mfi_format::identify(util::random_read &io, uint32_t form_factor, const std:
(h.cyl_count >> RESOLUTION_SHIFT) < 3 &&
h.head_count <= 2 &&
(!form_factor || !h.form_factor || h.form_factor == form_factor))
- return 100;
+ return FIFID_SIGN|FIFID_STRUCT;
return 0;
}
diff --git a/src/lib/formats/nfd_dsk.cpp b/src/lib/formats/nfd_dsk.cpp
index 58851ab5fe8..3236dc61f02 100644
--- a/src/lib/formats/nfd_dsk.cpp
+++ b/src/lib/formats/nfd_dsk.cpp
@@ -112,7 +112,7 @@ int nfd_format::identify(util::random_read &io, uint32_t form_factor, const std:
io.read_at(0, h, 16, actual);
if (strncmp((const char *)h, "T98FDDIMAGE.R0", 14) == 0 || strncmp((const char *)h, "T98FDDIMAGE.R1", 14) == 0)
- return 100;
+ return FIFID_SIGN;
return 0;
}
diff --git a/src/lib/formats/opd_dsk.cpp b/src/lib/formats/opd_dsk.cpp
index 987e3eeba0a..83889025ffb 100644
--- a/src/lib/formats/opd_dsk.cpp
+++ b/src/lib/formats/opd_dsk.cpp
@@ -35,7 +35,7 @@ int opd_format::identify(util::random_read &io, uint32_t form_factor, const std:
int const type = find_size(io, form_factor, variants);
if (type != -1)
- return 90;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/oric_dsk.cpp b/src/lib/formats/oric_dsk.cpp
index 0457a6ca7b5..f845075e67f 100644
--- a/src/lib/formats/oric_dsk.cpp
+++ b/src/lib/formats/oric_dsk.cpp
@@ -54,7 +54,7 @@ int oric_dsk_format::identify(util::random_read &io, uint32_t form_factor, const
if(sides < 0 || sides > 2 || geom != 1 || size != 256+6400*sides*tracks)
return 0;
- return 100;
+ return FIFID_SIGN|FIFID_SIZE|FIFID_STRUCT;
}
bool oric_dsk_format::load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) const
@@ -138,7 +138,7 @@ int oric_jasmin_format::identify(util::random_read &io, uint32_t form_factor, co
bool const can_ds = variants.empty() || has_variant(variants, floppy_image::DSDD);
if(size == 41*17*256 || (can_ds && size == 41*17*256*2))
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/os9_dsk.cpp b/src/lib/formats/os9_dsk.cpp
index 4c64aa06a21..67ae74e5884 100644
--- a/src/lib/formats/os9_dsk.cpp
+++ b/src/lib/formats/os9_dsk.cpp
@@ -75,7 +75,7 @@ int os9_format::identify(util::random_read &io, uint32_t form_factor, const std:
int const type = find_size(io, form_factor, variants);
if (type != -1)
- return 75;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/pasti_dsk.cpp b/src/lib/formats/pasti_dsk.cpp
index 61d95792687..c190f69f170 100644
--- a/src/lib/formats/pasti_dsk.cpp
+++ b/src/lib/formats/pasti_dsk.cpp
@@ -49,7 +49,7 @@ int pasti_format::identify(util::random_read &io, uint32_t form_factor, const st
if(!memcmp(h, "RSY\0\3\0", 6) &&
(1 || (h[10] >= 80 && h[10] <= 82) || (h[10] >= 160 && h[10] <= 164)))
- return 100;
+ return FIFID_SIGN;
return 0;
}
diff --git a/src/lib/formats/pc98fdi_dsk.cpp b/src/lib/formats/pc98fdi_dsk.cpp
index 23890e42190..1edba6bf989 100644
--- a/src/lib/formats/pc98fdi_dsk.cpp
+++ b/src/lib/formats/pc98fdi_dsk.cpp
@@ -51,7 +51,7 @@ int pc98fdi_format::identify(util::random_read &io, uint32_t form_factor, const
uint32_t const sides = little_endianize_int32(*(uint32_t *) (h + 0x18));
uint32_t const ntrk = little_endianize_int32(*(uint32_t *) (h + 0x1c));
if(size == hsize + psize && psize == ssize*scnt*sides*ntrk)
- return 100;
+ return FIFID_STRUCT;
return 0;
}
diff --git a/src/lib/formats/poly_dsk.cpp b/src/lib/formats/poly_dsk.cpp
index 072cf0a1902..72c6ca16bc0 100644
--- a/src/lib/formats/poly_dsk.cpp
+++ b/src/lib/formats/poly_dsk.cpp
@@ -54,7 +54,7 @@ int poly_cpm_format::identify(util::random_read &io, uint32_t form_factor, const
io.read_at(0, boot, 16, actual);
if (memcmp(boot, "\x86\xc3\xb7\x00\x00\x8e\x10\xc0\xbf\x00\x01\xbf\xe0\x60\x00\x00", 16) == 0)
{
- return 100;
+ return FIFID_SIZE|FIFID_SIGN;
}
}
diff --git a/src/lib/formats/rx50_dsk.cpp b/src/lib/formats/rx50_dsk.cpp
index e202e0cb448..373506198c7 100644
--- a/src/lib/formats/rx50_dsk.cpp
+++ b/src/lib/formats/rx50_dsk.cpp
@@ -135,7 +135,7 @@ int rx50img_format::identify(util::random_read &io, uint32_t form_factor, const
find_size(io, track_count, head_count, sector_count);
if(track_count)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/sdf_dsk.cpp b/src/lib/formats/sdf_dsk.cpp
index 52ac1c1229d..c1fb036dc87 100644
--- a/src/lib/formats/sdf_dsk.cpp
+++ b/src/lib/formats/sdf_dsk.cpp
@@ -69,7 +69,7 @@ int sdf_format::identify(util::random_read &io, uint32_t form_factor, const std:
if (size == HEADER_SIZE + heads * tracks * TOTAL_TRACK_SIZE)
{
- return 100;
+ return FIFID_SIGN|FIFID_SIZE|FIFID_STRUCT;
}
return 0;
diff --git a/src/lib/formats/st_dsk.cpp b/src/lib/formats/st_dsk.cpp
index 0c43baada82..27660735c22 100644
--- a/src/lib/formats/st_dsk.cpp
+++ b/src/lib/formats/st_dsk.cpp
@@ -58,7 +58,7 @@ int st_format::identify(util::random_read &io, uint32_t form_factor, const std::
find_size(io, track_count, head_count, sector_count);
if(track_count)
- return 50;
+ return FIFID_SIZE;
return 0;
}
@@ -224,7 +224,7 @@ int msa_format::identify(util::random_read &io, uint32_t form_factor, const std:
(head == 0 || head == 1) &&
strack <= etrack &&
etrack < 82)
- return 100;
+ return FIFID_SIGN | FIFID_STRUCT;
return 0;
}
diff --git a/src/lib/formats/svi_dsk.cpp b/src/lib/formats/svi_dsk.cpp
index 5caa80f25b8..2e4e8bd4a9f 100644
--- a/src/lib/formats/svi_dsk.cpp
+++ b/src/lib/formats/svi_dsk.cpp
@@ -39,7 +39,7 @@ int svi_format::identify(util::random_read &io, uint32_t form_factor, const std:
return 0;
if (size == 172032 || size == 346112)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/td0_dsk.cpp b/src/lib/formats/td0_dsk.cpp
index 360bd0d06e5..586ab2d763b 100644
--- a/src/lib/formats/td0_dsk.cpp
+++ b/src/lib/formats/td0_dsk.cpp
@@ -816,7 +816,7 @@ int td0_format::identify(util::random_read &io, uint32_t form_factor, const std:
io.read_at(0, h, 7, actual);
if(((h[0] == 'T') && (h[1] == 'D')) || ((h[0] == 't') && (h[1] == 'd')))
{
- return 100;
+ return FIFID_SIGN;
}
return 0;
}
diff --git a/src/lib/formats/ti99_dsk.cpp b/src/lib/formats/ti99_dsk.cpp
index a2b4a0e651d..232dfa5bb62 100644
--- a/src/lib/formats/ti99_dsk.cpp
+++ b/src/lib/formats/ti99_dsk.cpp
@@ -943,7 +943,7 @@ int ti99_sdf_format::identify(util::random_read &io, uint32_t form_factor, const
case 368640: // DSDD
case 737280: // DSDD80
case 1474560: // DSQD
- vote = 50;
+ vote = FIFID_SIZE;
break;
default:
vote = 0;
@@ -961,7 +961,7 @@ int ti99_sdf_format::identify(util::random_read &io, uint32_t form_factor, const
if ((vib.id[0]=='D')&&(vib.id[1]=='S')&&(vib.id[2]=='K'))
{
LOGMASKED(LOG_INFO, "[ti99_dsk] Found formatted SDF disk medium\n");
- vote = 100;
+ vote |= FIFID_SIGN;
}
else
{
@@ -1239,7 +1239,7 @@ int ti99_tdf_format::identify(util::random_read &io, uint32_t form_factor, const
// Do we have a plausible image size? From the size alone we only give a 50 percent vote.
if (sector_count != 0)
- vote = 50;
+ vote = FIFID_SIZE;
if (vote > 0)
{
@@ -1283,7 +1283,7 @@ int ti99_tdf_format::identify(util::random_read &io, uint32_t form_factor, const
else
{
LOGMASKED(LOG_INFO, "[ti99_dsk] Image format complies with TDF\n");
- vote = 100;
+ vote |= FIFID_STRUCT;
}
}
else LOGMASKED(LOG_INFO, "[ti99_dsk] Disk image is not a TDF image\n");
diff --git a/src/lib/formats/trs80_dsk.cpp b/src/lib/formats/trs80_dsk.cpp
index 6cd4155f284..ac342fc4aeb 100644
--- a/src/lib/formats/trs80_dsk.cpp
+++ b/src/lib/formats/trs80_dsk.cpp
@@ -226,7 +226,7 @@ int jv3_format::identify(util::random_read &io, uint32_t form_factor, const std:
return 0;
}
- return 80;
+ return FIFID_STRUCT;
}
bool jv3_format::load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) const
diff --git a/src/lib/formats/uniflex_dsk.cpp b/src/lib/formats/uniflex_dsk.cpp
index 4eb63461875..fe682417b09 100644
--- a/src/lib/formats/uniflex_dsk.cpp
+++ b/src/lib/formats/uniflex_dsk.cpp
@@ -39,7 +39,7 @@ int uniflex_format::identify(util::random_read &io, uint32_t form_factor, const
int const type = find_size(io, form_factor, variants);
if (type != -1)
- return 75;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/upd765_dsk.cpp b/src/lib/formats/upd765_dsk.cpp
index 1a90bcdacec..e61cb5d3f8b 100644
--- a/src/lib/formats/upd765_dsk.cpp
+++ b/src/lib/formats/upd765_dsk.cpp
@@ -45,7 +45,7 @@ int upd765_format::identify(util::random_read &io, uint32_t form_factor, const s
int type = find_size(io, form_factor, variants);
if(type != -1)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/vdk_dsk.cpp b/src/lib/formats/vdk_dsk.cpp
index 49a0c136616..92c5c4d3e91 100644
--- a/src/lib/formats/vdk_dsk.cpp
+++ b/src/lib/formats/vdk_dsk.cpp
@@ -41,7 +41,7 @@ int vdk_format::identify(util::random_read &io, uint32_t form_factor, const std:
io.read_at(0, id, 2, actual);
if (id[0] == 'd' && id[1] == 'k')
- return 50;
+ return FIFID_SIGN;
else
return 0;
}
diff --git a/src/lib/formats/victor9k_dsk.cpp b/src/lib/formats/victor9k_dsk.cpp
index 62e1cc38efb..ba5cb2fa25b 100644
--- a/src/lib/formats/victor9k_dsk.cpp
+++ b/src/lib/formats/victor9k_dsk.cpp
@@ -146,7 +146,7 @@ int victor9k_format::identify(util::random_read &io, uint32_t form_factor, const
int type = find_size(io, form_factor);
if (type != -1)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/lib/formats/vt_dsk.cpp b/src/lib/formats/vt_dsk.cpp
index 957efab67ba..5923c8f366b 100644
--- a/src/lib/formats/vt_dsk.cpp
+++ b/src/lib/formats/vt_dsk.cpp
@@ -227,7 +227,7 @@ int vtech_bin_format::identify(util::random_read &io, uint32_t form_factor, cons
return 0;
if(size == 40*16*256)
- return 50;
+ return FIFID_SIZE;
return 0;
}
@@ -256,7 +256,7 @@ int vtech_dsk_format::identify(util::random_read &io, uint32_t form_factor, cons
count_sd++;
}
- return count_sh >= 30*16 && count_sd >= 30*16 ? 100 : 0;
+ return count_sh >= 30*16 && count_sd >= 30*16 ? FIFID_STRUCT : 0;
}
bool vtech_bin_format::load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) const
diff --git a/src/lib/formats/wd177x_dsk.cpp b/src/lib/formats/wd177x_dsk.cpp
index e62053c50e3..d48db91f4d4 100644
--- a/src/lib/formats/wd177x_dsk.cpp
+++ b/src/lib/formats/wd177x_dsk.cpp
@@ -67,7 +67,7 @@ int wd177x_format::identify(util::random_read &io, uint32_t form_factor, const s
int const type = find_size(io, form_factor, variants);
if(type != -1)
- return 50;
+ return FIFID_SIZE;
return 0;
}
diff --git a/src/tools/floptool.cpp b/src/tools/floptool.cpp
index 1e7efc05ba5..7abea32a90b 100644
--- a/src/tools/floptool.cpp
+++ b/src/tools/floptool.cpp
@@ -139,7 +139,13 @@ static int identify(int argc, char *argv[])
bool first = true;
for(const auto &e : scores) {
- printf("%-*s %c %3d - %-*s %s\n", sz, first ? argv[i] : "", first ? ':' : ' ', e.first, sz2, e.second->m_format->name(), e.second->m_format->description());
+ printf("%-*s %c %c%c%c%c%c - %-*s %s\n", sz, first ? argv[i] : "", first ? ':' : ' ',
+ e.first & 0x10 ? '+' : '.',
+ e.first & 0x08 ? '+' : '.',
+ e.first & 0x04 ? '+' : '.',
+ e.first & 0x02 ? '+' : '.',
+ e.first & 0x01 ? '+' : '.',
+ sz2, e.second->m_format->name(), e.second->m_format->description());
first = false;
}
}
diff --git a/src/tools/image_handler.cpp b/src/tools/image_handler.cpp
index 28a6dfe703b..02328059490 100644
--- a/src/tools/image_handler.cpp
+++ b/src/tools/image_handler.cpp
@@ -246,6 +246,8 @@ std::vector<std::pair<u8, const floppy_format_info *>> image_handler::identify(c
for(const auto &e : formats.floppy_format_info_by_key) {
u8 score = e.second->m_format->identify(*io, floppy_image::FF_UNKNOWN, variants);
+ if(score && e.second->m_format->extension_matches(m_on_disk_path.c_str()))
+ score |= floppy_image_format_t::FIFID_EXT;
if(score)
res.emplace_back(std::make_pair(score, e.second));
}