diff options
Diffstat (limited to 'src/lib/formats/pasti_dsk.cpp')
-rw-r--r-- | src/lib/formats/pasti_dsk.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/formats/pasti_dsk.cpp b/src/lib/formats/pasti_dsk.cpp index 0ab6dc2f064..1a418096cd3 100644 --- a/src/lib/formats/pasti_dsk.cpp +++ b/src/lib/formats/pasti_dsk.cpp @@ -2,6 +2,8 @@ // copyright-holders:Olivier Galibert #include "pasti_dsk.h" +#include "ioprocs.h" + // Pasti format supported using the documentation at // http://www.sarnau.info/atari:pasti_file_format @@ -36,10 +38,11 @@ bool pasti_format::supports_save() const return false; } -int pasti_format::identify(io_generic *io, uint32_t form_factor, const std::vector<uint32_t> &variants) +int pasti_format::identify(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants) { uint8_t h[16]; - io_generic_read(io, h, 0, 16); + size_t actual; + io.read_at(0, h, 16, actual); if(!memcmp(h, "RSY\0\3\0", 6) && (1 || (h[10] >= 80 && h[10] <= 82) || (h[10] >= 160 && h[10] <= 164))) @@ -58,10 +61,11 @@ static void hexdump(const uint8_t *d, int s) } } -bool pasti_format::load(io_generic *io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) +bool pasti_format::load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) { + size_t actual; uint8_t fh[16]; - io_generic_read(io, fh, 0, 16); + io.read_at(0, fh, 16, actual); std::vector<uint8_t> raw_track; @@ -76,7 +80,7 @@ bool pasti_format::load(io_generic *io, uint32_t form_factor, const std::vector< for(int track=0; track < tracks; track++) { for(int head=0; head < heads; head++) { uint8_t th[16]; - io_generic_read(io, th, pos, 16); + io.read_at(pos, th, 16, actual); int entry_len = th[0] | (th[1] << 8) | (th[2] << 16) | (th[3] << 24); int fuzz_len = th[4] | (th[5] << 8) | (th[6] << 16) | (th[7] << 24); int sect = th[8] | (th[9] << 8); @@ -87,7 +91,7 @@ bool pasti_format::load(io_generic *io, uint32_t form_factor, const std::vector< raw_track.resize(entry_len-16); - io_generic_read(io, &raw_track[0], pos+16, entry_len-16); + io.read_at(pos+16, &raw_track[0], entry_len-16, actual); uint8_t *fuzz = fuzz_len ? &raw_track[16*sect] : nullptr; uint8_t *bdata = fuzz ? fuzz+fuzz_len : &raw_track[16*sect]; |