frontend: Don't let the non-menus get as far as trying to draw.

This commit is contained in:
Vas Crabb 2021-11-04 10:32:24 +11:00
parent dc33e01896
commit 6e355f86c8
3 changed files with 29 additions and 20 deletions

View File

@ -44,7 +44,7 @@ function autofire.startplugin()
for i, button in ipairs(buttons) do
local key = button.port .. '\0' .. button.mask .. '.' .. button.type
local state = button_states[key] or { 0, button.button }
local state = button_states[key] or {0, button.button}
state[1] = process_button(button) | state[1]
button_states[key] = state
end

View File

@ -74,23 +74,24 @@ void menu_control_floppy_image::hook_load(const std::string &filename)
{
machine().popmessage("Error: %s\n", m_image.error());
stack_pop();
return;
}
bool can_in_place = input_format->supports_save();
if(can_in_place) {
std::string tmp_path;
util::core_file::ptr tmp_file;
// attempt to open the file for writing but *without* create
std::error_condition const filerr = util::zippath_fopen(filename, OPEN_FLAG_READ | OPEN_FLAG_WRITE, tmp_file, tmp_path);
if(!filerr)
tmp_file.reset();
else
can_in_place = false;
else
{
bool can_in_place = input_format->supports_save();
if(can_in_place) {
std::string tmp_path;
util::core_file::ptr tmp_file;
// attempt to open the file for writing but *without* create
std::error_condition const filerr = util::zippath_fopen(filename, OPEN_FLAG_READ | OPEN_FLAG_WRITE, tmp_file, tmp_path);
if(!filerr)
tmp_file.reset();
else
can_in_place = false;
}
m_submenu_result.rw = menu_select_rw::result::INVALID;
menu::stack_push<menu_select_rw>(ui(), container(), can_in_place, m_submenu_result.rw);
m_state = SELECT_RW;
}
m_submenu_result.rw = menu_select_rw::result::INVALID;
menu::stack_push<menu_select_rw>(ui(), container(), can_in_place, m_submenu_result.rw);
m_state = SELECT_RW;
}
void menu_control_floppy_image::menu_activated()
@ -174,6 +175,7 @@ void menu_control_floppy_image::menu_activated()
case menu_select_rw::result::INVALID:
m_state = START_FILE;
menu_activated();
break;
}
break;

View File

@ -164,6 +164,7 @@ void menu_control_device_image::load_software_part()
{
machine().popmessage(_("The software selected is missing one or more required ROM or CHD images.\nPlease acquire the correct files or select a different one."));
m_state = SELECT_SOFTLIST;
menu_activated();
}
}
@ -229,17 +230,22 @@ void menu_control_device_image::menu_activated()
if (!m_sld)
{
stack_pop();
break;
}
m_software_info_name.clear();
menu::stack_push_special_main<menu_software_list>(ui(), container(), m_sld, m_image.image_interface(), m_software_info_name);
m_state = SELECT_PARTLIST;
else
{
m_software_info_name.clear();
menu::stack_push_special_main<menu_software_list>(ui(), container(), m_sld, m_image.image_interface(), m_software_info_name);
m_state = SELECT_PARTLIST;
}
break;
case SELECT_PARTLIST:
m_swi = m_sld->find(m_software_info_name);
if (!m_swi)
{
m_state = START_SOFTLIST;
menu_activated();
}
else if (m_swi->has_multiple_parts(m_image.image_interface()))
{
m_submenu_result.swparts = menu_software_parts::result::INVALID;
@ -263,6 +269,7 @@ void menu_control_device_image::menu_activated()
default: // return to list
m_state = SELECT_SOFTLIST;
menu_activated();
break;
}
break;