mirror of
https://github.com/holub/mame
synced 2025-04-16 21:44:32 +03:00
submenu: merged some options menu. (nw)
This commit is contained in:
parent
6b5cb8304f
commit
5347076f49
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -247,8 +247,6 @@ files {
|
||||
MAME_DIR .. "src/emu/ui/auditmenu.h",
|
||||
MAME_DIR .. "src/emu/ui/cmddata.h",
|
||||
MAME_DIR .. "src/emu/ui/cmdrender.h",
|
||||
MAME_DIR .. "src/emu/ui/ctrlmenu.cpp",
|
||||
MAME_DIR .. "src/emu/ui/ctrlmenu.h",
|
||||
MAME_DIR .. "src/emu/ui/custmenu.cpp",
|
||||
MAME_DIR .. "src/emu/ui/custmenu.h",
|
||||
MAME_DIR .. "src/emu/ui/custui.cpp",
|
||||
@ -260,8 +258,6 @@ files {
|
||||
MAME_DIR .. "src/emu/ui/defimg.h",
|
||||
MAME_DIR .. "src/emu/ui/dirmenu.cpp",
|
||||
MAME_DIR .. "src/emu/ui/dirmenu.h",
|
||||
MAME_DIR .. "src/emu/ui/dsplmenu.cpp",
|
||||
MAME_DIR .. "src/emu/ui/dsplmenu.h",
|
||||
MAME_DIR .. "src/emu/ui/icorender.h",
|
||||
MAME_DIR .. "src/emu/ui/inifile.cpp",
|
||||
MAME_DIR .. "src/emu/ui/inifile.h",
|
||||
|
@ -1,150 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Maurizio Petrarota
|
||||
/*********************************************************************
|
||||
|
||||
ui/ctrlmenu.cpp
|
||||
|
||||
Internal UI user interface.
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "emuopts.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ctrlmenu.h"
|
||||
|
||||
const char *ui_menu_controller_mapping::m_device_status[] = { "none", "keyboard", "mouse", "lightgun", "joystick" };
|
||||
|
||||
ui_menu_controller_mapping::ctrl_option ui_menu_controller_mapping::m_options[] = {
|
||||
{ 0, nullptr, nullptr },
|
||||
{ 0, __("Lightgun Device Assignment"), OPTION_LIGHTGUN_DEVICE },
|
||||
{ 0, __("Trackball Device Assignment"), OPTION_TRACKBALL_DEVICE },
|
||||
{ 0, __("Pedal Device Assignment"), OPTION_PEDAL_DEVICE },
|
||||
{ 0, __("Adstick Device Assignment"), OPTION_ADSTICK_DEVICE },
|
||||
{ 0, __("Paddle Device Assignment"), OPTION_PADDLE_DEVICE },
|
||||
{ 0, __("Dial Device Assignment"), OPTION_DIAL_DEVICE },
|
||||
{ 0, __("Positional Device Assignment"), OPTION_POSITIONAL_DEVICE },
|
||||
{ 0, __("Mouse Device Assignment"), OPTION_MOUSE_DEVICE }
|
||||
};
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_controller_mapping::ui_menu_controller_mapping(running_machine &machine, render_container *container) : ui_menu(machine, container)
|
||||
{
|
||||
for (int d = 1; d < ARRAY_LENGTH(m_options); ++d)
|
||||
m_options[d].status = check_status(machine.options().value(m_options[d].option), m_options[d].option);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_controller_mapping::~ui_menu_controller_mapping()
|
||||
{
|
||||
std::string error_string;
|
||||
for (int d = 1; d < ARRAY_LENGTH(m_options); ++d)
|
||||
{
|
||||
if (strcmp(machine().options().value(m_options[d].option), m_device_status[m_options[d].status])!=0)
|
||||
{
|
||||
machine().options().set_value(m_options[d].option, m_device_status[m_options[d].status], OPTION_PRIORITY_CMDLINE, error_string);
|
||||
machine().options().mark_changed(m_options[d].option);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_controller_mapping::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(0);
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
changed = true;
|
||||
FPTR value = (FPTR)m_event->itemref;
|
||||
(m_event->iptkey == IPT_UI_RIGHT) ? m_options[value].status++ : m_options[value].status--;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_controller_mapping::populate()
|
||||
{
|
||||
// add options
|
||||
for (int d = 1; d < ARRAY_LENGTH(m_options); ++d)
|
||||
{
|
||||
UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_device_status) - 1, m_options[d].status);
|
||||
item_append(_(m_options[d].description), m_device_status[m_options[d].status], arrow_flags, (void *)(FPTR)d);
|
||||
}
|
||||
item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
|
||||
customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_controller_mapping::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width, maxwidth = origx2 - origx1;
|
||||
ui_manager &mui = machine().ui();
|
||||
|
||||
mui.draw_text_full(container, _("Device Mapping"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
|
||||
width += 2 * UI_BOX_LR_BORDER;
|
||||
maxwidth = MAX(maxwidth, width);
|
||||
|
||||
// compute our bounds
|
||||
float x1 = 0.5f - 0.5f * maxwidth;
|
||||
float x2 = x1 + maxwidth;
|
||||
float y1 = origy1 - top;
|
||||
float y2 = origy1 - UI_BOX_TB_BORDER;
|
||||
|
||||
// draw a box
|
||||
mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
|
||||
|
||||
// take off the borders
|
||||
x1 += UI_BOX_LR_BORDER;
|
||||
x2 -= UI_BOX_LR_BORDER;
|
||||
y1 += UI_BOX_TB_BORDER;
|
||||
|
||||
// draw the text within it
|
||||
mui.draw_text_full(container, _("Device Mapping"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// return current value
|
||||
//-------------------------------------------------
|
||||
|
||||
int ui_menu_controller_mapping::check_status(const char *status, const char *option)
|
||||
{
|
||||
for (int d = 0; *m_device_status[d]; d++)
|
||||
if (!strcmp(m_device_status[d], status))
|
||||
return d;
|
||||
|
||||
emu_options def_opt;
|
||||
const char *def_val = def_opt.value(option);
|
||||
|
||||
for (int d = 0; *m_device_status[d]; d++)
|
||||
if (!strcmp(m_device_status[d], def_val))
|
||||
return d;
|
||||
|
||||
return 1;
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Maurizio Petrarota
|
||||
/***************************************************************************
|
||||
|
||||
ui/ctrlmenu.h
|
||||
|
||||
Internal UI user interface.
|
||||
|
||||
***************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_CTRLMENU_H__
|
||||
#define __UI_CTRLMENU_H__
|
||||
|
||||
//-------------------------------------------------
|
||||
// class controller mapping menu
|
||||
//-------------------------------------------------
|
||||
|
||||
class ui_menu_controller_mapping : public ui_menu
|
||||
{
|
||||
public:
|
||||
ui_menu_controller_mapping(running_machine &machine, render_container *container);
|
||||
virtual ~ui_menu_controller_mapping();
|
||||
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:
|
||||
struct ctrl_option
|
||||
{
|
||||
int status;
|
||||
const char *description;
|
||||
const char *option;
|
||||
};
|
||||
|
||||
static const char *m_device_status[];
|
||||
static ctrl_option m_options[];
|
||||
int check_status(const char *status, const char *option);
|
||||
};
|
||||
|
||||
#endif /* __UI_CTRLMENU_H__ */
|
@ -1,223 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Maurizio Petrarota
|
||||
/*********************************************************************
|
||||
|
||||
ui/dsplmenu.cpp
|
||||
|
||||
UI video options menu.
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/dsplmenu.h"
|
||||
#include "ui/selector.h"
|
||||
#include "ui/utils.h"
|
||||
|
||||
#if defined(UI_WINDOWS) && !defined(UI_SDL)
|
||||
#include "../osd/windows/winmain.h"
|
||||
#else
|
||||
#include "../osd/modules/lib/osdobj_common.h"
|
||||
#endif
|
||||
|
||||
|
||||
ui_menu_display_options::video_modes ui_menu_display_options::m_video = {
|
||||
{ "auto", "Auto" },
|
||||
{ "opengl", "OpenGL" },
|
||||
{ "bgfx", "BGFX" },
|
||||
{ "d3d", "Direct3D" },
|
||||
{ "gdi", "GDI" },
|
||||
{ "ddraw", "DirectDraw" },
|
||||
{ "soft", "Software" },
|
||||
{ "accel", "SDL2 Accelerated" }
|
||||
};
|
||||
|
||||
ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = {
|
||||
{ 0, nullptr, nullptr },
|
||||
{ 0, __("Video Mode"), OSDOPTION_VIDEO },
|
||||
#if defined(UI_WINDOWS) && !defined(UI_SDL)
|
||||
{ 0, __("Triple Buffering"), WINOPTION_TRIPLEBUFFER },
|
||||
{ 0, __("HLSL"), WINOPTION_HLSL_ENABLE },
|
||||
#endif
|
||||
{ 0, __("GLSL"), OSDOPTION_GL_GLSL },
|
||||
{ 0, __("Bilinear Filtering"), OSDOPTION_FILTER },
|
||||
{ 0, __("Bitmap Prescaling"), OSDOPTION_PRESCALE },
|
||||
{ 0, __("Window Mode"), OSDOPTION_WINDOW },
|
||||
{ 0, __("Enforce Aspect Ratio"), OPTION_KEEPASPECT },
|
||||
{ 0, __("Start Out Maximized"), OSDOPTION_MAXIMIZE },
|
||||
{ 0, __("Synchronized Refresh"), OSDOPTION_SYNCREFRESH },
|
||||
{ 0, __("Wait Vertical Sync"), OSDOPTION_WAITVSYNC }
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_display_options::ui_menu_display_options(running_machine &machine, render_container *container) : ui_menu(machine, container)
|
||||
{
|
||||
osd_options &options = downcast<osd_options &>(machine.options());
|
||||
|
||||
for (int d = 2; d < ARRAY_LENGTH(m_options); ++d)
|
||||
m_options[d].status = options.int_value(m_options[d].option);
|
||||
|
||||
// create video list
|
||||
m_list.push_back("auto");
|
||||
|
||||
std::string descr = options.description(OSDOPTION_VIDEO);
|
||||
descr.erase(0, descr.find(":") + 2);
|
||||
std::string delim = ", ";
|
||||
size_t p1, p2 = 0;
|
||||
for (;;)
|
||||
{
|
||||
p1 = descr.find_first_not_of(delim, p2);
|
||||
if (p1 == std::string::npos)
|
||||
break;
|
||||
p2 = descr.find_first_of(delim, p1 + 1);
|
||||
if (p2 != std::string::npos)
|
||||
{
|
||||
std::string txt(descr.substr(p1, p2 - p1));
|
||||
if (txt != "or" && txt != "none")
|
||||
m_list.push_back(txt);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_list.push_back(descr.substr(p1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_options[1].status = 0;
|
||||
for (int cur = 0; cur < m_list.size(); ++cur)
|
||||
if (options.video() == m_list[cur])
|
||||
{
|
||||
m_options[1].status = cur;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// dtor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_display_options::~ui_menu_display_options()
|
||||
{
|
||||
std::string error_string;
|
||||
for (int d = 2; d < ARRAY_LENGTH(m_options); ++d)
|
||||
{
|
||||
if (machine().options().int_value(m_options[d].option) != m_options[d].status)
|
||||
{
|
||||
machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string);
|
||||
machine().options().mark_changed(m_options[d].option);
|
||||
}
|
||||
}
|
||||
if (machine().options().value(m_options[1].option) != m_list[m_options[1].status])
|
||||
{
|
||||
machine().options().set_value(m_options[1].option, m_list[m_options[1].status].c_str(), OPTION_PRIORITY_CMDLINE, error_string);
|
||||
machine().options().mark_changed(m_options[1].option);
|
||||
|
||||
}
|
||||
ui_globals::reset = true;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_display_options::handle()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *m_event = process(0);
|
||||
|
||||
if (m_event != nullptr && m_event->itemref != nullptr)
|
||||
{
|
||||
int value = (FPTR)m_event->itemref;
|
||||
if (!strcmp(m_options[value].option, OSDOPTION_VIDEO) || !strcmp(m_options[value].option, OSDOPTION_PRESCALE))
|
||||
{
|
||||
if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
changed = true;
|
||||
(m_event->iptkey == IPT_UI_LEFT) ? m_options[value].status-- : m_options[value].status++;
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_SELECT && !strcmp(m_options[value].option, OSDOPTION_VIDEO))
|
||||
{
|
||||
int total = m_list.size();
|
||||
std::vector<std::string> s_sel(total);
|
||||
for (int index = 0; index < total; ++index)
|
||||
s_sel[index] = m_video[m_list[index]];
|
||||
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, m_options[value].status));
|
||||
}
|
||||
}
|
||||
else if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
changed = true;
|
||||
m_options[value].status = !m_options[value].status;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// populate
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_display_options::populate()
|
||||
{
|
||||
// add video mode option
|
||||
std::string v_text(m_video[m_list[m_options[1].status]]);
|
||||
UINT32 arrow_flags = get_arrow_flags(0, m_list.size() - 1, m_options[1].status);
|
||||
item_append(_(m_options[1].description), v_text.c_str(), arrow_flags, (void *)(FPTR)1);
|
||||
|
||||
// add options items
|
||||
for (int opt = 2; opt < ARRAY_LENGTH(m_options); ++opt)
|
||||
if (strcmp(m_options[opt].option, OSDOPTION_PRESCALE) != 0)
|
||||
item_append(_(m_options[opt].description), m_options[opt].status ? _("On") : _("Off"),
|
||||
m_options[opt].status ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)opt);
|
||||
else
|
||||
{
|
||||
arrow_flags = get_arrow_flags(1, 3, m_options[opt].status);
|
||||
item_append(_(m_options[opt].description), string_format("%d", m_options[opt].status).c_str(), arrow_flags, (void *)(FPTR)opt);
|
||||
}
|
||||
|
||||
item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
|
||||
customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// perform our special rendering
|
||||
//-------------------------------------------------
|
||||
|
||||
void ui_menu_display_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||
{
|
||||
float width;
|
||||
ui_manager &mui = machine().ui();
|
||||
mui.draw_text_full(container, _("Display Options"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE,
|
||||
ARGB_WHITE, ARGB_BLACK, &width, nullptr);
|
||||
width += 2 * UI_BOX_LR_BORDER;
|
||||
float maxwidth = MAX(origx2 - origx1, width);
|
||||
|
||||
// compute our bounds
|
||||
float x1 = 0.5f - 0.5f * maxwidth;
|
||||
float x2 = x1 + maxwidth;
|
||||
float y1 = origy1 - top;
|
||||
float y2 = origy1 - UI_BOX_TB_BORDER;
|
||||
|
||||
// draw a box
|
||||
mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
|
||||
|
||||
// take off the borders
|
||||
x1 += UI_BOX_LR_BORDER;
|
||||
x2 -= UI_BOX_LR_BORDER;
|
||||
y1 += UI_BOX_TB_BORDER;
|
||||
|
||||
// draw the text within it
|
||||
mui.draw_text_full(container, _("Display Options"), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL,
|
||||
UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Maurizio Petrarota
|
||||
/***************************************************************************
|
||||
|
||||
ui/dsplmenu.h
|
||||
|
||||
UI video options menu.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UI_DSPLMENU_H__
|
||||
#define __UI_DSPLMENU_H__
|
||||
|
||||
//-------------------------------------------------
|
||||
// class display options menu
|
||||
//-------------------------------------------------
|
||||
class ui_menu_display_options : public ui_menu
|
||||
{
|
||||
public:
|
||||
ui_menu_display_options(running_machine &machine, render_container *container);
|
||||
virtual ~ui_menu_display_options();
|
||||
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:
|
||||
struct dspl_option
|
||||
{
|
||||
UINT16 status;
|
||||
const char *description;
|
||||
const char *option;
|
||||
};
|
||||
|
||||
using video_modes = std::unordered_map<std::string, std::string>;
|
||||
|
||||
static video_modes m_video;
|
||||
static dspl_option m_options[];
|
||||
|
||||
std::vector<std::string> m_list;
|
||||
};
|
||||
|
||||
#endif /* __UI_DSPLMENU_H__ */
|
@ -566,7 +566,8 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
|
||||
bool show_bottom_arrow = false;
|
||||
|
||||
// if scrolling, show arrows
|
||||
if (item.size() > visible_lines) {
|
||||
if (item.size() > visible_lines)
|
||||
{
|
||||
if (top_line > 0)
|
||||
show_top_arrow = true;
|
||||
if (top_line != item.size() - visible_lines)
|
||||
@ -2796,7 +2797,6 @@ void ui_menu::draw_dats_menu()
|
||||
float y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER + extra_height;
|
||||
float line = visible_top + (float)(visible_lines * line_height);
|
||||
|
||||
//machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
|
||||
mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
|
||||
|
||||
if (visible_items < visible_lines)
|
||||
|
@ -17,8 +17,6 @@
|
||||
#include "ui/selector.h"
|
||||
#include "ui/custui.h"
|
||||
#include "ui/sndmenu.h"
|
||||
#include "ui/ctrlmenu.h"
|
||||
#include "ui/dsplmenu.h"
|
||||
#include "ui/miscmenu.h"
|
||||
#include "ui/optsmenu.h"
|
||||
#include "ui/custmenu.h"
|
||||
@ -171,7 +169,7 @@ void ui_menu_game_options::handle()
|
||||
break;
|
||||
case DISPLAY_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_display_options>(machine(), container));
|
||||
ui_menu::stack_push(global_alloc_clear<ui_submenu>(machine(), container, video_submenu_options));
|
||||
break;
|
||||
case CUSTOM_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
@ -179,7 +177,7 @@ void ui_menu_game_options::handle()
|
||||
break;
|
||||
case CONTROLLER_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
ui_menu::stack_push(global_alloc_clear<ui_menu_controller_mapping>(machine(), container));
|
||||
ui_menu::stack_push(global_alloc_clear<ui_submenu>(machine(), container, control_submenu_options));
|
||||
break;
|
||||
case CGI_MENU:
|
||||
if (m_event->iptkey == IPT_UI_SELECT)
|
||||
@ -263,10 +261,10 @@ void ui_menu_game_options::populate()
|
||||
item_append(_("Customize UI"), nullptr, 0, (void *)(FPTR)CUSTOM_MENU);
|
||||
item_append(_("Configure Directories"), nullptr, 0, (void *)(FPTR)CONF_DIR);
|
||||
}
|
||||
item_append(_("Display Options"), nullptr, 0, (void *)(FPTR)DISPLAY_MENU);
|
||||
item_append(_(video_submenu_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(_("Device Mapping"), nullptr, 0, (void *)(FPTR)CONTROLLER_MENU);
|
||||
item_append(_(control_submenu_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(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
|
||||
|
@ -2260,7 +2260,6 @@ void ui_menu_select_game::draw_right_panel(void *selectedref, float origx1, floa
|
||||
float ar_x1 = ar_x0 + lr_arrow_width;
|
||||
float ar_y1 = 0.5f * (origy2 + origy1) + 0.9f * space;
|
||||
|
||||
//machine().ui().draw_outlined_box(container, origx1, origy1, origx2, origy2, UI_BACKGROUND_COLOR);
|
||||
mui.draw_outlined_box(container, origx1, origy1, origx2, origy2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
|
||||
|
||||
if (mouse_hit && origx1 <= mouse_x && x2 > mouse_x && origy1 <= mouse_y && origy2 > mouse_y)
|
||||
|
@ -431,7 +431,6 @@ void ui_menu_select_software::populate()
|
||||
|
||||
machine_config config(*m_driver, machine().options());
|
||||
image_interface_iterator iter(config.root_device());
|
||||
|
||||
for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
|
||||
if (image->filename() == nullptr && image->must_be_loaded())
|
||||
{
|
||||
@ -1431,7 +1430,6 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo
|
||||
}
|
||||
|
||||
x2 = x1 + left_width + 2.0f * UI_BOX_LR_BORDER;
|
||||
//machine().ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
|
||||
mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
|
||||
|
||||
// take off the borders
|
||||
@ -1512,7 +1510,6 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo
|
||||
float ar_x1 = ar_x0 + lr_arrow_width;
|
||||
float ar_y1 = 0.5f * (y2 + y1) + 0.9f * space;
|
||||
|
||||
//machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
|
||||
mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
|
||||
|
||||
if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y)
|
||||
@ -1536,7 +1533,6 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo
|
||||
float ar_x1 = ar_x0 + lr_arrow_width;
|
||||
float ar_y1 = 0.5f * (y2 + y1) + 0.9f * space;
|
||||
|
||||
//machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
|
||||
mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
|
||||
|
||||
if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y)
|
||||
@ -1899,7 +1895,6 @@ void ui_menu_select_software::draw_right_panel(void *selectedref, float origx1,
|
||||
float ar_x1 = ar_x0 + lr_arrow_width;
|
||||
float ar_y1 = 0.5f * (origy2 + origy1) + 0.9f * space;
|
||||
|
||||
//machine().ui().draw_outlined_box(container, origx1, origy1, origx2, origy2, UI_BACKGROUND_COLOR);
|
||||
mui.draw_outlined_box(container, origx1, origy1, origx2, origy2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
|
||||
|
||||
if (mouse_hit && origx1 <= mouse_x && x2 > mouse_x && origy1 <= mouse_y && origy2 > mouse_y)
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "ui/submenu.h"
|
||||
#include "ui/utils.h"
|
||||
#include <limits>
|
||||
#include <iterator>
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor / dtor
|
||||
@ -24,19 +25,65 @@ ui_submenu::ui_submenu(running_machine &machine, render_container *container, st
|
||||
{
|
||||
for (auto & sm_option : m_options)
|
||||
{
|
||||
if (sm_option.type < ui_submenu::EMU)
|
||||
continue;
|
||||
|
||||
// fixme use switch
|
||||
sm_option.entry = machine.options().get_entry(sm_option.name);
|
||||
if (sm_option.entry == nullptr)
|
||||
switch (sm_option.type)
|
||||
{
|
||||
sm_option.entry = machine.ui().options().get_entry(sm_option.name);
|
||||
sm_option.options = dynamic_cast<core_options*>(&machine.ui().options());
|
||||
case ui_submenu::EMU:
|
||||
sm_option.entry = machine.options().get_entry(sm_option.name);
|
||||
sm_option.options = dynamic_cast<core_options*>(&machine.options());
|
||||
if (sm_option.entry->type() == OPTION_STRING)
|
||||
{
|
||||
sm_option.value.clear();
|
||||
std::string namestr(sm_option.entry->description());
|
||||
int lparen = namestr.find_first_of('(', 0);
|
||||
int vslash = namestr.find_first_of('|', lparen + 1);
|
||||
int rparen = namestr.find_first_of(')', vslash + 1);
|
||||
if (lparen != -1 && vslash != -1 && rparen != -1)
|
||||
{
|
||||
int semi;
|
||||
namestr.erase(rparen);
|
||||
namestr.erase(0, lparen + 1);
|
||||
while ((semi = namestr.find_first_of('|')) != -1)
|
||||
{
|
||||
sm_option.value.emplace_back(namestr.substr(0, semi));
|
||||
namestr.erase(0, semi + 1);
|
||||
}
|
||||
sm_option.value.emplace_back(namestr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ui_submenu::OSD:
|
||||
sm_option.entry = machine.options().get_entry(sm_option.name);
|
||||
sm_option.options = dynamic_cast<core_options*>(&machine.options());
|
||||
if (sm_option.entry->type() == OPTION_STRING)
|
||||
{
|
||||
sm_option.value.clear();
|
||||
std::string descr(sm_option.entry->description()), delim(", ");
|
||||
descr.erase(0, descr.find(":") + 2);
|
||||
size_t p1, p2 = 0;
|
||||
while ((p1 = descr.find_first_not_of(delim, p2)) != std::string::npos)
|
||||
{
|
||||
p2 = descr.find_first_of(delim, p1 + 1);
|
||||
if (p2 != std::string::npos)
|
||||
{
|
||||
std::string txt(descr.substr(p1, p2 - p1));
|
||||
if (txt != "or")
|
||||
sm_option.value.push_back(txt);
|
||||
}
|
||||
else
|
||||
{
|
||||
sm_option.options = dynamic_cast<core_options*>(&machine.options());
|
||||
sm_option.value.push_back(descr.substr(p1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ui_submenu::UI:
|
||||
sm_option.entry = machine.ui().options().get_entry(sm_option.name);
|
||||
sm_option.options = dynamic_cast<core_options*>(&machine.ui().options());
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -115,6 +162,20 @@ void ui_submenu::handle()
|
||||
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;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -207,6 +268,16 @@ void ui_submenu::populate()
|
||||
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:
|
||||
arrow_flags = MENU_FLAG_RIGHT_ARROW;
|
||||
item_append(_(sm_option->description),
|
||||
@ -260,7 +331,6 @@ 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)
|
||||
{
|
||||
mui.draw_text_full(container, selected_sm_option->entry->description(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
|
@ -15,6 +15,12 @@
|
||||
#include "emuopts.h"
|
||||
#include "ui/menu.h"
|
||||
|
||||
#if defined(UI_WINDOWS) && !defined(UI_SDL)
|
||||
#include "../osd/windows/winmain.h"
|
||||
#else
|
||||
#include "../osd/modules/lib/osdobj_common.h"
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------
|
||||
// class ui menu
|
||||
//-------------------------------------------------
|
||||
@ -37,6 +43,7 @@ public:
|
||||
const char *name;
|
||||
core_options::entry *entry;
|
||||
core_options (*options);
|
||||
std::vector<std::string> value;
|
||||
};
|
||||
|
||||
ui_submenu(running_machine &machine, render_container *container, std::vector<ui_submenu::option> &suboptions);
|
||||
@ -74,9 +81,7 @@ static std::vector<ui_submenu::option> advanced_submenu_options = {
|
||||
{ ui_submenu::EMU, __("Sleep"), OPTION_SLEEP },
|
||||
{ ui_submenu::EMU, __("Speed"), OPTION_SPEED },
|
||||
{ ui_submenu::EMU, __("Refresh speed"), OPTION_REFRESHSPEED },
|
||||
//};
|
||||
|
||||
//static std::vector<ui_submenu::option> rotate_submenu_options = {
|
||||
{ ui_submenu::HEAD, __("Rotation Options") },
|
||||
{ ui_submenu::EMU, __("Rotate"), OPTION_ROTATE },
|
||||
{ ui_submenu::EMU, __("Rotate right"), OPTION_ROR },
|
||||
@ -85,9 +90,7 @@ static std::vector<ui_submenu::option> advanced_submenu_options = {
|
||||
{ ui_submenu::EMU, __("Auto rotate left"), OPTION_AUTOROL },
|
||||
{ ui_submenu::EMU, __("Flip X"), OPTION_FLIPX },
|
||||
{ ui_submenu::EMU, __("Flip Y"), OPTION_FLIPY },
|
||||
//};
|
||||
|
||||
//static std::vector<ui_submenu::option> artwork_submenu_options = {
|
||||
{ ui_submenu::HEAD, __("Artwork Options") },
|
||||
{ ui_submenu::EMU, __("Artwork Crop"), OPTION_ARTWORK_CROP },
|
||||
{ ui_submenu::EMU, __("Use Backdrops"), OPTION_USE_BACKDROPS },
|
||||
@ -95,16 +98,12 @@ static std::vector<ui_submenu::option> advanced_submenu_options = {
|
||||
{ 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 },
|
||||
//};
|
||||
|
||||
//static std::vector<ui_submenu::option> state_submenu_options = {
|
||||
{ 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 },
|
||||
//};
|
||||
|
||||
//static std::vector<ui_submenu::option> input_submenu_options = {
|
||||
{ ui_submenu::HEAD, __("Input Options") },
|
||||
{ ui_submenu::EMU, __("Coin lockout"), OPTION_COIN_LOCKOUT },
|
||||
{ ui_submenu::EMU, __("Mouse"), OPTION_MOUSE },
|
||||
@ -122,6 +121,35 @@ static std::vector<ui_submenu::option> advanced_submenu_options = {
|
||||
{ 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, __("Display Options") },
|
||||
{ ui_submenu::OSD, __("Video Mode"), OSDOPTION_VIDEO },
|
||||
#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" },
|
||||
|
Loading…
Reference in New Issue
Block a user