summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/devices/bus/a2bus/a2cffa.cpp4
-rw-r--r--src/devices/bus/abcbus/ssa.h4
-rw-r--r--src/devices/bus/ata/cr589.cpp2
-rw-r--r--src/devices/bus/c64/dqbb.h4
-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.cpp6
-rw-r--r--src/devices/bus/pofo/hpc104.h4
-rw-r--r--src/devices/bus/pofo/ram.h4
-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.cpp5
-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.cpp5
-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.cpp7
-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.cpp6
-rw-r--r--src/devices/machine/x2212.cpp6
-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.cpp22
-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.cpp7
-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, 411 insertions, 149 deletions
diff --git a/src/devices/bus/a2bus/a2cffa.cpp b/src/devices/bus/a2bus/a2cffa.cpp
index 8eab784d572..bf1fe956f86 100644
--- a/src/devices/bus/a2bus/a2cffa.cpp
+++ b/src/devices/bus/a2bus/a2cffa.cpp
@@ -18,6 +18,10 @@
#include "bus/ata/ataintf.h"
<<<<<<< HEAD
+<<<<<<< HEAD
+=======
+#include "fileio.h"
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
#include "softlist.h"
=======
#include "softlist_dev.h"
diff --git a/src/devices/bus/abcbus/ssa.h b/src/devices/bus/abcbus/ssa.h
index ec01d79dcca..2f5f99e5eb4 100644
--- a/src/devices/bus/abcbus/ssa.h
+++ b/src/devices/bus/abcbus/ssa.h
@@ -13,9 +13,13 @@
#include "abcbus.h"
<<<<<<< HEAD
+<<<<<<< HEAD
#include "machine/nvram.h"
=======
>>>>>>> upstream/master
+=======
+#include "fileio.h"
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
diff --git a/src/devices/bus/ata/cr589.cpp b/src/devices/bus/ata/cr589.cpp
index 5905a54bd54..2b511ab93d8 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 91c3c1caede..1fb607b9304 100644
--- a/src/devices/bus/c64/dqbb.h
+++ b/src/devices/bus/c64/dqbb.h
@@ -14,9 +14,13 @@
#include "exp.h"
<<<<<<< HEAD
+<<<<<<< HEAD
#include "machine/nvram.h"
=======
>>>>>>> upstream/master
+=======
+#include "fileio.h"
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
diff --git a/src/devices/bus/c64/fcc.h b/src/devices/bus/c64/fcc.h
index 33baea0707c..00e5e31c37c 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 d54e8e18cc4..d3580750310 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 3c128a10266..c2a6d8b5b2d 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 8baf43bd98a..8be51e27f75 100644
--- a/src/devices/bus/pce/pce_rom.cpp
+++ b/src/devices/bus/pce/pce_rom.cpp
@@ -13,9 +13,15 @@
#include "pce_rom.h"
<<<<<<< HEAD
+<<<<<<< HEAD
=======
>>>>>>> upstream/master
+=======
+#include "fileio.h"
+
+
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
//-------------------------------------------------
// pce_rom_device - constructor
diff --git a/src/devices/bus/pofo/hpc104.h b/src/devices/bus/pofo/hpc104.h
index 1d6bf7ad553..9f6884a8fe5 100644
--- a/src/devices/bus/pofo/hpc104.h
+++ b/src/devices/bus/pofo/hpc104.h
@@ -14,9 +14,13 @@
#include "exp.h"
#include "bus/pofo/ccm.h"
<<<<<<< HEAD
+<<<<<<< HEAD
#include "machine/nvram.h"
=======
>>>>>>> upstream/master
+=======
+#include "fileio.h"
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
diff --git a/src/devices/bus/pofo/ram.h b/src/devices/bus/pofo/ram.h
index 61516e2226b..170d181dcd5 100644
--- a/src/devices/bus/pofo/ram.h
+++ b/src/devices/bus/pofo/ram.h
@@ -13,9 +13,13 @@
#include "ccm.h"
<<<<<<< HEAD
+<<<<<<< HEAD
#include "machine/nvram.h"
=======
>>>>>>> upstream/master
+=======
+#include "fileio.h"
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
diff --git a/src/devices/bus/s100/seals8k.cpp b/src/devices/bus/s100/seals8k.cpp
index 58a040efad4..eec2c936e1d 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 2cee3467dea..f01a8b8fd6f 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 212207665e2..22c667f3d39 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 bc07ad4b4ed..5e075ac30bf 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 9afcae2e035..7be6e53d68f 100644
--- a/src/devices/bus/ti99/peb/evpc.cpp
+++ b/src/devices/bus/ti99/peb/evpc.cpp
@@ -41,9 +41,14 @@
#include "emu.h"
#include "evpc.h"
<<<<<<< HEAD
+<<<<<<< HEAD
=======
>>>>>>> upstream/master
+=======
+
+#include "fileio.h"
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.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 52827ac324f..d234d9c93a1 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 e1c691a9a4b..ef2116b5697 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 845d46bb31f..0c6cec94765 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 6728729c11e..1dc0266f73f 100644
--- a/src/devices/cpu/mcs51/mcs51.cpp
+++ b/src/devices/cpu/mcs51/mcs51.cpp
@@ -131,11 +131,14 @@
*/
#include "emu.h"
-#include "debugger.h"
#include "mcs51.h"
#include "mcs51dasm.h"
#include "debugger.h"
+<<<<<<< HEAD
+=======
+#include "fileio.h"
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
#define VERBOSE 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 60351ee7565..8609839225a 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 575b7e71308..4590887286b 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 098454a771e..ccd44ef0aed 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 c701c13c557..2d287f43b3f 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 890cd78ac59..4b16fb96da8 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 7c8b2060869..192a99d8712 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 55434819a10..e141e687fde 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 86682d1c7a3..eb75dd74e39 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 e1070113277..ff03134c931 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 5a723d5f259..1f8099bdce7 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 7bc8689f3a2..bfb5f4dd179 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 e9455585242..e88f96a2950 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 d6dacf90815..12a6bd4520f 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 6a279d80986..3000e31865b 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 2ee3b1697c1..e9f72fb76c3 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 79ec1bc7d6e..35faa205720 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 678c044122a..d23bec2833b 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 a95e907c5c0..1f1a4272903 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 e21d8c6b6ee..e437a63e584 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 b67b8b57ad1..f4559a72b3f 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 917ca444215..1a095d1e4b7 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 a6a674c19e3..67797df8b98 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 937f9e815e1..5b5d68f9d17 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 d0990b0606e..449c22ec252 100644
--- a/src/devices/machine/mc146818.cpp
+++ b/src/devices/machine/mc146818.cpp
@@ -12,7 +12,14 @@
*********************************************************************/
#include "emu.h"
+<<<<<<< HEAD
#include "coreutil.h"
+=======
+#include "machine/mc146818.h"
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.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 abbddf5b9be..4e29f02dd08 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 9dc1f8df642..08a063bb168 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 b2fd50626f9..f71e6aad54c 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 84c07477e9a..fd87803a424 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 ebad0d9e90e..200a1f59b3d 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 b2ed3a49272..ad43b19722f 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 50443421ba5..b164b2c4e38 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 5ddc59ddb5f..2d45881968b 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 a16ce296dde..83831a0194b 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 6bc9bbf64eb..065c3e6913b 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 815cb829d85..e1345076994 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 e9edf3a892a..83a5c5ef08b 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 c7589e6f58e..2d645f8e5c6 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 15841fe4597..ceb4044053e 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 645a4604c8a..2bf22ac47b7 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 e05df4dd5da..c47b1cd52aa 100644
--- a/src/devices/machine/x2201.cpp
+++ b/src/devices/machine/x2201.cpp
@@ -25,9 +25,15 @@
#include "emu.h"
#include "machine/x2201.h"
<<<<<<< HEAD
+<<<<<<< HEAD
=======
>>>>>>> upstream/master
+=======
+
+#include "fileio.h"
+
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
#include <algorithm>
diff --git a/src/devices/machine/x2212.cpp b/src/devices/machine/x2212.cpp
index a2867e87478..c90dd2e4540 100644
--- a/src/devices/machine/x2212.cpp
+++ b/src/devices/machine/x2212.cpp
@@ -11,9 +11,15 @@
#include "emu.h"
#include "machine/x2212.h"
<<<<<<< HEAD
+<<<<<<< HEAD
=======
>>>>>>> upstream/master
+=======
+
+#include "fileio.h"
+
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
#include <algorithm>
diff --git a/src/devices/machine/x76f041.cpp b/src/devices/machine/x76f041.cpp
index 01a858df8e5..151bd4104f3 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 dde7cf95161..f00228edf5d 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 829c36c2063..2915ef342db 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"
@@ -2188,8 +2189,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");
}
@@ -2200,8 +2200,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()))
@@ -4256,7 +4255,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 08af09c3dab..508c2377f54 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 45da39badc4..974a43e656a 100644
--- a/src/emu/debug/debugcon.h
+++ b/src/emu/debug/debugcon.h
@@ -78,6 +78,7 @@ class debugger_console
{
public:
debugger_console(running_machine &machine);
+ ~debugger_console();
// command handling
CMDERR execute_command(std::string_view 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 28bfe54e040..5999a75abe5 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
@@ -1734,8 +1846,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()
@@ -2811,7 +2921,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)
@@ -2823,7 +2934,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");
@@ -2843,7 +2954,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;
}
@@ -2859,7 +2970,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)
@@ -2981,7 +3092,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());
@@ -2998,10 +3110,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);
}
@@ -3016,7 +3128,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 98ee3f53241..76f61debcac 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
@@ -1451,8 +1341,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 b5683e54dc9..c9cb9cc3e6f 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -16,9 +16,13 @@
#include "debug/debugvw.h"
#include "debugger.h"
#include "dirtc.h"
+<<<<<<< HEAD
#include "emuopts.h"
#include "fileio.h"
#include "http.h"
+=======
+#include "fileio.h"
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
#include "image.h"
#include "natkeyboard.h"
#include "network.h"
@@ -593,10 +597,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;
@@ -630,10 +634,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;
@@ -1135,8 +1139,13 @@ void running_machine::nvram_load()
emu_file file(options().nvram_directory(), OPEN_FLAG_READ);
if (!file.open(nvram_filename(nvram.device())))
{
+<<<<<<< HEAD
if (!nvram.nvram_load(file))
osd_printf_error("Error reading NVRAM file %s\n", file.filename());
+=======
+ // FIXME: don't swallow errors
+ nvram.nvram_load(file);
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
file.close();
}
else
@@ -1158,8 +1167,13 @@ 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())))
{
+<<<<<<< HEAD
if (!nvram.nvram_save(file))
osd_printf_error("Error writing NVRAM file %s\n", file.filename());
+=======
+ // FIXME: don't swallow errors
+ nvram.nvram_save(file);
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.h")
file.close();
}
}
diff --git a/src/emu/machine.h b/src/emu/machine.h
index 702d79bcd6e..4bef86ce3a7 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 d4256d869a4..ffe680fa625 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 73bbd5b62c9..1ab26947946 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 82a4d3c70d2..4925874251f 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 edb00e4f00a..eb77d0d4ddb 100644
--- a/src/emu/video.h
+++ b/src/emu/video.h
@@ -79,7 +79,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 a6e16fb83e2..71781f2421a 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 08c8dbf366e..a7779183894 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 0525aab56c2..635ed5817d3 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 4cff9226aa0..b0e2ca2ddfa 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 347b166c706..920a847c001 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 fe8f11236de..9dab127b383 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 0ca570337a7..b3d02b3bd98 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 6739569a331..7e91ed1c733 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 39cad3032c0..fc17bc8c9bc 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 0b53b52f64b..1c69eff9649 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 9af4be4d36e..bb1f298e4d2 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 c902f585412..e97467846d4 100644
--- a/src/mame/machine/kr1601rr1.cpp
+++ b/src/mame/machine/kr1601rr1.cpp
@@ -13,12 +13,19 @@
***************************************************************************/
#include "emu.h"
+<<<<<<< HEAD
<<<<<<< HEAD
#include "kr1601rr1.h"
=======
>>>>>>> upstream/master
+=======
+#include "kr1601rr1.h"
+
+#include "fileio.h"
+
+>>>>>>> parent of ea6d1ae3f4c (Revert "Remove fileio.h from emu.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 0d31c3585fd..1a1e81c0f9b 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 11ae4b6bfdf..41ddc131d39 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 1153b3c21b3..5c41e146ea8 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 fddbd56315e..2ee9f73668d 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 730299386b6..5a056b6e1fb 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 6dce3a8ad78..b136d8e3c8d 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 5edfbe60e94..9fa78ffd27e 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 506697640a7..5d045ed616c 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"