mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
ui: able to show emulation warnings from tab menu
This commit is contained in:
parent
890104f33d
commit
4ee2f625bb
@ -293,10 +293,6 @@ std::string machine_info::warnings_string() const
|
||||
buf << '\n';
|
||||
}
|
||||
|
||||
// add the 'press OK' string
|
||||
if (!buf.str().empty())
|
||||
buf << _("\n\nPress any key to continue");
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
@ -451,9 +447,8 @@ std::string machine_info::get_screen_desc(screen_device &screen) const
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
menu_game_info - handle the game information
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
menu_game_info - handle the game information menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
menu_game_info::menu_game_info(mame_ui_manager &mui, render_container &container) : menu(mui, container)
|
||||
{
|
||||
@ -477,9 +472,33 @@ void menu_game_info::handle()
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
menu_image_info - handle the image information
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
menu_warn_info - handle the emulation warnings menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
menu_warn_info::menu_warn_info(mame_ui_manager &mui, render_container &container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
menu_warn_info::~menu_warn_info()
|
||||
{
|
||||
}
|
||||
|
||||
void menu_warn_info::populate(float &customtop, float &custombottom)
|
||||
{
|
||||
std::string tempstring = ui().machine_info().warnings_string();
|
||||
item_append(std::move(tempstring), "", FLAG_MULTILINE, nullptr);
|
||||
}
|
||||
|
||||
void menu_warn_info::handle()
|
||||
{
|
||||
// process the menu
|
||||
process(0);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
menu_image_info - handle the image information menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
menu_image_info::menu_image_info(mame_ui_manager &mui, render_container &container) : menu(mui, container)
|
||||
{
|
||||
|
@ -96,6 +96,18 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class menu_warn_info : public menu
|
||||
{
|
||||
public:
|
||||
menu_warn_info(mame_ui_manager &mui, render_container &container);
|
||||
virtual ~menu_warn_info() override;
|
||||
|
||||
private:
|
||||
virtual void populate(float &customtop, float &custombottom) override;
|
||||
virtual void handle() override;
|
||||
};
|
||||
|
||||
|
||||
class menu_image_info : public menu
|
||||
{
|
||||
public:
|
||||
|
@ -75,6 +75,9 @@ void menu_main::populate(float &customtop, float &custombottom)
|
||||
|
||||
item_append(_("Machine Information"), "", 0, (void *)GAME_INFO);
|
||||
|
||||
if (ui().found_machine_warnings())
|
||||
item_append(_("Warning Information"), "", 0, (void *)WARN_INFO);
|
||||
|
||||
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
|
||||
{
|
||||
if (image.user_loadable())
|
||||
@ -184,6 +187,10 @@ void menu_main::handle()
|
||||
menu::stack_push<menu_game_info>(ui(), container());
|
||||
break;
|
||||
|
||||
case WARN_INFO:
|
||||
menu::stack_push<menu_warn_info>(ui(), container());
|
||||
break;
|
||||
|
||||
case IMAGE_MENU_IMAGE_INFO:
|
||||
menu::stack_push<menu_image_info>(ui(), container());
|
||||
break;
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
ANALOG,
|
||||
BOOKKEEPING,
|
||||
GAME_INFO,
|
||||
WARN_INFO,
|
||||
IMAGE_MENU_IMAGE_INFO,
|
||||
IMAGE_MENU_FILE_MANAGER,
|
||||
TAPE_CONTROL,
|
||||
|
@ -166,7 +166,9 @@ mame_ui_manager::mame_ui_manager(running_machine &machine)
|
||||
, m_mouse_bitmap(32, 32)
|
||||
, m_mouse_arrow_texture(nullptr)
|
||||
, m_mouse_show(false)
|
||||
, m_target_font_height(0) {}
|
||||
, m_target_font_height(0)
|
||||
, m_has_warnings(false)
|
||||
{ }
|
||||
|
||||
mame_ui_manager::~mame_ui_manager()
|
||||
{
|
||||
@ -329,10 +331,11 @@ void mame_ui_manager::display_startup_screens(bool first_time)
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
if (show_warnings)
|
||||
messagebox_text = machine_info().warnings_string();
|
||||
if (!messagebox_text.empty())
|
||||
messagebox_text = machine_info().warnings_string();
|
||||
m_has_warnings = !messagebox_text.empty();
|
||||
if (m_has_warnings && show_warnings)
|
||||
{
|
||||
messagebox_text.append("\n\nPress any key to continue");
|
||||
set_handler(ui_callback_type::MODAL, std::bind(&mame_ui_manager::handler_messagebox_anykey, this, _1));
|
||||
messagebox_backcolor = machine_info().warnings_color();
|
||||
}
|
||||
|
@ -223,6 +223,7 @@ public:
|
||||
void show_mouse(bool status);
|
||||
virtual bool is_menu_active() override;
|
||||
bool can_paste();
|
||||
bool found_machine_warnings() const { return m_has_warnings; }
|
||||
void image_handler_ingame();
|
||||
void increase_frameskip();
|
||||
void decrease_frameskip();
|
||||
@ -261,7 +262,7 @@ private:
|
||||
render_font * m_font;
|
||||
std::function<uint32_t (render_container &)> m_handler_callback;
|
||||
ui_callback_type m_handler_callback_type;
|
||||
uint32_t m_handler_param;
|
||||
uint32_t m_handler_param;
|
||||
bool m_single_step;
|
||||
bool m_showfps;
|
||||
osd_ticks_t m_showfps_end;
|
||||
@ -274,6 +275,7 @@ private:
|
||||
ui_options m_ui_options;
|
||||
ui_colors m_ui_colors;
|
||||
float m_target_font_height;
|
||||
bool m_has_warnings;
|
||||
|
||||
std::unique_ptr<ui::machine_info> m_machine_info;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user