From de72f97b90b885e7fa5b0aa237098c945e02f1b5 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 13 Apr 2020 19:14:36 +1000 Subject: (nw) formats: reduce dependencies on libemu The only link dependency left is emu_fatalerror. The format handlers really shouldn't be throwing fatal errors at all - they should just fail to load an image they can't handle. Maybe the interface should be enhanced to allow better propagation of errors up from the format handlers so they can be displayed in a UI rather than just logged. The only other two dependencies are on logmacro.h (pure macros) and the PAIR type from emucore.h (possibly worth moving to util). --- src/lib/formats/apridisk.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/lib/formats/apridisk.cpp') diff --git a/src/lib/formats/apridisk.cpp b/src/lib/formats/apridisk.cpp index d023448f3fb..4c2cad2123c 100644 --- a/src/lib/formats/apridisk.cpp +++ b/src/lib/formats/apridisk.cpp @@ -8,10 +8,13 @@ ***************************************************************************/ -#include "emu.h" -#include "imageutl.h" #include "apridisk.h" +#include "imageutl.h" + +#include "emucore.h" // emu_fatalerror + + apridisk_format::apridisk_format() { } @@ -97,7 +100,7 @@ bool apridisk_format::load(io_generic *io, uint32_t form_factor, floppy_image *i uint16_t length = pick_integer_le(comp, 0, 2); if (length != SECTOR_SIZE) - fatalerror("apridisk_format: Invalid compression length %04x\n", length); + throw emu_fatalerror("apridisk_format: Invalid compression length %04x\n", length); memset(data_ptr, comp[2], SECTOR_SIZE); } @@ -108,7 +111,7 @@ bool apridisk_format::load(io_generic *io, uint32_t form_factor, floppy_image *i break; default: - fatalerror("apridisk_format: Invalid compression %04x\n", compression); + throw emu_fatalerror("apridisk_format: Invalid compression %04x\n", compression); } sectors[track][head][sector - 1].data = data_ptr; -- cgit v1.2.3-70-g09d2