summaryrefslogtreecommitdiffstats
path: root/src/frontend/mame/ui/ui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/mame/ui/ui.cpp')
-rw-r--r--src/frontend/mame/ui/ui.cpp90
1 files changed, 85 insertions, 5 deletions
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index d65cf9c581b..df10800608b 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -36,7 +36,6 @@
#include "rendfont.h"
#include "romload.h"
#include "uiinput.h"
-
#include "../osd/modules/lib/osdobj_common.h"
#include <chrono>
@@ -202,7 +201,7 @@ void mame_ui_manager::init()
// update font row info from setting
update_target_font_height();
- // more initialization
+ // more initialisation
using namespace std::placeholders;
set_handler(ui_callback_type::GENERAL, std::bind(&mame_ui_manager::handler_messagebox, this, _1));
m_non_char_keys_down = std::make_unique<uint8_t[]>((ARRAY_LENGTH(non_char_keys) + 7) / 8);
@@ -210,6 +209,8 @@ void mame_ui_manager::init()
// request notification callbacks
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&mame_ui_manager::exit, this));
+ // register callbacks
+ machine().configuration().config_register("sliders", config_load_delegate(&mame_ui_manager::config_load_s, this), config_save_delegate(&mame_ui_manager::config_save_s, this));
machine().configuration().config_register(
"ui_warnings",
config_load_delegate(&mame_ui_manager::config_load, this),
@@ -603,7 +604,8 @@ void mame_ui_manager::update_and_render(render_container &container)
m_popup_text_end = 0;
// display the internal mouse cursor
- if (m_mouse_show || (is_menu_active() && machine().options().ui_mouse()))
+ if (machine().options().ui_mouse() && (m_mouse_show || is_menu_active())) //MESSUI - (NEWUI) system pointer always on; MAME pointer always off
+// if (m_mouse_show || (is_menu_active() && machine().options().ui_mouse()))
{
int32_t mouse_target_x, mouse_target_y;
bool mouse_button;
@@ -1539,7 +1541,7 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
// add CPU overclocking (cheat only)
slider_index = 0;
- if (machine.options().cheat())
+// if (machine.options().cheat()) // HBMAME
{
for (device_execute_interface &exec : execute_interface_iterator(machine.root_device()))
{
@@ -1572,7 +1574,7 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
std::string screen_desc = machine_info().get_screen_desc(screen);
// add refresh rate tweaker
- if (machine.options().cheat())
+// if (machine.options().cheat()) // HBMAME
{
std::string str = string_format(_("%1$s Refresh Rate"), screen_desc);
m_sliders.push_back(slider_alloc(SLIDER_ID_REFRESH + slider_index, str.c_str(), -10000, 0, 10000, 1000, param));
@@ -1657,6 +1659,7 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
}
}
#endif
+ config_apply();
std::vector<ui::menu_item> items;
for (auto &slider : m_sliders)
@@ -2359,6 +2362,83 @@ void mame_ui_manager::menu_reset()
ui::menu::stack_reset(machine());
}
+
+//-------------------------------------------------
+// config_load - read data from the
+// configuration file
+//-------------------------------------------------
+
+void mame_ui_manager::config_load_s(config_type cfg_type, util::xml::data_node const *parentnode)
+{
+ // we only care about game files
+ if (cfg_type != config_type::GAME)
+ return;
+
+ // might not have any data
+ if (parentnode == nullptr)
+ return;
+
+ // iterate over slider nodes
+ for (util::xml::data_node const *slider_node = parentnode->get_child("slider"); slider_node; slider_node = slider_node->get_next_sibling("slider"))
+ {
+ const char *desc = slider_node->get_attribute_string("desc", "");
+ int32_t saved_val = slider_node->get_attribute_int("value", 0);
+
+ // create a dummy slider to store the saved value
+ m_sliders_saved.push_back(slider_alloc(0, desc, 0, saved_val, 0, 0, 0));
+ }
+}
+
+
+//-------------------------------------------------
+// config_appy - apply data from the conf. file
+// This currently needs to be done on a separate
+// step because sliders are not created yet when
+// configuration file is loaded
+//-------------------------------------------------
+
+void mame_ui_manager::config_apply(void)
+{
+ // iterate over sliders and restore saved values
+ for (auto &slider : m_sliders)
+ {
+ for (auto &slider_saved : m_sliders_saved)
+ {
+ if (!strcmp(slider->description.c_str(), slider_saved->description.c_str()))
+ {
+ std::string tempstring;
+ slider->update(machine(), slider->arg, slider->id, &tempstring, slider_saved->defval);
+ break;
+ }
+ }
+ }
+}
+
+
+//-------------------------------------------------
+// config_save - save data to the configuration
+// file
+//-------------------------------------------------
+
+void mame_ui_manager::config_save_s(config_type cfg_type, util::xml::data_node *parentnode)
+{
+ // we only care about game files
+ if (cfg_type != config_type::GAME)
+ return;
+
+ std::string tempstring;
+ util::xml::data_node *slider_node;
+
+ // save UI sliders
+ for (auto &slider : m_sliders)
+ {
+ int32_t curval = slider->update(machine(), slider->arg, slider->id, &tempstring, SLIDER_NOCHANGE);
+ slider_node = parentnode->add_child("slider", nullptr);
+ slider_node->set_attribute("desc", slider->description.c_str());
+ slider_node->set_attribute_int("value", curval);
+ }
+}
+
void ui_colors::refresh(const ui_options &options)
{
m_border_color = options.border_color();