mirror of
https://github.com/holub/mame
synced 2025-04-23 17:00:53 +03:00
ui: Show software selection menu before doing system audit, for casual browsing.
This commit is contained in:
parent
5f3bfbce6b
commit
b567c11f7f
@ -786,32 +786,33 @@ void menu_select_game::inkey_select(const event *menu_event)
|
||||
else
|
||||
{
|
||||
// anything else is a driver
|
||||
|
||||
// audit the game first to see if we're going to work
|
||||
driver_enumerator enumerator(machine().options(), *driver);
|
||||
enumerator.next();
|
||||
|
||||
// if there are software entries, show a software selection menu
|
||||
for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config()->root_device()))
|
||||
{
|
||||
if (!swlistdev.get_info().empty())
|
||||
{
|
||||
menu::stack_push<menu_select_software>(ui(), container(), *driver);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// audit the system ROMs first to see if we're going to work
|
||||
media_auditor auditor(enumerator);
|
||||
media_auditor::summary const summary = auditor.audit_media(AUDIT_VALIDATE_FAST);
|
||||
|
||||
// if everything looks good, schedule the new driver
|
||||
if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
|
||||
{
|
||||
for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config()->root_device()))
|
||||
{
|
||||
if (!swlistdev.get_info().empty())
|
||||
{
|
||||
menu::stack_push<menu_select_software>(ui(), container(), *driver);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!select_bios(*driver, false))
|
||||
launch_system(*driver);
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, display an error
|
||||
set_error(reset_options::REMEMBER_REF, make_error_text(media_auditor::NOTFOUND != summary, auditor));
|
||||
set_error(reset_options::REMEMBER_REF, make_audit_fail_text(media_auditor::NOTFOUND != summary, auditor));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -858,23 +859,25 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
}
|
||||
else if (ui_swinfo->startempty == 1)
|
||||
{
|
||||
// audit the game first to see if we're going to work
|
||||
driver_enumerator enumerator(machine().options(), *ui_swinfo->driver);
|
||||
enumerator.next();
|
||||
|
||||
// if there are software entries, show a software selection menu
|
||||
for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config()->root_device()))
|
||||
{
|
||||
if (!swlistdev.get_info().empty())
|
||||
{
|
||||
menu::stack_push<menu_select_software>(ui(), container(), *ui_swinfo->driver);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// audit the system ROMs first to see if we're going to work
|
||||
media_auditor auditor(enumerator);
|
||||
media_auditor::summary const summary = auditor.audit_media(AUDIT_VALIDATE_FAST);
|
||||
|
||||
if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
|
||||
{
|
||||
for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config()->root_device()))
|
||||
{
|
||||
if (!swlistdev.get_info().empty())
|
||||
{
|
||||
menu::stack_push<menu_select_software>(ui(), container(), *ui_swinfo->driver);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// if everything looks good, schedule the new driver
|
||||
if (!select_bios(*ui_swinfo->driver, false))
|
||||
{
|
||||
@ -885,7 +888,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
else
|
||||
{
|
||||
// otherwise, display an error
|
||||
set_error(reset_options::REMEMBER_REF, make_error_text(media_auditor::NOTFOUND != summary, auditor));
|
||||
set_error(reset_options::REMEMBER_REF, make_audit_fail_text(media_auditor::NOTFOUND != summary, auditor));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -907,7 +910,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
else
|
||||
{
|
||||
// otherwise, display an error
|
||||
set_error(reset_options::REMEMBER_POSITION, make_error_text(media_auditor::NOTFOUND != summary, auditor));
|
||||
set_error(reset_options::REMEMBER_POSITION, make_audit_fail_text(media_auditor::NOTFOUND != summary, auditor));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1455,18 +1458,4 @@ void menu_select_game::filter_selected()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string menu_select_game::make_error_text(bool summary, media_auditor const &auditor)
|
||||
{
|
||||
std::ostringstream str;
|
||||
str << _("The selected machine is missing one or more required ROM or CHD images. Please select a different machine.\n\n");
|
||||
if (summary)
|
||||
{
|
||||
auditor.summarize(nullptr, &str);
|
||||
str << "\n";
|
||||
}
|
||||
str << _("Press any key to continue.");
|
||||
return str.str();
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -18,8 +18,6 @@
|
||||
#include <functional>
|
||||
|
||||
|
||||
class media_auditor;
|
||||
|
||||
namespace ui {
|
||||
|
||||
class menu_select_game : public menu_select_launch
|
||||
@ -86,8 +84,6 @@ private:
|
||||
bool load_available_machines();
|
||||
void load_custom_filters();
|
||||
|
||||
static std::string make_error_text(bool summary, media_auditor const &auditor);
|
||||
|
||||
// General info
|
||||
virtual void general_info(const game_driver *driver, std::string &buffer) override;
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "ui/starimg.ipp"
|
||||
#include "ui/toolbar.ipp"
|
||||
|
||||
#include "audit.h"
|
||||
#include "cheat.h"
|
||||
#include "mame.h"
|
||||
#include "mameopts.h"
|
||||
@ -2508,6 +2509,20 @@ void menu_select_launch::draw_snapx(float origx1, float origy1, float origx2, fl
|
||||
}
|
||||
|
||||
|
||||
std::string menu_select_launch::make_audit_fail_text(bool found, media_auditor const &auditor)
|
||||
{
|
||||
std::ostringstream str;
|
||||
str << _("The selected machine is missing one or more required ROM or CHD images. Please select a different machine.\n\n");
|
||||
if (found)
|
||||
{
|
||||
auditor.summarize(nullptr, &str);
|
||||
str << "\n";
|
||||
}
|
||||
str << _("Press any key to continue.");
|
||||
return str.str();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// get bios count
|
||||
//-------------------------------------------------
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <vector>
|
||||
|
||||
|
||||
class media_auditor;
|
||||
struct ui_software_info;
|
||||
|
||||
namespace ui {
|
||||
@ -155,6 +156,8 @@ protected:
|
||||
return (uintptr_t(selected_ref) > skip_main_items) ? selected_ref : m_prev_selected;
|
||||
}
|
||||
|
||||
static std::string make_audit_fail_text(bool found, media_auditor const &auditor);
|
||||
|
||||
int m_available_items;
|
||||
int skip_main_items;
|
||||
void *m_prev_selected;
|
||||
|
@ -468,8 +468,17 @@ void menu_select_software::build_software_list()
|
||||
void menu_select_software::inkey_select(const event *menu_event)
|
||||
{
|
||||
ui_software_info *ui_swinfo = (ui_software_info *)menu_event->itemref;
|
||||
driver_enumerator drivlist(machine().options(), *ui_swinfo->driver);
|
||||
media_auditor auditor(drivlist);
|
||||
drivlist.next();
|
||||
|
||||
if (ui_swinfo->startempty == 1)
|
||||
// audit the system ROMs first to see if we're going to work
|
||||
media_auditor::summary const sysaudit = auditor.audit_media(AUDIT_VALIDATE_FAST);
|
||||
if (sysaudit != media_auditor::CORRECT && sysaudit != media_auditor::BEST_AVAILABLE && sysaudit != media_auditor::NONE_NEEDED)
|
||||
{
|
||||
set_error(reset_options::REMEMBER_REF, make_audit_fail_text(media_auditor::NOTFOUND != sysaudit, auditor));
|
||||
}
|
||||
else if (ui_swinfo->startempty == 1)
|
||||
{
|
||||
if (!select_bios(*ui_swinfo->driver, true))
|
||||
{
|
||||
@ -479,16 +488,13 @@ void menu_select_software::inkey_select(const event *menu_event)
|
||||
}
|
||||
else
|
||||
{
|
||||
// first validate
|
||||
driver_enumerator drivlist(machine().options(), *ui_swinfo->driver);
|
||||
media_auditor auditor(drivlist);
|
||||
drivlist.next();
|
||||
// first audit the software
|
||||
software_list_device *swlist = software_list_device::find_by_name(*drivlist.config(), ui_swinfo->listname);
|
||||
const software_info *swinfo = swlist->find(ui_swinfo->shortname);
|
||||
|
||||
media_auditor::summary const summary = auditor.audit_software(*swlist, *swinfo, AUDIT_VALIDATE_FAST);
|
||||
media_auditor::summary const swaudit = auditor.audit_software(*swlist, *swinfo, AUDIT_VALIDATE_FAST);
|
||||
|
||||
if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
|
||||
if (swaudit == media_auditor::CORRECT || swaudit == media_auditor::BEST_AVAILABLE || swaudit == media_auditor::NONE_NEEDED)
|
||||
{
|
||||
if (!select_bios(*ui_swinfo, false) && !select_part(*swinfo, *ui_swinfo))
|
||||
{
|
||||
@ -500,11 +506,11 @@ void menu_select_software::inkey_select(const event *menu_event)
|
||||
{
|
||||
// otherwise, display an error
|
||||
std::ostringstream str;
|
||||
str << _("The selected software is missing one or more required files. Please select a different software.\n\n");
|
||||
if (media_auditor::NOTFOUND != summary)
|
||||
str << _("The selected software is missing one or more required files. Please select a different software item.\n\n");
|
||||
if (media_auditor::NOTFOUND != swaudit)
|
||||
{
|
||||
auditor.summarize(nullptr, &str);
|
||||
str << "\n";
|
||||
str << '\n';
|
||||
}
|
||||
str << _("Press any key to continue."),
|
||||
set_error(reset_options::REMEMBER_POSITION, str.str());
|
||||
|
Loading…
Reference in New Issue
Block a user