summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2022-02-11 23:22:46 -0500
committer AJR <ajrhacker@users.noreply.github.com>2022-02-11 23:22:46 -0500
commit0cb0cfd4c66915b43929d496fb694445fd7ab6ea (patch)
treebf6b5354e06024451554153eb4d60fbc97b47811
parenta9440352de702cc42c4ac972aeb1e37fe6bd8b2a (diff)
Remove fileio.h from emu.h
-rw-r--r--src/devices/bus/a2bus/a2cffa.cpp1
-rw-r--r--src/devices/bus/abcbus/ssa.h2
-rw-r--r--src/devices/bus/ata/cr589.cpp2
-rw-r--r--src/devices/bus/c64/dqbb.h2
-rw-r--r--src/devices/bus/c64/fcc.h1
-rw-r--r--src/devices/bus/c64/neoram.h1
-rw-r--r--src/devices/bus/iq151/minigraf.cpp1
-rw-r--r--src/devices/bus/iq151/ms151a.cpp1
-rw-r--r--src/devices/bus/pasopia/rampac2.cpp2
-rw-r--r--src/devices/bus/pce/pce_rom.cpp3
-rw-r--r--src/devices/bus/pofo/hpc104.h2
-rw-r--r--src/devices/bus/pofo/ram.h2
-rw-r--r--src/devices/bus/s100/seals8k.cpp2
-rw-r--r--src/devices/bus/saturn/bram.h2
-rw-r--r--src/devices/bus/ti99/gromport/cartridges.cpp2
-rw-r--r--src/devices/bus/ti99/gromport/gkracker.cpp2
-rw-r--r--src/devices/bus/ti99/internal/buffram.cpp2
-rw-r--r--src/devices/bus/ti99/peb/evpc.cpp2
-rw-r--r--src/devices/bus/ti99/peb/horizon.cpp2
-rw-r--r--src/devices/bus/vic20/megacart.h1
-rw-r--r--src/devices/cpu/m6805/m68705.cpp2
-rw-r--r--src/devices/cpu/mcs51/mcs51.cpp4
-rw-r--r--src/devices/imagedev/diablo.cpp1
-rw-r--r--src/devices/imagedev/harddriv.cpp1
-rw-r--r--src/devices/machine/28fxxx.cpp2
-rw-r--r--src/devices/machine/at28c16.cpp2
-rw-r--r--src/devices/machine/at28c64b.cpp2
-rw-r--r--src/devices/machine/at29x.cpp2
-rw-r--r--src/devices/machine/at45dbxx.cpp2
-rw-r--r--src/devices/machine/bq4847.cpp2
-rw-r--r--src/devices/machine/bq48x2.cpp2
-rw-r--r--src/devices/machine/dp8573.cpp2
-rw-r--r--src/devices/machine/ds1204.cpp2
-rw-r--r--src/devices/machine/ds1205.cpp2
-rw-r--r--src/devices/machine/ds1302.cpp2
-rw-r--r--src/devices/machine/ds1386.cpp2
-rw-r--r--src/devices/machine/ds1994.cpp2
-rw-r--r--src/devices/machine/ds2404.cpp2
-rw-r--r--src/devices/machine/eeprom.cpp2
-rw-r--r--src/devices/machine/er1400.cpp2
-rw-r--r--src/devices/machine/er2055.cpp2
-rw-r--r--src/devices/machine/hd64610.cpp2
-rw-r--r--src/devices/machine/i2cmem.cpp2
-rw-r--r--src/devices/machine/icm7170.cpp2
-rw-r--r--src/devices/machine/intelfsh.cpp2
-rw-r--r--src/devices/machine/m3002.cpp2
-rw-r--r--src/devices/machine/m6m80011ap.cpp2
-rw-r--r--src/devices/machine/mc146818.cpp4
-rw-r--r--src/devices/machine/mccs1850.cpp2
-rw-r--r--src/devices/machine/msm58321.cpp2
-rw-r--r--src/devices/machine/nmc9306.cpp2
-rw-r--r--src/devices/machine/nvram.cpp2
-rw-r--r--src/devices/machine/pcf8583.cpp2
-rw-r--r--src/devices/machine/pcf8593.cpp2
-rw-r--r--src/devices/machine/rp5c01.cpp2
-rw-r--r--src/devices/machine/rtc65271.cpp2
-rw-r--r--src/devices/machine/rtc9701.cpp2
-rw-r--r--src/devices/machine/s3520cf.cpp2
-rw-r--r--src/devices/machine/sda2006.cpp2
-rw-r--r--src/devices/machine/sensorboard.cpp2
-rw-r--r--src/devices/machine/serflash.cpp2
-rw-r--r--src/devices/machine/sonydriv.cpp2
-rw-r--r--src/devices/machine/strata.cpp2
-rw-r--r--src/devices/machine/timekpr.cpp2
-rw-r--r--src/devices/machine/x2201.cpp3
-rw-r--r--src/devices/machine/x2212.cpp3
-rw-r--r--src/devices/machine/x76f041.cpp2
-rw-r--r--src/devices/machine/x76f100.cpp2
-rw-r--r--src/devices/sound/samples.cpp1
-rw-r--r--src/emu/config.cpp1
-rw-r--r--src/emu/crsshair.cpp1
-rw-r--r--src/emu/debug/debugcmd.cpp9
-rw-r--r--src/emu/debug/debugcon.cpp5
-rw-r--r--src/emu/debug/debugcon.h1
-rw-r--r--src/emu/debug/debugcpu.cpp1
-rw-r--r--src/emu/diimage.cpp1
-rw-r--r--src/emu/emu.h6
-rw-r--r--src/emu/emufwd.h3
-rw-r--r--src/emu/hashfile.cpp1
-rw-r--r--src/emu/image.cpp1
-rw-r--r--src/emu/ioport.cpp132
-rw-r--r--src/emu/ioport.h114
-rw-r--r--src/emu/machine.cpp11
-rw-r--r--src/emu/machine.h4
-rw-r--r--src/emu/recording.cpp3
-rw-r--r--src/emu/render.cpp1
-rw-r--r--src/emu/rendfont.cpp3
-rw-r--r--src/emu/rendlay.cpp1
-rw-r--r--src/emu/romload.cpp6
-rw-r--r--src/emu/save.cpp9
-rw-r--r--src/emu/save.h6
-rw-r--r--src/emu/screen.cpp1
-rw-r--r--src/emu/softlist_dev.cpp1
-rw-r--r--src/emu/video.cpp3
-rw-r--r--src/emu/video.h2
-rw-r--r--src/frontend/mame/audit.cpp1
-rw-r--r--src/frontend/mame/cheat.cpp1
-rw-r--r--src/frontend/mame/clifront.cpp1
-rw-r--r--src/frontend/mame/language.cpp1
-rw-r--r--src/frontend/mame/luaengine.cpp1
-rw-r--r--src/frontend/mame/mame.cpp1
-rw-r--r--src/frontend/mame/mameopts.cpp1
-rw-r--r--src/frontend/mame/ui/auditmenu.cpp1
-rw-r--r--src/frontend/mame/ui/custui.cpp1
-rw-r--r--src/frontend/mame/ui/dirmenu.cpp1
-rw-r--r--src/frontend/mame/ui/inifile.cpp1
-rw-r--r--src/frontend/mame/ui/menu.cpp1
-rw-r--r--src/frontend/mame/ui/miscmenu.cpp1
-rw-r--r--src/frontend/mame/ui/optsmenu.cpp2
-rw-r--r--src/frontend/mame/ui/selgame.cpp1
-rw-r--r--src/frontend/mame/ui/selmenu.cpp1
-rw-r--r--src/frontend/mame/ui/selsoft.cpp1
-rw-r--r--src/frontend/mame/ui/simpleselgame.cpp1
-rw-r--r--src/frontend/mame/ui/systemlist.cpp1
-rw-r--r--src/frontend/mame/ui/ui.cpp1
-rw-r--r--src/mame/drivers/ldplayer.cpp1
-rw-r--r--src/mame/drivers/ngp.cpp1
-rw-r--r--src/mame/machine/cuda.cpp2
-rw-r--r--src/mame/machine/docg3.cpp2
-rw-r--r--src/mame/machine/egret.cpp2
-rw-r--r--src/mame/machine/kr1601rr1.cpp3
-rw-r--r--src/mame/machine/m3comm.h2
-rw-r--r--src/mame/machine/macrtc.cpp2
-rw-r--r--src/mame/machine/midwayic.cpp3
-rw-r--r--src/mame/machine/msx_matsushita.cpp2
-rw-r--r--src/mame/machine/msx_s1985.cpp2
-rw-r--r--src/mame/machine/pc9801_memsw.cpp2
-rw-r--r--src/mame/machine/tosh1000_bram.cpp2
-rw-r--r--src/mame/machine/zs01.cpp2
-rw-r--r--src/mame/video/midtunit.cpp1
-rw-r--r--src/osd/modules/debugger/debuggdbstub.cpp1
-rw-r--r--src/osd/modules/render/aviwrite.cpp1
-rw-r--r--src/osd/modules/render/bgfx/chainentryreader.cpp1
-rw-r--r--src/osd/modules/render/bgfx/texturemanager.cpp1
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.cpp1
135 files changed, 363 insertions, 155 deletions
diff --git a/src/devices/bus/a2bus/a2cffa.cpp b/src/devices/bus/a2bus/a2cffa.cpp
index 8942e05558d..83124c4a51a 100644
--- a/src/devices/bus/a2bus/a2cffa.cpp
+++ b/src/devices/bus/a2bus/a2cffa.cpp
@@ -17,6 +17,7 @@
#include "imagedev/harddriv.h"
#include "bus/ata/ataintf.h"
+#include "fileio.h"
#include "softlist.h"
diff --git a/src/devices/bus/abcbus/ssa.h b/src/devices/bus/abcbus/ssa.h
index 2be5046b24a..d6376cd9d4b 100644
--- a/src/devices/bus/abcbus/ssa.h
+++ b/src/devices/bus/abcbus/ssa.h
@@ -12,7 +12,7 @@
#pragma once
#include "abcbus.h"
-#include "machine/nvram.h"
+#include "fileio.h"
diff --git a/src/devices/bus/ata/cr589.cpp b/src/devices/bus/ata/cr589.cpp
index 6142f75ee7a..8f0cfed6556 100644
--- a/src/devices/bus/ata/cr589.cpp
+++ b/src/devices/bus/ata/cr589.cpp
@@ -3,6 +3,8 @@
#include "emu.h"
#include "cr589.h"
+#include "fileio.h"
+
static constexpr int identity_offset = 0x3ab;
static constexpr char download_identity[] = "MATSHITA CD98Q4 DOWNLOADGS0N";
diff --git a/src/devices/bus/c64/dqbb.h b/src/devices/bus/c64/dqbb.h
index af9460a5bbe..0fbbff1afd5 100644
--- a/src/devices/bus/c64/dqbb.h
+++ b/src/devices/bus/c64/dqbb.h
@@ -13,7 +13,7 @@
#include "exp.h"
-#include "machine/nvram.h"
+#include "fileio.h"
diff --git a/src/devices/bus/c64/fcc.h b/src/devices/bus/c64/fcc.h
index 15a096f5cf5..5f7a180fe20 100644
--- a/src/devices/bus/c64/fcc.h
+++ b/src/devices/bus/c64/fcc.h
@@ -14,6 +14,7 @@
#include "exp.h"
#include "cpu/m6502/m65sc02.h"
#include "machine/gen_latch.h"
+#include "fileio.h"
diff --git a/src/devices/bus/c64/neoram.h b/src/devices/bus/c64/neoram.h
index b6729ec08d4..295b893b5c7 100644
--- a/src/devices/bus/c64/neoram.h
+++ b/src/devices/bus/c64/neoram.h
@@ -13,6 +13,7 @@
#include "exp.h"
+#include "fileio.h"
diff --git a/src/devices/bus/iq151/minigraf.cpp b/src/devices/bus/iq151/minigraf.cpp
index e0962048411..b3d51bdf8d3 100644
--- a/src/devices/bus/iq151/minigraf.cpp
+++ b/src/devices/bus/iq151/minigraf.cpp
@@ -10,6 +10,7 @@
#include "minigraf.h"
#include "emuopts.h"
+#include "fileio.h"
#include "png.h"
// paper is A4 (297x210mm)
diff --git a/src/devices/bus/iq151/ms151a.cpp b/src/devices/bus/iq151/ms151a.cpp
index 651e82bfe6f..6b4116f3d42 100644
--- a/src/devices/bus/iq151/ms151a.cpp
+++ b/src/devices/bus/iq151/ms151a.cpp
@@ -10,6 +10,7 @@
#include "ms151a.h"
#include "emuopts.h"
+#include "fileio.h"
#include "png.h"
// paper is A4 (210x297mm)
diff --git a/src/devices/bus/pasopia/rampac2.cpp b/src/devices/bus/pasopia/rampac2.cpp
index f9059e24345..e1d912b92d4 100644
--- a/src/devices/bus/pasopia/rampac2.cpp
+++ b/src/devices/bus/pasopia/rampac2.cpp
@@ -12,6 +12,8 @@
#include "emu.h"
#include "rampac2.h"
+#include "fileio.h"
+
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
diff --git a/src/devices/bus/pce/pce_rom.cpp b/src/devices/bus/pce/pce_rom.cpp
index 897878ad13a..1b532e7f081 100644
--- a/src/devices/bus/pce/pce_rom.cpp
+++ b/src/devices/bus/pce/pce_rom.cpp
@@ -12,6 +12,9 @@
#include "emu.h"
#include "pce_rom.h"
+#include "fileio.h"
+
+
//-------------------------------------------------
// pce_rom_device - constructor
diff --git a/src/devices/bus/pofo/hpc104.h b/src/devices/bus/pofo/hpc104.h
index 6afae6dd5ec..0522090614e 100644
--- a/src/devices/bus/pofo/hpc104.h
+++ b/src/devices/bus/pofo/hpc104.h
@@ -13,7 +13,7 @@
#include "exp.h"
#include "bus/pofo/ccm.h"
-#include "machine/nvram.h"
+#include "fileio.h"
diff --git a/src/devices/bus/pofo/ram.h b/src/devices/bus/pofo/ram.h
index fc00ac48d2d..fe956525896 100644
--- a/src/devices/bus/pofo/ram.h
+++ b/src/devices/bus/pofo/ram.h
@@ -12,7 +12,7 @@
#pragma once
#include "ccm.h"
-#include "machine/nvram.h"
+#include "fileio.h"
diff --git a/src/devices/bus/s100/seals8k.cpp b/src/devices/bus/s100/seals8k.cpp
index 949c7d6d2c5..da3699f7244 100644
--- a/src/devices/bus/s100/seals8k.cpp
+++ b/src/devices/bus/s100/seals8k.cpp
@@ -29,6 +29,8 @@
#include "emu.h"
#include "seals8k.h"
+#include "fileio.h"
+
//**************************************************************************
// TYPE DEFINITIONS
diff --git a/src/devices/bus/saturn/bram.h b/src/devices/bus/saturn/bram.h
index 71ff5f0ace9..9d5b0eab1f8 100644
--- a/src/devices/bus/saturn/bram.h
+++ b/src/devices/bus/saturn/bram.h
@@ -5,6 +5,8 @@
#include "sat_slot.h"
+#include "fileio.h"
+
// ======================> saturn_bram_device
diff --git a/src/devices/bus/ti99/gromport/cartridges.cpp b/src/devices/bus/ti99/gromport/cartridges.cpp
index a6c80531f19..ae52f2db820 100644
--- a/src/devices/bus/ti99/gromport/cartridges.cpp
+++ b/src/devices/bus/ti99/gromport/cartridges.cpp
@@ -15,6 +15,8 @@
#include "emu.h"
#include "cartridges.h"
+#include "fileio.h"
+
#include "corestr.h"
#include "formats/rpk.h"
diff --git a/src/devices/bus/ti99/gromport/gkracker.cpp b/src/devices/bus/ti99/gromport/gkracker.cpp
index 37f13623575..df0967d54cd 100644
--- a/src/devices/bus/ti99/gromport/gkracker.cpp
+++ b/src/devices/bus/ti99/gromport/gkracker.cpp
@@ -97,6 +97,8 @@
#include "emu.h"
#include "gkracker.h"
+#include "fileio.h"
+
#define LOG_WARN (1U<<1) // Warnings
#define LOG_CHANGE (1U<<2) // Cartridge change
#define LOG_GKRACKER (1U<<3) // Gram Kracker operation
diff --git a/src/devices/bus/ti99/internal/buffram.cpp b/src/devices/bus/ti99/internal/buffram.cpp
index 1677e2ede8d..76d84d2d6da 100644
--- a/src/devices/bus/ti99/internal/buffram.cpp
+++ b/src/devices/bus/ti99/internal/buffram.cpp
@@ -11,6 +11,8 @@
#include "emu.h"
#include "buffram.h"
+#include "fileio.h"
+
#define VERBOSE ( LOG_GENERAL )
#include "logmacro.h"
diff --git a/src/devices/bus/ti99/peb/evpc.cpp b/src/devices/bus/ti99/peb/evpc.cpp
index b99821baf4a..a6a02c3dccd 100644
--- a/src/devices/bus/ti99/peb/evpc.cpp
+++ b/src/devices/bus/ti99/peb/evpc.cpp
@@ -40,6 +40,8 @@
#include "emu.h"
#include "evpc.h"
+
+#include "fileio.h"
#include "speaker.h"
#define LOG_WARN (1U<<1) // Warnings
diff --git a/src/devices/bus/ti99/peb/horizon.cpp b/src/devices/bus/ti99/peb/horizon.cpp
index 1be6264189c..41ffcc6557d 100644
--- a/src/devices/bus/ti99/peb/horizon.cpp
+++ b/src/devices/bus/ti99/peb/horizon.cpp
@@ -126,6 +126,8 @@
#include "emu.h"
#include "horizon.h"
+#include "fileio.h"
+
#define LOG_WARN (1U<<1) // Warnings
#define LOG_CONFIG (1U<<2) // Configuration
#define LOG_32K (1U<<3) // 32K optional RAM r/w
diff --git a/src/devices/bus/vic20/megacart.h b/src/devices/bus/vic20/megacart.h
index 08e3ef0a59b..090e0c7d60c 100644
--- a/src/devices/bus/vic20/megacart.h
+++ b/src/devices/bus/vic20/megacart.h
@@ -12,6 +12,7 @@
#pragma once
#include "exp.h"
+#include "fileio.h"
diff --git a/src/devices/cpu/m6805/m68705.cpp b/src/devices/cpu/m6805/m68705.cpp
index 964286124ba..1c7ceb2617b 100644
--- a/src/devices/cpu/m6805/m68705.cpp
+++ b/src/devices/cpu/m6805/m68705.cpp
@@ -16,6 +16,8 @@
#include "m6805defs.h"
#include "6805dasm.h"
+#include "fileio.h"
+
/****************************************************************************
* Configurable logging
****************************************************************************/
diff --git a/src/devices/cpu/mcs51/mcs51.cpp b/src/devices/cpu/mcs51/mcs51.cpp
index f9e9afc1470..a2c538e9cca 100644
--- a/src/devices/cpu/mcs51/mcs51.cpp
+++ b/src/devices/cpu/mcs51/mcs51.cpp
@@ -131,10 +131,12 @@
*/
#include "emu.h"
-#include "debugger.h"
#include "mcs51.h"
#include "mcs51dasm.h"
+#include "debugger.h"
+#include "fileio.h"
+
#define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
diff --git a/src/devices/imagedev/diablo.cpp b/src/devices/imagedev/diablo.cpp
index d14c53ef7f2..a74ff5947e9 100644
--- a/src/devices/imagedev/diablo.cpp
+++ b/src/devices/imagedev/diablo.cpp
@@ -8,6 +8,7 @@
#include "diablo.h"
#include "emuopts.h"
+#include "fileio.h"
#include "harddisk.h"
#include "romload.h"
diff --git a/src/devices/imagedev/harddriv.cpp b/src/devices/imagedev/harddriv.cpp
index f06f464f8b4..ca3367cee73 100644
--- a/src/devices/imagedev/harddriv.cpp
+++ b/src/devices/imagedev/harddriv.cpp
@@ -17,6 +17,7 @@
#include "harddriv.h"
#include "emuopts.h"
+#include "fileio.h"
#include "harddisk.h"
#include "romload.h"
diff --git a/src/devices/machine/28fxxx.cpp b/src/devices/machine/28fxxx.cpp
index e434a761c46..7841f15470e 100644
--- a/src/devices/machine/28fxxx.cpp
+++ b/src/devices/machine/28fxxx.cpp
@@ -32,6 +32,8 @@
#include "emu.h"
#include "28fxxx.h"
+#include "fileio.h"
+
#define VERBOSE 0
#include "logmacro.h"
diff --git a/src/devices/machine/at28c16.cpp b/src/devices/machine/at28c16.cpp
index fdc7d5c93ec..f9664fd3dc9 100644
--- a/src/devices/machine/at28c16.cpp
+++ b/src/devices/machine/at28c16.cpp
@@ -10,6 +10,8 @@
#include "emu.h"
#include "machine/at28c16.h"
+#include "fileio.h"
+
#define AT28C16_DATA_BYTES ( 0x800 )
#define AT28C16_ID_BYTES ( 0x20 )
#define AT28C16_TOTAL_BYTES ( AT28C16_DATA_BYTES + AT28C16_ID_BYTES )
diff --git a/src/devices/machine/at28c64b.cpp b/src/devices/machine/at28c64b.cpp
index 96302285f0c..b3552c90f4b 100644
--- a/src/devices/machine/at28c64b.cpp
+++ b/src/devices/machine/at28c64b.cpp
@@ -10,6 +10,8 @@
#include "emu.h"
#include "machine/at28c64b.h"
+#include "fileio.h"
+
static constexpr int AT28C64B_DATA_BYTES = 0x10000;
static constexpr int AT28C64B_ID_BYTES = 0x40;
static constexpr int AT28C64B_TOTAL_BYTES = AT28C64B_DATA_BYTES + AT28C64B_ID_BYTES;
diff --git a/src/devices/machine/at29x.cpp b/src/devices/machine/at29x.cpp
index 7cc435d7033..775a6cb42b5 100644
--- a/src/devices/machine/at29x.cpp
+++ b/src/devices/machine/at29x.cpp
@@ -40,6 +40,8 @@
#include "emu.h"
#include "at29x.h"
+#include "fileio.h"
+
#define LOG_DETAIL (1U<<1) // More detail
#define LOG_WARN (1U<<2) // Warning
#define LOG_PRG (1U<<3) // Programming
diff --git a/src/devices/machine/at45dbxx.cpp b/src/devices/machine/at45dbxx.cpp
index 74fc06b4413..268c485dc4c 100644
--- a/src/devices/machine/at45dbxx.cpp
+++ b/src/devices/machine/at45dbxx.cpp
@@ -15,6 +15,8 @@
#include "emu.h"
#include "at45dbxx.h"
+#include "fileio.h"
+
#define LOG_LEVEL 1
#define _logerror(level,x) do { if (LOG_LEVEL > level) logerror x; } while (0)
diff --git a/src/devices/machine/bq4847.cpp b/src/devices/machine/bq4847.cpp
index 3be75106707..f3d8a7ec4d8 100644
--- a/src/devices/machine/bq4847.cpp
+++ b/src/devices/machine/bq4847.cpp
@@ -21,6 +21,8 @@
#include "emu.h"
#include "bq4847.h"
+#include "fileio.h"
+
#define LOG_WARN (1U<<1) // Warnings
#define LOG_CLOCK (1U<<2) // Clock operation
#define LOG_REG (1U<<3) // Register write
diff --git a/src/devices/machine/bq48x2.cpp b/src/devices/machine/bq48x2.cpp
index 40bfde5a754..6098e5f04ae 100644
--- a/src/devices/machine/bq48x2.cpp
+++ b/src/devices/machine/bq48x2.cpp
@@ -8,6 +8,8 @@
#include "emu.h"
#include "bq48x2.h"
+#include "fileio.h"
+
#define LOG_WARN (1U<<1) // Warnings
#define LOG_CLOCK (1U<<2) // Clock operation
#define LOG_REGW (1U<<3) // Register write
diff --git a/src/devices/machine/dp8573.cpp b/src/devices/machine/dp8573.cpp
index 529ed3d90fe..10f5960d6d3 100644
--- a/src/devices/machine/dp8573.cpp
+++ b/src/devices/machine/dp8573.cpp
@@ -10,6 +10,8 @@
#include "machine/dp8573.h"
#include "machine/timehelp.h"
+#include "fileio.h"
+
#define LOG_GENERAL (1 << 0)
#define LOG_TICKS (1 << 1)
#define LOG_ALL (LOG_GENERAL | LOG_TICKS)
diff --git a/src/devices/machine/ds1204.cpp b/src/devices/machine/ds1204.cpp
index ba86725df66..abdbca4421b 100644
--- a/src/devices/machine/ds1204.cpp
+++ b/src/devices/machine/ds1204.cpp
@@ -10,6 +10,8 @@
#include "emu.h"
#include "ds1204.h"
+#include "fileio.h"
+
#include <cstdio>
diff --git a/src/devices/machine/ds1205.cpp b/src/devices/machine/ds1205.cpp
index 460d267928a..25c98f441e7 100644
--- a/src/devices/machine/ds1205.cpp
+++ b/src/devices/machine/ds1205.cpp
@@ -10,6 +10,8 @@
#include "emu.h"
#include "ds1205.h"
+#include "fileio.h"
+
#include <cstdio>
diff --git a/src/devices/machine/ds1302.cpp b/src/devices/machine/ds1302.cpp
index e284e359e12..34d75224748 100644
--- a/src/devices/machine/ds1302.cpp
+++ b/src/devices/machine/ds1302.cpp
@@ -18,6 +18,8 @@
#include "emu.h"
#include "ds1302.h"
+#include "fileio.h"
+
//#define VERBOSE 1
#include "logmacro.h"
diff --git a/src/devices/machine/ds1386.cpp b/src/devices/machine/ds1386.cpp
index cd3f601b0ea..edbd46f07b5 100644
--- a/src/devices/machine/ds1386.cpp
+++ b/src/devices/machine/ds1386.cpp
@@ -12,6 +12,8 @@
#include "ds1386.h"
#include "machine/timehelp.h"
+#include "fileio.h"
+
#define DISABLE_OSC (0x80)
#define DISABLE_SQW (0x40)
diff --git a/src/devices/machine/ds1994.cpp b/src/devices/machine/ds1994.cpp
index 3b9e9f0ebe9..2d16d3eed54 100644
--- a/src/devices/machine/ds1994.cpp
+++ b/src/devices/machine/ds1994.cpp
@@ -15,6 +15,8 @@
#include "emu.h"
#include "machine/ds1994.h"
+#include "fileio.h"
+
#include <ctime>
#define VERBOSE_LEVEL 0
diff --git a/src/devices/machine/ds2404.cpp b/src/devices/machine/ds2404.cpp
index 7c5876ee9d0..f488b116aec 100644
--- a/src/devices/machine/ds2404.cpp
+++ b/src/devices/machine/ds2404.cpp
@@ -16,6 +16,8 @@
#include "emu.h"
#include "ds2404.h"
+#include "fileio.h"
+
#include <algorithm>
#include <ctime> // FIXME: re-write in terms of device_rtc_interface and remove this
diff --git a/src/devices/machine/eeprom.cpp b/src/devices/machine/eeprom.cpp
index 0c81a6701e0..791e5c88ec5 100644
--- a/src/devices/machine/eeprom.cpp
+++ b/src/devices/machine/eeprom.cpp
@@ -11,6 +11,8 @@
#include "emu.h"
#include "machine/eeprom.h"
+#include "fileio.h"
+
//#define VERBOSE 1
#include "logmacro.h"
diff --git a/src/devices/machine/er1400.cpp b/src/devices/machine/er1400.cpp
index e239f621e5d..7f73983e173 100644
--- a/src/devices/machine/er1400.cpp
+++ b/src/devices/machine/er1400.cpp
@@ -24,6 +24,8 @@
#include "emu.h"
#include "machine/er1400.h"
+#include "fileio.h"
+
#define VERBOSE 0
#include "logmacro.h"
diff --git a/src/devices/machine/er2055.cpp b/src/devices/machine/er2055.cpp
index 20fd3805e7d..80faafe3a46 100644
--- a/src/devices/machine/er2055.cpp
+++ b/src/devices/machine/er2055.cpp
@@ -14,6 +14,8 @@
#include "emu.h"
#include "machine/er2055.h"
+#include "fileio.h"
+
#include "logmacro.h"
diff --git a/src/devices/machine/hd64610.cpp b/src/devices/machine/hd64610.cpp
index beedbeea73d..bb62c11cb36 100644
--- a/src/devices/machine/hd64610.cpp
+++ b/src/devices/machine/hd64610.cpp
@@ -16,7 +16,9 @@
#include "emu.h"
#include "hd64610.h"
+
#include "coreutil.h"
+#include "fileio.h"
#define VERBOSE 1
#include "logmacro.h"
diff --git a/src/devices/machine/i2cmem.cpp b/src/devices/machine/i2cmem.cpp
index d5fd3f3094a..a951f325110 100644
--- a/src/devices/machine/i2cmem.cpp
+++ b/src/devices/machine/i2cmem.cpp
@@ -25,6 +25,8 @@ there are two standard values.
#include "emu.h"
#include "machine/i2cmem.h"
+#include "fileio.h"
+
constexpr int STATE_IDLE(0);
constexpr int STATE_DEVSEL(1);
constexpr int STATE_ADDRESSHIGH(2);
diff --git a/src/devices/machine/icm7170.cpp b/src/devices/machine/icm7170.cpp
index 8537074371a..097fadf3b57 100644
--- a/src/devices/machine/icm7170.cpp
+++ b/src/devices/machine/icm7170.cpp
@@ -8,7 +8,9 @@
#include "emu.h"
#include "icm7170.h"
+
#include "coreutil.h"
+#include "fileio.h"
#define VERBOSE (0)
#include "logmacro.h"
diff --git a/src/devices/machine/intelfsh.cpp b/src/devices/machine/intelfsh.cpp
index 5221668059f..92561edc32a 100644
--- a/src/devices/machine/intelfsh.cpp
+++ b/src/devices/machine/intelfsh.cpp
@@ -16,6 +16,8 @@
#include "emu.h"
#include "intelfsh.h"
+#include "fileio.h"
+
//**************************************************************************
// CONSTANTS
diff --git a/src/devices/machine/m3002.cpp b/src/devices/machine/m3002.cpp
index fd93666a55f..9a51792f11d 100644
--- a/src/devices/machine/m3002.cpp
+++ b/src/devices/machine/m3002.cpp
@@ -14,6 +14,8 @@
#include "emu.h"
#include "m3002.h"
+#include "fileio.h"
+
#define VERBOSE 0
#include "logmacro.h"
diff --git a/src/devices/machine/m6m80011ap.cpp b/src/devices/machine/m6m80011ap.cpp
index 79d7073c331..56d9911dc6c 100644
--- a/src/devices/machine/m6m80011ap.cpp
+++ b/src/devices/machine/m6m80011ap.cpp
@@ -4,6 +4,8 @@
#include "emu.h"
#include "machine/m6m80011ap.h"
+#include "fileio.h"
+
//**************************************************************************
diff --git a/src/devices/machine/mc146818.cpp b/src/devices/machine/mc146818.cpp
index 7f2aab30270..49f77a3a012 100644
--- a/src/devices/machine/mc146818.cpp
+++ b/src/devices/machine/mc146818.cpp
@@ -12,9 +12,11 @@
*********************************************************************/
#include "emu.h"
-#include "coreutil.h"
#include "machine/mc146818.h"
+#include "coreutil.h"
+#include "fileio.h"
+
//#define VERBOSE 1
#include "logmacro.h"
diff --git a/src/devices/machine/mccs1850.cpp b/src/devices/machine/mccs1850.cpp
index ebd70e04f9c..f422d769cea 100644
--- a/src/devices/machine/mccs1850.cpp
+++ b/src/devices/machine/mccs1850.cpp
@@ -18,6 +18,8 @@
#include "emu.h"
#include "mccs1850.h"
+#include "fileio.h"
+
//#define VERBOSE 0
#include "logmacro.h"
diff --git a/src/devices/machine/msm58321.cpp b/src/devices/machine/msm58321.cpp
index c34513e6847..7f7ba37b1a2 100644
--- a/src/devices/machine/msm58321.cpp
+++ b/src/devices/machine/msm58321.cpp
@@ -17,6 +17,8 @@
#include "emu.h"
#include "msm58321.h"
+#include "fileio.h"
+
//#define VERBOSE 1
#include "logmacro.h"
diff --git a/src/devices/machine/nmc9306.cpp b/src/devices/machine/nmc9306.cpp
index d20e77a398b..c977bee7925 100644
--- a/src/devices/machine/nmc9306.cpp
+++ b/src/devices/machine/nmc9306.cpp
@@ -9,6 +9,8 @@
#include "emu.h"
#include "nmc9306.h"
+#include "fileio.h"
+
//#define VERBOSE 1
#include "logmacro.h"
diff --git a/src/devices/machine/nvram.cpp b/src/devices/machine/nvram.cpp
index e00d10447a8..b6adb230ea5 100644
--- a/src/devices/machine/nvram.cpp
+++ b/src/devices/machine/nvram.cpp
@@ -11,6 +11,8 @@
#include "emu.h"
#include "machine/nvram.h"
+#include "fileio.h"
+
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
diff --git a/src/devices/machine/pcf8583.cpp b/src/devices/machine/pcf8583.cpp
index 7883340cf15..fb1eb2b2a79 100644
--- a/src/devices/machine/pcf8583.cpp
+++ b/src/devices/machine/pcf8583.cpp
@@ -12,6 +12,8 @@
#include "emu.h"
#include "pcf8583.h"
+#include "fileio.h"
+
#define LOG_DATA (1 << 1)
#define LOG_LINE (1 << 2)
diff --git a/src/devices/machine/pcf8593.cpp b/src/devices/machine/pcf8593.cpp
index dc3d93d7ad1..c0ed932c5fe 100644
--- a/src/devices/machine/pcf8593.cpp
+++ b/src/devices/machine/pcf8593.cpp
@@ -11,6 +11,8 @@
#include "emu.h"
#include "pcf8593.h"
+#include "fileio.h"
+
/***************************************************************************
PARAMETERS/CONSTANTS/MACROS
diff --git a/src/devices/machine/rp5c01.cpp b/src/devices/machine/rp5c01.cpp
index 8ea9e85e6ef..61e523afe51 100644
--- a/src/devices/machine/rp5c01.cpp
+++ b/src/devices/machine/rp5c01.cpp
@@ -19,6 +19,8 @@
#include "emu.h"
#include "rp5c01.h"
+#include "fileio.h"
+
// device type definitions
DEFINE_DEVICE_TYPE(RP5C01, rp5c01_device, "rp5c01", "Ricoh RP5C01 RTC")
diff --git a/src/devices/machine/rtc65271.cpp b/src/devices/machine/rtc65271.cpp
index b39730fb372..a74c9ecd06d 100644
--- a/src/devices/machine/rtc65271.cpp
+++ b/src/devices/machine/rtc65271.cpp
@@ -21,6 +21,8 @@
#include "emu.h"
#include "rtc65271.h"
+#include "fileio.h"
+
/* Delay between the beginning (UIP asserted) and the end (UIP cleared and
update interrupt asserted) of the update cycle */
#define UPDATE_CYCLE_TIME attotime::from_usec(1984)
diff --git a/src/devices/machine/rtc9701.cpp b/src/devices/machine/rtc9701.cpp
index a8ccc5cec7f..f022d9fe329 100644
--- a/src/devices/machine/rtc9701.cpp
+++ b/src/devices/machine/rtc9701.cpp
@@ -14,6 +14,8 @@
#include "emu.h"
#include "machine/rtc9701.h"
+#include "fileio.h"
+
ALLOW_SAVE_TYPE(rtc9701_device::state_t);
diff --git a/src/devices/machine/s3520cf.cpp b/src/devices/machine/s3520cf.cpp
index abdd1d83638..6cc780e7175 100644
--- a/src/devices/machine/s3520cf.cpp
+++ b/src/devices/machine/s3520cf.cpp
@@ -17,6 +17,8 @@ TODO:
#include "emu.h"
#include "machine/s3520cf.h"
+#include "fileio.h"
+
//**************************************************************************
diff --git a/src/devices/machine/sda2006.cpp b/src/devices/machine/sda2006.cpp
index 853e5cf871d..e44cf48881c 100644
--- a/src/devices/machine/sda2006.cpp
+++ b/src/devices/machine/sda2006.cpp
@@ -4,6 +4,8 @@
#include "emu.h"
#include "machine/sda2006.h"
+#include "fileio.h"
+
//-------------------------------------------------
//
// Siemens SDA2006 512-bit (32x16) NV EEPROM
diff --git a/src/devices/machine/sensorboard.cpp b/src/devices/machine/sensorboard.cpp
index 3d4188396dd..0889e80a016 100644
--- a/src/devices/machine/sensorboard.cpp
+++ b/src/devices/machine/sensorboard.cpp
@@ -59,6 +59,8 @@ sensor state instead.
#include "emu.h"
#include "machine/sensorboard.h"
+#include "fileio.h"
+
DEFINE_DEVICE_TYPE(SENSORBOARD, sensorboard_device, "sensorboard", "Sensorboard")
diff --git a/src/devices/machine/serflash.cpp b/src/devices/machine/serflash.cpp
index c616b4d34a7..801a212a592 100644
--- a/src/devices/machine/serflash.cpp
+++ b/src/devices/machine/serflash.cpp
@@ -8,6 +8,8 @@
#include "emu.h"
#include "machine/serflash.h"
+#include "fileio.h"
+
#include <algorithm>
ALLOW_SAVE_TYPE(serflash_device::flash_state_t);
diff --git a/src/devices/machine/sonydriv.cpp b/src/devices/machine/sonydriv.cpp
index d65c1146359..e99c077b02a 100644
--- a/src/devices/machine/sonydriv.cpp
+++ b/src/devices/machine/sonydriv.cpp
@@ -39,6 +39,8 @@
#include "formats/ap_dsk35.h"
#include "imagedev/flopdrv.h"
+#include "fileio.h"
+
#ifdef MAME_DEBUG
#define LOG_SONY 1
diff --git a/src/devices/machine/strata.cpp b/src/devices/machine/strata.cpp
index 7976a16def9..57383ef8e11 100644
--- a/src/devices/machine/strata.cpp
+++ b/src/devices/machine/strata.cpp
@@ -23,6 +23,8 @@
#include "emu.h"
#include "strata.h"
+#include "fileio.h"
+
#define FEEPROM_SIZE 0x800000 // 64Mbit
#define BLOCK_SIZE 0x020000
diff --git a/src/devices/machine/timekpr.cpp b/src/devices/machine/timekpr.cpp
index fbddc56d1ab..bf3225103b8 100644
--- a/src/devices/machine/timekpr.cpp
+++ b/src/devices/machine/timekpr.cpp
@@ -18,6 +18,8 @@
#include "machine/timekpr.h"
#include "machine/timehelp.h"
+#include "fileio.h"
+
#define LOG_GENERAL (1U << 0)
#define LOG_TICKS (1U << 1)
diff --git a/src/devices/machine/x2201.cpp b/src/devices/machine/x2201.cpp
index d93fca101ff..50be117403e 100644
--- a/src/devices/machine/x2201.cpp
+++ b/src/devices/machine/x2201.cpp
@@ -24,6 +24,9 @@
#include "emu.h"
#include "machine/x2201.h"
+
+#include "fileio.h"
+
#include <algorithm>
diff --git a/src/devices/machine/x2212.cpp b/src/devices/machine/x2212.cpp
index cc5028e0cc7..e055f860640 100644
--- a/src/devices/machine/x2212.cpp
+++ b/src/devices/machine/x2212.cpp
@@ -10,6 +10,9 @@
#include "emu.h"
#include "machine/x2212.h"
+
+#include "fileio.h"
+
#include <algorithm>
diff --git a/src/devices/machine/x76f041.cpp b/src/devices/machine/x76f041.cpp
index 06b831eeda6..0f2f0f87f09 100644
--- a/src/devices/machine/x76f041.cpp
+++ b/src/devices/machine/x76f041.cpp
@@ -16,6 +16,8 @@
#include "emu.h"
#include "machine/x76f041.h"
+#include "fileio.h"
+
#define VERBOSE_LEVEL ( 0 )
inline void ATTR_PRINTF( 3, 4 ) x76f041_device::verboselog( int n_level, const char *s_fmt, ... )
diff --git a/src/devices/machine/x76f100.cpp b/src/devices/machine/x76f100.cpp
index b03829265ac..825486c0e27 100644
--- a/src/devices/machine/x76f100.cpp
+++ b/src/devices/machine/x76f100.cpp
@@ -14,6 +14,8 @@
#include "emu.h"
#include "machine/x76f100.h"
+#include "fileio.h"
+
#define VERBOSE_LEVEL ( 0 )
inline void ATTR_PRINTF( 3, 4 ) x76f100_device::verboselog( int n_level, const char *s_fmt, ... )
diff --git a/src/devices/sound/samples.cpp b/src/devices/sound/samples.cpp
index 7663d921475..bd8fbb1144f 100644
--- a/src/devices/sound/samples.cpp
+++ b/src/devices/sound/samples.cpp
@@ -26,6 +26,7 @@
#include "samples.h"
#include "emuopts.h"
+#include "fileio.h"
#include "flac.h"
diff --git a/src/emu/config.cpp b/src/emu/config.cpp
index 792da6f255d..c6b85bb6ae8 100644
--- a/src/emu/config.cpp
+++ b/src/emu/config.cpp
@@ -13,6 +13,7 @@
#include "drivenum.h"
#include "emuopts.h"
+#include "fileio.h"
#include "xmlfile.h"
diff --git a/src/emu/crsshair.cpp b/src/emu/crsshair.cpp
index 3c6a6b807f0..d90cc9a7f5e 100644
--- a/src/emu/crsshair.cpp
+++ b/src/emu/crsshair.cpp
@@ -13,6 +13,7 @@
#include "config.h"
#include "emuopts.h"
+#include "fileio.h"
#include "render.h"
#include "rendutil.h"
#include "screen.h"
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index b8de0298432..9b68c234d2f 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -21,6 +21,7 @@
#include "debugger.h"
#include "emuopts.h"
+#include "fileio.h"
#include "natkeyboard.h"
#include "render.h"
#include "screen.h"
@@ -2191,8 +2192,7 @@ void debugger_commands::execute_rplist(const std::vector<std::string> &params)
void debugger_commands::execute_statesave(const std::vector<std::string> &params)
{
- const std::string &filename(params[0]);
- m_machine.immediate_save(filename.c_str());
+ m_machine.immediate_save(params[0]);
m_console.printf("State save attempted. Please refer to window message popup for results.\n");
}
@@ -2203,8 +2203,7 @@ void debugger_commands::execute_statesave(const std::vector<std::string> &params
void debugger_commands::execute_stateload(const std::vector<std::string> &params)
{
- const std::string &filename(params[0]);
- m_machine.immediate_load(filename.c_str());
+ m_machine.immediate_load(params[0]);
// clear all PC & memory tracks
for (device_t &device : device_enumerator(m_machine.root_device()))
@@ -4259,7 +4258,7 @@ void debugger_commands::execute_unmount(const std::vector<std::string> &params)
void debugger_commands::execute_input(const std::vector<std::string> &params)
{
- m_machine.natkeyboard().post_coded(params[0].c_str());
+ m_machine.natkeyboard().post_coded(params[0]);
}
diff --git a/src/emu/debug/debugcon.cpp b/src/emu/debug/debugcon.cpp
index 32a4888c285..210087ab1c0 100644
--- a/src/emu/debug/debugcon.cpp
+++ b/src/emu/debug/debugcon.cpp
@@ -16,6 +16,7 @@
#include "textbuf.h"
#include "debugger.h"
+#include "fileio.h"
#include "corestr.h"
@@ -86,6 +87,10 @@ debugger_console::debugger_console(running_machine &machine)
}
}
+debugger_console::~debugger_console()
+{
+}
+
/*-------------------------------------------------
exit - frees the console system
diff --git a/src/emu/debug/debugcon.h b/src/emu/debug/debugcon.h
index 5271b0e5ae5..f8a0bafc7c1 100644
--- a/src/emu/debug/debugcon.h
+++ b/src/emu/debug/debugcon.h
@@ -79,6 +79,7 @@ class debugger_console
{
public:
debugger_console(running_machine &machine);
+ ~debugger_console();
// command handling
CMDERR execute_command(const std::string &command, bool echo);
diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp
index b4689bc9892..978702094b9 100644
--- a/src/emu/debug/debugcpu.cpp
+++ b/src/emu/debug/debugcpu.cpp
@@ -19,6 +19,7 @@
#include "debugger.h"
#include "emuopts.h"
+#include "fileio.h"
#include "screen.h"
#include "uiinput.h"
diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp
index 81bd272ef6a..6f01f8f26b5 100644
--- a/src/emu/diimage.cpp
+++ b/src/emu/diimage.cpp
@@ -11,6 +11,7 @@
#include "emu.h"
#include "emuopts.h"
+#include "fileio.h"
#include "romload.h"
#include "softlist.h"
#include "softlist_dev.h"
diff --git a/src/emu/emu.h b/src/emu/emu.h
index 67d879cd772..5ba862171a4 100644
--- a/src/emu/emu.h
+++ b/src/emu/emu.h
@@ -39,12 +39,12 @@
// commonly-referenced utilities imported from lib/util
#include "corealloc.h"
+#include "corefile.h"
+#include "delegate.h"
+#include "hash.h"
#include "palette.h"
// emulator-specific utilities
-#include "hash.h"
-#include "fileio.h"
-#include "delegate.h"
#include "devdelegate.h"
// memory and address spaces
diff --git a/src/emu/emufwd.h b/src/emu/emufwd.h
index 13e6d40865a..6d0528015c4 100644
--- a/src/emu/emufwd.h
+++ b/src/emu/emufwd.h
@@ -152,6 +152,9 @@ class memory_view;
// declared in emuopts.h
class emu_options;
+// declared in fileio.h
+class emu_file;
+
// declared in http.h
class http_manager;
diff --git a/src/emu/hashfile.cpp b/src/emu/hashfile.cpp
index a6107e5e630..8436ad339fb 100644
--- a/src/emu/hashfile.cpp
+++ b/src/emu/hashfile.cpp
@@ -13,6 +13,7 @@
#include "drivenum.h"
#include "emuopts.h"
+#include "fileio.h"
#include "hash.h"
diff --git a/src/emu/image.cpp b/src/emu/image.cpp
index 5e58758eb89..e7f070eb9ea 100644
--- a/src/emu/image.cpp
+++ b/src/emu/image.cpp
@@ -14,6 +14,7 @@
#include "config.h"
#include "drivenum.h"
#include "emuopts.h"
+#include "fileio.h"
#include "softlist.h"
#include "corestr.h"
diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp
index a9b86776247..f96b2a8d323 100644
--- a/src/emu/ioport.cpp
+++ b/src/emu/ioport.cpp
@@ -93,6 +93,7 @@
#include "emu.h"
#include "emuopts.h"
#include "config.h"
+#include "fileio.h"
#include "xmlfile.h"
#include "profiler.h"
#include "ui/uimain.h"
@@ -339,6 +340,117 @@ std::string substitute_player(std::string_view name, u8 player)
return result;
}
+
+
+// ======================> inp_header
+
+// header at the front of INP files
+class inp_header
+{
+public:
+ // parameters
+ static constexpr unsigned MAJVERSION = 3;
+ static constexpr unsigned MINVERSION = 0;
+
+ bool read(emu_file &f)
+ {
+ return f.read(m_data, sizeof(m_data)) == sizeof(m_data);
+ }
+ bool write(emu_file &f) const
+ {
+ return f.write(m_data, sizeof(m_data)) == sizeof(m_data);
+ }
+
+ bool check_magic() const
+ {
+ return 0 == std::memcmp(MAGIC, m_data + OFFS_MAGIC, OFFS_BASETIME - OFFS_MAGIC);
+ }
+ u64 get_basetime() const
+ {
+ return
+ (u64(m_data[OFFS_BASETIME + 0]) << (0 * 8)) |
+ (u64(m_data[OFFS_BASETIME + 1]) << (1 * 8)) |
+ (u64(m_data[OFFS_BASETIME + 2]) << (2 * 8)) |
+ (u64(m_data[OFFS_BASETIME + 3]) << (3 * 8)) |
+ (u64(m_data[OFFS_BASETIME + 4]) << (4 * 8)) |
+ (u64(m_data[OFFS_BASETIME + 5]) << (5 * 8)) |
+ (u64(m_data[OFFS_BASETIME + 6]) << (6 * 8)) |
+ (u64(m_data[OFFS_BASETIME + 7]) << (7 * 8));
+ }
+ unsigned get_majversion() const
+ {
+ return m_data[OFFS_MAJVERSION];
+ }
+ unsigned get_minversion() const
+ {
+ return m_data[OFFS_MINVERSION];
+ }
+ std::string get_sysname() const
+ {
+ return get_string<OFFS_SYSNAME, OFFS_APPDESC>();
+ }
+ std::string get_appdesc() const
+ {
+ return get_string<OFFS_APPDESC, OFFS_END>();
+ }
+
+ void set_magic()
+ {
+ std::memcpy(m_data + OFFS_MAGIC, MAGIC, OFFS_BASETIME - OFFS_MAGIC);
+ }
+ void set_basetime(u64 time)
+ {
+ m_data[OFFS_BASETIME + 0] = u8((time >> (0 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 1] = u8((time >> (1 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 2] = u8((time >> (2 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 3] = u8((time >> (3 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 4] = u8((time >> (4 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 5] = u8((time >> (5 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 6] = u8((time >> (6 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 7] = u8((time >> (7 * 8)) & 0x00ff);
+ }
+ void set_version()
+ {
+ m_data[OFFS_MAJVERSION] = MAJVERSION;
+ m_data[OFFS_MINVERSION] = MINVERSION;
+ }
+ void set_sysname(std::string const &name)
+ {
+ set_string<OFFS_SYSNAME, OFFS_APPDESC>(name);
+ }
+ void set_appdesc(std::string const &desc)
+ {
+ set_string<OFFS_APPDESC, OFFS_END>(desc);
+ }
+
+private:
+ template <std::size_t BEGIN, std::size_t END> void set_string(std::string const &str)
+ {
+ std::size_t const used = (std::min<std::size_t>)(str.size() + 1, END - BEGIN);
+ std::memcpy(m_data + BEGIN, str.c_str(), used);
+ if ((END - BEGIN) > used)
+ std::memset(m_data + BEGIN + used, 0, (END - BEGIN) - used);
+ }
+ template <std::size_t BEGIN, std::size_t END> std::string get_string() const
+ {
+ char const *const begin = reinterpret_cast<char const *>(m_data + BEGIN);
+ return std::string(begin, std::find(begin, reinterpret_cast<char const *>(m_data + END), '\0'));
+ }
+
+ static constexpr std::size_t OFFS_MAGIC = 0x00; // 0x08 bytes
+ static constexpr std::size_t OFFS_BASETIME = 0x08; // 0x08 bytes (little-endian binary integer)
+ static constexpr std::size_t OFFS_MAJVERSION = 0x10; // 0x01 bytes (binary integer)
+ static constexpr std::size_t OFFS_MINVERSION = 0x11; // 0x01 bytes (binary integer)
+ // 0x02 bytes reserved
+ static constexpr std::size_t OFFS_SYSNAME = 0x14; // 0x0c bytes (ASCII)
+ static constexpr std::size_t OFFS_APPDESC = 0x20; // 0x20 bytes (ASCII)
+ static constexpr std::size_t OFFS_END = 0x40;
+
+ static u8 const MAGIC[OFFS_BASETIME - OFFS_MAGIC];
+
+ u8 m_data[OFFS_END];
+};
+
} // anonymous namespace
@@ -1716,8 +1828,6 @@ ioport_manager::ioport_manager(running_machine &machine)
, m_safe_to_read(false)
, m_last_frame_time(attotime::zero)
, m_last_delta_nsec(0)
- , m_record_file(machine.options().input_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)
- , m_playback_file(machine.options().input_directory(), OPEN_FLAG_READ)
, m_playback_accumulated_speed(0)
, m_playback_accumulated_frames(0)
, m_deselected_card_config()
@@ -2793,7 +2903,8 @@ time_t ioport_manager::playback_init()
return 0;
// open the playback file
- std::error_condition const filerr = m_playback_file.open(filename);
+ m_playback_file = std::make_unique<emu_file>(machine().options().input_directory(), OPEN_FLAG_READ);
+ std::error_condition const filerr = m_playback_file->open(filename);
// return an explicit error if file isn't found in given path
if (filerr == std::errc::no_such_file_or_directory)
@@ -2805,7 +2916,7 @@ time_t ioport_manager::playback_init()
// read the header and verify that it is a modern version; if not, print an error
inp_header header;
- if (!header.read(m_playback_file))
+ if (!header.read(*m_playback_file))
fatalerror("Input file is corrupt or invalid (missing header)\n");
if (!header.check_magic())
fatalerror("Input file invalid or in an older, unsupported format\n");
@@ -2825,7 +2936,7 @@ time_t ioport_manager::playback_init()
osd_printf_info("Input file is for machine '%s', not for current machine '%s'\n", sysname, machine().system().name);
// enable compression
- m_playback_stream = util::zlib_read(m_playback_file, 16386);
+ m_playback_stream = util::zlib_read(*m_playback_file, 16386);
return basetime;
}
@@ -2841,7 +2952,7 @@ void ioport_manager::playback_end(const char *message)
{
// close the file
m_playback_stream.reset();
- m_playback_file.close();
+ m_playback_file.reset();
// pop a message
if (message != nullptr)
@@ -2963,7 +3074,8 @@ void ioport_manager::record_init()
return;
// open the record file
- std::error_condition const filerr = m_record_file.open(filename);
+ m_record_file = std::make_unique<emu_file>(machine().options().input_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
+ std::error_condition const filerr = m_record_file->open(filename);
if (filerr)
throw emu_fatalerror("ioport_manager::record_init: Failed to open file for recording (%s:%d %s)", filerr.category().name(), filerr.value(), filerr.message());
@@ -2980,10 +3092,10 @@ void ioport_manager::record_init()
header.set_appdesc(util::string_format("%s %s", emulator_info::get_appname(), emulator_info::get_build_version()));
// write it
- header.write(m_record_file);
+ header.write(*m_record_file);
// enable compression
- m_record_stream = util::zlib_write(m_record_file, 6, 16384);
+ m_record_stream = util::zlib_write(*m_record_file, 6, 16384);
}
@@ -2998,7 +3110,7 @@ void ioport_manager::record_end(const char *message)
{
// close the file
m_record_stream.reset(); // TODO: check for errors flushing the last compressed block before doing this
- m_record_file.close();
+ m_record_file.reset();
// pop a message
if (message != nullptr)
diff --git a/src/emu/ioport.h b/src/emu/ioport.h
index e81cce1e8c4..2d9bd855918 100644
--- a/src/emu/ioport.h
+++ b/src/emu/ioport.h
@@ -662,116 +662,6 @@ typedef device_delegate<void (ioport_field &, u32, ioport_value, ioport_value)>
typedef device_delegate<float (float)> ioport_field_crossmap_delegate;
-// ======================> inp_header
-
-// header at the front of INP files
-class inp_header
-{
-public:
- // parameters
- static constexpr unsigned MAJVERSION = 3;
- static constexpr unsigned MINVERSION = 0;
-
- bool read(emu_file &f)
- {
- return f.read(m_data, sizeof(m_data)) == sizeof(m_data);
- }
- bool write(emu_file &f) const
- {
- return f.write(m_data, sizeof(m_data)) == sizeof(m_data);
- }
-
- bool check_magic() const
- {
- return 0 == std::memcmp(MAGIC, m_data + OFFS_MAGIC, OFFS_BASETIME - OFFS_MAGIC);
- }
- u64 get_basetime() const
- {
- return
- (u64(m_data[OFFS_BASETIME + 0]) << (0 * 8)) |
- (u64(m_data[OFFS_BASETIME + 1]) << (1 * 8)) |
- (u64(m_data[OFFS_BASETIME + 2]) << (2 * 8)) |
- (u64(m_data[OFFS_BASETIME + 3]) << (3 * 8)) |
- (u64(m_data[OFFS_BASETIME + 4]) << (4 * 8)) |
- (u64(m_data[OFFS_BASETIME + 5]) << (5 * 8)) |
- (u64(m_data[OFFS_BASETIME + 6]) << (6 * 8)) |
- (u64(m_data[OFFS_BASETIME + 7]) << (7 * 8));
- }
- unsigned get_majversion() const
- {
- return m_data[OFFS_MAJVERSION];
- }
- unsigned get_minversion() const
- {
- return m_data[OFFS_MINVERSION];
- }
- std::string get_sysname() const
- {
- return get_string<OFFS_SYSNAME, OFFS_APPDESC>();
- }
- std::string get_appdesc() const
- {
- return get_string<OFFS_APPDESC, OFFS_END>();
- }
-
- void set_magic()
- {
- std::memcpy(m_data + OFFS_MAGIC, MAGIC, OFFS_BASETIME - OFFS_MAGIC);
- }
- void set_basetime(u64 time)
- {
- m_data[OFFS_BASETIME + 0] = u8((time >> (0 * 8)) & 0x00ff);
- m_data[OFFS_BASETIME + 1] = u8((time >> (1 * 8)) & 0x00ff);
- m_data[OFFS_BASETIME + 2] = u8((time >> (2 * 8)) & 0x00ff);
- m_data[OFFS_BASETIME + 3] = u8((time >> (3 * 8)) & 0x00ff);
- m_data[OFFS_BASETIME + 4] = u8((time >> (4 * 8)) & 0x00ff);
- m_data[OFFS_BASETIME + 5] = u8((time >> (5 * 8)) & 0x00ff);
- m_data[OFFS_BASETIME + 6] = u8((time >> (6 * 8)) & 0x00ff);
- m_data[OFFS_BASETIME + 7] = u8((time >> (7 * 8)) & 0x00ff);
- }
- void set_version()
- {
- m_data[OFFS_MAJVERSION] = MAJVERSION;
- m_data[OFFS_MINVERSION] = MINVERSION;
- }
- void set_sysname(std::string const &name)
- {
- set_string<OFFS_SYSNAME, OFFS_APPDESC>(name);
- }
- void set_appdesc(std::string const &desc)
- {
- set_string<OFFS_APPDESC, OFFS_END>(desc);
- }
-
-private:
- template <std::size_t BEGIN, std::size_t END> void set_string(std::string const &str)
- {
- std::size_t const used = (std::min<std::size_t>)(str.size() + 1, END - BEGIN);
- std::memcpy(m_data + BEGIN, str.c_str(), used);
- if ((END - BEGIN) > used)
- std::memset(m_data + BEGIN + used, 0, (END - BEGIN) - used);
- }
- template <std::size_t BEGIN, std::size_t END> std::string get_string() const
- {
- char const *const begin = reinterpret_cast<char const *>(m_data + BEGIN);
- return std::string(begin, std::find(begin, reinterpret_cast<char const *>(m_data + END), '\0'));
- }
-
- static constexpr std::size_t OFFS_MAGIC = 0x00; // 0x08 bytes
- static constexpr std::size_t OFFS_BASETIME = 0x08; // 0x08 bytes (little-endian binary integer)
- static constexpr std::size_t OFFS_MAJVERSION = 0x10; // 0x01 bytes (binary integer)
- static constexpr std::size_t OFFS_MINVERSION = 0x11; // 0x01 bytes (binary integer)
- // 0x02 bytes reserved
- static constexpr std::size_t OFFS_SYSNAME = 0x14; // 0x0c bytes (ASCII)
- static constexpr std::size_t OFFS_APPDESC = 0x20; // 0x20 bytes (ASCII)
- static constexpr std::size_t OFFS_END = 0x40;
-
- static u8 const MAGIC[OFFS_BASETIME - OFFS_MAGIC];
-
- u8 m_data[OFFS_END];
-};
-
-
// ======================> input_device_default
// device defined default input settings
@@ -1449,8 +1339,8 @@ private:
attoseconds_t m_last_delta_nsec; // nanoseconds that passed since the previous callback
// playback/record information
- emu_file m_record_file; // recording file (closed if not recording)
- emu_file m_playback_file; // playback file (closed if not recording)
+ std::unique_ptr<emu_file> m_record_file; // recording file (nullptr if not recording)
+ std::unique_ptr<emu_file> m_playback_file; // playback file (nullptr if not recording)
util::write_stream::ptr m_record_stream; // recording stream (nullptr if not recording)
util::read_stream::ptr m_playback_stream; // playback stream (nullptr if not recording)
u64 m_playback_accumulated_speed; // accumulated speed during playback
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp
index 633bde66de8..1d8fe872fd1 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -20,6 +20,7 @@
#include "debug/debugvw.h"
#include "debug/debugcpu.h"
#include "dirtc.h"
+#include "fileio.h"
#include "image.h"
#include "network.h"
#include "romload.h"
@@ -590,10 +591,10 @@ void running_machine::schedule_save(std::string &&filename)
// immediate_save - save state.
//-------------------------------------------------
-void running_machine::immediate_save(const char *filename)
+void running_machine::immediate_save(std::string_view filename)
{
// specify the filename to save or load
- set_saveload_filename(filename);
+ set_saveload_filename(std::string(filename));
// set up some parameters for handle_saveload()
m_saveload_schedule = saveload_schedule::SAVE;
@@ -627,10 +628,10 @@ void running_machine::schedule_load(std::string &&filename)
// immediate_load - load state.
//-------------------------------------------------
-void running_machine::immediate_load(const char *filename)
+void running_machine::immediate_load(std::string_view filename)
{
// specify the filename to save or load
- set_saveload_filename(filename);
+ set_saveload_filename(std::string(filename));
// set up some parameters for handle_saveload()
m_saveload_schedule = saveload_schedule::LOAD;
@@ -1121,6 +1122,7 @@ void running_machine::nvram_load()
emu_file file(options().nvram_directory(), OPEN_FLAG_READ);
if (!file.open(nvram_filename(nvram.device())))
{
+ // FIXME: don't swallow errors
nvram.nvram_load(file);
file.close();
}
@@ -1143,6 +1145,7 @@ void running_machine::nvram_save()
emu_file file(options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (!file.open(nvram_filename(nvram.device())))
{
+ // FIXME: don't swallow errors
nvram.nvram_save(file);
file.close();
}
diff --git a/src/emu/machine.h b/src/emu/machine.h
index 3b736e58dff..4870c232e3a 100644
--- a/src/emu/machine.h
+++ b/src/emu/machine.h
@@ -177,8 +177,8 @@ public:
void export_http_api();
// TODO: Do saves and loads still require scheduling?
- void immediate_save(const char *filename);
- void immediate_load(const char *filename);
+ void immediate_save(std::string_view filename);
+ void immediate_load(std::string_view filename);
// rewind operations
bool rewind_capture();
diff --git a/src/emu/recording.cpp b/src/emu/recording.cpp
index 9e3c1f3f4ae..611e5ae327b 100644
--- a/src/emu/recording.cpp
+++ b/src/emu/recording.cpp
@@ -9,7 +9,10 @@
***************************************************************************/
#include "emu.h"
+
+#include "fileio.h"
#include "screen.h"
+
#include "aviio.h"
#include "png.h"
diff --git a/src/emu/render.cpp b/src/emu/render.cpp
index 0cd396ac52c..b9a96e81fad 100644
--- a/src/emu/render.cpp
+++ b/src/emu/render.cpp
@@ -41,6 +41,7 @@
#include "corestr.h"
#include "emuopts.h"
+#include "fileio.h"
#include "rendfont.h"
#include "rendlay.h"
#include "rendutil.h"
diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp
index 9984bf9497b..3d79f0e6ac2 100644
--- a/src/emu/rendfont.cpp
+++ b/src/emu/rendfont.cpp
@@ -10,7 +10,10 @@
#include "emu.h"
#include "rendfont.h"
+
#include "emuopts.h"
+#include "fileio.h"
+
#include "corestr.h"
#include "coreutil.h"
diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp
index 28011b8372c..88cc161e22f 100644
--- a/src/emu/rendlay.cpp
+++ b/src/emu/rendlay.cpp
@@ -13,6 +13,7 @@
#include "rendlay.h"
#include "emuopts.h"
+#include "fileio.h"
#include "rendfont.h"
#include "rendutil.h"
#include "video/rgbutil.h"
diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp
index bdff58a4a41..f408f865004 100644
--- a/src/emu/romload.cpp
+++ b/src/emu/romload.cpp
@@ -11,12 +11,14 @@
#include "emu.h"
#include "romload.h"
-#include "corestr.h"
-#include "emuopts.h"
#include "drivenum.h"
+#include "emuopts.h"
+#include "fileio.h"
#include "softlist_dev.h"
#include "ui/uimain.h"
+#include "corestr.h"
+
#include <algorithm>
#include <set>
diff --git a/src/emu/save.cpp b/src/emu/save.cpp
index a27a98ee23c..b8acfa24b0a 100644
--- a/src/emu/save.cpp
+++ b/src/emu/save.cpp
@@ -208,7 +208,7 @@ void save_manager::save_memory(device_t *device, const char *module, const char
// state
//-------------------------------------------------
-save_error save_manager::check_file(running_machine &machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...))
+save_error save_manager::check_file(running_machine &machine, util::core_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...))
{
// if we want to validate the signature, compute it
u32 sig;
@@ -217,7 +217,8 @@ save_error save_manager::check_file(running_machine &machine, emu_file &file, co
// seek to the beginning and read the header
file.seek(0, SEEK_SET);
u8 header[HEADER_SIZE];
- if (file.read(header, sizeof(header)) != sizeof(header))
+ size_t actual(0);
+ if (file.read(header, sizeof(header), actual) || actual != sizeof(header))
{
if (errormsg != nullptr)
(*errormsg)("Could not read %s save file header",emulator_info::get_appname());
@@ -257,7 +258,7 @@ void save_manager::dispatch_presave()
// write_file - writes the data to a file
//-------------------------------------------------
-save_error save_manager::write_file(emu_file &file)
+save_error save_manager::write_file(util::core_file &file)
{
util::write_stream::ptr writer;
save_error err = do_write(
@@ -290,7 +291,7 @@ save_error save_manager::write_file(emu_file &file)
// read_file - read the data from a file
//-------------------------------------------------
-save_error save_manager::read_file(emu_file &file)
+save_error save_manager::read_file(util::core_file &file)
{
util::read_stream::ptr reader;
return do_read(
diff --git a/src/emu/save.h b/src/emu/save.h
index 2ea17ab9921..677f127853a 100644
--- a/src/emu/save.h
+++ b/src/emu/save.h
@@ -300,9 +300,9 @@ public:
{ save_pointer(nullptr, "global", nullptr, index, std::forward<ItemType>(value), element, valname, count); }
// file processing
- static save_error check_file(running_machine &machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...));
- save_error write_file(emu_file &file);
- save_error read_file(emu_file &file);
+ static save_error check_file(running_machine &machine, util::core_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...));
+ save_error write_file(util::core_file &file);
+ save_error read_file(util::core_file &file);
save_error write_stream(std::ostream &str);
save_error read_stream(std::istream &str);
diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp
index 8ecd87663ae..e721ba80b03 100644
--- a/src/emu/screen.cpp
+++ b/src/emu/screen.cpp
@@ -12,6 +12,7 @@
#include "screen.h"
#include "emuopts.h"
+#include "fileio.h"
#include "render.h"
#include "rendutil.h"
diff --git a/src/emu/softlist_dev.cpp b/src/emu/softlist_dev.cpp
index 7d25dd17013..c6a32f0b30f 100644
--- a/src/emu/softlist_dev.cpp
+++ b/src/emu/softlist_dev.cpp
@@ -13,6 +13,7 @@
#include "diimage.h"
#include "emuopts.h"
+#include "fileio.h"
#include "romload.h"
#include "validity.h"
diff --git a/src/emu/video.cpp b/src/emu/video.cpp
index 5d3691c08c9..6a6c75477aa 100644
--- a/src/emu/video.cpp
+++ b/src/emu/video.cpp
@@ -11,6 +11,7 @@
#include "emu.h"
#include "emuopts.h"
#include "debugger.h"
+#include "fileio.h"
#include "ui/uimain.h"
#include "crsshair.h"
#include "rendersw.hxx"
@@ -318,7 +319,7 @@ std::string video_manager::speed_text()
// file handle
//-------------------------------------------------
-void video_manager::save_snapshot(screen_device *screen, emu_file &file)
+void video_manager::save_snapshot(screen_device *screen, util::core_file &file)
{
// validate
assert(!m_snap_native || screen != nullptr);
diff --git a/src/emu/video.h b/src/emu/video.h
index 5be473ec7e3..da57d6b8a98 100644
--- a/src/emu/video.h
+++ b/src/emu/video.h
@@ -78,7 +78,7 @@ public:
// snapshots
bool snap_native() const { return m_snap_native; }
render_target &snapshot_target() { return *m_snap_target; }
- void save_snapshot(screen_device *screen, emu_file &file);
+ void save_snapshot(screen_device *screen, util::core_file &file);
void save_active_screen_snapshots();
// movies
diff --git a/src/frontend/mame/audit.cpp b/src/frontend/mame/audit.cpp
index 0a37c4a3fff..f4d1d2e1438 100644
--- a/src/frontend/mame/audit.cpp
+++ b/src/frontend/mame/audit.cpp
@@ -15,6 +15,7 @@
#include "emuopts.h"
#include "drivenum.h"
+#include "fileio.h"
#include "romload.h"
#include "softlist_dev.h"
diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp
index c16316e8d02..d5221a71213 100644
--- a/src/frontend/mame/cheat.cpp
+++ b/src/frontend/mame/cheat.cpp
@@ -81,6 +81,7 @@
#include "corestr.h"
#include "emuopts.h"
+#include "fileio.h"
#include <cstring>
#include <iterator>
diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp
index 6a657a7735f..4afcad8a1ae 100644
--- a/src/frontend/mame/clifront.cpp
+++ b/src/frontend/mame/clifront.cpp
@@ -23,6 +23,7 @@
#include "pluginopts.h"
#include "emuopts.h"
+#include "fileio.h"
#include "romload.h"
#include "softlist_dev.h"
#include "validity.h"
diff --git a/src/frontend/mame/language.cpp b/src/frontend/mame/language.cpp
index 6602dffaa8e..3e660130ffd 100644
--- a/src/frontend/mame/language.cpp
+++ b/src/frontend/mame/language.cpp
@@ -12,6 +12,7 @@
#include "language.h"
#include "emuopts.h"
+#include "fileio.h"
#include "corestr.h"
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index 831f445faa5..b6fc0014a4c 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -21,6 +21,7 @@
#include "debugger.h"
#include "drivenum.h"
#include "emuopts.h"
+#include "fileio.h"
#include "inputdev.h"
#include "natkeyboard.h"
#include "screen.h"
diff --git a/src/frontend/mame/mame.cpp b/src/frontend/mame/mame.cpp
index c7bc0879909..486f3a8db66 100644
--- a/src/frontend/mame/mame.cpp
+++ b/src/frontend/mame/mame.cpp
@@ -19,6 +19,7 @@
#include "cheat.h"
#include "clifront.h"
#include "emuopts.h"
+#include "fileio.h"
#include "luaengine.h"
#include "mameopts.h"
#include "pluginopts.h"
diff --git a/src/frontend/mame/mameopts.cpp b/src/frontend/mame/mameopts.cpp
index a1d370ddb74..bbdf8a692b4 100644
--- a/src/frontend/mame/mameopts.cpp
+++ b/src/frontend/mame/mameopts.cpp
@@ -12,6 +12,7 @@
#include "mameopts.h"
#include "drivenum.h"
+#include "fileio.h"
#include "screen.h"
#include "softlist_dev.h"
#include "zippath.h"
diff --git a/src/frontend/mame/ui/auditmenu.cpp b/src/frontend/mame/ui/auditmenu.cpp
index a5cb46fc4d8..651464cfdab 100644
--- a/src/frontend/mame/ui/auditmenu.cpp
+++ b/src/frontend/mame/ui/auditmenu.cpp
@@ -17,6 +17,7 @@
#include "audit.h"
#include "drivenum.h"
+#include "fileio.h"
#include "uiinput.h"
#include "util/corestr.h"
diff --git a/src/frontend/mame/ui/custui.cpp b/src/frontend/mame/ui/custui.cpp
index 02da9310207..9359bc5d4a8 100644
--- a/src/frontend/mame/ui/custui.cpp
+++ b/src/frontend/mame/ui/custui.cpp
@@ -17,6 +17,7 @@
#include "drivenum.h"
#include "emuopts.h"
+#include "fileio.h"
#include "uiinput.h"
#include "corestr.h"
diff --git a/src/frontend/mame/ui/dirmenu.cpp b/src/frontend/mame/ui/dirmenu.cpp
index d37217afd9d..32916d6e8f0 100644
--- a/src/frontend/mame/ui/dirmenu.cpp
+++ b/src/frontend/mame/ui/dirmenu.cpp
@@ -16,6 +16,7 @@
#include "ui/optsmenu.h"
#include "emuopts.h"
+#include "fileio.h"
#include "mame.h"
#include "util/corestr.h"
diff --git a/src/frontend/mame/ui/inifile.cpp b/src/frontend/mame/ui/inifile.cpp
index 07d9dd85b62..6cf9886324d 100644
--- a/src/frontend/mame/ui/inifile.cpp
+++ b/src/frontend/mame/ui/inifile.cpp
@@ -16,6 +16,7 @@
#include "language.h"
#include "drivenum.h"
+#include "fileio.h"
#include "softlist_dev.h"
#include "corestr.h"
diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp
index 1b8290f77f5..c69b792e1c0 100644
--- a/src/frontend/mame/ui/menu.cpp
+++ b/src/frontend/mame/ui/menu.cpp
@@ -21,6 +21,7 @@
#include "corestr.h"
#include "drivenum.h"
+#include "fileio.h"
#include "rendutil.h"
#include "uiinput.h"
diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp
index 0d052562fa0..aef5a60a7c3 100644
--- a/src/frontend/mame/ui/miscmenu.cpp
+++ b/src/frontend/mame/ui/miscmenu.cpp
@@ -24,6 +24,7 @@
#include "mameopts.h"
#include "pluginopts.h"
#include "drivenum.h"
+#include "fileio.h"
#include "romload.h"
#include "uiinput.h"
diff --git a/src/frontend/mame/ui/optsmenu.cpp b/src/frontend/mame/ui/optsmenu.cpp
index d21f069f6f7..bafbe9d2af0 100644
--- a/src/frontend/mame/ui/optsmenu.cpp
+++ b/src/frontend/mame/ui/optsmenu.cpp
@@ -22,6 +22,8 @@
#include "mame.h"
#include "mameopts.h"
+
+#include "fileio.h"
#include "rendfont.h"
diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp
index 77fcefd208e..abda7047971 100644
--- a/src/frontend/mame/ui/selgame.cpp
+++ b/src/frontend/mame/ui/selgame.cpp
@@ -28,6 +28,7 @@
#include "corestr.h"
#include "drivenum.h"
#include "emuopts.h"
+#include "fileio.h"
#include "rendutil.h"
#include "romload.h"
#include "softlist_dev.h"
diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp
index 3c16f83f112..85efff4b8cd 100644
--- a/src/frontend/mame/ui/selmenu.cpp
+++ b/src/frontend/mame/ui/selmenu.cpp
@@ -27,6 +27,7 @@
#include "corestr.h"
#include "drivenum.h"
#include "emuopts.h"
+#include "fileio.h"
#include "rendfont.h"
#include "rendutil.h"
#include "romload.h"
diff --git a/src/frontend/mame/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp
index c5c32303e93..dc3904f2169 100644
--- a/src/frontend/mame/ui/selsoft.cpp
+++ b/src/frontend/mame/ui/selsoft.cpp
@@ -19,6 +19,7 @@
#include "corestr.h"
#include "drivenum.h"
#include "emuopts.h"
+#include "fileio.h"
#include "mame.h"
#include "rendutil.h"
#include "softlist_dev.h"
diff --git a/src/frontend/mame/ui/simpleselgame.cpp b/src/frontend/mame/ui/simpleselgame.cpp
index 7cb346ee397..3a230e88a89 100644
--- a/src/frontend/mame/ui/simpleselgame.cpp
+++ b/src/frontend/mame/ui/simpleselgame.cpp
@@ -20,6 +20,7 @@
#include "audit.h"
#include "drivenum.h"
#include "emuopts.h"
+#include "fileio.h"
#include "mame.h"
#include "uiinput.h"
diff --git a/src/frontend/mame/ui/systemlist.cpp b/src/frontend/mame/ui/systemlist.cpp
index a05ebeecc12..5038c7e9783 100644
--- a/src/frontend/mame/ui/systemlist.cpp
+++ b/src/frontend/mame/ui/systemlist.cpp
@@ -14,6 +14,7 @@
#include "ui/moptions.h"
#include "drivenum.h"
+#include "fileio.h"
#include "util/corestr.h"
#include "util/unicode.h"
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index c9dae332ea6..8813251976c 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -33,6 +33,7 @@
#include "emuopts.h"
#include "mameopts.h"
#include "drivenum.h"
+#include "fileio.h"
#include "natkeyboard.h"
#include "render.h"
#include "cheat.h"
diff --git a/src/mame/drivers/ldplayer.cpp b/src/mame/drivers/ldplayer.cpp
index 9c60fe06453..a8150b2d7cc 100644
--- a/src/mame/drivers/ldplayer.cpp
+++ b/src/mame/drivers/ldplayer.cpp
@@ -17,6 +17,7 @@
#include "ui/uimain.h"
#include "emuopts.h"
+#include "fileio.h"
#include "romload.h"
#include "speaker.h"
#include "screen.h"
diff --git a/src/mame/drivers/ngp.cpp b/src/mame/drivers/ngp.cpp
index 412fd75a81b..e4a57483617 100644
--- a/src/mame/drivers/ngp.cpp
+++ b/src/mame/drivers/ngp.cpp
@@ -105,6 +105,7 @@ the Neogeo Pocket.
#include "sound/t6w28.h"
#include "sound/dac.h"
#include "video/k1ge.h"
+#include "fileio.h"
#include "screen.h"
#include "softlist_dev.h"
#include "speaker.h"
diff --git a/src/mame/machine/cuda.cpp b/src/mame/machine/cuda.cpp
index 83f8f126494..4442c6f9287 100644
--- a/src/mame/machine/cuda.cpp
+++ b/src/mame/machine/cuda.cpp
@@ -43,6 +43,8 @@
#include "cpu/m6805/m6805.h"
#include "sound/asc.h"
+#include "fileio.h"
+
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
diff --git a/src/mame/machine/docg3.cpp b/src/mame/machine/docg3.cpp
index 13e7fcee3a5..e9210144b31 100644
--- a/src/mame/machine/docg3.cpp
+++ b/src/mame/machine/docg3.cpp
@@ -11,6 +11,8 @@
#include "emu.h"
#include "machine/docg3.h"
+#include "fileio.h"
+
#define VERBOSE_LEVEL ( 0 )
static inline void ATTR_PRINTF(3,4) verboselog( device_t &device, int n_level, const char *s_fmt, ... )
diff --git a/src/mame/machine/egret.cpp b/src/mame/machine/egret.cpp
index f62c8484821..fa3d641545e 100644
--- a/src/mame/machine/egret.cpp
+++ b/src/mame/machine/egret.cpp
@@ -42,6 +42,8 @@
#include "cpu/m6805/m6805.h"
#include "sound/asc.h"
+#include "fileio.h"
+
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
diff --git a/src/mame/machine/kr1601rr1.cpp b/src/mame/machine/kr1601rr1.cpp
index 30da9ff9534..836fd981813 100644
--- a/src/mame/machine/kr1601rr1.cpp
+++ b/src/mame/machine/kr1601rr1.cpp
@@ -13,9 +13,10 @@
***************************************************************************/
#include "emu.h"
-
#include "kr1601rr1.h"
+#include "fileio.h"
+
#include <algorithm>
diff --git a/src/mame/machine/m3comm.h b/src/mame/machine/m3comm.h
index 529c0bec578..e0dfdb074c0 100644
--- a/src/mame/machine/m3comm.h
+++ b/src/mame/machine/m3comm.h
@@ -8,6 +8,8 @@
#include "machine/ram.h"
#include "cpu/m68000/m68000.h"
+#include "fileio.h"
+
//**************************************************************************
// TYPE DEFINITIONS
diff --git a/src/mame/machine/macrtc.cpp b/src/mame/machine/macrtc.cpp
index 19e0909c8d5..fcd64f34604 100644
--- a/src/mame/machine/macrtc.cpp
+++ b/src/mame/machine/macrtc.cpp
@@ -14,6 +14,8 @@
#include "emu.h"
#include "macrtc.h"
+#include "fileio.h"
+
#ifdef MAME_DEBUG
#define LOG_RTC 0
#else
diff --git a/src/mame/machine/midwayic.cpp b/src/mame/machine/midwayic.cpp
index 9db6471d4d3..8f6ed497403 100644
--- a/src/mame/machine/midwayic.cpp
+++ b/src/mame/machine/midwayic.cpp
@@ -7,9 +7,10 @@
***************************************************************************/
#include "emu.h"
-#include "debugger.h"
#include "midwayic.h"
+#include "fileio.h"
+
#define LOG_NVRAM (0)
diff --git a/src/mame/machine/msx_matsushita.cpp b/src/mame/machine/msx_matsushita.cpp
index 169fd809458..10e989419c6 100644
--- a/src/mame/machine/msx_matsushita.cpp
+++ b/src/mame/machine/msx_matsushita.cpp
@@ -3,6 +3,8 @@
#include "emu.h"
#include "msx_matsushita.h"
+#include "fileio.h"
+
const uint8_t manufacturer_id = 0x08;
DEFINE_DEVICE_TYPE(MSX_MATSUSHITA, msx_matsushita_device, "msx_matsushita", "Matsushita switched device")
diff --git a/src/mame/machine/msx_s1985.cpp b/src/mame/machine/msx_s1985.cpp
index 5e562e5cbbf..fbe6ccafb8a 100644
--- a/src/mame/machine/msx_s1985.cpp
+++ b/src/mame/machine/msx_s1985.cpp
@@ -3,6 +3,8 @@
#include "emu.h"
#include "msx_s1985.h"
+#include "fileio.h"
+
const uint8_t manufacturer_id = 0xfe;
DEFINE_DEVICE_TYPE(MSX_S1985, msx_s1985_device, "msx_s1985", "MSX-Engine S1985")
diff --git a/src/mame/machine/pc9801_memsw.cpp b/src/mame/machine/pc9801_memsw.cpp
index 93392aefc0f..e636eebc841 100644
--- a/src/mame/machine/pc9801_memsw.cpp
+++ b/src/mame/machine/pc9801_memsw.cpp
@@ -78,7 +78,9 @@
#include "emu.h"
#include "pc9801_memsw.h"
+
#include "coreutil.h"
+#include "fileio.h"
//**************************************************************************
// GLOBAL VARIABLES
diff --git a/src/mame/machine/tosh1000_bram.cpp b/src/mame/machine/tosh1000_bram.cpp
index 391539472b6..401467c078e 100644
--- a/src/mame/machine/tosh1000_bram.cpp
+++ b/src/mame/machine/tosh1000_bram.cpp
@@ -11,6 +11,8 @@
#include "emu.h"
#include "tosh1000_bram.h"
+#include "fileio.h"
+
#include <algorithm>
diff --git a/src/mame/machine/zs01.cpp b/src/mame/machine/zs01.cpp
index c5e4606ec91..eb93c5c6ead 100644
--- a/src/mame/machine/zs01.cpp
+++ b/src/mame/machine/zs01.cpp
@@ -14,6 +14,8 @@
#include "emu.h"
#include "machine/zs01.h"
+#include "fileio.h"
+
#define VERBOSE_LEVEL ( 0 )
inline void ATTR_PRINTF( 3, 4 ) zs01_device::verboselog( int n_level, const char *s_fmt, ... )
diff --git a/src/mame/video/midtunit.cpp b/src/mame/video/midtunit.cpp
index 1e6d4e812da..b4189bd1d55 100644
--- a/src/mame/video/midtunit.cpp
+++ b/src/mame/video/midtunit.cpp
@@ -18,6 +18,7 @@
#include "debugger.h"
#include "emuopts.h" // Used by PNG logging
+#include "fileio.h" // Used by PNG logging
#include "png.h" // Used by PNG logging
#include <rapidjson/prettywriter.h> // Used by JSON logging
diff --git a/src/osd/modules/debugger/debuggdbstub.cpp b/src/osd/modules/debugger/debuggdbstub.cpp
index 9f26fb2c778..5e477200dc2 100644
--- a/src/osd/modules/debugger/debuggdbstub.cpp
+++ b/src/osd/modules/debugger/debuggdbstub.cpp
@@ -13,6 +13,7 @@
#include "debug/textbuf.h"
#include "debug_module.h"
#include "debugger.h"
+#include "fileio.h"
#include "modules/lib/osdobj_common.h"
#include "modules/osdmodule.h"
diff --git a/src/osd/modules/render/aviwrite.cpp b/src/osd/modules/render/aviwrite.cpp
index ec6ce21c543..9148244111b 100644
--- a/src/osd/modules/render/aviwrite.cpp
+++ b/src/osd/modules/render/aviwrite.cpp
@@ -10,6 +10,7 @@
#include "aviwrite.h"
#include "modules/lib/osdobj_common.h"
+#include "fileio.h"
#include "screen.h"
diff --git a/src/osd/modules/render/bgfx/chainentryreader.cpp b/src/osd/modules/render/bgfx/chainentryreader.cpp
index ba3ae1c9e67..c179992c6b0 100644
--- a/src/osd/modules/render/bgfx/chainentryreader.cpp
+++ b/src/osd/modules/render/bgfx/chainentryreader.cpp
@@ -9,6 +9,7 @@
#include <string>
#include "emu.h"
+#include "fileio.h"
#include "rendutil.h"
#include <modules/render/copyutil.h>
diff --git a/src/osd/modules/render/bgfx/texturemanager.cpp b/src/osd/modules/render/bgfx/texturemanager.cpp
index 1fe6fe13b60..a61d77c9177 100644
--- a/src/osd/modules/render/bgfx/texturemanager.cpp
+++ b/src/osd/modules/render/bgfx/texturemanager.cpp
@@ -14,6 +14,7 @@
#include "texturemanager.h"
#include "texture.h"
#include "bgfxutil.h"
+#include "fileio.h"
#include "rendutil.h"
#include "modules/render/copyutil.h"
diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp
index eabcd5bcb81..599da82c8d3 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.cpp
+++ b/src/osd/modules/render/d3d/d3dhlsl.cpp
@@ -13,6 +13,7 @@
#include "rendlay.h"
#include "rendutil.h"
#include "emuopts.h"
+#include "fileio.h"
#include "aviio.h"
#include "png.h"
#include "screen.h"