summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
author Firehawke <Firehawke@users.noreply.github.com>2017-12-13 21:01:10 -0700
committer Firehawke <Firehawke@users.noreply.github.com>2017-12-13 21:01:10 -0700
commit54155441e9ba9941e85d80c4834a66376a11e791 (patch)
treeaa44bdaf0035cbe188d64c447f225f10f7d76d8d /src/frontend
parentf537428e5a40ba6dde8ca9bf0fe9ae6b1f189ac4 (diff)
Revert "Merge branch 'master' of https://github.com/mamedev/mame"
This reverts commit f537428e5a40ba6dde8ca9bf0fe9ae6b1f189ac4, reversing changes made to 0d70d798107d4e4e8fb9f230410aeb1e888d65c5.
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/mame.cpp9
-rw-r--r--src/frontend/mame/ui/filesel.cpp142
-rw-r--r--src/frontend/mame/ui/filesel.h44
-rw-r--r--src/frontend/mame/ui/submenu.cpp2
-rw-r--r--src/frontend/mame/ui/ui.cpp5
5 files changed, 93 insertions, 109 deletions
diff --git a/src/frontend/mame/mame.cpp b/src/frontend/mame/mame.cpp
index 63c765abc24..8e6a0614260 100644
--- a/src/frontend/mame/mame.cpp
+++ b/src/frontend/mame/mame.cpp
@@ -155,14 +155,7 @@ void mame_machine_manager::start_luaengine()
}
if (options().console())
{
- if (m_plugins->exists(OPTION_CONSOLE))
- {
- m_plugins->set_value(OPTION_CONSOLE, "1", OPTION_PRIORITY_CMDLINE);
- }
- else
- {
- fatalerror("Console plugin not found.\n");
- }
+ m_plugins->set_value("console", "1", OPTION_PRIORITY_CMDLINE);
}
m_lua->initialize();
diff --git a/src/frontend/mame/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp
index c64dcc5001e..256834c5de1 100644
--- a/src/frontend/mame/ui/filesel.cpp
+++ b/src/frontend/mame/ui/filesel.cpp
@@ -47,15 +47,14 @@ namespace ui {
menu_file_selector::menu_file_selector(mame_ui_manager &mui, render_container &container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool has_empty, bool has_softlist, bool has_create, menu_file_selector::result &result)
: menu(mui, container)
- , m_image(image)
, m_current_directory(current_directory)
, m_current_file(current_file)
- , m_has_empty(has_empty)
- , m_has_softlist(has_softlist)
- , m_has_create(has_create)
, m_result(result)
{
- (void)m_image;
+ m_image = image;
+ m_has_empty = has_empty;
+ m_has_softlist = has_softlist;
+ m_has_create = has_create;
}
@@ -177,9 +176,7 @@ int menu_file_selector::compare_entries(const file_selector_entry *e1, const fil
//-------------------------------------------------
menu_file_selector::file_selector_entry &menu_file_selector::append_entry(
- file_selector_entry_type entry_type,
- const std::string &entry_basename,
- const std::string &entry_fullpath)
+ file_selector_entry_type entry_type, const std::string &entry_basename, const std::string &entry_fullpath)
{
return append_entry(entry_type, std::string(entry_basename), std::string(entry_fullpath));
}
@@ -191,9 +188,7 @@ menu_file_selector::file_selector_entry &menu_file_selector::append_entry(
//-------------------------------------------------
menu_file_selector::file_selector_entry &menu_file_selector::append_entry(
- file_selector_entry_type entry_type,
- std::string &&entry_basename,
- std::string &&entry_fullpath)
+ file_selector_entry_type entry_type, std::string &&entry_basename, std::string &&entry_fullpath)
{
// allocate a new entry
file_selector_entry entry;
@@ -202,41 +197,47 @@ menu_file_selector::file_selector_entry &menu_file_selector::append_entry(
entry.fullpath = std::move(entry_fullpath);
// find the end of the list
- return *m_entrylist.emplace(m_entrylist.end(), std::move(entry));
+ m_entrylist.emplace_back(std::move(entry));
+ return m_entrylist[m_entrylist.size() - 1];
}
//-------------------------------------------------
-// append_dirent_entry - appends
+// append_entry_menu_item - appends
// 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)
{
+ std::string buffer;
file_selector_entry_type entry_type;
- switch (dirent->type)
+ file_selector_entry *entry;
+
+ switch(dirent->type)
{
- case osd::directory::entry::entry_type::FILE:
- entry_type = SELECTOR_ENTRY_TYPE_FILE;
- break;
+ case osd::directory::entry::entry_type::FILE:
+ entry_type = SELECTOR_ENTRY_TYPE_FILE;
+ break;
- case osd::directory::entry::entry_type::DIR:
- entry_type = SELECTOR_ENTRY_TYPE_DIRECTORY;
- break;
+ case osd::directory::entry::entry_type::DIR:
+ entry_type = SELECTOR_ENTRY_TYPE_DIRECTORY;
+ break;
- default:
- // exceptional case; do not add a menu item
- return nullptr;
+ default:
+ // exceptional case; do not add a menu item
+ return nullptr;
}
// determine the full path
- std::string buffer = util::zippath_combine(m_current_directory, dirent->name);
+ buffer = util::zippath_combine(m_current_directory, dirent->name);
// create the file selector entry
- return &append_entry(
- entry_type,
- dirent->name,
- std::move(buffer));
+ entry = &append_entry(
+ entry_type,
+ dirent->name,
+ std::move(buffer));
+
+ return entry;
}
@@ -289,51 +290,64 @@ void menu_file_selector::append_entry_menu_item(const file_selector_entry *entry
void menu_file_selector::populate(float &customtop, float &custombottom)
{
+ util::zippath_directory *directory = nullptr;
+ osd_file::error err;
+ const osd::directory::entry *dirent;
+ const file_selector_entry *entry;
const file_selector_entry *selected_entry = nullptr;
+ int i;
+ const char *volume_name;
+ uint8_t first;
+ // open the directory
+ err = util::zippath_opendir(m_current_directory, &directory);
// clear out the menu entries
m_entrylist.clear();
- // open the directory
- util::zippath_directory *directory = nullptr;
- osd_file::error const err = util::zippath_opendir(m_current_directory, &directory);
-
- // add the "[empty slot]" entry if available
if (m_has_empty)
+ {
+ // add the "[empty slot]" entry
append_entry(SELECTOR_ENTRY_TYPE_EMPTY, "", "");
+ }
- // add the "[create]" entry
if (m_has_create && !util::zippath_is_zip(directory))
+ {
+ // add the "[create]" entry
append_entry(SELECTOR_ENTRY_TYPE_CREATE, "", "");
+ }
- // add and select the "[software list]" entry if available
if (m_has_softlist)
- selected_entry = &append_entry(SELECTOR_ENTRY_TYPE_SOFTWARE_LIST, "", "");
+ {
+ // add the "[software list]" entry
+ entry = &append_entry(SELECTOR_ENTRY_TYPE_SOFTWARE_LIST, "", "");
+ selected_entry = entry;
+ }
// add the drives
- int i = 0;
- for (char const *volume_name = osd_get_volume_name(i); volume_name; volume_name = osd_get_volume_name(++i))
- append_entry(SELECTOR_ENTRY_TYPE_DRIVE, volume_name, volume_name);
+ i = 0;
+ while((volume_name = osd_get_volume_name(i))!=nullptr)
+ {
+ append_entry(SELECTOR_ENTRY_TYPE_DRIVE,
+ volume_name, volume_name);
+ i++;
+ }
// mark first filename entry
- std::size_t const first = m_entrylist.size() + 1;
+ first = m_entrylist.size() + 1;
// build the menu for each item
- if (osd_file::error::NONE != err)
- {
- osd_printf_verbose("menu_file_selector::populate: error opening directory '%s' (%d)\n", m_current_directory.c_str(), int(err));
- }
- else
+ if (err == osd_file::error::NONE)
{
- for (osd::directory::entry const *dirent = util::zippath_readdir(directory); dirent; dirent = util::zippath_readdir(directory))
+ while((dirent = util::zippath_readdir(directory)) != nullptr)
{
// append a dirent entry
- file_selector_entry const *entry = append_dirent_entry(dirent);
- if (entry)
+ entry = append_dirent_entry(dirent);
+
+ if (entry != nullptr)
{
// set the selected item to be the first non-parent directory or file
- if (!selected_entry && strcmp(dirent->name, ".."))
+ if ((selected_entry == nullptr) && strcmp(dirent->name, ".."))
selected_entry = entry;
// do we have to select this file?
@@ -342,31 +356,29 @@ void menu_file_selector::populate(float &customtop, float &custombottom)
}
}
}
- if (directory)
- util::zippath_closedir(directory);
// sort the menu entries
- const std::collate<wchar_t> &coll = std::use_facet<std::collate<wchar_t>>(std::locale());
- std::sort(
- m_entrylist.begin() + first,
- m_entrylist.end(),
- [&coll] (file_selector_entry const &x, file_selector_entry const &y)
- {
- std::wstring const xstr = wstring_from_utf8(x.basename);
- std::wstring const ystr = wstring_from_utf8(y.basename);
- return coll.compare(xstr.data(), xstr.data()+xstr.size(), ystr.data(), ystr.data()+ystr.size()) < 0;
- });
+ const std::collate<wchar_t>& coll = std::use_facet<std::collate<wchar_t>>(std::locale());
+ std::sort(m_entrylist.begin()+first, m_entrylist.end(), [&coll](file_selector_entry const &x, file_selector_entry const &y)
+ {
+ std::wstring xstr = wstring_from_utf8(x.basename);
+ std::wstring ystr = wstring_from_utf8(y.basename);
+ return coll.compare(xstr.data(), xstr.data()+xstr.size(), ystr.data(), ystr.data()+ystr.size()) < 0;
+ } );
// append all of the menu entries
- for (file_selector_entry const &entry : m_entrylist)
+ for (auto &entry : m_entrylist)
append_entry_menu_item(&entry);
// set the selection (if we have one)
- if (selected_entry)
- set_selection((void *)selected_entry);
+ if (selected_entry != nullptr)
+ set_selection((void *) selected_entry);
// set up custom render proc
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
+
+ if (directory != nullptr)
+ util::zippath_closedir(directory);
}
@@ -414,7 +426,7 @@ void menu_file_selector::handle()
if (err != osd_file::error::NONE)
{
// this path is problematic; present the user with an error and bail
- ui().popup_time(1, _("Error accessing %s"), entry->fullpath);
+ ui().popup_time(1, "Error accessing %s", entry->fullpath);
break;
}
m_current_directory.assign(entry->fullpath);
diff --git a/src/frontend/mame/ui/filesel.h b/src/frontend/mame/ui/filesel.h
index 2aec3a77da1..6e1759588dd 100644
--- a/src/frontend/mame/ui/filesel.h
+++ b/src/frontend/mame/ui/filesel.h
@@ -16,7 +16,6 @@
#include "ui/menu.h"
namespace ui {
-
// ======================> menu_file_selector
class menu_file_selector : public menu
@@ -31,16 +30,7 @@ public:
FILE
};
- menu_file_selector(
- mame_ui_manager &mui,
- render_container &container,
- device_image_interface *image,
- std::string &current_directory,
- std::string &current_file,
- bool has_empty,
- bool has_softlist,
- bool has_create,
- result &result);
+ menu_file_selector(mame_ui_manager &mui, render_container &container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool has_empty, bool has_softlist, bool has_create, result &result);
virtual ~menu_file_selector() override;
protected:
@@ -60,7 +50,7 @@ private:
struct file_selector_entry
{
- file_selector_entry() { }
+ file_selector_entry() {}
file_selector_entry(file_selector_entry &&) = default;
file_selector_entry &operator=(file_selector_entry &&) = default;
file_selector_entry_type type;
@@ -69,16 +59,16 @@ private:
};
// internal state
- device_image_interface *const m_image;
- std::string & m_current_directory;
- std::string & m_current_file;
- bool const m_has_empty;
- bool const m_has_softlist;
- bool const m_has_create;
- result & m_result;
+ device_image_interface * m_image;
+ std::string & m_current_directory;
+ std::string & m_current_file;
+ bool m_has_empty;
+ bool m_has_softlist;
+ bool m_has_create;
+ result & m_result;
std::vector<file_selector_entry> m_entrylist;
- std::string m_hover_directory;
- std::string m_filename;
+ std::string m_hover_directory;
+ std::string m_filename;
virtual void populate(float &customtop, float &custombottom) override;
virtual void handle() override;
@@ -105,20 +95,16 @@ public:
WRITE_OTHER,
WRITE_DIFF
};
- menu_select_rw(
- mame_ui_manager &mui,
- render_container &container,
- bool can_in_place,
- result &result);
+ menu_select_rw(mame_ui_manager &mui, render_container &container,
+ bool can_in_place, result &result);
virtual ~menu_select_rw() override;
+ virtual void populate(float &customtop, float &custombottom) override;
+ virtual void handle() override;
static void *itemref_from_result(result result);
static result result_from_itemref(void *itemref);
private:
- virtual void populate(float &customtop, float &custombottom) override;
- virtual void handle() override;
-
// internal state
bool m_can_in_place;
result & m_result;
diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp
index 33632cb4150..367fb429a53 100644
--- a/src/frontend/mame/ui/submenu.cpp
+++ b/src/frontend/mame/ui/submenu.cpp
@@ -63,8 +63,6 @@ std::vector<submenu::option> const submenu::advanced_options = {
{ submenu::option_type::HEAD, __("State/Playback Options") },
{ submenu::option_type::EMU, __("Automatic save/restore"), OPTION_AUTOSAVE },
- { submenu::option_type::EMU, __("Rewind"), OPTION_REWIND },
- { submenu::option_type::EMU, __("Rewind capacity"), OPTION_REWIND_CAPACITY },
{ submenu::option_type::EMU, __("Bilinear snapshot"), OPTION_SNAPBILINEAR },
{ submenu::option_type::EMU, __("Burn-in"), OPTION_BURNIN },
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index df5089cb1c0..026bf0c34f7 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -1200,15 +1200,10 @@ uint32_t mame_ui_manager::handler_ingame(render_container &container)
// pause single step
if (machine().ui_input().pressed(IPT_UI_PAUSE_SINGLE))
{
- machine().rewind_capture();
set_single_step(true);
machine().resume();
}
- // rewind single step
- if (machine().ui_input().pressed(IPT_UI_REWIND_SINGLE))
- machine().rewind_step();
-
// handle a toggle cheats request
if (machine().ui_input().pressed(IPT_UI_TOGGLE_CHEAT))
mame_machine_manager::instance()->cheat().set_enable(!mame_machine_manager::instance()->cheat().enabled());