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