summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-04-13 19:14:36 +1000
committer Vas Crabb <vas@vastheman.com>2020-04-13 19:14:36 +1000
commitde72f97b90b885e7fa5b0aa237098c945e02f1b5 (patch)
treeccdebacc984f5298783ca8aa7b4ecfa38af23983
parent404e7321a63548d2e77e50ec0dc7572b3298d5f4 (diff)
(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).
-rw-r--r--src/lib/formats/ap_dsk35.cpp6
-rw-r--r--src/lib/formats/apridisk.cpp11
-rw-r--r--src/lib/formats/camplynx_cas.cpp3
-rw-r--r--src/lib/formats/cbm_crt.cpp3
-rw-r--r--src/lib/formats/cbm_crt.h2
-rw-r--r--src/lib/formats/ccvf_dsk.cpp6
-rw-r--r--src/lib/formats/coco_cas.cpp4
-rw-r--r--src/lib/formats/d64_dsk.cpp4
-rw-r--r--src/lib/formats/dfi_dsk.cpp9
-rw-r--r--src/lib/formats/flopimg.cpp15
-rw-r--r--src/lib/formats/fsd_dsk.cpp1
-rw-r--r--src/lib/formats/g64_dsk.cpp4
-rw-r--r--src/lib/formats/hpi_dsk.cpp14
-rw-r--r--src/lib/formats/ibmxdf_dsk.cpp6
-rw-r--r--src/lib/formats/imd_dsk.cpp10
-rw-r--r--src/lib/formats/img_dsk.cpp20
-rw-r--r--src/lib/formats/jvc_dsk.cpp5
-rw-r--r--src/lib/formats/mfm_hd.cpp1
-rw-r--r--src/lib/formats/oric_dsk.cpp2
-rw-r--r--src/lib/formats/os9_dsk.cpp19
-rw-r--r--src/lib/formats/pasti_dsk.cpp1
-rw-r--r--src/lib/formats/ti99_dsk.cpp12
-rw-r--r--src/lib/formats/tzx_cas.cpp9
-rw-r--r--src/lib/formats/upd765_dsk.cpp4
-rw-r--r--src/lib/formats/vdk_dsk.cpp1
-rw-r--r--src/lib/formats/victor9k_dsk.cpp6
-rw-r--r--src/lib/formats/wd177x_dsk.cpp4
27 files changed, 103 insertions, 79 deletions
diff --git a/src/lib/formats/ap_dsk35.cpp b/src/lib/formats/ap_dsk35.cpp
index 677cfcc9463..243eacaa7ad 100644
--- a/src/lib/formats/ap_dsk35.cpp
+++ b/src/lib/formats/ap_dsk35.cpp
@@ -98,11 +98,11 @@
*********************************************************************/
-#include <cstdio>
+#include "ap_dsk35.h"
+
#include <cassert>
+#include <cstdio>
-#include "emu.h" // logerror
-#include "ap_dsk35.h"
struct apple35_tag
{
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;
diff --git a/src/lib/formats/camplynx_cas.cpp b/src/lib/formats/camplynx_cas.cpp
index 9cb4275bd93..e802be4426f 100644
--- a/src/lib/formats/camplynx_cas.cpp
+++ b/src/lib/formats/camplynx_cas.cpp
@@ -23,10 +23,9 @@ Each byte is 8 bits (MSB first) with no start or stop bits.
********************************************************************/
-#include "emu.h" // for popmessage and <string>
-
#include "camplynx_cas.h"
+
#define WAVEENTRY_LOW -32768
#define WAVEENTRY_HIGH 32767
diff --git a/src/lib/formats/cbm_crt.cpp b/src/lib/formats/cbm_crt.cpp
index ae67b8c7f1b..9ca4312e43e 100644
--- a/src/lib/formats/cbm_crt.cpp
+++ b/src/lib/formats/cbm_crt.cpp
@@ -39,11 +39,8 @@
*********************************************************************/
-#include "emu.h" // fatalerror
#include "cbm_crt.h"
-#include "corefile.h"
-
//**************************************************************************
// MACROS/CONSTANTS
diff --git a/src/lib/formats/cbm_crt.h b/src/lib/formats/cbm_crt.h
index c3fea3db799..d7b257f3e9e 100644
--- a/src/lib/formats/cbm_crt.h
+++ b/src/lib/formats/cbm_crt.h
@@ -14,6 +14,8 @@
#include "formats/imageutl.h"
+#include "corefile.h"
+
//**************************************************************************
// MACROS/CONSTANTS
diff --git a/src/lib/formats/ccvf_dsk.cpp b/src/lib/formats/ccvf_dsk.cpp
index febe78d45d2..27aaf355871 100644
--- a/src/lib/formats/ccvf_dsk.cpp
+++ b/src/lib/formats/ccvf_dsk.cpp
@@ -8,9 +8,11 @@
*********************************************************************/
-#include "emu.h" // BIT
#include "formats/ccvf_dsk.h"
+#include "coretmpl.h" // BIT
+
+
ccvf_format::ccvf_format()
{
formats = file_formats;
@@ -124,7 +126,7 @@ bool ccvf_format::load(io_generic *io, uint32_t form_factor, floppy_image *image
for (int i=0; i<1920 && pos<size; i++, pos++) {
for (int bit=0; bit<8; bit++) {
- bit_w(buffer, BIT(bytes[pos], bit), f.cell_size);
+ bit_w(buffer, util::BIT(bytes[pos], bit), f.cell_size);
}
}
diff --git a/src/lib/formats/coco_cas.cpp b/src/lib/formats/coco_cas.cpp
index 6579f47a60f..f3df09266b0 100644
--- a/src/lib/formats/coco_cas.cpp
+++ b/src/lib/formats/coco_cas.cpp
@@ -33,9 +33,11 @@
**************************************************************************/
-#include "emu.h" // PAIR
#include "coco_cas.h"
+#include "emucore.h" // PAIR
+
+
#define COCO_WAVESAMPLES_HEADER (1.0)
#define COCO_WAVESAMPLES_TRAILER (1.0)
#define COCO_LONGSILENCE (5.0)
diff --git a/src/lib/formats/d64_dsk.cpp b/src/lib/formats/d64_dsk.cpp
index f26a3e676fb..1a96c11cd40 100644
--- a/src/lib/formats/d64_dsk.cpp
+++ b/src/lib/formats/d64_dsk.cpp
@@ -10,9 +10,11 @@
*********************************************************************/
-#include "emu.h" // emu_fatalerror, fatalerror
#include "formats/d64_dsk.h"
+#include "emucore.h" // emu_fatalerror
+
+
d64_format::d64_format()
{
formats = file_formats;
diff --git a/src/lib/formats/dfi_dsk.cpp b/src/lib/formats/dfi_dsk.cpp
index 6c9f32cbb31..f36969b58f0 100644
--- a/src/lib/formats/dfi_dsk.cpp
+++ b/src/lib/formats/dfi_dsk.cpp
@@ -11,9 +11,12 @@
* Correctly note exact index timing.
*/
-#include "emu.h" // fatalerror
#include "dfi_dsk.h"
+
+#include "emucore.h" // emu_fatalerror
+
#include <zlib.h>
+
#define NUMBER_OF_MULTIREADS 3
// thresholds for brickwall windowing
//define DFI_MIN_CLOCKS 65
@@ -59,8 +62,8 @@ int dfi_format::identify(io_generic *io, uint32_t form_factor)
{
char sign[4];
io_generic_read(io, sign, 0, 4);
- if (memcmp(sign, "DFER", 4)==0)
- fatalerror("Old type Discferret image detected; the mess Discferret decoder will not handle this properly, bailing out!\n");
+ if (memcmp(sign, "DFER", 4) == 0)
+ throw emu_fatalerror("Old type Discferret image detected; the mess Discferret decoder will not handle this properly, bailing out!\n");
return memcmp(sign, "DFE2", 4) ? 0 : 100;
}
diff --git a/src/lib/formats/flopimg.cpp b/src/lib/formats/flopimg.cpp
index 79d97b1bf71..f6c35bd95d0 100644
--- a/src/lib/formats/flopimg.cpp
+++ b/src/lib/formats/flopimg.cpp
@@ -8,6 +8,14 @@
*********************************************************************/
+#include "flopimg.h"
+#include "imageutl.h"
+
+#include "emucore.h" // emu_fatalerror
+#include "osdcore.h"
+#include "ioprocs.h"
+#include "pool.h"
+
#include <cstdlib>
#include <cstring>
#include <cstdio>
@@ -15,13 +23,6 @@
#include <climits>
#include <cassert>
-#include "emu.h" // emu_fatalerror
-#include "osdcore.h"
-#include "ioprocs.h"
-#include "flopimg.h"
-#include "pool.h"
-#include "imageutl.h"
-
#define TRACK_LOADED 0x01
#define TRACK_DIRTY 0x02
diff --git a/src/lib/formats/fsd_dsk.cpp b/src/lib/formats/fsd_dsk.cpp
index 9cd4bff1f61..7880c4415c6 100644
--- a/src/lib/formats/fsd_dsk.cpp
+++ b/src/lib/formats/fsd_dsk.cpp
@@ -8,7 +8,6 @@
***************************************************************************/
-#include "emu.h"
#include "fsd_dsk.h"
diff --git a/src/lib/formats/g64_dsk.cpp b/src/lib/formats/g64_dsk.cpp
index d0fc182835d..fc75b1a6528 100644
--- a/src/lib/formats/g64_dsk.cpp
+++ b/src/lib/formats/g64_dsk.cpp
@@ -10,9 +10,11 @@
*********************************************************************/
-#include "emu.h" // emu_fatalerror
#include "formats/g64_dsk.h"
+#include "emucore.h" // emu_fatalerror
+
+
#define G64_FORMAT_HEADER "GCR-1541"
g64_format::g64_format()
diff --git a/src/lib/formats/hpi_dsk.cpp b/src/lib/formats/hpi_dsk.cpp
index 50d2653280d..7a4f8d1903a 100644
--- a/src/lib/formats/hpi_dsk.cpp
+++ b/src/lib/formats/hpi_dsk.cpp
@@ -45,12 +45,14 @@
*********************************************************************/
-#include "emu.h"
#include "hpi_dsk.h"
+#include "coretmpl.h" // BIT
+
+
// Debugging
#define VERBOSE 0
-#define LOG(...) do { if (VERBOSE) printf(__VA_ARGS__); } while (false)
+#define LOG(...) do { if (VERBOSE) osd_printf_info(__VA_ARGS__); } while (false)
constexpr unsigned IL_OFFSET = 0x12; // Position of interleave factor in HPI image (2 bytes, big-endian)
constexpr unsigned DEFAULT_IL = 7; // Default interleaving factor
@@ -260,7 +262,7 @@ void hpi_format::write_mmfm_bit(std::vector<uint32_t> &buffer , bool data_bit ,
void hpi_format::write_mmfm_byte(std::vector<uint32_t> &buffer , uint8_t data , uint8_t clock)
{
for (unsigned i = 0; i < 8; i++) {
- write_mmfm_bit(buffer , BIT(data , i) , BIT(clock , i));
+ write_mmfm_bit(buffer , util::BIT(data , i) , util::BIT(clock , i));
}
}
@@ -281,7 +283,7 @@ void hpi_format::write_crc(std::vector<uint32_t> &buffer , uint16_t crc)
{
// Note that CRC is stored with MSB (x^15) first
for (unsigned i = 0; i < 16; i++) {
- write_mmfm_bit(buffer , BIT(crc , 15 - i) , 0);
+ write_mmfm_bit(buffer , util::BIT(crc , 15 - i) , 0);
}
}
@@ -371,7 +373,7 @@ std::vector<uint8_t> hpi_format::get_next_id_n_block(const uint8_t *bitstream ,
uint32_t sr = 0;
// Look for either sync + ID AM or sync + DATA AM
while (pos < bitstream_size && sr != ID_CD_PATTERN && sr != DATA_CD_PATTERN) {
- bool bit = BIT(bitstream[ pos >> 3 ] , 7 - (pos & 7));
+ bool bit = util::BIT(bitstream[ pos >> 3 ] , 7 - (pos & 7));
pos++;
sr = (sr << 1) | bit;
}
@@ -396,7 +398,7 @@ std::vector<uint8_t> hpi_format::get_next_id_n_block(const uint8_t *bitstream ,
uint8_t byte = 0;
unsigned j;
for (j = 0; j < 8 && pos < bitstream_size; j++) {
- bool bit = BIT(bitstream[ pos >> 3 ] , 7 - (pos & 7));
+ bool bit = util::BIT(bitstream[ pos >> 3 ] , 7 - (pos & 7));
pos += 2;
byte >>= 1;
if (bit) {
diff --git a/src/lib/formats/ibmxdf_dsk.cpp b/src/lib/formats/ibmxdf_dsk.cpp
index 59c653b5b4e..b9a55daca85 100644
--- a/src/lib/formats/ibmxdf_dsk.cpp
+++ b/src/lib/formats/ibmxdf_dsk.cpp
@@ -30,10 +30,10 @@
*********************************************************************/
-#include <assert.h>
+#include "ibmxdf_dsk.h"
+
+#include "emucore.h" // emu_fatalerror
-#include "emu.h" // emu_fatalerror
-#include "formats/ibmxdf_dsk.h"
ibmxdf_format::ibmxdf_format() : wd177x_format(formats)
{
diff --git a/src/lib/formats/imd_dsk.cpp b/src/lib/formats/imd_dsk.cpp
index 4ae22724fb9..b31e7dfb11f 100644
--- a/src/lib/formats/imd_dsk.cpp
+++ b/src/lib/formats/imd_dsk.cpp
@@ -8,9 +8,12 @@
*********************************************************************/
-#include <cstring>
+#include "imd_dsk.h"
+
#include <cassert>
-#include "flopimg.h"
+#include <cstring>
+
+
struct imddsk_tag
{
@@ -373,9 +376,6 @@ FLOPPY_CONSTRUCT( imd_dsk_construct )
*********************************************************************/
-#include "emu.h" // emu_fatalerror
-#include "imd_dsk.h"
-
imd_format::imd_format()
{
}
diff --git a/src/lib/formats/img_dsk.cpp b/src/lib/formats/img_dsk.cpp
index 40093bee4aa..5921130003f 100644
--- a/src/lib/formats/img_dsk.cpp
+++ b/src/lib/formats/img_dsk.cpp
@@ -14,9 +14,11 @@
*********************************************************************/
-#include "emu.h"
#include "img_dsk.h"
+#include "coretmpl.h" // BIT
+
+
// Debugging
#define VERBOSE 0
#define LOG(...) do { if (VERBOSE) osd_printf_info(__VA_ARGS__); } while (false)
@@ -159,7 +161,7 @@ void img_format::write_mmfm_bit(std::vector<uint32_t> &buffer , bool data_bit ,
bit_w(buffer , clock_bit , CELL_SIZE);
bit_w(buffer , data_bit , CELL_SIZE);
- if (BIT(m_crc , 15) ^ data_bit) {
+ if (util::BIT(m_crc , 15) ^ data_bit) {
m_crc = (m_crc << 1) ^ CRC_POLY;
} else {
m_crc <<= 1;
@@ -169,7 +171,7 @@ void img_format::write_mmfm_bit(std::vector<uint32_t> &buffer , bool data_bit ,
void img_format::write_mmfm_byte(std::vector<uint32_t> &buffer , uint8_t data , uint8_t clock)
{
for (int i = 7; i >= 0; i--) {
- write_mmfm_bit(buffer , BIT(data , i) , BIT(clock , i));
+ write_mmfm_bit(buffer , util::BIT(data , i) , util::BIT(clock , i));
}
}
@@ -182,7 +184,7 @@ void img_format::write_crc(std::vector<uint32_t> &buffer , uint16_t crc)
{
// Note that CRC is stored with MSB (x^15) first
for (unsigned i = 0; i < 16; i++) {
- write_mmfm_bit(buffer , BIT(crc , 15 - i) , 0);
+ write_mmfm_bit(buffer , util::BIT(crc , 15 - i) , 0);
}
}
@@ -268,10 +270,10 @@ std::vector<uint8_t> img_format::get_next_id_n_block(const uint8_t *bitstream ,
do {
unsigned cnt_trans = 0;
while (pos < bitstream_size && cnt_trans < 34) {
- bool bit = BIT(bitstream[ pos >> 3 ] , ~pos & 7);
+ bool bit = util::BIT(bitstream[ pos >> 3 ] , ~pos & 7);
pos++;
if (cnt_trans < 32) {
- if (!(BIT(cnt_trans , 0) ^ bit)) {
+ if (!(util::BIT(cnt_trans , 0) ^ bit)) {
cnt_trans++;
} else {
cnt_trans = 0;
@@ -298,10 +300,10 @@ std::vector<uint8_t> img_format::get_next_id_n_block(const uint8_t *bitstream ,
// Get AM
data_sr = clock_sr = 0;
for (unsigned i = 0; i < 7; ++i) {
- bool bit = BIT(bitstream[ pos >> 3 ] , ~pos & 7);
+ bool bit = util::BIT(bitstream[ pos >> 3 ] , ~pos & 7);
pos++;
clock_sr = (clock_sr << 1) | bit;
- bit = BIT(bitstream[ pos >> 3 ] , ~pos & 7);
+ bit = util::BIT(bitstream[ pos >> 3 ] , ~pos & 7);
pos++;
data_sr = (data_sr << 1) | bit;
}
@@ -327,7 +329,7 @@ std::vector<uint8_t> img_format::get_next_id_n_block(const uint8_t *bitstream ,
data_sr = 0;
unsigned j;
for (j = 0; j < 8 && pos < bitstream_size; j++) {
- bool bit = BIT(bitstream[ pos >> 3 ] , ~pos & 7);
+ bool bit = util::BIT(bitstream[ pos >> 3 ] , ~pos & 7);
pos += 2;
data_sr = (data_sr << 1) | bit;
}
diff --git a/src/lib/formats/jvc_dsk.cpp b/src/lib/formats/jvc_dsk.cpp
index 961329a040f..2bbbb15bd2d 100644
--- a/src/lib/formats/jvc_dsk.cpp
+++ b/src/lib/formats/jvc_dsk.cpp
@@ -104,10 +104,11 @@
***************************************************************************/
-#include "emu.h"
-#include "imageutl.h"
#include "jvc_dsk.h"
+#include "emucore.h" // emu_fatalerror
+
+
jvc_format::jvc_format()
{
}
diff --git a/src/lib/formats/mfm_hd.cpp b/src/lib/formats/mfm_hd.cpp
index 032be8622cb..98d8079443c 100644
--- a/src/lib/formats/mfm_hd.cpp
+++ b/src/lib/formats/mfm_hd.cpp
@@ -116,7 +116,6 @@
**************************************************************************/
-#include "emu.h"
#include "mfm_hd.h"
#include "imageutl.h"
diff --git a/src/lib/formats/oric_dsk.cpp b/src/lib/formats/oric_dsk.cpp
index 45cbcab0fee..4e77cfab13b 100644
--- a/src/lib/formats/oric_dsk.cpp
+++ b/src/lib/formats/oric_dsk.cpp
@@ -8,9 +8,9 @@
*********************************************************************/
-#include "emu.h" // logerror
#include "formats/oric_dsk.h"
+
oric_dsk_format::oric_dsk_format()
{
}
diff --git a/src/lib/formats/os9_dsk.cpp b/src/lib/formats/os9_dsk.cpp
index 228f3069dde..3dfbec1e822 100644
--- a/src/lib/formats/os9_dsk.cpp
+++ b/src/lib/formats/os9_dsk.cpp
@@ -44,10 +44,11 @@
*********************************************************************/
-#include "emu.h"
-#include "formats/os9_dsk.h"
+#include "os9_dsk.h"
+#include "imageutl.h"
+
+#include "coretmpl.h" // BIT
-#include "formats/imageutl.h"
os9_format::os9_format() : wd177x_format(formats)
{
@@ -85,7 +86,7 @@ int os9_format::find_size(io_generic *io, uint32_t form_factor)
io_generic_read(io, os9_header, 0, sizeof(os9_header));
int os9_total_sectors = pick_integer_be(os9_header, 0x00, 3);
- int os9_heads = BIT(os9_header[0x10], 0) ? 2 : 1;
+ int os9_heads = util::BIT(os9_header[0x10], 0) ? 2 : 1;
int os9_sectors = pick_integer_be(os9_header, 0x11, 2);
if (os9_total_sectors <= 0 || os9_heads <= 0 || os9_sectors <= 0)
@@ -103,19 +104,19 @@ int os9_format::find_size(io_generic *io, uint32_t form_factor)
int opt_track0_sectors = pick_integer_be(os9_header, 0x3f + 11, 2);
int opt_interleave = os9_header[0x3f + 13];
- int opt_mfm = BIT(opt_density, 0);
+ int opt_mfm = util::BIT(opt_density, 0);
// The NitrOS9 rb1773 driver uses bit 1 of opt_type to distinguish
// between a sector base ID of zero or one, so recognise that here.
- int opt_sector_base_id = BIT(opt_type, 1) ? 0 : 1;
- int opt_sector_size = BIT(opt_type, 2) ? 512 : 256;
- int opt_coco = BIT(opt_type, 5);
+ int opt_sector_base_id = util::BIT(opt_type, 1) ? 0 : 1;
+ int opt_sector_size = util::BIT(opt_type, 2) ? 512 : 256;
+ int opt_coco = util::BIT(opt_type, 5);
// Some OS9 versions appear to use bit 7 of the opt_density rather
// than bit 5 of opt_type to signify a COCO format disk. E.g. Gimix
// OS9 is documented to use this bit and had a floppy driver that
// could read both non-COCO and COCO format disks.
- if (BIT(opt_density, 7))
+ if (util::BIT(opt_density, 7))
opt_coco = 1;
// COCO format disks are expected for have an opt_dtype of 1.
diff --git a/src/lib/formats/pasti_dsk.cpp b/src/lib/formats/pasti_dsk.cpp
index 3bf5fa7a243..4236c066708 100644
--- a/src/lib/formats/pasti_dsk.cpp
+++ b/src/lib/formats/pasti_dsk.cpp
@@ -1,6 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
-#include "emu.h" // logerror
#include "pasti_dsk.h"
// Pasti format supported using the documentation at
diff --git a/src/lib/formats/ti99_dsk.cpp b/src/lib/formats/ti99_dsk.cpp
index a82600feaa6..9ab4f5fb4b3 100644
--- a/src/lib/formats/ti99_dsk.cpp
+++ b/src/lib/formats/ti99_dsk.cpp
@@ -40,18 +40,18 @@
********************************************************************/
+#include "ti99_dsk.h"
+#include "imageutl.h"
+
+#include "osdcore.h" // osd_printf_* (in osdcore.h)
+
#include <cstring>
#include <ctime>
#include <cassert>
#include <iomanip>
-#include "emu.h" // osd_printf_* (in osdcore.h)
-#include "imageutl.h"
-#include "ti99_dsk.h"
-
#define SECTOR_SIZE 256
-#undef LOG_OUTPUT_FUNC
#define LOG_OUTPUT_FUNC osd_printf_info
#define LOG_WARN (1U<<1) // Warnings
@@ -64,8 +64,10 @@
#define VERBOSE ( LOG_WARN )
+#define __EMU_H__ // logmacro wasn't really intended to be used outside stuff that uses libemu
#include "logmacro.h"
+
// ====================================================
// Common methods for both formats.
// ====================================================
diff --git a/src/lib/formats/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp
index a4b2b30ed81..e1ced8175f0 100644
--- a/src/lib/formats/tzx_cas.cpp
+++ b/src/lib/formats/tzx_cas.cpp
@@ -27,11 +27,12 @@ TODO:
*/
+#include "tzx_cas.h"
+#include "imageutl.h"
+
#include <cassert>
+#include <cmath>
-#include "tzx_cas.h"
-#include "formats/imageutl.h"
-#include "emu.h"
#define TZX_WAV_FREQUENCY 44100
#define WAVE_LOW -0x5a9e
@@ -435,7 +436,7 @@ static int tzx_handle_generalized(int16_t **buffer, const uint8_t *bytes, int pa
const uint8_t *symtable = bytes;
const uint8_t *table2 = bytes + (2 * npd + 1)*asd;
- int NB = ceil(compute_log2(asd)); // number of bits needed to represent each symbol
+ int NB = std::ceil(compute_log2(asd)); // number of bits needed to represent each symbol
uint8_t stream_bit = 0;
uint32_t stream_byte = 0;
diff --git a/src/lib/formats/upd765_dsk.cpp b/src/lib/formats/upd765_dsk.cpp
index c8355b7b691..ee3fda0abda 100644
--- a/src/lib/formats/upd765_dsk.cpp
+++ b/src/lib/formats/upd765_dsk.cpp
@@ -8,9 +8,11 @@
*********************************************************************/
-#include "emu.h" // emu_fatalerror
#include "formats/upd765_dsk.h"
+#include "emucore.h" // emu_fatalerror
+
+
upd765_format::upd765_format(const format *_formats) : file_header_skip_bytes(0), file_footer_skip_bytes(0), formats(_formats)
{
}
diff --git a/src/lib/formats/vdk_dsk.cpp b/src/lib/formats/vdk_dsk.cpp
index 70f417fd2db..fa07d22a958 100644
--- a/src/lib/formats/vdk_dsk.cpp
+++ b/src/lib/formats/vdk_dsk.cpp
@@ -10,7 +10,6 @@
***************************************************************************/
-#include "emu.h"
#include "vdk_dsk.h"
vdk_format::vdk_format()
diff --git a/src/lib/formats/victor9k_dsk.cpp b/src/lib/formats/victor9k_dsk.cpp
index 1fbba7502be..49e285d4e2a 100644
--- a/src/lib/formats/victor9k_dsk.cpp
+++ b/src/lib/formats/victor9k_dsk.cpp
@@ -97,9 +97,11 @@
zone.
*/
-#include "emu.h" // osd_printf_verbose, BIT, emu_fatalerror
#include "formats/victor9k_dsk.h"
+#include "emucore.h" // emu_fatalerror
+
+
victor9k_format::victor9k_format()
{
}
@@ -173,7 +175,7 @@ void victor9k_format::log_boot_sector(uint8_t *data)
osd_printf_verbose("Boot start: %04x\n", (data[29] << 8) | data[30]);
// Flags
- osd_printf_verbose("%s sided\n", BIT(data[33], 0) ? "Double" : "Single");
+ osd_printf_verbose("%s sided\n", util::BIT(data[33], 0) ? "Double" : "Single");
osd_printf_verbose("Interleave factor: %u\n", data[32] >> 4);
// Disc type
diff --git a/src/lib/formats/wd177x_dsk.cpp b/src/lib/formats/wd177x_dsk.cpp
index f19e9d4cbb2..75d76d26f38 100644
--- a/src/lib/formats/wd177x_dsk.cpp
+++ b/src/lib/formats/wd177x_dsk.cpp
@@ -8,9 +8,11 @@
*********************************************************************/
-#include "emu.h" // emu_fatalerror
#include "formats/wd177x_dsk.h"
+#include "emucore.h" // emu_fatalerror
+
+
wd177x_format::wd177x_format(const format *_formats)
{
formats = _formats;