summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Justin Kerk <dopefishjustin@gmail.com>2016-12-29 14:44:50 -0800
committer angelosa <salese_corp_ltd@email.it>2016-12-31 22:18:54 +0100
commita8ef9c252199227ff2fc4d6f53318f404a681eae (patch)
tree8a4e446e955291dd29b4662be673e422899e9c0b
parent54ae9d208b2aae33d6c3544a558c898b871e6817 (diff)
pc_dsk: Support 360K images with 512-byte header, found in some softlist entries. [Justin Kerk]
-rw-r--r--hash/ibm5150.xml6
-rw-r--r--src/lib/formats/pc_dsk.cpp12
-rw-r--r--src/lib/formats/pc_dsk.h2
-rw-r--r--src/lib/formats/upd765_dsk.cpp6
-rw-r--r--src/lib/formats/upd765_dsk.h2
5 files changed, 21 insertions, 7 deletions
diff --git a/hash/ibm5150.xml b/hash/ibm5150.xml
index b63298b93b8..940a86b2212 100644
--- a/hash/ibm5150.xml
+++ b/hash/ibm5150.xml
@@ -3202,8 +3202,7 @@ Known PC Booter Games Not Dumped, Or Dumped and Lost when Demonlord's Site went
</part>
</software>
- <!-- Fatal error: Device 5.25" double density floppy drive load failed: Unable to identify the image format -->
- <software name="msdos33" supported="no">
+ <software name="msdos33">
<description>MS-DOS (Version 3.30)</description>
<year>1987</year>
<publisher>Microsoft</publisher>
@@ -3296,8 +3295,7 @@ Known PC Booter Games Not Dumped, Or Dumped and Lost when Demonlord's Site went
</part>
</software>
- <!-- Fatal error: Device 5.25" double density floppy drive load failed: Unable to identify the image format -->
- <software name="msdos401m" cloneof="msdos401" supported="no">
+ <software name="msdos401m" cloneof="msdos401">
<description>MS-DOS (Version 4.01, 5.25")</description>
<year>1988</year>
<publisher>Microsoft</publisher>
diff --git a/src/lib/formats/pc_dsk.cpp b/src/lib/formats/pc_dsk.cpp
index 73ef727cdaf..32b6f079bbb 100644
--- a/src/lib/formats/pc_dsk.cpp
+++ b/src/lib/formats/pc_dsk.cpp
@@ -159,6 +159,18 @@ const char *pc_format::extensions() const
return "dsk,ima,img,ufi,360";
}
+int pc_format::identify(io_generic *io, uint32_t form_factor)
+{
+ uint64_t size = io_generic_size(io);
+
+ /* some 360K images have a 512-byte header */
+ if (size == 368640 + 0x200) {
+ file_header_skip_bytes = 0x200;
+ }
+
+ return upd765_format::identify(io, form_factor);
+}
+
const pc_format::format pc_format::formats[] = {
{ /* 160K 5 1/4 inch double density single sided */
floppy_image::FF_525, floppy_image::SSDD, floppy_image::MFM,
diff --git a/src/lib/formats/pc_dsk.h b/src/lib/formats/pc_dsk.h
index 381ad49e99a..02b3aa2468b 100644
--- a/src/lib/formats/pc_dsk.h
+++ b/src/lib/formats/pc_dsk.h
@@ -24,6 +24,8 @@ class pc_format : public upd765_format
public:
pc_format();
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+
virtual const char *name() const override;
virtual const char *description() const override;
virtual const char *extensions() const override;
diff --git a/src/lib/formats/upd765_dsk.cpp b/src/lib/formats/upd765_dsk.cpp
index a7e5febc3d7..72e11257b89 100644
--- a/src/lib/formats/upd765_dsk.cpp
+++ b/src/lib/formats/upd765_dsk.cpp
@@ -11,7 +11,7 @@
#include "emu.h" // emu_fatalerror
#include "formats/upd765_dsk.h"
-upd765_format::upd765_format(const format *_formats)
+upd765_format::upd765_format(const format *_formats) : file_header_skip_bytes(0)
{
formats = _formats;
}
@@ -24,7 +24,7 @@ int upd765_format::find_size(io_generic *io, uint32_t form_factor) const
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if(size == (uint64_t) compute_track_size(f) * f.track_count * f.head_count)
+ if(size == file_header_skip_bytes + (uint64_t) compute_track_size(f) * f.track_count * f.head_count)
return i;
}
return -1;
@@ -220,7 +220,7 @@ bool upd765_format::load(io_generic *io, uint32_t form_factor, floppy_image *ima
for(int track=0; track < f.track_count; track++)
for(int head=0; head < f.head_count; head++) {
build_sector_description(f, sectdata, sectors, track, head);
- io_generic_read(io, sectdata, (track*f.head_count + head)*track_size, track_size);
+ io_generic_read(io, sectdata, file_header_skip_bytes + (track*f.head_count + head)*track_size, track_size);
generate_track(desc, track, head, sectors, f.sector_count, total_size, image);
}
diff --git a/src/lib/formats/upd765_dsk.h b/src/lib/formats/upd765_dsk.h
index 5bd675de9e8..980d21a396e 100644
--- a/src/lib/formats/upd765_dsk.h
+++ b/src/lib/formats/upd765_dsk.h
@@ -44,6 +44,8 @@ public:
virtual bool supports_save() const override;
protected:
+ uint64_t file_header_skip_bytes;
+
floppy_image_format_t::desc_e* get_desc_fm(const format &f, int &current_size, int &end_gap_index);
floppy_image_format_t::desc_e* get_desc_mfm(const format &f, int &current_size, int &end_gap_index);
int find_size(io_generic *io, uint32_t form_factor) const;