mirror of
https://github.com/holub/mame
synced 2025-04-16 13:34:55 +03:00
ui refactoring [Vas Crabb]
* move menu classes into ::ui namesapce * reduce scope of many symbols (first step in making UI code less rage-inducing so I can fix text input)
This commit is contained in:
parent
4efb2fe825
commit
87429e74d9
@ -956,7 +956,7 @@ void cheat_entry::menu_text(std::string &description, std::string &state, UINT32
|
||||
if (description.empty())
|
||||
description.assign(MENU_SEPARATOR_ITEM);
|
||||
}
|
||||
flags = MENU_FLAG_DISABLE;
|
||||
flags = ui::menu::FLAG_DISABLE;
|
||||
}
|
||||
|
||||
// if we have no parameter and no run or off script, it's a oneshot cheat
|
||||
@ -967,7 +967,7 @@ void cheat_entry::menu_text(std::string &description, std::string &state, UINT32
|
||||
else if (is_onoff())
|
||||
{
|
||||
state.assign((m_state == SCRIPT_STATE_RUN) ? "On" : "Off");
|
||||
flags = (m_state != 0) ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW;
|
||||
flags = (m_state != 0) ? ui::menu::FLAG_LEFT_ARROW : ui::menu::FLAG_RIGHT_ARROW;
|
||||
}
|
||||
|
||||
// if we have a value parameter, compute it
|
||||
@ -976,14 +976,14 @@ void cheat_entry::menu_text(std::string &description, std::string &state, UINT32
|
||||
if (m_state == SCRIPT_STATE_OFF)
|
||||
{
|
||||
state.assign(is_oneshot_parameter() ? "Set" : "Off");
|
||||
flags = MENU_FLAG_RIGHT_ARROW;
|
||||
flags = ui::menu::FLAG_RIGHT_ARROW;
|
||||
}
|
||||
else
|
||||
{
|
||||
state.assign(m_parameter->text());
|
||||
flags = MENU_FLAG_LEFT_ARROW;
|
||||
flags = ui::menu::FLAG_LEFT_ARROW;
|
||||
if (!m_parameter->is_maximum())
|
||||
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||
flags |= ui::menu::FLAG_RIGHT_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -314,9 +314,9 @@ void emulator_info::display_ui_chooser(running_machine& machine)
|
||||
mame_ui_manager &mui = mame_machine_manager::instance()->ui();
|
||||
render_container *container = &machine.render().ui_container();
|
||||
if (strcmp(machine.options().ui(), "simple") == 0)
|
||||
ui_simple_menu_select_game::force_game_select(mui, container);
|
||||
ui::simple_menu_select_game::force_game_select(mui, container);
|
||||
else
|
||||
ui_menu_select_game::force_game_select(mui, container);
|
||||
ui::menu_select_game::force_game_select(mui, container);
|
||||
}
|
||||
|
||||
int emulator_info::start_frontend(emu_options &options, osd_interface &osd, int argc, char *argv[])
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
extern const char UI_VERSION_TAG[];
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// sort
|
||||
//-------------------------------------------------
|
||||
@ -84,8 +86,8 @@ bool sorted_game_list(const game_driver *x, const game_driver *y)
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_audit::ui_menu_audit(mame_ui_manager &mui, render_container *container, vptr_game &availablesorted, vptr_game &unavailablesorted, int _audit_mode)
|
||||
: ui_menu(mui, container)
|
||||
menu_audit::menu_audit(mame_ui_manager &mui, render_container *container, vptr_game &availablesorted, vptr_game &unavailablesorted, int _audit_mode)
|
||||
: menu(mui, container)
|
||||
, m_availablesorted(availablesorted)
|
||||
, m_unavailablesorted(unavailablesorted)
|
||||
, m_audit_mode(_audit_mode)
|
||||
@ -98,7 +100,7 @@ ui_menu_audit::ui_menu_audit(mame_ui_manager &mui, render_container *container,
|
||||
}
|
||||
}
|
||||
|
||||
ui_menu_audit::~ui_menu_audit()
|
||||
menu_audit::~menu_audit()
|
||||
{
|
||||
}
|
||||
|
||||
@ -106,9 +108,9 @@ ui_menu_audit::~ui_menu_audit()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_audit::handle()
|
||||
void menu_audit::handle()
|
||||
{
|
||||
process(UI_MENU_PROCESS_CUSTOM_ONLY);
|
||||
process(PROCESS_CUSTOM_ONLY);
|
||||
|
||||
if (m_first)
|
||||
{
|
||||
@ -157,15 +159,15 @@ void ui_menu_audit::handle()
|
||||
std::stable_sort(m_availablesorted.begin(), m_availablesorted.end(), sorted_game_list);
|
||||
std::stable_sort(m_unavailablesorted.begin(), m_unavailablesorted.end(), sorted_game_list);
|
||||
save_available_machines();
|
||||
ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
ui_menu::stack_pop(machine());
|
||||
reset_parent(reset_options::SELECT_FIRST);
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_audit::populate()
|
||||
void menu_audit::populate()
|
||||
{
|
||||
item_append("Dummy", nullptr, 0, (void *)(FPTR)1);
|
||||
}
|
||||
@ -174,7 +176,7 @@ void ui_menu_audit::populate()
|
||||
// save drivers infos to file
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_audit::save_available_machines()
|
||||
void menu_audit::save_available_machines()
|
||||
{
|
||||
// attempt to open the output file
|
||||
emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
|
||||
@ -203,3 +205,5 @@ void ui_menu_audit::save_available_machines()
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,19 +10,23 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_AUDIT_H__
|
||||
#define __UI_AUDIT_H__
|
||||
#ifndef MAME_FRONTEND_UI_AUDITMENU_H
|
||||
#define MAME_FRONTEND_UI_AUDITMENU_H
|
||||
|
||||
#include "ui/menu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// class audit menu
|
||||
//-------------------------------------------------
|
||||
using vptr_game = std::vector<const game_driver *>;
|
||||
|
||||
class ui_menu_audit : public ui_menu
|
||||
class menu_audit : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_audit(mame_ui_manager &mui, render_container *container, vptr_game &availablesorted, vptr_game &unavailablesorted, int audit_mode);
|
||||
virtual ~ui_menu_audit();
|
||||
menu_audit(mame_ui_manager &mui, render_container *container, vptr_game &availablesorted, vptr_game &unavailablesorted, int audit_mode);
|
||||
virtual ~menu_audit() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -35,7 +39,8 @@ private:
|
||||
bool m_first;
|
||||
};
|
||||
|
||||
inline int cs_stricmp(const char *s1, const char *s2);
|
||||
bool sorted_game_list(const game_driver *x, const game_driver *y);
|
||||
|
||||
#endif /* __UI_AUDIT_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_AUDITMENU_H */
|
||||
|
@ -9,9 +9,11 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
|
||||
#include "ui/barcode.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
// itemrefs for key menu items
|
||||
#define ITEMREF_NEW_BARCODE ((void *) 0x0001)
|
||||
@ -30,8 +32,8 @@
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_barcode_reader::ui_menu_barcode_reader(mame_ui_manager &mui, render_container *container, barcode_reader_device *device)
|
||||
: ui_menu_device_control<barcode_reader_device>(mui, container, device)
|
||||
menu_barcode_reader::menu_barcode_reader(mame_ui_manager &mui, render_container *container, barcode_reader_device *device)
|
||||
: menu_device_control<barcode_reader_device>(mui, container, device)
|
||||
{
|
||||
}
|
||||
|
||||
@ -40,7 +42,7 @@ ui_menu_barcode_reader::ui_menu_barcode_reader(mame_ui_manager &mui, render_cont
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_barcode_reader::~ui_menu_barcode_reader()
|
||||
menu_barcode_reader::~menu_barcode_reader()
|
||||
{
|
||||
}
|
||||
|
||||
@ -48,7 +50,7 @@ ui_menu_barcode_reader::~ui_menu_barcode_reader()
|
||||
// populate - populates the barcode input menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_barcode_reader::populate()
|
||||
void menu_barcode_reader::populate()
|
||||
{
|
||||
if (current_device())
|
||||
{
|
||||
@ -72,7 +74,7 @@ void ui_menu_barcode_reader::populate()
|
||||
item_append(_("New Barcode:"), new_barcode, 0, ITEMREF_NEW_BARCODE);
|
||||
|
||||
// finish up the menu
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("Enter Code"), nullptr, 0, ITEMREF_ENTER_BARCODE);
|
||||
|
||||
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
@ -84,14 +86,14 @@ void ui_menu_barcode_reader::populate()
|
||||
// handle - manages inputs in the barcode input menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_barcode_reader::handle()
|
||||
void menu_barcode_reader::handle()
|
||||
{
|
||||
// rebuild the menu (so to update the selected device, if the user has pressed L or R)
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
populate();
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
const event *event = process(PROCESS_LR_REPEAT);
|
||||
|
||||
// process the event
|
||||
if (event != nullptr)
|
||||
@ -99,56 +101,58 @@ void ui_menu_barcode_reader::handle()
|
||||
// handle selections
|
||||
switch (event->iptkey)
|
||||
{
|
||||
case IPT_UI_LEFT:
|
||||
if (event->itemref == ITEMREF_SELECT_READER)
|
||||
previous();
|
||||
break;
|
||||
case IPT_UI_LEFT:
|
||||
if (event->itemref == ITEMREF_SELECT_READER)
|
||||
previous();
|
||||
break;
|
||||
|
||||
case IPT_UI_RIGHT:
|
||||
if (event->itemref == ITEMREF_SELECT_READER)
|
||||
next();
|
||||
break;
|
||||
case IPT_UI_RIGHT:
|
||||
if (event->itemref == ITEMREF_SELECT_READER)
|
||||
next();
|
||||
break;
|
||||
|
||||
case IPT_UI_SELECT:
|
||||
if (event->itemref == ITEMREF_ENTER_BARCODE)
|
||||
case IPT_UI_SELECT:
|
||||
if (event->itemref == ITEMREF_ENTER_BARCODE)
|
||||
{
|
||||
std::string tmp_file(m_barcode_buffer);
|
||||
//printf("code %s\n", m_barcode_buffer);
|
||||
if (!current_device()->is_valid(tmp_file.length()))
|
||||
ui().popup_time(5, "%s", _("Barcode length invalid!"));
|
||||
else
|
||||
{
|
||||
std::string tmp_file(m_barcode_buffer);
|
||||
//printf("code %s\n", m_barcode_buffer);
|
||||
if (!current_device()->is_valid(tmp_file.length()))
|
||||
ui().popup_time(5, "%s", _("Barcode length invalid!"));
|
||||
else
|
||||
{
|
||||
current_device()->write_code(tmp_file.c_str(), tmp_file.length());
|
||||
// if sending was successful, reset char buffer
|
||||
if (m_barcode_buffer[0] != '\0')
|
||||
memset(m_barcode_buffer, '\0', ARRAY_LENGTH(m_barcode_buffer));
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
}
|
||||
current_device()->write_code(tmp_file.c_str(), tmp_file.length());
|
||||
// if sending was successful, reset char buffer
|
||||
if (m_barcode_buffer[0] != '\0')
|
||||
memset(m_barcode_buffer, '\0', ARRAY_LENGTH(m_barcode_buffer));
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPT_SPECIAL:
|
||||
if (get_selection() == ITEMREF_NEW_BARCODE)
|
||||
case IPT_SPECIAL:
|
||||
if (get_selection() == ITEMREF_NEW_BARCODE)
|
||||
{
|
||||
int buflen = strlen(m_barcode_buffer);
|
||||
|
||||
// if it's a backspace and we can handle it, do so
|
||||
if ((event->unichar == 8 || event->unichar == 0x7f) && buflen > 0)
|
||||
*(char *)utf8_previous_char(&m_barcode_buffer[buflen]) = 0;
|
||||
else if (event->unichar >= '0' && event->unichar <= '9')
|
||||
{
|
||||
int buflen = strlen(m_barcode_buffer);
|
||||
|
||||
// if it's a backspace and we can handle it, do so
|
||||
if ((event->unichar == 8 || event->unichar == 0x7f) && buflen > 0)
|
||||
*(char *)utf8_previous_char(&m_barcode_buffer[buflen]) = 0;
|
||||
else if (event->unichar >= '0' && event->unichar <= '9')
|
||||
{
|
||||
buflen += utf8_from_uchar(&m_barcode_buffer[buflen], ARRAY_LENGTH(m_barcode_buffer) - buflen, event->unichar);
|
||||
m_barcode_buffer[buflen] = 0;
|
||||
}
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
buflen += utf8_from_uchar(&m_barcode_buffer[buflen], ARRAY_LENGTH(m_barcode_buffer) - buflen, event->unichar);
|
||||
m_barcode_buffer[buflen] = 0;
|
||||
}
|
||||
break;
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
break;
|
||||
|
||||
case IPT_UI_CANCEL:
|
||||
// reset the char buffer also in this case
|
||||
if (m_barcode_buffer[0] != '\0')
|
||||
memset(m_barcode_buffer, '\0', ARRAY_LENGTH(m_barcode_buffer));
|
||||
break;
|
||||
case IPT_UI_CANCEL:
|
||||
// reset the char buffer also in this case
|
||||
if (m_barcode_buffer[0] != '\0')
|
||||
memset(m_barcode_buffer, '\0', ARRAY_LENGTH(m_barcode_buffer));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
@ -10,16 +10,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_BARCODE_H__
|
||||
#define __UI_BARCODE_H__
|
||||
#ifndef MAME_FRONTEND_UI_BARCODE_H
|
||||
#define MAME_FRONTEND_UI_BARCODE_H
|
||||
|
||||
#include "machine/bcreader.h"
|
||||
#include "ui/devctrl.h"
|
||||
|
||||
class ui_menu_barcode_reader : public ui_menu_device_control<barcode_reader_device> {
|
||||
namespace ui {
|
||||
|
||||
class menu_barcode_reader : public menu_device_control<barcode_reader_device> {
|
||||
public:
|
||||
ui_menu_barcode_reader(mame_ui_manager &mui, render_container *container, barcode_reader_device *device);
|
||||
virtual ~ui_menu_barcode_reader();
|
||||
menu_barcode_reader(mame_ui_manager &mui, render_container *container, barcode_reader_device *device);
|
||||
virtual ~menu_barcode_reader() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -27,5 +29,6 @@ private:
|
||||
char m_barcode_buffer[20];
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif // __UI_BARCODE_H__
|
||||
#endif // MAME_FRONTEND_UI_BARCODE_H
|
||||
|
@ -16,14 +16,29 @@
|
||||
#include "ui/menu.h"
|
||||
#include "ui/cheatopt.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
// itemrefs for key menu items
|
||||
#define ITEMREF_CHEATS_RESET_ALL ((void *) 0x0001)
|
||||
#define ITEMREF_CHEATS_RELOAD_ALL ((void *) 0x0002)
|
||||
#define ITEMREF_CHEATS_AUTOFIRE_SETTINGS ((void *) 0x0003)
|
||||
#define ITEMREF_CHEATS_FIRST_ITEM ((void *) 0x0004)
|
||||
|
||||
// itemrefs for key menu items
|
||||
#define ITEMREF_AUTOFIRE_STATUS ((void *) 0x0001)
|
||||
#define ITEMREF_AUTOFIRE_DELAY ((void *) 0x0002)
|
||||
#define ITEMREF_AUTOFIRE_FIRST_BUTTON ((void *) 0x0003)
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
menu_cheat - handle the cheat menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_cheat::handle()
|
||||
void menu_cheat::handle()
|
||||
{
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
const event *menu_event = process(PROCESS_LR_REPEAT);
|
||||
|
||||
|
||||
/* handle events */
|
||||
@ -87,19 +102,19 @@ void ui_menu_cheat::handle()
|
||||
mame_machine_manager::instance()->cheat().reload();
|
||||
|
||||
/* display the reloaded cheats */
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
machine().popmessage(_("All cheats reloaded"));
|
||||
}
|
||||
|
||||
/* handle autofire menu */
|
||||
if (menu_event->itemref == ITEMREF_CHEATS_AUTOFIRE_SETTINGS && menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_autofire>(ui(), container));
|
||||
menu::stack_push<menu_autofire>(ui(), container);
|
||||
}
|
||||
|
||||
/* if things changed, update */
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,11 +123,11 @@ void ui_menu_cheat::handle()
|
||||
menu_cheat_populate - populate the cheat menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_cheat::ui_menu_cheat(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_cheat::menu_cheat(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_cheat::populate()
|
||||
void menu_cheat::populate()
|
||||
{
|
||||
/* iterate over cheats */
|
||||
std::string text;
|
||||
@ -122,7 +137,7 @@ void ui_menu_cheat::populate()
|
||||
item_append(_("Autofire Settings"), nullptr, 0, (void *)ITEMREF_CHEATS_AUTOFIRE_SETTINGS);
|
||||
|
||||
/* add a separator */
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
// add other cheats
|
||||
if (!mame_machine_manager::instance()->cheat().entries().empty()) {
|
||||
@ -134,7 +149,7 @@ void ui_menu_cheat::populate()
|
||||
}
|
||||
|
||||
/* add a separator */
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
/* add a reset all option */
|
||||
item_append(_("Reset All"), nullptr, 0, (void *)ITEMREF_CHEATS_RESET_ALL);
|
||||
@ -144,7 +159,7 @@ void ui_menu_cheat::populate()
|
||||
}
|
||||
}
|
||||
|
||||
ui_menu_cheat::~ui_menu_cheat()
|
||||
menu_cheat::~menu_cheat()
|
||||
{
|
||||
}
|
||||
|
||||
@ -157,7 +172,7 @@ ui_menu_cheat::~ui_menu_cheat()
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_autofire::ui_menu_autofire(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container), last_toggle(false)
|
||||
menu_autofire::menu_autofire(mame_ui_manager &mui, render_container *container) : menu(mui, container), last_toggle(false)
|
||||
{
|
||||
const screen_device *screen = mui.machine().first_screen();
|
||||
|
||||
@ -171,17 +186,17 @@ ui_menu_autofire::ui_menu_autofire(mame_ui_manager &mui, render_container *conta
|
||||
}
|
||||
}
|
||||
|
||||
ui_menu_autofire::~ui_menu_autofire()
|
||||
menu_autofire::~menu_autofire()
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_autofire::handle()
|
||||
void menu_autofire::handle()
|
||||
{
|
||||
ioport_field *field;
|
||||
bool changed = false;
|
||||
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
/* handle events */
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
@ -237,7 +252,7 @@ void ui_menu_autofire::handle()
|
||||
/* if something changed, rebuild the menu */
|
||||
if (changed)
|
||||
{
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,14 +262,14 @@ void ui_menu_autofire::handle()
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_autofire::populate()
|
||||
void menu_autofire::populate()
|
||||
{
|
||||
char temp_text[64];
|
||||
|
||||
/* add autofire toggle item */
|
||||
bool autofire_toggle = machine().ioport().get_autofire_toggle();
|
||||
item_append(_("Autofire Status"), (autofire_toggle ? _("Disabled") : _("Enabled")),
|
||||
(autofire_toggle ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW), (void *)ITEMREF_AUTOFIRE_STATUS);
|
||||
(autofire_toggle ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW), (void *)ITEMREF_AUTOFIRE_STATUS);
|
||||
|
||||
/* iterate over the input ports and add autofire toggle items */
|
||||
int menu_items = 0;
|
||||
@ -272,7 +287,7 @@ void ui_menu_autofire::populate()
|
||||
if (is_first_button)
|
||||
{
|
||||
/* add a separator for each player */
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
is_first_button = false;
|
||||
}
|
||||
/* add an autofire item */
|
||||
@ -280,13 +295,13 @@ void ui_menu_autofire::populate()
|
||||
{
|
||||
// item is enabled and can be switched to values on/off
|
||||
item_append(field.name(), (settings.autofire ? _("On") : _("Off")),
|
||||
(settings.autofire ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW), (void *)&field);
|
||||
(settings.autofire ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW), (void *)&field);
|
||||
}
|
||||
else
|
||||
{
|
||||
// item is disabled
|
||||
item_append(field.name(), (settings.autofire ? _("On") : _("Off")),
|
||||
MENU_FLAG_DISABLE | MENU_FLAG_INVERT, nullptr);
|
||||
FLAG_DISABLE | FLAG_INVERT, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -295,27 +310,29 @@ void ui_menu_autofire::populate()
|
||||
/* add text item if no buttons found */
|
||||
if (menu_items==0)
|
||||
{
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(_("No buttons found on this machine!"), nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("No buttons found on this machine!"), nullptr, FLAG_DISABLE, nullptr);
|
||||
}
|
||||
|
||||
/* add a separator */
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
/* add autofire delay item */
|
||||
int value = machine().ioport().get_autofire_delay();
|
||||
snprintf(temp_text, ARRAY_LENGTH(temp_text), "%d = %.2f Hz", value, (float)refresh/value);
|
||||
if (!autofire_toggle)
|
||||
{
|
||||
item_append(_("Autofire Delay"), temp_text, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)ITEMREF_AUTOFIRE_DELAY);
|
||||
item_append(_("Autofire Delay"), temp_text, FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, (void *)ITEMREF_AUTOFIRE_DELAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
item_append(_("Autofire Delay"), temp_text, MENU_FLAG_DISABLE | MENU_FLAG_INVERT, nullptr);
|
||||
item_append(_("Autofire Delay"), temp_text, FLAG_DISABLE | FLAG_INVERT, nullptr);
|
||||
}
|
||||
|
||||
/* add a separator */
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
last_toggle = autofire_toggle;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,33 +10,28 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_CHEATOPT_H__
|
||||
#define __UI_CHEATOPT_H__
|
||||
#ifndef MAME_FRONTEND_UI_CHEATOPT_H
|
||||
#define MAME_FRONTEND_UI_CHEATOPT_H
|
||||
|
||||
// itemrefs for key menu items
|
||||
#define ITEMREF_CHEATS_RESET_ALL ((void *) 0x0001)
|
||||
#define ITEMREF_CHEATS_RELOAD_ALL ((void *) 0x0002)
|
||||
#define ITEMREF_CHEATS_AUTOFIRE_SETTINGS ((void *) 0x0003)
|
||||
#define ITEMREF_CHEATS_FIRST_ITEM ((void *) 0x0004)
|
||||
#include "ui/menu.h"
|
||||
|
||||
class ui_menu_cheat : public ui_menu {
|
||||
namespace ui {
|
||||
|
||||
class menu_cheat : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_cheat(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_cheat();
|
||||
menu_cheat(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_cheat() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
};
|
||||
|
||||
|
||||
// itemrefs for key menu items
|
||||
#define ITEMREF_AUTOFIRE_STATUS ((void *) 0x0001)
|
||||
#define ITEMREF_AUTOFIRE_DELAY ((void *) 0x0002)
|
||||
#define ITEMREF_AUTOFIRE_FIRST_BUTTON ((void *) 0x0003)
|
||||
|
||||
class ui_menu_autofire : public ui_menu {
|
||||
class menu_autofire : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_autofire(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_autofire();
|
||||
menu_autofire(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_autofire() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -45,5 +40,6 @@ private:
|
||||
bool last_toggle;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif /* __UI_CHEATOPT_H__ */
|
||||
#endif /* MAME_FRONTEND_UI_CHEATOPT_H */
|
||||
|
@ -10,56 +10,59 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/custmenu.h"
|
||||
#include "ui/selector.h"
|
||||
#include "ui/inifile.h"
|
||||
|
||||
#include "rendfont.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
/**************************************************
|
||||
MENU CUSTOM FILTER
|
||||
**************************************************/
|
||||
//-------------------------------------------------
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
ui_menu_custom_filter::ui_menu_custom_filter(mame_ui_manager &mui, render_container *container, bool _single_menu)
|
||||
: ui_menu(mui, container)
|
||||
menu_custom_filter::menu_custom_filter(mame_ui_manager &mui, render_container *container, bool _single_menu)
|
||||
: menu(mui, container)
|
||||
, m_single_menu(_single_menu)
|
||||
, m_added(false)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_custom_filter::~ui_menu_custom_filter()
|
||||
menu_custom_filter::~menu_custom_filter()
|
||||
{
|
||||
if (m_single_menu)
|
||||
ui_menu::menu_stack->reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset_topmost(reset_options::SELECT_FIRST);
|
||||
save_custom_filters();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
void ui_menu_custom_filter::handle()
|
||||
void menu_custom_filter::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
m_added = false;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
const event *menu_event = process(PROCESS_LR_REPEAT);
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
switch ((FPTR)m_event->itemref)
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
{
|
||||
case MAIN_FILTER:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
(m_event->iptkey == IPT_UI_RIGHT) ? custfltr::main++ : custfltr::main--;
|
||||
(menu_event->iptkey == IPT_UI_RIGHT) ? custfltr::main++ : custfltr::main--;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case ADD_FILTER:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
custfltr::numother++;
|
||||
custfltr::other[custfltr::numother] = FILTER_UNAVAILABLE + 1;
|
||||
@ -68,7 +71,7 @@ void ui_menu_custom_filter::handle()
|
||||
break;
|
||||
|
||||
case REMOVE_FILTER:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
custfltr::other[custfltr::numother] = FILTER_UNAVAILABLE + 1;
|
||||
custfltr::numother--;
|
||||
@ -77,24 +80,24 @@ void ui_menu_custom_filter::handle()
|
||||
break;
|
||||
}
|
||||
|
||||
if ((FPTR)m_event->itemref >= OTHER_FILTER && (FPTR)m_event->itemref < OTHER_FILTER + MAX_CUST_FILTER)
|
||||
if ((FPTR)menu_event->itemref >= OTHER_FILTER && (FPTR)menu_event->itemref < OTHER_FILTER + MAX_CUST_FILTER)
|
||||
{
|
||||
int pos = (int)((FPTR)m_event->itemref - OTHER_FILTER);
|
||||
if (m_event->iptkey == IPT_UI_LEFT && custfltr::other[pos] > FILTER_UNAVAILABLE + 1)
|
||||
int pos = (int)((FPTR)menu_event->itemref - OTHER_FILTER);
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && custfltr::other[pos] > FILTER_UNAVAILABLE + 1)
|
||||
{
|
||||
custfltr::other[pos]--;
|
||||
for ( ; custfltr::other[pos] > FILTER_UNAVAILABLE && (custfltr::other[pos] == FILTER_CATEGORY
|
||||
|| custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]--) { };
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::other[pos] < FILTER_LAST - 1)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && custfltr::other[pos] < FILTER_LAST - 1)
|
||||
{
|
||||
custfltr::other[pos]++;
|
||||
for ( ; custfltr::other[pos] < FILTER_LAST && (custfltr::other[pos] == FILTER_CATEGORY
|
||||
|| custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]++) { };
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
size_t total = main_filters::length;
|
||||
std::vector<std::string> s_sel(total);
|
||||
@ -104,53 +107,53 @@ void ui_menu_custom_filter::handle()
|
||||
else
|
||||
s_sel[index] = main_filters::text[index];
|
||||
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, s_sel, custfltr::other[pos]));
|
||||
menu::stack_push<menu_selector>(ui(), container, s_sel, custfltr::other[pos]);
|
||||
}
|
||||
}
|
||||
else if ((FPTR)m_event->itemref >= YEAR_FILTER && (FPTR)m_event->itemref < YEAR_FILTER + MAX_CUST_FILTER)
|
||||
else if ((FPTR)menu_event->itemref >= YEAR_FILTER && (FPTR)menu_event->itemref < YEAR_FILTER + MAX_CUST_FILTER)
|
||||
{
|
||||
int pos = (int)((FPTR)m_event->itemref - YEAR_FILTER);
|
||||
if (m_event->iptkey == IPT_UI_LEFT && custfltr::year[pos] > 0)
|
||||
int pos = (int)((FPTR)menu_event->itemref - YEAR_FILTER);
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && custfltr::year[pos] > 0)
|
||||
{
|
||||
custfltr::year[pos]--;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::year[pos] < c_year::ui.size() - 1)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && custfltr::year[pos] < c_year::ui.size() - 1)
|
||||
{
|
||||
custfltr::year[pos]++;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, c_year::ui, custfltr::year[pos]));
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_selector>(ui(), container, c_year::ui, custfltr::year[pos]);
|
||||
}
|
||||
else if ((FPTR)m_event->itemref >= MNFCT_FILTER && (FPTR)m_event->itemref < MNFCT_FILTER + MAX_CUST_FILTER)
|
||||
else if ((FPTR)menu_event->itemref >= MNFCT_FILTER && (FPTR)menu_event->itemref < MNFCT_FILTER + MAX_CUST_FILTER)
|
||||
{
|
||||
int pos = (int)((FPTR)m_event->itemref - MNFCT_FILTER);
|
||||
if (m_event->iptkey == IPT_UI_LEFT && custfltr::mnfct[pos] > 0)
|
||||
int pos = (int)((FPTR)menu_event->itemref - MNFCT_FILTER);
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && custfltr::mnfct[pos] > 0)
|
||||
{
|
||||
custfltr::mnfct[pos]--;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::mnfct[pos] < c_mnfct::ui.size() - 1)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && custfltr::mnfct[pos] < c_mnfct::ui.size() - 1)
|
||||
{
|
||||
custfltr::mnfct[pos]++;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, c_mnfct::ui, custfltr::mnfct[pos]));
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_selector>(ui(), container, c_mnfct::ui, custfltr::mnfct[pos]);
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
else if (m_added)
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
void ui_menu_custom_filter::populate()
|
||||
void menu_custom_filter::populate()
|
||||
{
|
||||
// add main filter
|
||||
UINT32 arrow_flags = get_arrow_flags((int)FILTER_ALL, (int)FILTER_UNAVAILABLE, custfltr::main);
|
||||
@ -159,7 +162,7 @@ void ui_menu_custom_filter::populate()
|
||||
// add other filters
|
||||
for (int x = 1; x <= custfltr::numother; x++)
|
||||
{
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
// add filter items
|
||||
arrow_flags = get_arrow_flags((int)FILTER_UNAVAILABLE + 1, (int)FILTER_LAST - 1, custfltr::other[x]);
|
||||
@ -187,7 +190,7 @@ void ui_menu_custom_filter::populate()
|
||||
}
|
||||
}
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
if (custfltr::numother > 0)
|
||||
item_append(_("Remove last filter"), nullptr, 0, (void *)(FPTR)REMOVE_FILTER);
|
||||
@ -195,14 +198,14 @@ void ui_menu_custom_filter::populate()
|
||||
if (custfltr::numother < MAX_CUST_FILTER - 2)
|
||||
item_append(_("Add filter"), nullptr, 0, (void *)(FPTR)ADD_FILTER);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
void ui_menu_custom_filter::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_custom_filter::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
@ -235,7 +238,7 @@ void ui_menu_custom_filter::custom_render(void *selectedref, float top, float bo
|
||||
// save custom filters info to file
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_custom_filter::save_custom_filters()
|
||||
void menu_custom_filter::save_custom_filters()
|
||||
{
|
||||
// attempt to open the output file
|
||||
emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
|
||||
@ -265,44 +268,44 @@ void ui_menu_custom_filter::save_custom_filters()
|
||||
//-------------------------------------------------
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
ui_menu_swcustom_filter::ui_menu_swcustom_filter(mame_ui_manager &mui, render_container *container, const game_driver *_driver, s_filter &_filter) :
|
||||
ui_menu(mui, container)
|
||||
menu_swcustom_filter::menu_swcustom_filter(mame_ui_manager &mui, render_container *container, const game_driver *_driver, s_filter &_filter)
|
||||
: menu(mui, container)
|
||||
, m_added(false)
|
||||
, m_filter(_filter)
|
||||
, m_driver(_driver)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_swcustom_filter::~ui_menu_swcustom_filter()
|
||||
menu_swcustom_filter::~menu_swcustom_filter()
|
||||
{
|
||||
ui_menu::menu_stack->reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset_topmost(reset_options::SELECT_FIRST);
|
||||
save_sw_custom_filters();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
void ui_menu_swcustom_filter::handle()
|
||||
void menu_swcustom_filter::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
m_added = false;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
const event *menu_event = process(PROCESS_LR_REPEAT);
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
switch ((FPTR)m_event->itemref)
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
{
|
||||
case MAIN_FILTER:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
(m_event->iptkey == IPT_UI_RIGHT) ? sw_custfltr::main++ : sw_custfltr::main--;
|
||||
(menu_event->iptkey == IPT_UI_RIGHT) ? sw_custfltr::main++ : sw_custfltr::main--;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case ADD_FILTER:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
sw_custfltr::numother++;
|
||||
sw_custfltr::other[sw_custfltr::numother] = UI_SW_UNAVAILABLE + 1;
|
||||
@ -311,7 +314,7 @@ void ui_menu_swcustom_filter::handle()
|
||||
break;
|
||||
|
||||
case REMOVE_FILTER:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
sw_custfltr::other[sw_custfltr::numother] = UI_SW_UNAVAILABLE + 1;
|
||||
sw_custfltr::numother--;
|
||||
@ -320,20 +323,20 @@ void ui_menu_swcustom_filter::handle()
|
||||
break;
|
||||
}
|
||||
|
||||
if ((FPTR)m_event->itemref >= OTHER_FILTER && (FPTR)m_event->itemref < OTHER_FILTER + MAX_CUST_FILTER)
|
||||
if ((FPTR)menu_event->itemref >= OTHER_FILTER && (FPTR)menu_event->itemref < OTHER_FILTER + MAX_CUST_FILTER)
|
||||
{
|
||||
int pos = (int)((FPTR)m_event->itemref - OTHER_FILTER);
|
||||
if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::other[pos] > UI_SW_UNAVAILABLE + 1)
|
||||
int pos = (int)((FPTR)menu_event->itemref - OTHER_FILTER);
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && sw_custfltr::other[pos] > UI_SW_UNAVAILABLE + 1)
|
||||
{
|
||||
sw_custfltr::other[pos]--;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::other[pos] < UI_SW_LAST - 1)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && sw_custfltr::other[pos] < UI_SW_LAST - 1)
|
||||
{
|
||||
sw_custfltr::other[pos]++;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
size_t total = sw_filters::length;
|
||||
std::vector<std::string> s_sel(total);
|
||||
@ -343,101 +346,101 @@ void ui_menu_swcustom_filter::handle()
|
||||
else
|
||||
s_sel[index] = sw_filters::text[index];
|
||||
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, s_sel, sw_custfltr::other[pos]));
|
||||
menu::stack_push<menu_selector>(ui(), container, s_sel, sw_custfltr::other[pos]);
|
||||
}
|
||||
}
|
||||
else if ((FPTR)m_event->itemref >= YEAR_FILTER && (FPTR)m_event->itemref < YEAR_FILTER + MAX_CUST_FILTER)
|
||||
else if ((FPTR)menu_event->itemref >= YEAR_FILTER && (FPTR)menu_event->itemref < YEAR_FILTER + MAX_CUST_FILTER)
|
||||
{
|
||||
int pos = (int)((FPTR)m_event->itemref - YEAR_FILTER);
|
||||
if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::year[pos] > 0)
|
||||
int pos = (int)((FPTR)menu_event->itemref - YEAR_FILTER);
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && sw_custfltr::year[pos] > 0)
|
||||
{
|
||||
sw_custfltr::year[pos]--;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::year[pos] < m_filter.year.ui.size() - 1)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && sw_custfltr::year[pos] < m_filter.year.ui.size() - 1)
|
||||
{
|
||||
sw_custfltr::year[pos]++;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, m_filter.year.ui, sw_custfltr::year[pos]));
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_selector>(ui(), container, m_filter.year.ui, sw_custfltr::year[pos]);
|
||||
}
|
||||
else if ((FPTR)m_event->itemref >= TYPE_FILTER && (FPTR)m_event->itemref < TYPE_FILTER + MAX_CUST_FILTER)
|
||||
else if ((FPTR)menu_event->itemref >= TYPE_FILTER && (FPTR)menu_event->itemref < TYPE_FILTER + MAX_CUST_FILTER)
|
||||
{
|
||||
int pos = (int)((FPTR)m_event->itemref - TYPE_FILTER);
|
||||
if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::type[pos] > 0)
|
||||
int pos = (int)((FPTR)menu_event->itemref - TYPE_FILTER);
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && sw_custfltr::type[pos] > 0)
|
||||
{
|
||||
sw_custfltr::type[pos]--;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::type[pos] < m_filter.type.ui.size() - 1)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && sw_custfltr::type[pos] < m_filter.type.ui.size() - 1)
|
||||
{
|
||||
sw_custfltr::type[pos]++;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, m_filter.type.ui, sw_custfltr::type[pos]));
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_selector>(ui(), container, m_filter.type.ui, sw_custfltr::type[pos]);
|
||||
}
|
||||
else if ((FPTR)m_event->itemref >= MNFCT_FILTER && (FPTR)m_event->itemref < MNFCT_FILTER + MAX_CUST_FILTER)
|
||||
else if ((FPTR)menu_event->itemref >= MNFCT_FILTER && (FPTR)menu_event->itemref < MNFCT_FILTER + MAX_CUST_FILTER)
|
||||
{
|
||||
int pos = (int)((FPTR)m_event->itemref - MNFCT_FILTER);
|
||||
if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::mnfct[pos] > 0)
|
||||
int pos = (int)((FPTR)menu_event->itemref - MNFCT_FILTER);
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && sw_custfltr::mnfct[pos] > 0)
|
||||
{
|
||||
sw_custfltr::mnfct[pos]--;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::mnfct[pos] < m_filter.publisher.ui.size() - 1)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && sw_custfltr::mnfct[pos] < m_filter.publisher.ui.size() - 1)
|
||||
{
|
||||
sw_custfltr::mnfct[pos]++;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, m_filter.publisher.ui, sw_custfltr::mnfct[pos]));
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_selector>(ui(), container, m_filter.publisher.ui, sw_custfltr::mnfct[pos]);
|
||||
}
|
||||
else if ((FPTR)m_event->itemref >= REGION_FILTER && (FPTR)m_event->itemref < REGION_FILTER + MAX_CUST_FILTER)
|
||||
else if ((FPTR)menu_event->itemref >= REGION_FILTER && (FPTR)menu_event->itemref < REGION_FILTER + MAX_CUST_FILTER)
|
||||
{
|
||||
int pos = (int)((FPTR)m_event->itemref - REGION_FILTER);
|
||||
if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::region[pos] > 0)
|
||||
int pos = (int)((FPTR)menu_event->itemref - REGION_FILTER);
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && sw_custfltr::region[pos] > 0)
|
||||
{
|
||||
sw_custfltr::region[pos]--;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::region[pos] < m_filter.region.ui.size() - 1)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && sw_custfltr::region[pos] < m_filter.region.ui.size() - 1)
|
||||
{
|
||||
sw_custfltr::region[pos]++;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, m_filter.region.ui, sw_custfltr::region[pos]));
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_selector>(ui(), container, m_filter.region.ui, sw_custfltr::region[pos]);
|
||||
}
|
||||
else if ((FPTR)m_event->itemref >= LIST_FILTER && (FPTR)m_event->itemref < LIST_FILTER + MAX_CUST_FILTER)
|
||||
else if ((FPTR)menu_event->itemref >= LIST_FILTER && (FPTR)menu_event->itemref < LIST_FILTER + MAX_CUST_FILTER)
|
||||
{
|
||||
int pos = (int)((FPTR)m_event->itemref - LIST_FILTER);
|
||||
if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::list[pos] > 0)
|
||||
int pos = (int)((FPTR)menu_event->itemref - LIST_FILTER);
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && sw_custfltr::list[pos] > 0)
|
||||
{
|
||||
sw_custfltr::list[pos]--;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::list[pos] < m_filter.swlist.name.size() - 1)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && sw_custfltr::list[pos] < m_filter.swlist.name.size() - 1)
|
||||
{
|
||||
sw_custfltr::list[pos]++;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, m_filter.swlist.description, sw_custfltr::list[pos]));
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_selector>(ui(), container, m_filter.swlist.description, sw_custfltr::list[pos]);
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
else if (m_added)
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
void ui_menu_swcustom_filter::populate()
|
||||
void menu_swcustom_filter::populate()
|
||||
{
|
||||
// add main filter
|
||||
UINT32 arrow_flags = get_arrow_flags((int)UI_SW_ALL, (int)UI_SW_UNAVAILABLE, sw_custfltr::main);
|
||||
@ -446,7 +449,7 @@ void ui_menu_swcustom_filter::populate()
|
||||
// add other filters
|
||||
for (int x = 1; x <= sw_custfltr::numother; x++)
|
||||
{
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
// add filter items
|
||||
arrow_flags = get_arrow_flags((int)UI_SW_UNAVAILABLE + 1, (int)UI_SW_LAST - 1, sw_custfltr::other[x]);
|
||||
@ -501,7 +504,7 @@ void ui_menu_swcustom_filter::populate()
|
||||
}
|
||||
}
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
if (sw_custfltr::numother > 0)
|
||||
item_append(_("Remove last filter"), nullptr, 0, (void *)(FPTR)REMOVE_FILTER);
|
||||
@ -509,7 +512,7 @@ void ui_menu_swcustom_filter::populate()
|
||||
if (sw_custfltr::numother < MAX_CUST_FILTER - 2)
|
||||
item_append(_("Add filter"), nullptr, 0, (void *)(FPTR)ADD_FILTER);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
}
|
||||
@ -517,7 +520,7 @@ void ui_menu_swcustom_filter::populate()
|
||||
//-------------------------------------------------
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
void ui_menu_swcustom_filter::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_swcustom_filter::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
@ -550,7 +553,7 @@ void ui_menu_swcustom_filter::custom_render(void *selectedref, float top, float
|
||||
// save custom filters info to file
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_swcustom_filter::save_sw_custom_filters()
|
||||
void menu_swcustom_filter::save_sw_custom_filters()
|
||||
{
|
||||
// attempt to open the output file
|
||||
emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
|
||||
@ -579,3 +582,5 @@ void ui_menu_swcustom_filter::save_sw_custom_filters()
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -11,11 +11,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_CUSTMENU_H__
|
||||
#define __UI_CUSTMENU_H__
|
||||
#ifndef MAME_FRONTEND_UI_CUSTMENU_H
|
||||
#define MAME_FRONTEND_UI_CUSTMENU_H
|
||||
|
||||
#include "ui/menu.h"
|
||||
#include "ui/utils.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
// Software region
|
||||
struct c_sw_region
|
||||
{
|
||||
@ -70,11 +73,11 @@ struct s_filter
|
||||
//-------------------------------------------------
|
||||
// custom software filter menu class
|
||||
//-------------------------------------------------
|
||||
class ui_menu_swcustom_filter : public ui_menu
|
||||
class menu_swcustom_filter : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_swcustom_filter(mame_ui_manager &mui, render_container *container, const game_driver *_driver, s_filter &_filter);
|
||||
virtual ~ui_menu_swcustom_filter();
|
||||
menu_swcustom_filter(mame_ui_manager &mui, render_container *container, const game_driver *_driver, s_filter &_filter);
|
||||
virtual ~menu_swcustom_filter() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -103,11 +106,11 @@ private:
|
||||
//-------------------------------------------------
|
||||
// custom filter menu class
|
||||
//-------------------------------------------------
|
||||
class ui_menu_custom_filter : public ui_menu
|
||||
class menu_custom_filter : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_custom_filter(mame_ui_manager &mui, render_container *container, bool _single_menu = false);
|
||||
virtual ~ui_menu_custom_filter();
|
||||
menu_custom_filter(mame_ui_manager &mui, render_container *container, bool _single_menu = false);
|
||||
virtual ~menu_custom_filter() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -128,4 +131,6 @@ private:
|
||||
void save_custom_filters();
|
||||
};
|
||||
|
||||
#endif /* __UI_CUSTMENU_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_CUSTMENU_H */
|
||||
|
@ -9,15 +9,19 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "emuopts.h"
|
||||
#include "osdepend.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/selector.h"
|
||||
#include "ui/utils.h"
|
||||
|
||||
#include "ui/custui.h"
|
||||
|
||||
const char *const ui_menu_custom_ui::hide_status[] = {
|
||||
#include "ui/ui.h"
|
||||
#include "ui/selector.h"
|
||||
#include "ui/utils.h"
|
||||
|
||||
#include "emuopts.h"
|
||||
#include "osdepend.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
const char *const menu_custom_ui::hide_status[] = {
|
||||
__("Show All"),
|
||||
__("Hide Filters"),
|
||||
__("Hide Info/Image"),
|
||||
@ -27,7 +31,7 @@ const char *const ui_menu_custom_ui::hide_status[] = {
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_custom_ui::ui_menu_custom_ui(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_custom_ui::menu_custom_ui(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
// load languages
|
||||
file_enumerator path(mui.machine().options().language_path());
|
||||
@ -51,7 +55,7 @@ ui_menu_custom_ui::ui_menu_custom_ui(mame_ui_manager &mui, render_container *con
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_custom_ui::~ui_menu_custom_ui()
|
||||
menu_custom_ui::~menu_custom_ui()
|
||||
{
|
||||
std::string error_string;
|
||||
ui().options().set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string);
|
||||
@ -68,58 +72,58 @@ ui_menu_custom_ui::~ui_menu_custom_ui()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_custom_ui::handle()
|
||||
void menu_custom_ui::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
switch ((FPTR)m_event->itemref)
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
{
|
||||
case FONT_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_font_ui>(ui(), container));
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_font_ui>(ui(), container);
|
||||
break;
|
||||
case COLORS_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_colors_ui>(ui(), container));
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_colors_ui>(ui(), container);
|
||||
break;
|
||||
case HIDE_MENU:
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
changed = true;
|
||||
(m_event->iptkey == IPT_UI_RIGHT) ? ui_globals::panels_status++ : ui_globals::panels_status--;
|
||||
(menu_event->iptkey == IPT_UI_RIGHT) ? ui_globals::panels_status++ : ui_globals::panels_status--;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
int total = ARRAY_LENGTH(hide_status);
|
||||
std::vector<std::string> s_sel(total);
|
||||
for (int index = 0; index < total; ++index)
|
||||
s_sel[index] = _(hide_status[index]);
|
||||
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, s_sel, ui_globals::panels_status));
|
||||
menu::stack_push<menu_selector>(ui(), container, s_sel, ui_globals::panels_status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LANGUAGE_MENU:
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
changed = true;
|
||||
(m_event->iptkey == IPT_UI_RIGHT) ? m_currlang++ : m_currlang--;
|
||||
(menu_event->iptkey == IPT_UI_RIGHT) ? m_currlang++ : m_currlang--;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
int total = m_lang.size();
|
||||
std::vector<std::string> s_sel(total);
|
||||
for (int index = 0; index < total; ++index)
|
||||
s_sel[index] = m_lang[index];
|
||||
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, s_sel, m_currlang));
|
||||
menu::stack_push<menu_selector>(ui(), container, s_sel, m_currlang);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -127,14 +131,14 @@ void ui_menu_custom_ui::handle()
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_custom_ui::populate()
|
||||
void menu_custom_ui::populate()
|
||||
{
|
||||
UINT32 arrow_flags;
|
||||
item_append(_("Fonts"), nullptr, 0, (void *)(FPTR)FONT_MENU);
|
||||
@ -149,7 +153,7 @@ void ui_menu_custom_ui::populate()
|
||||
arrow_flags = get_arrow_flags(0, (int)HIDE_BOTH, ui_globals::panels_status);
|
||||
item_append(_("Show side panels"), _(hide_status[ui_globals::panels_status]), arrow_flags, (void *)(FPTR)HIDE_MENU);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
}
|
||||
|
||||
@ -157,7 +161,7 @@ void ui_menu_custom_ui::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_custom_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_custom_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
@ -189,7 +193,7 @@ void ui_menu_custom_ui::custom_render(void *selectedref, float top, float bottom
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_font_ui::ui_menu_font_ui(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_font_ui::menu_font_ui(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
ui_options &moptions = mui.options();
|
||||
std::string name(mui.machine().options().ui_font());
|
||||
@ -234,7 +238,7 @@ ui_menu_font_ui::ui_menu_font_ui(mame_ui_manager &mui, render_container *contain
|
||||
// create fonts list
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_font_ui::list()
|
||||
void menu_font_ui::list()
|
||||
{
|
||||
machine().osd().get_font_families(machine().options().font_path(), m_fonts);
|
||||
|
||||
@ -246,7 +250,7 @@ void ui_menu_font_ui::list()
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_font_ui::~ui_menu_font_ui()
|
||||
menu_font_ui::~menu_font_ui()
|
||||
{
|
||||
std::string error_string;
|
||||
ui_options &moptions = ui().options();
|
||||
@ -272,45 +276,45 @@ ui_menu_font_ui::~ui_menu_font_ui()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_font_ui::handle()
|
||||
void menu_font_ui::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
const event *menu_event = process(PROCESS_LR_REPEAT);
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
switch ((FPTR)m_event->itemref)
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
{
|
||||
case INFOS_SIZE:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
(m_event->iptkey == IPT_UI_RIGHT) ? m_info_size += 0.05f : m_info_size -= 0.05f;
|
||||
(menu_event->iptkey == IPT_UI_RIGHT) ? m_info_size += 0.05f : m_info_size -= 0.05f;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case FONT_SIZE:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
(m_event->iptkey == IPT_UI_RIGHT) ? m_font_size++ : m_font_size--;
|
||||
(menu_event->iptkey == IPT_UI_RIGHT) ? m_font_size++ : m_font_size--;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MUI_FNT:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
(m_event->iptkey == IPT_UI_RIGHT) ? m_actual++ : m_actual--;
|
||||
(menu_event->iptkey == IPT_UI_RIGHT) ? m_actual++ : m_actual--;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
std::vector<std::string> display_names;
|
||||
display_names.reserve(m_fonts.size());
|
||||
for (auto const &font : m_fonts) display_names.emplace_back(font.second);
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, std::move(display_names), m_actual));
|
||||
menu::stack_push<menu_selector>(ui(), container, std::move(display_names), m_actual);
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
@ -318,9 +322,9 @@ void ui_menu_font_ui::handle()
|
||||
#ifdef UI_WINDOWS
|
||||
case MUI_BOLD:
|
||||
case MUI_ITALIC:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT || menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
((FPTR)m_event->itemref == MUI_BOLD) ? m_bold = !m_bold : m_italic = !m_italic;
|
||||
((FPTR)menu_event->itemref == MUI_BOLD) ? m_bold = !m_bold : m_italic = !m_italic;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
@ -328,14 +332,14 @@ void ui_menu_font_ui::handle()
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_font_ui::populate()
|
||||
void menu_font_ui::populate()
|
||||
{
|
||||
// set filter arrow
|
||||
UINT32 arrow_flags;
|
||||
@ -347,21 +351,21 @@ void ui_menu_font_ui::populate()
|
||||
#ifdef UI_WINDOWS
|
||||
if (m_fonts[m_actual].first != "default")
|
||||
{
|
||||
item_append(_("Bold"), m_bold ? "On" : "Off", m_bold ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)MUI_BOLD);
|
||||
item_append(_("Italic"), m_italic ? "On" : "Off", m_italic ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)MUI_ITALIC);
|
||||
item_append(_("Bold"), m_bold ? "On" : "Off", m_bold ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(FPTR)MUI_BOLD);
|
||||
item_append(_("Italic"), m_italic ? "On" : "Off", m_italic ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(FPTR)MUI_ITALIC);
|
||||
}
|
||||
#endif
|
||||
|
||||
arrow_flags = get_arrow_flags(m_font_min, m_font_max, m_font_size);
|
||||
item_append(_("Lines"), string_format("%2d", m_font_size).c_str(), arrow_flags, (void *)(FPTR)FONT_SIZE);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
// add item
|
||||
arrow_flags = get_arrow_flags(m_info_min, m_info_max, m_info_size);
|
||||
item_append(_("Infos text size"), string_format("%3.2f", m_info_size).c_str(), arrow_flags, (void *)(FPTR)INFOS_SIZE);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
custombottom = customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
}
|
||||
@ -370,7 +374,7 @@ void ui_menu_font_ui::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_font_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_font_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
@ -434,7 +438,7 @@ void ui_menu_font_ui::custom_render(void *selectedref, float top, float bottom,
|
||||
//-------------------------------------------------
|
||||
#define SET_COLOR_UI(var, opt) var[M##opt].color = opt; var[M##opt].option = OPTION_##opt
|
||||
|
||||
ui_menu_colors_ui::ui_menu_colors_ui(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_colors_ui::menu_colors_ui(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
SET_COLOR_UI(m_color_table, UI_BACKGROUND_COLOR);
|
||||
SET_COLOR_UI(m_color_table, UI_BORDER_COLOR);
|
||||
@ -458,7 +462,7 @@ ui_menu_colors_ui::ui_menu_colors_ui(mame_ui_manager &mui, render_container *con
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_colors_ui::~ui_menu_colors_ui()
|
||||
menu_colors_ui::~menu_colors_ui()
|
||||
{
|
||||
std::string error_string, dec_color;
|
||||
for (int index = 1; index < MUI_RESTORE; index++)
|
||||
@ -472,17 +476,17 @@ ui_menu_colors_ui::~ui_menu_colors_ui()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_colors_ui::handle()
|
||||
void menu_colors_ui::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr && menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
if ((FPTR)m_event->itemref != MUI_RESTORE)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_rgb_ui>(ui(), container, &m_color_table[(FPTR)m_event->itemref].color, item[selected].text));
|
||||
if ((FPTR)menu_event->itemref != MUI_RESTORE)
|
||||
menu::stack_push<menu_rgb_ui>(ui(), container, &m_color_table[(FPTR)menu_event->itemref].color, item[selected].text);
|
||||
else
|
||||
{
|
||||
changed = true;
|
||||
@ -491,14 +495,14 @@ void ui_menu_colors_ui::handle()
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_colors_ui::populate()
|
||||
void menu_colors_ui::populate()
|
||||
{
|
||||
item_append(_("Normal text"), nullptr, 0, (void *)(FPTR)MUI_TEXT_COLOR);
|
||||
item_append(_("Selected color"), nullptr, 0, (void *)(FPTR)MUI_SELECTED_COLOR);
|
||||
@ -517,7 +521,7 @@ void ui_menu_colors_ui::populate()
|
||||
item_append(_("Mouse down color"), nullptr, 0, (void *)(FPTR)MUI_MOUSEDOWN_COLOR);
|
||||
item_append(_("Mouse down background color"), nullptr, 0, (void *)(FPTR)MUI_MOUSEDOWN_BG_COLOR);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("Restore originals colors"), nullptr, 0, (void *)(FPTR)MUI_RESTORE);
|
||||
|
||||
custombottom = customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
@ -527,7 +531,7 @@ void ui_menu_colors_ui::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width, maxwidth = origx2 - origx1;
|
||||
float line_height = ui().get_line_height();
|
||||
@ -674,7 +678,7 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom
|
||||
// restore original colors
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_colors_ui::restore_colors()
|
||||
void menu_colors_ui::restore_colors()
|
||||
{
|
||||
ui_options options;
|
||||
for (int index = 1; index < MUI_RESTORE; index++)
|
||||
@ -685,7 +689,7 @@ void ui_menu_colors_ui::restore_colors()
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_rgb_ui::ui_menu_rgb_ui(mame_ui_manager &mui, render_container *container, rgb_t *_color, std::string _title) : ui_menu(mui, container)
|
||||
menu_rgb_ui::menu_rgb_ui(mame_ui_manager &mui, render_container *container, rgb_t *_color, std::string _title) : menu(mui, container)
|
||||
{
|
||||
m_color = _color;
|
||||
m_key_active = false;
|
||||
@ -698,7 +702,7 @@ ui_menu_rgb_ui::ui_menu_rgb_ui(mame_ui_manager &mui, render_container *container
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_rgb_ui::~ui_menu_rgb_ui()
|
||||
menu_rgb_ui::~menu_rgb_ui()
|
||||
{
|
||||
}
|
||||
|
||||
@ -706,125 +710,125 @@ ui_menu_rgb_ui::~ui_menu_rgb_ui()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_rgb_ui::handle()
|
||||
void menu_rgb_ui::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event;
|
||||
const event *menu_event;
|
||||
|
||||
if (!m_key_active)
|
||||
m_event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
menu_event = process(PROCESS_LR_REPEAT);
|
||||
else
|
||||
m_event = process(UI_MENU_PROCESS_ONLYCHAR);
|
||||
menu_event = process(PROCESS_ONLYCHAR);
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
switch ((FPTR)m_event->itemref)
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
{
|
||||
case RGB_ALPHA:
|
||||
if (m_event->iptkey == IPT_UI_LEFT && m_color->a() > 1)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && m_color->a() > 1)
|
||||
{
|
||||
m_color->set_a(m_color->a() - 1);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && m_color->a() < 255)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && m_color->a() < 255)
|
||||
{
|
||||
m_color->set_a(m_color->a() + 1);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
else if (m_event->iptkey == IPT_UI_SELECT || m_event->iptkey == IPT_SPECIAL)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT || menu_event->iptkey == IPT_SPECIAL)
|
||||
{
|
||||
inkey_special(m_event);
|
||||
inkey_special(menu_event);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RGB_RED:
|
||||
if (m_event->iptkey == IPT_UI_LEFT && m_color->r() > 1)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && m_color->r() > 1)
|
||||
{
|
||||
m_color->set_r(m_color->r() - 1);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && m_color->r() < 255)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && m_color->r() < 255)
|
||||
{
|
||||
m_color->set_r(m_color->r() + 1);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
else if (m_event->iptkey == IPT_UI_SELECT || m_event->iptkey == IPT_SPECIAL)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT || menu_event->iptkey == IPT_SPECIAL)
|
||||
{
|
||||
inkey_special(m_event);
|
||||
inkey_special(menu_event);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RGB_GREEN:
|
||||
if (m_event->iptkey == IPT_UI_LEFT && m_color->g() > 1)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && m_color->g() > 1)
|
||||
{
|
||||
m_color->set_g(m_color->g() - 1);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && m_color->g() < 255)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && m_color->g() < 255)
|
||||
{
|
||||
m_color->set_g(m_color->g() + 1);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
else if (m_event->iptkey == IPT_UI_SELECT || m_event->iptkey == IPT_SPECIAL)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT || menu_event->iptkey == IPT_SPECIAL)
|
||||
{
|
||||
inkey_special(m_event);
|
||||
inkey_special(menu_event);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RGB_BLUE:
|
||||
if (m_event->iptkey == IPT_UI_LEFT && m_color->b() > 1)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && m_color->b() > 1)
|
||||
{
|
||||
m_color->set_b(m_color->b() - 1);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT && m_color->b() < 255)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT && m_color->b() < 255)
|
||||
{
|
||||
m_color->set_b(m_color->b() + 1);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
else if (m_event->iptkey == IPT_UI_SELECT || m_event->iptkey == IPT_SPECIAL)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT || menu_event->iptkey == IPT_SPECIAL)
|
||||
{
|
||||
inkey_special(m_event);
|
||||
inkey_special(menu_event);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PALETTE_CHOOSE:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_palette_sel>(ui(), container, *m_color));
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_palette_sel>(ui(), container, *m_color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_rgb_ui::populate()
|
||||
void menu_rgb_ui::populate()
|
||||
{
|
||||
// set filter arrow
|
||||
UINT32 arrow_flags = MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW;
|
||||
UINT32 arrow_flags = FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW;
|
||||
std::string s_text = std::string(m_search).append("_");
|
||||
|
||||
if (m_lock_ref != RGB_ALPHA)
|
||||
@ -859,9 +863,9 @@ void ui_menu_rgb_ui::populate()
|
||||
else
|
||||
item_append(_("Blue"), s_text.c_str(), 0, (void *)(FPTR)RGB_BLUE);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("Choose from palette"), nullptr, 0, (void *)(FPTR)PALETTE_CHOOSE);
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
custombottom = customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
}
|
||||
@ -870,7 +874,7 @@ void ui_menu_rgb_ui::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width, maxwidth = origx2 - origx1;
|
||||
|
||||
@ -937,19 +941,19 @@ void ui_menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, f
|
||||
// handle special key event
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_rgb_ui::inkey_special(const ui_menu_event *m_event)
|
||||
void menu_rgb_ui::inkey_special(const event *menu_event)
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
m_key_active = !m_key_active;
|
||||
m_lock_ref = (FPTR)m_event->itemref;
|
||||
m_lock_ref = (FPTR)menu_event->itemref;
|
||||
|
||||
if (!m_key_active)
|
||||
{
|
||||
int val = atoi(m_search);
|
||||
val = m_color->clamp(val);
|
||||
|
||||
switch ((FPTR)m_event->itemref)
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
{
|
||||
case RGB_ALPHA:
|
||||
m_color->set_a(val);
|
||||
@ -983,18 +987,18 @@ void ui_menu_rgb_ui::inkey_special(const ui_menu_event *m_event)
|
||||
int buflen = strlen(m_search);
|
||||
|
||||
// if it's a backspace and we can handle it, do so
|
||||
if (((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0))
|
||||
if (((menu_event->unichar == 8 || menu_event->unichar == 0x7f) && buflen > 0))
|
||||
*(char *)utf8_previous_char(&m_search[buflen]) = 0;
|
||||
else if (buflen >= 3)
|
||||
return;
|
||||
// if it's any other key and we're not maxed out, update
|
||||
else if ((m_event->unichar >= '0' && m_event->unichar <= '9'))
|
||||
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar);
|
||||
else if ((menu_event->unichar >= '0' && menu_event->unichar <= '9'))
|
||||
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, menu_event->unichar);
|
||||
|
||||
m_search[buflen] = 0;
|
||||
}
|
||||
|
||||
ui_menu_palette_sel::palcolor ui_menu_palette_sel::m_palette[] = {
|
||||
menu_palette_sel::palcolor menu_palette_sel::m_palette[] = {
|
||||
{ __("White"), "FFFFFFFF" },
|
||||
{ __("Silver"), "FFC0C0C0" },
|
||||
{ __("Gray"), "FF808080" },
|
||||
@ -1011,8 +1015,8 @@ ui_menu_palette_sel::palcolor ui_menu_palette_sel::m_palette[] = {
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_palette_sel::ui_menu_palette_sel(mame_ui_manager &mui, render_container *container, rgb_t &_color)
|
||||
: ui_menu(mui, container), m_original(_color)
|
||||
menu_palette_sel::menu_palette_sel(mame_ui_manager &mui, render_container *container, rgb_t &_color)
|
||||
: menu(mui, container), m_original(_color)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1020,7 +1024,7 @@ ui_menu_palette_sel::ui_menu_palette_sel(mame_ui_manager &mui, render_container
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_palette_sel::~ui_menu_palette_sel()
|
||||
menu_palette_sel::~menu_palette_sel()
|
||||
{
|
||||
}
|
||||
|
||||
@ -1028,17 +1032,17 @@ ui_menu_palette_sel::~ui_menu_palette_sel()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_palette_sel::handle()
|
||||
void menu_palette_sel::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(MENU_FLAG_UI_PALETTE);
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
const event *menu_event = process(FLAG_UI_PALETTE);
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
m_original = rgb_t((UINT32)strtoul(item[selected].subtext, nullptr, 16));
|
||||
ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
ui_menu::stack_pop(machine());
|
||||
reset_parent(reset_options::SELECT_FIRST);
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1047,18 +1051,20 @@ void ui_menu_palette_sel::handle()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_palette_sel::populate()
|
||||
void menu_palette_sel::populate()
|
||||
{
|
||||
for (int x = 0; x < ARRAY_LENGTH(m_palette); ++x)
|
||||
item_append(_(m_palette[x].name), m_palette[x].argb, MENU_FLAG_UI_PALETTE, (void *)(FPTR)(x + 1));
|
||||
item_append(_(m_palette[x].name), m_palette[x].argb, FLAG_UI_PALETTE, (void *)(FPTR)(x + 1));
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_palette_sel::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_palette_sel::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,18 +10,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef MAME_EMU_UI_UI_CUSTUI_H
|
||||
#define MAME_EMU_UI_UI_CUSTUI_H
|
||||
#ifndef MAME_FRONTEND_UI_CUSTUI_H
|
||||
#define MAME_FRONTEND_UI_CUSTUI_H
|
||||
|
||||
#include "ui/menu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// Custom UI menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_custom_ui : public ui_menu
|
||||
class menu_custom_ui : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_custom_ui(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_custom_ui();
|
||||
menu_custom_ui(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_custom_ui() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -43,11 +47,11 @@ private:
|
||||
// Font UI menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_font_ui : public ui_menu
|
||||
class menu_font_ui : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_font_ui(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_font_ui();
|
||||
menu_font_ui(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_font_ui() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -78,11 +82,11 @@ private:
|
||||
// Colors UI menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_colors_ui : public ui_menu
|
||||
class menu_colors_ui : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_colors_ui(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_colors_ui();
|
||||
menu_colors_ui(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_colors_ui() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -123,11 +127,11 @@ private:
|
||||
// ARGB UI menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_rgb_ui : public ui_menu
|
||||
class menu_rgb_ui : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_rgb_ui(mame_ui_manager &mui, render_container *container, rgb_t *_color, std::string _title);
|
||||
virtual ~ui_menu_rgb_ui();
|
||||
menu_rgb_ui(mame_ui_manager &mui, render_container *container, rgb_t *_color, std::string _title);
|
||||
virtual ~menu_rgb_ui() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -148,18 +152,18 @@ private:
|
||||
PALETTE_CHOOSE
|
||||
};
|
||||
|
||||
void inkey_special(const ui_menu_event *menu_event);
|
||||
void inkey_special(const event *menu_event);
|
||||
};
|
||||
|
||||
//-------------------------------------------------
|
||||
// Palette UI menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_palette_sel : public ui_menu
|
||||
class menu_palette_sel : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_palette_sel(mame_ui_manager &mui, render_container *container, rgb_t &_color);
|
||||
virtual ~ui_menu_palette_sel();
|
||||
menu_palette_sel(mame_ui_manager &mui, render_container *container, rgb_t &_color);
|
||||
virtual ~menu_palette_sel() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -175,4 +179,6 @@ private:
|
||||
rgb_t &m_original;
|
||||
};
|
||||
|
||||
#endif // MAME_EMU_UI_UI_CUSTUI_H
|
||||
} // namespace ui
|
||||
|
||||
#endif // MAME_FRONTEND_UI_CUSTUI_H
|
||||
|
@ -9,21 +9,24 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "mame.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "rendfont.h"
|
||||
#include "ui/datfile.h"
|
||||
#include "ui/datmenu.h"
|
||||
#include "ui/utils.h"
|
||||
|
||||
#include "mame.h"
|
||||
#include "rendfont.h"
|
||||
#include "softlist.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_dats_view::ui_menu_dats_view(mame_ui_manager &mui, render_container *container, const game_driver *driver)
|
||||
: ui_menu(mui, container)
|
||||
menu_dats_view::menu_dats_view(mame_ui_manager &mui, render_container *container, const game_driver *driver)
|
||||
: menu(mui, container)
|
||||
, m_actual(0)
|
||||
, m_driver((driver == nullptr) ? &mui.machine().system() : driver)
|
||||
, m_issoft(false)
|
||||
@ -47,8 +50,8 @@ ui_menu_dats_view::ui_menu_dats_view(mame_ui_manager &mui, render_container *con
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_dats_view::ui_menu_dats_view(mame_ui_manager &mui, render_container *container, ui_software_info *swinfo, const game_driver *driver)
|
||||
: ui_menu(mui, container)
|
||||
menu_dats_view::menu_dats_view(mame_ui_manager &mui, render_container *container, ui_software_info *swinfo, const game_driver *driver)
|
||||
: menu(mui, container)
|
||||
, m_actual(0)
|
||||
, m_driver((driver == nullptr) ? &mui.machine().system() : driver)
|
||||
, m_swinfo(swinfo)
|
||||
@ -69,7 +72,7 @@ ui_menu_dats_view::ui_menu_dats_view(mame_ui_manager &mui, render_container *con
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_dats_view::~ui_menu_dats_view()
|
||||
menu_dats_view::~menu_dats_view()
|
||||
{
|
||||
}
|
||||
|
||||
@ -77,21 +80,21 @@ ui_menu_dats_view::~ui_menu_dats_view()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_dats_view::handle()
|
||||
void menu_dats_view::handle()
|
||||
{
|
||||
const ui_menu_event *m_event = process(MENU_FLAG_UI_DATS);
|
||||
if (m_event != nullptr)
|
||||
const event *menu_event = process(FLAG_UI_DATS);
|
||||
if (menu_event != nullptr)
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_LEFT && m_actual > 0)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT && m_actual > 0)
|
||||
{
|
||||
m_actual--;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
|
||||
if (m_event->iptkey == IPT_UI_RIGHT && m_actual < m_items_list.size() - 1)
|
||||
if (menu_event->iptkey == IPT_UI_RIGHT && m_actual < m_items_list.size() - 1)
|
||||
{
|
||||
m_actual++;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -100,7 +103,7 @@ void ui_menu_dats_view::handle()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_dats_view::populate()
|
||||
void menu_dats_view::populate()
|
||||
{
|
||||
bool paused = machine().paused();
|
||||
if (!paused)
|
||||
@ -108,7 +111,7 @@ void ui_menu_dats_view::populate()
|
||||
|
||||
(m_issoft == true) ? get_data_sw() : get_data();
|
||||
|
||||
item_append(MENU_SEPARATOR_ITEM, nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), nullptr);
|
||||
item_append(MENU_SEPARATOR_ITEM, nullptr, (FLAG_UI_DATS | FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW), nullptr);
|
||||
customtop = 2.0f * ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER;
|
||||
custombottom = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
|
||||
@ -120,7 +123,7 @@ void ui_menu_dats_view::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_dats_view::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float maxwidth = origx2 - origx1;
|
||||
float width;
|
||||
@ -219,7 +222,7 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom
|
||||
// load data from DATs
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_dats_view::get_data()
|
||||
void menu_dats_view::get_data()
|
||||
{
|
||||
std::vector<int> xstart;
|
||||
std::vector<int> xend;
|
||||
@ -248,11 +251,11 @@ void ui_menu_dats_view::get_data()
|
||||
for (int x = 0; x < lines; ++x)
|
||||
{
|
||||
std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x]));
|
||||
item_append(tempbuf.c_str(), nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_DISABLE), (void *)(FPTR)(x + 1));
|
||||
item_append(tempbuf.c_str(), nullptr, (FLAG_UI_DATS | FLAG_DISABLE), (void *)(FPTR)(x + 1));
|
||||
}
|
||||
}
|
||||
|
||||
void ui_menu_dats_view::get_data_sw()
|
||||
void menu_dats_view::get_data_sw()
|
||||
{
|
||||
std::vector<int> xstart;
|
||||
std::vector<int> xend;
|
||||
@ -271,11 +274,11 @@ void ui_menu_dats_view::get_data_sw()
|
||||
for (int x = 0; x < lines; ++x)
|
||||
{
|
||||
std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x]));
|
||||
item_append(tempbuf.c_str(), nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_DISABLE), (void *)(FPTR)(x + 1));
|
||||
item_append(tempbuf.c_str(), nullptr, (FLAG_UI_DATS | FLAG_DISABLE), (void *)(FPTR)(x + 1));
|
||||
}
|
||||
}
|
||||
|
||||
void ui_menu_dats_view::init_items()
|
||||
void menu_dats_view::init_items()
|
||||
{
|
||||
datfile_manager &datfile = mame_machine_manager::instance()->datfile();
|
||||
if (datfile.has_history(m_driver))
|
||||
@ -293,3 +296,5 @@ void ui_menu_dats_view::init_items()
|
||||
if (datfile.has_command(m_driver))
|
||||
m_items_list.emplace_back(_("Command"), UI_COMMAND_LOAD, "");
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -11,21 +11,29 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_DATMENU_H__
|
||||
#define __UI_DATMENU_H__
|
||||
#ifndef MAME_FRONTEND_UI_DATMENU_H
|
||||
#define MAME_FRONTEND_UI_DATMENU_H
|
||||
|
||||
#include "ui/menu.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
struct ui_software_info;
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// class dats menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_dats_view : public ui_menu
|
||||
class menu_dats_view : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_dats_view(mame_ui_manager &mui, render_container *container, ui_software_info *swinfo, const game_driver *driver = nullptr);
|
||||
ui_menu_dats_view(mame_ui_manager &mui, render_container *container, const game_driver *driver = nullptr);
|
||||
virtual ~ui_menu_dats_view();
|
||||
menu_dats_view(mame_ui_manager &mui, render_container *container, ui_software_info *swinfo, const game_driver *driver = nullptr);
|
||||
menu_dats_view(mame_ui_manager &mui, render_container *container, const game_driver *driver = nullptr);
|
||||
virtual ~menu_dats_view() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -49,4 +57,6 @@ private:
|
||||
std::vector<list_items> m_items_list;
|
||||
};
|
||||
|
||||
#endif /* __UI_DATMENU_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_DATMENU_H */
|
||||
|
@ -20,17 +20,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_DEVCTRL_H__
|
||||
#define __UI_DEVCTRL_H__
|
||||
#ifndef MAME_FRONTEND_UI_DEVCTRL_H
|
||||
#define MAME_FRONTEND_UI_DEVCTRL_H
|
||||
|
||||
template<class _DeviceType>
|
||||
class ui_menu_device_control : public ui_menu
|
||||
#include "ui/menu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
template<class DeviceType>
|
||||
class menu_device_control : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_device_control(mame_ui_manager &mui, render_container *container, _DeviceType *device);
|
||||
menu_device_control(mame_ui_manager &mui, render_container *container, DeviceType *device);
|
||||
|
||||
protected:
|
||||
_DeviceType *current_device() { return m_device; }
|
||||
DeviceType *current_device() { return m_device; }
|
||||
int count() { return m_count; }
|
||||
|
||||
int current_index();
|
||||
@ -41,9 +45,9 @@ protected:
|
||||
|
||||
private:
|
||||
// device iterator
|
||||
typedef device_type_iterator<&device_creator<_DeviceType>, _DeviceType> iterator;
|
||||
typedef device_type_iterator<&device_creator<DeviceType>, DeviceType> iterator;
|
||||
|
||||
_DeviceType * m_device;
|
||||
DeviceType * m_device;
|
||||
int m_count;
|
||||
};
|
||||
|
||||
@ -52,9 +56,9 @@ private:
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
template<class _DeviceType>
|
||||
ui_menu_device_control<_DeviceType>::ui_menu_device_control(mame_ui_manager &mui, render_container *container, _DeviceType *device)
|
||||
: ui_menu(mui, container)
|
||||
template<class DeviceType>
|
||||
menu_device_control<DeviceType>::menu_device_control(mame_ui_manager &mui, render_container *container, DeviceType *device)
|
||||
: menu(mui, container)
|
||||
{
|
||||
iterator iter(mui.machine().root_device());
|
||||
m_count = iter.count();
|
||||
@ -66,8 +70,8 @@ ui_menu_device_control<_DeviceType>::ui_menu_device_control(mame_ui_manager &mui
|
||||
// current_index
|
||||
//-------------------------------------------------
|
||||
|
||||
template<class _DeviceType>
|
||||
int ui_menu_device_control<_DeviceType>::current_index()
|
||||
template<class DeviceType>
|
||||
int menu_device_control<DeviceType>::current_index()
|
||||
{
|
||||
iterator iter(machine().root_device());
|
||||
return iter.indexof(*m_device);
|
||||
@ -78,8 +82,8 @@ int ui_menu_device_control<_DeviceType>::current_index()
|
||||
// previous
|
||||
//-------------------------------------------------
|
||||
|
||||
template<class _DeviceType>
|
||||
void ui_menu_device_control<_DeviceType>::previous()
|
||||
template<class DeviceType>
|
||||
void menu_device_control<DeviceType>::previous()
|
||||
{
|
||||
// left arrow - rotate left through cassette devices
|
||||
if (m_device != nullptr)
|
||||
@ -99,8 +103,8 @@ void ui_menu_device_control<_DeviceType>::previous()
|
||||
// next
|
||||
//-------------------------------------------------
|
||||
|
||||
template<class _DeviceType>
|
||||
void ui_menu_device_control<_DeviceType>::next()
|
||||
template<class DeviceType>
|
||||
void menu_device_control<DeviceType>::next()
|
||||
{
|
||||
// right arrow - rotate right through cassette devices
|
||||
if (m_device != nullptr)
|
||||
@ -120,8 +124,8 @@ void ui_menu_device_control<_DeviceType>::next()
|
||||
// current_display_name
|
||||
//-------------------------------------------------
|
||||
|
||||
template<class _DeviceType>
|
||||
std::string ui_menu_device_control<_DeviceType>::current_display_name()
|
||||
template<class DeviceType>
|
||||
std::string menu_device_control<DeviceType>::current_display_name()
|
||||
{
|
||||
std::string display_name;
|
||||
display_name.assign(current_device()->name());
|
||||
@ -135,19 +139,20 @@ std::string ui_menu_device_control<_DeviceType>::current_display_name()
|
||||
// current_display_flags
|
||||
//-------------------------------------------------
|
||||
|
||||
template<class _DeviceType>
|
||||
UINT32 ui_menu_device_control<_DeviceType>::current_display_flags()
|
||||
template<class DeviceType>
|
||||
UINT32 menu_device_control<DeviceType>::current_display_flags()
|
||||
{
|
||||
UINT32 flags = 0;
|
||||
if (count() > 1)
|
||||
{
|
||||
if (current_index() > 0)
|
||||
flags |= MENU_FLAG_LEFT_ARROW;
|
||||
flags |= FLAG_LEFT_ARROW;
|
||||
if (current_index() < count() - 1)
|
||||
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||
flags |= FLAG_RIGHT_ARROW;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif /* __UI_DEVCTRL_H__ */
|
||||
#endif /* MAME_FRONTEND_UI_DEVCTRL_H */
|
||||
|
@ -10,22 +10,24 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/devopt.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_device_config - handle the game information
|
||||
device_config - handle the game information
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_device_config::ui_menu_device_config(mame_ui_manager &mui, render_container *container, device_slot_interface *slot, device_slot_option *option) : ui_menu(mui, container)
|
||||
menu_device_config::menu_device_config(mame_ui_manager &mui, render_container *container, device_slot_interface *slot, device_slot_option *option) : menu(mui, container)
|
||||
{
|
||||
m_option = option;
|
||||
m_owner = slot;
|
||||
m_mounted = slot->device().subdevice(option->name()) != nullptr;
|
||||
}
|
||||
|
||||
void ui_menu_device_config::populate()
|
||||
void menu_device_config::populate()
|
||||
{
|
||||
std::ostringstream str;
|
||||
device_t *dev;
|
||||
@ -265,15 +267,17 @@ void ui_menu_device_config::populate()
|
||||
str << "[None]\n";
|
||||
|
||||
const_cast<machine_config &>(machine().config()).device_remove(&machine().config().root_device(), m_option->name());
|
||||
item_append(str.str().c_str(), nullptr, MENU_FLAG_MULTILINE, nullptr);
|
||||
item_append(str.str().c_str(), nullptr, FLAG_MULTILINE, nullptr);
|
||||
}
|
||||
|
||||
void ui_menu_device_config::handle()
|
||||
void menu_device_config::handle()
|
||||
{
|
||||
/* process the menu */
|
||||
process(0);
|
||||
}
|
||||
|
||||
ui_menu_device_config::~ui_menu_device_config()
|
||||
menu_device_config::~menu_device_config()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,13 +10,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_DEVOPT_H__
|
||||
#define __UI_DEVOPT_H__
|
||||
#ifndef MAME_FRONTEND_UI_DEVOPT_H
|
||||
#define MAME_FRONTEND_UI_DEVOPT_H
|
||||
|
||||
class ui_menu_device_config : public ui_menu {
|
||||
#include "ui/menu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
class menu_device_config : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_device_config(mame_ui_manager &mui, render_container *container, device_slot_interface *slot, device_slot_option *option);
|
||||
virtual ~ui_menu_device_config();
|
||||
menu_device_config(mame_ui_manager &mui, render_container *container, device_slot_interface *slot, device_slot_option *option);
|
||||
virtual ~menu_device_config() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -26,5 +31,6 @@ private:
|
||||
bool m_mounted;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif /* __UI_DEVOPT_H__ */
|
||||
#endif /* MAME_FRONTEND_UI_DEVOPT_H */
|
||||
|
@ -9,15 +9,19 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "emuopts.h"
|
||||
#include "mame.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/dirmenu.h"
|
||||
#include "ui/datfile.h"
|
||||
#include "ui/utils.h"
|
||||
#include "ui/optsmenu.h"
|
||||
|
||||
#include "emuopts.h"
|
||||
#include "mame.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
static int ADDING = 1;
|
||||
static int CHANGE = 2;
|
||||
|
||||
@ -68,11 +72,11 @@ static const folders_entry s_folders[] =
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_directory::ui_menu_directory(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_directory::menu_directory(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_directory::~ui_menu_directory()
|
||||
menu_directory::~menu_directory()
|
||||
{
|
||||
ui().save_ui_options();
|
||||
ui_globals::reset = true;
|
||||
@ -83,25 +87,25 @@ ui_menu_directory::~ui_menu_directory()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_directory::handle()
|
||||
void menu_directory::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_display_actual>(ui(), container, selected));
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr && menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_display_actual>(ui(), container, selected);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_directory::populate()
|
||||
void menu_directory::populate()
|
||||
{
|
||||
for (auto & elem : s_folders)
|
||||
item_append(_(elem.name), nullptr, 0, (void *)(FPTR)elem.action);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
}
|
||||
|
||||
@ -109,7 +113,7 @@ void ui_menu_directory::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_directory::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_directory::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
@ -145,12 +149,12 @@ void ui_menu_directory::custom_render(void *selectedref, float top, float bottom
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_display_actual::ui_menu_display_actual(mame_ui_manager &mui, render_container *container, int ref)
|
||||
: ui_menu(mui, container), m_ref(ref)
|
||||
menu_display_actual::menu_display_actual(mame_ui_manager &mui, render_container *container, int ref)
|
||||
: menu(mui, container), m_ref(ref)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_display_actual::~ui_menu_display_actual()
|
||||
menu_display_actual::~menu_display_actual()
|
||||
{
|
||||
}
|
||||
|
||||
@ -158,20 +162,20 @@ ui_menu_display_actual::~ui_menu_display_actual()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_display_actual::handle()
|
||||
void menu_display_actual::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(0);
|
||||
if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT)
|
||||
switch ((FPTR)m_event->itemref)
|
||||
const event *menu_event = process(0);
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr && menu_event->iptkey == IPT_UI_SELECT)
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
{
|
||||
case REMOVE:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_remove_folder>(ui(), container, m_ref));
|
||||
break;
|
||||
case REMOVE:
|
||||
menu::stack_push<menu_remove_folder>(ui(), container, m_ref);
|
||||
break;
|
||||
|
||||
case ADD_CHANGE:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_add_change_folder>(ui(), container, m_ref));
|
||||
break;
|
||||
case ADD_CHANGE:
|
||||
menu::stack_push<menu_add_change_folder>(ui(), container, m_ref);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,7 +183,7 @@ void ui_menu_display_actual::handle()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_display_actual::populate()
|
||||
void menu_display_actual::populate()
|
||||
{
|
||||
m_tempbuf = string_format(_("Current %1$s Folders"), _(s_folders[m_ref].name));
|
||||
if (ui().options().exists(s_folders[m_ref].option))
|
||||
@ -198,7 +202,7 @@ void ui_menu_display_actual::populate()
|
||||
if (m_folders.size() > 1)
|
||||
item_append(_("Remove Folder"), nullptr, 0, (void *)REMOVE);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
customtop = (m_folders.size() + 1) * ui().get_line_height() + 6.0f * UI_BOX_TB_BORDER;
|
||||
}
|
||||
|
||||
@ -206,7 +210,7 @@ void ui_menu_display_actual::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_display_actual::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_display_actual::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width, maxwidth = origx2 - origx1;
|
||||
float lineh = ui().get_line_height();
|
||||
@ -272,7 +276,7 @@ MENU ADD FOLDER
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_add_change_folder::ui_menu_add_change_folder(mame_ui_manager &mui, render_container *container, int ref) : ui_menu(mui, container)
|
||||
menu_add_change_folder::menu_add_change_folder(mame_ui_manager &mui, render_container *container, int ref) : menu(mui, container)
|
||||
{
|
||||
m_ref = ref;
|
||||
m_change = (s_folders[ref].action == CHANGE);
|
||||
@ -293,7 +297,7 @@ ui_menu_add_change_folder::ui_menu_add_change_folder(mame_ui_manager &mui, rende
|
||||
m_folders.push_back(curpath);
|
||||
}
|
||||
|
||||
ui_menu_add_change_folder::~ui_menu_add_change_folder()
|
||||
menu_add_change_folder::~menu_add_change_folder()
|
||||
{
|
||||
}
|
||||
|
||||
@ -301,17 +305,17 @@ ui_menu_add_change_folder::~ui_menu_add_change_folder()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_add_change_folder::handle()
|
||||
void menu_add_change_folder::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
int index = (FPTR)m_event->itemref - 1;
|
||||
const ui_menu_item &pitem = item[index];
|
||||
int index = (FPTR)menu_event->itemref - 1;
|
||||
const menu_item &pitem = item[index];
|
||||
|
||||
// go up to the parent path
|
||||
if (!strcmp(pitem.text, ".."))
|
||||
@ -338,28 +342,28 @@ void ui_menu_add_change_folder::handle()
|
||||
// reset the char buffer also in this case
|
||||
if (m_search[0] != 0)
|
||||
m_search[0] = '\0';
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
else if (m_event->iptkey == IPT_SPECIAL)
|
||||
else if (menu_event->iptkey == IPT_SPECIAL)
|
||||
{
|
||||
int buflen = strlen(m_search);
|
||||
bool update_selected = FALSE;
|
||||
|
||||
// if it's a backspace and we can handle it, do so
|
||||
if ((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0)
|
||||
if ((menu_event->unichar == 8 || menu_event->unichar == 0x7f) && buflen > 0)
|
||||
{
|
||||
*(char *)utf8_previous_char(&m_search[buflen]) = 0;
|
||||
update_selected = TRUE;
|
||||
}
|
||||
// if it's any other key and we're not maxed out, update
|
||||
else if (m_event->unichar >= ' ' && m_event->unichar < 0x7f)
|
||||
else if (menu_event->unichar >= ' ' && menu_event->unichar < 0x7f)
|
||||
{
|
||||
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar);
|
||||
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, menu_event->unichar);
|
||||
m_search[buflen] = 0;
|
||||
update_selected = TRUE;
|
||||
}
|
||||
// Tab key, save current path
|
||||
else if (m_event->unichar == 0x09)
|
||||
else if (menu_event->unichar == 0x09)
|
||||
{
|
||||
std::string error_string;
|
||||
if (m_change)
|
||||
@ -393,8 +397,8 @@ void ui_menu_add_change_folder::handle()
|
||||
}
|
||||
}
|
||||
|
||||
ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
ui_menu::stack_pop(machine());
|
||||
reset_parent(reset_options::SELECT_FIRST);
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
|
||||
// check for entries which matches our search buffer
|
||||
@ -443,7 +447,7 @@ void ui_menu_add_change_folder::handle()
|
||||
top_line = selected - (visible_lines / 2);
|
||||
}
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_CANCEL)
|
||||
else if (menu_event->iptkey == IPT_UI_CANCEL)
|
||||
{
|
||||
// reset the char buffer also in this case
|
||||
if (m_search[0] != 0)
|
||||
@ -456,7 +460,7 @@ void ui_menu_add_change_folder::handle()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_add_change_folder::populate()
|
||||
void menu_add_change_folder::populate()
|
||||
{
|
||||
// open a path
|
||||
const char *volume_name = nullptr;
|
||||
@ -475,7 +479,7 @@ void ui_menu_add_change_folder::populate()
|
||||
item_append(dirent->name, "[DIR]", 0, (void *)(FPTR)++folders_count);
|
||||
}
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
// configure the custom rendering
|
||||
customtop = 2.0f * ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
@ -486,7 +490,7 @@ void ui_menu_add_change_folder::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_add_change_folder::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_add_change_folder::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width, maxwidth = origx2 - origx1;
|
||||
std::string tempbuf[2];
|
||||
@ -564,7 +568,7 @@ void ui_menu_add_change_folder::custom_render(void *selectedref, float top, floa
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_remove_folder::ui_menu_remove_folder(mame_ui_manager &mui, render_container *container, int ref) : ui_menu(mui, container)
|
||||
menu_remove_folder::menu_remove_folder(mame_ui_manager &mui, render_container *container, int ref) : menu(mui, container)
|
||||
{
|
||||
m_ref = ref;
|
||||
if (mui.options().exists(s_folders[m_ref].option))
|
||||
@ -578,7 +582,7 @@ ui_menu_remove_folder::ui_menu_remove_folder(mame_ui_manager &mui, render_contai
|
||||
m_folders.push_back(curpath);
|
||||
}
|
||||
|
||||
ui_menu_remove_folder::~ui_menu_remove_folder()
|
||||
menu_remove_folder::~menu_remove_folder()
|
||||
{
|
||||
}
|
||||
|
||||
@ -586,11 +590,11 @@ ui_menu_remove_folder::~ui_menu_remove_folder()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_remove_folder::handle()
|
||||
void menu_remove_folder::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(0);
|
||||
if (m_event != nullptr && m_event->itemref != nullptr && m_event->iptkey == IPT_UI_SELECT)
|
||||
const event *menu_event = process(0);
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr && menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
std::string tmppath, error_string;
|
||||
m_folders.erase(m_folders.begin() + selected);
|
||||
@ -609,8 +613,8 @@ void ui_menu_remove_folder::handle()
|
||||
machine().options().mark_changed(s_folders[m_ref].option);
|
||||
}
|
||||
|
||||
ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
ui_menu::stack_pop(machine());
|
||||
reset_parent(reset_options::REMEMBER_REF);
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
}
|
||||
|
||||
@ -618,13 +622,13 @@ void ui_menu_remove_folder::handle()
|
||||
// populate menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_remove_folder::populate()
|
||||
void menu_remove_folder::populate()
|
||||
{
|
||||
int folders_count = 0;
|
||||
for (auto & elem : m_folders)
|
||||
item_append(elem.c_str(), nullptr, 0, (void *)(FPTR)++folders_count);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
}
|
||||
|
||||
@ -632,7 +636,7 @@ void ui_menu_remove_folder::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_remove_folder::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_remove_folder::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
std::string tempbuf = string_format(_("Remove %1$s Folder"), _(s_folders[m_ref].name));
|
||||
@ -660,3 +664,5 @@ void ui_menu_remove_folder::custom_render(void *selectedref, float top, float bo
|
||||
ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL,
|
||||
UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,18 +10,25 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_DIRMENU_H__
|
||||
#define __UI_DIRMENU_H__
|
||||
#ifndef MAME_FRONTEND_UI_DIRMENU_H
|
||||
#define MAME_FRONTEND_UI_DIRMENU_H
|
||||
|
||||
#include "ui/menu.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// class directory menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_directory : public ui_menu
|
||||
class menu_directory : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_directory(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_directory();
|
||||
menu_directory(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_directory() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -31,11 +38,11 @@ public:
|
||||
// class directory specific menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_display_actual : public ui_menu
|
||||
class menu_display_actual : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_display_actual(mame_ui_manager &mui, render_container *container, int selectedref);
|
||||
virtual ~ui_menu_display_actual();
|
||||
menu_display_actual(mame_ui_manager &mui, render_container *container, int selectedref);
|
||||
virtual ~menu_display_actual() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -56,11 +63,11 @@ private:
|
||||
// class remove folder menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_remove_folder : public ui_menu
|
||||
class menu_remove_folder : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_remove_folder(mame_ui_manager &mui, render_container *container, int ref);
|
||||
virtual ~ui_menu_remove_folder();
|
||||
menu_remove_folder(mame_ui_manager &mui, render_container *container, int ref);
|
||||
virtual ~menu_remove_folder() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -75,11 +82,11 @@ private:
|
||||
// class add / change folder menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_add_change_folder : public ui_menu
|
||||
class menu_add_change_folder : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_add_change_folder(mame_ui_manager &mui, render_container *container, int ref);
|
||||
virtual ~ui_menu_add_change_folder();
|
||||
menu_add_change_folder(mame_ui_manager &mui, render_container *container, int ref);
|
||||
virtual ~menu_add_change_folder() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -94,4 +101,6 @@ private:
|
||||
std::vector<std::string> m_folders;
|
||||
};
|
||||
|
||||
#endif /* __UI_DIRMENU_H__ */
|
||||
} // namesapce ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_DIRMENU_H */
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "softlist.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
/***************************************************************************
|
||||
FILE MANAGER
|
||||
***************************************************************************/
|
||||
@ -30,7 +32,7 @@
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_file_manager::ui_menu_file_manager(mame_ui_manager &mui, render_container *container, const char *warnings) : ui_menu(mui, container), selected_device(nullptr)
|
||||
menu_file_manager::menu_file_manager(mame_ui_manager &mui, render_container *container, const char *warnings) : menu(mui, container), selected_device(nullptr)
|
||||
{
|
||||
// This warning string is used when accessing from the force_file_manager call, i.e.
|
||||
// when the file manager is loaded top front in the case of mandatory image devices
|
||||
@ -47,7 +49,7 @@ ui_menu_file_manager::ui_menu_file_manager(mame_ui_manager &mui, render_containe
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_file_manager::~ui_menu_file_manager()
|
||||
menu_file_manager::~menu_file_manager()
|
||||
{
|
||||
}
|
||||
|
||||
@ -56,7 +58,7 @@ ui_menu_file_manager::~ui_menu_file_manager()
|
||||
// custom_render - perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_file_manager::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_file_manager::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
const char *path;
|
||||
|
||||
@ -66,7 +68,7 @@ void ui_menu_file_manager::custom_render(void *selectedref, float top, float bot
|
||||
}
|
||||
|
||||
|
||||
void ui_menu_file_manager::fill_image_line(device_image_interface *img, std::string &instance, std::string &filename)
|
||||
void menu_file_manager::fill_image_line(device_image_interface *img, std::string &instance, std::string &filename)
|
||||
{
|
||||
// get the image type/id
|
||||
instance = string_format("%s (%s)", img->instance_name(), img->brief_instance_name());
|
||||
@ -102,15 +104,15 @@ void ui_menu_file_manager::fill_image_line(device_image_interface *img, std::str
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_file_manager::populate()
|
||||
void menu_file_manager::populate()
|
||||
{
|
||||
std::string tmp_inst, tmp_name;
|
||||
bool first_entry = true;
|
||||
|
||||
if (!m_warnings.empty())
|
||||
{
|
||||
item_append(m_warnings.c_str(), nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append("", nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(m_warnings.c_str(), nullptr, FLAG_DISABLE, nullptr);
|
||||
item_append("", nullptr, FLAG_DISABLE, nullptr);
|
||||
}
|
||||
|
||||
// cycle through all devices for this system
|
||||
@ -141,7 +143,7 @@ void ui_menu_file_manager::populate()
|
||||
if (first_entry)
|
||||
first_entry = false;
|
||||
else
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(string_format("[root%s]", dev.tag()).c_str(), nullptr, 0, nullptr);
|
||||
tag_appended = true;
|
||||
}
|
||||
@ -152,7 +154,7 @@ void ui_menu_file_manager::populate()
|
||||
}
|
||||
}
|
||||
}
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append("Reset", nullptr, 0, (void *)1);
|
||||
|
||||
custombottom = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
@ -163,10 +165,10 @@ void ui_menu_file_manager::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_file_manager::handle()
|
||||
void menu_file_manager::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(0);
|
||||
const event *event = process(0);
|
||||
if (event != nullptr && event->itemref != nullptr && event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
if ((FPTR)event->itemref == 1)
|
||||
@ -183,30 +185,28 @@ void ui_menu_file_manager::handle()
|
||||
floppy_image_device *floppy_device = dynamic_cast<floppy_image_device *>(selected_device);
|
||||
if (floppy_device != nullptr)
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_control_floppy_image>(ui(), container, floppy_device));
|
||||
menu::stack_push<menu_control_floppy_image>(ui(), container, floppy_device);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_control_device_image>(ui(), container, selected_device));
|
||||
menu::stack_push<menu_control_device_image>(ui(), container, selected_device);
|
||||
}
|
||||
// reset the existing menu
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// force file manager menu
|
||||
void ui_menu_file_manager::force_file_manager(mame_ui_manager &mui, render_container *container, const char *warnings)
|
||||
void menu_file_manager::force_file_manager(mame_ui_manager &mui, render_container *container, const char *warnings)
|
||||
{
|
||||
// reset the menu stack
|
||||
ui_menu::stack_reset(mui.machine());
|
||||
menu::stack_reset(mui.machine());
|
||||
|
||||
// add the quit entry followed by the game select entry
|
||||
ui_menu *quit = global_alloc_clear<ui_menu_quit_game>(mui, container);
|
||||
quit->set_special_main_menu(true);
|
||||
ui_menu::stack_push(quit);
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_file_manager>(mui, container, warnings));
|
||||
menu::stack_push_special_main<menu_quit_game>(mui, container);
|
||||
menu::stack_push<menu_file_manager>(mui, container, warnings);
|
||||
|
||||
// force the menus on
|
||||
mui.show_menu();
|
||||
@ -214,3 +214,5 @@ void ui_menu_file_manager::force_file_manager(mame_ui_manager &mui, render_conta
|
||||
// make sure MAME is paused
|
||||
mui.machine().pause();
|
||||
}
|
||||
|
||||
} // namespace ui
|
@ -10,10 +10,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_FILEMNGR_H__
|
||||
#define __UI_FILEMNGR_H__
|
||||
#ifndef MAME_FRONTEND_UI_FILEMNGR_H
|
||||
#define MAME_FRONTEND_UI_FILEMNGR_H
|
||||
|
||||
class ui_menu_file_manager : public ui_menu {
|
||||
namespace ui {
|
||||
|
||||
class menu_file_manager : public menu
|
||||
{
|
||||
public:
|
||||
std::string current_directory;
|
||||
std::string current_file;
|
||||
@ -21,8 +24,8 @@ public:
|
||||
|
||||
static void force_file_manager(mame_ui_manager &mui, render_container *container, const char *warnings);
|
||||
|
||||
ui_menu_file_manager(mame_ui_manager &mui, render_container *container, const char *warnings);
|
||||
virtual ~ui_menu_file_manager();
|
||||
menu_file_manager(mame_ui_manager &mui, render_container *container, const char *warnings);
|
||||
virtual ~menu_file_manager();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -34,4 +37,6 @@ private:
|
||||
bool m_curr_selected;
|
||||
};
|
||||
|
||||
#endif /* __UI_FILEMNGR_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_FILEMNGR_H */
|
||||
|
@ -13,15 +13,19 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "zippath.h"
|
||||
|
||||
#include "ui/filesel.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include "imagedev/floppy.h"
|
||||
|
||||
#include "zippath.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
@ -74,8 +78,8 @@ static void input_character(char *buffer, size_t buffer_length, unicode_char uni
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_confirm_save_as::ui_menu_confirm_save_as(mame_ui_manager &mui, render_container *container, bool *yes)
|
||||
: ui_menu(mui, container)
|
||||
menu_confirm_save_as::menu_confirm_save_as(mame_ui_manager &mui, render_container *container, bool *yes)
|
||||
: menu(mui, container)
|
||||
{
|
||||
m_yes = yes;
|
||||
*m_yes = false;
|
||||
@ -86,7 +90,7 @@ ui_menu_confirm_save_as::ui_menu_confirm_save_as(mame_ui_manager &mui, render_co
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_confirm_save_as::~ui_menu_confirm_save_as()
|
||||
menu_confirm_save_as::~menu_confirm_save_as()
|
||||
{
|
||||
}
|
||||
|
||||
@ -95,10 +99,10 @@ ui_menu_confirm_save_as::~ui_menu_confirm_save_as()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_confirm_save_as::populate()
|
||||
void menu_confirm_save_as::populate()
|
||||
{
|
||||
item_append(_("File Already Exists - Override?"), nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(MENU_SEPARATOR_ITEM, nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(_("File Already Exists - Override?"), nullptr, FLAG_DISABLE, nullptr);
|
||||
item_append(MENU_SEPARATOR_ITEM, nullptr, FLAG_DISABLE, nullptr);
|
||||
item_append(_("No"), nullptr, 0, ITEMREF_NO);
|
||||
item_append(_("Yes"), nullptr, 0, ITEMREF_YES);
|
||||
}
|
||||
@ -107,10 +111,10 @@ void ui_menu_confirm_save_as::populate()
|
||||
// handle - confirm save as menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_confirm_save_as::handle()
|
||||
void menu_confirm_save_as::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(0);
|
||||
const event *event = process(0);
|
||||
|
||||
// process the event
|
||||
if ((event != nullptr) && (event->iptkey == IPT_UI_SELECT))
|
||||
@ -119,7 +123,7 @@ void ui_menu_confirm_save_as::handle()
|
||||
*m_yes = true;
|
||||
|
||||
// no matter what, pop out
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,11 +160,11 @@ static int is_valid_filename_char(unicode_char unichar)
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_file_create::ui_menu_file_create(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string ¤t_directory, std::string ¤t_file, bool *ok)
|
||||
: ui_menu(mui, container),
|
||||
m_current_directory(current_directory),
|
||||
m_current_file(current_file),
|
||||
m_current_format(nullptr)
|
||||
menu_file_create::menu_file_create(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string ¤t_directory, std::string ¤t_file, bool *ok)
|
||||
: menu(mui, container)
|
||||
, m_current_directory(current_directory)
|
||||
, m_current_file(current_file)
|
||||
, m_current_format(nullptr)
|
||||
{
|
||||
m_image = image;
|
||||
m_ok = ok;
|
||||
@ -174,7 +178,7 @@ ui_menu_file_create::ui_menu_file_create(mame_ui_manager &mui, render_container
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_file_create::~ui_menu_file_create()
|
||||
menu_file_create::~menu_file_create()
|
||||
{
|
||||
}
|
||||
|
||||
@ -183,7 +187,7 @@ ui_menu_file_create::~ui_menu_file_create()
|
||||
// custom_render - perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_file_create::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_file_create::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
extra_text_render(top, bottom, origx1, origy1, origx2, origy2,
|
||||
m_current_directory.c_str(),
|
||||
@ -195,7 +199,7 @@ void ui_menu_file_create::custom_render(void *selectedref, float top, float bott
|
||||
// populate - populates the file creator menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_file_create::populate()
|
||||
void menu_file_create::populate()
|
||||
{
|
||||
std::string buffer;
|
||||
const image_device_format *format;
|
||||
@ -222,7 +226,7 @@ void ui_menu_file_create::populate()
|
||||
}
|
||||
|
||||
// finish up the menu
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("Create"), nullptr, 0, ITEMREF_CREATE);
|
||||
|
||||
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
@ -233,10 +237,10 @@ void ui_menu_file_create::populate()
|
||||
// handle - file creator menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_file_create::handle()
|
||||
void menu_file_create::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(0);
|
||||
const event *event = process(0);
|
||||
|
||||
// process the event
|
||||
if (event != nullptr)
|
||||
@ -251,7 +255,7 @@ void ui_menu_file_create::handle()
|
||||
if (tmp_file.find(".") != -1 && tmp_file.find(".") < tmp_file.length() - 1)
|
||||
{
|
||||
m_current_file = m_filename_buffer;
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
else
|
||||
ui().popup_time(1, "%s", _("Please enter a file extension too"));
|
||||
@ -266,7 +270,7 @@ void ui_menu_file_create::handle()
|
||||
ARRAY_LENGTH(m_filename_buffer),
|
||||
event->unichar,
|
||||
is_valid_filename_char);
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
break;
|
||||
case IPT_UI_CANCEL:
|
||||
@ -284,11 +288,11 @@ void ui_menu_file_create::handle()
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_file_selector::ui_menu_file_selector(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string ¤t_directory, std::string ¤t_file, bool has_empty, bool has_softlist, bool has_create, int *result)
|
||||
: ui_menu(mui, container),
|
||||
m_current_directory(current_directory),
|
||||
m_current_file(current_file),
|
||||
m_entrylist(nullptr)
|
||||
menu_file_selector::menu_file_selector(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string ¤t_directory, std::string ¤t_file, bool has_empty, bool has_softlist, bool has_create, int *result)
|
||||
: menu(mui, container)
|
||||
, m_current_directory(current_directory)
|
||||
, m_current_file(current_file)
|
||||
, m_entrylist(nullptr)
|
||||
{
|
||||
m_image = image;
|
||||
m_has_empty = has_empty;
|
||||
@ -302,7 +306,7 @@ ui_menu_file_selector::ui_menu_file_selector(mame_ui_manager &mui, render_contai
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_file_selector::~ui_menu_file_selector()
|
||||
menu_file_selector::~menu_file_selector()
|
||||
{
|
||||
}
|
||||
|
||||
@ -311,7 +315,7 @@ ui_menu_file_selector::~ui_menu_file_selector()
|
||||
// custom_render - perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_file_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_file_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
extra_text_render(top, bottom,
|
||||
origx1, origy1, origx2, origy2,
|
||||
@ -326,7 +330,7 @@ void ui_menu_file_selector::custom_render(void *selectedref, float top, float bo
|
||||
// for file selector entries
|
||||
//-------------------------------------------------
|
||||
|
||||
int ui_menu_file_selector::compare_entries(const file_selector_entry *e1, const file_selector_entry *e2)
|
||||
int menu_file_selector::compare_entries(const file_selector_entry *e1, const file_selector_entry *e2)
|
||||
{
|
||||
int result;
|
||||
const char *e1_basename = (e1->basename != nullptr) ? e1->basename : "";
|
||||
@ -365,7 +369,7 @@ int ui_menu_file_selector::compare_entries(const file_selector_entry *e1, const
|
||||
// file selector entry to an entry list
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_file_selector::file_selector_entry *ui_menu_file_selector::append_entry(
|
||||
menu_file_selector::file_selector_entry *menu_file_selector::append_entry(
|
||||
file_selector_entry_type entry_type, const char *entry_basename, const char *entry_fullpath)
|
||||
{
|
||||
file_selector_entry *entry;
|
||||
@ -395,7 +399,7 @@ ui_menu_file_selector::file_selector_entry *ui_menu_file_selector::append_entry(
|
||||
// a menu item for a file selector entry
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_file_selector::file_selector_entry *ui_menu_file_selector::append_dirent_entry(const osd_directory_entry *dirent)
|
||||
menu_file_selector::file_selector_entry *menu_file_selector::append_dirent_entry(const osd_directory_entry *dirent)
|
||||
{
|
||||
std::string buffer;
|
||||
file_selector_entry_type entry_type;
|
||||
@ -434,7 +438,7 @@ ui_menu_file_selector::file_selector_entry *ui_menu_file_selector::append_dirent
|
||||
// a menu item for a file selector entry
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_file_selector::append_entry_menu_item(const file_selector_entry *entry)
|
||||
void menu_file_selector::append_entry_menu_item(const file_selector_entry *entry)
|
||||
{
|
||||
const char *text = nullptr;
|
||||
const char *subtext = nullptr;
|
||||
@ -476,7 +480,7 @@ void ui_menu_file_selector::append_entry_menu_item(const file_selector_entry *en
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_file_selector::populate()
|
||||
void menu_file_selector::populate()
|
||||
{
|
||||
util::zippath_directory *directory = nullptr;
|
||||
osd_file::error err;
|
||||
@ -562,7 +566,7 @@ void ui_menu_file_selector::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_file_selector::handle()
|
||||
void menu_file_selector::handle()
|
||||
{
|
||||
osd_file::error err;
|
||||
const file_selector_entry *entry;
|
||||
@ -570,7 +574,7 @@ void ui_menu_file_selector::handle()
|
||||
int bestmatch = 0;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(0);
|
||||
const event *event = process(0);
|
||||
if (event != nullptr && event->itemref != nullptr)
|
||||
{
|
||||
// handle selections
|
||||
@ -582,18 +586,18 @@ void ui_menu_file_selector::handle()
|
||||
case SELECTOR_ENTRY_TYPE_EMPTY:
|
||||
// empty slot - unload
|
||||
*m_result = R_EMPTY;
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
|
||||
case SELECTOR_ENTRY_TYPE_CREATE:
|
||||
// create
|
||||
*m_result = R_CREATE;
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
|
||||
case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST:
|
||||
*m_result = R_SOFTLIST;
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
|
||||
case SELECTOR_ENTRY_TYPE_DRIVE:
|
||||
@ -607,14 +611,14 @@ void ui_menu_file_selector::handle()
|
||||
break;
|
||||
}
|
||||
m_current_directory.assign(entry->fullpath);
|
||||
reset((ui_menu_reset_options)0);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
break;
|
||||
|
||||
case SELECTOR_ENTRY_TYPE_FILE:
|
||||
// file
|
||||
m_current_file.assign(entry->fullpath);
|
||||
*m_result = R_FILE;
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -717,8 +721,8 @@ void ui_menu_file_selector::handle()
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_select_format::ui_menu_select_format(mame_ui_manager &mui, render_container *container, floppy_image_format_t **formats, int ext_match, int total_usable, int *result)
|
||||
: ui_menu(mui, container)
|
||||
menu_select_format::menu_select_format(mame_ui_manager &mui, render_container *container, floppy_image_format_t **formats, int ext_match, int total_usable, int *result)
|
||||
: menu(mui, container)
|
||||
{
|
||||
m_formats = formats;
|
||||
m_ext_match = ext_match;
|
||||
@ -731,7 +735,7 @@ ui_menu_select_format::ui_menu_select_format(mame_ui_manager &mui, render_contai
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_select_format::~ui_menu_select_format()
|
||||
menu_select_format::~menu_select_format()
|
||||
{
|
||||
}
|
||||
|
||||
@ -740,15 +744,15 @@ ui_menu_select_format::~ui_menu_select_format()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_format::populate()
|
||||
void menu_select_format::populate()
|
||||
{
|
||||
item_append(_("Select image format"), nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(_("Select image format"), nullptr, FLAG_DISABLE, nullptr);
|
||||
for (int i = 0; i < m_total_usable; i++)
|
||||
{
|
||||
const floppy_image_format_t *fmt = m_formats[i];
|
||||
|
||||
if (i && i == m_ext_match)
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(fmt->description(), fmt->name(), 0, (void *)(FPTR)i);
|
||||
}
|
||||
}
|
||||
@ -758,14 +762,14 @@ void ui_menu_select_format::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_format::handle()
|
||||
void menu_select_format::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(0);
|
||||
const event *event = process(0);
|
||||
if (event != nullptr && event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
*m_result = int(FPTR(event->itemref));
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
}
|
||||
|
||||
@ -778,9 +782,9 @@ void ui_menu_select_format::handle()
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_select_rw::ui_menu_select_rw(mame_ui_manager &mui, render_container *container,
|
||||
menu_select_rw::menu_select_rw(mame_ui_manager &mui, render_container *container,
|
||||
bool can_in_place, int *result)
|
||||
: ui_menu(mui, container)
|
||||
: menu(mui, container)
|
||||
{
|
||||
m_can_in_place = can_in_place;
|
||||
m_result = result;
|
||||
@ -791,7 +795,7 @@ ui_menu_select_rw::ui_menu_select_rw(mame_ui_manager &mui, render_container *con
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_select_rw::~ui_menu_select_rw()
|
||||
menu_select_rw::~menu_select_rw()
|
||||
{
|
||||
}
|
||||
|
||||
@ -800,9 +804,9 @@ ui_menu_select_rw::~ui_menu_select_rw()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_rw::populate()
|
||||
void menu_select_rw::populate()
|
||||
{
|
||||
item_append(_("Select access mode"), nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(_("Select access mode"), nullptr, FLAG_DISABLE, nullptr);
|
||||
item_append(_("Read-only"), nullptr, 0, (void *)READONLY);
|
||||
if (m_can_in_place)
|
||||
item_append(_("Read-write"), nullptr, 0, (void *)READWRITE);
|
||||
@ -815,13 +819,15 @@ void ui_menu_select_rw::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_rw::handle()
|
||||
void menu_select_rw::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(0);
|
||||
const event *event = process(0);
|
||||
if (event != nullptr && event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
*m_result = int(FPTR(event->itemref));
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,16 +10,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_FILESEL_H__
|
||||
#define __UI_FILESEL_H__
|
||||
#ifndef MAME_FRONTEND_UI_FILESEL_H
|
||||
#define MAME_FRONTEND_UI_FILESEL_H
|
||||
|
||||
// ======================> ui_menu_confirm_save_as
|
||||
#include "ui/menu.h"
|
||||
|
||||
class ui_menu_confirm_save_as : public ui_menu
|
||||
class floppy_image_format_t;
|
||||
|
||||
namespace ui {
|
||||
|
||||
// ======================> menu_confirm_save_as
|
||||
|
||||
class menu_confirm_save_as : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_confirm_save_as(mame_ui_manager &mui, render_container *container, bool *yes);
|
||||
virtual ~ui_menu_confirm_save_as();
|
||||
menu_confirm_save_as(mame_ui_manager &mui, render_container *container, bool *yes);
|
||||
virtual ~menu_confirm_save_as() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -28,13 +34,13 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// ======================> ui_menu_file_create
|
||||
// ======================> menu_file_create
|
||||
|
||||
class ui_menu_file_create : public ui_menu
|
||||
class menu_file_create : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_file_create(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string ¤t_directory, std::string ¤t_file, bool *ok);
|
||||
virtual ~ui_menu_file_create();
|
||||
menu_file_create(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string ¤t_directory, std::string ¤t_file, bool *ok);
|
||||
virtual ~menu_file_create() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -51,14 +57,14 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
// ======================> ui_menu_file_selector
|
||||
// ======================> menu_file_selector
|
||||
|
||||
class ui_menu_file_selector : public ui_menu
|
||||
class menu_file_selector : public menu
|
||||
{
|
||||
public:
|
||||
enum { R_EMPTY, R_SOFTLIST, R_CREATE, R_FILE };
|
||||
ui_menu_file_selector(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string ¤t_directory, std::string ¤t_file, bool has_empty, bool has_softlist, bool has_create, int *result);
|
||||
virtual ~ui_menu_file_selector();
|
||||
menu_file_selector(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string ¤t_directory, std::string ¤t_file, bool has_empty, bool has_softlist, bool has_create, int *result);
|
||||
virtual ~menu_file_selector() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -102,14 +108,14 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// ======================> ui_menu_select_format
|
||||
// ======================> menu_select_format
|
||||
|
||||
class ui_menu_select_format : public ui_menu
|
||||
class menu_select_format : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_select_format(mame_ui_manager &mui, render_container *container,
|
||||
class floppy_image_format_t **formats, int ext_match, int total_usable, int *result);
|
||||
virtual ~ui_menu_select_format();
|
||||
menu_select_format(mame_ui_manager &mui, render_container *container,
|
||||
floppy_image_format_t **formats, int ext_match, int total_usable, int *result);
|
||||
virtual ~menu_select_format() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -122,15 +128,15 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// ======================> ui_menu_select_rw
|
||||
// ======================> menu_select_rw
|
||||
|
||||
class ui_menu_select_rw : public ui_menu
|
||||
class menu_select_rw : public menu
|
||||
{
|
||||
public:
|
||||
enum { READONLY, READWRITE, WRITE_OTHER, WRITE_DIFF };
|
||||
ui_menu_select_rw(mame_ui_manager &mui, render_container *container,
|
||||
menu_select_rw(mame_ui_manager &mui, render_container *container,
|
||||
bool can_in_place, int *result);
|
||||
virtual ~ui_menu_select_rw();
|
||||
virtual ~menu_select_rw() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -140,4 +146,6 @@ private:
|
||||
int * m_result;
|
||||
};
|
||||
|
||||
#endif /* __UI_FILESEL_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_FILESEL_H */
|
||||
|
@ -7,17 +7,20 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "zippath.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/imgcntrl.h"
|
||||
|
||||
#include "ui/filesel.h"
|
||||
#include "ui/floppycntrl.h"
|
||||
|
||||
#include "zippath.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
/***************************************************************************
|
||||
IMPLEMENTATION
|
||||
***************************************************************************/
|
||||
|
||||
ui_menu_control_floppy_image::ui_menu_control_floppy_image(mame_ui_manager &mui, render_container *container, device_image_interface *_image) : ui_menu_control_device_image(mui, container, _image)
|
||||
menu_control_floppy_image::menu_control_floppy_image(mame_ui_manager &mui, render_container *container, device_image_interface *_image) : menu_control_device_image(mui, container, _image)
|
||||
{
|
||||
floppy_image_device *fd = static_cast<floppy_image_device *>(image);
|
||||
const floppy_image_format_t *fif_list = fd->get_formats();
|
||||
@ -30,12 +33,12 @@ ui_menu_control_floppy_image::ui_menu_control_floppy_image(mame_ui_manager &mui,
|
||||
input_filename = output_filename = "";
|
||||
}
|
||||
|
||||
ui_menu_control_floppy_image::~ui_menu_control_floppy_image()
|
||||
menu_control_floppy_image::~menu_control_floppy_image()
|
||||
{
|
||||
global_free_array(format_array);
|
||||
}
|
||||
|
||||
void ui_menu_control_floppy_image::do_load_create()
|
||||
void menu_control_floppy_image::do_load_create()
|
||||
{
|
||||
floppy_image_device *fd = static_cast<floppy_image_device *>(image);
|
||||
if(input_filename.compare("")==0) {
|
||||
@ -58,13 +61,13 @@ void ui_menu_control_floppy_image::do_load_create()
|
||||
}
|
||||
}
|
||||
|
||||
void ui_menu_control_floppy_image::hook_load(std::string filename, bool softlist)
|
||||
void menu_control_floppy_image::hook_load(std::string filename, bool softlist)
|
||||
{
|
||||
if (softlist)
|
||||
{
|
||||
machine().popmessage("When loaded from software list, the disk is Read-only.\n");
|
||||
image->load(filename.c_str());
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -74,7 +77,7 @@ void ui_menu_control_floppy_image::hook_load(std::string filename, bool softlist
|
||||
if (!input_format)
|
||||
{
|
||||
machine().popmessage("Error: %s\n", image->error());
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -91,11 +94,11 @@ void ui_menu_control_floppy_image::hook_load(std::string filename, bool softlist
|
||||
can_in_place = false;
|
||||
}
|
||||
submenu_result = -1;
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_select_rw>(ui(), container, can_in_place, &submenu_result));
|
||||
menu::stack_push<menu_select_rw>(ui(), container, can_in_place, &submenu_result);
|
||||
state = SELECT_RW;
|
||||
}
|
||||
|
||||
void ui_menu_control_floppy_image::handle()
|
||||
void menu_control_floppy_image::handle()
|
||||
{
|
||||
floppy_image_device *fd = static_cast<floppy_image_device *>(image);
|
||||
switch (state) {
|
||||
@ -117,7 +120,7 @@ void ui_menu_control_floppy_image::handle()
|
||||
format_array[total_usable++] = i;
|
||||
}
|
||||
submenu_result = -1;
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_select_format>(ui(), container, format_array, ext_match, total_usable, &submenu_result));
|
||||
menu::stack_push<menu_select_format>(ui(), container, format_array, ext_match, total_usable, &submenu_result);
|
||||
|
||||
state = SELECT_FORMAT;
|
||||
break;
|
||||
@ -131,30 +134,30 @@ void ui_menu_control_floppy_image::handle()
|
||||
util::zippath_combine(output_filename, current_directory.c_str(), current_file.c_str());
|
||||
output_format = format_array[submenu_result];
|
||||
do_load_create();
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
break;
|
||||
|
||||
case SELECT_RW:
|
||||
switch(submenu_result) {
|
||||
case ui_menu_select_rw::READONLY:
|
||||
case menu_select_rw::READONLY:
|
||||
do_load_create();
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
|
||||
case ui_menu_select_rw::READWRITE:
|
||||
case menu_select_rw::READWRITE:
|
||||
output_format = input_format;
|
||||
do_load_create();
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
|
||||
case ui_menu_select_rw::WRITE_DIFF:
|
||||
case menu_select_rw::WRITE_DIFF:
|
||||
machine().popmessage("Sorry, diffs are not supported yet\n");
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
|
||||
case ui_menu_select_rw::WRITE_OTHER:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_file_create>(ui(), container, image, current_directory, current_file, &create_ok));
|
||||
case menu_select_rw::WRITE_OTHER:
|
||||
menu::stack_push<menu_file_create>(ui(), container, image, current_directory, current_file, &create_ok);
|
||||
state = CHECK_CREATE;
|
||||
break;
|
||||
|
||||
@ -165,6 +168,8 @@ void ui_menu_control_floppy_image::handle()
|
||||
break;
|
||||
|
||||
default:
|
||||
ui_menu_control_device_image::handle();
|
||||
menu_control_device_image::handle();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -8,16 +8,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_FLOPPY_IMAGE_H__
|
||||
#define __UI_FLOPPY_IMAGE_H__
|
||||
#ifndef MAME_FRONTEND_UI_FLOPPYCNTRL_H
|
||||
#define MAME_FRONTEND_UI_FLOPPYCNTRL_H
|
||||
|
||||
#include "ui/imgcntrl.h"
|
||||
|
||||
#include "imagedev/floppy.h"
|
||||
#include "formats/flopimg.h"
|
||||
|
||||
class ui_menu_control_floppy_image : public ui_menu_control_device_image {
|
||||
namespace ui {
|
||||
|
||||
class menu_control_floppy_image : public menu_control_device_image
|
||||
{
|
||||
public:
|
||||
ui_menu_control_floppy_image(mame_ui_manager &ui, render_container *container, device_image_interface *image);
|
||||
virtual ~ui_menu_control_floppy_image();
|
||||
menu_control_floppy_image(mame_ui_manager &ui, render_container *container, device_image_interface *image);
|
||||
virtual ~menu_control_floppy_image() override;
|
||||
|
||||
virtual void handle() override;
|
||||
|
||||
@ -32,5 +37,6 @@ protected:
|
||||
virtual void hook_load(std::string filename, bool softlist) override;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif /* __UI_FLOPPY_IMAGE_H__ */
|
||||
#endif /* MAME_FRONTEND_UI_FLOPPYCNTRL_H */
|
||||
|
@ -9,17 +9,21 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "emuopts.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
|
||||
#include "ui/imgcntrl.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/filesel.h"
|
||||
#include "ui/swlist.h"
|
||||
#include "zippath.h"
|
||||
#include "drivenum.h"
|
||||
#include "audit.h"
|
||||
#include "softlist.h"
|
||||
|
||||
#include "audit.h"
|
||||
#include "drivenum.h"
|
||||
#include "emuopts.h"
|
||||
#include "softlist.h"
|
||||
#include "zippath.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
/***************************************************************************
|
||||
IMPLEMENTATION
|
||||
@ -29,8 +33,8 @@
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_control_device_image::ui_menu_control_device_image(mame_ui_manager &mui, render_container *container, device_image_interface *_image)
|
||||
: ui_menu(mui, container),
|
||||
menu_control_device_image::menu_control_device_image(mame_ui_manager &mui, render_container *container, device_image_interface *_image)
|
||||
: menu(mui, container),
|
||||
submenu_result(0),
|
||||
create_ok(false),
|
||||
create_confirmed(false)
|
||||
@ -72,7 +76,7 @@ ui_menu_control_device_image::ui_menu_control_device_image(mame_ui_manager &mui,
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_control_device_image::~ui_menu_control_device_image()
|
||||
menu_control_device_image::~menu_control_device_image()
|
||||
{
|
||||
}
|
||||
|
||||
@ -81,7 +85,7 @@ ui_menu_control_device_image::~ui_menu_control_device_image()
|
||||
// test_create - creates a new disk image
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_control_device_image::test_create(bool &can_create, bool &need_confirm)
|
||||
void menu_control_device_image::test_create(bool &can_create, bool &need_confirm)
|
||||
{
|
||||
std::string path;
|
||||
osd_directory_entry *entry;
|
||||
@ -130,7 +134,7 @@ void ui_menu_control_device_image::test_create(bool &can_create, bool &need_conf
|
||||
// load_software_part
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_control_device_image::load_software_part()
|
||||
void menu_control_device_image::load_software_part()
|
||||
{
|
||||
std::string temp_name = std::string(sld->list_name()).append(":").append(swi->shortname()).append(":").append(swp->name());
|
||||
|
||||
@ -153,11 +157,11 @@ void ui_menu_control_device_image::load_software_part()
|
||||
// hook_load
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_control_device_image::hook_load(std::string name, bool softlist)
|
||||
void menu_control_device_image::hook_load(std::string name, bool softlist)
|
||||
{
|
||||
if (image->is_reset_on_load()) image->set_init_phase();
|
||||
image->load(name.c_str());
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
|
||||
|
||||
@ -165,7 +169,7 @@ void ui_menu_control_device_image::hook_load(std::string name, bool softlist)
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_control_device_image::populate()
|
||||
void menu_control_device_image::populate()
|
||||
{
|
||||
}
|
||||
|
||||
@ -174,7 +178,7 @@ void ui_menu_control_device_image::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_control_device_image::handle()
|
||||
void menu_control_device_image::handle()
|
||||
{
|
||||
switch(state) {
|
||||
case START_FILE: {
|
||||
@ -187,31 +191,31 @@ void ui_menu_control_device_image::handle()
|
||||
util::zippath_closedir(directory);
|
||||
}
|
||||
submenu_result = -1;
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_file_selector>(ui(), container, image, current_directory, current_file, true, image->image_interface()!=nullptr, can_create, &submenu_result));
|
||||
menu::stack_push<menu_file_selector>(ui(), container, image, current_directory, current_file, true, image->image_interface()!=nullptr, can_create, &submenu_result);
|
||||
state = SELECT_FILE;
|
||||
break;
|
||||
}
|
||||
|
||||
case START_SOFTLIST:
|
||||
sld = nullptr;
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_software>(ui(), container, image->image_interface(), &sld));
|
||||
menu::stack_push<menu_software>(ui(), container, image->image_interface(), &sld);
|
||||
state = SELECT_SOFTLIST;
|
||||
break;
|
||||
|
||||
case START_OTHER_PART: {
|
||||
submenu_result = -1;
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_software_parts>(ui(), container, swi, swp->interface(), &swp, true, &submenu_result));
|
||||
menu::stack_push<menu_software_parts>(ui(), container, swi, swp->interface(), &swp, true, &submenu_result);
|
||||
state = SELECT_OTHER_PART;
|
||||
break;
|
||||
}
|
||||
|
||||
case SELECT_SOFTLIST:
|
||||
if(!sld) {
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
}
|
||||
software_info_name = "";
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_software_list>(ui(), container, sld, image->image_interface(), software_info_name));
|
||||
menu::stack_push<menu_software_list>(ui(), container, sld, image->image_interface(), software_info_name);
|
||||
state = SELECT_PARTLIST;
|
||||
break;
|
||||
|
||||
@ -223,7 +227,7 @@ void ui_menu_control_device_image::handle()
|
||||
{
|
||||
submenu_result = -1;
|
||||
swp = nullptr;
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_software_parts>(ui(), container, swi, image->image_interface(), &swp, false, &submenu_result));
|
||||
menu::stack_push<menu_software_parts>(ui(), container, swi, image->image_interface(), &swp, false, &submenu_result);
|
||||
state = SELECT_ONE_PART;
|
||||
}
|
||||
else
|
||||
@ -235,7 +239,7 @@ void ui_menu_control_device_image::handle()
|
||||
|
||||
case SELECT_ONE_PART:
|
||||
switch(submenu_result) {
|
||||
case ui_menu_software_parts::T_ENTRY: {
|
||||
case menu_software_parts::T_ENTRY: {
|
||||
load_software_part();
|
||||
break;
|
||||
}
|
||||
@ -249,27 +253,27 @@ void ui_menu_control_device_image::handle()
|
||||
|
||||
case SELECT_OTHER_PART:
|
||||
switch(submenu_result) {
|
||||
case ui_menu_software_parts::T_ENTRY:
|
||||
case menu_software_parts::T_ENTRY:
|
||||
load_software_part();
|
||||
break;
|
||||
|
||||
case ui_menu_software_parts::T_FMGR:
|
||||
case menu_software_parts::T_FMGR:
|
||||
state = START_FILE;
|
||||
handle();
|
||||
break;
|
||||
|
||||
case ui_menu_software_parts::T_EMPTY:
|
||||
case menu_software_parts::T_EMPTY:
|
||||
image->unload();
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
|
||||
case ui_menu_software_parts::T_SWLIST:
|
||||
case menu_software_parts::T_SWLIST:
|
||||
state = START_SOFTLIST;
|
||||
handle();
|
||||
break;
|
||||
|
||||
case -1: // return to system
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
|
||||
}
|
||||
@ -277,27 +281,27 @@ void ui_menu_control_device_image::handle()
|
||||
|
||||
case SELECT_FILE:
|
||||
switch(submenu_result) {
|
||||
case ui_menu_file_selector::R_EMPTY:
|
||||
case menu_file_selector::R_EMPTY:
|
||||
image->unload();
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
|
||||
case ui_menu_file_selector::R_FILE:
|
||||
case menu_file_selector::R_FILE:
|
||||
hook_load(current_file, false);
|
||||
break;
|
||||
|
||||
case ui_menu_file_selector::R_CREATE:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_file_create>(ui(), container, image, current_directory, current_file, &create_ok));
|
||||
case menu_file_selector::R_CREATE:
|
||||
menu::stack_push<menu_file_create>(ui(), container, image, current_directory, current_file, &create_ok);
|
||||
state = CHECK_CREATE;
|
||||
break;
|
||||
|
||||
case ui_menu_file_selector::R_SOFTLIST:
|
||||
case menu_file_selector::R_SOFTLIST:
|
||||
state = START_SOFTLIST;
|
||||
handle();
|
||||
break;
|
||||
|
||||
case -1: // return to system
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -307,7 +311,7 @@ void ui_menu_control_device_image::handle()
|
||||
test_create(can_create, need_confirm);
|
||||
if(can_create) {
|
||||
if(need_confirm) {
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_confirm_save_as>(ui(), container, &create_confirmed));
|
||||
menu::stack_push<menu_confirm_save_as>(ui(), container, &create_confirmed);
|
||||
state = CREATE_CONFIRM;
|
||||
} else {
|
||||
state = DO_CREATE;
|
||||
@ -336,8 +340,10 @@ void ui_menu_control_device_image::handle()
|
||||
int err = image->create(path.c_str(), nullptr, nullptr);
|
||||
if (err != 0)
|
||||
machine().popmessage("Error: %s", image->error());
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,15 +10,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_IMGCNTRL_H__
|
||||
#define __UI_IMGCNTRL_H__
|
||||
#ifndef MAME_FRONTEND_UI_IMAGECNTRL_H
|
||||
#define MAME_FRONTEND_UI_IMAGECNTRL_H
|
||||
|
||||
// ======================> ui_menu_control_device_image
|
||||
#include "ui/menu.h"
|
||||
|
||||
class ui_menu_control_device_image : public ui_menu {
|
||||
namespace ui {
|
||||
|
||||
// ======================> menu_control_device_image
|
||||
|
||||
class menu_control_device_image : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_control_device_image(mame_ui_manager &mui, render_container *container, device_image_interface *image);
|
||||
virtual ~ui_menu_control_device_image();
|
||||
menu_control_device_image(mame_ui_manager &mui, render_container *container, device_image_interface *image);
|
||||
virtual ~menu_control_device_image() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -56,5 +61,6 @@ private:
|
||||
void load_software_part();
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif /* __UI_IMGCNTRL_H__ */
|
||||
#endif /* MAME_FRONTEND_UI_IMAGECNTRL_H */
|
||||
|
@ -9,31 +9,34 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui/menu.h"
|
||||
|
||||
#include "ui/info.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include "softlist.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
/*-------------------------------------------------
|
||||
menu_game_info - handle the game information
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_game_info::ui_menu_game_info(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_game_info::menu_game_info(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_game_info::~ui_menu_game_info()
|
||||
menu_game_info::~menu_game_info()
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_game_info::populate()
|
||||
void menu_game_info::populate()
|
||||
{
|
||||
std::string tempstring;
|
||||
item_append(ui().game_info_astring(tempstring).c_str(), nullptr, MENU_FLAG_MULTILINE, nullptr);
|
||||
item_append(ui().game_info_astring(tempstring).c_str(), nullptr, FLAG_MULTILINE, nullptr);
|
||||
}
|
||||
|
||||
void ui_menu_game_info::handle()
|
||||
void menu_game_info::handle()
|
||||
{
|
||||
// process the menu
|
||||
process(0);
|
||||
@ -41,28 +44,28 @@ void ui_menu_game_info::handle()
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_menu_image_info - handle the image information
|
||||
menu_image_info - handle the image information
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_image_info::ui_menu_image_info(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_image_info::menu_image_info(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_image_info::~ui_menu_image_info()
|
||||
menu_image_info::~menu_image_info()
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_image_info::populate()
|
||||
void menu_image_info::populate()
|
||||
{
|
||||
item_append(machine().system().description, nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append("", nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(machine().system().description, nullptr, FLAG_DISABLE, nullptr);
|
||||
item_append("", nullptr, FLAG_DISABLE, nullptr);
|
||||
|
||||
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
|
||||
image_info(&image);
|
||||
}
|
||||
|
||||
void ui_menu_image_info::handle()
|
||||
void menu_image_info::handle()
|
||||
{
|
||||
// process the menu
|
||||
process(0);
|
||||
@ -74,7 +77,7 @@ void ui_menu_image_info::handle()
|
||||
image interface device
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_image_info::image_info(device_image_interface *image)
|
||||
void menu_image_info::image_info(device_image_interface *image)
|
||||
{
|
||||
if (image->exists())
|
||||
{
|
||||
@ -85,19 +88,19 @@ void ui_menu_image_info::image_info(device_image_interface *image)
|
||||
if (image->software_entry())
|
||||
{
|
||||
// display long filename
|
||||
item_append(image->longname(), "", MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(image->longname(), "", FLAG_DISABLE, nullptr);
|
||||
|
||||
// display manufacturer and year
|
||||
item_append(string_format("%s, %s", image->manufacturer(), image->year()).c_str(), "", MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(string_format("%s, %s", image->manufacturer(), image->year()).c_str(), "", FLAG_DISABLE, nullptr);
|
||||
|
||||
// display supported information, if available
|
||||
switch (image->supported())
|
||||
{
|
||||
case SOFTWARE_SUPPORTED_NO:
|
||||
item_append(_("Not supported"), "", MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(_("Not supported"), "", FLAG_DISABLE, nullptr);
|
||||
break;
|
||||
case SOFTWARE_SUPPORTED_PARTIAL:
|
||||
item_append(_("Partially supported"), "", MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(_("Partially supported"), "", FLAG_DISABLE, nullptr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -106,5 +109,7 @@ void ui_menu_image_info::image_info(device_image_interface *image)
|
||||
}
|
||||
else
|
||||
item_append(image->brief_instance_name(), _("[empty]"), 0, nullptr);
|
||||
item_append("", nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append("", nullptr, FLAG_DISABLE, nullptr);
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,23 +10,28 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_INFO_H__
|
||||
#define __UI_INFO_H__
|
||||
#ifndef MAME_FRONTEND_UI_INFO_H
|
||||
#define MAME_FRONTEND_UI_INFO_H
|
||||
|
||||
class ui_menu_game_info : public ui_menu {
|
||||
#include "ui/menu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
class menu_game_info : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_game_info(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_game_info();
|
||||
menu_game_info(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_game_info() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
};
|
||||
|
||||
|
||||
class ui_menu_image_info : public ui_menu
|
||||
class menu_image_info : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_image_info(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_image_info();
|
||||
menu_image_info(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_image_info() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -34,4 +39,6 @@ private:
|
||||
void image_info(device_image_interface *image);
|
||||
};
|
||||
|
||||
#endif // __UI_INFO_H__
|
||||
} // namespace ui
|
||||
|
||||
#endif // MAME_FRONTEND_UI_INFO_H
|
||||
|
@ -9,35 +9,40 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui/menu.h"
|
||||
|
||||
#include "ui/info_pty.h"
|
||||
|
||||
ui_menu_pty_info::ui_menu_pty_info(mame_ui_manager &mui, render_container *container) :
|
||||
ui_menu(mui, container)
|
||||
|
||||
namespace ui {
|
||||
|
||||
menu_pty_info::menu_pty_info(mame_ui_manager &mui, render_container *container) :
|
||||
menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_pty_info::~ui_menu_pty_info()
|
||||
menu_pty_info::~menu_pty_info()
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_pty_info::populate()
|
||||
void menu_pty_info::populate()
|
||||
{
|
||||
item_append(_("Pseudo terminals"), nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append("", nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(_("Pseudo terminals"), nullptr, FLAG_DISABLE, nullptr);
|
||||
item_append("", nullptr, FLAG_DISABLE, nullptr);
|
||||
|
||||
for (device_pty_interface &pty : pty_interface_iterator(machine().root_device()))
|
||||
{
|
||||
const char *port_name = pty.device().owner()->tag() + 1;
|
||||
if (pty.is_open())
|
||||
item_append(port_name, pty.slave_name(), MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(port_name, pty.slave_name(), FLAG_DISABLE, nullptr);
|
||||
else
|
||||
item_append(port_name, _("[failed]"), MENU_FLAG_DISABLE, nullptr);
|
||||
item_append("", nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(port_name, _("[failed]"), FLAG_DISABLE, nullptr);
|
||||
item_append("", nullptr, FLAG_DISABLE, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void ui_menu_pty_info::handle()
|
||||
void menu_pty_info::handle()
|
||||
{
|
||||
process(0);
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,15 +10,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_INFO_PTY_H__
|
||||
#define __UI_INFO_PTY_H__
|
||||
#ifndef MAME_FRONTEND_UI_INFO_PTY_H
|
||||
#define MAME_FRONTEND_UI_INFO_PTY_H
|
||||
|
||||
class ui_menu_pty_info : public ui_menu {
|
||||
#include "ui/menu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
class menu_pty_info : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_pty_info(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_pty_info();
|
||||
menu_pty_info(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_pty_info() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
};
|
||||
|
||||
#endif // __UI_INFO_PTY_H__
|
||||
} // namespace ui
|
||||
|
||||
#endif // MAME_FRONTEND_UI_INFO_PTY_H
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "ui/inputmap.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
@ -40,11 +42,11 @@
|
||||
input groups menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_input_groups::ui_menu_input_groups(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_input_groups::menu_input_groups(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_input_groups::populate()
|
||||
void menu_input_groups::populate()
|
||||
{
|
||||
int player;
|
||||
|
||||
@ -59,7 +61,7 @@ void ui_menu_input_groups::populate()
|
||||
item_append(_("Other Controls"), nullptr, 0, (void *)(FPTR)(IPG_OTHER + 1));
|
||||
}
|
||||
|
||||
ui_menu_input_groups::~ui_menu_input_groups()
|
||||
menu_input_groups::~menu_input_groups()
|
||||
{
|
||||
}
|
||||
|
||||
@ -68,12 +70,12 @@ ui_menu_input_groups::~ui_menu_input_groups()
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_input_groups::handle()
|
||||
void menu_input_groups::handle()
|
||||
{
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
if (menu_event != nullptr && menu_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_input_general>(ui(), container, int((long long)(menu_event->itemref)-1)));
|
||||
menu::stack_push<menu_input_general>(ui(), container, int((long long)(menu_event->itemref)-1));
|
||||
}
|
||||
|
||||
|
||||
@ -83,12 +85,12 @@ void ui_menu_input_groups::handle()
|
||||
input menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_input_general::ui_menu_input_general(mame_ui_manager &mui, render_container *container, int _group) : ui_menu_input(mui, container)
|
||||
menu_input_general::menu_input_general(mame_ui_manager &mui, render_container *container, int _group) : menu_input(mui, container)
|
||||
{
|
||||
group = _group;
|
||||
}
|
||||
|
||||
void ui_menu_input_general::populate()
|
||||
void menu_input_general::populate()
|
||||
{
|
||||
input_item_data *itemlist = nullptr;
|
||||
int suborder[SEQ_TYPE_TOTAL];
|
||||
@ -137,7 +139,7 @@ void ui_menu_input_general::populate()
|
||||
populate_and_sort(itemlist);
|
||||
}
|
||||
|
||||
ui_menu_input_general::~ui_menu_input_general()
|
||||
menu_input_general::~menu_input_general()
|
||||
{
|
||||
}
|
||||
|
||||
@ -146,11 +148,11 @@ ui_menu_input_general::~ui_menu_input_general()
|
||||
input menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_input_specific::ui_menu_input_specific(mame_ui_manager &mui, render_container *container) : ui_menu_input(mui, container)
|
||||
menu_input_specific::menu_input_specific(mame_ui_manager &mui, render_container *container) : menu_input(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_input_specific::populate()
|
||||
void menu_input_specific::populate()
|
||||
{
|
||||
input_item_data *itemlist = nullptr;
|
||||
int suborder[SEQ_TYPE_TOTAL];
|
||||
@ -216,21 +218,21 @@ void ui_menu_input_specific::populate()
|
||||
populate_and_sort(itemlist);
|
||||
}
|
||||
|
||||
ui_menu_input_specific::~ui_menu_input_specific()
|
||||
menu_input_specific::~menu_input_specific()
|
||||
{
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
menu_input - display a menu for inputs
|
||||
-------------------------------------------------*/
|
||||
ui_menu_input::ui_menu_input(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container), last_sortorder(0), record_next(false)
|
||||
menu_input::menu_input(mame_ui_manager &mui, render_container *container) : menu(mui, container), last_sortorder(0), record_next(false)
|
||||
{
|
||||
pollingitem = nullptr;
|
||||
pollingref = nullptr;
|
||||
pollingseq = SEQ_TYPE_STANDARD;
|
||||
}
|
||||
|
||||
ui_menu_input::~ui_menu_input()
|
||||
menu_input::~menu_input()
|
||||
{
|
||||
}
|
||||
|
||||
@ -239,7 +241,7 @@ ui_menu_input::~ui_menu_input()
|
||||
and the default item
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_input::toggle_none_default(input_seq &selected_seq, input_seq &original_seq, const input_seq &selected_defseq)
|
||||
void menu_input::toggle_none_default(input_seq &selected_seq, input_seq &original_seq, const input_seq &selected_defseq)
|
||||
{
|
||||
/* if we used to be "none", toggle to the default value */
|
||||
if (original_seq.length() == 0)
|
||||
@ -250,14 +252,14 @@ void ui_menu_input::toggle_none_default(input_seq &selected_seq, input_seq &orig
|
||||
selected_seq.reset();
|
||||
}
|
||||
|
||||
void ui_menu_input::handle()
|
||||
void menu_input::handle()
|
||||
{
|
||||
input_item_data *seqchangeditem = nullptr;
|
||||
const ui_menu_event *menu_event;
|
||||
const event *menu_event;
|
||||
int invalidate = false;
|
||||
|
||||
/* process the menu */
|
||||
menu_event = process((pollingitem != nullptr) ? UI_MENU_PROCESS_NOKEYS : 0);
|
||||
menu_event = process((pollingitem != nullptr) ? PROCESS_NOKEYS : 0);
|
||||
|
||||
/* if we are polling, handle as a special case */
|
||||
if (pollingitem != nullptr)
|
||||
@ -330,17 +332,17 @@ void ui_menu_input::handle()
|
||||
pollingref = pollingitem->ref;
|
||||
pollingseq = pollingitem->seqtype;
|
||||
}
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
}
|
||||
|
||||
void ui_menu_input_general::update_input(struct input_item_data *seqchangeditem)
|
||||
void menu_input_general::update_input(struct input_item_data *seqchangeditem)
|
||||
{
|
||||
const input_type_entry *entry = (const input_type_entry *)seqchangeditem->ref;
|
||||
machine().ioport().set_type_seq(entry->type(), entry->player(), seqchangeditem->seqtype, seqchangeditem->seq);
|
||||
}
|
||||
|
||||
void ui_menu_input_specific::update_input(struct input_item_data *seqchangeditem)
|
||||
void menu_input_specific::update_input(struct input_item_data *seqchangeditem)
|
||||
{
|
||||
ioport_field::user_settings settings;
|
||||
|
||||
@ -355,7 +357,7 @@ void ui_menu_input_specific::update_input(struct input_item_data *seqchangeditem
|
||||
items for quicksort
|
||||
-------------------------------------------------*/
|
||||
|
||||
int ui_menu_input::compare_items(const void *i1, const void *i2)
|
||||
int menu_input::compare_items(const void *i1, const void *i2)
|
||||
{
|
||||
const input_item_data * const *data1 = (const input_item_data * const *)i1;
|
||||
const input_item_data * const *data2 = (const input_item_data * const *)i2;
|
||||
@ -373,7 +375,7 @@ int ui_menu_input::compare_items(const void *i1, const void *i2)
|
||||
menu from them
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_input::populate_and_sort(input_item_data *itemlist)
|
||||
void menu_input::populate_and_sort(input_item_data *itemlist)
|
||||
{
|
||||
const char *nameformat[INPUT_TYPE_TOTAL] = { nullptr };
|
||||
input_item_data **itemarray, *item;
|
||||
@ -414,7 +416,7 @@ void ui_menu_input::populate_and_sort(input_item_data *itemlist)
|
||||
if (first_entry)
|
||||
first_entry = false;
|
||||
else
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(string_format("[root%s]", item->owner_name).c_str(), nullptr, 0, nullptr);
|
||||
prev_owner.assign(item->owner_name);
|
||||
}
|
||||
@ -425,14 +427,14 @@ void ui_menu_input::populate_and_sort(input_item_data *itemlist)
|
||||
if (pollingref == item->ref)
|
||||
{
|
||||
subtext.assign(" ");
|
||||
flags |= MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW;
|
||||
flags |= FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW;
|
||||
}
|
||||
|
||||
/* otherwise, generate the sequence name and invert it if different from the default */
|
||||
else
|
||||
{
|
||||
subtext = machine().input().seq_name(item->seq);
|
||||
flags |= (item->seq != *item->defseq) ? MENU_FLAG_INVERT : 0;
|
||||
flags |= (item->seq != *item->defseq) ? FLAG_INVERT : 0;
|
||||
}
|
||||
|
||||
/* add the item */
|
||||
@ -446,11 +448,11 @@ void ui_menu_input::populate_and_sort(input_item_data *itemlist)
|
||||
switches menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_settings_dip_switches::ui_menu_settings_dip_switches(mame_ui_manager &mui, render_container *container) : ui_menu_settings(mui, container, IPT_DIPSWITCH)
|
||||
menu_settings_dip_switches::menu_settings_dip_switches(mame_ui_manager &mui, render_container *container) : menu_settings(mui, container, IPT_DIPSWITCH)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_settings_dip_switches::~ui_menu_settings_dip_switches()
|
||||
menu_settings_dip_switches::~menu_settings_dip_switches()
|
||||
{
|
||||
}
|
||||
|
||||
@ -459,11 +461,11 @@ ui_menu_settings_dip_switches::~ui_menu_settings_dip_switches()
|
||||
driver config menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_settings_driver_config::ui_menu_settings_driver_config(mame_ui_manager &mui, render_container *container) : ui_menu_settings(mui, container, IPT_CONFIG)
|
||||
menu_settings_driver_config::menu_settings_driver_config(mame_ui_manager &mui, render_container *container) : menu_settings(mui, container, IPT_CONFIG)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_settings_driver_config::~ui_menu_settings_driver_config()
|
||||
menu_settings_driver_config::~menu_settings_driver_config()
|
||||
{
|
||||
}
|
||||
|
||||
@ -472,10 +474,10 @@ ui_menu_settings_driver_config::~ui_menu_settings_driver_config()
|
||||
switches menus
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_settings::handle()
|
||||
void menu_settings::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
// handle events
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
@ -495,30 +497,30 @@ void ui_menu_settings::handle()
|
||||
|
||||
switch (menu_event->iptkey)
|
||||
{
|
||||
/* if selected, reset to default value */
|
||||
case IPT_UI_SELECT:
|
||||
field->get_user_settings(settings);
|
||||
settings.value = field->defvalue();
|
||||
field->set_user_settings(settings);
|
||||
changed = true;
|
||||
break;
|
||||
/* if selected, reset to default value */
|
||||
case IPT_UI_SELECT:
|
||||
field->get_user_settings(settings);
|
||||
settings.value = field->defvalue();
|
||||
field->set_user_settings(settings);
|
||||
changed = true;
|
||||
break;
|
||||
|
||||
/* left goes to previous setting */
|
||||
case IPT_UI_LEFT:
|
||||
field->select_previous_setting();
|
||||
changed = true;
|
||||
break;
|
||||
/* left goes to previous setting */
|
||||
case IPT_UI_LEFT:
|
||||
field->select_previous_setting();
|
||||
changed = true;
|
||||
break;
|
||||
|
||||
/* right goes to next setting */
|
||||
case IPT_UI_RIGHT:
|
||||
field->select_next_setting();
|
||||
changed = true;
|
||||
break;
|
||||
/* right goes to next setting */
|
||||
case IPT_UI_RIGHT:
|
||||
field->select_next_setting();
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/* if anything changed, rebuild the menu, trying to stay on the same field */
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -529,12 +531,12 @@ void ui_menu_settings::handle()
|
||||
switches menus
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_settings::ui_menu_settings(mame_ui_manager &mui, render_container *container, UINT32 _type) : ui_menu(mui, container), diplist(nullptr), dipcount(0)
|
||||
menu_settings::menu_settings(mame_ui_manager &mui, render_container *container, UINT32 _type) : menu(mui, container), diplist(nullptr), dipcount(0)
|
||||
{
|
||||
type = _type;
|
||||
}
|
||||
|
||||
void ui_menu_settings::populate()
|
||||
void menu_settings::populate()
|
||||
{
|
||||
dip_descriptor **diplist_tailptr;
|
||||
std::string prev_owner;
|
||||
@ -554,9 +556,9 @@ void ui_menu_settings::populate()
|
||||
|
||||
/* set the left/right flags appropriately */
|
||||
if (field.has_previous_setting())
|
||||
flags |= MENU_FLAG_LEFT_ARROW;
|
||||
flags |= FLAG_LEFT_ARROW;
|
||||
if (field.has_next_setting())
|
||||
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||
flags |= FLAG_RIGHT_ARROW;
|
||||
|
||||
/* add the menu item */
|
||||
if (strcmp(field.device().tag(), prev_owner.c_str()) != 0)
|
||||
@ -564,7 +566,7 @@ void ui_menu_settings::populate()
|
||||
if (first_entry)
|
||||
first_entry = false;
|
||||
else
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
string_format("[root%s]", field.device().tag());
|
||||
item_append(string_format("[root%s]", field.device().tag()).c_str(), nullptr, 0, nullptr);
|
||||
prev_owner.assign(field.device().tag());
|
||||
@ -617,11 +619,11 @@ void ui_menu_settings::populate()
|
||||
if (type == IPT_DIPSWITCH)
|
||||
custombottom = dipcount ? dipcount * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) + DIP_SWITCH_SPACING : 0;
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("Reset"), nullptr, 0, (void *)1);
|
||||
}
|
||||
|
||||
ui_menu_settings::~ui_menu_settings()
|
||||
menu_settings::~menu_settings()
|
||||
{
|
||||
}
|
||||
|
||||
@ -630,7 +632,7 @@ ui_menu_settings::~ui_menu_settings()
|
||||
rendering
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_settings_dip_switches::custom_render(void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
|
||||
void menu_settings_dip_switches::custom_render(void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
|
||||
{
|
||||
// catch if no diploc has to be drawn
|
||||
if (bottom == 0)
|
||||
@ -672,7 +674,7 @@ void ui_menu_settings_dip_switches::custom_render(void *selectedref, float top,
|
||||
DIP switch
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_settings_dip_switches::custom_render_one(float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask)
|
||||
void menu_settings_dip_switches::custom_render_one(float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask)
|
||||
{
|
||||
float switch_field_width = SINGLE_TOGGLE_SWITCH_FIELD_WIDTH * container->manager().ui_aspect();
|
||||
float switch_width = SINGLE_TOGGLE_SWITCH_WIDTH * container->manager().ui_aspect();
|
||||
@ -741,10 +743,10 @@ void ui_menu_settings_dip_switches::custom_render_one(float x1, float y1, float
|
||||
menu_analog - handle the analog settings menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_analog::handle()
|
||||
void menu_analog::handle()
|
||||
{
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
const event *menu_event = process(PROCESS_LR_REPEAT);
|
||||
|
||||
/* handle events */
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
@ -793,7 +795,7 @@ void ui_menu_analog::handle()
|
||||
data->field->set_user_settings(settings);
|
||||
|
||||
/* rebuild the menu */
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -804,11 +806,11 @@ void ui_menu_analog::handle()
|
||||
settings menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_analog::ui_menu_analog(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_analog::menu_analog(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_analog::populate()
|
||||
void menu_analog::populate()
|
||||
{
|
||||
std::string text;
|
||||
std::string subtext;
|
||||
@ -861,7 +863,7 @@ void ui_menu_analog::populate()
|
||||
if (first_entry)
|
||||
first_entry = false;
|
||||
else
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(string_format("[root%s]", field.device().tag()).c_str(), nullptr, 0, nullptr);
|
||||
prev_owner.assign(field.device().tag());
|
||||
}
|
||||
@ -914,9 +916,9 @@ void ui_menu_analog::populate()
|
||||
|
||||
/* put on arrows */
|
||||
if (data->cur > data->min)
|
||||
flags |= MENU_FLAG_LEFT_ARROW;
|
||||
flags |= FLAG_LEFT_ARROW;
|
||||
if (data->cur < data->max)
|
||||
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||
flags |= FLAG_RIGHT_ARROW;
|
||||
|
||||
/* append a menu item */
|
||||
item_append(text.c_str(), subtext.c_str(), flags, data);
|
||||
@ -924,6 +926,8 @@ void ui_menu_analog::populate()
|
||||
}
|
||||
}
|
||||
|
||||
ui_menu_analog::~ui_menu_analog()
|
||||
menu_analog::~menu_analog()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,21 +10,28 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_INPUTMAP_H__
|
||||
#define __UI_INPUTMAP_H__
|
||||
#ifndef MAME_FRONTEND_UI_INPUTMAP_H
|
||||
#define MAME_FRONTEND_UI_INPUTMAP_H
|
||||
|
||||
class ui_menu_input_groups : public ui_menu {
|
||||
#include "ui/menu.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
class menu_input_groups : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_input_groups(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_input_groups();
|
||||
menu_input_groups(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_input_groups() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
};
|
||||
|
||||
class ui_menu_input : public ui_menu {
|
||||
class menu_input : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_input(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_input();
|
||||
menu_input(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_input() override;
|
||||
virtual void handle() override;
|
||||
|
||||
protected:
|
||||
@ -37,7 +44,8 @@ protected:
|
||||
};
|
||||
|
||||
/* internal input menu item data */
|
||||
struct input_item_data {
|
||||
struct input_item_data
|
||||
{
|
||||
input_item_data * next; /* pointer to next item in the list */
|
||||
const void * ref; /* reference to type description for global inputs or field for game inputs */
|
||||
input_seq_type seqtype; /* sequence type */
|
||||
@ -66,10 +74,11 @@ private:
|
||||
static int compare_items(const void *i1, const void *i2);
|
||||
};
|
||||
|
||||
class ui_menu_input_general : public ui_menu_input {
|
||||
class menu_input_general : public menu_input
|
||||
{
|
||||
public:
|
||||
ui_menu_input_general(mame_ui_manager &mui, render_container *container, int group);
|
||||
virtual ~ui_menu_input_general();
|
||||
menu_input_general(mame_ui_manager &mui, render_container *container, int group);
|
||||
virtual ~menu_input_general() override;
|
||||
virtual void populate() override;
|
||||
|
||||
protected:
|
||||
@ -77,26 +86,29 @@ protected:
|
||||
virtual void update_input(struct input_item_data *seqchangeditem) override;
|
||||
};
|
||||
|
||||
class ui_menu_input_specific : public ui_menu_input {
|
||||
class menu_input_specific : public menu_input
|
||||
{
|
||||
public:
|
||||
ui_menu_input_specific(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_input_specific();
|
||||
menu_input_specific(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_input_specific() override;
|
||||
virtual void populate() override;
|
||||
|
||||
protected:
|
||||
virtual void update_input(struct input_item_data *seqchangeditem) override;
|
||||
};
|
||||
|
||||
class ui_menu_settings : public ui_menu {
|
||||
class menu_settings : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_settings(mame_ui_manager &mui, render_container *container, UINT32 type);
|
||||
virtual ~ui_menu_settings();
|
||||
menu_settings(mame_ui_manager &mui, render_container *container, UINT32 type);
|
||||
virtual ~menu_settings() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
protected:
|
||||
/* DIP switch descriptor */
|
||||
struct dip_descriptor {
|
||||
struct dip_descriptor
|
||||
{
|
||||
dip_descriptor * next;
|
||||
const char * name;
|
||||
UINT32 mask;
|
||||
@ -108,26 +120,29 @@ protected:
|
||||
int type;
|
||||
};
|
||||
|
||||
class ui_menu_settings_dip_switches : public ui_menu_settings {
|
||||
class menu_settings_dip_switches : public menu_settings
|
||||
{
|
||||
public:
|
||||
ui_menu_settings_dip_switches(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_settings_dip_switches();
|
||||
menu_settings_dip_switches(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_settings_dip_switches() override;
|
||||
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
private:
|
||||
void custom_render_one(float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask);
|
||||
};
|
||||
|
||||
class ui_menu_settings_driver_config : public ui_menu_settings {
|
||||
class menu_settings_driver_config : public menu_settings
|
||||
{
|
||||
public:
|
||||
ui_menu_settings_driver_config(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_settings_driver_config();
|
||||
menu_settings_driver_config(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_settings_driver_config();
|
||||
};
|
||||
|
||||
class ui_menu_analog : public ui_menu {
|
||||
class menu_analog : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_analog(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_analog();
|
||||
menu_analog(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_analog() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -150,4 +165,6 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* __UI_INPUTMAP_H__ */
|
||||
} // namesapce ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_INPUTMAP_H */
|
||||
|
@ -35,19 +35,21 @@
|
||||
#include "ui/pluginopt.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
/***************************************************************************
|
||||
MENU HANDLERS
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_menu_main constructor - populate the main menu
|
||||
menu_main constructor - populate the main menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_main::ui_menu_main(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_main::menu_main(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_main::populate()
|
||||
void menu_main::populate()
|
||||
{
|
||||
/* add input menu items */
|
||||
item_append(_("Input (general)"), nullptr, 0, (void *)INPUT_GROUPS);
|
||||
@ -131,7 +133,7 @@ void ui_menu_main::populate()
|
||||
if (ui().options().enabled_dats() && mame_machine_manager::instance()->datfile().has_data())
|
||||
item_append(_("External DAT View"), nullptr, 0, (void *)EXTERNAL_DATS);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
/* add favorite menu */
|
||||
if (!mame_machine_manager::instance()->favorite().isgame_favorite())
|
||||
@ -139,7 +141,7 @@ void ui_menu_main::populate()
|
||||
else
|
||||
item_append(_("Remove From Favorites"), nullptr, 0, (void *)REMOVE_FAVORITE);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
// item_append(_("Quit from Machine"), nullptr, 0, (void *)QUIT_GAME);
|
||||
|
||||
@ -147,7 +149,7 @@ void ui_menu_main::populate()
|
||||
item_append(_("Select New Machine"), nullptr, 0, (void *)SELECT_GAME);
|
||||
}
|
||||
|
||||
ui_menu_main::~ui_menu_main()
|
||||
menu_main::~menu_main()
|
||||
{
|
||||
}
|
||||
|
||||
@ -155,129 +157,130 @@ ui_menu_main::~ui_menu_main()
|
||||
menu_main - handle the main menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_main::handle()
|
||||
void menu_main::handle()
|
||||
{
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
if (menu_event != nullptr && menu_event->iptkey == IPT_UI_SELECT) {
|
||||
switch((long long)(menu_event->itemref)) {
|
||||
case INPUT_GROUPS:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_input_groups>(ui(), container));
|
||||
menu::stack_push<menu_input_groups>(ui(), container);
|
||||
break;
|
||||
|
||||
case INPUT_SPECIFIC:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_input_specific>(ui(), container));
|
||||
menu::stack_push<menu_input_specific>(ui(), container);
|
||||
break;
|
||||
|
||||
case SETTINGS_DIP_SWITCHES:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_settings_dip_switches>(ui(), container));
|
||||
menu::stack_push<menu_settings_dip_switches>(ui(), container);
|
||||
break;
|
||||
|
||||
case SETTINGS_DRIVER_CONFIG:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_settings_driver_config>(ui(), container));
|
||||
menu::stack_push<menu_settings_driver_config>(ui(), container);
|
||||
break;
|
||||
|
||||
case ANALOG:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_analog>(ui(), container));
|
||||
menu::stack_push<menu_analog>(ui(), container);
|
||||
break;
|
||||
|
||||
case BOOKKEEPING:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_bookkeeping>(ui(), container));
|
||||
menu::stack_push<menu_bookkeeping>(ui(), container);
|
||||
break;
|
||||
|
||||
case GAME_INFO:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_game_info>(ui(), container));
|
||||
menu::stack_push<menu_game_info>(ui(), container);
|
||||
break;
|
||||
|
||||
case IMAGE_MENU_IMAGE_INFO:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_image_info>(ui(), container));
|
||||
menu::stack_push<menu_image_info>(ui(), container);
|
||||
break;
|
||||
|
||||
case IMAGE_MENU_FILE_MANAGER:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_file_manager>(ui(), container, nullptr));
|
||||
menu::stack_push<menu_file_manager>(ui(), container, nullptr);
|
||||
break;
|
||||
|
||||
case TAPE_CONTROL:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_tape_control>(ui(), container, nullptr));
|
||||
menu::stack_push<menu_tape_control>(ui(), container, nullptr);
|
||||
break;
|
||||
|
||||
case PTY_INFO:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_pty_info>(ui(), container));
|
||||
menu::stack_push<menu_pty_info>(ui(), container);
|
||||
break;
|
||||
|
||||
case SLOT_DEVICES:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_slot_devices>(ui(), container));
|
||||
menu::stack_push<menu_slot_devices>(ui(), container);
|
||||
break;
|
||||
|
||||
case NETWORK_DEVICES:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_network_devices>(ui(), container));
|
||||
menu::stack_push<menu_network_devices>(ui(), container);
|
||||
break;
|
||||
|
||||
case KEYBOARD_MODE:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_keyboard_mode>(ui(), container));
|
||||
menu::stack_push<menu_keyboard_mode>(ui(), container);
|
||||
break;
|
||||
|
||||
case SLIDERS:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_sliders>(ui(), container, false));
|
||||
menu::stack_push<menu_sliders>(ui(), container, false);
|
||||
break;
|
||||
|
||||
case VIDEO_TARGETS:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_video_targets>(ui(), container));
|
||||
menu::stack_push<menu_video_targets>(ui(), container);
|
||||
break;
|
||||
|
||||
case VIDEO_OPTIONS:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_video_options>(ui(), container, machine().render().first_target()));
|
||||
menu::stack_push<menu_video_options>(ui(), container, machine().render().first_target());
|
||||
break;
|
||||
|
||||
case CROSSHAIR:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_crosshair>(ui(), container));
|
||||
menu::stack_push<menu_crosshair>(ui(), container);
|
||||
break;
|
||||
|
||||
case CHEAT:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_cheat>(ui(), container));
|
||||
menu::stack_push<menu_cheat>(ui(), container);
|
||||
break;
|
||||
|
||||
case PLUGINS:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_plugin>(ui(), container));
|
||||
menu::stack_push<menu_plugin>(ui(), container);
|
||||
break;
|
||||
|
||||
case SELECT_GAME:
|
||||
if (strcmp(machine().options().ui(),"simple")==0) {
|
||||
ui_menu::stack_push(global_alloc_clear<ui_simple_menu_select_game>(ui(), container, nullptr));
|
||||
} else {
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_select_game>(ui(), container, nullptr));
|
||||
}
|
||||
if (strcmp(machine().options().ui(),"simple")==0)
|
||||
menu::stack_push<simple_menu_select_game>(ui(), container, nullptr);
|
||||
else
|
||||
menu::stack_push<menu_select_game>(ui(), container, nullptr);
|
||||
break;
|
||||
|
||||
case BIOS_SELECTION:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_bios_selection>(ui(), container));
|
||||
menu::stack_push<menu_bios_selection>(ui(), container);
|
||||
break;
|
||||
|
||||
case BARCODE_READ:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_barcode_reader>(ui(), container, nullptr));
|
||||
menu::stack_push<menu_barcode_reader>(ui(), container, nullptr);
|
||||
break;
|
||||
|
||||
case EXTERNAL_DATS:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(ui(), container));
|
||||
menu::stack_push<menu_dats_view>(ui(), container);
|
||||
break;
|
||||
|
||||
case ADD_FAVORITE:
|
||||
mame_machine_manager::instance()->favorite().add_favorite_game();
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
break;
|
||||
|
||||
case REMOVE_FAVORITE:
|
||||
mame_machine_manager::instance()->favorite().remove_favorite_game();
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
break;
|
||||
|
||||
case QUIT_GAME:
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
ui().request_quit();
|
||||
break;
|
||||
|
||||
default:
|
||||
fatalerror("ui_menu_main::handle - unknown reference\n");
|
||||
fatalerror("ui::menu_main::handle - unknown reference\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,13 +10,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_MAINMENU_H__
|
||||
#define __UI_MAINMENU_H__
|
||||
#ifndef MAME_FRONTEND_UI_MAINMENU_H
|
||||
#define MAME_FRONTEND_UI_MAINMENU_H
|
||||
|
||||
class ui_menu_main : public ui_menu {
|
||||
namespace ui {
|
||||
|
||||
class menu_main : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_main(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_main();
|
||||
menu_main(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_main();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -50,8 +53,8 @@ private:
|
||||
REMOVE_FAVORITE,
|
||||
QUIT_GAME
|
||||
};
|
||||
|
||||
//bool submenu;
|
||||
};
|
||||
|
||||
#endif /* __UI_MAINMENU_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_MAINMENU_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -10,102 +10,62 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_MENU_H__
|
||||
#define __UI_MENU_H__
|
||||
#ifndef MAME_FRONTEND_UI_MENU_H
|
||||
#define MAME_FRONTEND_UI_MENU_H
|
||||
|
||||
#include "render.h"
|
||||
#include "language.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menuitem.h"
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
// flags for menu items
|
||||
#define MENU_FLAG_LEFT_ARROW (1 << 0)
|
||||
#define MENU_FLAG_RIGHT_ARROW (1 << 1)
|
||||
#define MENU_FLAG_INVERT (1 << 2)
|
||||
#define MENU_FLAG_MULTILINE (1 << 3)
|
||||
#define MENU_FLAG_REDTEXT (1 << 4)
|
||||
#define MENU_FLAG_DISABLE (1 << 5)
|
||||
#define MENU_FLAG_UI (1 << 6)
|
||||
#define MENU_FLAG_UI_DATS (1 << 7)
|
||||
#define MENU_FLAG_UI_SWLIST (1 << 8)
|
||||
#define MENU_FLAG_UI_FAVORITE (1 << 9)
|
||||
#define MENU_FLAG_UI_PALETTE (1 << 10)
|
||||
#define MENU_FLAG_UI_HEADING (1 << 11)
|
||||
#include <memory>
|
||||
|
||||
// flags to pass to ui_menu_process
|
||||
#define UI_MENU_PROCESS_NOKEYS 1
|
||||
#define UI_MENU_PROCESS_LR_REPEAT 2
|
||||
#define UI_MENU_PROCESS_CUSTOM_ONLY 4
|
||||
#define UI_MENU_PROCESS_ONLYCHAR 8
|
||||
#define UI_MENU_PROCESS_NOINPUT 16
|
||||
#define UI_MENU_PROCESS_NOIMAGE 32
|
||||
|
||||
// options for ui_menu_reset
|
||||
enum ui_menu_reset_options
|
||||
{
|
||||
UI_MENU_RESET_SELECT_FIRST,
|
||||
UI_MENU_RESET_REMEMBER_POSITION,
|
||||
UI_MENU_RESET_REMEMBER_REF
|
||||
};
|
||||
|
||||
namespace ui {
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
// menu-related events
|
||||
struct ui_menu_event
|
||||
{
|
||||
void *itemref; // reference for the selected item
|
||||
ui_menu_item_type type; // item type (eventually will go away when itemref is proper ui_menu_item class rather than void*)
|
||||
int iptkey; // one of the IPT_* values from inptport.h
|
||||
unicode_char unichar; // unicode character if iptkey == IPT_SPECIAL
|
||||
render_bounds mouse; // mouse position if iptkey == IPT_CUSTOM
|
||||
};
|
||||
|
||||
struct ui_menu_pool
|
||||
{
|
||||
ui_menu_pool *next; // chain to next one
|
||||
UINT8 *top; // top of the pool
|
||||
UINT8 *end; // end of the pool
|
||||
};
|
||||
|
||||
|
||||
class ui_menu
|
||||
class menu
|
||||
{
|
||||
public:
|
||||
ui_menu(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu();
|
||||
// flags for menu items
|
||||
enum
|
||||
{
|
||||
FLAG_LEFT_ARROW = (1 << 0),
|
||||
FLAG_RIGHT_ARROW = (1 << 1),
|
||||
FLAG_INVERT = (1 << 2),
|
||||
FLAG_MULTILINE = (1 << 3),
|
||||
FLAG_REDTEXT = (1 << 4),
|
||||
FLAG_DISABLE = (1 << 5),
|
||||
FLAG_UI = (1 << 6),
|
||||
FLAG_UI_DATS = (1 << 7),
|
||||
FLAG_UI_SWLIST = (1 << 8),
|
||||
FLAG_UI_FAVORITE = (1 << 9),
|
||||
FLAG_UI_PALETTE = (1 << 10),
|
||||
FLAG_UI_HEADING = (1 << 11)
|
||||
};
|
||||
|
||||
virtual ~menu();
|
||||
|
||||
mame_ui_manager &ui() const { return m_ui; }
|
||||
running_machine &machine() const { return m_ui.machine(); }
|
||||
|
||||
render_container *container; // render_container we render to
|
||||
ui_menu_event menu_event; // the UI menu_event that occurred
|
||||
ui_menu *parent; // pointer to parent menu
|
||||
int resetpos; // reset position
|
||||
void *resetref; // reset reference
|
||||
int selected; // which item is selected
|
||||
int hover; // which item is being hovered over
|
||||
int visitems; // number of visible items
|
||||
float customtop; // amount of extra height to add at the top
|
||||
float custombottom; // amount of extra height to add at the bottom
|
||||
ui_menu_pool *pool; // list of memory pools
|
||||
std::vector<ui_menu_item> item; // array of items
|
||||
|
||||
// free all items in the menu, and all memory allocated from the memory pool
|
||||
void reset(ui_menu_reset_options options);
|
||||
render_container *container; // render_container we render to
|
||||
int resetpos; // reset position
|
||||
void *resetref; // reset reference
|
||||
int selected; // which item is selected
|
||||
int hover; // which item is being hovered over
|
||||
int visitems; // number of visible items
|
||||
float customtop; // amount of extra height to add at the top
|
||||
float custombottom; // amount of extra height to add at the bottom
|
||||
std::vector<menu_item> item; // array of items
|
||||
|
||||
// append a new item to the end of the menu
|
||||
void item_append(const char *text, const char *subtext, UINT32 flags, void *ref, ui_menu_item_type type = ui_menu_item_type::UNKNOWN);
|
||||
void item_append(ui_menu_item item);
|
||||
void item_append(ui_menu_item_type type);
|
||||
|
||||
// process a menu, drawing it and returning any interesting events
|
||||
const ui_menu_event *process(UINT32 flags, float x0 = 0.0f, float y0 = 0.0f);
|
||||
void item_append(const char *text, const char *subtext, UINT32 flags, void *ref, menu_item_type type = menu_item_type::UNKNOWN);
|
||||
void item_append(menu_item item);
|
||||
void item_append(menu_item_type type);
|
||||
|
||||
// configure the menu for custom rendering
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
|
||||
@ -124,7 +84,6 @@ public:
|
||||
|
||||
// request the specific handling of the game selection main menu
|
||||
bool is_special_main_menu() const;
|
||||
void set_special_main_menu(bool disable);
|
||||
|
||||
// Global initialization
|
||||
static void init(running_machine &machine, ui_options &mopt);
|
||||
@ -134,7 +93,18 @@ public:
|
||||
static void stack_reset(running_machine &machine);
|
||||
|
||||
// push a new menu onto the stack
|
||||
static void stack_push(ui_menu *menu);
|
||||
template <typename T, typename... Params>
|
||||
static void stack_push(Params &&... args)
|
||||
{
|
||||
stack_push(std::unique_ptr<menu>(global_alloc_clear<T>(std::forward<Params>(args)...)));
|
||||
}
|
||||
template <typename T, typename... Params>
|
||||
static void stack_push_special_main(Params &&... args)
|
||||
{
|
||||
std::unique_ptr<menu> ptr(global_alloc_clear<T>(std::forward<Params>(args)...));
|
||||
ptr->set_special_main_menu(true);
|
||||
stack_push(std::move(ptr));
|
||||
}
|
||||
|
||||
// pop a menu from the stack
|
||||
static void stack_pop(running_machine &machine);
|
||||
@ -153,7 +123,6 @@ public:
|
||||
|
||||
// Used by sliders
|
||||
void validate_selection(int scandir);
|
||||
static ui_menu *menu_stack;
|
||||
|
||||
void do_handle();
|
||||
|
||||
@ -167,13 +136,9 @@ public:
|
||||
virtual bool menu_has_search_active() { return false; }
|
||||
|
||||
private:
|
||||
static ui_menu *menu_free;
|
||||
static std::unique_ptr<bitmap_rgb32> hilight_bitmap;
|
||||
static render_texture *hilight_texture, *arrow_texture;
|
||||
|
||||
bool m_special_main_menu;
|
||||
mame_ui_manager &m_ui; // UI we are attached to
|
||||
|
||||
void draw(UINT32 flags, float x0 = 0.0f, float y0 = 0.0f);
|
||||
void draw_text_box();
|
||||
void handle_events(UINT32 flags);
|
||||
@ -227,10 +192,39 @@ public:
|
||||
if (max == 0)
|
||||
return 0;
|
||||
else
|
||||
return ((actual <= min) ? MENU_FLAG_RIGHT_ARROW : (actual >= max ? MENU_FLAG_LEFT_ARROW : (MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW)));
|
||||
return ((actual <= min) ? FLAG_RIGHT_ARROW : (actual >= max ? FLAG_LEFT_ARROW : (FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW)));
|
||||
}
|
||||
|
||||
protected:
|
||||
// flags to pass to process
|
||||
enum
|
||||
{
|
||||
PROCESS_NOKEYS = 1,
|
||||
PROCESS_LR_REPEAT = 2,
|
||||
PROCESS_CUSTOM_ONLY = 4,
|
||||
PROCESS_ONLYCHAR = 8,
|
||||
PROCESS_NOINPUT = 16,
|
||||
PROCESS_NOIMAGE = 32
|
||||
};
|
||||
|
||||
// options for reset
|
||||
enum class reset_options
|
||||
{
|
||||
SELECT_FIRST,
|
||||
REMEMBER_POSITION,
|
||||
REMEMBER_REF
|
||||
};
|
||||
|
||||
// menu-related events
|
||||
struct event
|
||||
{
|
||||
void *itemref; // reference for the selected item
|
||||
menu_item_type type; // item type (eventually will go away when itemref is proper ui_menu_item class rather than void*)
|
||||
int iptkey; // one of the IPT_* values from inptport.h
|
||||
unicode_char unichar; // unicode character if iptkey == IPT_SPECIAL
|
||||
render_bounds mouse; // mouse position if iptkey == IPT_CUSTOM
|
||||
};
|
||||
|
||||
int topline_datsview; // right box top line
|
||||
int top_line; // main box top line
|
||||
int l_sw_hover;
|
||||
@ -238,6 +232,17 @@ protected:
|
||||
int totallines;
|
||||
int skip_main_items;
|
||||
|
||||
menu(mame_ui_manager &mui, render_container *container);
|
||||
|
||||
// free all items in the menu, and all memory allocated from the memory pool
|
||||
void reset(reset_options options);
|
||||
void reset_parent(reset_options options) { m_parent->reset(options); }
|
||||
static void reset_topmost(reset_options options) { if (menu_stack) menu_stack->reset(options); }
|
||||
|
||||
// process a menu, drawing it and returning any interesting events
|
||||
const event *process(UINT32 flags, float x0 = 0.0f, float y0 = 0.0f);
|
||||
void process_parent() { m_parent->process(PROCESS_NOINPUT); }
|
||||
|
||||
// draw right box
|
||||
float draw_right_box_title(float x1, float y1, float x2, float y2);
|
||||
|
||||
@ -252,6 +257,9 @@ protected:
|
||||
// draw header and footer text
|
||||
void extra_text_render(float top, float bottom, float origx1, float origy1, float origx2, float origy2, const char *header, const char *footer);
|
||||
|
||||
template <typename T>
|
||||
static T *topmost_menu() { return dynamic_cast<T *>(menu_stack.get()); }
|
||||
|
||||
int visible_lines; // main box visible lines
|
||||
int right_visible_lines; // right box lines
|
||||
|
||||
@ -260,11 +268,16 @@ protected:
|
||||
|
||||
static std::unique_ptr<bitmap_rgb32> hilight_main_bitmap;
|
||||
static render_texture *hilight_main_texture;
|
||||
private:
|
||||
|
||||
// mouse button held down
|
||||
bool m_pressed = false;
|
||||
osd_ticks_t m_repeat = 0;
|
||||
private:
|
||||
struct pool
|
||||
{
|
||||
pool *next; // chain to next one
|
||||
UINT8 *top; // top of the pool
|
||||
UINT8 *end; // end of the pool
|
||||
};
|
||||
|
||||
|
||||
void reset_pressed() { m_pressed = false; m_repeat = 0; }
|
||||
bool mouse_pressed() { return (osd_ticks() >= m_repeat); }
|
||||
void set_pressed();
|
||||
@ -274,6 +287,12 @@ private:
|
||||
static bitmap_argb32 *icons_bitmap[];
|
||||
static render_texture *icons_texture[];
|
||||
|
||||
// request the specific handling of the game selection main menu
|
||||
void set_special_main_menu(bool disable);
|
||||
|
||||
// push a new menu onto the stack
|
||||
static void stack_push(std::unique_ptr<menu> &&menu);
|
||||
|
||||
// toolbar
|
||||
static bitmap_argb32 *toolbar_bitmap[], *sw_toolbar_bitmap[];
|
||||
static render_texture *toolbar_texture[], *sw_toolbar_texture[];
|
||||
@ -297,6 +316,19 @@ private:
|
||||
|
||||
void draw_icon(int linenum, void *selectedref, float x1, float y1);
|
||||
void extra_text_draw_box(float origx1, float origx2, float origy, float yspan, const char *text, int direction);
|
||||
|
||||
bool m_special_main_menu;
|
||||
mame_ui_manager &m_ui; // UI we are attached to
|
||||
std::unique_ptr<menu> m_parent; // pointer to parent menu
|
||||
bool m_pressed; // mouse button held down
|
||||
osd_ticks_t m_repeat;
|
||||
event m_event; // the UI event that occurred
|
||||
pool *m_pool; // list of memory pools
|
||||
|
||||
static std::unique_ptr<menu> menu_stack;
|
||||
static std::unique_ptr<menu> menu_free;
|
||||
};
|
||||
|
||||
#endif // __UI_MENU_H__
|
||||
} // namespace ui
|
||||
|
||||
#endif // MAME_FRONTEND_UI_MENU_H
|
||||
|
@ -11,32 +11,34 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_MENUITEM__
|
||||
#define __UI_MENUITEM__
|
||||
#ifndef MAME_FRONTEND_UI_MENUITEM_H
|
||||
#define MAME_FRONTEND_UI_MENUITEM_H
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
// special menu item for separators
|
||||
#define MENU_SEPARATOR_ITEM "---"
|
||||
|
||||
// types of menu items (TODO: please expand)
|
||||
enum class ui_menu_item_type
|
||||
enum class menu_item_type
|
||||
{
|
||||
UNKNOWN,
|
||||
SLIDER,
|
||||
SEPARATOR
|
||||
};
|
||||
|
||||
class ui_menu_item
|
||||
class menu_item
|
||||
{
|
||||
public:
|
||||
const char *text;
|
||||
const char *subtext;
|
||||
UINT32 flags;
|
||||
void *ref;
|
||||
ui_menu_item_type type; // item type (eventually will go away when itemref is proper ui_menu_item class rather than void*)
|
||||
|
||||
inline bool is_selectable() const;
|
||||
const char *text;
|
||||
const char *subtext;
|
||||
UINT32 flags;
|
||||
void *ref;
|
||||
menu_item_type type; // item type (eventually will go away when itemref is proper ui_menu_item class rather than void*)
|
||||
};
|
||||
|
||||
#endif // __UI_MENUITEM__
|
||||
} // namespace ui
|
||||
|
||||
#endif // MAME_FRONTEND_UI_MENUITEM_H
|
||||
|
@ -23,56 +23,58 @@
|
||||
#include "ui/inifile.h"
|
||||
#include "ui/submenu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
/***************************************************************************
|
||||
MENU HANDLERS
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_menu_keyboard_mode - menu that
|
||||
menu_keyboard_mode - menu that
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_keyboard_mode::ui_menu_keyboard_mode(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_keyboard_mode::menu_keyboard_mode(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_keyboard_mode::populate()
|
||||
void menu_keyboard_mode::populate()
|
||||
{
|
||||
bool natural = ui().use_natural_keyboard();
|
||||
item_append(_("Keyboard Mode:"), natural ? _("Natural") : _("Emulated"), natural ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, nullptr);
|
||||
item_append(_("Keyboard Mode:"), natural ? _("Natural") : _("Emulated"), natural ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, nullptr);
|
||||
}
|
||||
|
||||
ui_menu_keyboard_mode::~ui_menu_keyboard_mode()
|
||||
menu_keyboard_mode::~menu_keyboard_mode()
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_keyboard_mode::handle()
|
||||
void menu_keyboard_mode::handle()
|
||||
{
|
||||
bool natural = ui().use_natural_keyboard();
|
||||
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (menu_event != nullptr)
|
||||
{
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
ui().set_use_natural_keyboard(natural ^ true);
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_menu_bios_selection - populates the main
|
||||
menu_bios_selection - populates the main
|
||||
bios selection menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_bios_selection::ui_menu_bios_selection(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_bios_selection::menu_bios_selection(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_bios_selection::populate()
|
||||
void menu_bios_selection::populate()
|
||||
{
|
||||
/* cycle through all devices for this system */
|
||||
for (device_t &device : device_iterator(machine().root_device()))
|
||||
@ -87,26 +89,26 @@ void ui_menu_bios_selection::populate()
|
||||
val = ROM_GETHASHDATA(rom);
|
||||
}
|
||||
}
|
||||
item_append(device.owner() == nullptr ? "driver" : device.tag()+1, val, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)&device);
|
||||
item_append(device.owner() == nullptr ? "driver" : device.tag()+1, val, FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, (void *)&device);
|
||||
}
|
||||
}
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("Reset"), nullptr, 0, (void *)1);
|
||||
}
|
||||
|
||||
ui_menu_bios_selection::~ui_menu_bios_selection()
|
||||
menu_bios_selection::~menu_bios_selection()
|
||||
{
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_menu_bios_selection - menu that
|
||||
menu_bios_selection - menu that
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_bios_selection::handle()
|
||||
void menu_bios_selection::handle()
|
||||
{
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
@ -134,18 +136,18 @@ void ui_menu_bios_selection::handle()
|
||||
machine().options().set_value(dev->owner()->tag()+1, value.c_str(), OPTION_PRIORITY_CMDLINE, error);
|
||||
assert(error.empty());
|
||||
}
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ui_menu_network_devices::ui_menu_network_devices(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_network_devices::menu_network_devices(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_network_devices::~ui_menu_network_devices()
|
||||
menu_network_devices::~menu_network_devices()
|
||||
{
|
||||
}
|
||||
|
||||
@ -154,7 +156,7 @@ ui_menu_network_devices::~ui_menu_network_devices()
|
||||
network device menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_network_devices::populate()
|
||||
void menu_network_devices::populate()
|
||||
{
|
||||
/* cycle through all devices for this system */
|
||||
for (device_network_interface &network : network_interface_iterator(machine().root_device()))
|
||||
@ -170,18 +172,18 @@ void ui_menu_network_devices::populate()
|
||||
entry = entry->m_next;
|
||||
}
|
||||
|
||||
item_append(network.device().tag(), (title) ? title : "------", MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)network);
|
||||
item_append(network.device().tag(), (title) ? title : "------", FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, (void *)network);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_menu_network_devices - menu that
|
||||
menu_network_devices - menu that
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_network_devices::handle()
|
||||
void menu_network_devices::handle()
|
||||
{
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
@ -191,7 +193,7 @@ void ui_menu_network_devices::handle()
|
||||
if (menu_event->iptkey == IPT_UI_LEFT) curr--; else curr++;
|
||||
if (curr==-2) curr = netdev_count() - 1;
|
||||
network->set_interface(curr);
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +204,7 @@ void ui_menu_network_devices::handle()
|
||||
information menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_bookkeeping::handle()
|
||||
void menu_bookkeeping::handle()
|
||||
{
|
||||
attotime curtime;
|
||||
|
||||
@ -210,7 +212,7 @@ void ui_menu_bookkeeping::handle()
|
||||
curtime = machine().time();
|
||||
if (prevtime.seconds() != curtime.seconds())
|
||||
{
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
prevtime = curtime;
|
||||
populate();
|
||||
}
|
||||
@ -224,15 +226,15 @@ void ui_menu_bookkeeping::handle()
|
||||
menu_bookkeeping - handle the bookkeeping
|
||||
information menu
|
||||
-------------------------------------------------*/
|
||||
ui_menu_bookkeeping::ui_menu_bookkeeping(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_bookkeeping::menu_bookkeeping(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_bookkeeping::~ui_menu_bookkeeping()
|
||||
menu_bookkeeping::~menu_bookkeeping()
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_bookkeeping::populate()
|
||||
void menu_bookkeeping::populate()
|
||||
{
|
||||
int tickets = machine().bookkeeping().get_dispensed_tickets();
|
||||
std::ostringstream tempstring;
|
||||
@ -264,7 +266,7 @@ void ui_menu_bookkeeping::populate()
|
||||
}
|
||||
|
||||
/* append the single item */
|
||||
item_append(tempstring.str().c_str(), nullptr, MENU_FLAG_MULTILINE, nullptr);
|
||||
item_append(tempstring.str().c_str(), nullptr, FLAG_MULTILINE, nullptr);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
@ -272,10 +274,10 @@ void ui_menu_bookkeeping::populate()
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_crosshair::handle()
|
||||
void menu_crosshair::handle()
|
||||
{
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
const event *menu_event = process(PROCESS_LR_REPEAT);
|
||||
|
||||
/* handle events */
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
@ -362,7 +364,7 @@ void ui_menu_crosshair::handle()
|
||||
machine().crosshair().set_user_settings(data->player, &settings);
|
||||
|
||||
/* rebuild the menu */
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -373,11 +375,11 @@ void ui_menu_crosshair::handle()
|
||||
crosshair settings menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_crosshair::ui_menu_crosshair(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_crosshair::menu_crosshair(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_crosshair::populate()
|
||||
void menu_crosshair::populate()
|
||||
{
|
||||
crosshair_user_settings settings;
|
||||
crosshair_item_data *data;
|
||||
@ -412,9 +414,9 @@ void ui_menu_crosshair::populate()
|
||||
|
||||
/* put on arrows */
|
||||
if (data->cur > data->min)
|
||||
flags |= MENU_FLAG_LEFT_ARROW;
|
||||
flags |= FLAG_LEFT_ARROW;
|
||||
if (data->cur < data->max)
|
||||
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||
flags |= FLAG_RIGHT_ARROW;
|
||||
|
||||
/* add CROSSHAIR_ITEM_VIS menu */
|
||||
sprintf(temp_text, "P%d Visibility", player + 1);
|
||||
@ -489,9 +491,9 @@ void ui_menu_crosshair::populate()
|
||||
/* setup the selection flags */
|
||||
flags = 0;
|
||||
if (finished)
|
||||
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||
flags |= FLAG_RIGHT_ARROW;
|
||||
if (found)
|
||||
flags |= MENU_FLAG_LEFT_ARROW;
|
||||
flags |= FLAG_LEFT_ARROW;
|
||||
|
||||
/* add CROSSHAIR_ITEM_PIC menu */
|
||||
sprintf(temp_text, "P%d Crosshair", player + 1);
|
||||
@ -513,9 +515,9 @@ void ui_menu_crosshair::populate()
|
||||
|
||||
/* put on arrows in visible menu */
|
||||
if (data->cur > data->min)
|
||||
flags |= MENU_FLAG_LEFT_ARROW;
|
||||
flags |= FLAG_LEFT_ARROW;
|
||||
if (data->cur < data->max)
|
||||
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||
flags |= FLAG_RIGHT_ARROW;
|
||||
|
||||
/* add CROSSHAIR_ITEM_AUTO_TIME menu */
|
||||
sprintf(temp_text, "%d", settings.auto_time);
|
||||
@ -526,7 +528,7 @@ void ui_menu_crosshair::populate()
|
||||
// item_append("", "", nullptr, nullptr);
|
||||
}
|
||||
|
||||
ui_menu_crosshair::~ui_menu_crosshair()
|
||||
menu_crosshair::~menu_crosshair()
|
||||
{
|
||||
}
|
||||
|
||||
@ -535,37 +537,37 @@ ui_menu_crosshair::~ui_menu_crosshair()
|
||||
quitting the game
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_quit_game::ui_menu_quit_game(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_quit_game::menu_quit_game(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_quit_game::~ui_menu_quit_game()
|
||||
menu_quit_game::~menu_quit_game()
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_quit_game::populate()
|
||||
void menu_quit_game::populate()
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_quit_game::handle()
|
||||
void menu_quit_game::handle()
|
||||
{
|
||||
/* request a reset */
|
||||
machine().schedule_exit();
|
||||
|
||||
/* reset the menu stack */
|
||||
ui_menu::stack_reset(machine());
|
||||
menu::stack_reset(machine());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_export::ui_menu_export(mame_ui_manager &mui, render_container *container, std::vector<const game_driver *> drvlist)
|
||||
: ui_menu(mui, container), m_list(drvlist)
|
||||
menu_export::menu_export(mame_ui_manager &mui, render_container *container, std::vector<const game_driver *> drvlist)
|
||||
: menu(mui, container), m_list(drvlist)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_export::~ui_menu_export()
|
||||
menu_export::~menu_export()
|
||||
{
|
||||
}
|
||||
|
||||
@ -573,19 +575,19 @@ ui_menu_export::~ui_menu_export()
|
||||
// handlethe options menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_export::handle()
|
||||
void menu_export::handle()
|
||||
{
|
||||
// process the menu
|
||||
ui_menu::menu_stack->parent->process(UI_MENU_PROCESS_NOINPUT);
|
||||
const ui_menu_event *m_event = process(UI_MENU_PROCESS_NOIMAGE);
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
process_parent();
|
||||
const event *menu_event = process(PROCESS_NOIMAGE);
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
switch ((FPTR)m_event->itemref)
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
{
|
||||
case 1:
|
||||
case 3:
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
std::string filename("exported");
|
||||
emu_file infile(ui().options().ui_path(), OPEN_FLAG_READ);
|
||||
@ -616,7 +618,7 @@ void ui_menu_export::handle()
|
||||
drvlist.include(driver_list::find(*elem));
|
||||
|
||||
info_xml_creator creator(drvlist);
|
||||
creator.output(pfile, ((FPTR)m_event->itemref == 1) ? false : true);
|
||||
creator.output(pfile, ((FPTR)menu_event->itemref == 1) ? false : true);
|
||||
fclose(pfile);
|
||||
machine().popmessage(_("%s.xml saved under ui folder."), filename.c_str());
|
||||
}
|
||||
@ -625,7 +627,7 @@ void ui_menu_export::handle()
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
std::string filename("exported");
|
||||
emu_file infile(ui().options().ui_path(), OPEN_FLAG_READ);
|
||||
@ -673,21 +675,21 @@ void ui_menu_export::handle()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_export::populate()
|
||||
void menu_export::populate()
|
||||
{
|
||||
// add options items
|
||||
item_append(_("Export list in XML format (like -listxml)"), nullptr, 0, (void *)(FPTR)1);
|
||||
item_append(_("Export list in XML format (like -listxml, but exclude devices)"), nullptr, 0, (void *)(FPTR)3);
|
||||
item_append(_("Export list in TXT format (like -listfull)"), nullptr, 0, (void *)(FPTR)2);
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_machine_configure::ui_menu_machine_configure(mame_ui_manager &mui, render_container *container, const game_driver *prev, float _x0, float _y0)
|
||||
: ui_menu(mui, container)
|
||||
menu_machine_configure::menu_machine_configure(mame_ui_manager &mui, render_container *container, const game_driver *prev, float _x0, float _y0)
|
||||
: menu(mui, container)
|
||||
, m_drv(prev)
|
||||
, m_opts(mui.machine().options())
|
||||
, x0(_x0)
|
||||
@ -700,7 +702,7 @@ ui_menu_machine_configure::ui_menu_machine_configure(mame_ui_manager &mui, rende
|
||||
setup_bios();
|
||||
}
|
||||
|
||||
ui_menu_machine_configure::~ui_menu_machine_configure()
|
||||
menu_machine_configure::~menu_machine_configure()
|
||||
{
|
||||
}
|
||||
|
||||
@ -708,16 +710,16 @@ ui_menu_machine_configure::~ui_menu_machine_configure()
|
||||
// handlethe options menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_machine_configure::handle()
|
||||
void menu_machine_configure::handle()
|
||||
{
|
||||
// process the menu
|
||||
ui_menu::menu_stack->parent->process(UI_MENU_PROCESS_NOINPUT);
|
||||
const ui_menu_event *m_event = process(UI_MENU_PROCESS_NOIMAGE, x0, y0);
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
process_parent();
|
||||
const event *menu_event = process(PROCESS_NOIMAGE, x0, y0);
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
switch ((FPTR)m_event->itemref)
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
{
|
||||
case SAVE:
|
||||
{
|
||||
@ -734,36 +736,36 @@ void ui_menu_machine_configure::handle()
|
||||
}
|
||||
case ADDFAV:
|
||||
mame_machine_manager::instance()->favorite().add_favorite_game(m_drv);
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
break;
|
||||
|
||||
case DELFAV:
|
||||
mame_machine_manager::instance()->favorite().remove_favorite_game();
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
break;
|
||||
case CONTROLLER:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_submenu>(ui(), container, control_submenu_options, m_drv, &m_opts));
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<submenu>(ui(), container, submenu::control_options, m_drv, &m_opts);
|
||||
break;
|
||||
case VIDEO:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_submenu>(ui(), container, video_submenu_options, m_drv, &m_opts));
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<submenu>(ui(), container, submenu::video_options, m_drv, &m_opts);
|
||||
break;
|
||||
case ADVANCED:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_submenu>(ui(), container, advanced_submenu_options, m_drv, &m_opts));
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<submenu>(ui(), container, submenu::advanced_options, m_drv, &m_opts);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
else if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
(m_event->iptkey == IPT_UI_LEFT) ? --m_curbios : ++m_curbios;
|
||||
(menu_event->iptkey == IPT_UI_LEFT) ? --m_curbios : ++m_curbios;
|
||||
std::string error;
|
||||
m_opts.set_value(OPTION_BIOS, m_bios[m_curbios].second, OPTION_PRIORITY_CMDLINE, error);
|
||||
m_opts.mark_changed(OPTION_BIOS);
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -772,32 +774,32 @@ void ui_menu_machine_configure::handle()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_machine_configure::populate()
|
||||
void menu_machine_configure::populate()
|
||||
{
|
||||
// add options items
|
||||
item_append(_("Bios"), nullptr, MENU_FLAG_DISABLE | MENU_FLAG_UI_HEADING, nullptr);
|
||||
item_append(_("Bios"), nullptr, FLAG_DISABLE | FLAG_UI_HEADING, nullptr);
|
||||
if (!m_bios.empty())
|
||||
{
|
||||
UINT32 arrows = get_arrow_flags(0, m_bios.size() - 1, m_curbios);
|
||||
item_append(_("Driver"), m_bios[m_curbios].first.c_str(), arrows, (void *)(FPTR)BIOS);
|
||||
}
|
||||
else
|
||||
item_append(_("This machine has no bios."), nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(_("This machine has no bios."), nullptr, FLAG_DISABLE, nullptr);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(_(advanced_submenu_options[0].description), nullptr, 0, (void *)(FPTR)ADVANCED);
|
||||
item_append(_(video_submenu_options[0].description), nullptr, 0, (void *)(FPTR)VIDEO);
|
||||
item_append(_(control_submenu_options[0].description), nullptr, 0, (void *)(FPTR)CONTROLLER);
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_(submenu::advanced_options[0].description), nullptr, 0, (void *)(FPTR)ADVANCED);
|
||||
item_append(_(submenu::video_options[0].description), nullptr, 0, (void *)(FPTR)VIDEO);
|
||||
item_append(_(submenu::control_options[0].description), nullptr, 0, (void *)(FPTR)CONTROLLER);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
if (!mame_machine_manager::instance()->favorite().isgame_favorite(m_drv))
|
||||
item_append(_("Add To Favorites"), nullptr, 0, (void *)ADDFAV);
|
||||
else
|
||||
item_append(_("Remove From Favorites"), nullptr, 0, (void *)DELFAV);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("Save machine configuration"), nullptr, 0, (void *)(FPTR)SAVE);
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
customtop = 2.0f * ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
}
|
||||
|
||||
@ -805,7 +807,7 @@ void ui_menu_machine_configure::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_machine_configure::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_machine_configure::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
std::string text[2];
|
||||
@ -846,7 +848,7 @@ void ui_menu_machine_configure::custom_render(void *selectedref, float top, floa
|
||||
}
|
||||
}
|
||||
|
||||
void ui_menu_machine_configure::setup_bios()
|
||||
void menu_machine_configure::setup_bios()
|
||||
{
|
||||
if (m_drv->rom == nullptr)
|
||||
return;
|
||||
@ -889,12 +891,12 @@ void ui_menu_machine_configure::setup_bios()
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_plugins_configure::ui_menu_plugins_configure(mame_ui_manager &mui, render_container *container)
|
||||
: ui_menu(mui, container)
|
||||
menu_plugins_configure::menu_plugins_configure(mame_ui_manager &mui, render_container *container)
|
||||
: menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_plugins_configure::~ui_menu_plugins_configure()
|
||||
menu_plugins_configure::~menu_plugins_configure()
|
||||
{
|
||||
emu_file file_plugin(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
|
||||
if (file_plugin.open("plugin.ini") != osd_file::error::NONE)
|
||||
@ -907,32 +909,32 @@ ui_menu_plugins_configure::~ui_menu_plugins_configure()
|
||||
// handlethe options menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_plugins_configure::handle()
|
||||
void menu_plugins_configure::handle()
|
||||
{
|
||||
// process the menu
|
||||
bool changed = false;
|
||||
plugin_options& plugins = mame_machine_manager::instance()->plugins();
|
||||
ui_menu::menu_stack->parent->process(UI_MENU_PROCESS_NOINPUT);
|
||||
const ui_menu_event *m_event = process(UI_MENU_PROCESS_NOIMAGE);
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
process_parent();
|
||||
const event *menu_event = process(PROCESS_NOIMAGE);
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT || menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
int oldval = plugins.int_value((const char*)m_event->itemref);
|
||||
int oldval = plugins.int_value((const char*)menu_event->itemref);
|
||||
std::string error_string;
|
||||
plugins.set_value((const char*)m_event->itemref, oldval == 1 ? 0 : 1, OPTION_PRIORITY_CMDLINE, error_string);
|
||||
plugins.set_value((const char*)menu_event->itemref, oldval == 1 ? 0 : 1, OPTION_PRIORITY_CMDLINE, error_string);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_plugins_configure::populate()
|
||||
void menu_plugins_configure::populate()
|
||||
{
|
||||
plugin_options& plugins = mame_machine_manager::instance()->plugins();
|
||||
|
||||
@ -942,10 +944,10 @@ void ui_menu_plugins_configure::populate()
|
||||
{
|
||||
auto enabled = std::string(curentry.value()) == "1";
|
||||
item_append(curentry.description(), enabled ? _("On") : _("Off"),
|
||||
enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)curentry.name());
|
||||
enabled ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(FPTR)curentry.name());
|
||||
}
|
||||
}
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
customtop = ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
|
||||
}
|
||||
|
||||
@ -953,7 +955,7 @@ void ui_menu_plugins_configure::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_plugins_configure::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_plugins_configure::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
@ -980,3 +982,5 @@ void ui_menu_plugins_configure::custom_render(void *selectedref, float top, floa
|
||||
ui().draw_text_full(container, _("Plugins"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
}
|
||||
|
||||
} // namespace ui
|
@ -10,34 +10,41 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_MISCMENU_H__
|
||||
#define __UI_MISCMENU_H__
|
||||
#ifndef MAME_FRONTEND_UI_MISCMENU_H
|
||||
#define MAME_FRONTEND_UI_MISCMENU_H
|
||||
|
||||
#include "crsshair.h"
|
||||
#include "emuopts.h"
|
||||
|
||||
using s_bios = std::vector<std::pair<std::string, int>>;
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class ui_menu_keyboard_mode : public ui_menu {
|
||||
|
||||
namespace ui {
|
||||
|
||||
class menu_keyboard_mode : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_keyboard_mode(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_keyboard_mode();
|
||||
menu_keyboard_mode(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_keyboard_mode();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
};
|
||||
|
||||
class ui_menu_network_devices : public ui_menu {
|
||||
class menu_network_devices : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_network_devices(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_network_devices();
|
||||
menu_network_devices(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_network_devices();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
};
|
||||
|
||||
class ui_menu_bookkeeping : public ui_menu {
|
||||
class menu_bookkeeping : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_bookkeeping(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_bookkeeping();
|
||||
menu_bookkeeping(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_bookkeeping();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -45,10 +52,11 @@ private:
|
||||
attotime prevtime;
|
||||
};
|
||||
|
||||
class ui_menu_crosshair : public ui_menu {
|
||||
class menu_crosshair : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_crosshair(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_crosshair();
|
||||
menu_crosshair(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_crosshair();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -71,18 +79,20 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
class ui_menu_quit_game : public ui_menu {
|
||||
class menu_quit_game : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_quit_game(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_quit_game();
|
||||
menu_quit_game(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_quit_game();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
};
|
||||
|
||||
class ui_menu_bios_selection : public ui_menu {
|
||||
class menu_bios_selection : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_bios_selection(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_bios_selection();
|
||||
menu_bios_selection(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_bios_selection();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
};
|
||||
@ -92,11 +102,11 @@ public:
|
||||
// export menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_export : public ui_menu
|
||||
class menu_export : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_export(mame_ui_manager &mui, render_container *container, std::vector<const game_driver*> list);
|
||||
virtual ~ui_menu_export();
|
||||
menu_export(mame_ui_manager &mui, render_container *container, std::vector<const game_driver*> list);
|
||||
virtual ~menu_export();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -108,16 +118,18 @@ private:
|
||||
// machine configure menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_machine_configure : public ui_menu
|
||||
class menu_machine_configure : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_machine_configure(mame_ui_manager &mui, render_container *container, const game_driver *prev, float x0 = 0.0f, float y0 = 0.0f);
|
||||
virtual ~ui_menu_machine_configure();
|
||||
menu_machine_configure(mame_ui_manager &mui, render_container *container, const game_driver *prev, float x0 = 0.0f, float y0 = 0.0f);
|
||||
virtual ~menu_machine_configure();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
|
||||
private:
|
||||
using s_bios = std::vector<std::pair<std::string, int>>;
|
||||
|
||||
enum
|
||||
{
|
||||
ADDFAV = 1,
|
||||
@ -141,14 +153,16 @@ private:
|
||||
// plugins configure menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_plugins_configure : public ui_menu
|
||||
class menu_plugins_configure : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_plugins_configure(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_plugins_configure();
|
||||
menu_plugins_configure(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_plugins_configure();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
};
|
||||
|
||||
#endif /* __UI_MISCMENU_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_MISCMENU_H */
|
||||
|
@ -9,26 +9,30 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "mame.h"
|
||||
#include "mameopts.h"
|
||||
|
||||
#include "ui/optsmenu.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/submenu.h"
|
||||
#include "ui/inifile.h"
|
||||
#include "ui/selector.h"
|
||||
#include "ui/custui.h"
|
||||
#include "ui/sndmenu.h"
|
||||
#include "ui/optsmenu.h"
|
||||
#include "ui/custmenu.h"
|
||||
#include "ui/inputmap.h"
|
||||
#include "ui/dirmenu.h"
|
||||
|
||||
#include "mame.h"
|
||||
#include "mameopts.h"
|
||||
#include "rendfont.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_game_options::ui_menu_game_options(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_game_options::menu_game_options(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
m_main = main_filters::actual;
|
||||
}
|
||||
@ -37,11 +41,10 @@ ui_menu_game_options::ui_menu_game_options(mame_ui_manager &mui, render_containe
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_game_options::~ui_menu_game_options()
|
||||
menu_game_options::~menu_game_options()
|
||||
{
|
||||
main_filters::actual = m_main;
|
||||
if (ui_menu::menu_stack != nullptr)
|
||||
ui_menu::menu_stack->reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset_topmost(reset_options::SELECT_FIRST);
|
||||
ui().save_ui_options();
|
||||
ui_globals::switch_image = true;
|
||||
}
|
||||
@ -50,56 +53,56 @@ ui_menu_game_options::~ui_menu_game_options()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_game_options::handle()
|
||||
void menu_game_options::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event;
|
||||
const event *menu_event;
|
||||
if (strcmp(machine().options().ui(), "simple") == 0)
|
||||
{
|
||||
m_event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
menu_event = process(PROCESS_LR_REPEAT);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_menu::menu_stack->parent->process(UI_MENU_PROCESS_NOINPUT);
|
||||
m_event = process(UI_MENU_PROCESS_LR_REPEAT | UI_MENU_PROCESS_NOIMAGE);
|
||||
process_parent();
|
||||
menu_event = process(PROCESS_LR_REPEAT | PROCESS_NOIMAGE);
|
||||
}
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
switch ((FPTR)m_event->itemref)
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
{
|
||||
case FILTER_MENU:
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
(m_event->iptkey == IPT_UI_RIGHT) ? ++m_main : --m_main;
|
||||
(menu_event->iptkey == IPT_UI_RIGHT) ? ++m_main : --m_main;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
int total = main_filters::length;
|
||||
std::vector<std::string> s_sel(total);
|
||||
for (int index = 0; index < total; ++index)
|
||||
s_sel[index] = main_filters::text[index];
|
||||
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, s_sel, m_main));
|
||||
menu::stack_push<menu_selector>(ui(), container, s_sel, m_main);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FILE_CATEGORY_FILTER:
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_LEFT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT)
|
||||
{
|
||||
mame_machine_manager::instance()->inifile().move_file(-1);
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
mame_machine_manager::instance()->inifile().move_file(1);
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
inifile_manager &ifile = mame_machine_manager::instance()->inifile();
|
||||
int total = ifile.total();
|
||||
@ -108,23 +111,23 @@ void ui_menu_game_options::handle()
|
||||
for (size_t index = 0; index < total; ++index)
|
||||
s_sel[index] = ifile.get_file(index);
|
||||
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, s_sel, ifile.cur_file(), SELECTOR_INIFILE));
|
||||
menu::stack_push<menu_selector>(ui(), container, s_sel, ifile.cur_file(), menu_selector::INIFILE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CATEGORY_FILTER:
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_LEFT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT)
|
||||
{
|
||||
mame_machine_manager::instance()->inifile().move_cat(-1);
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
mame_machine_manager::instance()->inifile().move_cat(1);
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
inifile_manager &ifile = mame_machine_manager::instance()->inifile();
|
||||
int total = ifile.cat_total();
|
||||
@ -132,93 +135,93 @@ void ui_menu_game_options::handle()
|
||||
for (int index = 0; index < total; ++index)
|
||||
s_sel[index] = ifile.get_category(index);
|
||||
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, s_sel, ifile.cur_cat(), SELECTOR_CATEGORY));
|
||||
menu::stack_push<menu_selector>(ui(), container, s_sel, ifile.cur_cat(), menu_selector::CATEGORY);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MANUFACT_CAT_FILTER:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
(m_event->iptkey == IPT_UI_RIGHT) ? c_mnfct::actual++ : c_mnfct::actual--;
|
||||
(menu_event->iptkey == IPT_UI_RIGHT) ? c_mnfct::actual++ : c_mnfct::actual--;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, c_mnfct::ui, c_mnfct::actual));
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_selector>(ui(), container, c_mnfct::ui, c_mnfct::actual);
|
||||
|
||||
break;
|
||||
case YEAR_CAT_FILTER:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
(m_event->iptkey == IPT_UI_RIGHT) ? c_year::actual++ : c_year::actual--;
|
||||
(menu_event->iptkey == IPT_UI_RIGHT) ? c_year::actual++ : c_year::actual--;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, c_year::ui, c_year::actual));
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_selector>(ui(), container, c_year::ui, c_year::actual);
|
||||
|
||||
break;
|
||||
case CONF_DIR:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_directory>(ui(), container));
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_directory>(ui(), container);
|
||||
break;
|
||||
case MISC_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_submenu>(ui(), container, misc_submenu_options));
|
||||
menu::stack_push<submenu>(ui(), container, submenu::misc_options);
|
||||
ui_globals::reset = true;
|
||||
}
|
||||
break;
|
||||
case SOUND_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_sound_options>(ui(), container));
|
||||
menu::stack_push<menu_sound_options>(ui(), container);
|
||||
ui_globals::reset = true;
|
||||
}
|
||||
break;
|
||||
case DISPLAY_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_submenu>(ui(), container, video_submenu_options));
|
||||
menu::stack_push<submenu>(ui(), container, submenu::video_options);
|
||||
ui_globals::reset = true;
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_custom_ui>(ui(), container));
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_custom_ui>(ui(), container);
|
||||
break;
|
||||
case CONTROLLER_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_submenu>(ui(), container, control_submenu_options));
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<submenu>(ui(), container, submenu::control_options);
|
||||
break;
|
||||
case CGI_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_input_groups>(ui(), container));
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_input_groups>(ui(), container);
|
||||
break;
|
||||
case CUSTOM_FILTER:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_custom_filter>(ui(), container));
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_custom_filter>(ui(), container);
|
||||
break;
|
||||
case ADVANCED_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_submenu>(ui(), container, advanced_submenu_options));
|
||||
menu::stack_push<submenu>(ui(), container, submenu::advanced_options);
|
||||
ui_globals::reset = true;
|
||||
}
|
||||
break;
|
||||
case SAVE_CONFIG:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
ui().save_main_option();
|
||||
break;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_game_options::populate()
|
||||
void menu_game_options::populate()
|
||||
{
|
||||
if (strcmp(machine().options().ui(),"simple")!=0)
|
||||
{
|
||||
@ -268,19 +271,19 @@ void ui_menu_game_options::populate()
|
||||
item_append(fbuff.c_str(), nullptr, 0, (void *)(FPTR)CUSTOM_FILTER);
|
||||
}
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
// add options items
|
||||
item_append(_("Customize UI"), nullptr, 0, (void *)(FPTR)CUSTOM_MENU);
|
||||
item_append(_("Configure Directories"), nullptr, 0, (void *)(FPTR)CONF_DIR);
|
||||
}
|
||||
item_append(_(video_submenu_options[0].description), nullptr, 0, (void *)(FPTR)DISPLAY_MENU);
|
||||
item_append(_(submenu::video_options[0].description), nullptr, 0, (void *)(FPTR)DISPLAY_MENU);
|
||||
item_append(_("Sound Options"), nullptr, 0, (void *)(FPTR)SOUND_MENU);
|
||||
item_append(_(misc_submenu_options[0].description), nullptr, 0, (void *)(FPTR)MISC_MENU);
|
||||
item_append(_(control_submenu_options[0].description), nullptr, 0, (void *)(FPTR)CONTROLLER_MENU);
|
||||
item_append(_(submenu::misc_options[0].description), nullptr, 0, (void *)(FPTR)MISC_MENU);
|
||||
item_append(_(submenu::control_options[0].description), nullptr, 0, (void *)(FPTR)CONTROLLER_MENU);
|
||||
item_append(_("General Inputs"), nullptr, 0, (void *)(FPTR)CGI_MENU);
|
||||
item_append(_(advanced_submenu_options[0].description), nullptr, 0, (void *)(FPTR)ADVANCED_MENU);
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(_(submenu::advanced_options[0].description), nullptr, 0, (void *)(FPTR)ADVANCED_MENU);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("Save Configuration"), nullptr, 0, (void *)(FPTR)SAVE_CONFIG);
|
||||
|
||||
custombottom = 2.0f * ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
@ -291,7 +294,7 @@ void ui_menu_game_options::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_game_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_game_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
ui().draw_text_full(container, _("Settings"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
@ -317,3 +320,6 @@ void ui_menu_game_options::custom_render(void *selectedref, float top, float bot
|
||||
ui().draw_text_full(container, _("Settings"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
}
|
||||
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,14 +10,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_OPTSMENU_H__
|
||||
#define __UI_OPTSMENU_H__
|
||||
#ifndef MAME_FRONTEND_UI_OPTSMENU_H
|
||||
#define MAME_FRONTEND_UI_OPTSMENU_H
|
||||
|
||||
class ui_menu_game_options : public ui_menu
|
||||
#include "ui/menu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
class menu_game_options : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_game_options(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_game_options();
|
||||
menu_game_options(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_game_options() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -46,4 +50,6 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* __UI_OPTSMENU_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_OPTSMENU_H */
|
||||
|
@ -9,48 +9,52 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "mame.h"
|
||||
#include "luaengine.h"
|
||||
|
||||
#include "ui/pluginopt.h"
|
||||
|
||||
void ui_menu_plugin::handle()
|
||||
#include "mame.h"
|
||||
#include "luaengine.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
void menu_plugin::handle()
|
||||
{
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_plugin_opt>(ui(), container, (char *)menu_event->itemref));
|
||||
menu::stack_push<menu_plugin_opt>(ui(), container, (char *)menu_event->itemref);
|
||||
}
|
||||
}
|
||||
|
||||
ui_menu_plugin::ui_menu_plugin(mame_ui_manager &mui, render_container *container) :
|
||||
ui_menu(mui, container),
|
||||
menu_plugin::menu_plugin(mame_ui_manager &mui, render_container *container) :
|
||||
menu(mui, container),
|
||||
m_plugins(mame_machine_manager::instance()->lua()->get_menu())
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_plugin::populate()
|
||||
void menu_plugin::populate()
|
||||
{
|
||||
for (auto &curplugin : m_plugins)
|
||||
item_append(curplugin.c_str(), nullptr, 0, (void *)curplugin.c_str());
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
}
|
||||
|
||||
ui_menu_plugin::~ui_menu_plugin()
|
||||
menu_plugin::~menu_plugin()
|
||||
{
|
||||
}
|
||||
|
||||
ui_menu_plugin_opt::ui_menu_plugin_opt(mame_ui_manager &mui, render_container *container, char *menu) :
|
||||
ui_menu(mui, container),
|
||||
menu_plugin_opt::menu_plugin_opt(mame_ui_manager &mui, render_container *container, char *menu) :
|
||||
ui::menu(mui, container),
|
||||
m_menu(menu)
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_plugin_opt::handle()
|
||||
void menu_plugin_opt::handle()
|
||||
{
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (menu_event != nullptr && (FPTR)menu_event->itemref)
|
||||
{
|
||||
@ -82,11 +86,11 @@ void ui_menu_plugin_opt::handle()
|
||||
return;
|
||||
}
|
||||
if(mame_machine_manager::instance()->lua()->menu_callback(m_menu, (FPTR)menu_event->itemref, key))
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
}
|
||||
|
||||
void ui_menu_plugin_opt::populate()
|
||||
void menu_plugin_opt::populate()
|
||||
{
|
||||
std::vector<lua_engine::menu_item> menu_list;
|
||||
mame_machine_manager::instance()->lua()->menu_populate(m_menu, menu_list);
|
||||
@ -95,19 +99,21 @@ void ui_menu_plugin_opt::populate()
|
||||
{
|
||||
UINT32 flags = 0;
|
||||
if(item.flags == "off")
|
||||
flags = MENU_FLAG_DISABLE;
|
||||
flags = FLAG_DISABLE;
|
||||
else if(item.flags == "l")
|
||||
flags = MENU_FLAG_LEFT_ARROW;
|
||||
flags = FLAG_LEFT_ARROW;
|
||||
else if(item.flags == "r")
|
||||
flags = MENU_FLAG_RIGHT_ARROW;
|
||||
flags = FLAG_RIGHT_ARROW;
|
||||
else if(item.flags == "lr")
|
||||
flags = MENU_FLAG_RIGHT_ARROW | MENU_FLAG_LEFT_ARROW;
|
||||
flags = FLAG_RIGHT_ARROW | FLAG_LEFT_ARROW;
|
||||
|
||||
item_append(item.text.c_str(), item.subtext.c_str(), flags, (void *)i++);
|
||||
}
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
}
|
||||
|
||||
ui_menu_plugin_opt::~ui_menu_plugin_opt()
|
||||
menu_plugin_opt::~menu_plugin_opt()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,29 +10,40 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_PLUGINOPT_H__
|
||||
#define __UI_PLUGINOPT_H__
|
||||
#ifndef MAME_FRONTEND_UI_PLUGINOPT_H
|
||||
#define MAME_FRONTEND_UI_PLUGINOPT_H
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
|
||||
class ui_menu_plugin : public ui_menu {
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
class menu_plugin : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_plugin(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_plugin();
|
||||
menu_plugin(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_plugin();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
private:
|
||||
std::vector<std::string> &m_plugins;
|
||||
};
|
||||
|
||||
class ui_menu_plugin_opt : public ui_menu {
|
||||
class menu_plugin_opt : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_plugin_opt(mame_ui_manager &mui, render_container *container, char *menu);
|
||||
virtual ~ui_menu_plugin_opt();
|
||||
menu_plugin_opt(mame_ui_manager &mui, render_container *container, char *menu);
|
||||
virtual ~menu_plugin_opt();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
private:
|
||||
std::string m_menu;
|
||||
};
|
||||
#endif /* __UI_PLUGINOPT_H__ */
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_PLUGINOPT_H */
|
||||
|
@ -9,18 +9,21 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "mame.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
|
||||
#include "ui/selector.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/inifile.h"
|
||||
|
||||
#include "mame.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_selector::ui_menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> const &s_sel, UINT16 &s_actual, int category, int _hover)
|
||||
: ui_menu(mui, container)
|
||||
menu_selector::menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> const &s_sel, UINT16 &s_actual, int category, int _hover)
|
||||
: menu(mui, container)
|
||||
, m_selector(s_actual)
|
||||
, m_category(category)
|
||||
, m_hover(_hover)
|
||||
@ -31,8 +34,8 @@ ui_menu_selector::ui_menu_selector(mame_ui_manager &mui, render_container *conta
|
||||
m_searchlist[0] = nullptr;
|
||||
}
|
||||
|
||||
ui_menu_selector::ui_menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> &&s_sel, UINT16 &s_actual, int category, int _hover)
|
||||
: ui_menu(mui, container)
|
||||
menu_selector::menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> &&s_sel, UINT16 &s_actual, int category, int _hover)
|
||||
: menu(mui, container)
|
||||
, m_selector(s_actual)
|
||||
, m_category(category)
|
||||
, m_hover(_hover)
|
||||
@ -43,7 +46,7 @@ ui_menu_selector::ui_menu_selector(mame_ui_manager &mui, render_container *conta
|
||||
m_searchlist[0] = nullptr;
|
||||
}
|
||||
|
||||
ui_menu_selector::~ui_menu_selector()
|
||||
menu_selector::~menu_selector()
|
||||
{
|
||||
}
|
||||
|
||||
@ -51,75 +54,75 @@ ui_menu_selector::~ui_menu_selector()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_selector::handle()
|
||||
void menu_selector::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
for (size_t idx = 0; idx < m_str_items.size(); ++idx)
|
||||
if ((void*)&m_str_items[idx] == m_event->itemref)
|
||||
if ((void*)&m_str_items[idx] == menu_event->itemref)
|
||||
m_selector = idx;
|
||||
|
||||
switch (m_category)
|
||||
{
|
||||
case SELECTOR_INIFILE:
|
||||
mame_machine_manager::instance()->inifile().set_file(m_selector);
|
||||
mame_machine_manager::instance()->inifile().set_cat(0);
|
||||
ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
break;
|
||||
case INIFILE:
|
||||
mame_machine_manager::instance()->inifile().set_file(m_selector);
|
||||
mame_machine_manager::instance()->inifile().set_cat(0);
|
||||
reset_parent(reset_options::REMEMBER_REF);
|
||||
break;
|
||||
|
||||
case SELECTOR_CATEGORY:
|
||||
mame_machine_manager::instance()->inifile().set_cat(m_selector);
|
||||
ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
break;
|
||||
case CATEGORY:
|
||||
mame_machine_manager::instance()->inifile().set_cat(m_selector);
|
||||
reset_parent(reset_options::REMEMBER_REF);
|
||||
break;
|
||||
|
||||
case SELECTOR_GAME:
|
||||
main_filters::actual = m_hover;
|
||||
ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
break;
|
||||
case GAME:
|
||||
main_filters::actual = m_hover;
|
||||
reset_parent(reset_options::SELECT_FIRST);
|
||||
break;
|
||||
|
||||
case SELECTOR_SOFTWARE:
|
||||
sw_filters::actual = m_hover;
|
||||
ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
break;
|
||||
case SOFTWARE:
|
||||
sw_filters::actual = m_hover;
|
||||
reset_parent(reset_options::SELECT_FIRST);
|
||||
break;
|
||||
|
||||
default:
|
||||
ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
break;
|
||||
default:
|
||||
reset_parent(reset_options::REMEMBER_REF);
|
||||
break;
|
||||
}
|
||||
|
||||
ui_globals::switch_image = true;
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
else if (m_event->iptkey == IPT_SPECIAL)
|
||||
else if (menu_event->iptkey == IPT_SPECIAL)
|
||||
{
|
||||
int buflen = strlen(m_search);
|
||||
|
||||
// if it's a backspace and we can handle it, do so
|
||||
if ((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0)
|
||||
if ((menu_event->unichar == 8 || menu_event->unichar == 0x7f) && buflen > 0)
|
||||
{
|
||||
*(char *)utf8_previous_char(&m_search[buflen]) = 0;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
|
||||
// if it's any other key and we're not maxed out, update
|
||||
else if (m_event->unichar >= ' ' && m_event->unichar < 0x7f)
|
||||
else if (menu_event->unichar >= ' ' && menu_event->unichar < 0x7f)
|
||||
{
|
||||
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar);
|
||||
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, menu_event->unichar);
|
||||
m_search[buflen] = 0;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
}
|
||||
|
||||
// escape pressed with non-empty text clears the text
|
||||
else if (m_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0)
|
||||
else if (menu_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0)
|
||||
{
|
||||
m_search[0] = '\0';
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,7 +131,7 @@ void ui_menu_selector::handle()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_selector::populate()
|
||||
void menu_selector::populate()
|
||||
{
|
||||
if (m_search[0] != 0)
|
||||
{
|
||||
@ -150,7 +153,7 @@ void ui_menu_selector::populate()
|
||||
}
|
||||
}
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
customtop = custombottom = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
|
||||
m_first_pass = false;
|
||||
}
|
||||
@ -159,7 +162,7 @@ void ui_menu_selector::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
std::string tempbuf = std::string(_("Selection List - Search: ")).append(m_search).append("_");
|
||||
@ -221,7 +224,7 @@ void ui_menu_selector::custom_render(void *selectedref, float top, float bottom,
|
||||
// find approximate matches
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_selector::find_matches(const char *str)
|
||||
void menu_selector::find_matches(const char *str)
|
||||
{
|
||||
// allocate memory to track the penalty value
|
||||
std::vector<int> penalty(VISIBLE_GAMES_IN_SEARCH, 9999);
|
||||
@ -255,3 +258,5 @@ void ui_menu_selector::find_matches(const char *str)
|
||||
}
|
||||
(index < VISIBLE_GAMES_IN_SEARCH) ? m_searchlist[index] = nullptr : m_searchlist[VISIBLE_GAMES_IN_SEARCH] = nullptr;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,27 +10,31 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_SELECTOR_H__
|
||||
#define __UI_SELECTOR_H__
|
||||
#ifndef MAME_FRONTEND_UI_SELECTOR_H
|
||||
#define MAME_FRONTEND_UI_SELECTOR_H
|
||||
|
||||
enum
|
||||
{
|
||||
SELECTOR_INIFILE = 1,
|
||||
SELECTOR_CATEGORY,
|
||||
SELECTOR_GAME,
|
||||
SELECTOR_SOFTWARE
|
||||
};
|
||||
#include "ui/menu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// class selector menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_selector : public ui_menu
|
||||
class menu_selector : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> const &_sel, UINT16 &_actual, int _category = 0, int _hover = 0);
|
||||
ui_menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> &&_sel, UINT16 &_actual, int _category = 0, int _hover = 0);
|
||||
virtual ~ui_menu_selector();
|
||||
enum
|
||||
{
|
||||
INIFILE = 1,
|
||||
CATEGORY,
|
||||
GAME,
|
||||
SOFTWARE
|
||||
};
|
||||
|
||||
menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> const &_sel, UINT16 &_actual, int _category = 0, int _hover = 0);
|
||||
menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> &&_sel, UINT16 &_actual, int _category = 0, int _hover = 0);
|
||||
virtual ~menu_selector() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -49,4 +53,6 @@ private:
|
||||
void find_matches(const char *str);
|
||||
};
|
||||
|
||||
#endif /* __UI_SELECTOR_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_SELECTOR_H */
|
||||
|
@ -9,29 +9,35 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "mame.h"
|
||||
#include "emuopts.h"
|
||||
#include "ui/ui.h"
|
||||
#include "uiinput.h"
|
||||
|
||||
#include "ui/selgame.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/miscmenu.h"
|
||||
#include "drivenum.h"
|
||||
#include "audit.h"
|
||||
#include "ui/datfile.h"
|
||||
#include "ui/inifile.h"
|
||||
#include "rendfont.h"
|
||||
#include "ui/datmenu.h"
|
||||
#include "ui/optsmenu.h"
|
||||
#include "ui/selector.h"
|
||||
#include "ui/selsoft.h"
|
||||
#include "ui/custmenu.h"
|
||||
#include "../info.h"
|
||||
#include "ui/auditmenu.h"
|
||||
|
||||
#include "../info.h"
|
||||
|
||||
#include "audit.h"
|
||||
#include "drivenum.h"
|
||||
#include "emuopts.h"
|
||||
#include "mame.h"
|
||||
#include "rendfont.h"
|
||||
#include "rendutil.h"
|
||||
#include "softlist.h"
|
||||
#include "uiinput.h"
|
||||
|
||||
extern const char UI_VERSION_TAG[];
|
||||
|
||||
namespace ui {
|
||||
|
||||
static bool first_start = true;
|
||||
static const char *dats_info[] = {
|
||||
__("General Info"),
|
||||
@ -43,14 +49,14 @@ static const char *dats_info[] = {
|
||||
__("Gameinit"),
|
||||
__("Mamescore") };
|
||||
|
||||
std::vector<const game_driver *> ui_menu_select_game::m_sortedlist;
|
||||
int ui_menu_select_game::m_isabios = 0;
|
||||
std::vector<const game_driver *> menu_select_game::m_sortedlist;
|
||||
int menu_select_game::m_isabios = 0;
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_select_game::ui_menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename) : ui_menu(mui, container)
|
||||
menu_select_game::menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename) : menu(mui, container)
|
||||
{
|
||||
m_focus = focused_menu::main;
|
||||
highlight = 0;
|
||||
@ -137,7 +143,7 @@ ui_menu_select_game::ui_menu_select_game(mame_ui_manager &mui, render_container
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_select_game::~ui_menu_select_game()
|
||||
menu_select_game::~menu_select_game()
|
||||
{
|
||||
std::string error_string, last_driver;
|
||||
const game_driver *driver = nullptr;
|
||||
@ -170,7 +176,7 @@ ui_menu_select_game::~ui_menu_select_game()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::handle()
|
||||
void menu_select_game::handle()
|
||||
{
|
||||
if (m_prev_selected == nullptr)
|
||||
m_prev_selected = item[0].ref;
|
||||
@ -183,7 +189,7 @@ void ui_menu_select_game::handle()
|
||||
{
|
||||
ui_globals::reset = false;
|
||||
machine().schedule_hard_reset();
|
||||
ui_menu::stack_reset(machine());
|
||||
menu::stack_reset(machine());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -191,7 +197,7 @@ void ui_menu_select_game::handle()
|
||||
if (reselect_last::get())
|
||||
{
|
||||
const game_driver *driver = (const game_driver *)item[selected].ref;
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_select_software>(ui(), container, driver));
|
||||
menu::stack_push<menu_select_software>(ui(), container, driver);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -199,10 +205,10 @@ void ui_menu_select_game::handle()
|
||||
machine().ui_input().pressed(IPT_UI_PAUSE);
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
const event *menu_event = process(PROCESS_LR_REPEAT);
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
// reset the error on any future m_event
|
||||
// reset the error on any future menu_event
|
||||
if (ui_error)
|
||||
{
|
||||
ui_error = false;
|
||||
@ -210,14 +216,14 @@ void ui_menu_select_game::handle()
|
||||
}
|
||||
|
||||
// handle selections
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
if (m_focus == focused_menu::main)
|
||||
{
|
||||
if (isfavorite())
|
||||
inkey_select_favorite(m_event);
|
||||
inkey_select_favorite(menu_event);
|
||||
else
|
||||
inkey_select(m_event);
|
||||
inkey_select(menu_event);
|
||||
}
|
||||
else if (m_focus == focused_menu::left)
|
||||
{
|
||||
@ -228,14 +234,14 @@ void ui_menu_select_game::handle()
|
||||
}
|
||||
|
||||
// handle IPT_CUSTOM (mouse right click)
|
||||
else if (m_event->iptkey == IPT_CUSTOM)
|
||||
else if (menu_event->iptkey == IPT_CUSTOM)
|
||||
{
|
||||
if (!isfavorite())
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_machine_configure>(ui(), container, (const game_driver *)m_prev_selected, m_event->mouse.x0, m_event->mouse.y0));
|
||||
menu::stack_push<menu_machine_configure>(ui(), container, (const game_driver *)m_prev_selected, menu_event->mouse.x0, menu_event->mouse.y0);
|
||||
}
|
||||
|
||||
// handle UI_LEFT
|
||||
else if (m_event->iptkey == IPT_UI_LEFT)
|
||||
else if (menu_event->iptkey == IPT_UI_LEFT)
|
||||
{
|
||||
// Images
|
||||
if (ui_globals::rpanel == RP_IMAGES && ui_globals::curimage_view > FIRST_VIEW)
|
||||
@ -250,7 +256,7 @@ void ui_menu_select_game::handle()
|
||||
{
|
||||
if (!isfavorite())
|
||||
{
|
||||
const game_driver *drv = (const game_driver *)m_event->itemref;
|
||||
const game_driver *drv = (const game_driver *)menu_event->itemref;
|
||||
if ((FPTR)drv > skip_main_items && ui_globals::curdats_view > UI_FIRST_LOAD)
|
||||
{
|
||||
ui_globals::curdats_view--;
|
||||
@ -259,7 +265,7 @@ void ui_menu_select_game::handle()
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_software_info *drv = (ui_software_info *)m_event->itemref;
|
||||
ui_software_info *drv = (ui_software_info *)menu_event->itemref;
|
||||
if (drv->startempty == 1 && ui_globals::curdats_view > UI_FIRST_LOAD)
|
||||
{
|
||||
ui_globals::curdats_view--;
|
||||
@ -275,7 +281,7 @@ void ui_menu_select_game::handle()
|
||||
}
|
||||
|
||||
// handle UI_RIGHT
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
// Images
|
||||
if (ui_globals::rpanel == RP_IMAGES && ui_globals::curimage_view < LAST_VIEW)
|
||||
@ -290,7 +296,7 @@ void ui_menu_select_game::handle()
|
||||
{
|
||||
if (!isfavorite())
|
||||
{
|
||||
const game_driver *drv = (const game_driver *)m_event->itemref;
|
||||
const game_driver *drv = (const game_driver *)menu_event->itemref;
|
||||
if ((FPTR)drv > skip_main_items && ui_globals::curdats_view < UI_LAST_LOAD)
|
||||
{
|
||||
ui_globals::curdats_view++;
|
||||
@ -299,7 +305,7 @@ void ui_menu_select_game::handle()
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_software_info *drv = (ui_software_info *)m_event->itemref;
|
||||
ui_software_info *drv = (ui_software_info *)menu_event->itemref;
|
||||
if (drv->startempty == 1 && ui_globals::curdats_view < UI_LAST_LOAD)
|
||||
{
|
||||
ui_globals::curdats_view++;
|
||||
@ -315,62 +321,62 @@ void ui_menu_select_game::handle()
|
||||
}
|
||||
|
||||
// handle UI_UP_FILTER
|
||||
else if (m_event->iptkey == IPT_UI_UP_FILTER && highlight > FILTER_FIRST)
|
||||
else if (menu_event->iptkey == IPT_UI_UP_FILTER && highlight > FILTER_FIRST)
|
||||
{
|
||||
highlight--;
|
||||
}
|
||||
|
||||
// handle UI_DOWN_FILTER
|
||||
else if (m_event->iptkey == IPT_UI_DOWN_FILTER && highlight < FILTER_LAST)
|
||||
else if (menu_event->iptkey == IPT_UI_DOWN_FILTER && highlight < FILTER_LAST)
|
||||
{
|
||||
highlight++;
|
||||
}
|
||||
|
||||
// handle UI_LEFT_PANEL
|
||||
else if (m_event->iptkey == IPT_UI_LEFT_PANEL)
|
||||
else if (menu_event->iptkey == IPT_UI_LEFT_PANEL)
|
||||
ui_globals::rpanel = RP_IMAGES;
|
||||
|
||||
// handle UI_RIGHT_PANEL
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT_PANEL)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT_PANEL)
|
||||
ui_globals::rpanel = RP_INFOS;
|
||||
|
||||
// escape pressed with non-empty text clears the text
|
||||
else if (m_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0)
|
||||
else if (menu_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0)
|
||||
{
|
||||
m_search[0] = '\0';
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
|
||||
// handle UI_DATS
|
||||
else if (m_event->iptkey == IPT_UI_DATS && enabled_dats)
|
||||
else if (menu_event->iptkey == IPT_UI_DATS && enabled_dats)
|
||||
{
|
||||
if (!isfavorite())
|
||||
{
|
||||
const game_driver *driver = (const game_driver *)m_event->itemref;
|
||||
const game_driver *driver = (const game_driver *)menu_event->itemref;
|
||||
if ((FPTR)driver > skip_main_items && mame_machine_manager::instance()->datfile().has_data(driver))
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(ui(), container, driver));
|
||||
menu::stack_push<menu_dats_view>(ui(), container, driver);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref;
|
||||
ui_software_info *ui_swinfo = (ui_software_info *)menu_event->itemref;
|
||||
datfile_manager &mdat = mame_machine_manager::instance()->datfile();
|
||||
|
||||
if ((FPTR)ui_swinfo > skip_main_items)
|
||||
{
|
||||
if (ui_swinfo->startempty == 1 && mdat.has_history(ui_swinfo->driver))
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(ui(), container, ui_swinfo->driver));
|
||||
menu::stack_push<menu_dats_view>(ui(), container, ui_swinfo->driver);
|
||||
else if (mdat.has_software(ui_swinfo->listname, ui_swinfo->shortname, ui_swinfo->parentname) || !ui_swinfo->usage.empty())
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(ui(), container, ui_swinfo));
|
||||
menu::stack_push<menu_dats_view>(ui(), container, ui_swinfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// handle UI_FAVORITES
|
||||
else if (m_event->iptkey == IPT_UI_FAVORITES)
|
||||
else if (menu_event->iptkey == IPT_UI_FAVORITES)
|
||||
{
|
||||
if (!isfavorite())
|
||||
{
|
||||
const game_driver *driver = (const game_driver *)m_event->itemref;
|
||||
const game_driver *driver = (const game_driver *)menu_event->itemref;
|
||||
if ((FPTR)driver > skip_main_items)
|
||||
{
|
||||
favorite_manager &mfav = mame_machine_manager::instance()->favorite();
|
||||
@ -389,36 +395,36 @@ void ui_menu_select_game::handle()
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_software_info *swinfo = (ui_software_info *)m_event->itemref;
|
||||
ui_software_info *swinfo = (ui_software_info *)menu_event->itemref;
|
||||
if ((FPTR)swinfo > skip_main_items)
|
||||
{
|
||||
machine().popmessage(_("%s\n removed from favorites list."), swinfo->longname.c_str());
|
||||
mame_machine_manager::instance()->favorite().remove_favorite_game(*swinfo);
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// handle UI_EXPORT
|
||||
else if (m_event->iptkey == IPT_UI_EXPORT && !isfavorite())
|
||||
else if (menu_event->iptkey == IPT_UI_EXPORT && !isfavorite())
|
||||
inkey_export();
|
||||
|
||||
// handle UI_AUDIT_FAST
|
||||
else if (m_event->iptkey == IPT_UI_AUDIT_FAST && !m_unavailsortedlist.empty())
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_audit>(ui(), container, m_availsortedlist, m_unavailsortedlist, 1));
|
||||
else if (menu_event->iptkey == IPT_UI_AUDIT_FAST && !m_unavailsortedlist.empty())
|
||||
menu::stack_push<menu_audit>(ui(), container, m_availsortedlist, m_unavailsortedlist, 1);
|
||||
|
||||
// handle UI_AUDIT_ALL
|
||||
else if (m_event->iptkey == IPT_UI_AUDIT_ALL)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_audit>(ui(), container, m_availsortedlist, m_unavailsortedlist, 2));
|
||||
else if (menu_event->iptkey == IPT_UI_AUDIT_ALL)
|
||||
menu::stack_push<menu_audit>(ui(), container, m_availsortedlist, m_unavailsortedlist, 2);
|
||||
|
||||
// typed characters append to the buffer
|
||||
else if (m_event->iptkey == IPT_SPECIAL)
|
||||
inkey_special(m_event);
|
||||
else if (menu_event->iptkey == IPT_SPECIAL)
|
||||
inkey_special(menu_event);
|
||||
|
||||
else if (m_event->iptkey == IPT_UI_CONFIGURE)
|
||||
inkey_configure(m_event);
|
||||
else if (menu_event->iptkey == IPT_UI_CONFIGURE)
|
||||
inkey_configure(menu_event);
|
||||
|
||||
else if (m_event->iptkey == IPT_OTHER)
|
||||
else if (menu_event->iptkey == IPT_OTHER)
|
||||
{
|
||||
m_prev_selected = nullptr;
|
||||
check_filter = true;
|
||||
@ -426,13 +432,13 @@ void ui_menu_select_game::handle()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_event != nullptr && m_event->itemref == nullptr)
|
||||
if (menu_event != nullptr && menu_event->itemref == nullptr)
|
||||
{
|
||||
if (m_event->iptkey == IPT_SPECIAL)
|
||||
inkey_special(m_event);
|
||||
else if (m_event->iptkey == IPT_UI_CONFIGURE)
|
||||
inkey_configure(m_event);
|
||||
else if (m_event->iptkey == IPT_OTHER)
|
||||
if (menu_event->iptkey == IPT_SPECIAL)
|
||||
inkey_special(menu_event);
|
||||
else if (menu_event->iptkey == IPT_UI_CONFIGURE)
|
||||
inkey_configure(menu_event);
|
||||
else if (menu_event->iptkey == IPT_OTHER)
|
||||
{
|
||||
m_focus = focused_menu::left;
|
||||
m_prev_selected = nullptr;
|
||||
@ -440,13 +446,13 @@ void ui_menu_select_game::handle()
|
||||
check_filter = true;
|
||||
}
|
||||
// handle UI_UP_FILTER
|
||||
else if (m_event->iptkey == IPT_UI_UP_FILTER && highlight > FILTER_FIRST)
|
||||
else if (menu_event->iptkey == IPT_UI_UP_FILTER && highlight > FILTER_FIRST)
|
||||
{
|
||||
highlight--;
|
||||
}
|
||||
|
||||
// handle UI_DOWN_FILTER
|
||||
else if (m_event->iptkey == IPT_UI_DOWN_FILTER && highlight < FILTER_LAST)
|
||||
else if (menu_event->iptkey == IPT_UI_DOWN_FILTER && highlight < FILTER_LAST)
|
||||
{
|
||||
highlight++;
|
||||
}
|
||||
@ -464,22 +470,22 @@ void ui_menu_select_game::handle()
|
||||
if (l_hover == FILTER_CATEGORY)
|
||||
{
|
||||
main_filters::actual = l_hover;
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_game_options>(ui(), container));
|
||||
menu::stack_push<menu_game_options>(ui(), container);
|
||||
}
|
||||
else if (l_hover == FILTER_CUSTOM)
|
||||
{
|
||||
main_filters::actual = l_hover;
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_custom_filter>(ui(), container, true));
|
||||
menu::stack_push<menu_custom_filter>(ui(), container, true);
|
||||
}
|
||||
else if (l_hover == FILTER_MANUFACTURER)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, c_mnfct::ui, c_mnfct::actual, SELECTOR_GAME, l_hover));
|
||||
menu::stack_push<menu_selector>(ui(), container, c_mnfct::ui, c_mnfct::actual, menu_selector::GAME, l_hover);
|
||||
else if (l_hover == FILTER_YEAR)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, c_year::ui, c_year::actual, SELECTOR_GAME, l_hover));
|
||||
menu::stack_push<menu_selector>(ui(), container, c_year::ui, c_year::actual, menu_selector::GAME, l_hover);
|
||||
else
|
||||
{
|
||||
if (l_hover >= FILTER_ALL)
|
||||
main_filters::actual = l_hover;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -488,7 +494,7 @@ void ui_menu_select_game::handle()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::populate()
|
||||
void menu_select_game::populate()
|
||||
{
|
||||
ui_globals::redraw_icon = true;
|
||||
ui_globals::switch_image = true;
|
||||
@ -529,7 +535,7 @@ void ui_menu_select_game::populate()
|
||||
int curitem = 0;
|
||||
for (auto & elem : m_displaylist)
|
||||
{
|
||||
UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW;
|
||||
UINT32 flags_ui = FLAG_UI | FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW;
|
||||
|
||||
if (old_item_selected == -1 && elem->name == reselect_last::driver)
|
||||
old_item_selected = curitem;
|
||||
@ -542,7 +548,7 @@ void ui_menu_select_game::populate()
|
||||
cloneof = false;
|
||||
}
|
||||
if (cloneof)
|
||||
flags_ui |= MENU_FLAG_INVERT;
|
||||
flags_ui |= FLAG_INVERT;
|
||||
|
||||
item_append(elem->description, nullptr, flags_ui, (void *)elem);
|
||||
curitem++;
|
||||
@ -557,7 +563,7 @@ void ui_menu_select_game::populate()
|
||||
// iterate over entries
|
||||
for (auto & mfavorite : mame_machine_manager::instance()->favorite().m_list)
|
||||
{
|
||||
UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW | MENU_FLAG_UI_FAVORITE;
|
||||
UINT32 flags_ui = FLAG_UI | FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW | FLAG_UI_FAVORITE;
|
||||
if (mfavorite.startempty == 1)
|
||||
{
|
||||
if (old_item_selected == -1 && mfavorite.shortname == reselect_last::driver)
|
||||
@ -571,7 +577,7 @@ void ui_menu_select_game::populate()
|
||||
cloneof = false;
|
||||
}
|
||||
if (cloneof)
|
||||
flags_ui |= MENU_FLAG_INVERT;
|
||||
flags_ui |= FLAG_INVERT;
|
||||
|
||||
item_append(mfavorite.longname.c_str(), nullptr, flags_ui, (void *)&mfavorite);
|
||||
}
|
||||
@ -580,18 +586,18 @@ void ui_menu_select_game::populate()
|
||||
if (old_item_selected == -1 && mfavorite.shortname == reselect_last::driver)
|
||||
old_item_selected = curitem;
|
||||
item_append(mfavorite.longname.c_str(), mfavorite.devicetype.c_str(),
|
||||
mfavorite.parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui), (void *)&mfavorite);
|
||||
mfavorite.parentname.empty() ? flags_ui : (FLAG_INVERT | flags_ui), (void *)&mfavorite);
|
||||
}
|
||||
curitem++;
|
||||
}
|
||||
}
|
||||
|
||||
item_append(MENU_SEPARATOR_ITEM, nullptr, MENU_FLAG_UI, nullptr);
|
||||
item_append(MENU_SEPARATOR_ITEM, nullptr, FLAG_UI, nullptr);
|
||||
|
||||
// add special items
|
||||
if (ui_menu::stack_has_special_main_menu())
|
||||
if (menu::stack_has_special_main_menu())
|
||||
{
|
||||
UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW;
|
||||
UINT32 flags_ui = FLAG_UI | FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW;
|
||||
item_append(_("Configure Options"), nullptr, flags_ui, (void *)(FPTR)CONF_OPTS);
|
||||
item_append(_("Configure Machine"), nullptr, flags_ui, (void *)(FPTR)CONF_MACHINE);
|
||||
skip_main_items = 2;
|
||||
@ -628,7 +634,7 @@ void ui_menu_select_game::populate()
|
||||
// build a list of available drivers
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::build_available_list()
|
||||
void menu_select_game::build_available_list()
|
||||
{
|
||||
int m_total = driver_list::total();
|
||||
std::vector<bool> m_included(m_total, false);
|
||||
@ -743,7 +749,7 @@ void ui_menu_select_game::build_available_list()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
const game_driver *driver = nullptr;
|
||||
ui_software_info *swinfo = nullptr;
|
||||
@ -990,16 +996,14 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott
|
||||
// and inescapable
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::force_game_select(mame_ui_manager &mui, render_container *container)
|
||||
void menu_select_game::force_game_select(mame_ui_manager &mui, render_container *container)
|
||||
{
|
||||
// reset the menu stack
|
||||
ui_menu::stack_reset(mui.machine());
|
||||
menu::stack_reset(mui.machine());
|
||||
|
||||
// add the quit entry followed by the game select entry
|
||||
ui_menu *quit = global_alloc_clear<ui_menu_quit_game>(mui, container);
|
||||
quit->set_special_main_menu(true);
|
||||
ui_menu::stack_push(quit);
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_select_game>(mui, container, nullptr));
|
||||
menu::stack_push_special_main<menu_quit_game>(mui, container);
|
||||
menu::stack_push<menu_select_game>(mui, container, nullptr);
|
||||
|
||||
// force the menus on
|
||||
mui.show_menu();
|
||||
@ -1012,19 +1016,19 @@ void ui_menu_select_game::force_game_select(mame_ui_manager &mui, render_contain
|
||||
// handle select key event
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::inkey_select(const ui_menu_event *m_event)
|
||||
void menu_select_game::inkey_select(const event *menu_event)
|
||||
{
|
||||
const game_driver *driver = (const game_driver *)m_event->itemref;
|
||||
const game_driver *driver = (const game_driver *)menu_event->itemref;
|
||||
|
||||
// special case for configure options
|
||||
if ((FPTR)driver == CONF_OPTS)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_game_options>(ui(), container));
|
||||
menu::stack_push<menu_game_options>(ui(), container);
|
||||
|
||||
// special case for configure machine
|
||||
else if ((FPTR)driver == CONF_MACHINE)
|
||||
{
|
||||
if (m_prev_selected != nullptr)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_machine_configure>(ui(), container, (const game_driver *)m_prev_selected));
|
||||
menu::stack_push<menu_machine_configure>(ui(), container, (const game_driver *)m_prev_selected);
|
||||
else
|
||||
return;
|
||||
}
|
||||
@ -1032,7 +1036,7 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event)
|
||||
// special case for configure plugins
|
||||
else if ((FPTR)driver == CONF_PLUGINS)
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_plugins_configure>(ui(), container));
|
||||
menu::stack_push<menu_plugins_configure>(ui(), container);
|
||||
}
|
||||
// anything else is a driver
|
||||
else
|
||||
@ -1051,14 +1055,14 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event)
|
||||
for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config().root_device()))
|
||||
if (!swlistdev.get_info().empty())
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_select_software>(ui(), container, driver));
|
||||
menu::stack_push<menu_select_software>(ui(), container, driver);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
s_bios biosname;
|
||||
if (!ui().options().skip_bios_menu() && has_multiple_bios(driver, biosname))
|
||||
ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(ui(), container, biosname, (void *)driver, false, false));
|
||||
menu::stack_push<bios_selection>(ui(), container, biosname, (void *)driver, false, false);
|
||||
else
|
||||
{
|
||||
reselect_last::driver = driver->name;
|
||||
@ -1066,13 +1070,13 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event)
|
||||
reselect_last::swlist.clear();
|
||||
mame_machine_manager::instance()->schedule_new_driver(*driver);
|
||||
machine().schedule_hard_reset();
|
||||
ui_menu::stack_reset(machine());
|
||||
menu::stack_reset(machine());
|
||||
}
|
||||
}
|
||||
// otherwise, display an error
|
||||
else
|
||||
{
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
ui_error = true;
|
||||
}
|
||||
}
|
||||
@ -1082,14 +1086,14 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event)
|
||||
// handle select key event for favorites menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
|
||||
void menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
{
|
||||
ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref;
|
||||
ui_software_info *ui_swinfo = (ui_software_info *)menu_event->itemref;
|
||||
ui_options &mopt = ui().options();
|
||||
|
||||
// special case for configure options
|
||||
if ((FPTR)ui_swinfo == CONF_OPTS)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_game_options>(ui(), container));
|
||||
menu::stack_push<menu_game_options>(ui(), container);
|
||||
/* special case for configure machine TODO
|
||||
else if ((FPTR)ui_swinfo == CONF_MACHINE)
|
||||
{
|
||||
@ -1097,7 +1101,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
|
||||
{
|
||||
ui_software_info *swinfo = (ui_software_info *)m_prev_selected;
|
||||
if (swinfo->startempty == 1)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_machine_configure>(ui(), container, swinfo->driver));
|
||||
menu::stack_push(ui(), container, swinfo->driver);
|
||||
}
|
||||
else
|
||||
return;
|
||||
@ -1105,7 +1109,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
|
||||
// special case for configure plugins
|
||||
else if ((FPTR)ui_swinfo == CONF_PLUGINS)
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_plugins_configure>(ui(), container));
|
||||
menu::stack_push<menu_plugins_configure>(ui(), container);
|
||||
}
|
||||
else if (ui_swinfo->startempty == 1)
|
||||
{
|
||||
@ -1120,7 +1124,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
|
||||
{
|
||||
s_bios biosname;
|
||||
if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname))
|
||||
ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(ui(), container, biosname, (void *)ui_swinfo->driver, false, false));
|
||||
menu::stack_push<bios_selection>(ui(), container, biosname, (void *)ui_swinfo->driver, false, false);
|
||||
else
|
||||
{
|
||||
reselect_last::driver = ui_swinfo->driver->name;
|
||||
@ -1129,14 +1133,14 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
|
||||
reselect_last::set(true);
|
||||
mame_machine_manager::instance()->schedule_new_driver(*ui_swinfo->driver);
|
||||
machine().schedule_hard_reset();
|
||||
ui_menu::stack_reset(machine());
|
||||
menu::stack_reset(machine());
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise, display an error
|
||||
else
|
||||
{
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
ui_error = true;
|
||||
}
|
||||
}
|
||||
@ -1154,7 +1158,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
|
||||
s_bios biosname;
|
||||
if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname))
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(ui(), container, biosname, (void *)ui_swinfo, true, false));
|
||||
menu::stack_push<bios_selection>(ui(), container, biosname, (void *)ui_swinfo, true, false);
|
||||
return;
|
||||
}
|
||||
else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str()))
|
||||
@ -1170,7 +1174,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
|
||||
parts.emplace(swpart.name(), menu_part_name);
|
||||
}
|
||||
}
|
||||
ui_menu::stack_push(global_alloc_clear<ui_software_parts>(ui(), container, parts, ui_swinfo));
|
||||
menu::stack_push<software_parts>(ui(), container, parts, ui_swinfo);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1184,12 +1188,12 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
|
||||
reselect_last::swlist = ui_swinfo->listname;
|
||||
mame_machine_manager::instance()->schedule_new_driver(drv.driver());
|
||||
machine().schedule_hard_reset();
|
||||
ui_menu::stack_reset(machine());
|
||||
menu::stack_reset(machine());
|
||||
}
|
||||
// otherwise, display an error
|
||||
else
|
||||
{
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
ui_error = true;
|
||||
}
|
||||
}
|
||||
@ -1199,7 +1203,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
|
||||
// returns if the search can be activated
|
||||
//-------------------------------------------------
|
||||
|
||||
inline bool ui_menu_select_game::isfavorite()
|
||||
inline bool menu_select_game::isfavorite()
|
||||
{
|
||||
return (main_filters::actual == FILTER_FAVORITE);
|
||||
}
|
||||
@ -1208,27 +1212,27 @@ inline bool ui_menu_select_game::isfavorite()
|
||||
// handle special key event
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::inkey_special(const ui_menu_event *m_event)
|
||||
void menu_select_game::inkey_special(const event *menu_event)
|
||||
{
|
||||
int buflen = strlen(m_search);
|
||||
|
||||
// if it's a backspace and we can handle it, do so
|
||||
if (((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0) && !isfavorite())
|
||||
if (((menu_event->unichar == 8 || menu_event->unichar == 0x7f) && buflen > 0) && !isfavorite())
|
||||
{
|
||||
*(char *)utf8_previous_char(&m_search[buflen]) = 0;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
else if ((m_event->unichar >= ' ' && m_event->unichar < 0x7f) && !isfavorite())
|
||||
else if ((menu_event->unichar >= ' ' && menu_event->unichar < 0x7f) && !isfavorite())
|
||||
{
|
||||
// if it's any other key and we're not maxed out, update
|
||||
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar);
|
||||
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, menu_event->unichar);
|
||||
m_search[buflen] = 0;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ui_menu_select_game::inkey_configure(const ui_menu_event *m_event)
|
||||
void menu_select_game::inkey_configure(const event *menu_event)
|
||||
{
|
||||
if (selected <= visible_items && m_focus == focused_menu::main)
|
||||
{
|
||||
@ -1288,7 +1292,7 @@ void ui_menu_select_game::inkey_configure(const ui_menu_event *m_event)
|
||||
// build list
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::build_list(const char *filter_text, int filter, bool bioscheck, std::vector<const game_driver *> s_drivers)
|
||||
void menu_select_game::build_list(const char *filter_text, int filter, bool bioscheck, std::vector<const game_driver *> s_drivers)
|
||||
{
|
||||
int cx = 0;
|
||||
bool cloneof = false;
|
||||
@ -1311,94 +1315,94 @@ void ui_menu_select_game::build_list(const char *filter_text, int filter, bool b
|
||||
|
||||
switch (filter)
|
||||
{
|
||||
case FILTER_ALL:
|
||||
case FILTER_AVAILABLE:
|
||||
case FILTER_UNAVAILABLE:
|
||||
case FILTER_ALL:
|
||||
case FILTER_AVAILABLE:
|
||||
case FILTER_UNAVAILABLE:
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case FILTER_WORKING:
|
||||
if (!(s_driver->flags & MACHINE_NOT_WORKING))
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
break;
|
||||
|
||||
case FILTER_WORKING:
|
||||
if (!(s_driver->flags & MACHINE_NOT_WORKING))
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case FILTER_NOT_MECHANICAL:
|
||||
if (!(s_driver->flags & MACHINE_MECHANICAL))
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case FILTER_NOT_MECHANICAL:
|
||||
if (!(s_driver->flags & MACHINE_MECHANICAL))
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case FILTER_BIOS:
|
||||
if (s_driver->flags & MACHINE_IS_BIOS_ROOT)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case FILTER_BIOS:
|
||||
if (s_driver->flags & MACHINE_IS_BIOS_ROOT)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case FILTER_PARENT:
|
||||
case FILTER_CLONES:
|
||||
cloneof = strcmp(s_driver->parent, "0");
|
||||
if (cloneof)
|
||||
{
|
||||
cx = driver_list::find(s_driver->parent);
|
||||
if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0))
|
||||
cloneof = false;
|
||||
}
|
||||
|
||||
case FILTER_PARENT:
|
||||
case FILTER_CLONES:
|
||||
cloneof = strcmp(s_driver->parent, "0");
|
||||
if (cloneof)
|
||||
{
|
||||
cx = driver_list::find(s_driver->parent);
|
||||
if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0))
|
||||
cloneof = false;
|
||||
}
|
||||
if (filter == FILTER_CLONES && cloneof)
|
||||
m_displaylist.push_back(s_driver);
|
||||
else if (filter == FILTER_PARENT && !cloneof)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
if (filter == FILTER_CLONES && cloneof)
|
||||
m_displaylist.push_back(s_driver);
|
||||
else if (filter == FILTER_PARENT && !cloneof)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case FILTER_NOT_WORKING:
|
||||
if (s_driver->flags & MACHINE_NOT_WORKING)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case FILTER_NOT_WORKING:
|
||||
if (s_driver->flags & MACHINE_NOT_WORKING)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case FILTER_MECHANICAL:
|
||||
if (s_driver->flags & MACHINE_MECHANICAL)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case FILTER_MECHANICAL:
|
||||
if (s_driver->flags & MACHINE_MECHANICAL)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case FILTER_SAVE:
|
||||
if (s_driver->flags & MACHINE_SUPPORTS_SAVE)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case FILTER_SAVE:
|
||||
if (s_driver->flags & MACHINE_SUPPORTS_SAVE)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case FILTER_NOSAVE:
|
||||
if (!(s_driver->flags & MACHINE_SUPPORTS_SAVE))
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case FILTER_NOSAVE:
|
||||
if (!(s_driver->flags & MACHINE_SUPPORTS_SAVE))
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case FILTER_YEAR:
|
||||
if (!core_stricmp(filter_text, s_driver->year))
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case FILTER_YEAR:
|
||||
if (!core_stricmp(filter_text, s_driver->year))
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case FILTER_VERTICAL:
|
||||
if (s_driver->flags & ORIENTATION_SWAP_XY)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case FILTER_VERTICAL:
|
||||
if (s_driver->flags & ORIENTATION_SWAP_XY)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case FILTER_HORIZONTAL:
|
||||
if (!(s_driver->flags & ORIENTATION_SWAP_XY))
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case FILTER_HORIZONTAL:
|
||||
if (!(s_driver->flags & ORIENTATION_SWAP_XY))
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case FILTER_MANUFACTURER:
|
||||
case FILTER_MANUFACTURER:
|
||||
{
|
||||
std::string name = c_mnfct::getname(s_driver->manufacturer);
|
||||
if (!core_stricmp(filter_text, name.c_str()))
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
}
|
||||
case FILTER_CHD:
|
||||
for (const rom_entry *rom = s_driver->rom; !ROMENTRY_ISEND(rom); ++rom)
|
||||
if (ROMENTRY_ISREGION(rom) && ROMREGION_ISDISKDATA(rom))
|
||||
{
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FILTER_NOCHD:
|
||||
break;
|
||||
case FILTER_CHD:
|
||||
for (const rom_entry *rom = s_driver->rom; !ROMENTRY_ISEND(rom); ++rom)
|
||||
if (ROMENTRY_ISREGION(rom) && ROMREGION_ISDISKDATA(rom))
|
||||
{
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FILTER_NOCHD:
|
||||
{
|
||||
bool found = false;
|
||||
for (const rom_entry *rom = s_driver->rom; !ROMENTRY_ISEND(rom); ++rom)
|
||||
@ -1409,8 +1413,8 @@ void ui_menu_select_game::build_list(const char *filter_text, int filter, bool b
|
||||
}
|
||||
if (!found)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1419,7 +1423,7 @@ void ui_menu_select_game::build_list(const char *filter_text, int filter, bool b
|
||||
// build custom display list
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::build_custom()
|
||||
void menu_select_game::build_custom()
|
||||
{
|
||||
std::vector<const game_driver *> s_drivers;
|
||||
bool bioscheck = false;
|
||||
@ -1468,7 +1472,7 @@ void ui_menu_select_game::build_custom()
|
||||
// build category list
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::build_category()
|
||||
void menu_select_game::build_category()
|
||||
{
|
||||
m_displaylist.clear();
|
||||
std::vector<int> temp_filter;
|
||||
@ -1484,7 +1488,7 @@ void ui_menu_select_game::build_category()
|
||||
// populate search list
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::populate_search()
|
||||
void menu_select_game::populate_search()
|
||||
{
|
||||
// allocate memory to track the penalty value
|
||||
std::vector<int> penalty(VISIBLE_GAMES_IN_SEARCH, 9999);
|
||||
@ -1516,7 +1520,7 @@ void ui_menu_select_game::populate_search()
|
||||
}
|
||||
|
||||
(index < VISIBLE_GAMES_IN_SEARCH) ? m_searchlist[index] = nullptr : m_searchlist[VISIBLE_GAMES_IN_SEARCH] = nullptr;
|
||||
UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW;
|
||||
UINT32 flags_ui = FLAG_UI | FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW;
|
||||
for (int curitem = 0; m_searchlist[curitem]; ++curitem)
|
||||
{
|
||||
bool cloneof = strcmp(m_searchlist[curitem]->parent, "0");
|
||||
@ -1526,7 +1530,7 @@ void ui_menu_select_game::populate_search()
|
||||
if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0))
|
||||
cloneof = false;
|
||||
}
|
||||
item_append(m_searchlist[curitem]->description, nullptr, (!cloneof) ? flags_ui : (MENU_FLAG_INVERT | flags_ui),
|
||||
item_append(m_searchlist[curitem]->description, nullptr, (!cloneof) ? flags_ui : (FLAG_INVERT | flags_ui),
|
||||
(void *)m_searchlist[curitem]);
|
||||
}
|
||||
}
|
||||
@ -1535,7 +1539,7 @@ void ui_menu_select_game::populate_search()
|
||||
// generate general info
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::general_info(const game_driver *driver, std::string &buffer)
|
||||
void menu_select_game::general_info(const game_driver *driver, std::string &buffer)
|
||||
{
|
||||
std::ostringstream str;
|
||||
|
||||
@ -1617,7 +1621,7 @@ void ui_menu_select_game::general_info(const game_driver *driver, std::string &b
|
||||
buffer = str.str();
|
||||
}
|
||||
|
||||
void ui_menu_select_game::inkey_export()
|
||||
void menu_select_game::inkey_export()
|
||||
{
|
||||
std::vector<const game_driver *> list;
|
||||
if (m_search[0] != 0)
|
||||
@ -1631,14 +1635,14 @@ void ui_menu_select_game::inkey_export()
|
||||
{
|
||||
list = m_displaylist;
|
||||
}
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_export>(ui(), container, list));
|
||||
menu::stack_push<menu_export>(ui(), container, list);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// save drivers infos to file
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::init_sorted_list()
|
||||
void menu_select_game::init_sorted_list()
|
||||
{
|
||||
if (!m_sortedlist.empty())
|
||||
return;
|
||||
@ -1667,7 +1671,7 @@ void ui_menu_select_game::init_sorted_list()
|
||||
// load drivers infos from file
|
||||
//-------------------------------------------------
|
||||
|
||||
bool ui_menu_select_game::load_available_machines()
|
||||
bool menu_select_game::load_available_machines()
|
||||
{
|
||||
// try to load available drivers from file
|
||||
emu_file file(ui().options().ui_path(), OPEN_FLAG_READ);
|
||||
@ -1719,7 +1723,7 @@ bool ui_menu_select_game::load_available_machines()
|
||||
// load custom filters info from file
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::load_custom_filters()
|
||||
void menu_select_game::load_custom_filters()
|
||||
{
|
||||
// attempt to open the output file
|
||||
emu_file file(ui().options().ui_path(), OPEN_FLAG_READ);
|
||||
@ -1779,7 +1783,7 @@ void ui_menu_select_game::load_custom_filters()
|
||||
// draw left box
|
||||
//-------------------------------------------------
|
||||
|
||||
float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2)
|
||||
float menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2)
|
||||
{
|
||||
float line_height = ui().get_line_height();
|
||||
|
||||
@ -1837,7 +1841,7 @@ float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y
|
||||
bgcolor = UI_MOUSEOVER_BG_COLOR;
|
||||
fgcolor = UI_MOUSEOVER_COLOR;
|
||||
hover = phover + filter;
|
||||
ui_menu::highlight(container, x1, y1, x2, y1+ line_height_max, bgcolor);
|
||||
menu::highlight(container, x1, y1, x2, y1+ line_height_max, bgcolor);
|
||||
}
|
||||
|
||||
if (highlight == filter && m_focus == focused_menu::left)
|
||||
@ -1937,7 +1941,7 @@ float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y
|
||||
// draw infos
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::infos_render(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_select_game::infos_render(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float line_height = ui().get_line_height();
|
||||
static std::string buffer;
|
||||
@ -1946,7 +1950,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or
|
||||
float text_size = ui().options().infos_size();
|
||||
const game_driver *driver = nullptr;
|
||||
ui_software_info *soft = nullptr;
|
||||
bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0);
|
||||
bool is_favorites = ((item[0].flags & FLAG_UI_FAVORITE) != 0);
|
||||
static ui_software_info *oldsoft = nullptr;
|
||||
static const game_driver *olddriver = nullptr;
|
||||
static int oldview = -1;
|
||||
@ -2251,7 +2255,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or
|
||||
// draw right panel
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_select_game::draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
rgb_t fgcolor = UI_TEXT_COLOR;
|
||||
bool hide = (ui_globals::panels_status == HIDE_RIGHT_PANEL || ui_globals::panels_status == HIDE_BOTH);
|
||||
@ -2293,10 +2297,10 @@ void ui_menu_select_game::draw_right_panel(void *selectedref, float origx1, floa
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_game::arts_render(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_select_game::arts_render(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float line_height = ui().get_line_height();
|
||||
bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0);
|
||||
bool is_favorites = ((item[0].flags & FLAG_UI_FAVORITE) != 0);
|
||||
static ui_software_info *oldsoft = nullptr;
|
||||
static const game_driver *olddriver = nullptr;
|
||||
const game_driver *driver = nullptr;
|
||||
@ -2488,3 +2492,5 @@ void ui_menu_select_game::arts_render(void *selectedref, float origx1, float ori
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,16 +10,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_MAIN_H__
|
||||
#define __UI_MAIN_H__
|
||||
#ifndef MAME_FRONTEND_UI_SELGAME_H
|
||||
#define MAME_FRONTEND_UI_SELGAME_H
|
||||
|
||||
#include "ui/menu.h"
|
||||
|
||||
class ui_menu_select_game : public ui_menu
|
||||
|
||||
namespace ui {
|
||||
|
||||
class menu_select_game : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename);
|
||||
virtual ~ui_menu_select_game();
|
||||
menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename);
|
||||
virtual ~menu_select_game();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -74,12 +77,13 @@ private:
|
||||
void infos_render(void *selectedref, float x1, float y1, float x2, float y2);
|
||||
|
||||
// handlers
|
||||
void inkey_select(const ui_menu_event *menu_event);
|
||||
void inkey_select_favorite(const ui_menu_event *menu_event);
|
||||
void inkey_special(const ui_menu_event *menu_event);
|
||||
void inkey_select(const event *menu_event);
|
||||
void inkey_select_favorite(const event *menu_event);
|
||||
void inkey_special(const event *menu_event);
|
||||
void inkey_export();
|
||||
void inkey_configure(const ui_menu_event *menu_event);
|
||||
void inkey_configure(const event *menu_event);
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif /* __UI_MAIN_H__ */
|
||||
#endif // MAME_FRONTEND_UI_SELGAME_H
|
||||
|
@ -9,21 +9,26 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "mame.h"
|
||||
#include "emuopts.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "uiinput.h"
|
||||
#include "audit.h"
|
||||
#include "drivenum.h"
|
||||
|
||||
#include "ui/selsoft.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/datmenu.h"
|
||||
#include "ui/datfile.h"
|
||||
#include "ui/inifile.h"
|
||||
#include "ui/selector.h"
|
||||
|
||||
#include "audit.h"
|
||||
#include "drivenum.h"
|
||||
#include "emuopts.h"
|
||||
#include "mame.h"
|
||||
#include "rendfont.h"
|
||||
#include "rendutil.h"
|
||||
#include "softlist.h"
|
||||
#include "uiinput.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
std::string reselect_last::driver;
|
||||
std::string reselect_last::software;
|
||||
@ -121,7 +126,7 @@ bool has_multiple_bios(const game_driver *driver, s_bios &biosname)
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_select_software::ui_menu_select_software(mame_ui_manager &mui, render_container *container, const game_driver *driver) : ui_menu(mui, container)
|
||||
menu_select_software::menu_select_software(mame_ui_manager &mui, render_container *container, const game_driver *driver) : menu(mui, container)
|
||||
{
|
||||
if (reselect_last::get())
|
||||
reselect_last::set(false);
|
||||
@ -145,7 +150,7 @@ ui_menu_select_software::ui_menu_select_software(mame_ui_manager &mui, render_co
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_select_software::~ui_menu_select_software()
|
||||
menu_select_software::~menu_select_software()
|
||||
{
|
||||
ui_globals::curimage_view = CABINETS_VIEW;
|
||||
ui_globals::switch_image = true;
|
||||
@ -155,7 +160,7 @@ ui_menu_select_software::~ui_menu_select_software()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_software::handle()
|
||||
void menu_select_software::handle()
|
||||
{
|
||||
if (m_prev_selected == nullptr)
|
||||
m_prev_selected = item[0].ref;
|
||||
@ -166,11 +171,11 @@ void ui_menu_select_software::handle()
|
||||
machine().ui_input().pressed(IPT_UI_PAUSE);
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
const event *menu_event = process(PROCESS_LR_REPEAT);
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
// reset the error on any future m_event
|
||||
// reset the error on any future event
|
||||
if (ui_error)
|
||||
{
|
||||
ui_error = false;
|
||||
@ -178,11 +183,11 @@ void ui_menu_select_software::handle()
|
||||
}
|
||||
|
||||
// handle selections
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
if (m_focus == focused_menu::main)
|
||||
{
|
||||
inkey_select(m_event);
|
||||
inkey_select(menu_event);
|
||||
}
|
||||
else if (m_focus == focused_menu::left)
|
||||
{
|
||||
@ -193,7 +198,7 @@ void ui_menu_select_software::handle()
|
||||
}
|
||||
|
||||
// handle UI_LEFT
|
||||
else if (m_event->iptkey == IPT_UI_LEFT)
|
||||
else if (menu_event->iptkey == IPT_UI_LEFT)
|
||||
{
|
||||
// Images
|
||||
if (ui_globals::rpanel == RP_IMAGES && ui_globals::curimage_view > FIRST_VIEW)
|
||||
@ -212,7 +217,7 @@ void ui_menu_select_software::handle()
|
||||
}
|
||||
|
||||
// handle UI_RIGHT
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
// Images
|
||||
if (ui_globals::rpanel == RP_IMAGES && ui_globals::curimage_view < LAST_VIEW)
|
||||
@ -231,48 +236,48 @@ void ui_menu_select_software::handle()
|
||||
}
|
||||
|
||||
// handle UI_UP_FILTER
|
||||
else if (m_event->iptkey == IPT_UI_UP_FILTER && highlight > UI_SW_FIRST)
|
||||
else if (menu_event->iptkey == IPT_UI_UP_FILTER && highlight > UI_SW_FIRST)
|
||||
{
|
||||
highlight--;
|
||||
}
|
||||
|
||||
// handle UI_DOWN_FILTER
|
||||
else if (m_event->iptkey == IPT_UI_DOWN_FILTER && highlight < UI_SW_LAST)
|
||||
else if (menu_event->iptkey == IPT_UI_DOWN_FILTER && highlight < UI_SW_LAST)
|
||||
{
|
||||
highlight++;
|
||||
}
|
||||
|
||||
// handle UI_DATS
|
||||
else if (m_event->iptkey == IPT_UI_DATS && ui().options().enabled_dats())
|
||||
else if (menu_event->iptkey == IPT_UI_DATS && ui().options().enabled_dats())
|
||||
{
|
||||
ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref;
|
||||
ui_software_info *ui_swinfo = (ui_software_info *)menu_event->itemref;
|
||||
datfile_manager &mdat = mame_machine_manager::instance()->datfile();
|
||||
|
||||
if (ui_swinfo->startempty == 1 && mdat.has_history(ui_swinfo->driver))
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(ui(), container, ui_swinfo->driver));
|
||||
menu::stack_push<menu_dats_view>(ui(), container, ui_swinfo->driver);
|
||||
else if (mdat.has_software(ui_swinfo->listname, ui_swinfo->shortname, ui_swinfo->parentname) || !ui_swinfo->usage.empty())
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(ui(), container, ui_swinfo));
|
||||
menu::stack_push<menu_dats_view>(ui(), container, ui_swinfo);
|
||||
}
|
||||
|
||||
// handle UI_LEFT_PANEL
|
||||
else if (m_event->iptkey == IPT_UI_LEFT_PANEL)
|
||||
else if (menu_event->iptkey == IPT_UI_LEFT_PANEL)
|
||||
ui_globals::rpanel = RP_IMAGES;
|
||||
|
||||
// handle UI_RIGHT_PANEL
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT_PANEL)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT_PANEL)
|
||||
ui_globals::rpanel = RP_INFOS;
|
||||
|
||||
// escape pressed with non-empty text clears the text
|
||||
else if (m_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0)
|
||||
else if (menu_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0)
|
||||
{
|
||||
m_search[0] = '\0';
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
|
||||
// handle UI_FAVORITES
|
||||
else if (m_event->iptkey == IPT_UI_FAVORITES)
|
||||
else if (menu_event->iptkey == IPT_UI_FAVORITES)
|
||||
{
|
||||
ui_software_info *swinfo = (ui_software_info *)m_event->itemref;
|
||||
ui_software_info *swinfo = (ui_software_info *)menu_event->itemref;
|
||||
|
||||
if ((FPTR)swinfo > 2)
|
||||
{
|
||||
@ -292,27 +297,27 @@ void ui_menu_select_software::handle()
|
||||
}
|
||||
|
||||
// typed characters append to the buffer
|
||||
else if (m_event->iptkey == IPT_SPECIAL)
|
||||
inkey_special(m_event);
|
||||
else if (menu_event->iptkey == IPT_SPECIAL)
|
||||
inkey_special(menu_event);
|
||||
|
||||
else if (m_event->iptkey == IPT_OTHER)
|
||||
else if (menu_event->iptkey == IPT_OTHER)
|
||||
{
|
||||
highlight = l_sw_hover;
|
||||
check_filter = true;
|
||||
m_prev_selected = nullptr;
|
||||
}
|
||||
|
||||
else if (m_event->iptkey == IPT_UI_CONFIGURE)
|
||||
inkey_configure(m_event);
|
||||
else if (menu_event->iptkey == IPT_UI_CONFIGURE)
|
||||
inkey_configure(menu_event);
|
||||
}
|
||||
|
||||
if (m_event != nullptr && m_event->itemref == nullptr)
|
||||
if (menu_event && !menu_event->itemref)
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_CONFIGURE)
|
||||
inkey_configure(m_event);
|
||||
if (menu_event->iptkey == IPT_UI_CONFIGURE)
|
||||
inkey_configure(menu_event);
|
||||
|
||||
// handle UI_LEFT
|
||||
else if (m_event->iptkey == IPT_UI_LEFT)
|
||||
else if (menu_event->iptkey == IPT_UI_LEFT)
|
||||
{
|
||||
// Images
|
||||
if (ui_globals::rpanel == RP_IMAGES && ui_globals::curimage_view > FIRST_VIEW)
|
||||
@ -331,7 +336,7 @@ void ui_menu_select_software::handle()
|
||||
}
|
||||
|
||||
// handle UI_RIGHT
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
// Images
|
||||
if (ui_globals::rpanel == RP_IMAGES && ui_globals::curimage_view < LAST_VIEW)
|
||||
@ -350,25 +355,25 @@ void ui_menu_select_software::handle()
|
||||
}
|
||||
|
||||
// handle UI_LEFT_PANEL
|
||||
else if (m_event->iptkey == IPT_UI_LEFT_PANEL)
|
||||
else if (menu_event->iptkey == IPT_UI_LEFT_PANEL)
|
||||
ui_globals::rpanel = RP_IMAGES;
|
||||
|
||||
// handle UI_RIGHT_PANEL
|
||||
else if (m_event->iptkey == IPT_UI_RIGHT_PANEL)
|
||||
else if (menu_event->iptkey == IPT_UI_RIGHT_PANEL)
|
||||
ui_globals::rpanel = RP_INFOS;
|
||||
|
||||
// handle UI_UP_FILTER
|
||||
else if (m_event->iptkey == IPT_UI_UP_FILTER && highlight > UI_SW_FIRST)
|
||||
else if (menu_event->iptkey == IPT_UI_UP_FILTER && highlight > UI_SW_FIRST)
|
||||
{
|
||||
highlight--;
|
||||
}
|
||||
|
||||
// handle UI_DOWN_FILTER
|
||||
else if (m_event->iptkey == IPT_UI_DOWN_FILTER && highlight < UI_SW_LAST)
|
||||
else if (menu_event->iptkey == IPT_UI_DOWN_FILTER && highlight < UI_SW_LAST)
|
||||
{
|
||||
highlight++;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_OTHER && m_focus == focused_menu::left)
|
||||
else if (menu_event->iptkey == IPT_OTHER && m_focus == focused_menu::left)
|
||||
{
|
||||
l_sw_hover = highlight;
|
||||
check_filter = true;
|
||||
@ -389,34 +394,29 @@ void ui_menu_select_software::handle()
|
||||
m_search[0] = '\0';
|
||||
switch (l_sw_hover)
|
||||
{
|
||||
case UI_SW_REGION:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, m_filter.region.ui,
|
||||
m_filter.region.actual, SELECTOR_SOFTWARE, l_sw_hover));
|
||||
break;
|
||||
case UI_SW_YEARS:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, m_filter.year.ui,
|
||||
m_filter.year.actual, SELECTOR_SOFTWARE, l_sw_hover));
|
||||
break;
|
||||
case UI_SW_LIST:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, m_filter.swlist.description,
|
||||
m_filter.swlist.actual, SELECTOR_SOFTWARE, l_sw_hover));
|
||||
break;
|
||||
case UI_SW_TYPE:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, m_filter.type.ui,
|
||||
m_filter.type.actual, SELECTOR_SOFTWARE, l_sw_hover));
|
||||
break;
|
||||
case UI_SW_PUBLISHERS:
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, m_filter.publisher.ui,
|
||||
m_filter.publisher.actual, SELECTOR_SOFTWARE, l_sw_hover));
|
||||
break;
|
||||
case UI_SW_CUSTOM:
|
||||
sw_filters::actual = l_sw_hover;
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_swcustom_filter>(ui(), container, m_driver, m_filter));
|
||||
break;
|
||||
default:
|
||||
sw_filters::actual = l_sw_hover;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
break;
|
||||
case UI_SW_REGION:
|
||||
menu::stack_push<menu_selector>(ui(), container, m_filter.region.ui, m_filter.region.actual, menu_selector::SOFTWARE, l_sw_hover);
|
||||
break;
|
||||
case UI_SW_YEARS:
|
||||
menu::stack_push<menu_selector>(ui(), container, m_filter.year.ui, m_filter.year.actual, menu_selector::SOFTWARE, l_sw_hover);
|
||||
break;
|
||||
case UI_SW_LIST:
|
||||
menu::stack_push<menu_selector>(ui(), container, m_filter.swlist.description, m_filter.swlist.actual, menu_selector::SOFTWARE, l_sw_hover);
|
||||
break;
|
||||
case UI_SW_TYPE:
|
||||
menu::stack_push<menu_selector>(ui(), container, m_filter.type.ui, m_filter.type.actual, menu_selector::SOFTWARE, l_sw_hover);
|
||||
break;
|
||||
case UI_SW_PUBLISHERS:
|
||||
menu::stack_push<menu_selector>(ui(), container, m_filter.publisher.ui, m_filter.publisher.actual, menu_selector::SOFTWARE, l_sw_hover);
|
||||
break;
|
||||
case UI_SW_CUSTOM:
|
||||
sw_filters::actual = l_sw_hover;
|
||||
menu::stack_push<menu_swcustom_filter>(ui(), container, m_driver, m_filter);
|
||||
break;
|
||||
default:
|
||||
sw_filters::actual = l_sw_hover;
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -425,9 +425,9 @@ void ui_menu_select_software::handle()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_software::populate()
|
||||
void menu_select_software::populate()
|
||||
{
|
||||
UINT32 flags_ui = MENU_FLAG_UI_SWLIST | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW;
|
||||
UINT32 flags_ui = FLAG_UI_SWLIST | FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW;
|
||||
m_has_empty_start = true;
|
||||
int old_software = -1;
|
||||
|
||||
@ -490,7 +490,7 @@ void ui_menu_select_software::populate()
|
||||
old_software = m_has_empty_start ? curitem + 1 : curitem;
|
||||
|
||||
item_append(m_displaylist[curitem]->longname.c_str(), m_displaylist[curitem]->devicetype.c_str(),
|
||||
m_displaylist[curitem]->parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui), (void *)m_displaylist[curitem]);
|
||||
m_displaylist[curitem]->parentname.empty() ? flags_ui : (FLAG_INVERT | flags_ui), (void *)m_displaylist[curitem]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ void ui_menu_select_software::populate()
|
||||
|
||||
for (int curitem = 0; m_searchlist[curitem] != nullptr; ++curitem)
|
||||
item_append(m_searchlist[curitem]->longname.c_str(), m_searchlist[curitem]->devicetype.c_str(),
|
||||
m_searchlist[curitem]->parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui),
|
||||
m_searchlist[curitem]->parentname.empty() ? flags_ui : (FLAG_INVERT | flags_ui),
|
||||
(void *)m_searchlist[curitem]);
|
||||
}
|
||||
|
||||
@ -523,7 +523,7 @@ void ui_menu_select_software::populate()
|
||||
// build a list of software
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_software::build_software_list()
|
||||
void menu_select_software::build_software_list()
|
||||
{
|
||||
// add start empty item
|
||||
m_swinfo.emplace_back(m_driver->name, m_driver->description, "", "", "", 0, "", m_driver, "", "", "", 1, "", "", "", true);
|
||||
@ -665,7 +665,7 @@ void ui_menu_select_software::build_software_list()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_software::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_select_software::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
ui_software_info *swinfo = (selectedref != nullptr) ? (ui_software_info *)selectedref : ((m_prev_selected != nullptr) ? (ui_software_info *)m_prev_selected : nullptr);
|
||||
const game_driver *driver = nullptr;
|
||||
@ -893,16 +893,16 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float
|
||||
// handle select key event
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_software::inkey_select(const ui_menu_event *m_event)
|
||||
void menu_select_software::inkey_select(const event *menu_event)
|
||||
{
|
||||
ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref;
|
||||
ui_software_info *ui_swinfo = (ui_software_info *)menu_event->itemref;
|
||||
ui_options &mopt = ui().options();
|
||||
|
||||
if (ui_swinfo->startempty == 1)
|
||||
{
|
||||
s_bios biosname;
|
||||
if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname))
|
||||
ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(ui(), container, biosname, (void *)ui_swinfo->driver, false, true));
|
||||
menu::stack_push<bios_selection>(ui(), container, biosname, (void *)ui_swinfo->driver, false, true);
|
||||
else
|
||||
{
|
||||
reselect_last::driver = ui_swinfo->driver->name;
|
||||
@ -911,7 +911,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event)
|
||||
reselect_last::set(true);
|
||||
mame_machine_manager::instance()->schedule_new_driver(*ui_swinfo->driver);
|
||||
machine().schedule_hard_reset();
|
||||
ui_menu::stack_reset(machine());
|
||||
menu::stack_reset(machine());
|
||||
}
|
||||
}
|
||||
|
||||
@ -931,7 +931,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event)
|
||||
s_bios biosname;
|
||||
if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname))
|
||||
{
|
||||
ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(ui(), container, biosname, (void *)ui_swinfo, true, false));
|
||||
menu::stack_push<bios_selection>(ui(), container, biosname, (void *)ui_swinfo, true, false);
|
||||
return;
|
||||
}
|
||||
else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str()))
|
||||
@ -947,7 +947,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event)
|
||||
parts.emplace(swpart.name(), menu_part_name);
|
||||
}
|
||||
}
|
||||
ui_menu::stack_push(global_alloc_clear<ui_software_parts>(ui(), container, parts, ui_swinfo));
|
||||
menu::stack_push<software_parts>(ui(), container, parts, ui_swinfo);
|
||||
return;
|
||||
}
|
||||
std::string error_string;
|
||||
@ -961,13 +961,13 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event)
|
||||
reselect_last::set(true);
|
||||
mame_machine_manager::instance()->schedule_new_driver(drivlist.driver());
|
||||
machine().schedule_hard_reset();
|
||||
ui_menu::stack_reset(machine());
|
||||
menu::stack_reset(machine());
|
||||
}
|
||||
|
||||
// otherwise, display an error
|
||||
else
|
||||
{
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
ui_error = true;
|
||||
}
|
||||
}
|
||||
@ -977,27 +977,27 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event)
|
||||
// handle special key event
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_software::inkey_special(const ui_menu_event *m_event)
|
||||
void menu_select_software::inkey_special(const event *menu_event)
|
||||
{
|
||||
int buflen = strlen(m_search);
|
||||
|
||||
// if it's a backspace and we can handle it, do so
|
||||
if ((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0)
|
||||
if ((menu_event->unichar == 8 || menu_event->unichar == 0x7f) && buflen > 0)
|
||||
{
|
||||
*(char *)utf8_previous_char(&m_search[buflen]) = 0;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
|
||||
// if it's any other key and we're not maxed out, update
|
||||
else if (m_event->unichar >= ' ' && m_event->unichar < 0x7f)
|
||||
else if (menu_event->unichar >= ' ' && menu_event->unichar < 0x7f)
|
||||
{
|
||||
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar);
|
||||
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, menu_event->unichar);
|
||||
m_search[buflen] = 0;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
}
|
||||
|
||||
void ui_menu_select_software::inkey_configure(const ui_menu_event *m_event)
|
||||
void menu_select_software::inkey_configure(const event *menu_event)
|
||||
{
|
||||
if (selected <= visible_items && m_focus == focused_menu::main)
|
||||
{
|
||||
@ -1057,7 +1057,7 @@ void ui_menu_select_software::inkey_configure(const ui_menu_event *m_event)
|
||||
// load custom filters info from file
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_software::load_sw_custom_filters()
|
||||
void menu_select_software::load_sw_custom_filters()
|
||||
{
|
||||
// attempt to open the output file
|
||||
emu_file file(ui().options().ui_path(), OPEN_FLAG_READ);
|
||||
@ -1218,7 +1218,7 @@ std::string c_sw_publisher::getname(std::string &str)
|
||||
//-------------------------------------------------
|
||||
// build display list
|
||||
//-------------------------------------------------
|
||||
void ui_menu_select_software::build_list(std::vector<ui_software_info *> &s_drivers, const char *filter_text, int filter)
|
||||
void menu_select_software::build_list(std::vector<ui_software_info *> &s_drivers, const char *filter_text, int filter)
|
||||
{
|
||||
if (s_drivers.empty() && filter == -1)
|
||||
{
|
||||
@ -1231,77 +1231,77 @@ void ui_menu_select_software::build_list(std::vector<ui_software_info *> &s_driv
|
||||
{
|
||||
switch (filter)
|
||||
{
|
||||
case UI_SW_PARENTS:
|
||||
if (s_driver->parentname.empty())
|
||||
m_displaylist.push_back(s_driver);
|
||||
case UI_SW_PARENTS:
|
||||
if (s_driver->parentname.empty())
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_CLONES:
|
||||
if (!s_driver->parentname.empty())
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_AVAILABLE:
|
||||
if (s_driver->available)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_CLONES:
|
||||
if (!s_driver->parentname.empty())
|
||||
m_displaylist.push_back(s_driver);
|
||||
case UI_SW_UNAVAILABLE:
|
||||
if (!s_driver->available)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_AVAILABLE:
|
||||
if (s_driver->available)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case UI_SW_SUPPORTED:
|
||||
if (s_driver->supported == SOFTWARE_SUPPORTED_YES)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_UNAVAILABLE:
|
||||
if (!s_driver->available)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case UI_SW_PARTIAL_SUPPORTED:
|
||||
if (s_driver->supported == SOFTWARE_SUPPORTED_PARTIAL)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_SUPPORTED:
|
||||
if (s_driver->supported == SOFTWARE_SUPPORTED_YES)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
case UI_SW_UNSUPPORTED:
|
||||
if (s_driver->supported == SOFTWARE_SUPPORTED_NO)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_PARTIAL_SUPPORTED:
|
||||
if (s_driver->supported == SOFTWARE_SUPPORTED_PARTIAL)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_UNSUPPORTED:
|
||||
if (s_driver->supported == SOFTWARE_SUPPORTED_NO)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_REGION:
|
||||
case UI_SW_REGION:
|
||||
{
|
||||
std::string name = m_filter.region.getname(s_driver->longname);
|
||||
|
||||
if(!name.empty() && name == filter_text)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case UI_SW_PUBLISHERS:
|
||||
case UI_SW_PUBLISHERS:
|
||||
{
|
||||
std::string name = m_filter.publisher.getname(s_driver->publisher);
|
||||
|
||||
if(!name.empty() && name == filter_text)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case UI_SW_YEARS:
|
||||
if(s_driver->year == filter_text)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_LIST:
|
||||
if(s_driver->listname == filter_text)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_TYPE:
|
||||
if(s_driver->devicetype == filter_text)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
default:
|
||||
case UI_SW_YEARS:
|
||||
if(s_driver->year == filter_text)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
break;
|
||||
|
||||
case UI_SW_LIST:
|
||||
if(s_driver->listname == filter_text)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
case UI_SW_TYPE:
|
||||
if(s_driver->devicetype == filter_text)
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
|
||||
default:
|
||||
m_displaylist.push_back(s_driver);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1310,7 +1310,7 @@ void ui_menu_select_software::build_list(std::vector<ui_software_info *> &s_driv
|
||||
// find approximate matches
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_software::find_matches(const char *str, int count)
|
||||
void menu_select_software::find_matches(const char *str, int count)
|
||||
{
|
||||
// allocate memory to track the penalty value
|
||||
std::vector<int> penalty(count, 9999);
|
||||
@ -1348,7 +1348,7 @@ void ui_menu_select_software::find_matches(const char *str, int count)
|
||||
// build custom display list
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_software::build_custom()
|
||||
void menu_select_software::build_custom()
|
||||
{
|
||||
std::vector<ui_software_info *> s_drivers;
|
||||
|
||||
@ -1388,7 +1388,7 @@ void ui_menu_select_software::build_custom()
|
||||
// draw left box
|
||||
//-------------------------------------------------
|
||||
|
||||
float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, float y2)
|
||||
float menu_select_software::draw_left_panel(float x1, float y1, float x2, float y2)
|
||||
{
|
||||
if (ui_globals::panels_status == SHOW_PANELS || ui_globals::panels_status == HIDE_RIGHT_PANEL)
|
||||
{
|
||||
@ -1546,7 +1546,7 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo
|
||||
// draw infos
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_software::infos_render(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_select_software::infos_render(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float line_height = ui().get_line_height();
|
||||
static std::string buffer;
|
||||
@ -1689,7 +1689,7 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_select_software::arts_render(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_select_software::arts_render(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float line_height = ui().get_line_height();
|
||||
static ui_software_info *oldsoft = nullptr;
|
||||
@ -1874,7 +1874,7 @@ void ui_menu_select_software::arts_render(void *selectedref, float origx1, float
|
||||
}
|
||||
}
|
||||
|
||||
void ui_menu_select_software::draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_select_software::draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
rgb_t fgcolor = UI_TEXT_COLOR;
|
||||
bool hide = (ui_globals::panels_status == HIDE_RIGHT_PANEL || ui_globals::panels_status == HIDE_BOTH);
|
||||
@ -1916,7 +1916,7 @@ void ui_menu_select_software::draw_right_panel(void *selectedref, float origx1,
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_software_parts::ui_software_parts(mame_ui_manager &mui, render_container *container, s_parts parts, ui_software_info *ui_info) : ui_menu(mui, container)
|
||||
software_parts::software_parts(mame_ui_manager &mui, render_container *container, s_parts parts, ui_software_info *ui_info) : menu(mui, container)
|
||||
{
|
||||
m_parts = parts;
|
||||
m_uiinfo = ui_info;
|
||||
@ -1926,7 +1926,7 @@ ui_software_parts::ui_software_parts(mame_ui_manager &mui, render_container *con
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_software_parts::~ui_software_parts()
|
||||
software_parts::~software_parts()
|
||||
{
|
||||
}
|
||||
|
||||
@ -1934,12 +1934,12 @@ ui_software_parts::~ui_software_parts()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_software_parts::populate()
|
||||
void software_parts::populate()
|
||||
{
|
||||
for (auto & elem : m_parts)
|
||||
item_append(elem.first.c_str(), elem.second.c_str(), 0, (void *)&elem);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
customtop = ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
|
||||
}
|
||||
|
||||
@ -1947,13 +1947,15 @@ void ui_software_parts::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_software_parts::handle()
|
||||
void software_parts::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(0);
|
||||
if (event != nullptr && event->iptkey == IPT_UI_SELECT && event->itemref != nullptr)
|
||||
const event *menu_event = process(0);
|
||||
if (menu_event && (menu_event->iptkey) == IPT_UI_SELECT && menu_event->itemref)
|
||||
{
|
||||
for (auto & elem : m_parts)
|
||||
if ((void*)&elem == event->itemref)
|
||||
{
|
||||
if ((void*)&elem == menu_event->itemref)
|
||||
{
|
||||
std::string error_string;
|
||||
std::string string_list = std::string(m_uiinfo->listname).append(":").append(m_uiinfo->shortname).append(":").append(elem.first).append(":").append(m_uiinfo->instance);
|
||||
@ -1969,15 +1971,17 @@ void ui_software_parts::handle()
|
||||
|
||||
mame_machine_manager::instance()->schedule_new_driver(*m_uiinfo->driver);
|
||||
machine().schedule_hard_reset();
|
||||
ui_menu::stack_reset(machine());
|
||||
menu::stack_reset(machine());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_software_parts::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void software_parts::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
ui().draw_text_full(container, _("Software part selection:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
@ -2008,7 +2012,7 @@ void ui_software_parts::custom_render(void *selectedref, float top, float bottom
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_bios_selection::ui_bios_selection(mame_ui_manager &mui, render_container *container, s_bios biosname, void *_driver, bool _software, bool _inlist) : ui_menu(mui, container)
|
||||
bios_selection::bios_selection(mame_ui_manager &mui, render_container *container, s_bios biosname, void *_driver, bool _software, bool _inlist) : menu(mui, container)
|
||||
{
|
||||
m_bios = biosname;
|
||||
m_driver = _driver;
|
||||
@ -2020,7 +2024,7 @@ ui_bios_selection::ui_bios_selection(mame_ui_manager &mui, render_container *con
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_bios_selection::~ui_bios_selection()
|
||||
bios_selection::~bios_selection()
|
||||
{
|
||||
}
|
||||
|
||||
@ -2028,12 +2032,12 @@ ui_bios_selection::~ui_bios_selection()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_bios_selection::populate()
|
||||
void bios_selection::populate()
|
||||
{
|
||||
for (auto & elem : m_bios)
|
||||
item_append(elem.first.c_str(), nullptr, 0, (void *)&elem.first);
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
customtop = ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
|
||||
}
|
||||
|
||||
@ -2041,14 +2045,16 @@ void ui_bios_selection::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_bios_selection::handle()
|
||||
void bios_selection::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
emu_options &moptions = machine().options();
|
||||
if (event != nullptr && event->iptkey == IPT_UI_SELECT && event->itemref != nullptr)
|
||||
if (menu_event && menu_event->iptkey == IPT_UI_SELECT && menu_event->itemref)
|
||||
{
|
||||
for (auto & elem : m_bios)
|
||||
if ((void*)&elem.first == event->itemref)
|
||||
{
|
||||
if ((void*)&elem.first == menu_event->itemref)
|
||||
{
|
||||
if (!m_software)
|
||||
{
|
||||
@ -2067,7 +2073,7 @@ void ui_bios_selection::handle()
|
||||
moptions.set_value(OPTION_BIOS, elem.second, OPTION_PRIORITY_CMDLINE, error);
|
||||
mame_machine_manager::instance()->schedule_new_driver(*s_driver);
|
||||
machine().schedule_hard_reset();
|
||||
ui_menu::stack_reset(machine());
|
||||
menu::stack_reset(machine());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2091,7 +2097,7 @@ void ui_bios_selection::handle()
|
||||
parts.emplace(swpart.name(), menu_part_name);
|
||||
}
|
||||
}
|
||||
ui_menu::stack_push(global_alloc_clear<ui_software_parts>(ui(), container, parts, ui_swinfo));
|
||||
menu::stack_push<software_parts>(ui(), container, parts, ui_swinfo);
|
||||
return;
|
||||
}
|
||||
std::string error_string;
|
||||
@ -2105,16 +2111,18 @@ void ui_bios_selection::handle()
|
||||
reselect_last::set(true);
|
||||
mame_machine_manager::instance()->schedule_new_driver(drivlist.driver());
|
||||
machine().schedule_hard_reset();
|
||||
ui_menu::stack_reset(machine());
|
||||
menu::stack_reset(machine());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_bios_selection::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void bios_selection::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
ui().draw_text_full(container, _("Bios selection:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
@ -2140,3 +2148,5 @@ void ui_bios_selection::custom_render(void *selectedref, float top, float bottom
|
||||
ui().draw_text_full(container, _("Bios selection:"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -9,20 +9,22 @@
|
||||
***************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_SELSOFT_H__
|
||||
#define __UI_SELSOFT_H__
|
||||
#ifndef MAME_FRONTEND_UI_SELSOFT_H
|
||||
#define MAME_FRONTEND_UI_SELSOFT_H
|
||||
|
||||
#include "ui/custmenu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
using s_bios = std::vector<std::pair<std::string, int>>;
|
||||
using s_parts = std::unordered_map<std::string, std::string>;
|
||||
|
||||
// Menu Class
|
||||
class ui_menu_select_software : public ui_menu
|
||||
class menu_select_software : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_select_software(mame_ui_manager &mui, render_container *container, const game_driver *driver);
|
||||
virtual ~ui_menu_select_software();
|
||||
menu_select_software(mame_ui_manager &mui, render_container *container, const game_driver *driver);
|
||||
virtual ~menu_select_software() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -57,16 +59,16 @@ private:
|
||||
void infos_render(void *selectedref, float x1, float y1, float x2, float y2);
|
||||
|
||||
// handlers
|
||||
void inkey_select(const ui_menu_event *menu_event);
|
||||
void inkey_special(const ui_menu_event *menu_event);
|
||||
void inkey_configure(const ui_menu_event *menu_event);
|
||||
void inkey_select(const event *menu_event);
|
||||
void inkey_special(const event *menu_event);
|
||||
void inkey_configure(const event *menu_event);
|
||||
};
|
||||
|
||||
class ui_software_parts : public ui_menu
|
||||
class software_parts : public menu
|
||||
{
|
||||
public:
|
||||
ui_software_parts(mame_ui_manager &mui, render_container *container, s_parts parts, ui_software_info *ui_info);
|
||||
virtual ~ui_software_parts();
|
||||
software_parts(mame_ui_manager &mui, render_container *container, s_parts parts, ui_software_info *ui_info);
|
||||
virtual ~software_parts() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -76,11 +78,11 @@ private:
|
||||
s_parts m_parts;
|
||||
};
|
||||
|
||||
class ui_bios_selection : public ui_menu
|
||||
class bios_selection : public menu
|
||||
{
|
||||
public:
|
||||
ui_bios_selection(mame_ui_manager &mui, render_container *container, s_bios biosname, void *driver, bool software, bool inlist);
|
||||
virtual ~ui_bios_selection();
|
||||
bios_selection(mame_ui_manager &mui, render_container *container, s_bios biosname, void *driver, bool software, bool inlist);
|
||||
virtual ~bios_selection() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -106,5 +108,6 @@ private:
|
||||
// Getter
|
||||
bool has_multiple_bios(const game_driver *driver, s_bios &biosname);
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif /* __UI_SELSOFT_H__ */
|
||||
#endif /* MAME_FRONTEND_UI_SELSOFT_H */
|
||||
|
@ -9,24 +9,29 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "mame.h"
|
||||
#include "emuopts.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "uiinput.h"
|
||||
|
||||
#include "ui/simpleselgame.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/miscmenu.h"
|
||||
#include "ui/optsmenu.h"
|
||||
#include "drivenum.h"
|
||||
|
||||
#include "audit.h"
|
||||
#include "drivenum.h"
|
||||
#include "emuopts.h"
|
||||
#include "mame.h"
|
||||
#include "uiinput.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_simple_menu_select_game::ui_simple_menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename) : ui_menu(mui, container), m_driverlist(driver_list::total() + 1)
|
||||
simple_menu_select_game::simple_menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename) : menu(mui, container), m_driverlist(driver_list::total() + 1)
|
||||
{
|
||||
build_driver_list();
|
||||
if(gamename)
|
||||
@ -39,7 +44,7 @@ ui_simple_menu_select_game::ui_simple_menu_select_game(mame_ui_manager &mui, ren
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_simple_menu_select_game::~ui_simple_menu_select_game()
|
||||
simple_menu_select_game::~simple_menu_select_game()
|
||||
{
|
||||
}
|
||||
|
||||
@ -50,7 +55,7 @@ ui_simple_menu_select_game::~ui_simple_menu_select_game()
|
||||
// drivers
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_simple_menu_select_game::build_driver_list()
|
||||
void simple_menu_select_game::build_driver_list()
|
||||
{
|
||||
// start with an empty list
|
||||
m_drivlist = std::make_unique<driver_enumerator>(machine().options());
|
||||
@ -93,13 +98,13 @@ void ui_simple_menu_select_game::build_driver_list()
|
||||
// handle - handle the game select menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_simple_menu_select_game::handle()
|
||||
void simple_menu_select_game::handle()
|
||||
{
|
||||
// ignore pause keys by swallowing them before we process the menu
|
||||
machine().ui_input().pressed(IPT_UI_PAUSE);
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
// reset the error on any future menu_event
|
||||
@ -140,13 +145,13 @@ void ui_simple_menu_select_game::handle()
|
||||
// inkey_select
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_simple_menu_select_game::inkey_select(const ui_menu_event *menu_event)
|
||||
void simple_menu_select_game::inkey_select(const event *menu_event)
|
||||
{
|
||||
const game_driver *driver = (const game_driver *)menu_event->itemref;
|
||||
|
||||
// special case for configure inputs
|
||||
if ((FPTR)driver == 1)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_game_options>(ui(), container));
|
||||
menu::stack_push<menu_game_options>(ui(), container);
|
||||
// anything else is a driver
|
||||
else
|
||||
{
|
||||
@ -161,13 +166,13 @@ void ui_simple_menu_select_game::inkey_select(const ui_menu_event *menu_event)
|
||||
{
|
||||
mame_machine_manager::instance()->schedule_new_driver(*driver);
|
||||
machine().schedule_hard_reset();
|
||||
ui_menu::stack_reset(machine());
|
||||
menu::stack_reset(machine());
|
||||
}
|
||||
|
||||
// otherwise, display an error
|
||||
else
|
||||
{
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
m_error = true;
|
||||
}
|
||||
}
|
||||
@ -178,13 +183,13 @@ void ui_simple_menu_select_game::inkey_select(const ui_menu_event *menu_event)
|
||||
// inkey_cancel
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_simple_menu_select_game::inkey_cancel(const ui_menu_event *menu_event)
|
||||
void simple_menu_select_game::inkey_cancel(const event *menu_event)
|
||||
{
|
||||
// escape pressed with non-empty text clears the text
|
||||
if (m_search[0] != 0)
|
||||
{
|
||||
m_search[0] = '\0';
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +198,7 @@ void ui_simple_menu_select_game::inkey_cancel(const ui_menu_event *menu_event)
|
||||
// inkey_special - typed characters append to the buffer
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_simple_menu_select_game::inkey_special(const ui_menu_event *menu_event)
|
||||
void simple_menu_select_game::inkey_special(const event *menu_event)
|
||||
{
|
||||
// typed characters append to the buffer
|
||||
int buflen = strlen(m_search);
|
||||
@ -203,7 +208,7 @@ void ui_simple_menu_select_game::inkey_special(const ui_menu_event *menu_event)
|
||||
{
|
||||
*(char *)utf8_previous_char(&m_search[buflen]) = 0;
|
||||
m_rerandomize = true;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
|
||||
// if it's any other key and we're not maxed out, update
|
||||
@ -211,7 +216,7 @@ void ui_simple_menu_select_game::inkey_special(const ui_menu_event *menu_event)
|
||||
{
|
||||
buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, menu_event->unichar);
|
||||
m_search[buflen] = 0;
|
||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,7 +225,7 @@ void ui_simple_menu_select_game::inkey_special(const ui_menu_event *menu_event)
|
||||
// populate - populate the game select menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_simple_menu_select_game::populate()
|
||||
void simple_menu_select_game::populate()
|
||||
{
|
||||
int matchcount;
|
||||
int curitem;
|
||||
@ -238,7 +243,7 @@ void ui_simple_menu_select_game::populate()
|
||||
"the docs directory for information on configuring %2$s."),
|
||||
emulator_info::get_configname(),
|
||||
emulator_info::get_appname());
|
||||
item_append(txt.c_str(), nullptr, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, nullptr);
|
||||
item_append(txt.c_str(), nullptr, FLAG_MULTILINE | FLAG_REDTEXT, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -255,14 +260,14 @@ void ui_simple_menu_select_game::populate()
|
||||
if (curmatch != -1)
|
||||
{
|
||||
int cloneof = m_drivlist->non_bios_clone(curmatch);
|
||||
item_append(m_drivlist->driver(curmatch).name, m_drivlist->driver(curmatch).description, (cloneof == -1) ? 0 : MENU_FLAG_INVERT, (void *)&m_drivlist->driver(curmatch));
|
||||
item_append(m_drivlist->driver(curmatch).name, m_drivlist->driver(curmatch).description, (cloneof == -1) ? 0 : FLAG_INVERT, (void *)&m_drivlist->driver(curmatch));
|
||||
}
|
||||
}
|
||||
|
||||
// if we're forced into this, allow general input configuration as well
|
||||
if (ui_menu::stack_has_special_main_menu())
|
||||
if (menu::stack_has_special_main_menu())
|
||||
{
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("Configure Options"), nullptr, 0, (void *)1);
|
||||
skip_main_items = 1;
|
||||
}
|
||||
@ -277,7 +282,7 @@ void ui_simple_menu_select_game::populate()
|
||||
// custom_render - perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_simple_menu_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void simple_menu_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
const game_driver *driver;
|
||||
float width, maxwidth;
|
||||
@ -425,18 +430,16 @@ void ui_simple_menu_select_game::custom_render(void *selectedref, float top, flo
|
||||
// select menu to be visible and inescapable
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_simple_menu_select_game::force_game_select(mame_ui_manager &mui, render_container *container)
|
||||
void simple_menu_select_game::force_game_select(mame_ui_manager &mui, render_container *container)
|
||||
{
|
||||
char *gamename = (char *)mui.machine().options().system_name();
|
||||
|
||||
// reset the menu stack
|
||||
ui_menu::stack_reset(mui.machine());
|
||||
menu::stack_reset(mui.machine());
|
||||
|
||||
// add the quit entry followed by the game select entry
|
||||
ui_menu *quit = global_alloc_clear<ui_menu_quit_game>(mui, container);
|
||||
quit->set_special_main_menu(true);
|
||||
ui_menu::stack_push(quit);
|
||||
ui_menu::stack_push(global_alloc_clear<ui_simple_menu_select_game>(mui, container, gamename));
|
||||
menu::stack_push_special_main<menu_quit_game>(mui, container);
|
||||
menu::stack_push<simple_menu_select_game>(mui, container, gamename);
|
||||
|
||||
// force the menus on
|
||||
mui.show_menu();
|
||||
@ -444,3 +447,5 @@ void ui_simple_menu_select_game::force_game_select(mame_ui_manager &mui, render_
|
||||
// make sure MAME is paused
|
||||
mui.machine().pause();
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,17 +10,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_SIMPLESELGAME_H__
|
||||
#define __UI_SIMPLESELGAME_H__
|
||||
#ifndef MAME_FRONTEND_UI_SIMPLESELGAME_H
|
||||
#define MAME_FRONTEND_UI_SIMPLESELGAME_H
|
||||
|
||||
#include "menu.h"
|
||||
|
||||
class driver_enumerator;
|
||||
|
||||
class ui_simple_menu_select_game : public ui_menu {
|
||||
namespace ui {
|
||||
|
||||
class simple_menu_select_game : public menu {
|
||||
public:
|
||||
ui_simple_menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename);
|
||||
virtual ~ui_simple_menu_select_game();
|
||||
simple_menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename);
|
||||
virtual ~simple_menu_select_game();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -41,9 +43,11 @@ private:
|
||||
|
||||
// internal methods
|
||||
void build_driver_list();
|
||||
void inkey_select(const ui_menu_event *menu_event);
|
||||
void inkey_cancel(const ui_menu_event *menu_event);
|
||||
void inkey_special(const ui_menu_event *menu_event);
|
||||
void inkey_select(const event *menu_event);
|
||||
void inkey_cancel(const event *menu_event);
|
||||
void inkey_special(const event *menu_event);
|
||||
};
|
||||
|
||||
#endif /* __UI_SELGAME_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_SIMPLESELGAME_H */
|
||||
|
@ -11,17 +11,19 @@
|
||||
#include "emu.h"
|
||||
|
||||
#include "osdepend.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/sliders.h"
|
||||
#include "ui/slider.h"
|
||||
|
||||
ui_menu_sliders::ui_menu_sliders(mame_ui_manager &mui, render_container *container, bool menuless_mode) : ui_menu(mui, container)
|
||||
namespace ui {
|
||||
|
||||
menu_sliders::menu_sliders(mame_ui_manager &mui, render_container *container, bool menuless_mode) : menu(mui, container)
|
||||
{
|
||||
m_menuless_mode = m_hidden = menuless_mode;
|
||||
}
|
||||
|
||||
ui_menu_sliders::~ui_menu_sliders()
|
||||
menu_sliders::~menu_sliders()
|
||||
{
|
||||
}
|
||||
|
||||
@ -29,16 +31,16 @@ ui_menu_sliders::~ui_menu_sliders()
|
||||
menu_sliders - handle the sliders menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_sliders::handle()
|
||||
void menu_sliders::handle()
|
||||
{
|
||||
const ui_menu_event *menu_event;
|
||||
const event *menu_event;
|
||||
|
||||
/* process the menu */
|
||||
menu_event = process(UI_MENU_PROCESS_LR_REPEAT | (m_hidden ? UI_MENU_PROCESS_CUSTOM_ONLY : 0));
|
||||
menu_event = process(PROCESS_LR_REPEAT | (m_hidden ? PROCESS_CUSTOM_ONLY : 0));
|
||||
if (menu_event != nullptr)
|
||||
{
|
||||
/* handle keys if there is a valid item selected */
|
||||
if (menu_event->itemref != nullptr && menu_event->type == ui_menu_item_type::SLIDER)
|
||||
if (menu_event->itemref != nullptr && menu_event->type == menu_item_type::SLIDER)
|
||||
{
|
||||
const slider_state *slider = (const slider_state *)menu_event->itemref;
|
||||
INT32 curvalue = (*slider->update)(machine(), slider->arg, slider->id, nullptr, SLIDER_NOCHANGE);
|
||||
@ -52,7 +54,7 @@ void ui_menu_sliders::handle()
|
||||
/* toggle visibility */
|
||||
case IPT_UI_ON_SCREEN_DISPLAY:
|
||||
if (m_menuless_mode)
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
else
|
||||
m_hidden = !m_hidden;
|
||||
break;
|
||||
@ -104,7 +106,7 @@ void ui_menu_sliders::handle()
|
||||
|
||||
/* update the slider and recompute the menu */
|
||||
(*slider->update)(machine(), slider->arg, slider->id, nullptr, newvalue);
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,24 +136,24 @@ void ui_menu_sliders::handle()
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_sliders::populate()
|
||||
void menu_sliders::populate()
|
||||
{
|
||||
std::string tempstring;
|
||||
|
||||
/* add UI sliders */
|
||||
std::vector<ui_menu_item> ui_sliders = ui().get_slider_list();
|
||||
for (ui_menu_item item : ui_sliders)
|
||||
std::vector<menu_item> ui_sliders = ui().get_slider_list();
|
||||
for (menu_item item : ui_sliders)
|
||||
{
|
||||
if (item.type == ui_menu_item_type::SLIDER)
|
||||
if (item.type == menu_item_type::SLIDER)
|
||||
{
|
||||
slider_state* slider = reinterpret_cast<slider_state *>(item.ref);
|
||||
INT32 curval = (*slider->update)(machine(), slider->arg, slider->id, &tempstring, SLIDER_NOCHANGE);
|
||||
UINT32 flags = 0;
|
||||
if (curval > slider->minval)
|
||||
flags |= MENU_FLAG_LEFT_ARROW;
|
||||
flags |= FLAG_LEFT_ARROW;
|
||||
if (curval < slider->maxval)
|
||||
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||
item_append(slider->description, tempstring.c_str(), flags, (void *)slider, ui_menu_item_type::SLIDER);
|
||||
flags |= FLAG_RIGHT_ARROW;
|
||||
item_append(slider->description, tempstring.c_str(), flags, (void *)slider, menu_item_type::SLIDER);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -159,22 +161,22 @@ void ui_menu_sliders::populate()
|
||||
}
|
||||
}
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
/* add OSD options */
|
||||
std::vector<ui_menu_item> osd_sliders = machine().osd().get_slider_list();
|
||||
for (ui_menu_item item : osd_sliders)
|
||||
std::vector<menu_item> osd_sliders = machine().osd().get_slider_list();
|
||||
for (menu_item item : osd_sliders)
|
||||
{
|
||||
if (item.type == ui_menu_item_type::SLIDER)
|
||||
if (item.type == menu_item_type::SLIDER)
|
||||
{
|
||||
slider_state* slider = reinterpret_cast<slider_state *>(item.ref);
|
||||
INT32 curval = (*slider->update)(machine(), slider->arg, slider->id, &tempstring, SLIDER_NOCHANGE);
|
||||
UINT32 flags = 0;
|
||||
if (curval > slider->minval)
|
||||
flags |= MENU_FLAG_LEFT_ARROW;
|
||||
flags |= FLAG_LEFT_ARROW;
|
||||
if (curval < slider->maxval)
|
||||
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||
item_append(slider->description, tempstring.c_str(), flags, (void *)slider, ui_menu_item_type::SLIDER);
|
||||
flags |= FLAG_RIGHT_ARROW;
|
||||
item_append(slider->description, tempstring.c_str(), flags, (void *)slider, menu_item_type::SLIDER);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -190,7 +192,7 @@ void ui_menu_sliders::populate()
|
||||
rendering
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_sliders::custom_render(void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
|
||||
void menu_sliders::custom_render(void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
|
||||
{
|
||||
const slider_state *curslider = (const slider_state *)selectedref;
|
||||
if (curslider != nullptr)
|
||||
@ -257,26 +259,28 @@ void ui_menu_sliders::custom_render(void *selectedref, float top, float bottom,
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_slider_ui_handler - pushes the slider
|
||||
slider_ui_handler - pushes the slider
|
||||
menu on the stack and hands off to the
|
||||
standard menu handler
|
||||
-------------------------------------------------*/
|
||||
|
||||
UINT32 ui_menu_sliders::ui_handler(mame_ui_manager &mui, render_container *container, UINT32 state)
|
||||
UINT32 menu_sliders::ui_handler(mame_ui_manager &mui, render_container *container, UINT32 state)
|
||||
{
|
||||
UINT32 result;
|
||||
|
||||
/* if this is the first call, push the sliders menu */
|
||||
if (state)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_sliders>(mui, container, true));
|
||||
menu::stack_push<menu_sliders>(mui, container, true);
|
||||
|
||||
/* handle standard menus */
|
||||
result = ui_menu::ui_handler(mui, container, state);
|
||||
result = menu::ui_handler(mui, container, state);
|
||||
|
||||
/* if we are cancelled, pop the sliders menu */
|
||||
if (result == UI_HANDLER_CANCEL)
|
||||
ui_menu::stack_pop(mui.machine());
|
||||
menu::stack_pop(mui.machine());
|
||||
|
||||
ui_menu_sliders *uim = dynamic_cast<ui_menu_sliders *>(menu_stack);
|
||||
menu_sliders *uim = topmost_menu<menu_sliders>();
|
||||
return uim && uim->m_menuless_mode ? 0 : UI_HANDLER_CANCEL;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,15 +10,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_SLIDERS_H__
|
||||
#define __UI_SLIDERS_H__
|
||||
#ifndef MAME_FRONTEND_UI_SLIDERS_H
|
||||
#define MAME_FRONTEND_UI_SLIDERS_H
|
||||
|
||||
#include <map>
|
||||
#include "ui/menu.h"
|
||||
|
||||
class ui_menu_sliders : public ui_menu {
|
||||
namespace ui {
|
||||
|
||||
class menu_sliders : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_sliders(mame_ui_manager &mui, render_container *container, bool menuless_mode = false);
|
||||
virtual ~ui_menu_sliders();
|
||||
menu_sliders(mame_ui_manager &mui, render_container *container, bool menuless_mode = false);
|
||||
virtual ~menu_sliders() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -35,5 +38,6 @@ private:
|
||||
bool m_hidden;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif /* __UI_SLIDERS_H__ */
|
||||
#endif /* MAME_FRONTEND_UI_SLIDERS_H */
|
||||
|
@ -9,18 +9,21 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "emuopts.h"
|
||||
#include "mameopts.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/slotopt.h"
|
||||
#include "ui/devopt.h"
|
||||
|
||||
#include "emuopts.h"
|
||||
#include "mameopts.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_slot_get_current_option - returns
|
||||
slot_get_current_option - returns
|
||||
-------------------------------------------------*/
|
||||
device_slot_option *ui_menu_slot_devices::slot_get_current_option(device_slot_interface &slot)
|
||||
device_slot_option *menu_slot_devices::slot_get_current_option(device_slot_interface &slot)
|
||||
{
|
||||
std::string current;
|
||||
if (slot.fixed())
|
||||
@ -37,9 +40,9 @@ device_slot_option *ui_menu_slot_devices::slot_get_current_option(device_slot_in
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_slot_get_current_index - returns
|
||||
slot_get_current_index - returns
|
||||
-------------------------------------------------*/
|
||||
int ui_menu_slot_devices::slot_get_current_index(device_slot_interface &slot)
|
||||
int menu_slot_devices::slot_get_current_index(device_slot_interface &slot)
|
||||
{
|
||||
const device_slot_option *current = slot_get_current_option(slot);
|
||||
|
||||
@ -60,9 +63,9 @@ int ui_menu_slot_devices::slot_get_current_index(device_slot_interface &slot)
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_slot_get_length - returns
|
||||
slot_get_length - returns
|
||||
-------------------------------------------------*/
|
||||
int ui_menu_slot_devices::slot_get_length(device_slot_interface &slot)
|
||||
int menu_slot_devices::slot_get_length(device_slot_interface &slot)
|
||||
{
|
||||
int val = 0;
|
||||
for (const device_slot_option &option : slot.option_list())
|
||||
@ -73,9 +76,9 @@ int ui_menu_slot_devices::slot_get_length(device_slot_interface &slot)
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_slot_get_next - returns
|
||||
slot_get_next - returns
|
||||
-------------------------------------------------*/
|
||||
const char *ui_menu_slot_devices::slot_get_next(device_slot_interface &slot)
|
||||
const char *menu_slot_devices::slot_get_next(device_slot_interface &slot)
|
||||
{
|
||||
int idx = slot_get_current_index(slot);
|
||||
if (idx < 0)
|
||||
@ -90,9 +93,9 @@ const char *ui_menu_slot_devices::slot_get_next(device_slot_interface &slot)
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_slot_get_prev - returns
|
||||
slot_get_prev - returns
|
||||
-------------------------------------------------*/
|
||||
const char *ui_menu_slot_devices::slot_get_prev(device_slot_interface &slot)
|
||||
const char *menu_slot_devices::slot_get_prev(device_slot_interface &slot)
|
||||
{
|
||||
int idx = slot_get_current_index(slot);
|
||||
if (idx < 0)
|
||||
@ -107,9 +110,9 @@ const char *ui_menu_slot_devices::slot_get_prev(device_slot_interface &slot)
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_slot_get_option - returns
|
||||
slot_get_option - returns
|
||||
-------------------------------------------------*/
|
||||
const char *ui_menu_slot_devices::slot_get_option(device_slot_interface &slot, int index)
|
||||
const char *menu_slot_devices::slot_get_option(device_slot_interface &slot, int index)
|
||||
{
|
||||
if (index >= 0)
|
||||
{
|
||||
@ -129,11 +132,11 @@ const char *ui_menu_slot_devices::slot_get_option(device_slot_interface &slot, i
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_set_use_natural_keyboard - specifies
|
||||
set_use_natural_keyboard - specifies
|
||||
whether the natural keyboard is active
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_slot_devices::set_slot_device(device_slot_interface &slot, const char *val)
|
||||
void menu_slot_devices::set_slot_device(device_slot_interface &slot, const char *val)
|
||||
{
|
||||
std::string error;
|
||||
machine().options().set_value(slot.device().tag()+1, val, OPTION_PRIORITY_CMDLINE, error);
|
||||
@ -145,11 +148,11 @@ void ui_menu_slot_devices::set_slot_device(device_slot_interface &slot, const ch
|
||||
slot device menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_slot_devices::ui_menu_slot_devices(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_slot_devices::menu_slot_devices(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_slot_devices::populate()
|
||||
void menu_slot_devices::populate()
|
||||
{
|
||||
/* cycle through all devices for this system */
|
||||
for (device_slot_interface &slot : slot_interface_iterator(machine().root_device()))
|
||||
@ -166,24 +169,24 @@ void ui_menu_slot_devices::populate()
|
||||
opt_name.append(_(" [internal]"));
|
||||
}
|
||||
|
||||
item_append(slot.device().tag() + 1, opt_name.c_str(), (slot.fixed() || slot_get_length(slot) == 0) ? 0 : (MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), (void *)&slot);
|
||||
item_append(slot.device().tag() + 1, opt_name.c_str(), (slot.fixed() || slot_get_length(slot) == 0) ? 0 : (FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW), (void *)&slot);
|
||||
}
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
item_append(_("Reset"), nullptr, 0, (void *)1);
|
||||
}
|
||||
|
||||
ui_menu_slot_devices::~ui_menu_slot_devices()
|
||||
menu_slot_devices::~menu_slot_devices()
|
||||
{
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_menu_slot_devices - menu that
|
||||
menu_slot_devices - menu that
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_slot_devices::handle()
|
||||
void menu_slot_devices::handle()
|
||||
{
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
@ -197,14 +200,16 @@ void ui_menu_slot_devices::handle()
|
||||
device_slot_interface *slot = (device_slot_interface *)menu_event->itemref;
|
||||
const char *val = (menu_event->iptkey == IPT_UI_LEFT) ? slot_get_prev(*slot) : slot_get_next(*slot);
|
||||
set_slot_device(*slot, val);
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
device_slot_interface *slot = (device_slot_interface *)menu_event->itemref;
|
||||
device_slot_option *option = slot_get_current_option(*slot);
|
||||
if (option)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_device_config>(ui(), container, slot, option));
|
||||
menu::stack_push<menu_device_config>(ui(), container, slot, option);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,13 +10,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_SLOTOPT_H__
|
||||
#define __UI_SLOTOPT_H__
|
||||
#ifndef MAME_FRONTEND_UI_SLOTOPT_H
|
||||
#define MAME_FRONTEND_UI_SLOTOPT_H
|
||||
|
||||
class ui_menu_slot_devices : public ui_menu {
|
||||
#include "ui/menu.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
class menu_slot_devices : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_slot_devices(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_slot_devices();
|
||||
menu_slot_devices(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_slot_devices() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -30,4 +36,6 @@ private:
|
||||
void set_slot_device(device_slot_interface &slot, const char *val);
|
||||
};
|
||||
|
||||
#endif /* __UI_SLOTOPT_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_SLOTOPT_H */
|
||||
|
@ -10,18 +10,19 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/sndmenu.h"
|
||||
#include "ui/selector.h"
|
||||
#include "../osd/modules/lib/osdobj_common.h" // TODO: remove
|
||||
|
||||
const int ui_menu_sound_options::m_sound_rate[] = { 11025, 22050, 44100, 48000 };
|
||||
namespace ui {
|
||||
|
||||
const int menu_sound_options::m_sound_rate[] = { 11025, 22050, 44100, 48000 };
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_sound_options::ui_menu_sound_options(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_sound_options::menu_sound_options(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
osd_options &options = downcast<osd_options &>(mui.machine().options());
|
||||
|
||||
@ -43,7 +44,7 @@ ui_menu_sound_options::ui_menu_sound_options(mame_ui_manager &mui, render_contai
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_sound_options::~ui_menu_sound_options()
|
||||
menu_sound_options::~menu_sound_options()
|
||||
{
|
||||
std::string error_string;
|
||||
emu_options &moptions = machine().options();
|
||||
@ -69,54 +70,54 @@ ui_menu_sound_options::~ui_menu_sound_options()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_sound_options::handle()
|
||||
void menu_sound_options::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
switch ((FPTR)m_event->itemref)
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
{
|
||||
case ENABLE_SOUND:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
m_sound = !m_sound;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
case ENABLE_SOUND:
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT || menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
m_sound = !m_sound;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case SAMPLE_RATE:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
(m_event->iptkey == IPT_UI_LEFT) ? m_cur_rates-- : m_cur_rates++;
|
||||
changed = true;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
int total = ARRAY_LENGTH(m_sound_rate);
|
||||
std::vector<std::string> s_sel(total);
|
||||
for (int index = 0; index < total; index++)
|
||||
s_sel[index] = std::to_string(m_sound_rate[index]);
|
||||
case SAMPLE_RATE:
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
(menu_event->iptkey == IPT_UI_LEFT) ? m_cur_rates-- : m_cur_rates++;
|
||||
changed = true;
|
||||
}
|
||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
int total = ARRAY_LENGTH(m_sound_rate);
|
||||
std::vector<std::string> s_sel(total);
|
||||
for (int index = 0; index < total; index++)
|
||||
s_sel[index] = std::to_string(m_sound_rate[index]);
|
||||
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(ui(), container, s_sel, m_cur_rates));
|
||||
}
|
||||
break;
|
||||
menu::stack_push<menu_selector>(ui(), container, s_sel, m_cur_rates);
|
||||
}
|
||||
break;
|
||||
|
||||
case ENABLE_SAMPLES:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
m_samples = !m_samples;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
case ENABLE_SAMPLES:
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT || menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
m_samples = !m_samples;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
|
||||
}
|
||||
|
||||
@ -124,16 +125,16 @@ void ui_menu_sound_options::handle()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_sound_options::populate()
|
||||
void menu_sound_options::populate()
|
||||
{
|
||||
UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_sound_rate) - 1, m_cur_rates);
|
||||
m_sample_rate = m_sound_rate[m_cur_rates];
|
||||
|
||||
// add options items
|
||||
item_append(_("Sound"), m_sound ? _("On") : _("Off"), m_sound ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)ENABLE_SOUND);
|
||||
item_append(_("Sound"), m_sound ? _("On") : _("Off"), m_sound ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(FPTR)ENABLE_SOUND);
|
||||
item_append(_("Sample Rate"), string_format("%d", m_sample_rate).c_str(), arrow_flags, (void *)(FPTR)SAMPLE_RATE);
|
||||
item_append(_("Use External Samples"), m_samples ? _("On") : _("Off"), m_samples ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)ENABLE_SAMPLES);
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(_("Use External Samples"), m_samples ? _("On") : _("Off"), m_samples ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(FPTR)ENABLE_SAMPLES);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
customtop = ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
|
||||
}
|
||||
@ -142,7 +143,7 @@ void ui_menu_sound_options::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_sound_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void menu_sound_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
ui().draw_text_full(container, _("Sound Options"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
@ -168,3 +169,5 @@ void ui_menu_sound_options::custom_render(void *selectedref, float top, float bo
|
||||
ui().draw_text_full(container, _("Sound Options"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,17 +10,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_SNDMENU_H__
|
||||
#define __UI_SNDMENU_H__
|
||||
#ifndef MAME_FRONTEND_UI_SNDMENU_H
|
||||
#define MAME_FRONTEND_UI_SNDMENU_H
|
||||
|
||||
#include "ui/menu.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// class sound options menu
|
||||
//-------------------------------------------------
|
||||
class ui_menu_sound_options : public ui_menu
|
||||
class menu_sound_options : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_sound_options(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_sound_options();
|
||||
menu_sound_options(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_sound_options() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
@ -39,4 +43,6 @@ private:
|
||||
bool m_samples, m_sound;
|
||||
};
|
||||
|
||||
#endif /* __UI_SNDMENU_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_SNDMENU_H */
|
||||
|
@ -13,14 +13,118 @@
|
||||
#include "ui/submenu.h"
|
||||
#include "ui/utils.h"
|
||||
#include "ui/menuitem.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace ui {
|
||||
|
||||
std::vector<submenu::option> submenu::misc_options = {
|
||||
{ submenu::option_type::HEAD, __("Miscellaneous Options") },
|
||||
{ submenu::option_type::UI, __("Re-select last machine played"), OPTION_REMEMBER_LAST },
|
||||
{ submenu::option_type::UI, __("Enlarge images in the right panel"), OPTION_ENLARGE_SNAPS },
|
||||
{ submenu::option_type::UI, __("DATs info"), OPTION_DATS_ENABLED },
|
||||
{ submenu::option_type::EMU, __("Cheats"), OPTION_CHEAT },
|
||||
{ submenu::option_type::EMU, __("Show mouse pointer"), OPTION_UI_MOUSE },
|
||||
{ submenu::option_type::EMU, __("Confirm quit from machines"), OPTION_CONFIRM_QUIT },
|
||||
{ submenu::option_type::EMU, __("Skip information screen at startup"), OPTION_SKIP_GAMEINFO },
|
||||
{ submenu::option_type::UI, __("Force 4:3 aspect for snapshot display"), OPTION_FORCED4X3 },
|
||||
{ submenu::option_type::UI, __("Use image as background"), OPTION_USE_BACKGROUND },
|
||||
{ submenu::option_type::UI, __("Skip bios selection menu"), OPTION_SKIP_BIOS_MENU },
|
||||
{ submenu::option_type::UI, __("Skip software parts selection menu"), OPTION_SKIP_PARTS_MENU },
|
||||
{ submenu::option_type::UI, __("Info auto audit"), OPTION_INFO_AUTO_AUDIT },
|
||||
};
|
||||
|
||||
std::vector<submenu::option> submenu::advanced_options = {
|
||||
{ submenu::option_type::HEAD, __("Advanced Options") },
|
||||
{ submenu::option_type::HEAD, __("Performance Options") },
|
||||
{ submenu::option_type::EMU, __("Auto frame skip"), OPTION_AUTOFRAMESKIP },
|
||||
{ submenu::option_type::EMU, __("Frame skip"), OPTION_FRAMESKIP },
|
||||
{ submenu::option_type::EMU, __("Throttle"), OPTION_THROTTLE },
|
||||
{ submenu::option_type::EMU, __("Sleep"), OPTION_SLEEP },
|
||||
{ submenu::option_type::EMU, __("Speed"), OPTION_SPEED },
|
||||
{ submenu::option_type::EMU, __("Refresh speed"), OPTION_REFRESHSPEED },
|
||||
|
||||
{ submenu::option_type::HEAD, __("Rotation Options") },
|
||||
{ submenu::option_type::EMU, __("Rotate"), OPTION_ROTATE },
|
||||
{ submenu::option_type::EMU, __("Rotate right"), OPTION_ROR },
|
||||
{ submenu::option_type::EMU, __("Rotate left"), OPTION_ROL },
|
||||
{ submenu::option_type::EMU, __("Auto rotate right"), OPTION_AUTOROR },
|
||||
{ submenu::option_type::EMU, __("Auto rotate left"), OPTION_AUTOROL },
|
||||
{ submenu::option_type::EMU, __("Flip X"), OPTION_FLIPX },
|
||||
{ submenu::option_type::EMU, __("Flip Y"), OPTION_FLIPY },
|
||||
|
||||
{ submenu::option_type::HEAD, __("Artwork Options") },
|
||||
{ submenu::option_type::EMU, __("Artwork Crop"), OPTION_ARTWORK_CROP },
|
||||
{ submenu::option_type::EMU, __("Use Backdrops"), OPTION_USE_BACKDROPS },
|
||||
{ submenu::option_type::EMU, __("Use Overlays"), OPTION_USE_OVERLAYS },
|
||||
{ submenu::option_type::EMU, __("Use Bezels"), OPTION_USE_BEZELS },
|
||||
{ submenu::option_type::EMU, __("Use Control Panels"), OPTION_USE_CPANELS },
|
||||
{ submenu::option_type::EMU, __("Use Marquees"), OPTION_USE_MARQUEES },
|
||||
|
||||
{ submenu::option_type::HEAD, __("State/Playback Options") },
|
||||
{ submenu::option_type::EMU, __("Automatic save/restore"), OPTION_AUTOSAVE },
|
||||
{ submenu::option_type::EMU, __("Bilinear snapshot"), OPTION_SNAPBILINEAR },
|
||||
{ submenu::option_type::EMU, __("Burn-in"), OPTION_BURNIN },
|
||||
|
||||
{ submenu::option_type::HEAD, __("Input Options") },
|
||||
{ submenu::option_type::EMU, __("Coin lockout"), OPTION_COIN_LOCKOUT },
|
||||
{ submenu::option_type::EMU, __("Mouse"), OPTION_MOUSE },
|
||||
{ submenu::option_type::EMU, __("Joystick"), OPTION_JOYSTICK },
|
||||
{ submenu::option_type::EMU, __("Lightgun"), OPTION_LIGHTGUN },
|
||||
{ submenu::option_type::EMU, __("Multi-keyboard"), OPTION_MULTIKEYBOARD },
|
||||
{ submenu::option_type::EMU, __("Multi-mouse"), OPTION_MULTIMOUSE },
|
||||
{ submenu::option_type::EMU, __("Steadykey"), OPTION_STEADYKEY },
|
||||
{ submenu::option_type::EMU, __("UI active"), OPTION_UI_ACTIVE },
|
||||
{ submenu::option_type::EMU, __("Offscreen reload"), OPTION_OFFSCREEN_RELOAD },
|
||||
{ submenu::option_type::EMU, __("Joystick deadzone"), OPTION_JOYSTICK_DEADZONE },
|
||||
{ submenu::option_type::EMU, __("Joystick saturation"), OPTION_JOYSTICK_SATURATION },
|
||||
{ submenu::option_type::EMU, __("Natural keyboard"), OPTION_NATURAL_KEYBOARD },
|
||||
{ submenu::option_type::EMU, __("Simultaneous contradictory"), OPTION_JOYSTICK_CONTRADICTORY },
|
||||
{ submenu::option_type::EMU, __("Coin impulse"), OPTION_COIN_IMPULSE },
|
||||
};
|
||||
|
||||
std::vector<submenu::option> submenu::control_options = {
|
||||
{ submenu::option_type::HEAD, __("Device Mapping") },
|
||||
{ submenu::option_type::EMU, __("Lightgun Device Assignment"), OPTION_LIGHTGUN_DEVICE },
|
||||
{ submenu::option_type::EMU, __("Trackball Device Assignment"), OPTION_TRACKBALL_DEVICE },
|
||||
{ submenu::option_type::EMU, __("Pedal Device Assignment"), OPTION_PEDAL_DEVICE },
|
||||
{ submenu::option_type::EMU, __("Adstick Device Assignment"), OPTION_ADSTICK_DEVICE },
|
||||
{ submenu::option_type::EMU, __("Paddle Device Assignment"), OPTION_PADDLE_DEVICE },
|
||||
{ submenu::option_type::EMU, __("Dial Device Assignment"), OPTION_DIAL_DEVICE },
|
||||
{ submenu::option_type::EMU, __("Positional Device Assignment"), OPTION_POSITIONAL_DEVICE },
|
||||
{ submenu::option_type::EMU, __("Mouse Device Assignment"), OPTION_MOUSE_DEVICE }
|
||||
};
|
||||
|
||||
std::vector<submenu::option> submenu::video_options = {
|
||||
{ submenu::option_type::HEAD, __("Video Options") },
|
||||
{ submenu::option_type::OSD, __("Video Mode"), OSDOPTION_VIDEO },
|
||||
{ submenu::option_type::OSD, __("Number Of Screens"), OSDOPTION_NUMSCREENS },
|
||||
#if defined(UI_WINDOWS) && !defined(UI_SDL)
|
||||
{ submenu::option_type::OSD, __("Triple Buffering"), WINOPTION_TRIPLEBUFFER },
|
||||
{ submenu::option_type::OSD, __("HLSL"), WINOPTION_HLSL_ENABLE },
|
||||
#endif
|
||||
{ submenu::option_type::OSD, __("GLSL"), OSDOPTION_GL_GLSL },
|
||||
{ submenu::option_type::OSD, __("Bilinear Filtering"), OSDOPTION_FILTER },
|
||||
{ submenu::option_type::OSD, __("Bitmap Prescaling"), OSDOPTION_PRESCALE },
|
||||
{ submenu::option_type::OSD, __("Window Mode"), OSDOPTION_WINDOW },
|
||||
{ submenu::option_type::EMU, __("Enforce Aspect Ratio"), OPTION_KEEPASPECT },
|
||||
{ submenu::option_type::OSD, __("Start Out Maximized"), OSDOPTION_MAXIMIZE },
|
||||
{ submenu::option_type::OSD, __("Synchronized Refresh"), OSDOPTION_SYNCREFRESH },
|
||||
{ submenu::option_type::OSD, __("Wait Vertical Sync"), OSDOPTION_WAITVSYNC }
|
||||
};
|
||||
|
||||
//std::vector<submenu::option> submenu::export_options = {
|
||||
// { ui_submenu::option_type::COMMAND, __("Export XML format (like -listxml)"), "exportxml" },
|
||||
// { ui_submenu::option_type::COMMAND, __("Export TXT format (like -listfull)"), "exporttxt" },
|
||||
//};
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor / dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_submenu::ui_submenu(mame_ui_manager &mui, render_container *container, std::vector<ui_submenu::option> &suboptions, const game_driver *drv, emu_options *options)
|
||||
: ui_menu(mui, container)
|
||||
submenu::submenu(mame_ui_manager &mui, render_container *container, std::vector<option> &suboptions, const game_driver *drv, emu_options *options)
|
||||
: menu(mui, container)
|
||||
, m_options(suboptions)
|
||||
, m_driver(drv)
|
||||
{
|
||||
@ -34,7 +138,7 @@ ui_submenu::ui_submenu(mame_ui_manager &mui, render_container *container, std::v
|
||||
{
|
||||
switch (sm_option.type)
|
||||
{
|
||||
case ui_submenu::EMU:
|
||||
case option_type::EMU:
|
||||
sm_option.entry = opts->get_entry(sm_option.name);
|
||||
sm_option.options = opts;
|
||||
if (sm_option.entry->type() == OPTION_STRING)
|
||||
@ -58,7 +162,7 @@ ui_submenu::ui_submenu(mame_ui_manager &mui, render_container *container, std::v
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ui_submenu::OSD:
|
||||
case option_type::OSD:
|
||||
sm_option.entry = opts->get_entry(sm_option.name);
|
||||
sm_option.options = opts;
|
||||
if (sm_option.entry->type() == OPTION_STRING)
|
||||
@ -84,7 +188,7 @@ ui_submenu::ui_submenu(mame_ui_manager &mui, render_container *container, std::v
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ui_submenu::UI:
|
||||
case option_type::UI:
|
||||
sm_option.entry = mui.options().get_entry(sm_option.name);
|
||||
sm_option.options = dynamic_cast<core_options*>(&mui.options());
|
||||
break;
|
||||
@ -94,7 +198,7 @@ ui_submenu::ui_submenu(mame_ui_manager &mui, render_container *container, std::v
|
||||
}
|
||||
}
|
||||
|
||||
ui_submenu::~ui_submenu()
|
||||
submenu::~submenu()
|
||||
{
|
||||
}
|
||||
|
||||
@ -102,103 +206,103 @@ ui_submenu::~ui_submenu()
|
||||
// handlethe options menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_submenu::handle()
|
||||
void submenu::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
std::string error_string, tmptxt;
|
||||
float f_cur, f_step;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
const event *menu_event = process(PROCESS_LR_REPEAT);
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr &&
|
||||
(m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT))
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr &&
|
||||
(menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT || menu_event->iptkey == IPT_UI_SELECT))
|
||||
{
|
||||
ui_submenu::option *sm_option = (ui_submenu::option *)m_event->itemref;
|
||||
option &sm_option = *reinterpret_cast<option *>(menu_event->itemref);
|
||||
|
||||
switch (sm_option->type)
|
||||
switch (sm_option.type)
|
||||
{
|
||||
case ui_submenu::EMU:
|
||||
case ui_submenu::UI:
|
||||
case ui_submenu::OSD:
|
||||
switch (sm_option->entry->type())
|
||||
case option_type::EMU:
|
||||
case option_type::UI:
|
||||
case option_type::OSD:
|
||||
switch (sm_option.entry->type())
|
||||
{
|
||||
case OPTION_BOOLEAN:
|
||||
changed = true;
|
||||
sm_option.options->set_value(sm_option.name, !strcmp(sm_option.entry->value(),"1") ? "0" : "1", OPTION_PRIORITY_CMDLINE, error_string);
|
||||
sm_option.entry->mark_changed();
|
||||
break;
|
||||
case OPTION_INTEGER:
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
case OPTION_BOOLEAN:
|
||||
changed = true;
|
||||
sm_option->options->set_value(sm_option->name, !strcmp(sm_option->entry->value(),"1") ? "0" : "1", OPTION_PRIORITY_CMDLINE, error_string);
|
||||
sm_option->entry->mark_changed();
|
||||
break;
|
||||
case OPTION_INTEGER:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
changed = true;
|
||||
int i_cur = atoi(sm_option->entry->value());
|
||||
(m_event->iptkey == IPT_UI_LEFT) ? i_cur-- : i_cur++;
|
||||
sm_option->options->set_value(sm_option->name, i_cur, OPTION_PRIORITY_CMDLINE, error_string);
|
||||
sm_option->entry->mark_changed();
|
||||
}
|
||||
break;
|
||||
case OPTION_FLOAT:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
changed = true;
|
||||
f_cur = atof(sm_option->entry->value());
|
||||
if (sm_option->entry->has_range())
|
||||
{
|
||||
f_step = atof(sm_option->entry->minimum());
|
||||
if (f_step <= 0.0f) {
|
||||
int pmin = getprecisionchr(sm_option->entry->minimum());
|
||||
int pmax = getprecisionchr(sm_option->entry->maximum());
|
||||
tmptxt = '1' + std::string((pmin > pmax) ? pmin : pmax, '0');
|
||||
f_step = 1 / atof(tmptxt.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int precision = getprecisionchr(sm_option->entry->default_value());
|
||||
tmptxt = '1' + std::string(precision, '0');
|
||||
f_step = 1 / atof(tmptxt.c_str());
|
||||
}
|
||||
if (m_event->iptkey == IPT_UI_LEFT)
|
||||
f_cur -= f_step;
|
||||
else
|
||||
f_cur += f_step;
|
||||
tmptxt = string_format("%g", f_cur);
|
||||
sm_option->options->set_value(sm_option->name, tmptxt.c_str(), OPTION_PRIORITY_CMDLINE, error_string);
|
||||
sm_option->entry->mark_changed();
|
||||
}
|
||||
break;
|
||||
case OPTION_STRING:
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
changed = true;
|
||||
std::string v_cur(sm_option->entry->value());
|
||||
int cur_value = std::distance(sm_option->value.begin(), std::find(sm_option->value.begin(), sm_option->value.end(), v_cur));
|
||||
if (m_event->iptkey == IPT_UI_LEFT)
|
||||
v_cur = sm_option->value[--cur_value];
|
||||
else
|
||||
v_cur = sm_option->value[++cur_value];
|
||||
sm_option->options->set_value(sm_option->name, v_cur.c_str(), OPTION_PRIORITY_CMDLINE, error_string);
|
||||
sm_option->entry->mark_changed();
|
||||
}
|
||||
break;
|
||||
changed = true;
|
||||
int i_cur = atoi(sm_option.entry->value());
|
||||
(menu_event->iptkey == IPT_UI_LEFT) ? i_cur-- : i_cur++;
|
||||
sm_option.options->set_value(sm_option.name, i_cur, OPTION_PRIORITY_CMDLINE, error_string);
|
||||
sm_option.entry->mark_changed();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
osd_printf_error("Unhandled option: %s", _(sm_option->description));
|
||||
case OPTION_FLOAT:
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
changed = true;
|
||||
f_cur = atof(sm_option.entry->value());
|
||||
if (sm_option.entry->has_range())
|
||||
{
|
||||
f_step = atof(sm_option.entry->minimum());
|
||||
if (f_step <= 0.0f) {
|
||||
int pmin = getprecisionchr(sm_option.entry->minimum());
|
||||
int pmax = getprecisionchr(sm_option.entry->maximum());
|
||||
tmptxt = '1' + std::string((pmin > pmax) ? pmin : pmax, '0');
|
||||
f_step = 1 / atof(tmptxt.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int precision = getprecisionchr(sm_option.entry->default_value());
|
||||
tmptxt = '1' + std::string(precision, '0');
|
||||
f_step = 1 / atof(tmptxt.c_str());
|
||||
}
|
||||
if (menu_event->iptkey == IPT_UI_LEFT)
|
||||
f_cur -= f_step;
|
||||
else
|
||||
f_cur += f_step;
|
||||
tmptxt = string_format("%g", f_cur);
|
||||
sm_option.options->set_value(sm_option.name, tmptxt.c_str(), OPTION_PRIORITY_CMDLINE, error_string);
|
||||
sm_option.entry->mark_changed();
|
||||
}
|
||||
break;
|
||||
case OPTION_STRING:
|
||||
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
changed = true;
|
||||
std::string v_cur(sm_option.entry->value());
|
||||
int cur_value = std::distance(sm_option.value.begin(), std::find(sm_option.value.begin(), sm_option.value.end(), v_cur));
|
||||
if (menu_event->iptkey == IPT_UI_LEFT)
|
||||
v_cur = sm_option.value[--cur_value];
|
||||
else
|
||||
v_cur = sm_option.value[++cur_value];
|
||||
sm_option.options->set_value(sm_option.name, v_cur.c_str(), OPTION_PRIORITY_CMDLINE, error_string);
|
||||
sm_option.entry->mark_changed();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
osd_printf_error("Unhandled option: %s", _(sm_option.description));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_submenu::populate()
|
||||
void submenu::populate()
|
||||
{
|
||||
UINT32 arrow_flags;
|
||||
|
||||
@ -206,99 +310,99 @@ void ui_submenu::populate()
|
||||
for (auto sm_option = m_options.begin(); sm_option < m_options.end(); ++sm_option)
|
||||
{
|
||||
// skip first heading (is menu title)
|
||||
if (sm_option == m_options.begin() && sm_option->type == ui_submenu::HEAD) continue;
|
||||
if (sm_option == m_options.begin() && sm_option->type == option_type::HEAD) continue;
|
||||
|
||||
switch (sm_option->type)
|
||||
{
|
||||
case ui_submenu::HEAD:
|
||||
item_append(_(sm_option->description), nullptr, MENU_FLAG_DISABLE | MENU_FLAG_UI_HEADING, nullptr);
|
||||
case option_type::HEAD:
|
||||
item_append(_(sm_option->description), nullptr, FLAG_DISABLE | FLAG_UI_HEADING, nullptr);
|
||||
break;
|
||||
case option_type::SEP:
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
break;
|
||||
case option_type::CMD:
|
||||
item_append(_(sm_option->description), nullptr, 0, static_cast<void*>(&(*sm_option)));
|
||||
break;
|
||||
case option_type::EMU:
|
||||
case option_type::UI:
|
||||
case option_type::OSD:
|
||||
switch (sm_option->entry->type())
|
||||
{
|
||||
case OPTION_BOOLEAN:
|
||||
arrow_flags = sm_option->options->bool_value(sm_option->name) ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW;
|
||||
item_append(_(sm_option->description),
|
||||
(arrow_flags == FLAG_RIGHT_ARROW) ? "On" : "Off",
|
||||
arrow_flags,
|
||||
static_cast<void*>(&(*sm_option)));
|
||||
break;
|
||||
case ui_submenu::SEP:
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
break;
|
||||
case ui_submenu::CMD:
|
||||
item_append(_(sm_option->description), nullptr, 0, static_cast<void*>(&(*sm_option)));
|
||||
break;
|
||||
case ui_submenu::EMU:
|
||||
case ui_submenu::UI:
|
||||
case ui_submenu::OSD:
|
||||
switch (sm_option->entry->type())
|
||||
case OPTION_INTEGER:
|
||||
{
|
||||
case OPTION_BOOLEAN:
|
||||
arrow_flags = sm_option->options->bool_value(sm_option->name) ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW;
|
||||
item_append(_(sm_option->description),
|
||||
(arrow_flags == MENU_FLAG_RIGHT_ARROW) ? "On" : "Off",
|
||||
arrow_flags,
|
||||
static_cast<void*>(&(*sm_option)));
|
||||
break;
|
||||
case OPTION_INTEGER:
|
||||
int i_min, i_max;
|
||||
int i_cur = atoi(sm_option->entry->value());
|
||||
if (sm_option->entry->has_range())
|
||||
{
|
||||
int i_min, i_max;
|
||||
int i_cur = atoi(sm_option->entry->value());
|
||||
if (sm_option->entry->has_range())
|
||||
{
|
||||
i_min = atoi(sm_option->entry->minimum());
|
||||
i_max = atoi(sm_option->entry->maximum());
|
||||
}
|
||||
else
|
||||
{
|
||||
i_min = std::numeric_limits<int>::min();
|
||||
i_max = std::numeric_limits<int>::max();
|
||||
}
|
||||
arrow_flags = get_arrow_flags(i_min, i_max, i_cur);
|
||||
item_append(_(sm_option->description),
|
||||
sm_option->entry->value(),
|
||||
arrow_flags,
|
||||
static_cast<void*>(&(*sm_option)));
|
||||
break;
|
||||
i_min = atoi(sm_option->entry->minimum());
|
||||
i_max = atoi(sm_option->entry->maximum());
|
||||
}
|
||||
case OPTION_FLOAT:
|
||||
else
|
||||
{
|
||||
float f_min, f_max;
|
||||
float f_cur = atof(sm_option->entry->value());
|
||||
if (sm_option->entry->has_range())
|
||||
{
|
||||
f_min = atof(sm_option->entry->minimum());
|
||||
f_max = atof(sm_option->entry->maximum());
|
||||
}
|
||||
else
|
||||
{
|
||||
f_min = 0.0f;
|
||||
f_max = std::numeric_limits<float>::max();
|
||||
}
|
||||
arrow_flags = get_arrow_flags(f_min, f_max, f_cur);
|
||||
std::string tmptxt = string_format("%g", f_cur);
|
||||
item_append(_(sm_option->description),
|
||||
tmptxt.c_str(),
|
||||
arrow_flags,
|
||||
static_cast<void*>(&(*sm_option)));
|
||||
break;
|
||||
i_min = std::numeric_limits<int>::min();
|
||||
i_max = std::numeric_limits<int>::max();
|
||||
}
|
||||
case OPTION_STRING:
|
||||
arrow_flags = get_arrow_flags(i_min, i_max, i_cur);
|
||||
item_append(_(sm_option->description),
|
||||
sm_option->entry->value(),
|
||||
arrow_flags,
|
||||
static_cast<void*>(&(*sm_option)));
|
||||
}
|
||||
break;
|
||||
case OPTION_FLOAT:
|
||||
{
|
||||
float f_min, f_max;
|
||||
float f_cur = atof(sm_option->entry->value());
|
||||
if (sm_option->entry->has_range())
|
||||
{
|
||||
std::string v_cur(sm_option->entry->value());
|
||||
int cur_value = std::distance(sm_option->value.begin(), std::find(sm_option->value.begin(), sm_option->value.end(), v_cur));
|
||||
arrow_flags = get_arrow_flags(0, sm_option->value.size() - 1, cur_value);
|
||||
item_append(_(sm_option->description),
|
||||
sm_option->options->value(sm_option->name),
|
||||
arrow_flags, static_cast<void*>(&(*sm_option)));
|
||||
break;
|
||||
f_min = atof(sm_option->entry->minimum());
|
||||
f_max = atof(sm_option->entry->maximum());
|
||||
}
|
||||
default:
|
||||
arrow_flags = MENU_FLAG_RIGHT_ARROW;
|
||||
item_append(_(sm_option->description),
|
||||
sm_option->options->value(sm_option->name),
|
||||
arrow_flags, static_cast<void*>(&(*sm_option)));
|
||||
break;
|
||||
else
|
||||
{
|
||||
f_min = 0.0f;
|
||||
f_max = std::numeric_limits<float>::max();
|
||||
}
|
||||
arrow_flags = get_arrow_flags(f_min, f_max, f_cur);
|
||||
std::string tmptxt = string_format("%g", f_cur);
|
||||
item_append(_(sm_option->description),
|
||||
tmptxt.c_str(),
|
||||
arrow_flags,
|
||||
static_cast<void*>(&(*sm_option)));
|
||||
}
|
||||
break;
|
||||
case OPTION_STRING:
|
||||
{
|
||||
std::string v_cur(sm_option->entry->value());
|
||||
int cur_value = std::distance(sm_option->value.begin(), std::find(sm_option->value.begin(), sm_option->value.end(), v_cur));
|
||||
arrow_flags = get_arrow_flags(0, sm_option->value.size() - 1, cur_value);
|
||||
item_append(_(sm_option->description),
|
||||
sm_option->options->value(sm_option->name),
|
||||
arrow_flags, static_cast<void*>(&(*sm_option)));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
osd_printf_error("Unknown option type: %s", _(sm_option->description));
|
||||
arrow_flags = FLAG_RIGHT_ARROW;
|
||||
item_append(_(sm_option->description),
|
||||
sm_option->options->value(sm_option->name),
|
||||
arrow_flags, static_cast<void*>(&(*sm_option)));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
osd_printf_error("Unknown option type: %s", _(sm_option->description));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
custombottom = customtop = ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
|
||||
}
|
||||
|
||||
@ -306,7 +410,7 @@ void ui_submenu::populate()
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_submenu::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
void submenu::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
|
||||
@ -335,10 +439,10 @@ void ui_submenu::custom_render(void *selectedref, float top, float bottom, float
|
||||
|
||||
if (selectedref != nullptr)
|
||||
{
|
||||
ui_submenu::option *selected_sm_option = (ui_submenu::option *)selectedref;
|
||||
if (selected_sm_option->entry != nullptr)
|
||||
option &selected_sm_option = *reinterpret_cast<option *>(selectedref);
|
||||
if (selected_sm_option.entry != nullptr)
|
||||
{
|
||||
ui().draw_text_full(container, selected_sm_option->entry->description(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
ui().draw_text_full(container, selected_sm_option.entry->description(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr);
|
||||
|
||||
width += 2 * UI_BOX_LR_BORDER;
|
||||
@ -359,8 +463,10 @@ void ui_submenu::custom_render(void *selectedref, float top, float bottom, float
|
||||
y1 += UI_BOX_TB_BORDER;
|
||||
|
||||
// draw the text within it
|
||||
ui().draw_text_full(container, selected_sm_option->entry->description(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
|
||||
ui().draw_text_full(container, selected_sm_option.entry->description(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
|
||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -9,8 +9,8 @@
|
||||
***************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_SUBMENU_H__
|
||||
#define __UI_SUBMENU_H__
|
||||
#ifndef MAME_FRONTEND_UI_SUBMENU_H
|
||||
#define MAME_FRONTEND_UI_SUBMENU_H
|
||||
|
||||
#include "emuopts.h"
|
||||
#include "ui/menu.h"
|
||||
@ -21,13 +21,20 @@
|
||||
#include "../osd/modules/lib/osdobj_common.h"
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
//-------------------------------------------------
|
||||
// class ui menu
|
||||
//-------------------------------------------------
|
||||
class ui_submenu : public ui_menu
|
||||
class submenu : public menu
|
||||
{
|
||||
public:
|
||||
enum option_type {
|
||||
enum class option_type
|
||||
{
|
||||
HEAD,
|
||||
SEP,
|
||||
MENU,
|
||||
@ -37,7 +44,8 @@ public:
|
||||
OSD,
|
||||
};
|
||||
|
||||
struct option {
|
||||
struct option
|
||||
{
|
||||
option_type type;
|
||||
const char *description;
|
||||
const char *name;
|
||||
@ -46,115 +54,23 @@ public:
|
||||
std::vector<std::string> value;
|
||||
};
|
||||
|
||||
ui_submenu(mame_ui_manager &mui, render_container *container, std::vector<ui_submenu::option> &suboptions, const game_driver *drv = nullptr, emu_options *options = nullptr);
|
||||
virtual ~ui_submenu();
|
||||
submenu(mame_ui_manager &mui, render_container *container, std::vector<option> &suboptions, const game_driver *drv = nullptr, emu_options *options = nullptr);
|
||||
virtual ~submenu();
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
|
||||
static std::vector<option> misc_options;
|
||||
static std::vector<option> advanced_options;
|
||||
static std::vector<option> control_options;
|
||||
static std::vector<option> video_options;
|
||||
//static std::vector<option> export_options;
|
||||
|
||||
private:
|
||||
std::vector<option> &m_options;
|
||||
const game_driver *m_driver;
|
||||
game_driver const *m_driver;
|
||||
};
|
||||
|
||||
static std::vector<ui_submenu::option> misc_submenu_options = {
|
||||
{ ui_submenu::HEAD, __("Miscellaneous Options") },
|
||||
{ ui_submenu::UI, __("Re-select last machine played"), OPTION_REMEMBER_LAST },
|
||||
{ ui_submenu::UI, __("Enlarge images in the right panel"), OPTION_ENLARGE_SNAPS },
|
||||
{ ui_submenu::UI, __("DATs info"), OPTION_DATS_ENABLED },
|
||||
{ ui_submenu::EMU, __("Cheats"), OPTION_CHEAT },
|
||||
{ ui_submenu::EMU, __("Show mouse pointer"), OPTION_UI_MOUSE },
|
||||
{ ui_submenu::EMU, __("Confirm quit from machines"), OPTION_CONFIRM_QUIT },
|
||||
{ ui_submenu::EMU, __("Skip information screen at startup"), OPTION_SKIP_GAMEINFO },
|
||||
{ ui_submenu::UI, __("Force 4:3 aspect for snapshot display"), OPTION_FORCED4X3 },
|
||||
{ ui_submenu::UI, __("Use image as background"), OPTION_USE_BACKGROUND },
|
||||
{ ui_submenu::UI, __("Skip bios selection menu"), OPTION_SKIP_BIOS_MENU },
|
||||
{ ui_submenu::UI, __("Skip software parts selection menu"), OPTION_SKIP_PARTS_MENU },
|
||||
{ ui_submenu::UI, __("Info auto audit"), OPTION_INFO_AUTO_AUDIT },
|
||||
};
|
||||
} // namespace ui
|
||||
|
||||
static std::vector<ui_submenu::option> advanced_submenu_options = {
|
||||
{ ui_submenu::HEAD, __("Advanced Options") },
|
||||
{ ui_submenu::HEAD, __("Performance Options") },
|
||||
{ ui_submenu::EMU, __("Auto frame skip"), OPTION_AUTOFRAMESKIP },
|
||||
{ ui_submenu::EMU, __("Frame skip"), OPTION_FRAMESKIP },
|
||||
{ ui_submenu::EMU, __("Throttle"), OPTION_THROTTLE },
|
||||
{ ui_submenu::EMU, __("Sleep"), OPTION_SLEEP },
|
||||
{ ui_submenu::EMU, __("Speed"), OPTION_SPEED },
|
||||
{ ui_submenu::EMU, __("Refresh speed"), OPTION_REFRESHSPEED },
|
||||
|
||||
{ ui_submenu::HEAD, __("Rotation Options") },
|
||||
{ ui_submenu::EMU, __("Rotate"), OPTION_ROTATE },
|
||||
{ ui_submenu::EMU, __("Rotate right"), OPTION_ROR },
|
||||
{ ui_submenu::EMU, __("Rotate left"), OPTION_ROL },
|
||||
{ ui_submenu::EMU, __("Auto rotate right"), OPTION_AUTOROR },
|
||||
{ ui_submenu::EMU, __("Auto rotate left"), OPTION_AUTOROL },
|
||||
{ ui_submenu::EMU, __("Flip X"), OPTION_FLIPX },
|
||||
{ ui_submenu::EMU, __("Flip Y"), OPTION_FLIPY },
|
||||
|
||||
{ ui_submenu::HEAD, __("Artwork Options") },
|
||||
{ ui_submenu::EMU, __("Artwork Crop"), OPTION_ARTWORK_CROP },
|
||||
{ ui_submenu::EMU, __("Use Backdrops"), OPTION_USE_BACKDROPS },
|
||||
{ ui_submenu::EMU, __("Use Overlays"), OPTION_USE_OVERLAYS },
|
||||
{ ui_submenu::EMU, __("Use Bezels"), OPTION_USE_BEZELS },
|
||||
{ ui_submenu::EMU, __("Use Control Panels"), OPTION_USE_CPANELS },
|
||||
{ ui_submenu::EMU, __("Use Marquees"), OPTION_USE_MARQUEES },
|
||||
|
||||
{ ui_submenu::HEAD, __("State/Playback Options") },
|
||||
{ ui_submenu::EMU, __("Automatic save/restore"), OPTION_AUTOSAVE },
|
||||
{ ui_submenu::EMU, __("Bilinear snapshot"), OPTION_SNAPBILINEAR },
|
||||
{ ui_submenu::EMU, __("Burn-in"), OPTION_BURNIN },
|
||||
|
||||
{ ui_submenu::HEAD, __("Input Options") },
|
||||
{ ui_submenu::EMU, __("Coin lockout"), OPTION_COIN_LOCKOUT },
|
||||
{ ui_submenu::EMU, __("Mouse"), OPTION_MOUSE },
|
||||
{ ui_submenu::EMU, __("Joystick"), OPTION_JOYSTICK },
|
||||
{ ui_submenu::EMU, __("Lightgun"), OPTION_LIGHTGUN },
|
||||
{ ui_submenu::EMU, __("Multi-keyboard"), OPTION_MULTIKEYBOARD },
|
||||
{ ui_submenu::EMU, __("Multi-mouse"), OPTION_MULTIMOUSE },
|
||||
{ ui_submenu::EMU, __("Steadykey"), OPTION_STEADYKEY },
|
||||
{ ui_submenu::EMU, __("UI active"), OPTION_UI_ACTIVE },
|
||||
{ ui_submenu::EMU, __("Offscreen reload"), OPTION_OFFSCREEN_RELOAD },
|
||||
{ ui_submenu::EMU, __("Joystick deadzone"), OPTION_JOYSTICK_DEADZONE },
|
||||
{ ui_submenu::EMU, __("Joystick saturation"), OPTION_JOYSTICK_SATURATION },
|
||||
{ ui_submenu::EMU, __("Natural keyboard"), OPTION_NATURAL_KEYBOARD },
|
||||
{ ui_submenu::EMU, __("Simultaneous contradictory"), OPTION_JOYSTICK_CONTRADICTORY },
|
||||
{ ui_submenu::EMU, __("Coin impulse"), OPTION_COIN_IMPULSE },
|
||||
};
|
||||
|
||||
static std::vector<ui_submenu::option> control_submenu_options = {
|
||||
{ ui_submenu::HEAD, __("Device Mapping") },
|
||||
{ ui_submenu::EMU, __("Lightgun Device Assignment"), OPTION_LIGHTGUN_DEVICE },
|
||||
{ ui_submenu::EMU, __("Trackball Device Assignment"), OPTION_TRACKBALL_DEVICE },
|
||||
{ ui_submenu::EMU, __("Pedal Device Assignment"), OPTION_PEDAL_DEVICE },
|
||||
{ ui_submenu::EMU, __("Adstick Device Assignment"), OPTION_ADSTICK_DEVICE },
|
||||
{ ui_submenu::EMU, __("Paddle Device Assignment"), OPTION_PADDLE_DEVICE },
|
||||
{ ui_submenu::EMU, __("Dial Device Assignment"), OPTION_DIAL_DEVICE },
|
||||
{ ui_submenu::EMU, __("Positional Device Assignment"), OPTION_POSITIONAL_DEVICE },
|
||||
{ ui_submenu::EMU, __("Mouse Device Assignment"), OPTION_MOUSE_DEVICE }
|
||||
};
|
||||
|
||||
static std::vector<ui_submenu::option> video_submenu_options = {
|
||||
{ ui_submenu::HEAD, __("Video Options") },
|
||||
{ ui_submenu::OSD, __("Video Mode"), OSDOPTION_VIDEO },
|
||||
{ ui_submenu::OSD, __("Number Of Screens"), OSDOPTION_NUMSCREENS },
|
||||
#if defined(UI_WINDOWS) && !defined(UI_SDL)
|
||||
{ ui_submenu::OSD, __("Triple Buffering"), WINOPTION_TRIPLEBUFFER },
|
||||
{ ui_submenu::OSD, __("HLSL"), WINOPTION_HLSL_ENABLE },
|
||||
#endif
|
||||
{ ui_submenu::OSD, __("GLSL"), OSDOPTION_GL_GLSL },
|
||||
{ ui_submenu::OSD, __("Bilinear Filtering"), OSDOPTION_FILTER },
|
||||
{ ui_submenu::OSD, __("Bitmap Prescaling"), OSDOPTION_PRESCALE },
|
||||
{ ui_submenu::OSD, __("Window Mode"), OSDOPTION_WINDOW },
|
||||
{ ui_submenu::EMU, __("Enforce Aspect Ratio"), OPTION_KEEPASPECT },
|
||||
{ ui_submenu::OSD, __("Start Out Maximized"), OSDOPTION_MAXIMIZE },
|
||||
{ ui_submenu::OSD, __("Synchronized Refresh"), OSDOPTION_SYNCREFRESH },
|
||||
{ ui_submenu::OSD, __("Wait Vertical Sync"), OSDOPTION_WAITVSYNC }
|
||||
};
|
||||
|
||||
//static std::vector<ui_submenu::option> export_submenu_options = {
|
||||
// { ui_submenu::COMMAND, __("Export XML format (like -listxml)"), "exportxml" },
|
||||
// { ui_submenu::COMMAND, __("Export TXT format (like -listfull)"), "exporttxt" },
|
||||
//};
|
||||
|
||||
#endif /* __UI_SUBMENU_H__ */
|
||||
#endif /* MAME_FRONTEND_UI_SUBMENU_H */
|
||||
|
@ -9,12 +9,15 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/swlist.h"
|
||||
|
||||
#include "softlist.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
@ -31,8 +34,8 @@
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_software_parts::ui_menu_software_parts(mame_ui_manager &mui, render_container *container, const software_info *info, const char *interface, const software_part **part, bool other_opt, int *result)
|
||||
: ui_menu(mui, container)
|
||||
menu_software_parts::menu_software_parts(mame_ui_manager &mui, render_container *container, const software_info *info, const char *interface, const software_part **part, bool other_opt, int *result)
|
||||
: menu(mui, container)
|
||||
{
|
||||
m_info = info;
|
||||
m_interface = interface;
|
||||
@ -46,7 +49,7 @@ ui_menu_software_parts::ui_menu_software_parts(mame_ui_manager &mui, render_cont
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_software_parts::~ui_menu_software_parts()
|
||||
menu_software_parts::~menu_software_parts()
|
||||
{
|
||||
}
|
||||
|
||||
@ -55,7 +58,7 @@ ui_menu_software_parts::~ui_menu_software_parts()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_software_parts::populate()
|
||||
void menu_software_parts::populate()
|
||||
{
|
||||
if (m_other_opt)
|
||||
{
|
||||
@ -98,17 +101,17 @@ void ui_menu_software_parts::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_software_parts::handle()
|
||||
void menu_software_parts::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(0);
|
||||
const event *event = process(0);
|
||||
|
||||
if (event != nullptr && event->iptkey == IPT_UI_SELECT && event->itemref != nullptr)
|
||||
{
|
||||
software_part_menu_entry *entry = (software_part_menu_entry *) event->itemref;
|
||||
*m_result = entry->type;
|
||||
*m_selected_part = entry->part;
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,8 +124,8 @@ void ui_menu_software_parts::handle()
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_software_list::ui_menu_software_list(mame_ui_manager &mui, render_container *container, software_list_device *swlist, const char *interface, std::string &result)
|
||||
: ui_menu(mui, container), m_result(result)
|
||||
menu_software_list::menu_software_list(mame_ui_manager &mui, render_container *container, software_list_device *swlist, const char *interface, std::string &result)
|
||||
: menu(mui, container), m_result(result)
|
||||
{
|
||||
m_swlist = swlist;
|
||||
m_interface = interface;
|
||||
@ -135,7 +138,7 @@ ui_menu_software_list::ui_menu_software_list(mame_ui_manager &mui, render_contai
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_software_list::~ui_menu_software_list()
|
||||
menu_software_list::~menu_software_list()
|
||||
{
|
||||
}
|
||||
|
||||
@ -144,7 +147,7 @@ ui_menu_software_list::~ui_menu_software_list()
|
||||
// compare_entries
|
||||
//-------------------------------------------------
|
||||
|
||||
int ui_menu_software_list::compare_entries(const entry_info *e1, const entry_info *e2, bool shortname)
|
||||
int menu_software_list::compare_entries(const entry_info *e1, const entry_info *e2, bool shortname)
|
||||
{
|
||||
int result;
|
||||
const char *e1_basename;
|
||||
@ -182,7 +185,7 @@ int ui_menu_software_list::compare_entries(const entry_info *e1, const entry_inf
|
||||
// append_software_entry - populate a specific list
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_software_list::entry_info *ui_menu_software_list::append_software_entry(const software_info &swinfo)
|
||||
menu_software_list::entry_info *menu_software_list::append_software_entry(const software_info &swinfo)
|
||||
{
|
||||
entry_info *entry = nullptr;
|
||||
entry_info **entryptr;
|
||||
@ -225,7 +228,7 @@ ui_menu_software_list::entry_info *ui_menu_software_list::append_software_entry(
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_software_list::populate()
|
||||
void menu_software_list::populate()
|
||||
{
|
||||
// build up the list of entries for the menu
|
||||
for (const software_info &swinfo : m_swlist->get_info())
|
||||
@ -244,14 +247,14 @@ void ui_menu_software_list::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_software_list::handle()
|
||||
void menu_software_list::handle()
|
||||
{
|
||||
const entry_info *entry;
|
||||
const entry_info *selected_entry = nullptr;
|
||||
int bestmatch = 0;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(0);
|
||||
const event *event = process(0);
|
||||
|
||||
if (event != nullptr && event->itemref != nullptr)
|
||||
{
|
||||
@ -264,7 +267,7 @@ void ui_menu_software_list::handle()
|
||||
memset(m_filename_buffer, '\0', ARRAY_LENGTH(m_filename_buffer));
|
||||
|
||||
// reload the menu with the new order
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
machine().popmessage(_("Switched Order: entries now ordered by %s"), m_ordered_by_shortname ? _("shortname") : _("description"));
|
||||
}
|
||||
// handle selections
|
||||
@ -272,7 +275,7 @@ void ui_menu_software_list::handle()
|
||||
{
|
||||
entry_info *info = (entry_info *) event->itemref;
|
||||
m_result = info->short_name;
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
else if (event->iptkey == IPT_SPECIAL)
|
||||
{
|
||||
@ -367,7 +370,7 @@ void ui_menu_software_list::handle()
|
||||
if (m_filename_buffer[0] != '\0')
|
||||
memset(m_filename_buffer, '\0', ARRAY_LENGTH(m_filename_buffer));
|
||||
m_result = m_filename_buffer;
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -382,8 +385,8 @@ void ui_menu_software_list::handle()
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_software::ui_menu_software(mame_ui_manager &mui, render_container *container, const char *interface, software_list_device **result)
|
||||
: ui_menu(mui, container)
|
||||
menu_software::menu_software(mame_ui_manager &mui, render_container *container, const char *interface, software_list_device **result)
|
||||
: menu(mui, container)
|
||||
{
|
||||
m_interface = interface;
|
||||
m_result = result;
|
||||
@ -394,7 +397,7 @@ ui_menu_software::ui_menu_software(mame_ui_manager &mui, render_container *conta
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_software::~ui_menu_software()
|
||||
menu_software::~menu_software()
|
||||
{
|
||||
}
|
||||
|
||||
@ -403,7 +406,7 @@ ui_menu_software::~ui_menu_software()
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_software::populate()
|
||||
void menu_software::populate()
|
||||
{
|
||||
bool have_compatible = false;
|
||||
|
||||
@ -433,7 +436,7 @@ void ui_menu_software::populate()
|
||||
if (found)
|
||||
{
|
||||
if (!have_compatible)
|
||||
item_append(_("[compatible lists]"), nullptr, MENU_FLAG_DISABLE, nullptr);
|
||||
item_append(_("[compatible lists]"), nullptr, FLAG_DISABLE, nullptr);
|
||||
item_append(swlistdev.description(), nullptr, 0, (void *)&swlistdev);
|
||||
}
|
||||
have_compatible = true;
|
||||
@ -445,14 +448,16 @@ void ui_menu_software::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_software::handle()
|
||||
void menu_software::handle()
|
||||
{
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(0);
|
||||
const event *event = process(0);
|
||||
|
||||
if (event != nullptr && event->iptkey == IPT_UI_SELECT) {
|
||||
// ui_menu::stack_push(global_alloc_clear<ui_menu_software_list>(ui(), container, (software_list_config *)event->itemref, image));
|
||||
//menu::stack_push<menu_software_list>(ui(), container, (software_list_config *)event->itemref, image);
|
||||
*m_result = (software_list_device *)event->itemref;
|
||||
ui_menu::stack_pop(machine());
|
||||
menu::stack_pop(machine());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -8,16 +8,22 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __UI_SWLIST_H__
|
||||
#define __UI_SWLIST_H__
|
||||
#ifndef MAME_FRONTEND_UI_SWLIST_H
|
||||
#define MAME_FRONTEND_UI_SWLIST_H
|
||||
|
||||
// ======================> ui_menu_software_parts
|
||||
#include "ui/menu.h"
|
||||
|
||||
class ui_menu_software_parts : public ui_menu {
|
||||
|
||||
namespace ui {
|
||||
|
||||
// ======================> menu_software_parts
|
||||
|
||||
class menu_software_parts : public menu
|
||||
{
|
||||
public:
|
||||
enum { T_EMPTY, T_FMGR, T_SWLIST, T_ENTRY };
|
||||
ui_menu_software_parts(mame_ui_manager &mui, render_container *container, const software_info *info, const char *interface, const software_part **part, bool other_opt, int *result);
|
||||
virtual ~ui_menu_software_parts();
|
||||
menu_software_parts(mame_ui_manager &mui, render_container *container, const software_info *info, const char *interface, const software_part **part, bool other_opt, int *result);
|
||||
virtual ~menu_software_parts() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -36,12 +42,13 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// ======================> ui_menu_software_list
|
||||
// ======================> menu_software_list
|
||||
|
||||
class ui_menu_software_list : public ui_menu {
|
||||
class menu_software_list : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_software_list(mame_ui_manager &mui, render_container *container, software_list_device *swlist, const char *interface, std::string &result);
|
||||
virtual ~ui_menu_software_list();
|
||||
menu_software_list(mame_ui_manager &mui, render_container *container, software_list_device *swlist, const char *interface, std::string &result);
|
||||
virtual ~menu_software_list() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -67,12 +74,13 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// ======================> ui_menu_software
|
||||
// ======================> menu_software
|
||||
|
||||
class ui_menu_software : public ui_menu {
|
||||
class menu_software : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_software(mame_ui_manager &mui, render_container *container, const char *interface, software_list_device **result);
|
||||
virtual ~ui_menu_software();
|
||||
menu_software(mame_ui_manager &mui, render_container *container, const char *interface, software_list_device **result);
|
||||
virtual ~menu_software() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -81,4 +89,6 @@ private:
|
||||
software_list_device ** m_result;
|
||||
};
|
||||
|
||||
#endif /* __UI_SWLIST_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_SWLIST_H */
|
||||
|
@ -9,9 +9,11 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui/menu.h"
|
||||
|
||||
#include "ui/tapectrl.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
@ -34,8 +36,8 @@
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_tape_control::ui_menu_tape_control(mame_ui_manager &mui, render_container *container, cassette_image_device *device)
|
||||
: ui_menu_device_control<cassette_image_device>(mui, container, device)
|
||||
menu_tape_control::menu_tape_control(mame_ui_manager &mui, render_container *container, cassette_image_device *device)
|
||||
: menu_device_control<cassette_image_device>(mui, container, device)
|
||||
{
|
||||
}
|
||||
|
||||
@ -44,7 +46,7 @@ ui_menu_tape_control::ui_menu_tape_control(mame_ui_manager &mui, render_containe
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_tape_control::~ui_menu_tape_control()
|
||||
menu_tape_control::~menu_tape_control()
|
||||
{
|
||||
}
|
||||
|
||||
@ -53,7 +55,7 @@ ui_menu_tape_control::~ui_menu_tape_control()
|
||||
// populate - populates the main tape control menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_tape_control::populate()
|
||||
void menu_tape_control::populate()
|
||||
{
|
||||
if (current_device())
|
||||
{
|
||||
@ -72,9 +74,9 @@ void ui_menu_tape_control::populate()
|
||||
if (t1 > 0)
|
||||
{
|
||||
if (t0 > 0)
|
||||
tapeflags |= MENU_FLAG_LEFT_ARROW;
|
||||
tapeflags |= FLAG_LEFT_ARROW;
|
||||
if (t0 < t1)
|
||||
tapeflags |= MENU_FLAG_RIGHT_ARROW;
|
||||
tapeflags |= FLAG_RIGHT_ARROW;
|
||||
}
|
||||
|
||||
get_time_string(timepos, current_device(), nullptr, nullptr);
|
||||
@ -113,14 +115,14 @@ void ui_menu_tape_control::populate()
|
||||
// handle - main tape control menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_tape_control::handle()
|
||||
void menu_tape_control::handle()
|
||||
{
|
||||
// rebuild the menu (so to update the selected device, if the user has pressed L or R, and the tape counter)
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
populate();
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||
const event *event = process(PROCESS_LR_REPEAT);
|
||||
if (event != nullptr)
|
||||
{
|
||||
switch(event->iptkey)
|
||||
@ -163,7 +165,7 @@ void ui_menu_tape_control::handle()
|
||||
// representation of the time
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_tape_control::get_time_string(std::string &dest, cassette_image_device *cassette, int *curpos, int *endpos)
|
||||
void menu_tape_control::get_time_string(std::string &dest, cassette_image_device *cassette, int *curpos, int *endpos)
|
||||
{
|
||||
double t0, t1;
|
||||
|
||||
@ -180,3 +182,5 @@ void ui_menu_tape_control::get_time_string(std::string &dest, cassette_image_dev
|
||||
if (endpos != nullptr)
|
||||
*endpos = t1;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,16 +10,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_TAPECTRL_H__
|
||||
#define __UI_TAPECTRL_H__
|
||||
#ifndef MAME_FRONTEND_UI_TAPECTRL_H
|
||||
#define MAME_FRONTEND_UI_TAPECTRL_H
|
||||
|
||||
#include "imagedev/cassette.h"
|
||||
#include "ui/devctrl.h"
|
||||
|
||||
class ui_menu_tape_control : public ui_menu_device_control<cassette_image_device> {
|
||||
namespace ui {
|
||||
|
||||
class menu_tape_control : public menu_device_control<cassette_image_device>
|
||||
{
|
||||
public:
|
||||
ui_menu_tape_control(mame_ui_manager &mui, render_container *container, cassette_image_device *device);
|
||||
virtual ~ui_menu_tape_control();
|
||||
menu_tape_control(mame_ui_manager &mui, render_container *container, cassette_image_device *device);
|
||||
virtual ~menu_tape_control() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -27,4 +30,6 @@ private:
|
||||
static void get_time_string(std::string &dest, cassette_image_device *cassette, int *curpos, int *endpos);
|
||||
};
|
||||
|
||||
#endif /* __UI_TAPECTRL_H__ */
|
||||
} // namespace ui
|
||||
|
||||
#endif /* MAME_FRONTEND_UI_TAPECTRL_H */
|
||||
|
@ -121,7 +121,7 @@ std::string mame_ui_manager::messagebox_poptext;
|
||||
rgb_t mame_ui_manager::messagebox_backcolor;
|
||||
|
||||
// slider info
|
||||
std::vector<ui_menu_item> mame_ui_manager::slider_list;
|
||||
std::vector<ui::menu_item> mame_ui_manager::slider_list;
|
||||
slider_state *mame_ui_manager::slider_current;
|
||||
|
||||
|
||||
@ -268,7 +268,7 @@ void mame_ui_manager::init()
|
||||
{
|
||||
load_ui_options();
|
||||
// initialize the other UI bits
|
||||
ui_menu::init(machine(), options());
|
||||
ui::menu::init(machine(), options());
|
||||
ui_gfx_init(machine());
|
||||
|
||||
get_font_rows(&machine());
|
||||
@ -368,7 +368,7 @@ void mame_ui_manager::display_startup_screens(bool first_time)
|
||||
|
||||
// loop over states
|
||||
set_handler(handler_ingame, 0);
|
||||
for (state = 0; state < maxstate && !machine().scheduled_event_pending() && !ui_menu::stack_has_special_main_menu(); state++)
|
||||
for (state = 0; state < maxstate && !machine().scheduled_event_pending() && !ui::menu::stack_has_special_main_menu(); state++)
|
||||
{
|
||||
// default to standard colors
|
||||
messagebox_backcolor = UI_BACKGROUND_COLOR;
|
||||
@ -397,7 +397,7 @@ void mame_ui_manager::display_startup_screens(bool first_time)
|
||||
{
|
||||
std::string warning;
|
||||
warning.assign(_("This driver requires images to be loaded in the following device(s): ")).append(messagebox_text.substr(0, messagebox_text.length() - 2));
|
||||
ui_menu_file_manager::force_file_manager(*this, &machine().render().ui_container(), warning.c_str());
|
||||
ui::menu_file_manager::force_file_manager(*this, &machine().render().ui_container(), warning.c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -407,7 +407,7 @@ void mame_ui_manager::display_startup_screens(bool first_time)
|
||||
while (machine().input().poll_switches() != INPUT_CODE_INVALID) { }
|
||||
|
||||
// loop while we have a handler
|
||||
while (m_handler_callback != handler_ingame && !machine().scheduled_event_pending() && !ui_menu::stack_has_special_main_menu())
|
||||
while (m_handler_callback != handler_ingame && !machine().scheduled_event_pending() && !ui::menu::stack_has_special_main_menu())
|
||||
{
|
||||
machine().video().frame_update();
|
||||
}
|
||||
@ -418,8 +418,8 @@ void mame_ui_manager::display_startup_screens(bool first_time)
|
||||
}
|
||||
|
||||
// if we're the empty driver, force the menus on
|
||||
if (ui_menu::stack_has_special_main_menu())
|
||||
set_handler(ui_menu::ui_handler, 0);
|
||||
if (ui::menu::stack_has_special_main_menu())
|
||||
set_handler(ui::menu::ui_handler, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -460,7 +460,7 @@ void mame_ui_manager::update_and_render(render_container *container)
|
||||
if (machine().phase() >= MACHINE_PHASE_RESET && (single_step() || machine().paused()))
|
||||
{
|
||||
int alpha = (1.0f - machine().options().pause_brightness()) * 255.0f;
|
||||
if (ui_menu::stack_has_special_main_menu())
|
||||
if (ui::menu::stack_has_special_main_menu())
|
||||
alpha = 255;
|
||||
if (alpha > 255)
|
||||
alpha = 255;
|
||||
@ -979,7 +979,7 @@ bool mame_ui_manager::show_profiler() const
|
||||
|
||||
void mame_ui_manager::show_menu()
|
||||
{
|
||||
set_handler(ui_menu::ui_handler, 0);
|
||||
set_handler(ui::menu::ui_handler, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1000,7 +1000,7 @@ void mame_ui_manager::show_mouse(bool status)
|
||||
|
||||
bool mame_ui_manager::is_menu_active(void)
|
||||
{
|
||||
return (m_handler_callback == ui_menu::ui_handler);
|
||||
return (m_handler_callback == ui::menu::ui_handler);
|
||||
}
|
||||
|
||||
|
||||
@ -1300,7 +1300,7 @@ UINT32 mame_ui_manager::handler_messagebox_anykey(mame_ui_manager &mui, render_c
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
//-------------------------------------------------3
|
||||
// process_natural_keyboard - processes any
|
||||
// natural keyboard input
|
||||
//-------------------------------------------------
|
||||
@ -1597,11 +1597,11 @@ UINT32 mame_ui_manager::handler_ingame(mame_ui_manager &mui, render_container *c
|
||||
|
||||
// turn on menus if requested
|
||||
if (mui.machine().ui_input().pressed(IPT_UI_CONFIGURE))
|
||||
return mui.set_handler(ui_menu::ui_handler, 0);
|
||||
return mui.set_handler(ui::menu::ui_handler, 0);
|
||||
|
||||
// if the on-screen display isn't up and the user has toggled it, turn it on
|
||||
if ((mui.machine().debug_flags & DEBUG_FLAG_ENABLED) == 0 && mui.machine().ui_input().pressed(IPT_UI_ON_SCREEN_DISPLAY))
|
||||
return mui.set_handler(ui_menu_sliders::ui_handler, 1);
|
||||
return mui.set_handler(ui::menu_sliders::ui_handler, 1);
|
||||
|
||||
// handle a reset request
|
||||
if (mui.machine().ui_input().pressed(IPT_UI_RESET_MACHINE))
|
||||
@ -1886,7 +1886,7 @@ UINT32 mame_ui_manager::handler_confirm_quit(mame_ui_manager &mui, render_contai
|
||||
// ui_get_slider_list - get the list of sliders
|
||||
//-------------------------------------------------
|
||||
|
||||
std::vector<ui_menu_item>& mame_ui_manager::get_slider_list(void)
|
||||
std::vector<ui::menu_item>& mame_ui_manager::get_slider_list(void)
|
||||
{
|
||||
return slider_list;
|
||||
}
|
||||
@ -1919,7 +1919,7 @@ static slider_state *slider_alloc(running_machine &machine, const char *title, I
|
||||
// controls
|
||||
//----------------------------------------------------------
|
||||
|
||||
std::vector<ui_menu_item> mame_ui_manager::slider_init(running_machine &machine)
|
||||
std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine)
|
||||
{
|
||||
std::vector<slider_state *> sliders;
|
||||
|
||||
@ -2051,15 +2051,15 @@ std::vector<ui_menu_item> mame_ui_manager::slider_init(running_machine &machine)
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<ui_menu_item> items;
|
||||
std::vector<ui::menu_item> items;
|
||||
for (slider_state *slider : sliders)
|
||||
{
|
||||
ui_menu_item item;
|
||||
ui::menu_item item;
|
||||
item.text = slider->description;
|
||||
item.subtext = "";
|
||||
item.flags = 0;
|
||||
item.ref = slider;
|
||||
item.type = ui_menu_item_type::SLIDER;
|
||||
item.type = ui::menu_item_type::SLIDER;
|
||||
items.push_back(item);
|
||||
}
|
||||
|
||||
@ -2815,5 +2815,5 @@ void mame_ui_manager::save_main_option()
|
||||
|
||||
void mame_ui_manager::menu_reset()
|
||||
{
|
||||
ui_menu::stack_reset(machine());
|
||||
ui::menu::stack_reset(machine());
|
||||
}
|
||||
|
@ -22,7 +22,11 @@
|
||||
#include "ui/menuitem.h"
|
||||
#include "ui/slider.h"
|
||||
|
||||
class ui_menu_item;
|
||||
namespace ui {
|
||||
|
||||
class menu_item;
|
||||
|
||||
} // namespace ui
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
@ -117,7 +121,7 @@ public:
|
||||
|
||||
// methods
|
||||
void initialize(running_machine &machine);
|
||||
std::vector<ui_menu_item> slider_init(running_machine &machine);
|
||||
std::vector<ui::menu_item> slider_init(running_machine &machine);
|
||||
UINT32 set_handler(ui_callback callback, UINT32 param);
|
||||
void display_startup_screens(bool first_time);
|
||||
virtual void set_startup_text(const char *text, bool force) override;
|
||||
@ -160,7 +164,7 @@ public:
|
||||
std::string &game_info_astring(std::string &str);
|
||||
|
||||
// slider controls
|
||||
std::vector<ui_menu_item>& get_slider_list(void);
|
||||
std::vector<ui::menu_item>& get_slider_list(void);
|
||||
|
||||
// other
|
||||
void process_natural_keyboard();
|
||||
@ -196,7 +200,7 @@ private:
|
||||
static std::string messagebox_poptext;
|
||||
static rgb_t messagebox_backcolor;
|
||||
|
||||
static std::vector<ui_menu_item> slider_list;
|
||||
static std::vector<ui::menu_item> slider_list;
|
||||
static slider_state *slider_current;
|
||||
|
||||
// text generators
|
||||
|
@ -9,22 +9,24 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#include "ui/videoopt.h"
|
||||
|
||||
#include "rendutil.h"
|
||||
|
||||
#include "ui/menu.h"
|
||||
#include "ui/videoopt.h"
|
||||
namespace ui {
|
||||
|
||||
/*-------------------------------------------------
|
||||
menu_video_targets - handle the video targets
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_video_targets::handle()
|
||||
void menu_video_targets::handle()
|
||||
{
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
if (menu_event != nullptr && menu_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_video_options>(ui(), container, static_cast<render_target *>(menu_event->itemref)));
|
||||
menu::stack_push<menu_video_options>(ui(), container, static_cast<render_target *>(menu_event->itemref));
|
||||
}
|
||||
|
||||
|
||||
@ -33,11 +35,11 @@ void ui_menu_video_targets::handle()
|
||||
video targets menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_video_targets::ui_menu_video_targets(mame_ui_manager &mui, render_container *container) : ui_menu(mui, container)
|
||||
menu_video_targets::menu_video_targets(mame_ui_manager &mui, render_container *container) : menu(mui, container)
|
||||
{
|
||||
}
|
||||
|
||||
void ui_menu_video_targets::populate()
|
||||
void menu_video_targets::populate()
|
||||
{
|
||||
int targetnum;
|
||||
|
||||
@ -57,7 +59,7 @@ void ui_menu_video_targets::populate()
|
||||
}
|
||||
}
|
||||
|
||||
ui_menu_video_targets::~ui_menu_video_targets()
|
||||
menu_video_targets::~menu_video_targets()
|
||||
{
|
||||
}
|
||||
|
||||
@ -66,12 +68,12 @@ ui_menu_video_targets::~ui_menu_video_targets()
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_menu_video_options::handle()
|
||||
void menu_video_options::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
/* process the menu */
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
const event *menu_event = process(0);
|
||||
if (menu_event != nullptr && menu_event->itemref != nullptr)
|
||||
{
|
||||
switch ((FPTR)menu_event->itemref)
|
||||
@ -155,7 +157,7 @@ void ui_menu_video_options::handle()
|
||||
|
||||
/* if something changed, rebuild the menu */
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
|
||||
@ -164,12 +166,12 @@ void ui_menu_video_options::handle()
|
||||
video options menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
ui_menu_video_options::ui_menu_video_options(mame_ui_manager &mui, render_container *container, render_target *_target) : ui_menu(mui, container)
|
||||
menu_video_options::menu_video_options(mame_ui_manager &mui, render_container *container, render_target *_target) : menu(mui, container)
|
||||
{
|
||||
target = _target;
|
||||
}
|
||||
|
||||
void ui_menu_video_options::populate()
|
||||
void menu_video_options::populate()
|
||||
{
|
||||
const char *subtext = "";
|
||||
std::string tempstring;
|
||||
@ -190,7 +192,7 @@ void ui_menu_video_options::populate()
|
||||
}
|
||||
|
||||
/* add a separator */
|
||||
item_append(ui_menu_item_type::SEPARATOR);
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
|
||||
/* add a rotate item */
|
||||
switch (target->orientation())
|
||||
@ -200,33 +202,35 @@ void ui_menu_video_options::populate()
|
||||
case ROT180: subtext = "180" UTF8_DEGREES; break;
|
||||
case ROT270: subtext = "CCW 90" UTF8_DEGREES; break;
|
||||
}
|
||||
item_append(_("Rotate"), subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE);
|
||||
item_append(_("Rotate"), subtext, FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE);
|
||||
|
||||
/* backdrop item */
|
||||
enabled = target->backdrops_enabled();
|
||||
item_append(_("Backdrops"), enabled ? _("Enabled") : _("Disabled"), enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS);
|
||||
item_append(_("Backdrops"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS);
|
||||
|
||||
/* overlay item */
|
||||
enabled = target->overlays_enabled();
|
||||
item_append(_("Overlays"), enabled ? _("Enabled") : _("Disabled"), enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS);
|
||||
item_append(_("Overlays"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS);
|
||||
|
||||
/* bezel item */
|
||||
enabled = target->bezels_enabled();
|
||||
item_append(_("Bezels"), enabled ? _("Enabled") : _("Disabled"), enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS);
|
||||
item_append(_("Bezels"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS);
|
||||
|
||||
/* cpanel item */
|
||||
enabled = target->cpanels_enabled();
|
||||
item_append(_("CPanels"), enabled ? _("Enabled") : _("Disabled"), enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_CPANELS);
|
||||
item_append(_("CPanels"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_CPANELS);
|
||||
|
||||
/* marquee item */
|
||||
enabled = target->marquees_enabled();
|
||||
item_append(_("Marquees"), enabled ? _("Enabled") : _("Disabled"), enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_MARQUEES);
|
||||
item_append(_("Marquees"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_MARQUEES);
|
||||
|
||||
/* cropping */
|
||||
enabled = target->zoom_to_screen();
|
||||
item_append(_("View"), enabled ? _("Cropped") : _("Full"), enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM);
|
||||
item_append(_("View"), enabled ? _("Cropped") : _("Full"), enabled ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM);
|
||||
}
|
||||
|
||||
ui_menu_video_options::~ui_menu_video_options()
|
||||
menu_video_options::~menu_video_options()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -10,22 +10,27 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_VIDEOOPT_H__
|
||||
#define __UI_VIDEOOPT_H__
|
||||
#ifndef MAME_FRONTEND_UI_VIDEOOPT_H
|
||||
#define MAME_FRONTEND_UI_VIDEOOPT_H
|
||||
|
||||
#include "ui/menu.h"
|
||||
|
||||
class ui_menu_video_targets : public ui_menu {
|
||||
namespace ui {
|
||||
|
||||
class menu_video_targets : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_video_targets(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~ui_menu_video_targets();
|
||||
menu_video_targets(mame_ui_manager &mui, render_container *container);
|
||||
virtual ~menu_video_targets() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
};
|
||||
|
||||
class ui_menu_video_options : public ui_menu {
|
||||
class menu_video_options : public menu
|
||||
{
|
||||
public:
|
||||
ui_menu_video_options(mame_ui_manager &mui, render_container *container, render_target *target);
|
||||
virtual ~ui_menu_video_options();
|
||||
menu_video_options(mame_ui_manager &mui, render_container *container, render_target *target);
|
||||
virtual ~menu_video_options() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle() override;
|
||||
|
||||
@ -44,5 +49,6 @@ private:
|
||||
render_target *target;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif /* __UI_VIDEOOPT_H__ */
|
||||
#endif /* MAME_FRONTEND_UI_VIDEOOPT_H */
|
||||
|
@ -11,9 +11,14 @@
|
||||
#ifndef INPUT_COMMON_H_
|
||||
#define INPUT_COMMON_H_
|
||||
|
||||
#include <memory>
|
||||
#include "input_module.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
|
||||
|
||||
//============================================================
|
||||
// PARAMETERS
|
||||
@ -618,4 +623,4 @@ inline static INT32 normalize_absolute_axis(INT32 raw, INT32 rawmin, INT32 rawma
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // INPUT_COMMON_H_
|
||||
|
@ -10,8 +10,10 @@
|
||||
#define INPUT_MODULE_H_
|
||||
|
||||
#include "osdepend.h"
|
||||
|
||||
#include "modules/osdmodule.h"
|
||||
|
||||
|
||||
class input_module : public osd_module
|
||||
{
|
||||
public:
|
||||
@ -24,7 +26,6 @@ public:
|
||||
virtual void poll_if_necessary(running_machine &machine) = 0;
|
||||
virtual void pause() = 0;
|
||||
virtual void resume() = 0;
|
||||
virtual void exit() override {};
|
||||
};
|
||||
|
||||
//============================================================
|
||||
|
@ -554,7 +554,7 @@ void osd_common_t::customize_input_type_list(simple_list<input_type_entry> &type
|
||||
// list of OS-dependent slider values.
|
||||
//-------------------------------------------------
|
||||
|
||||
std::vector<ui_menu_item> osd_common_t::get_slider_list()
|
||||
std::vector<ui::menu_item> osd_common_t::get_slider_list()
|
||||
{
|
||||
return m_sliders;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public:
|
||||
|
||||
// video overridables
|
||||
virtual void add_audio_to_recording(const INT16 *buffer, int samples_this_frame) override;
|
||||
virtual std::vector<ui_menu_item> get_slider_list() override;
|
||||
virtual std::vector<ui::menu_item> get_slider_list() override;
|
||||
|
||||
// command option overrides
|
||||
virtual bool execute_command(const char *command) override;
|
||||
@ -285,7 +285,7 @@ protected:
|
||||
input_module* m_joystick_input;
|
||||
output_module* m_output;
|
||||
std::unique_ptr<osd_watchdog> m_watchdog;
|
||||
std::vector<ui_menu_item> m_sliders;
|
||||
std::vector<ui::menu_item> m_sliders;
|
||||
|
||||
private:
|
||||
std::vector<const char *> m_video_names;
|
||||
|
@ -238,7 +238,7 @@ public:
|
||||
virtual render_primitive_list *get_primitives() = 0;
|
||||
|
||||
virtual void add_audio_to_recording(const INT16 *buffer, int samples_this_frame) { }
|
||||
virtual std::vector<ui_menu_item> get_slider_list() { return m_sliders; }
|
||||
virtual std::vector<ui::menu_item> get_slider_list() { return m_sliders; }
|
||||
virtual int draw(const int update) = 0;
|
||||
virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) { return 0; };
|
||||
virtual void save() { };
|
||||
@ -254,7 +254,7 @@ protected:
|
||||
/* Internal flags */
|
||||
static const int FI_CHANGED = 0x010000;
|
||||
bool m_sliders_dirty;
|
||||
std::vector<ui_menu_item> m_sliders;
|
||||
std::vector<ui::menu_item> m_sliders;
|
||||
|
||||
private:
|
||||
std::weak_ptr<osd_window> m_window;
|
||||
|
@ -404,12 +404,12 @@ void chain_manager::create_selection_slider(uint32_t screen_index)
|
||||
state->id = screen_index;
|
||||
strcpy(state->description, description.c_str());
|
||||
|
||||
ui_menu_item item;
|
||||
ui::menu_item item;
|
||||
item.text = state->description;
|
||||
item.subtext = "";
|
||||
item.flags = 0;
|
||||
item.ref = state;
|
||||
item.type = ui_menu_item_type::SLIDER;
|
||||
item.type = ui::menu_item_type::SLIDER;
|
||||
m_selection_sliders.push_back(item);
|
||||
}
|
||||
|
||||
@ -519,9 +519,9 @@ std::vector<std::vector<float>> chain_manager::slider_settings()
|
||||
return curr;
|
||||
}
|
||||
|
||||
std::vector<ui_menu_item> chain_manager::get_slider_list()
|
||||
std::vector<ui::menu_item> chain_manager::get_slider_list()
|
||||
{
|
||||
std::vector<ui_menu_item> sliders;
|
||||
std::vector<ui::menu_item> sliders;
|
||||
|
||||
if (!needs_sliders())
|
||||
{
|
||||
@ -544,8 +544,8 @@ std::vector<ui_menu_item> chain_manager::get_slider_list()
|
||||
std::vector<bgfx_input_pair*> entry_inputs = entry->inputs();
|
||||
for (bgfx_input_pair* input : entry_inputs)
|
||||
{
|
||||
std::vector<ui_menu_item> input_sliders = input->get_slider_list();
|
||||
for (ui_menu_item slider : input_sliders)
|
||||
std::vector<ui::menu_item> input_sliders = input->get_slider_list();
|
||||
for (ui::menu_item slider : input_sliders)
|
||||
{
|
||||
sliders.push_back(slider);
|
||||
}
|
||||
@ -557,12 +557,12 @@ std::vector<ui_menu_item> chain_manager::get_slider_list()
|
||||
{
|
||||
slider_state* core_slider = slider->core_slider();
|
||||
|
||||
ui_menu_item item;
|
||||
ui::menu_item item;
|
||||
item.text = core_slider->description;
|
||||
item.subtext = "";
|
||||
item.flags = 0;
|
||||
item.ref = core_slider;
|
||||
item.type = ui_menu_item_type::SLIDER;
|
||||
item.type = ui::menu_item_type::SLIDER;
|
||||
m_selection_sliders.push_back(item);
|
||||
|
||||
sliders.push_back(item);
|
||||
@ -570,12 +570,12 @@ std::vector<ui_menu_item> chain_manager::get_slider_list()
|
||||
|
||||
if (chain_sliders.size() > 0)
|
||||
{
|
||||
ui_menu_item item;
|
||||
ui::menu_item item;
|
||||
item.text = MENU_SEPARATOR_ITEM;
|
||||
item.subtext = "";
|
||||
item.flags = 0;
|
||||
item.ref = nullptr;
|
||||
item.type = ui_menu_item_type::SEPARATOR;
|
||||
item.type = ui::menu_item_type::SEPARATOR;
|
||||
|
||||
sliders.push_back(item);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
bgfx_chain* screen_chain(uint32_t screen);
|
||||
bgfx_chain* load_chain(std::string name, uint32_t screen_index);
|
||||
bool has_applicable_chain(uint32_t screen);
|
||||
std::vector<ui_menu_item> get_slider_list();
|
||||
std::vector<ui::menu_item> get_slider_list();
|
||||
std::vector<std::vector<float>> slider_settings();
|
||||
|
||||
// Setters
|
||||
@ -100,7 +100,7 @@ private:
|
||||
std::vector<chain_desc> m_available_chains;
|
||||
std::vector<bgfx_chain*> m_screen_chains;
|
||||
std::vector<std::string> m_chain_names;
|
||||
std::vector<ui_menu_item> m_selection_sliders;
|
||||
std::vector<ui::menu_item> m_selection_sliders;
|
||||
std::vector<int32_t> m_current_chain;
|
||||
|
||||
static const uint32_t CHAIN_NONE;
|
||||
|
@ -111,12 +111,12 @@ void bgfx_input_pair::create_selection_slider(uint32_t screen_index)
|
||||
state->id = screen_index;
|
||||
strcpy(state->description, description.c_str());
|
||||
|
||||
ui_menu_item item;
|
||||
ui::menu_item item;
|
||||
item.text = state->description;
|
||||
item.subtext = "";
|
||||
item.flags = 0;
|
||||
item.ref = state;
|
||||
item.type = ui_menu_item_type::SLIDER;
|
||||
item.type = ui::menu_item_type::SLIDER;
|
||||
m_selection_slider = item;
|
||||
}
|
||||
|
||||
@ -125,9 +125,9 @@ bool bgfx_input_pair::needs_sliders()
|
||||
return chains().screen_count() > 0 && m_available_textures.size() > 1;
|
||||
}
|
||||
|
||||
std::vector<ui_menu_item> bgfx_input_pair::get_slider_list()
|
||||
std::vector<ui::menu_item> bgfx_input_pair::get_slider_list()
|
||||
{
|
||||
std::vector<ui_menu_item> sliders;
|
||||
std::vector<ui::menu_item> sliders;
|
||||
|
||||
if (!needs_sliders())
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
chain_manager& chains() const { return m_chains; }
|
||||
std::string sampler() const { return m_sampler; }
|
||||
std::string texture() const { return m_texture; }
|
||||
std::vector<ui_menu_item> get_slider_list();
|
||||
std::vector<ui::menu_item> get_slider_list();
|
||||
|
||||
private:
|
||||
void create_selection_slider(uint32_t screen_index);
|
||||
@ -46,7 +46,7 @@ private:
|
||||
std::string m_selection;
|
||||
chain_manager& m_chains;
|
||||
int32_t m_current_texture;
|
||||
ui_menu_item m_selection_slider;
|
||||
ui::menu_item m_selection_slider;
|
||||
};
|
||||
|
||||
#endif // __DRAWBGFX_INPUT_PAIR__
|
||||
|
@ -389,7 +389,7 @@ void shaders::end_avi_recording()
|
||||
// shaders::toggle
|
||||
//============================================================
|
||||
|
||||
void shaders::toggle(std::vector<ui_menu_item>& sliders)
|
||||
void shaders::toggle(std::vector<ui::menu_item>& sliders)
|
||||
{
|
||||
if (master_enable)
|
||||
{
|
||||
@ -824,7 +824,7 @@ void shaders::init_fsfx_quad(void *vertbuf)
|
||||
// shaders::create_resources
|
||||
//============================================================
|
||||
|
||||
int shaders::create_resources(bool reset, std::vector<ui_menu_item>& sliders)
|
||||
int shaders::create_resources(bool reset, std::vector<ui::menu_item>& sliders)
|
||||
{
|
||||
if (!master_enable || !d3dintf->post_fx_available)
|
||||
{
|
||||
@ -1000,7 +1000,7 @@ int shaders::create_resources(bool reset, std::vector<ui_menu_item>& sliders)
|
||||
|
||||
initialized = true;
|
||||
|
||||
std::vector<ui_menu_item> my_sliders = init_slider_list();
|
||||
std::vector<ui::menu_item> my_sliders = init_slider_list();
|
||||
sliders.insert(sliders.end(), my_sliders.begin(), my_sliders.end());
|
||||
|
||||
return 0;
|
||||
@ -2497,9 +2497,9 @@ void *shaders::get_slider_option(int id, int index)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<ui_menu_item> shaders::init_slider_list()
|
||||
std::vector<ui::menu_item> shaders::init_slider_list()
|
||||
{
|
||||
std::vector<ui_menu_item> sliders;
|
||||
std::vector<ui::menu_item> sliders;
|
||||
|
||||
for (slider* slider : internal_sliders)
|
||||
{
|
||||
@ -2560,12 +2560,12 @@ std::vector<ui_menu_item> shaders::init_slider_list()
|
||||
|
||||
slider_state* core_slider = slider_alloc(*machine, desc->id, name.c_str(), desc->minval, desc->defval, desc->maxval, desc->step, slider_update_trampoline, slider_arg);
|
||||
|
||||
ui_menu_item item;
|
||||
ui::menu_item item;
|
||||
item.text = core_slider->description;
|
||||
item.subtext = "";
|
||||
item.flags = 0;
|
||||
item.ref = core_slider;
|
||||
item.type = ui_menu_item_type::SLIDER;
|
||||
item.type = ui::menu_item_type::SLIDER;
|
||||
sliders.push_back(item);
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ public:
|
||||
void init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *renderer);
|
||||
|
||||
bool enabled() { return master_enable; }
|
||||
void toggle(std::vector<ui_menu_item>& sliders);
|
||||
void toggle(std::vector<ui::menu_item>& sliders);
|
||||
|
||||
bool vector_enabled() { return master_enable && vector_enable; }
|
||||
d3d_render_target* get_vector_target(render_primitive *prim);
|
||||
@ -338,11 +338,11 @@ public:
|
||||
void remove_render_target(int source_width, int source_height, UINT32 screen_index, UINT32 page_index);
|
||||
void remove_render_target(d3d_render_target *rt);
|
||||
|
||||
int create_resources(bool reset, std::vector<ui_menu_item>& sliders);
|
||||
int create_resources(bool reset, std::vector<ui::menu_item>& sliders);
|
||||
void delete_resources(bool reset);
|
||||
|
||||
// slider-related functions
|
||||
std::vector<ui_menu_item> init_slider_list();
|
||||
std::vector<ui::menu_item> init_slider_list();
|
||||
void *get_slider_option(int id, int index = 0);
|
||||
|
||||
private:
|
||||
|
@ -1158,7 +1158,7 @@ void renderer_bgfx::allocate_buffer(render_primitive *prim, UINT32 blend, bgfx::
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<ui_menu_item> renderer_bgfx::get_slider_list()
|
||||
std::vector<ui::menu_item> renderer_bgfx::get_slider_list()
|
||||
{
|
||||
m_sliders_dirty = false;
|
||||
return m_chains->get_slider_list();
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
virtual int draw(const int update) override;
|
||||
|
||||
virtual void add_audio_to_recording(const INT16 *buffer, int samples_this_frame) override;
|
||||
virtual std::vector<ui_menu_item> get_slider_list() override;
|
||||
virtual std::vector<ui::menu_item> get_slider_list() override;
|
||||
virtual void set_sliders_dirty() override;
|
||||
|
||||
#ifdef OSD_SDL
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
|
||||
// video overridables
|
||||
virtual void add_audio_to_recording(const INT16 *buffer, int samples_this_frame) = 0;
|
||||
virtual std::vector<ui_menu_item> get_slider_list() = 0;
|
||||
virtual std::vector<ui::menu_item> get_slider_list() = 0;
|
||||
|
||||
// font interface
|
||||
virtual osd_font::ptr font_alloc() = 0;
|
||||
|
@ -171,7 +171,7 @@ void sdl_osd_interface::build_slider_list()
|
||||
|
||||
for (auto window : sdl_window_list)
|
||||
{
|
||||
std::vector<ui_menu_item> window_sliders = window->renderer().get_slider_list();
|
||||
std::vector<ui::menu_item> window_sliders = window->renderer().get_slider_list();
|
||||
m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end());
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ void windows_osd_interface::build_slider_list()
|
||||
for (auto window : win_window_list)
|
||||
{
|
||||
// take the sliders of the first window
|
||||
std::vector<ui_menu_item> window_sliders = window->m_renderer->get_slider_list();
|
||||
std::vector<ui::menu_item> window_sliders = window->m_renderer->get_slider_list();
|
||||
m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user