mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
Low-level #include overhaul
- vecstream.h: Revert changes made in aa29519528
. The std::string_view conversion has been made a non-member function (util::buf_to_string_view) and moved to coretmpl.h.
- strformat.h: Remove the using declaration importing util::string_format into the global namespace. It has been moved to emucore.h and a few tool sources; other references have been qualified.
- osdcore.h: Split out file, directory and path classes and methods to a new header (osdfile.h), Doxygenizing the documentation comments.
- Disaggregate many #includes that were including other standard or custom headers. emu.h now includes basically the same things that it did, but other headers have been streamlined; for instance, emucore.h no longer stealth-includes osdcore.h several ways.
This commit is contained in:
parent
78f93a270c
commit
60e518cc50
@ -156,6 +156,7 @@ project ("ocore_" .. _OPTIONS["osd"])
|
||||
files {
|
||||
MAME_DIR .. "src/osd/osdcore.cpp",
|
||||
MAME_DIR .. "src/osd/osdcore.h",
|
||||
MAME_DIR .. "src/osd/osdfile.h",
|
||||
MAME_DIR .. "src/osd/strconv.cpp",
|
||||
MAME_DIR .. "src/osd/strconv.h",
|
||||
MAME_DIR .. "src/osd/osdsync.cpp",
|
||||
|
@ -468,6 +468,7 @@ project ("ocore_" .. _OPTIONS["osd"])
|
||||
files {
|
||||
MAME_DIR .. "src/osd/osdcore.cpp",
|
||||
MAME_DIR .. "src/osd/osdcore.h",
|
||||
MAME_DIR .. "src/osd/osdfile.h",
|
||||
MAME_DIR .. "src/osd/strconv.cpp",
|
||||
MAME_DIR .. "src/osd/strconv.h",
|
||||
MAME_DIR .. "src/osd/osdsync.cpp",
|
||||
|
@ -104,6 +104,7 @@ project ("ocore_" .. _OPTIONS["osd"])
|
||||
MAME_DIR .. "src/osd/osdcomm.h",
|
||||
MAME_DIR .. "src/osd/osdcore.cpp",
|
||||
MAME_DIR .. "src/osd/osdcore.h",
|
||||
MAME_DIR .. "src/osd/osdfile.h",
|
||||
MAME_DIR .. "src/osd/strconv.cpp",
|
||||
MAME_DIR .. "src/osd/strconv.h",
|
||||
MAME_DIR .. "src/osd/osdsync.cpp",
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
// core emulator headers -- must be first (profiler needs attotime, attotime needs xtal)
|
||||
#include "emucore.h"
|
||||
#include "osdcore.h"
|
||||
#include "eminline.h"
|
||||
#include "xtal.h"
|
||||
#include "attotime.h"
|
||||
@ -37,9 +38,8 @@
|
||||
#include "http.h"
|
||||
|
||||
// commonly-referenced utilities imported from lib/util
|
||||
#include "corestr.h"
|
||||
#include "palette.h"
|
||||
#include "strformat.h"
|
||||
#include "vecstream.h"
|
||||
|
||||
// emulator-specific utilities
|
||||
#include "hash.h"
|
||||
|
@ -13,12 +13,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "coretmpl.h"
|
||||
#include "osdcomm.h"
|
||||
#include "corealloc.h"
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <new>
|
||||
#include <vector>
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -28,7 +28,6 @@
|
||||
#endif
|
||||
|
||||
// standard C++ includes
|
||||
#include <cassert>
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
@ -37,9 +36,10 @@
|
||||
// core system includes
|
||||
#include "osdcomm.h"
|
||||
#include "emualloc.h"
|
||||
#include "corestr.h"
|
||||
#include "coretmpl.h"
|
||||
#include "bitmap.h"
|
||||
#include "strformat.h"
|
||||
#include "vecstream.h"
|
||||
|
||||
#include "emufwd.h"
|
||||
|
||||
@ -77,6 +77,7 @@ using util::make_bitmask;
|
||||
using util::BIT;
|
||||
using util::bitswap;
|
||||
using util::iabs;
|
||||
using util::string_format;
|
||||
|
||||
|
||||
// genf is a generic function pointer; cast function pointers to this instead of void *
|
||||
|
@ -438,27 +438,27 @@ private:
|
||||
|
||||
tmp.seekp(0);
|
||||
util::stream_format(tmp, "scr%uphysicalxaspect", i);
|
||||
try_insert(std::string_view(tmp), s64(physaspect.first));
|
||||
try_insert(util::buf_to_string_view(tmp), s64(physaspect.first));
|
||||
|
||||
tmp.seekp(0);
|
||||
util::stream_format(tmp, "scr%uphysicalyaspect", i);
|
||||
try_insert(std::string_view(tmp), s64(physaspect.second));
|
||||
try_insert(util::buf_to_string_view(tmp), s64(physaspect.second));
|
||||
|
||||
tmp.seekp(0);
|
||||
util::stream_format(tmp, "scr%unativexaspect", i);
|
||||
try_insert(std::string_view(tmp), xaspect);
|
||||
try_insert(util::buf_to_string_view(tmp), xaspect);
|
||||
|
||||
tmp.seekp(0);
|
||||
util::stream_format(tmp, "scr%unativeyaspect", i);
|
||||
try_insert(std::string_view(tmp), yaspect);
|
||||
try_insert(util::buf_to_string_view(tmp), yaspect);
|
||||
|
||||
tmp.seekp(0);
|
||||
util::stream_format(tmp, "scr%uwidth", i);
|
||||
try_insert(std::string_view(tmp), w);
|
||||
try_insert(util::buf_to_string_view(tmp), w);
|
||||
|
||||
tmp.seekp(0);
|
||||
util::stream_format(tmp, "scr%uheight", i);
|
||||
try_insert(std::string_view(tmp), h);
|
||||
try_insert(util::buf_to_string_view(tmp), h);
|
||||
|
||||
++i;
|
||||
}
|
||||
@ -539,7 +539,7 @@ private:
|
||||
else
|
||||
{
|
||||
m_buffer.write(&str[start], str.length() - start);
|
||||
return std::string_view(m_buffer);
|
||||
return util::buf_to_string_view(m_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -570,7 +570,7 @@ void favorite_manager::save_favorites()
|
||||
buf << info.devicetype << '\n';
|
||||
util::stream_format(buf, "%d\n", info.available);
|
||||
|
||||
file.puts(std::string_view(buf));
|
||||
file.puts(util::buf_to_string_view(buf));
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "cassimg.h"
|
||||
#include "imageutl.h"
|
||||
|
||||
#include "corealloc.h" // make_unique_clear
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include "osdcore.h"
|
||||
#include "ioprocs.h"
|
||||
#include "corefile.h"
|
||||
|
||||
|
@ -13,8 +13,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "coretmpl.h"
|
||||
#include "bitmap.h"
|
||||
#include "huffman.h"
|
||||
#include "flac.h"
|
||||
|
@ -8,13 +8,15 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "aviio.h"
|
||||
#include "osdcomm.h"
|
||||
#include "osdfile.h"
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "aviio.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
|
@ -11,7 +11,6 @@
|
||||
#ifndef MAME_LIB_UTIL_AVIIO_H
|
||||
#define MAME_LIB_UTIL_AVIIO_H
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "bitmap.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "bitmap.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <new>
|
||||
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "palette.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -1323,7 +1323,7 @@ chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc)
|
||||
strcpy(submode, cdrom_get_type_string(toc->tracks[i].pgtype));
|
||||
}
|
||||
|
||||
metadata = string_format(CDROM_TRACK_METADATA2_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype),
|
||||
metadata = util::string_format(CDROM_TRACK_METADATA2_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype),
|
||||
cdrom_get_subtype_string(toc->tracks[i].subtype), toc->tracks[i].frames, toc->tracks[i].pregap,
|
||||
submode, cdrom_get_subtype_string(toc->tracks[i].pgsub),
|
||||
toc->tracks[i].postgap);
|
||||
@ -1331,7 +1331,7 @@ chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc)
|
||||
}
|
||||
else
|
||||
{
|
||||
metadata = string_format(GDROM_TRACK_METADATA_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype),
|
||||
metadata = util::string_format(GDROM_TRACK_METADATA_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype),
|
||||
cdrom_get_subtype_string(toc->tracks[i].subtype), toc->tracks[i].frames, toc->tracks[i].padframes,
|
||||
toc->tracks[i].pregap, cdrom_get_type_string(toc->tracks[i].pgtype),
|
||||
cdrom_get_subtype_string(toc->tracks[i].pgsub), toc->tracks[i].postgap);
|
||||
|
@ -14,10 +14,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "coretmpl.h"
|
||||
#include "corestr.h"
|
||||
#include <string>
|
||||
#include "bitmap.h"
|
||||
#include "corefile.h"
|
||||
#include "hashing.h"
|
||||
#include "chdcodec.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "chd.h"
|
||||
#include "chdcd.h"
|
||||
#include "corefile.h"
|
||||
#include "corestr.h"
|
||||
|
||||
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "coretmpl.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#define CHDCODEC_VERIFY_COMPRESSION 0
|
||||
|
@ -13,8 +13,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "corefile.h"
|
||||
|
||||
#include "coretmpl.h"
|
||||
#include "osdcore.h"
|
||||
#include "unicode.h"
|
||||
#include "vecstream.h"
|
||||
|
||||
@ -600,7 +602,7 @@ int core_text_file::vprintf(util::format_argument_pack<std::ostream> const &args
|
||||
m_printf_buffer.reserve(1024);
|
||||
m_printf_buffer.seekp(0, ovectorstream::beg);
|
||||
util::stream_format<std::ostream, std::ostream>(m_printf_buffer, args);
|
||||
return puts(std::string_view(m_printf_buffer));
|
||||
return puts(buf_to_string_view(m_printf_buffer));
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,8 +13,7 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "corestr.h"
|
||||
#include "coretmpl.h"
|
||||
#include "osdfile.h"
|
||||
#include "strformat.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
@ -9,7 +9,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "corestr.h"
|
||||
#include "osdcore.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
@ -13,9 +13,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "strformat.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <cstring>
|
||||
|
@ -13,8 +13,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "osdcomm.h"
|
||||
#include "osdcore.h"
|
||||
#include "corealloc.h"
|
||||
#include "vecstream.h"
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
@ -28,6 +27,7 @@
|
||||
#include <numeric>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
@ -913,6 +913,15 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// extract a string_view from an ovectorstream buffer
|
||||
template <typename CharT, typename Traits, typename Allocator>
|
||||
std::basic_string_view<CharT, Traits> buf_to_string_view(basic_ovectorstream<CharT, Traits, Allocator> &stream)
|
||||
{
|
||||
// this works on the assumption that the value tellp returns is the same both before and after vec is called
|
||||
return std::basic_string_view<CharT, Traits>(&stream.vec()[0], stream.tellp());
|
||||
}
|
||||
|
||||
|
||||
template <typename E>
|
||||
using enable_enum_t = typename std::enable_if_t<std::is_enum<E>::value, typename std::underlying_type_t<E> >;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcomm.h"
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -1,16 +1,16 @@
|
||||
#include "disasmintf.h"
|
||||
|
||||
util::u32 util::disasm_interface::interface_flags() const
|
||||
util::disasm_interface::u32 util::disasm_interface::interface_flags() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
util::u32 util::disasm_interface::page_address_bits() const
|
||||
util::disasm_interface::u32 util::disasm_interface::page_address_bits() const
|
||||
{
|
||||
throw ("unimplemented page_address_bits called");
|
||||
}
|
||||
|
||||
util::u32 util::disasm_interface::page2_address_bits() const
|
||||
util::disasm_interface::u32 util::disasm_interface::page2_address_bits() const
|
||||
{
|
||||
throw ("unimplemented page2_address_bits called");
|
||||
}
|
||||
@ -25,22 +25,22 @@ util::disasm_interface::offs_t util::disasm_interface::pc_real_to_linear(offs_t
|
||||
throw ("unimplemented pc_real_to_linear called");
|
||||
}
|
||||
|
||||
util::u8 util::disasm_interface::decrypt8(u8 value, offs_t pc, bool opcode) const
|
||||
util::disasm_interface::u8 util::disasm_interface::decrypt8(u8 value, offs_t pc, bool opcode) const
|
||||
{
|
||||
throw ("unimplemented decrypt8 called");
|
||||
}
|
||||
|
||||
util::u16 util::disasm_interface::decrypt16(u16 value, offs_t pc, bool opcode) const
|
||||
util::disasm_interface::u16 util::disasm_interface::decrypt16(u16 value, offs_t pc, bool opcode) const
|
||||
{
|
||||
throw ("unimplemented decrypt16 called");
|
||||
}
|
||||
|
||||
util::u32 util::disasm_interface::decrypt32(u32 value, offs_t pc, bool opcode) const
|
||||
util::disasm_interface::u32 util::disasm_interface::decrypt32(u32 value, offs_t pc, bool opcode) const
|
||||
{
|
||||
throw ("unimplemented decrypt32 called");
|
||||
}
|
||||
|
||||
util::u64 util::disasm_interface::decrypt64(u64 value, offs_t pc, bool opcode) const
|
||||
util::disasm_interface::u64 util::disasm_interface::decrypt64(u64 value, offs_t pc, bool opcode) const
|
||||
{
|
||||
throw ("unimplemented decrypt64 called");
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
#ifndef MAME_UTIL_DISASMINTF_H
|
||||
#define MAME_UTIL_DISASMINTF_H
|
||||
|
||||
#include "coretmpl.h"
|
||||
#include "osdcomm.h"
|
||||
|
||||
namespace util {
|
||||
|
||||
|
@ -8,9 +8,11 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "flac.h"
|
||||
|
||||
#include "osdcomm.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <new>
|
||||
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "corefile.h"
|
||||
|
||||
#include <FLAC/all.h>
|
||||
|
@ -11,8 +11,9 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "hash.h"
|
||||
#include "hashing.h"
|
||||
#include "corestr.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "hashing.h"
|
||||
#include "strformat.h"
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
|
@ -12,11 +12,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "corestr.h"
|
||||
#include "md5.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "bitstream.h"
|
||||
#include "osdcomm.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -13,7 +13,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,9 @@
|
||||
|
||||
#include "msdib.h"
|
||||
|
||||
#include "coretmpl.h"
|
||||
#include "eminline.h"
|
||||
#include "osdcore.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include "bitmap.h"
|
||||
#include "corefile.h"
|
||||
#include "osdcore.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -8,14 +8,15 @@
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include "opresolv.h"
|
||||
|
||||
#include "strformat.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
|
||||
#include "pool.h"
|
||||
#include "corestr.h"
|
||||
#include "opresolv.h"
|
||||
|
||||
|
||||
namespace util {
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "options.h"
|
||||
|
||||
#include "corestr.h"
|
||||
#include "osdcomm.h"
|
||||
|
||||
#include <locale>
|
||||
#include <string>
|
||||
@ -1000,12 +1001,12 @@ void core_options::set_value(const std::string &name, std::string &&value, int p
|
||||
|
||||
void core_options::set_value(const std::string &name, int value, int priority)
|
||||
{
|
||||
set_value(name, string_format("%d", value), priority);
|
||||
set_value(name, util::string_format("%d", value), priority);
|
||||
}
|
||||
|
||||
void core_options::set_value(const std::string &name, float value, int priority)
|
||||
{
|
||||
set_value(name, string_format("%f", value), priority);
|
||||
set_value(name, util::string_format("%f", value), priority);
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "coretmpl.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -2,7 +2,7 @@
|
||||
// copyright-holders:Aaron Giles, hap
|
||||
/***************************************************************************
|
||||
|
||||
plaparse.h
|
||||
plaparse.cpp
|
||||
|
||||
Simple parser for Berkeley standard PLA files into raw fusemaps.
|
||||
It supports no more than one output matrix, and is limited to
|
||||
@ -10,12 +10,14 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "plaparse.h"
|
||||
|
||||
#include "osdcomm.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#include "jedparse.h"
|
||||
#include "plaparse.h"
|
||||
|
||||
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "jedparse.h"
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "png.h"
|
||||
|
||||
#include "osdcomm.h"
|
||||
#include "unicode.h"
|
||||
|
||||
#include <zlib.h>
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "bitmap.h"
|
||||
#include "corefile.h"
|
||||
#include "osdcore.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
|
@ -8,11 +8,14 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "pool.h"
|
||||
|
||||
#include "coreutil.h"
|
||||
#include "osdcomm.h"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include "pool.h"
|
||||
#include "coreutil.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -13,7 +13,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -1775,8 +1775,6 @@ using detail::make_format_argument_pack;
|
||||
|
||||
} // namespace util
|
||||
|
||||
using util::string_format;
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// EXTERNAL TEMPLATE INSTANTIATIONS
|
||||
|
@ -13,11 +13,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "coreutil.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "unzip.h"
|
||||
|
||||
#include "corestr.h"
|
||||
#include "osdcore.h"
|
||||
#include "osdfile.h"
|
||||
#include "unicode.h"
|
||||
#include "timeconv.h"
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "unicode.h"
|
||||
|
||||
#include "osdcomm.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "strconv.h"
|
||||
#define UTF8PROC_DLLEXPORT
|
||||
|
@ -19,11 +19,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "corestr.h"
|
||||
#include "hashing.h"
|
||||
#include "osdcore.h"
|
||||
#include "osdfile.h"
|
||||
#include "timeconv.h"
|
||||
|
||||
#include "lzma/C/LzmaDec.h"
|
||||
|
@ -13,8 +13,6 @@
|
||||
#ifndef MAME_LIB_UTIL_UNZIP_H
|
||||
#define MAME_LIB_UTIL_UNZIP_H
|
||||
|
||||
#include "osdcore.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
@ -8,9 +8,9 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "vbiparse.h"
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcomm.h"
|
||||
#include <cstdint>
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <ostream>
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@ -45,7 +44,6 @@ public:
|
||||
typedef typename std::basic_streambuf<CharT, Traits>::off_type off_type;
|
||||
typedef Allocator allocator_type;
|
||||
typedef std::vector<char_type, Allocator> vector_type;
|
||||
typedef std::basic_string_view<char_type> string_view_type;
|
||||
|
||||
basic_vectorbuf(std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : std::basic_streambuf<CharT, Traits>(), m_mode(mode), m_storage(), m_threshold(nullptr)
|
||||
{
|
||||
@ -74,16 +72,23 @@ public:
|
||||
|
||||
vector_type const &vec() const
|
||||
{
|
||||
finalize();
|
||||
if (m_mode & std::ios_base::out)
|
||||
{
|
||||
if (this->pptr() > m_threshold) m_threshold = this->pptr();
|
||||
auto const base(this->pbase());
|
||||
auto const end(m_threshold - base);
|
||||
if (m_storage.size() > std::make_unsigned_t<decltype(end)>(end))
|
||||
{
|
||||
m_storage.resize(std::make_unsigned_t<decltype(end)>(end));
|
||||
assert(&m_storage[0] == base);
|
||||
auto const put_offset(this->pptr() - base);
|
||||
const_cast<basic_vectorbuf *>(this)->setp(base, base + put_offset);
|
||||
const_cast<basic_vectorbuf *>(this)->pbump(put_offset);
|
||||
}
|
||||
}
|
||||
return m_storage;
|
||||
}
|
||||
|
||||
explicit operator string_view_type() const
|
||||
{
|
||||
finalize();
|
||||
return string_view_type(this->pbase(), this->pptr() - this->pbase());
|
||||
}
|
||||
|
||||
void vec(const vector_type &content)
|
||||
{
|
||||
m_storage = content;
|
||||
@ -302,24 +307,6 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void finalize() const
|
||||
{
|
||||
if (m_mode & std::ios_base::out)
|
||||
{
|
||||
if (this->pptr() > m_threshold) m_threshold = this->pptr();
|
||||
auto const base(this->pbase());
|
||||
auto const end(m_threshold - base);
|
||||
if (m_storage.size() > std::make_unsigned_t<decltype(end)>(end))
|
||||
{
|
||||
m_storage.resize(std::make_unsigned_t<decltype(end)>(end));
|
||||
assert(&m_storage[0] == base);
|
||||
auto const put_offset(this->pptr() - base);
|
||||
const_cast<basic_vectorbuf *>(this)->setp(base, base + put_offset);
|
||||
const_cast<basic_vectorbuf *>(this)->pbump(put_offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::ios_base::openmode m_mode;
|
||||
mutable vector_type m_storage;
|
||||
mutable CharT *m_threshold;
|
||||
@ -330,14 +317,12 @@ class basic_ivectorstream : public std::basic_istream<CharT, Traits>
|
||||
{
|
||||
public:
|
||||
typedef typename basic_vectorbuf<CharT, Traits, Allocator>::vector_type vector_type;
|
||||
typedef typename basic_vectorbuf<CharT, Traits, Allocator>::string_view_type string_view_type;
|
||||
|
||||
basic_ivectorstream(std::ios_base::openmode mode = std::ios_base::in) : std::basic_istream<CharT, Traits>(&m_rdbuf), m_rdbuf(mode) { }
|
||||
basic_ivectorstream(vector_type const &content, std::ios_base::openmode mode = std::ios_base::in) : std::basic_istream<CharT, Traits>(&m_rdbuf), m_rdbuf(content, mode) { }
|
||||
basic_ivectorstream(vector_type &&content, std::ios_base::openmode mode = std::ios_base::in) : std::basic_istream<CharT, Traits>(&m_rdbuf), m_rdbuf(std::move(content), mode) { }
|
||||
|
||||
basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return static_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_istream<CharT, Traits>::rdbuf()); }
|
||||
explicit operator string_view_type() const { return string_view_type(*rdbuf()); }
|
||||
vector_type const &vec() const { return rdbuf()->vec(); }
|
||||
void vec(const vector_type &content) { rdbuf()->vec(content); }
|
||||
void vec(vector_type &&content) { rdbuf()->vec(std::move(content)); }
|
||||
@ -353,7 +338,6 @@ class basic_ovectorstream : public std::basic_ostream<CharT, Traits>
|
||||
{
|
||||
public:
|
||||
typedef typename basic_vectorbuf<CharT, Traits, Allocator>::vector_type vector_type;
|
||||
typedef typename basic_vectorbuf<CharT, Traits, Allocator>::string_view_type string_view_type;
|
||||
|
||||
basic_ovectorstream(std::ios_base::openmode mode = std::ios_base::out) : std::basic_ostream<CharT, Traits>(&m_rdbuf), m_rdbuf(mode) { }
|
||||
basic_ovectorstream(vector_type const &content, std::ios_base::openmode mode = std::ios_base::out) : std::basic_ostream<CharT, Traits>(&m_rdbuf), m_rdbuf(content, mode) { }
|
||||
@ -362,7 +346,6 @@ public:
|
||||
basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return static_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_ostream<CharT, Traits>::rdbuf()); }
|
||||
|
||||
vector_type const &vec() const { return rdbuf()->vec(); }
|
||||
explicit operator string_view_type() const { return string_view_type(*rdbuf()); }
|
||||
void vec(const vector_type &content) { rdbuf()->vec(content); }
|
||||
void vec(vector_type &&content) { rdbuf()->vec(std::move(content)); }
|
||||
basic_ovectorstream &reserve(typename vector_type::size_type size) { rdbuf()->reserve(size); return *this; }
|
||||
@ -378,7 +361,6 @@ class basic_vectorstream : public std::basic_iostream<CharT, Traits>
|
||||
{
|
||||
public:
|
||||
typedef typename basic_vectorbuf<CharT, Traits, Allocator>::vector_type vector_type;
|
||||
typedef typename basic_vectorbuf<CharT, Traits, Allocator>::string_view_type string_view_type;
|
||||
|
||||
basic_vectorstream(std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : std::basic_iostream<CharT, Traits>(&m_rdbuf), m_rdbuf(mode) { }
|
||||
basic_vectorstream(vector_type const &content, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : std::basic_iostream<CharT, Traits>(&m_rdbuf), m_rdbuf(content, mode) { }
|
||||
@ -387,7 +369,6 @@ public:
|
||||
basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return static_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_iostream<CharT, Traits>::rdbuf()); }
|
||||
|
||||
vector_type const &vec() const { return rdbuf()->vec(); }
|
||||
explicit operator string_view_type() const { return string_view_type(*rdbuf()); }
|
||||
void vec(const vector_type &content) { rdbuf()->vec(content); }
|
||||
void vec(vector_type &&content) { rdbuf()->vec(std::move(content)); }
|
||||
basic_vectorstream &reserve(typename vector_type::size_type size) { rdbuf()->reserve(size); return *this; }
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "xmlfile.h"
|
||||
|
||||
#include "osdcore.h"
|
||||
|
||||
#include <expat.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "corefile.h"
|
||||
|
||||
#include <list>
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "zippath.h"
|
||||
#include "unzip.h"
|
||||
#include "corestr.h"
|
||||
#include "osdcore.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#define _DARWIN_C_SOURCE // to get DT_xxx on OS X
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "osdfile.h"
|
||||
#include "modules/lib/osdlib.h"
|
||||
#include "util/strformat.h"
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <cassert>
|
||||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
// MAME headers
|
||||
#include "posixfile.h"
|
||||
#include "osdcore.h"
|
||||
#include "unicode.h"
|
||||
|
||||
#include <cassert>
|
||||
|
@ -9,7 +9,7 @@
|
||||
//============================================================
|
||||
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "osdfile.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <cassert>
|
||||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
|
@ -7,6 +7,7 @@
|
||||
//============================================================
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "osdfile.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <tchar.h>
|
||||
|
||||
// MAME headers
|
||||
#include "osdcore.h"
|
||||
#include "osdfile.h"
|
||||
#include "strformat.h"
|
||||
|
||||
// MAMEOS headers
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef MAME_OSD_WINDOWS_WINFILE_H
|
||||
#define MAME_OSD_WINDOWS_WINFILE_H
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "osdfile.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace {
|
||||
|
@ -12,10 +12,10 @@
|
||||
#include <tchar.h>
|
||||
|
||||
// MAME headers
|
||||
#include "osdcore.h"
|
||||
#include "strformat.h"
|
||||
|
||||
// MAMEOS headers
|
||||
#include "osdfile.h"
|
||||
#include "strconv.h"
|
||||
#include "../../windows/winutil.h"
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef MAME_OSD_WINDOWS_WINFILE_H
|
||||
#define MAME_OSD_WINDOWS_WINFILE_H
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "osdfile.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace {
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
// standard windows headers
|
||||
#include <windows.h>
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
// standard windows headers
|
||||
#include <windows.h>
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#ifdef SDLMAME_MACOSX
|
||||
|
||||
#include "corealloc.h"
|
||||
#include "fileio.h"
|
||||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
@ -11,7 +11,6 @@
|
||||
#if defined(SDLMAME_UNIX) && !defined(SDLMAME_MACOSX) && !defined(SDLMAME_HAIKU) && !defined(SDLMAME_ANDROID)
|
||||
|
||||
#include "corestr.h"
|
||||
#include "corealloc.h"
|
||||
#include "fileio.h"
|
||||
#include "unicode.h"
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "strconv.h"
|
||||
#include "unicode.h"
|
||||
#include "corestr.h"
|
||||
#include "corealloc.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
*******************************************************************c********/
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "corealloc.h"
|
||||
#include "modules/osdmodule.h"
|
||||
#include "midi_module.h"
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <portmidi.h>
|
||||
#include "osdcore.h"
|
||||
#include "corealloc.h"
|
||||
#include "modules/osdmodule.h"
|
||||
#include "midi_module.h"
|
||||
|
||||
|
@ -16,196 +16,14 @@
|
||||
|
||||
#include "strformat.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <iosfwd>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FILE I/O INTERFACES
|
||||
***************************************************************************/
|
||||
|
||||
/* Make sure we have a path separator (default to /) */
|
||||
#ifndef PATH_SEPARATOR
|
||||
#if defined(_WIN32)
|
||||
#define PATH_SEPARATOR "\\"
|
||||
#else
|
||||
#define PATH_SEPARATOR "/"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// \defgroup openflags File open flags
|
||||
/// \{
|
||||
|
||||
/// Open file for reading.
|
||||
#define OPEN_FLAG_READ 0x0001
|
||||
|
||||
/// Open file for writing.
|
||||
#define OPEN_FLAG_WRITE 0x0002
|
||||
|
||||
/// Create the file, or truncate it if it exists.
|
||||
#define OPEN_FLAG_CREATE 0x0004
|
||||
|
||||
/// Create non-existent directories in the path.
|
||||
#define OPEN_FLAG_CREATE_PATHS 0x0008
|
||||
|
||||
/// Do not decompress into memory on open.
|
||||
#define OPEN_FLAG_NO_PRELOAD 0x0010
|
||||
|
||||
/// \}
|
||||
|
||||
|
||||
/// \brief Interface to file-like resources
|
||||
///
|
||||
/// This interface is used to access file-like and stream-like
|
||||
/// resources. Examples include plain files, TCP socket, named pipes,
|
||||
/// pseudo-terminals, and compressed archive members.
|
||||
class osd_file
|
||||
{
|
||||
public:
|
||||
/// \brief Result of a file operation
|
||||
///
|
||||
/// Returned by most members of osd_file, and also used by other
|
||||
/// classes that access files or other file-like resources.
|
||||
enum class error
|
||||
{
|
||||
/// Operation completed successfully.
|
||||
NONE,
|
||||
|
||||
/// Operation failed, but there is no more specific code to
|
||||
/// describe the failure.
|
||||
FAILURE,
|
||||
|
||||
/// Operation failed due to an error allocating memory.
|
||||
OUT_OF_MEMORY,
|
||||
|
||||
/// The requested file, path or resource was not found.
|
||||
NOT_FOUND,
|
||||
|
||||
/// Current permissions do not allow the requested access.
|
||||
ACCESS_DENIED,
|
||||
|
||||
/// Requested access is not permitted because the file or
|
||||
/// resource is currently open for exclusive access.
|
||||
ALREADY_OPEN,
|
||||
|
||||
/// Request cannot be completed due to resource exhaustion
|
||||
/// (maximum number of open files or other objects has been
|
||||
/// reached).
|
||||
TOO_MANY_FILES,
|
||||
|
||||
/// The request cannot be completed because invalid data was
|
||||
/// encountered (for example an inconsistent filesystem, or a
|
||||
/// corrupt archive file).
|
||||
INVALID_DATA,
|
||||
|
||||
/// The requested access mode is invalid, or not appropriate for
|
||||
/// the file or resource.
|
||||
INVALID_ACCESS
|
||||
};
|
||||
|
||||
/// \brief Smart pointer to a file handle
|
||||
typedef std::unique_ptr<osd_file> ptr;
|
||||
|
||||
/// \brief Open a new file handle
|
||||
///
|
||||
/// This function is called by core_fopen and several other places
|
||||
/// in the core to access files. These functions will construct
|
||||
/// paths by concatenating various search paths held in the
|
||||
/// options.c options database with partial paths specified by the
|
||||
/// core. The core assumes that the path separator is the first
|
||||
/// character of the string PATH_SEPARATOR, but does not interpret
|
||||
/// any path separators in the search paths, so if you use a
|
||||
/// different path separator in a search path, you may get a mixture
|
||||
/// of PATH_SEPARATORs (from the core) and alternate path separators
|
||||
/// (specified by users and placed into the options database).
|
||||
/// \param [in] path Path to the file to open.
|
||||
/// \param [in] openflags Combination of #OPEN_FLAG_READ,
|
||||
/// #OPEN_FLAG_WRITE, #OPEN_FLAG_CREATE and
|
||||
/// #OPEN_FLAG_CREATE_PATHS specifying the requested access mode
|
||||
/// and open behaviour.
|
||||
/// \param [out] file Receives the file handle if the operation
|
||||
/// succeeds. Not valid if the operation fails.
|
||||
/// \param [out] filesize Receives the size of the opened file if
|
||||
/// the operation succeeded. Not valid if the operation failed.
|
||||
/// Will be zero for stream-like objects (e.g. TCP sockets or
|
||||
/// named pipes).
|
||||
/// \return Result of the operation.
|
||||
static error open(std::string const &path, std::uint32_t openflags, ptr &file, std::uint64_t &filesize);
|
||||
|
||||
/// \brief Create a new pseudo-terminal (PTY) pair
|
||||
///
|
||||
/// \param [out] file Receives the handle of the master side of the
|
||||
/// pseudo-terminal if the operation succeeds. Not valid if the
|
||||
/// operation fails.
|
||||
/// \param [out] name Receives the name of the slave side of the
|
||||
/// pseudo-terminal if the operation succeeds. Not valid if the
|
||||
/// operation fails.
|
||||
/// \return Result of the operation.
|
||||
static error openpty(ptr &file, std::string &name);
|
||||
|
||||
/// \brief Close an open file
|
||||
virtual ~osd_file() { }
|
||||
|
||||
/// \brief Read from an open file
|
||||
///
|
||||
/// Read data from an open file at specified offset. Note that the
|
||||
/// seek and read are not guaranteed to be atomic, which may cause
|
||||
/// issues in multi-threaded applications.
|
||||
/// \param [out] buffer Pointer to memory that will receive the data
|
||||
/// read.
|
||||
/// \param [in] offset Byte offset within the file to read at,
|
||||
/// relative to the start of the file. Ignored for stream-like
|
||||
/// objects (e.g. TCP sockets or named pipes).
|
||||
/// \param [in] length Number of bytes to read. Fewer bytes may be
|
||||
/// read if the end of file is reached, or if no data is
|
||||
/// available.
|
||||
/// \param [out] actual Receives the number of bytes read if the
|
||||
/// operation succeeds. Not valid if the operation fails.
|
||||
/// \return Result of the operation.
|
||||
virtual error read(void *buffer, std::uint64_t offset, std::uint32_t length, std::uint32_t &actual) = 0;
|
||||
|
||||
/// \brief Write to an open file
|
||||
///
|
||||
/// Write data to an open file at specified offset. Note that the
|
||||
/// seek and write are not guaranteed to be atomic, which may cause
|
||||
/// issues in multi-threaded applications.
|
||||
/// \param [in] buffer Pointer to memory containing data to write.
|
||||
/// \param [in] offset Byte offset within the file to write at,
|
||||
/// relative to the start of the file. Ignored for stream-like
|
||||
/// objects (e.g. TCP sockets or named pipes).
|
||||
/// \param [in] length Number of bytes to write.
|
||||
/// \param [out] actual Receives the number of bytes written if the
|
||||
/// operation succeeds. Not valid if the operation fails.
|
||||
/// \return Result of the operation.
|
||||
virtual error write(void const *buffer, std::uint64_t offset, std::uint32_t length, std::uint32_t &actual) = 0;
|
||||
|
||||
/// \brief Change the size of an open file
|
||||
///
|
||||
/// \param [in] offset Desired size of the file.
|
||||
/// \return Result of the operation.
|
||||
virtual error truncate(std::uint64_t offset) = 0;
|
||||
|
||||
/// \brief Flush file buffers
|
||||
///
|
||||
/// This flushes any data cached by the application, but does not
|
||||
/// guarantee that all prior writes have reached persistent storage.
|
||||
/// \return Result of the operation.
|
||||
virtual error flush() = 0;
|
||||
|
||||
/// \brief Delete a file
|
||||
///
|
||||
/// \param [in] filename Path to the file to delete.
|
||||
/// \return Result of the operation.
|
||||
static error remove(std::string const &filename);
|
||||
};
|
||||
|
||||
|
||||
/// \brief Get environment variable value
|
||||
///
|
||||
/// \param [in] name Name of the environment variable as a
|
||||
@ -221,35 +39,6 @@ const char *osd_getenv(const char *name);
|
||||
int osd_getpid();
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
osd_get_physical_drive_geometry: if the given path points to a physical
|
||||
drive, return the geometry of that drive
|
||||
|
||||
Parameters:
|
||||
|
||||
filename - pointer to a path which might describe a physical drive
|
||||
|
||||
cylinders - pointer to a uint32_t to receive the number of cylinders
|
||||
of the physical drive
|
||||
|
||||
heads - pointer to a uint32_t to receive the number of heads per
|
||||
cylinder of the physical drive
|
||||
|
||||
sectors - pointer to a uint32_t to receive the number of sectors per
|
||||
cylinder of the physical drive
|
||||
|
||||
bps - pointer to a uint32_t to receive the number of bytes per sector
|
||||
of the physical drive
|
||||
|
||||
Return value:
|
||||
|
||||
true if the filename points to a physical drive and if the values
|
||||
pointed to by cylinders, heads, sectors, and bps are valid; false in
|
||||
any other case
|
||||
-----------------------------------------------------------------------------*/
|
||||
bool osd_get_physical_drive_geometry(const char *filename, uint32_t *cylinders, uint32_t *heads, uint32_t *sectors, uint32_t *bps);
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
osd_uchar_from_osdchar: convert the given character or sequence of
|
||||
characters from the OS-default encoding to a Unicode character
|
||||
@ -271,115 +60,6 @@ bool osd_get_physical_drive_geometry(const char *filename, uint32_t *cylinders,
|
||||
int osd_uchar_from_osdchar(char32_t *uchar, const char *osdchar, size_t count);
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
osd_is_valid_filename_char: is the given character legal for filenames?
|
||||
|
||||
Parameters:
|
||||
|
||||
uchar - the character to check
|
||||
|
||||
Return value:
|
||||
|
||||
Whether this character is legal in a filename
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
bool osd_is_valid_filename_char(char32_t uchar);
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
osd_is_valid_filepath_char: is the given character legal for paths?
|
||||
|
||||
Parameters:
|
||||
|
||||
uchar - the character to check
|
||||
|
||||
Return value:
|
||||
|
||||
Whether this character is legal in a file path
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
bool osd_is_valid_filepath_char(char32_t uchar);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
DIRECTORY INTERFACES
|
||||
***************************************************************************/
|
||||
|
||||
namespace osd
|
||||
{
|
||||
// directory is an opaque type which represents an open directory
|
||||
class directory
|
||||
{
|
||||
public:
|
||||
typedef std::unique_ptr<directory> ptr;
|
||||
|
||||
// osd::directory::entry contains basic information about a file when iterating through
|
||||
// a directory
|
||||
class entry
|
||||
{
|
||||
public:
|
||||
enum class entry_type
|
||||
{
|
||||
NONE,
|
||||
FILE,
|
||||
DIR,
|
||||
OTHER
|
||||
};
|
||||
|
||||
const char * name; // name of the entry
|
||||
entry_type type; // type of the entry
|
||||
std::uint64_t size; // size of the entry
|
||||
std::chrono::system_clock::time_point last_modified; // last modified time
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// osd::directory::open: open a directory for iteration
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// dirname - path to the directory in question
|
||||
//
|
||||
// Return value:
|
||||
//
|
||||
// upon success, this function should return an directory pointer
|
||||
// which contains opaque data necessary to traverse the directory; on
|
||||
// failure, this function should return nullptr
|
||||
// -----------------------------------------------------------------------------
|
||||
static ptr open(std::string const &dirname);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// osd::directory::~directory: close an open directory
|
||||
// -----------------------------------------------------------------------------
|
||||
virtual ~directory() { }
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// osd::directory::read: return information about the next entry in the directory
|
||||
//
|
||||
// Return value:
|
||||
//
|
||||
// a constant pointer to an entry representing the current item
|
||||
// in the directory, or nullptr, indicating that no more entries are
|
||||
// present
|
||||
// -----------------------------------------------------------------------------
|
||||
virtual const entry *read() = 0;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
osd_is_absolute_path: returns whether the specified path is absolute
|
||||
|
||||
Parameters:
|
||||
|
||||
path - the path in question
|
||||
|
||||
Return value:
|
||||
|
||||
non-zero if the path is absolute, zero otherwise
|
||||
-----------------------------------------------------------------------------*/
|
||||
bool osd_is_absolute_path(const std::string &path);
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TIMING INTERFACES
|
||||
@ -700,45 +380,6 @@ void osd_break_into_debugger(const char *message);
|
||||
std::string osd_get_clipboard_text();
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
DIRECTORY INTERFACES
|
||||
***************************************************************************/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
osd_stat: return a directory entry for a path
|
||||
|
||||
Parameters:
|
||||
|
||||
path - path in question
|
||||
|
||||
Return value:
|
||||
|
||||
an allocated pointer to an osd::directory::entry representing
|
||||
info on the path; even if the file does not exist.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
std::unique_ptr<osd::directory::entry> osd_stat(std::string const &path);
|
||||
|
||||
/***************************************************************************
|
||||
PATH INTERFACES
|
||||
***************************************************************************/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
osd_get_full_path: retrieves the full path
|
||||
|
||||
Parameters:
|
||||
|
||||
path - the path in question
|
||||
dst - reference to receive new path
|
||||
|
||||
Return value:
|
||||
|
||||
file error
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
osd_file::error osd_get_full_path(std::string &dst, std::string const &path);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
MIDI I/O INTERFACES
|
||||
***************************************************************************/
|
||||
@ -765,20 +406,6 @@ void osd_list_network_adapters();
|
||||
UNCATEGORIZED INTERFACES
|
||||
***************************************************************************/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
osd_get_volume_name: retrieves the volume name
|
||||
|
||||
Parameters:
|
||||
|
||||
idx - order number of volume
|
||||
|
||||
Return value:
|
||||
|
||||
pointer to volume name
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
const char *osd_get_volume_name(int idx);
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
osd_subst_env: substitute environment variables with values
|
||||
|
||||
|
320
src/osd/osdfile.h
Normal file
320
src/osd/osdfile.h
Normal file
@ -0,0 +1,320 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Aaron Giles
|
||||
/// \file
|
||||
/// \brief Core OS-dependent file interface
|
||||
///
|
||||
/// The prototypes in this file describe the interfaces that the MAME
|
||||
/// core and various tools rely on to interact with the outside world.
|
||||
/// They are broken out into several categories.
|
||||
|
||||
#ifndef MAME_OSD_OSDFILE_H
|
||||
#define MAME_OSD_OSDFILE_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FILE I/O INTERFACES
|
||||
***************************************************************************/
|
||||
|
||||
/* Make sure we have a path separator (default to /) */
|
||||
#ifndef PATH_SEPARATOR
|
||||
#if defined(_WIN32)
|
||||
#define PATH_SEPARATOR "\\"
|
||||
#else
|
||||
#define PATH_SEPARATOR "/"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// \defgroup openflags File open flags
|
||||
/// \{
|
||||
|
||||
/// Open file for reading.
|
||||
constexpr uint32_t OPEN_FLAG_READ = 0x0001;
|
||||
|
||||
/// Open file for writing.
|
||||
constexpr uint32_t OPEN_FLAG_WRITE = 0x0002;
|
||||
|
||||
/// Create the file, or truncate it if it exists.
|
||||
constexpr uint32_t OPEN_FLAG_CREATE = 0x0004;
|
||||
|
||||
/// Create non-existent directories in the path.
|
||||
constexpr uint32_t OPEN_FLAG_CREATE_PATHS = 0x0008;
|
||||
|
||||
/// Do not decompress into memory on open.
|
||||
constexpr uint32_t OPEN_FLAG_NO_PRELOAD = 0x0010;
|
||||
|
||||
/// \}
|
||||
|
||||
|
||||
/// \brief Interface to file-like resources
|
||||
///
|
||||
/// This interface is used to access file-like and stream-like
|
||||
/// resources. Examples include plain files, TCP socket, named pipes,
|
||||
/// pseudo-terminals, and compressed archive members.
|
||||
class osd_file
|
||||
{
|
||||
public:
|
||||
/// \brief Result of a file operation
|
||||
///
|
||||
/// Returned by most members of osd_file, and also used by other
|
||||
/// classes that access files or other file-like resources.
|
||||
enum class error
|
||||
{
|
||||
/// Operation completed successfully.
|
||||
NONE,
|
||||
|
||||
/// Operation failed, but there is no more specific code to
|
||||
/// describe the failure.
|
||||
FAILURE,
|
||||
|
||||
/// Operation failed due to an error allocating memory.
|
||||
OUT_OF_MEMORY,
|
||||
|
||||
/// The requested file, path or resource was not found.
|
||||
NOT_FOUND,
|
||||
|
||||
/// Current permissions do not allow the requested access.
|
||||
ACCESS_DENIED,
|
||||
|
||||
/// Requested access is not permitted because the file or
|
||||
/// resource is currently open for exclusive access.
|
||||
ALREADY_OPEN,
|
||||
|
||||
/// Request cannot be completed due to resource exhaustion
|
||||
/// (maximum number of open files or other objects has been
|
||||
/// reached).
|
||||
TOO_MANY_FILES,
|
||||
|
||||
/// The request cannot be completed because invalid data was
|
||||
/// encountered (for example an inconsistent filesystem, or a
|
||||
/// corrupt archive file).
|
||||
INVALID_DATA,
|
||||
|
||||
/// The requested access mode is invalid, or not appropriate for
|
||||
/// the file or resource.
|
||||
INVALID_ACCESS
|
||||
};
|
||||
|
||||
/// \brief Smart pointer to a file handle
|
||||
typedef std::unique_ptr<osd_file> ptr;
|
||||
|
||||
/// \brief Open a new file handle
|
||||
///
|
||||
/// This function is called by core_fopen and several other places
|
||||
/// in the core to access files. These functions will construct
|
||||
/// paths by concatenating various search paths held in the
|
||||
/// options.c options database with partial paths specified by the
|
||||
/// core. The core assumes that the path separator is the first
|
||||
/// character of the string PATH_SEPARATOR, but does not interpret
|
||||
/// any path separators in the search paths, so if you use a
|
||||
/// different path separator in a search path, you may get a mixture
|
||||
/// of PATH_SEPARATORs (from the core) and alternate path separators
|
||||
/// (specified by users and placed into the options database).
|
||||
/// \param [in] path Path to the file to open.
|
||||
/// \param [in] openflags Combination of #OPEN_FLAG_READ,
|
||||
/// #OPEN_FLAG_WRITE, #OPEN_FLAG_CREATE and
|
||||
/// #OPEN_FLAG_CREATE_PATHS specifying the requested access mode
|
||||
/// and open behaviour.
|
||||
/// \param [out] file Receives the file handle if the operation
|
||||
/// succeeds. Not valid if the operation fails.
|
||||
/// \param [out] filesize Receives the size of the opened file if
|
||||
/// the operation succeeded. Not valid if the operation failed.
|
||||
/// Will be zero for stream-like objects (e.g. TCP sockets or
|
||||
/// named pipes).
|
||||
/// \return Result of the operation.
|
||||
static error open(std::string const &path, std::uint32_t openflags, ptr &file, std::uint64_t &filesize);
|
||||
|
||||
/// \brief Create a new pseudo-terminal (PTY) pair
|
||||
///
|
||||
/// \param [out] file Receives the handle of the master side of the
|
||||
/// pseudo-terminal if the operation succeeds. Not valid if the
|
||||
/// operation fails.
|
||||
/// \param [out] name Receives the name of the slave side of the
|
||||
/// pseudo-terminal if the operation succeeds. Not valid if the
|
||||
/// operation fails.
|
||||
/// \return Result of the operation.
|
||||
static error openpty(ptr &file, std::string &name);
|
||||
|
||||
/// \brief Close an open file
|
||||
virtual ~osd_file() { }
|
||||
|
||||
/// \brief Read from an open file
|
||||
///
|
||||
/// Read data from an open file at specified offset. Note that the
|
||||
/// seek and read are not guaranteed to be atomic, which may cause
|
||||
/// issues in multi-threaded applications.
|
||||
/// \param [out] buffer Pointer to memory that will receive the data
|
||||
/// read.
|
||||
/// \param [in] offset Byte offset within the file to read at,
|
||||
/// relative to the start of the file. Ignored for stream-like
|
||||
/// objects (e.g. TCP sockets or named pipes).
|
||||
/// \param [in] length Number of bytes to read. Fewer bytes may be
|
||||
/// read if the end of file is reached, or if no data is
|
||||
/// available.
|
||||
/// \param [out] actual Receives the number of bytes read if the
|
||||
/// operation succeeds. Not valid if the operation fails.
|
||||
/// \return Result of the operation.
|
||||
virtual error read(void *buffer, std::uint64_t offset, std::uint32_t length, std::uint32_t &actual) = 0;
|
||||
|
||||
/// \brief Write to an open file
|
||||
///
|
||||
/// Write data to an open file at specified offset. Note that the
|
||||
/// seek and write are not guaranteed to be atomic, which may cause
|
||||
/// issues in multi-threaded applications.
|
||||
/// \param [in] buffer Pointer to memory containing data to write.
|
||||
/// \param [in] offset Byte offset within the file to write at,
|
||||
/// relative to the start of the file. Ignored for stream-like
|
||||
/// objects (e.g. TCP sockets or named pipes).
|
||||
/// \param [in] length Number of bytes to write.
|
||||
/// \param [out] actual Receives the number of bytes written if the
|
||||
/// operation succeeds. Not valid if the operation fails.
|
||||
/// \return Result of the operation.
|
||||
virtual error write(void const *buffer, std::uint64_t offset, std::uint32_t length, std::uint32_t &actual) = 0;
|
||||
|
||||
/// \brief Change the size of an open file
|
||||
///
|
||||
/// \param [in] offset Desired size of the file.
|
||||
/// \return Result of the operation.
|
||||
virtual error truncate(std::uint64_t offset) = 0;
|
||||
|
||||
/// \brief Flush file buffers
|
||||
///
|
||||
/// This flushes any data cached by the application, but does not
|
||||
/// guarantee that all prior writes have reached persistent storage.
|
||||
/// \return Result of the operation.
|
||||
virtual error flush() = 0;
|
||||
|
||||
/// \brief Delete a file
|
||||
///
|
||||
/// \param [in] filename Path to the file to delete.
|
||||
/// \return Result of the operation.
|
||||
static error remove(std::string const &filename);
|
||||
};
|
||||
|
||||
|
||||
/// \brief Describe geometry of physical drive
|
||||
///
|
||||
/// If the given path points to a physical drive, return the geometry of
|
||||
/// that drive.
|
||||
///
|
||||
/// \param [in] filename Pointer to a path which might describe a
|
||||
/// physical drive.
|
||||
/// \param [out] cylinders Pointer to a uint32_t to receive the number of
|
||||
/// cylinders of the physical drive.
|
||||
/// \param [out] heads Pointer to a uint32_t to receive the number of
|
||||
/// heads per cylinder of the physical drive.
|
||||
/// \param [out] sectors Pointer to a uint32_t to receive the number of
|
||||
/// sectors per cylinder of the physical drive.
|
||||
/// \param [out] bps Pointer to a uint32_t to receive the number of
|
||||
/// bytes per sector of the physical drive.
|
||||
/// \return true if the filename points to a physical drive and if the
|
||||
/// values pointed to by cylinders, heads, sectors, and bps are valid;
|
||||
/// false in any other case
|
||||
bool osd_get_physical_drive_geometry(const char *filename, uint32_t *cylinders, uint32_t *heads, uint32_t *sectors, uint32_t *bps);
|
||||
|
||||
|
||||
/// \brief Is the given character legal for filenames?
|
||||
///
|
||||
/// \param [in] uchar The character to check.
|
||||
/// \return Whether this character is legal in a filename.
|
||||
bool osd_is_valid_filename_char(char32_t uchar);
|
||||
|
||||
|
||||
/// \brief Is the given character legal for paths?
|
||||
///
|
||||
/// \param [in] uchar The character to check.
|
||||
/// \return Whether this character is legal in a file path.
|
||||
bool osd_is_valid_filepath_char(char32_t uchar);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
DIRECTORY INTERFACES
|
||||
***************************************************************************/
|
||||
|
||||
namespace osd
|
||||
{
|
||||
// directory is an opaque type which represents an open directory
|
||||
class directory
|
||||
{
|
||||
public:
|
||||
typedef std::unique_ptr<directory> ptr;
|
||||
|
||||
// osd::directory::entry contains basic information about a file when iterating through
|
||||
// a directory
|
||||
class entry
|
||||
{
|
||||
public:
|
||||
enum class entry_type
|
||||
{
|
||||
NONE,
|
||||
FILE,
|
||||
DIR,
|
||||
OTHER
|
||||
};
|
||||
|
||||
const char * name; // name of the entry
|
||||
entry_type type; // type of the entry
|
||||
std::uint64_t size; // size of the entry
|
||||
std::chrono::system_clock::time_point last_modified; // last modified time
|
||||
};
|
||||
|
||||
/// \brief Open a directory for iteration.
|
||||
///
|
||||
/// \param [in] dirname Path to the directory in question.
|
||||
/// \return Upon success, a directory pointer which contains opaque
|
||||
/// data necessary to traverse the directory; on failure, nullptr.
|
||||
static ptr open(std::string const &dirname);
|
||||
|
||||
/// \brief Close an open directory.
|
||||
virtual ~directory() { }
|
||||
|
||||
/// \brief Return information about the next entry in the directory.
|
||||
///
|
||||
/// \return A constant pointer to an entry representing the current
|
||||
/// item in the directory, or nullptr, indicating that no more
|
||||
/// entries are present.
|
||||
virtual const entry *read() = 0;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/// \brief Return a directory entry for a path.
|
||||
///
|
||||
/// \param [in] path The path in question.
|
||||
/// \return An allocated pointer to an osd::directory::entry representing
|
||||
/// info on the path; even if the file does not exist.
|
||||
std::unique_ptr<osd::directory::entry> osd_stat(std::string const &path);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
PATH INTERFACES
|
||||
***************************************************************************/
|
||||
|
||||
/// \brief Returns whether the specified path is absolute.
|
||||
///
|
||||
/// \param [in] path The path in question.
|
||||
/// \return true if the path is absolute, false otherwise.
|
||||
bool osd_is_absolute_path(const std::string &path);
|
||||
|
||||
|
||||
/// \brief Retrieves the full path.
|
||||
/// \param [in] path The path in question.
|
||||
/// \param [out] dst Reference to receive new path.
|
||||
/// \return File error.
|
||||
osd_file::error osd_get_full_path(std::string &dst, std::string const &path);
|
||||
|
||||
|
||||
/// \brief Retrieves the volume name.
|
||||
///
|
||||
/// \param [in] idx Order number of volume.
|
||||
/// \return Pointer to volume name.
|
||||
const char *osd_get_volume_name(int idx);
|
||||
|
||||
|
||||
#endif // MAME_OSD_OSDFILE_H
|
@ -9,7 +9,7 @@
|
||||
#ifndef __WINUTIL__
|
||||
#define __WINUTIL__
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "osdfile.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <chrono>
|
||||
|
@ -7,9 +7,6 @@
|
||||
****************************************************************************/
|
||||
#include <stdio.h> // must be stdio.h and here otherwise issues with I64FMT in MINGW
|
||||
|
||||
// osd
|
||||
#include "osdcore.h"
|
||||
|
||||
// lib/util
|
||||
#include "avhuff.h"
|
||||
#include "aviio.h"
|
||||
@ -18,6 +15,7 @@
|
||||
#include "corefile.h"
|
||||
#include "hashing.h"
|
||||
#include "md5.h"
|
||||
#include "strformat.h"
|
||||
#include "vbiparse.h"
|
||||
|
||||
#include <cassert>
|
||||
@ -33,6 +31,8 @@
|
||||
#include <new>
|
||||
#include <unordered_map>
|
||||
|
||||
using util::string_format;
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <cassert>
|
||||
|
||||
#include "corestr.h"
|
||||
#include "osdcomm.h"
|
||||
|
||||
#include "formats/mfi_dsk.h"
|
||||
#include "formats/dfi_dsk.h"
|
||||
|
@ -14,6 +14,10 @@
|
||||
|
||||
#include "unicode.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace imgtool
|
||||
{
|
||||
// ======================> charconverter
|
||||
|
@ -81,7 +81,7 @@ imgtoolerr_t imghd_create(imgtool::stream &stream, uint32_t hunksize, uint32_t c
|
||||
}
|
||||
|
||||
/* write the metadata */
|
||||
const std::string metadata = string_format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, seclen);
|
||||
const std::string metadata = util::string_format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, seclen);
|
||||
err = (imgtoolerr_t)chd.write_metadata(HARD_DISK_METADATA_TAG, 0, metadata);
|
||||
if (rc != CHDERR_NONE)
|
||||
{
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "opresolv.h"
|
||||
#include "library.h"
|
||||
#include "filter.h"
|
||||
#include "osdcomm.h"
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
|
@ -248,7 +248,7 @@ static int cmd_dir(const struct command *c, int argc, char *argv[])
|
||||
{
|
||||
std::string filesize_string = ent.directory
|
||||
? "<DIR>"
|
||||
: string_format("%u", (unsigned int) ent.filesize);
|
||||
: util::string_format("%u", (unsigned int) ent.filesize);
|
||||
|
||||
if (!ent.lastmodified_time.empty())
|
||||
{
|
||||
@ -748,7 +748,7 @@ static void listoptions(const util::option_guide &opt_guide, const char *opt_spe
|
||||
const util::option_resolution::entry &entry = *iter;
|
||||
std::stringstream description_buffer;
|
||||
|
||||
std::string opt_name = string_format("--%s", entry.identifier());
|
||||
std::string opt_name = util::string_format("--%s", entry.identifier());
|
||||
const char *opt_desc = entry.display_name();
|
||||
|
||||
// is this option relevant?
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <zlib.h>
|
||||
|
||||
#include "unzip.h"
|
||||
#include "osdcore.h"
|
||||
#include "imgtool.h"
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "imgterrs.h"
|
||||
#include "corefile.h"
|
||||
#include "osdcomm.h"
|
||||
|
||||
namespace imgtool
|
||||
{
|
||||
|
@ -145,6 +145,7 @@
|
||||
|
||||
#include "corestr.h"
|
||||
#include "jedparse.h"
|
||||
#include "osdcomm.h"
|
||||
#include "plaparse.h"
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#include <cassert>
|
||||
#include "osdcore.h"
|
||||
#include "osdfile.h"
|
||||
#include "png.h"
|
||||
|
||||
#include <new>
|
||||
|
@ -12,9 +12,13 @@
|
||||
#include <cctype>
|
||||
#include <new>
|
||||
#include <cassert>
|
||||
#include "osdcore.h"
|
||||
#include "corefile.h"
|
||||
#include "corestr.h"
|
||||
#include "osdcomm.h"
|
||||
#include "png.h"
|
||||
|
||||
using util::string_format;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS & DEFINES
|
||||
|
@ -9,7 +9,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "unzip.h"
|
||||
#include "osdcore.h"
|
||||
#include "osdfile.h"
|
||||
#include "osdcomm.h"
|
||||
#include "hash.h"
|
||||
|
||||
|
@ -149,7 +149,7 @@ static int split_file(const char *filename, const char *basename, uint32_t split
|
||||
splitfile->printf("hash=%s file=%s.%03d\n", computedhash.c_str(), basefilename.c_str(), partnum);
|
||||
|
||||
// compute the full filename for this guy
|
||||
outfilename = string_format("%s.%03d", basename, partnum);
|
||||
outfilename = util::string_format("%s.%03d", basename, partnum);
|
||||
|
||||
// create it
|
||||
filerr = util::core_file::open(outfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, outfile);
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
#include "corefile.h"
|
||||
#include "corestr.h"
|
||||
#include "osdcore.h"
|
||||
#include "osdcomm.h"
|
||||
#include "strformat.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -9,6 +9,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
// the disassemblers assume they're in MAME and emu.h is a PCH, so we minimally pander to them
|
||||
#include "coretmpl.h"
|
||||
#include "disasmintf.h"
|
||||
|
||||
using offs_t = osd::u32;
|
||||
|
Loading…
Reference in New Issue
Block a user