summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2016-06-24 23:53:38 +1000
committer Vas Crabb <vas@vastheman.com>2016-06-24 23:53:38 +1000
commit20a95045e16ab69cfb13c6d3cf520e63aa553102 (patch)
tree3a4b4bab3ed8afaedc6a9c499c5737dc6df5d91e /src
parent83a9cf42056efe9c78d39b89e4ba394a07c79dce (diff)
parent7509a56dc0cf8a380eada014167b8075fbcbcdc9 (diff)
Load save state preparations [Nathan Woods]
* A number of changes and refactorings in preparation for a new load/save state menu. Most notably, I am C++-ifying osd_directory (now osd::directory) and changing osd_stat() to return std::unique_ptrosd::directory::entry * Take note that this change completely omits POSIX support, simply because I lack a development environment to support it. This will have to be done by someone else.
Diffstat (limited to 'src')
-rw-r--r--src/emu/diimage.cpp17
-rw-r--r--src/emu/fileio.cpp10
-rw-r--r--src/emu/fileio.h4
-rw-r--r--src/emu/machine.cpp6
-rw-r--r--src/frontend/mame/clifront.cpp8
-rw-r--r--src/frontend/mame/pluginopts.cpp10
-rw-r--r--src/frontend/mame/ui/custui.cpp4
-rw-r--r--src/frontend/mame/ui/dirmenu.cpp4
-rw-r--r--src/frontend/mame/ui/filesel.cpp8
-rw-r--r--src/frontend/mame/ui/filesel.h2
-rw-r--r--src/frontend/mame/ui/imgcntrl.cpp16
-rw-r--r--src/frontend/mame/ui/inifile.cpp2
-rw-r--r--src/frontend/mame/ui/miscmenu.cpp2
-rw-r--r--src/frontend/mame/ui/selgame.cpp4
-rw-r--r--src/frontend/mame/ui/selsoft.cpp6
-rw-r--r--src/frontend/mame/ui/simpleselgame.cpp2
-rw-r--r--src/frontend/mame/ui/ui.cpp32
-rw-r--r--src/frontend/mame/ui/ui.h2
-rw-r--r--src/lib/util/zippath.cpp64
-rw-r--r--src/lib/util/zippath.h2
-rw-r--r--src/osd/modules/file/winfile.cpp11
-rw-r--r--src/osd/modules/render/bgfx/chainentryreader.cpp8
-rw-r--r--src/osd/modules/render/bgfx/chainmanager.cpp10
-rw-r--r--src/osd/osdcore.h128
-rw-r--r--src/osd/windows/windir.cpp108
-rw-r--r--src/osd/windows/winutil.cpp20
-rw-r--r--src/osd/windows/winutil.h4
27 files changed, 263 insertions, 231 deletions
diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp
index 9347570fee6..9c6ed4f2013 100644
--- a/src/emu/diimage.cpp
+++ b/src/emu/diimage.cpp
@@ -295,24 +295,23 @@ void device_image_interface::message(const char *format, ...)
-------------------------------------------------*/
bool device_image_interface::try_change_working_directory(const char *subdir)
{
- osd_directory *directory;
- const osd_directory_entry *entry;
- bool success = FALSE;
- bool done = FALSE;
+ const osd::directory::entry *entry;
+ bool success = false;
+ bool done = false;
- directory = osd_opendir(m_working_directory.c_str());
+ auto directory = osd::directory::open(m_working_directory.c_str());
if (directory != nullptr)
{
- while(!done && (entry = osd_readdir(directory)) != nullptr)
+ while(!done && (entry = directory->read()) != nullptr)
{
if (!core_stricmp(subdir, entry->name))
{
- done = TRUE;
- success = entry->type == ENTTYPE_DIR;
+ done = true;
+ success = entry->type == osd::directory::entry::entry_type::DIR;
}
}
- osd_closedir(directory);
+ delete directory;
}
/* did we successfully identify the directory? */
diff --git a/src/emu/fileio.cpp b/src/emu/fileio.cpp
index 78be6e10faa..55231dc845c 100644
--- a/src/emu/fileio.cpp
+++ b/src/emu/fileio.cpp
@@ -91,7 +91,7 @@ file_enumerator::~file_enumerator()
{
// close anything open
if (m_curdir != nullptr)
- osd_closedir(m_curdir);
+ delete m_curdir;
}
@@ -100,7 +100,7 @@ file_enumerator::~file_enumerator()
// in the search path
//-------------------------------------------------
-const osd_directory_entry *file_enumerator::next()
+const osd::directory::entry *file_enumerator::next()
{
// loop over potentially empty directories
while (1)
@@ -113,16 +113,16 @@ const osd_directory_entry *file_enumerator::next()
return nullptr;
// open the path
- m_curdir = osd_opendir(m_pathbuffer.c_str());
+ m_curdir = osd::directory::open(m_pathbuffer.c_str());
}
// get the next entry from the current directory
- const osd_directory_entry *result = osd_readdir(m_curdir);
+ const osd::directory::entry *result = m_curdir->read();
if (result != nullptr)
return result;
// we're done; close this directory
- osd_closedir(m_curdir);
+ delete m_curdir;
m_curdir = nullptr;
}
}
diff --git a/src/emu/fileio.h b/src/emu/fileio.h
index 5e765f660d8..d71b350559c 100644
--- a/src/emu/fileio.h
+++ b/src/emu/fileio.h
@@ -63,12 +63,12 @@ public:
~file_enumerator();
// iterator
- const osd_directory_entry *next();
+ const osd::directory::entry *next();
private:
// internal state
path_iterator m_iterator;
- osd_directory * m_curdir;
+ osd::directory *m_curdir;
std::string m_pathbuffer;
//int m_buflen;
};
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp
index 778403ef8a4..ae797fc81d2 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -568,7 +568,7 @@ void running_machine::set_saveload_filename(const char *filename)
// take into account the statename option
const char *stateopt = options().state_name();
std::string statename = get_statename(stateopt);
- m_saveload_pending_file.assign(statename.c_str()).append(PATH_SEPARATOR).append(filename).append(".sta");
+ m_saveload_pending_file = string_format("%s%s%s.sta", statename, PATH_SEPARATOR, filename);
}
}
@@ -844,7 +844,7 @@ void running_machine::handle_saveload()
break;
case STATERR_INVALID_HEADER:
- popmessage("Error: Unable to %s state due to an invalid header. Make sure the save state is correct for this game.", opname);
+ popmessage("Error: Unable to %s state due to an invalid header. Make sure the save state is correct for this machine.", opname);
break;
case STATERR_READ_ERROR:
@@ -857,7 +857,7 @@ void running_machine::handle_saveload()
case STATERR_NONE:
if (!(m_system.flags & MACHINE_SUPPORTS_SAVE))
- popmessage("State successfully %s.\nWarning: Save states are not officially supported for this game.", opnamed);
+ popmessage("State successfully %s.\nWarning: Save states are not officially supported for this machine.", opnamed);
else
popmessage("State successfully %s.", opnamed);
break;
diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp
index 39033e84d20..6f0f319dc44 100644
--- a/src/frontend/mame/clifront.cpp
+++ b/src/frontend/mame/clifront.cpp
@@ -1810,19 +1810,19 @@ media_identifier::media_identifier(emu_options &options)
void media_identifier::identify(const char *filename)
{
// first try to open as a directory
- osd_directory *directory = osd_opendir(filename);
+ osd::directory *directory = osd::directory::open(filename);
if (directory != nullptr)
{
// iterate over all files in the directory
- for (const osd_directory_entry *entry = osd_readdir(directory); entry != nullptr; entry = osd_readdir(directory))
- if (entry->type == ENTTYPE_FILE)
+ for (const osd::directory::entry *entry = directory->read(); entry != nullptr; entry = directory->read())
+ if (entry->type == osd::directory::entry::entry_type::FILE)
{
std::string curfile = std::string(filename).append(PATH_SEPARATOR).append(entry->name);
identify(curfile.c_str());
}
// close the directory and be done
- osd_closedir(directory);
+ delete directory;
}
// if that failed, and the filename ends with .zip, identify as a ZIP file
diff --git a/src/frontend/mame/pluginopts.cpp b/src/frontend/mame/pluginopts.cpp
index e56a72dfced..ad24cbbeef0 100644
--- a/src/frontend/mame/pluginopts.cpp
+++ b/src/frontend/mame/pluginopts.cpp
@@ -39,13 +39,13 @@ plugin_options::plugin_options()
void plugin_options::parse_json(std::string path)
{
// first try to open as a directory
- osd_directory *directory = osd_opendir(path.c_str());
+ osd::directory *directory = osd::directory::open(path.c_str());
if (directory != nullptr)
{
// iterate over all files in the directory
- for (const osd_directory_entry *entry = osd_readdir(directory); entry != nullptr; entry = osd_readdir(directory))
+ for (const osd::directory::entry *entry = directory->read(); entry != nullptr; entry = directory->read())
{
- if (entry->type == ENTTYPE_FILE)
+ if (entry->type == osd::directory::entry::entry_type::FILE)
{
std::string name = entry->name;
if (name == "plugin.json")
@@ -80,7 +80,7 @@ void plugin_options::parse_json(std::string path)
}
}
- else if (entry->type == ENTTYPE_DIR)
+ else if (entry->type == osd::directory::entry::entry_type::DIR)
{
std::string name = entry->name;
if (!(name == "." || name == ".."))
@@ -91,6 +91,6 @@ void plugin_options::parse_json(std::string path)
}
// close the directory and be done
- osd_closedir(directory);
+ delete directory;
}
}
diff --git a/src/frontend/mame/ui/custui.cpp b/src/frontend/mame/ui/custui.cpp
index 95a5ead8a8b..4cb4450b9ce 100644
--- a/src/frontend/mame/ui/custui.cpp
+++ b/src/frontend/mame/ui/custui.cpp
@@ -36,10 +36,10 @@ menu_custom_ui::menu_custom_ui(mame_ui_manager &mui, render_container *container
// load languages
file_enumerator path(mui.machine().options().language_path());
auto lang = mui.machine().options().language();
- const osd_directory_entry *dirent;
+ const osd::directory::entry *dirent;
int cnt = 0;
while ((dirent = path.next()) != nullptr)
- if (dirent->type == ENTTYPE_DIR && strcmp(dirent->name, ".") != 0 && strcmp(dirent->name, "..") != 0)
+ if (dirent->type == osd::directory::entry::entry_type::DIR && strcmp(dirent->name, ".") != 0 && strcmp(dirent->name, "..") != 0)
{
auto name = std::string(dirent->name);
auto i = strreplace(name, "_", " (");
diff --git a/src/frontend/mame/ui/dirmenu.cpp b/src/frontend/mame/ui/dirmenu.cpp
index 359d6d63420..1a500e14482 100644
--- a/src/frontend/mame/ui/dirmenu.cpp
+++ b/src/frontend/mame/ui/dirmenu.cpp
@@ -466,7 +466,7 @@ void menu_add_change_folder::populate()
// open a path
const char *volume_name = nullptr;
file_enumerator path(m_current_path.c_str());
- const osd_directory_entry *dirent;
+ const osd::directory::entry *dirent;
int folders_count = 0;
// add the drives
@@ -476,7 +476,7 @@ void menu_add_change_folder::populate()
// add the directories
while ((dirent = path.next()) != nullptr)
{
- if (dirent->type == ENTTYPE_DIR && strcmp(dirent->name, ".") != 0)
+ if (dirent->type == osd::directory::entry::entry_type::DIR && strcmp(dirent->name, ".") != 0)
item_append(dirent->name, "[DIR]", 0, (void *)(FPTR)++folders_count);
}
diff --git a/src/frontend/mame/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp
index 7c1d3ccfed6..1fe8c8e0bf4 100644
--- a/src/frontend/mame/ui/filesel.cpp
+++ b/src/frontend/mame/ui/filesel.cpp
@@ -451,7 +451,7 @@ menu_file_selector::file_selector_entry *menu_file_selector::append_entry(
// a menu item for a file selector entry
//-------------------------------------------------
-menu_file_selector::file_selector_entry *menu_file_selector::append_dirent_entry(const osd_directory_entry *dirent)
+menu_file_selector::file_selector_entry *menu_file_selector::append_dirent_entry(const osd::directory::entry *dirent)
{
std::string buffer;
file_selector_entry_type entry_type;
@@ -459,11 +459,11 @@ menu_file_selector::file_selector_entry *menu_file_selector::append_dirent_entry
switch(dirent->type)
{
- case ENTTYPE_FILE:
+ case osd::directory::entry::entry_type::FILE:
entry_type = SELECTOR_ENTRY_TYPE_FILE;
break;
- case ENTTYPE_DIR:
+ case osd::directory::entry::entry_type::DIR:
entry_type = SELECTOR_ENTRY_TYPE_DIRECTORY;
break;
@@ -536,7 +536,7 @@ void menu_file_selector::populate()
{
util::zippath_directory *directory = nullptr;
osd_file::error err;
- const osd_directory_entry *dirent;
+ const osd::directory::entry *dirent;
const file_selector_entry *entry;
const file_selector_entry *selected_entry = nullptr;
int i;
diff --git a/src/frontend/mame/ui/filesel.h b/src/frontend/mame/ui/filesel.h
index 66be755f699..571c11e4413 100644
--- a/src/frontend/mame/ui/filesel.h
+++ b/src/frontend/mame/ui/filesel.h
@@ -107,7 +107,7 @@ private:
// methods
int compare_entries(const file_selector_entry *e1, const file_selector_entry *e2);
file_selector_entry *append_entry(file_selector_entry_type entry_type, const char *entry_basename, const char *entry_fullpath);
- file_selector_entry *append_dirent_entry(const osd_directory_entry *dirent);
+ file_selector_entry *append_dirent_entry(const osd::directory::entry *dirent);
void append_entry_menu_item(const file_selector_entry *entry);
};
diff --git a/src/frontend/mame/ui/imgcntrl.cpp b/src/frontend/mame/ui/imgcntrl.cpp
index bc713bbca53..3468fa04b2d 100644
--- a/src/frontend/mame/ui/imgcntrl.cpp
+++ b/src/frontend/mame/ui/imgcntrl.cpp
@@ -88,31 +88,30 @@ menu_control_device_image::~menu_control_device_image()
void menu_control_device_image::test_create(bool &can_create, bool &need_confirm)
{
std::string path;
- osd_directory_entry *entry;
- osd_dir_entry_type file_type;
+ osd::directory::entry::entry_type file_type;
/* assemble the full path */
util::zippath_combine(path, current_directory.c_str(), current_file.c_str());
/* does a file or a directory exist at the path */
- entry = osd_stat(path.c_str());
- file_type = (entry != nullptr) ? entry->type : ENTTYPE_NONE;
+ auto entry = osd_stat(path.c_str());
+ file_type = (entry != nullptr) ? entry->type : osd::directory::entry::entry_type::NONE;
switch(file_type)
{
- case ENTTYPE_NONE:
+ case osd::directory::entry::entry_type::NONE:
/* no file/dir here - always create */
can_create = true;
need_confirm = false;
break;
- case ENTTYPE_FILE:
+ case osd::directory::entry::entry_type::FILE:
/* a file exists here - ask for permission from the user */
can_create = true;
need_confirm = true;
break;
- case ENTTYPE_DIR:
+ case osd::directory::entry::entry_type::DIR:
/* a directory exists here - we can't save over it */
ui().popup_time(5, "%s", _("Cannot save over directory"));
can_create = false;
@@ -124,9 +123,6 @@ void menu_control_device_image::test_create(bool &can_create, bool &need_confirm
need_confirm = false;
fatalerror("Unexpected\n");
}
-
- if (entry != nullptr)
- osd_free(entry);
}
diff --git a/src/frontend/mame/ui/inifile.cpp b/src/frontend/mame/ui/inifile.cpp
index d9f5cbeef8a..d8693356f05 100644
--- a/src/frontend/mame/ui/inifile.cpp
+++ b/src/frontend/mame/ui/inifile.cpp
@@ -39,7 +39,7 @@ inifile_manager::inifile_manager(running_machine &machine, ui_options &moptions)
void inifile_manager::directory_scan()
{
file_enumerator path(m_options.extraini_path());
- const osd_directory_entry *dir;
+ const osd::directory::entry *dir;
while ((dir = path.next()) != nullptr)
if (core_filename_ends_with(dir->name, ".ini") && parseopen(dir->name))
diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp
index 4e243f8ea8f..f48110dc6da 100644
--- a/src/frontend/mame/ui/miscmenu.cpp
+++ b/src/frontend/mame/ui/miscmenu.cpp
@@ -433,7 +433,7 @@ void menu_crosshair::populate()
/* open a path to the crosshairs */
file_enumerator path(machine().options().crosshair_path());
- const osd_directory_entry *dir;
+ const osd::directory::entry *dir;
/* reset search flags */
bool using_default = false;
bool finished = false;
diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp
index 37ec5915885..87a8ebaec79 100644
--- a/src/frontend/mame/ui/selgame.cpp
+++ b/src/frontend/mame/ui/selgame.cpp
@@ -69,7 +69,7 @@ menu_select_game::menu_select_game(mame_ui_manager &mui, render_container *conta
// check if there are available icons
ui_globals::has_icons = false;
file_enumerator path(moptions.icons_directory());
- const osd_directory_entry *dir;
+ const osd::directory::entry *dir;
while ((dir = path.next()) != nullptr)
{
std::string src(dir->name);
@@ -644,7 +644,7 @@ void menu_select_game::build_available_list()
// open a path to the ROMs and find them in the array
file_enumerator path(machine().options().media_path());
- const osd_directory_entry *dir;
+ const osd::directory::entry *dir;
// iterate while we get new objects
while ((dir = path.next()) != nullptr)
diff --git a/src/frontend/mame/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp
index 95f89bcb8dd..81c0bc97afe 100644
--- a/src/frontend/mame/ui/selsoft.cpp
+++ b/src/frontend/mame/ui/selsoft.cpp
@@ -608,7 +608,7 @@ void menu_select_software::build_software_list()
}
std::string searchstr, curpath;
- const osd_directory_entry *dir;
+ const osd::directory::entry *dir;
for (auto & elem : m_filter.swlist.name)
{
path_iterator path(machine().options().media_path());
@@ -621,9 +621,9 @@ void menu_select_software::build_software_list()
while ((dir = fpath.next()) != nullptr)
{
std::string name;
- if (dir->type == ENTTYPE_FILE)
+ if (dir->type == osd::directory::entry::entry_type::FILE)
name = core_filename_extract_base(dir->name, true);
- else if (dir->type == ENTTYPE_DIR && strcmp(dir->name, ".") != 0)
+ else if (dir->type == osd::directory::entry::entry_type::DIR && strcmp(dir->name, ".") != 0)
name = dir->name;
else
continue;
diff --git a/src/frontend/mame/ui/simpleselgame.cpp b/src/frontend/mame/ui/simpleselgame.cpp
index e2ca4ff6d55..c947279a001 100644
--- a/src/frontend/mame/ui/simpleselgame.cpp
+++ b/src/frontend/mame/ui/simpleselgame.cpp
@@ -63,7 +63,7 @@ void simple_menu_select_game::build_driver_list()
// open a path to the ROMs and find them in the array
file_enumerator path(machine().options().media_path());
- const osd_directory_entry *dir;
+ const osd::directory::entry *dir;
// iterate while we get new objects
while ((dir = path.next()) != nullptr)
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index 24d7b61fd2e..df941f3ceb7 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -1210,6 +1210,30 @@ void mame_ui_manager::draw_profiler(render_container *container)
//-------------------------------------------------
+// start_save_state
+//-------------------------------------------------
+
+void mame_ui_manager::start_save_state()
+{
+ machine().pause();
+ m_load_save_hold = true;
+ set_handler(UI_CALLBACK_TYPE_GENERAL, &mame_ui_manager::handler_load_save, (UINT32)LOADSAVE_SAVE);
+}
+
+
+//-------------------------------------------------
+// start_load_state
+//-------------------------------------------------
+
+void mame_ui_manager::start_load_state()
+{
+ machine().pause();
+ m_load_save_hold = true;
+ set_handler(UI_CALLBACK_TYPE_GENERAL, &mame_ui_manager::handler_load_save, (UINT32)LOADSAVE_LOAD);
+}
+
+
+//-------------------------------------------------
// image_handler_ingame - execute display
// callback function for each image device
//-------------------------------------------------
@@ -1386,18 +1410,14 @@ UINT32 mame_ui_manager::handler_ingame(render_container *container)
// handle a save state request
if (machine().ui_input().pressed(IPT_UI_SAVE_STATE))
{
- machine().pause();
- m_load_save_hold = true;
- set_handler(UI_CALLBACK_TYPE_GENERAL, &mame_ui_manager::handler_load_save, (UINT32)LOADSAVE_SAVE);
+ start_save_state();
return LOADSAVE_SAVE;
}
// handle a load state request
if (machine().ui_input().pressed(IPT_UI_LOAD_STATE))
{
- machine().pause();
- m_load_save_hold = true;
- set_handler(UI_CALLBACK_TYPE_GENERAL, &mame_ui_manager::handler_load_save, (UINT32)LOADSAVE_LOAD);
+ start_load_state();
return LOADSAVE_LOAD;
}
diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h
index 982200d0556..d02e9dd2037 100644
--- a/src/frontend/mame/ui/ui.h
+++ b/src/frontend/mame/ui/ui.h
@@ -236,6 +236,8 @@ public:
void draw_timecode_counter(render_container *container);
void draw_timecode_total(render_container *container);
void draw_profiler(render_container *container);
+ void start_save_state();
+ void start_load_state();
// print the game info string into a buffer
std::string &game_info_astring(std::string &str);
diff --git a/src/lib/util/zippath.cpp b/src/lib/util/zippath.cpp
index 1e4fb6dd293..48a919a8cad 100644
--- a/src/lib/util/zippath.cpp
+++ b/src/lib/util/zippath.cpp
@@ -48,11 +48,11 @@ public:
/** @brief true to returned parent. */
bool returned_parent;
/** @brief The returned entry. */
- osd_directory_entry returned_entry;
+ osd::directory::entry returned_entry;
/* specific to normal directories */
/** @brief Pathname of the directory. */
- osd_directory *directory;
+ osd::directory *directory;
/* specific to ZIP directories */
/** @brief true to called zip first. */
@@ -70,7 +70,7 @@ public:
FUNCTION PROTOTYPES
***************************************************************************/
-static int zippath_find_sub_path(archive_file &zipfile, std::string const &subpath, osd_dir_entry_type &type);
+static int zippath_find_sub_path(archive_file &zipfile, std::string const &subpath, osd::directory::entry::entry_type &type);
static bool is_zip_file(std::string const &path);
static bool is_zip_file_separator(char c);
static bool is_7z_file(std::string const &path);
@@ -341,7 +341,7 @@ osd_file::error zippath_fopen(const char *filename, UINT32 openflags, util::core
archive_file::error ziperr;
archive_file::ptr zip;
int header;
- osd_dir_entry_type entry_type;
+ osd::directory::entry::entry_type entry_type;
int len;
/* first, set up the two types of paths */
@@ -616,7 +616,7 @@ static char next_path_char(std::string const &s, std::string::size_type &pos)
-------------------------------------------------*/
/**
- * @fn static const zip_file_header *zippath_find_sub_path(archive_file *zipfile, const char *subpath, osd_dir_entry_type *type)
+ * @fn static const zip_file_header *zippath_find_sub_path(archive_file *zipfile, const char *subpath, osd::directory::entry::entry_type *type)
*
* @brief Zippath find sub path.
*
@@ -627,7 +627,7 @@ static char next_path_char(std::string const &s, std::string::size_type &pos)
* @return null if it fails, else a zip_file_header*.
*/
-static int zippath_find_sub_path(archive_file &zipfile, std::string const &subpath, osd_dir_entry_type &type)
+static int zippath_find_sub_path(archive_file &zipfile, std::string const &subpath, osd::directory::entry::entry_type &type)
{
for (int header = zipfile.first_file(); header >= 0; header = zipfile.next_file())
{
@@ -644,18 +644,18 @@ static int zippath_find_sub_path(archive_file &zipfile, std::string const &subpa
{
if (!c1)
{
- type = zipfile.current_is_directory() ? ENTTYPE_DIR : ENTTYPE_FILE;
+ type = zipfile.current_is_directory() ? osd::directory::entry::entry_type::DIR : osd::directory::entry::entry_type::FILE;
return header;
}
else if ((c1 == '/') || (i <= 1U))
{
- type = ENTTYPE_DIR;
+ type = osd::directory::entry::entry_type::DIR;
return header;
}
}
}
- type = ENTTYPE_NONE;
+ type = osd::directory::entry::entry_type::NONE;
return -1;
}
@@ -667,7 +667,7 @@ static int zippath_find_sub_path(archive_file &zipfile, std::string const &subpa
-------------------------------------------------*/
/**
- * @fn static osd_file::error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, archive_file *&zipfile, std::string &newpath)
+ * @fn static osd_file::error zippath_resolve(const char *path, osd::directory::entry::entry_type &entry_type, archive_file *&zipfile, std::string &newpath)
*
* @brief Zippath resolve.
*
@@ -679,17 +679,17 @@ static int zippath_find_sub_path(archive_file &zipfile, std::string const &subpa
* @return A osd_file::error.
*/
-static osd_file::error zippath_resolve(const char *path, osd_dir_entry_type &entry_type, archive_file::ptr &zipfile, std::string &newpath)
+static osd_file::error zippath_resolve(const char *path, osd::directory::entry::entry_type &entry_type, archive_file::ptr &zipfile, std::string &newpath)
{
newpath.clear();
// be conservative
- entry_type = ENTTYPE_NONE;
+ entry_type = osd::directory::entry::entry_type::NONE;
zipfile.reset();
std::string apath(path);
std::string apath_trimmed;
- osd_dir_entry_type current_entry_type;
+ osd::directory::entry::entry_type current_entry_type;
bool went_up = false;
do
{
@@ -701,7 +701,7 @@ static osd_file::error zippath_resolve(const char *path, osd_dir_entry_type &ent
apath_trimmed = apath;
// stat the path
- std::unique_ptr<osd_directory_entry, void (*)(void *)> current_entry(osd_stat(apath_trimmed), &osd_free);
+ auto current_entry = osd_stat(apath_trimmed);
// did we find anything?
if (current_entry)
@@ -712,20 +712,20 @@ static osd_file::error zippath_resolve(const char *path, osd_dir_entry_type &ent
else
{
// if we have not found the file or directory, go up
- current_entry_type = ENTTYPE_NONE;
+ current_entry_type = osd::directory::entry::entry_type::NONE;
went_up = true;
std::string parent;
apath = zippath_parent(parent, apath.c_str());
}
}
- while ((current_entry_type == ENTTYPE_NONE) && !is_root(apath.c_str()));
+ while ((current_entry_type == osd::directory::entry::entry_type::NONE) && !is_root(apath.c_str()));
// if we did not find anything, then error out
- if (current_entry_type == ENTTYPE_NONE)
+ if (current_entry_type == osd::directory::entry::entry_type::NONE)
return osd_file::error::NOT_FOUND;
// is this file a ZIP file?
- if ((current_entry_type == ENTTYPE_FILE) &&
+ if ((current_entry_type == osd::directory::entry::entry_type::FILE) &&
((is_zip_file(apath_trimmed) && (archive_file::open_zip(apath_trimmed, zipfile) == archive_file::error::NONE)) ||
(is_7z_file(apath_trimmed) && (archive_file::open_7z(apath_trimmed, zipfile) == archive_file::error::NONE))))
{
@@ -736,7 +736,7 @@ static osd_file::error zippath_resolve(const char *path, osd_dir_entry_type &ent
// this was a true ZIP path - attempt to identify the type of path
zippath_find_sub_path(*zipfile, newpath, current_entry_type);
- if (current_entry_type == ENTTYPE_NONE)
+ if (current_entry_type == osd::directory::entry::entry_type::NONE)
return osd_file::error::NOT_FOUND;
}
else
@@ -785,13 +785,13 @@ osd_file::error zippath_opendir(const char *path, zippath_directory **directory)
goto done;
}
/* resolve the path */
- osd_dir_entry_type entry_type;
+ osd::directory::entry::entry_type entry_type;
err = zippath_resolve(path, entry_type, result->zipfile, result->zipprefix);
if (err != osd_file::error::NONE)
goto done;
/* we have to be a directory */
- if (entry_type != ENTTYPE_DIR)
+ if (entry_type != osd::directory::entry::entry_type::DIR)
{
err = osd_file::error::NOT_FOUND;
goto done;
@@ -801,7 +801,7 @@ osd_file::error zippath_opendir(const char *path, zippath_directory **directory)
if (!result->zipfile)
{
/* a conventional directory */
- result->directory = osd_opendir(path);
+ result->directory = osd::directory::open(path);
if (!result->directory)
{
err = osd_file::error::FAILURE;
@@ -840,7 +840,7 @@ done:
void zippath_closedir(zippath_directory *directory)
{
if (directory->directory != nullptr)
- osd_closedir(directory->directory);
+ delete directory->directory;
if (directory->zipfile != nullptr)
directory->zipfile.reset();
@@ -901,18 +901,18 @@ static const char *get_relative_path(zippath_directory const &directory)
-------------------------------------------------*/
/**
- * @fn const osd_directory_entry *zippath_readdir(zippath_directory *directory)
+ * @fn const osd::directory::entry *zippath_readdir(zippath_directory *directory)
*
* @brief Zippath readdir.
*
* @param [in,out] directory If non-null, pathname of the directory.
*
- * @return null if it fails, else an osd_directory_entry*.
+ * @return null if it fails, else an osd::directory::entry*.
*/
-const osd_directory_entry *zippath_readdir(zippath_directory *directory)
+const osd::directory::entry *zippath_readdir(zippath_directory *directory)
{
- const osd_directory_entry *result = nullptr;
+ const osd::directory::entry *result = nullptr;
if (!directory->returned_parent)
{
@@ -920,7 +920,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
directory->returned_parent = true;
memset(&directory->returned_entry, 0, sizeof(directory->returned_entry));
directory->returned_entry.name = "..";
- directory->returned_entry.type = ENTTYPE_DIR;
+ directory->returned_entry.type = osd::directory::entry::entry_type::DIR;
result = &directory->returned_entry;
}
else if (directory->directory)
@@ -928,7 +928,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
/* a normal directory read */
do
{
- result = osd_readdir(directory->directory);
+ result = directory->directory->read();
}
while (result && (!strcmp(result->name, ".") || !strcmp(result->name, "..")));
@@ -937,7 +937,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
{
/* copy; but change the entry type */
directory->returned_entry = *result;
- directory->returned_entry.type = ENTTYPE_DIR;
+ directory->returned_entry.type = osd::directory::entry::entry_type::DIR;
result = &directory->returned_entry;
}
}
@@ -983,7 +983,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
/* ...and return it */
memset(&directory->returned_entry, 0, sizeof(directory->returned_entry));
directory->returned_entry.name = directory->returned_dirlist.front().c_str();
- directory->returned_entry.type = ENTTYPE_DIR;
+ directory->returned_entry.type = osd::directory::entry::entry_type::DIR;
result = &directory->returned_entry;
}
}
@@ -992,7 +992,7 @@ const osd_directory_entry *zippath_readdir(zippath_directory *directory)
/* a real file */
memset(&directory->returned_entry, 0, sizeof(directory->returned_entry));
directory->returned_entry.name = relpath;
- directory->returned_entry.type = ENTTYPE_FILE;
+ directory->returned_entry.type = osd::directory::entry::entry_type::FILE;
directory->returned_entry.size = directory->zipfile->current_uncompressed_length();
result = &directory->returned_entry;
}
diff --git a/src/lib/util/zippath.h b/src/lib/util/zippath.h
index 274852268bc..24325a89d68 100644
--- a/src/lib/util/zippath.h
+++ b/src/lib/util/zippath.h
@@ -58,7 +58,7 @@ osd_file::error zippath_opendir(const char *path, zippath_directory **directory)
void zippath_closedir(zippath_directory *directory);
/* reads a directory entry */
-const osd_directory_entry *zippath_readdir(zippath_directory *directory);
+const osd::directory::entry *zippath_readdir(zippath_directory *directory);
/* returns TRUE if this path is a ZIP path or FALSE if not */
int zippath_is_zip(zippath_directory *directory);
diff --git a/src/osd/modules/file/winfile.cpp b/src/osd/modules/file/winfile.cpp
index 9b6ecdc0535..13af3a025c8 100644
--- a/src/osd/modules/file/winfile.cpp
+++ b/src/osd/modules/file/winfile.cpp
@@ -354,7 +354,7 @@ int osd_get_physical_drive_geometry(const char *filename, UINT32 *cylinders, UIN
// osd_stat
//============================================================
-osd_directory_entry *osd_stat(const std::string &path)
+std::unique_ptr<osd::directory::entry> osd_stat(const std::string &path)
{
// convert the path to TCHARs
std::unique_ptr<TCHAR, void (*)(void *)> const t_path(tstring_from_utf8(path.c_str()), &osd_free);
@@ -379,17 +379,18 @@ osd_directory_entry *osd_stat(const std::string &path)
FindClose(find);
}
- // create an osd_directory_entry; be sure to make sure that the caller can
- // free all resources by just freeing the resulting osd_directory_entry
- osd_directory_entry *const result = (osd_directory_entry *)osd_malloc_array(sizeof(*result) + path.length() + 1);
+ // create an osd::directory::entry; be sure to make sure that the caller can
+ // free all resources by just freeing the resulting osd::directory::entry
+ osd::directory::entry *result = (osd::directory::entry *) ::operator new(sizeof(*result) + path.length() + 1);
if (!result)
return nullptr;
strcpy(((char *) result) + sizeof(*result), path.c_str());
result->name = ((char *) result) + sizeof(*result);
result->type = win_attributes_to_entry_type(find_data.dwFileAttributes);
result->size = find_data.nFileSizeLow | ((UINT64) find_data.nFileSizeHigh << 32);
+ result->last_modified = win_time_point_from_filetime(&find_data.ftLastWriteTime);
- return result;
+ return std::unique_ptr<osd::directory::entry>(result);
}
diff --git a/src/osd/modules/render/bgfx/chainentryreader.cpp b/src/osd/modules/render/bgfx/chainentryreader.cpp
index 39edd9f685c..c169a0cd441 100644
--- a/src/osd/modules/render/bgfx/chainentryreader.cpp
+++ b/src/osd/modules/render/bgfx/chainentryreader.cpp
@@ -115,12 +115,12 @@ bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, std::s
directory_path += "/" + file_directory;
}
- osd_directory *directory = osd_opendir(directory_path.c_str());
+ osd::directory *directory = osd::directory::open(directory_path.c_str());
if (directory != nullptr)
{
- for (const osd_directory_entry *entry = osd_readdir(directory); entry != nullptr; entry = osd_readdir(directory))
+ for (const osd::directory::entry *entry = directory->read(); entry != nullptr; entry = directory->read())
{
- if (entry->type == ENTTYPE_FILE)
+ if (entry->type == osd::directory::entry::entry_type::FILE)
{
std::string file(entry->name);
std::string extension(".png");
@@ -160,7 +160,7 @@ bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, std::s
}
}
- osd_closedir(directory);
+ delete directory;
}
}
}
diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp
index 34c891eb009..eaf8297a4ee 100644
--- a/src/osd/modules/render/bgfx/chainmanager.cpp
+++ b/src/osd/modules/render/bgfx/chainmanager.cpp
@@ -91,12 +91,12 @@ void chain_manager::destroy_unloaded_chains()
void chain_manager::find_available_chains(std::string root, std::string path)
{
- osd_directory *directory = osd_opendir((root + path).c_str());
+ osd::directory *directory = osd::directory::open((root + path).c_str());
if (directory != nullptr)
{
- for (const osd_directory_entry *entry = osd_readdir(directory); entry != nullptr; entry = osd_readdir(directory))
+ for (const osd::directory::entry *entry = directory->read(); entry != nullptr; entry = directory->read())
{
- if (entry->type == ENTTYPE_FILE)
+ if (entry->type == osd::directory::entry::entry_type::FILE)
{
std::string name(entry->name);
std::string extension(".json");
@@ -114,7 +114,7 @@ void chain_manager::find_available_chains(std::string root, std::string path)
}
}
}
- else if (entry->type == ENTTYPE_DIR)
+ else if (entry->type == osd::directory::entry::entry_type::DIR)
{
std::string name = entry->name;
if (!(name == "." || name == ".."))
@@ -129,7 +129,7 @@ void chain_manager::find_available_chains(std::string root, std::string path)
}
}
- osd_closedir(directory);
+ delete directory;
}
}
diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h
index c712b3fea8e..137f49d58e9 100644
--- a/src/osd/osdcore.h
+++ b/src/osd/osdcore.h
@@ -25,6 +25,7 @@
#include <cstdint>
#include <memory>
#include <string>
+#include <chrono>
/***************************************************************************
@@ -297,78 +298,66 @@ int osd_uchar_from_osdchar(UINT32 /* unicode_char */ *uchar, const char *osdchar
DIRECTORY INTERFACES
***************************************************************************/
-/* types of directory entries that can be returned */
-enum osd_dir_entry_type
+namespace osd
{
- ENTTYPE_NONE,
- ENTTYPE_FILE,
- ENTTYPE_DIR,
- ENTTYPE_OTHER
-};
-
-/* osd_directory is an opaque type which represents an open directory */
-struct osd_directory;
-
-/* osd_directory_entry contains basic information about a file when iterating through */
-/* a directory */
-struct osd_directory_entry
-{
- const char * name; /* name of the entry */
- osd_dir_entry_type type; /* type of the entry */
- UINT64 size; /* size of the entry */
+ // directory is an opaque type which represents an open directory
+ class directory
+ {
+ public:
+ // 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
+ UINT64 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 directory *open(const char *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_opendir: open a directory for iteration
-
- Parameters:
-
- dirname - path to the directory in question
-
- Return value:
-
- upon success, this function should return an osd_directory pointer
- which contains opaque data necessary to traverse the directory; on
- failure, this function should return nullptr
------------------------------------------------------------------------------*/
-osd_directory *osd_opendir(const char *dirname);
-
-
-/*-----------------------------------------------------------------------------
- osd_readdir: return information about the next entry in the directory
-
- Parameters:
-
- dir - pointer to an osd_directory that was returned from a prior
- call to osd_opendir
-
- Return value:
-
- a constant pointer to an osd_directory_entry representing the current item
- in the directory, or nullptr, indicating that no more entries are
- present
------------------------------------------------------------------------------*/
-const osd_directory_entry *osd_readdir(osd_directory *dir);
-
-
-/*-----------------------------------------------------------------------------
- osd_closedir: close an open directory for iteration
-
- Parameters:
-
- dir - pointer to an osd_directory that was returned from a prior
- call to osd_opendir
-
- Return value:
-
- frees any allocated memory and resources associated with the open
- directory
------------------------------------------------------------------------------*/
-void osd_closedir(osd_directory *dir);
-
-
-/*-----------------------------------------------------------------------------
osd_is_absolute_path: returns whether the specified path is absolute
Parameters:
@@ -798,12 +787,11 @@ char *osd_get_clipboard_text(void);
Return value:
- an allocated pointer to an osd_directory_entry representing
+ an allocated pointer to an osd::directory::entry representing
info on the path; even if the file does not exist.
- free with osd_free()
-----------------------------------------------------------------------------*/
-osd_directory_entry *osd_stat(std::string const &path);
+std::unique_ptr<osd::directory::entry> osd_stat(std::string const &path);
/***************************************************************************
PATH INTERFACES
diff --git a/src/osd/windows/windir.cpp b/src/osd/windows/windir.cpp
index f7b7fd44c6a..32c5ec232ae 100644
--- a/src/osd/windows/windir.cpp
+++ b/src/osd/windows/windir.cpp
@@ -28,36 +28,39 @@
// TYPE DEFINITIONS
//============================================================
-struct osd_directory
+namespace
{
- HANDLE find; // handle to the finder
- int is_first; // TRUE if this is the first entry
- osd_directory_entry entry; // current entry's data
- WIN32_FIND_DATA data; // current raw data
-};
+ class win_directory : public osd::directory
+ {
+ public:
+ win_directory();
+ ~win_directory();
+ virtual const entry *read() override;
+
+ HANDLE m_find; // handle to the finder
+ bool m_is_first; // true if this is the first entry
+ entry m_entry; // current entry's data
+ WIN32_FIND_DATA m_data; // current raw data
+ };
+};
//============================================================
-// osd_opendir
+// osd::directory::open
//============================================================
-osd_directory *osd_opendir(const char *dirname)
+osd::directory *osd::directory::open(const char *dirname)
{
- osd_directory *dir = nullptr;
+ win_directory *dir = nullptr;
TCHAR *t_dirname = nullptr;
TCHAR *dirfilter = nullptr;
size_t dirfilter_size;
// allocate memory to hold the osd_tool_directory structure
- dir = (osd_directory *)malloc(sizeof(*dir));
+ dir = new win_directory();
if (dir == nullptr)
goto error;
- memset(dir, 0, sizeof(*dir));
-
- // initialize the structure
- dir->find = INVALID_HANDLE_VALUE;
- dir->is_first = TRUE;
// convert the path to TCHARs
t_dirname = tstring_from_utf8(dirname);
@@ -72,7 +75,7 @@ osd_directory *osd_opendir(const char *dirname)
_sntprintf(dirfilter, dirfilter_size, TEXT("%s\\*.*"), t_dirname);
// attempt to find the first file
- dir->find = FindFirstFileEx(dirfilter, FindExInfoStandard, &dir->data, FindExSearchNameMatch, nullptr, 0);
+ dir->m_find = FindFirstFileEx(dirfilter, FindExInfoStandard, &dir->m_data, FindExSearchNameMatch, nullptr, 0);
error:
// cleanup
@@ -80,9 +83,9 @@ error:
osd_free(t_dirname);
if (dirfilter != nullptr)
free(dirfilter);
- if (dir != nullptr && dir->find == INVALID_HANDLE_VALUE)
+ if (dir != nullptr && dir->m_find == INVALID_HANDLE_VALUE)
{
- free(dir);
+ delete dir;
dir = nullptr;
}
return dir;
@@ -90,47 +93,56 @@ error:
//============================================================
-// osd_readdir
+// win_directory::win_directory
//============================================================
-const osd_directory_entry *osd_readdir(osd_directory *dir)
+win_directory::win_directory()
+ : m_find(INVALID_HANDLE_VALUE), m_is_first(true)
{
- // if we've previously allocated a name, free it now
- if (dir->entry.name != nullptr)
- {
- osd_free((void *)dir->entry.name);
- dir->entry.name = nullptr;
- }
+ memset(&m_entry, 0, sizeof(m_entry));
+ memset(&m_data, 0, sizeof(m_data));
+}
- // if this isn't the first file, do a find next
- if (!dir->is_first)
- {
- if (!FindNextFile(dir->find, &dir->data))
- return nullptr;
- }
- // otherwise, just use the data we already had
- else
- dir->is_first = FALSE;
+//============================================================
+// win_directory::~win_directory
+//============================================================
- // extract the data
- dir->entry.name = utf8_from_tstring(dir->data.cFileName);
- dir->entry.type = win_attributes_to_entry_type(dir->data.dwFileAttributes);
- dir->entry.size = dir->data.nFileSizeLow | ((UINT64) dir->data.nFileSizeHigh << 32);
- return (dir->entry.name != nullptr) ? &dir->entry : nullptr;
+win_directory::~win_directory()
+{
+ // free any data associated
+ if (m_entry.name != nullptr)
+ osd_free((void *)m_entry.name);
+ if (m_find != INVALID_HANDLE_VALUE)
+ FindClose(m_find);
}
//============================================================
-// osd_closedir
+// win_directory::read
//============================================================
-void osd_closedir(osd_directory *dir)
+const osd::directory::entry *win_directory::read()
{
- // free any data associated
- if (dir->entry.name != nullptr)
- osd_free((void *)dir->entry.name);
- if (dir->find != INVALID_HANDLE_VALUE)
- FindClose(dir->find);
- free(dir);
+ // if we've previously allocated a name, free it now
+ if (m_entry.name != nullptr)
+ {
+ osd_free((void *)m_entry.name);
+ m_entry.name = nullptr;
+ }
+
+ // if this isn't the first file, do a find next
+ if (!m_is_first)
+ {
+ if (!FindNextFile(m_find, &m_data))
+ return nullptr;
+ }
+ m_is_first = false;
+
+ // extract the data
+ m_entry.name = utf8_from_tstring(m_data.cFileName);
+ m_entry.type = win_attributes_to_entry_type(m_data.dwFileAttributes);
+ m_entry.size = m_data.nFileSizeLow | ((UINT64) m_data.nFileSizeHigh << 32);
+ m_entry.last_modified = win_time_point_from_filetime(&m_data.ftLastWriteTime);
+ return (m_entry.name != nullptr) ? &m_entry : nullptr;
}
diff --git a/src/osd/windows/winutil.cpp b/src/osd/windows/winutil.cpp
index 880e9aa7a06..3ec2314068e 100644
--- a/src/osd/windows/winutil.cpp
+++ b/src/osd/windows/winutil.cpp
@@ -23,14 +23,26 @@
// win_attributes_to_entry_type
//============================================================
-osd_dir_entry_type win_attributes_to_entry_type(DWORD attributes)
+osd::directory::entry::entry_type win_attributes_to_entry_type(DWORD attributes)
{
if (attributes == 0xFFFFFFFF)
- return ENTTYPE_NONE;
+ return osd::directory::entry::entry_type::NONE;
else if (attributes & FILE_ATTRIBUTE_DIRECTORY)
- return ENTTYPE_DIR;
+ return osd::directory::entry::entry_type::DIR;
else
- return ENTTYPE_FILE;
+ return osd::directory::entry::entry_type::FILE;
+}
+
+
+
+//============================================================
+// win_time_point_from_filetime
+//============================================================
+
+std::chrono::system_clock::time_point win_time_point_from_filetime(LPFILETIME file_time)
+{
+ return std::chrono::system_clock::time_point(std::chrono::system_clock::duration(
+ (static_cast<__int64>(file_time->dwHighDateTime) << 32) | file_time->dwLowDateTime));
}
diff --git a/src/osd/windows/winutil.h b/src/osd/windows/winutil.h
index 2598a920864..57470bf1372 100644
--- a/src/osd/windows/winutil.h
+++ b/src/osd/windows/winutil.h
@@ -12,9 +12,11 @@
#include "osdcore.h"
#include <string>
#include <vector>
+#include <chrono>
// Shared code
-osd_dir_entry_type win_attributes_to_entry_type(DWORD attributes);
+osd::directory::entry::entry_type win_attributes_to_entry_type(DWORD attributes);
+std::chrono::system_clock::time_point win_time_point_from_filetime(LPFILETIME file_time);
BOOL win_is_gui_application(void);
HMODULE WINAPI GetModuleHandleUni();