diff options
author | 2021-10-09 12:16:17 +1100 | |
---|---|---|
committer | 2021-10-09 12:16:17 +1100 | |
commit | 38082ccbee749d650ccea886ae376a5d1dec337c (patch) | |
tree | 9ba9a900ba826bda58832834278025ced17f42f5 /src/frontend/mame/ui/ui.h | |
parent | 34b3bf701098082feb9077db49987507962c1578 (diff) |
Overdue internal UI enhancements (#8674)
* frontend: Added support for message context to localisations.
* frontend: Added string_view versions of the message lookup functions.
* frontend: Added a few more folder options to the internal UI.
* emu/softlist.cpp: Use more appropriate containers.
* Switched to Python 3 by default - this will become a requirement.
* Updated msgfmt.py for message context support.
* frontend: Show all software item info in the internal UI.
* frontend: Search alternate titles in software selection menu.
* 3rdparty/utf8proc: Updated to v2.6.1 (has several fixes).
* frontend: Added software filters for common info fields.
* frontend: Allow UI manager to hold onto persistent session data.
* frontend: Cache software lists for eight machines.
* frontend: Added support for loading localised system names.
* frontend: Add UI for selecting localised system names.
Diffstat (limited to 'src/frontend/mame/ui/ui.h')
-rw-r--r-- | src/frontend/mame/ui/ui.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h index e9df57b3b2d..633d3c476f4 100644 --- a/src/frontend/mame/ui/ui.h +++ b/src/frontend/mame/ui/ui.h @@ -21,10 +21,15 @@ #include "ui/slider.h" #include "ui/text.h" +#include <any> +#include <cassert> #include <ctime> #include <functional> +#include <map> #include <set> #include <string_view> +#include <typeindex> +#include <typeinfo> #include <utility> #include <vector> @@ -213,9 +218,22 @@ public: virtual void menu_reset() override; + template <typename Owner, typename Data, typename... Param> + Data &get_session_data(Param &&... args) + { + auto const ins(m_session_data.try_emplace(typeid(Owner))); + assert(!ins.first->second.has_value() == ins.second); + if (ins.second) + return ins.first->second.emplace<Data>(std::forward<Param>(args)...); + Data *const result(std::any_cast<Data>(&ins.first->second)); + assert(result); + return *result; + } + private: using handler_callback_func = std::function<uint32_t (render_container &)>; using device_feature_set = std::set<std::pair<std::string, std::string> >; + using session_data_map = std::map<std::type_index, std::any>; // instance variables std::unique_ptr<render_font> m_font; @@ -243,6 +261,8 @@ private: std::time_t m_last_launch_time; std::time_t m_last_warning_time; + session_data_map m_session_data; + // static variables static std::string messagebox_text; static std::string messagebox_poptext; @@ -284,10 +304,10 @@ private: int32_t slider_beam_dot_size(screen_device &screen, std::string *str, int32_t newval); int32_t slider_beam_intensity_weight(screen_device &screen, std::string *str, int32_t newval); std::string slider_get_screen_desc(screen_device &screen); - #ifdef MAME_DEBUG +#ifdef MAME_DEBUG int32_t slider_crossscale(ioport_field &field, std::string *str, int32_t newval); int32_t slider_crossoffset(ioport_field &field, std::string *str, int32_t newval); - #endif +#endif std::vector<std::unique_ptr<slider_state>> m_sliders; }; |