Added support and configuration for the image collection "covers".

Slightly modernized and simplified the code.
This commit is contained in:
dankan1890 2016-03-18 22:00:47 +01:00
parent 95aa75c8c6
commit 25bc1007af
52 changed files with 209 additions and 192 deletions

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/auditmenu.cpp

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/auditmenu.h

View File

@ -2,7 +2,7 @@
// copyright-holders:Fabio Priuli
/***************************************************************************
ui/barcode.c
ui/barcode.cpp
"Barcode Reader" control

View File

@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/*********************************************************************
ui/cheatopt.c
ui/cheatopt.cpp
Internal menu for the cheat interface.

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/cmddata.h
@ -143,10 +143,8 @@ static rgb_t color_table[] =
BUTTON_COLOR_SILVER // 8 Player Lever
};
// for color glyph
#define COLOR_BUTTONS ARRAY_LENGTH(color_table)
// Follow Varialbe Defined Arraies for Game Command Tag
struct fix_command_t
{
unsigned char glyph_char;

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/cmdrender.h

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/ctrlmenu.cpp

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/ctrlmenu.h

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/custmenu.cpp

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/custmenu.h

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/custui.cpp

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/custui.h

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/datfile.cpp

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/datfile.h

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/datmenu.cpp
@ -36,6 +36,8 @@ ui_menu_dats_view::ui_menu_dats_view(running_machine &machine, render_container
}
}
m_driver = (driver == nullptr) ? &machine.system() : driver;
m_actual = 0;
m_issoft = false;
init_items();
}
@ -52,8 +54,8 @@ ui_menu_dats_view::ui_menu_dats_view(running_machine &machine, render_container
m_parent = swinfo->parentname;
m_driver = (driver == nullptr) ? &machine.system() : driver;
m_swinfo = swinfo;
issoft = true;
m_actual = 0;
m_issoft = true;
if (machine.datfile().has_software(m_list, m_short, m_parent))
m_items_list.emplace_back(_("Software History"), UI_HISTORY_LOAD, machine.datfile().rev_history());
@ -78,15 +80,15 @@ void ui_menu_dats_view::handle()
const ui_menu_event *m_event = process(MENU_FLAG_UI_DATS);
if (m_event != nullptr)
{
if (m_event->iptkey == IPT_UI_LEFT && actual > 0)
if (m_event->iptkey == IPT_UI_LEFT && m_actual > 0)
{
actual--;
m_actual--;
reset(UI_MENU_RESET_SELECT_FIRST);
}
if (m_event->iptkey == IPT_UI_RIGHT && actual < m_items_list.size() - 1)
if (m_event->iptkey == IPT_UI_RIGHT && m_actual < m_items_list.size() - 1)
{
actual++;
m_actual++;
reset(UI_MENU_RESET_SELECT_FIRST);
}
}
@ -99,7 +101,7 @@ void ui_menu_dats_view::handle()
void ui_menu_dats_view::populate()
{
machine().pause();
(issoft == true) ? get_data_sw() : get_data();
(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);
customtop = 2.0f * machine().ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER;
@ -116,7 +118,7 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom
ui_manager &mui = machine().ui();
float maxwidth = origx2 - origx1;
float width;
std::string driver = (issoft == true) ? m_swinfo->longname : m_driver->description;
std::string driver = (m_issoft == true) ? m_swinfo->longname : m_driver->description;
mui.draw_text_full(container, driver.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
@ -168,8 +170,8 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom
for (auto & elem : m_items_list)
{
x1 += space;
rgb_t fcolor = (actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR;
rgb_t bcolor = (actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR;
rgb_t fcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR;
rgb_t bcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR;
mui.draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, JUSTIFY_LEFT, WRAP_NEVER,
DRAW_NONE, fcolor, bcolor, &width, nullptr);
if (bcolor != UI_TEXT_BG_COLOR)
@ -184,7 +186,7 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom
// bottom
std::string revision;
revision.assign(_("Revision: ")).append(m_items_list[actual].revision);
revision.assign(_("Revision: ")).append(m_items_list[m_actual].revision);
mui.draw_text_full(container, revision.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
@ -219,7 +221,7 @@ void ui_menu_dats_view::get_data()
std::vector<int> xend;
std::string buffer;
std::vector<std::string> m_item;
if (m_items_list[actual].option == UI_COMMAND_LOAD)
if (m_items_list[m_actual].option == UI_COMMAND_LOAD)
{
machine().datfile().command_sub_menu(m_driver, m_item);
if (!m_item.empty())
@ -236,7 +238,7 @@ void ui_menu_dats_view::get_data()
}
}
else
machine().datfile().load_data_info(m_driver, buffer, m_items_list[actual].option);
machine().datfile().load_data_info(m_driver, buffer, m_items_list[m_actual].option);
int totallines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend);
for (int x = 0; x < totallines; ++x)
@ -252,7 +254,7 @@ void ui_menu_dats_view::get_data_sw()
std::vector<int> xend;
std::string buffer;
std::vector<std::string> m_item;
if (m_items_list[actual].option == 0)
if (m_items_list[m_actual].option == 0)
buffer = m_swinfo->usage;
else
{

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/datmenu.h
@ -31,14 +31,14 @@ public:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
int actual;
int m_actual;
const game_driver *m_driver;
ui_software_info *m_swinfo;
std::string m_list, m_short, m_long, m_parent;
void get_data();
void get_data_sw();
void init_items();
bool issoft;
bool m_issoft;
struct list_items
{
list_items(std::string l, int i, std::string rev) { label = l; option = i; revision = rev; }

View File

@ -1,5 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
static const UINT32 no_avail_bmp[] =
{
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x01231f20, 0x04231f20, 0x11231f20, 0x2e231f20, 0x62231f20, 0x8e231f20, 0xb4231f20, 0xd4231f20, 0xe5231f20, 0xf2231f20, 0xfd231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfd231f20, 0xf2231f20, 0xe5231f20, 0xd4231f20, 0xb4231f20, 0x8e231f20, 0x62231f20, 0x2e231f20, 0x11231f20, 0x04231f20, 0x01231f20, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,

View File

@ -2,7 +2,7 @@
// copyright-holders:Nathan Woods
/*********************************************************************
ui/devopt.c
ui/devopt.cpp
Internal menu for the device configuration.

View File

@ -55,6 +55,7 @@ static const folders_entry s_folders[] =
{ __("Logos"), OPTION_LOGOS_PATH, ADDING },
{ __("Scores"), OPTION_SCORES_PATH, ADDING },
{ __("Versus"), OPTION_VERSUS_PATH, ADDING },
{ __("Covers"), OPTION_COVER_PATH, ADDING }
};

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/dirmenu.h

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/dsplmenu.cpp

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/dsplmenu.h

View File

@ -2,7 +2,7 @@
// copyright-holders:Nathan Woods
/*********************************************************************
ui/filemngr.c
ui/filemngr.cpp
MESS's clunky built-in file manager

View File

@ -2,7 +2,7 @@
// copyright-holders:Nathan Woods
/***************************************************************************
ui/filesel.c
ui/filesel.cpp
MESS's clunky built-in file manager

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890;Victor Laskin
// copyright-holders:Maurizio Petrarota, Victor Laskin
/***************************************************************************
ui/icorender.h

View File

@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/***************************************************************************
ui/info.c
ui/info.cpp
System and image info screens

View File

@ -2,7 +2,7 @@
// copyright-holders:F.Ulivi
/***************************************************************************
ui/info_pty.c
ui/info_pty.cpp
Information screen on pseudo terminals

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/inifile.cpp
@ -18,8 +18,8 @@
//-------------------------------------------------
// GLOBAL VARIABLES
//-------------------------------------------------
UINT16 inifile_manager::current_category = 0;
UINT16 inifile_manager::current_file = 0;
UINT16 inifile_manager::c_cat = 0;
UINT16 inifile_manager::c_file = 0;
//-------------------------------------------------
// ctor
@ -48,10 +48,6 @@ void inifile_manager::directory_scan()
int length = strlen(dir->name);
std::string filename(dir->name);
// skip ui_favorite file
if (!core_stricmp("ui_favorite.ini", filename.c_str()))
continue;
// check .ini file ending
if ((length > 4) && dir->name[length - 4] == '.' && tolower((UINT8)dir->name[length - 3]) == 'i' &&
tolower((UINT8)dir->name[length - 2]) == 'n' && tolower((UINT8)dir->name[length - 1]) == 'i')
@ -103,8 +99,8 @@ void inifile_manager::load_ini_category(std::vector<int> &temp_filter)
return;
bool search_clones = false;
std::string filename(ini_index[current_file].name);
long offset = ini_index[current_file].category[current_category].offset;
std::string filename(ini_index[c_file].first);
long offset = ini_index[c_file].second[c_cat].second;
if (!core_stricmp(filename.c_str(), "category.ini") || !core_stricmp(filename.c_str(), "alltime.ini"))
search_clones = true;

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/inifile.h
@ -22,41 +22,36 @@
class inifile_manager
{
public:
// category structure
struct IniCategoryIndex
{
IniCategoryIndex(std::string _name, long _offset) { name = _name; offset = _offset; }
std::string name;
long offset;
};
using categoryindex = std::vector<IniCategoryIndex>;
// ini file structure
struct IniFileIndex
{
IniFileIndex(std::string _name, categoryindex _category) { name = _name; category = _category; }
std::string name;
categoryindex category;
};
// construction/destruction
inifile_manager(running_machine &machine);
// getters
running_machine &machine() const { return m_machine; }
std::string get_file(int file = -1) { return ((file == -1) ? ini_index[c_file].first : ini_index[file].first); }
std::string get_category(int cat = -1) { return ((cat == -1) ? ini_index[c_file].second[c_cat].first : ini_index[c_file].second[cat].first); }
size_t total() { return ini_index.size(); }
size_t cat_total() { return ini_index[c_file].second.size(); }
UINT16 &cur_file() { return c_file; }
UINT16 &cur_cat() { return c_cat; }
// load games from category
void load_ini_category(std::vector<int> &temp_filter);
// files indices
std::vector<IniFileIndex> ini_index;
static UINT16 current_file, current_category;
std::string actual_file() { return ini_index[current_file].name; }
std::string actual_category() { return ini_index[current_file].category[current_category].name; }
// setters
void move_file(int d) { c_file += d; c_cat = 0; }
void move_cat(int d) { c_cat += d; }
void set_cat(int i = -1) { (i == -1) ? c_cat = 0 : c_cat = i; }
void set_file(int i = -1) { (i == -1) ? c_file = 0 : c_file = i; }
private:
// ini file structure
using categoryindex = std::vector<std::pair<std::string, long>>;
// files indices
static UINT16 c_file, c_cat;
std::vector<std::pair<std::string, categoryindex>> ini_index;
// init category index
void init_category(std::string &filename);

View File

@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/*********************************************************************
ui/inputmap.c
ui/inputmap.cpp
Internal menus for input mappings.

View File

@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/*********************************************************************
ui/mainmenu.c
ui/mainmenu.cpp
Internal MAME menus for the user interface.

View File

@ -35,27 +35,28 @@
struct ui_arts_info
{
const char *title, *path, *addpath;
const char *title, *path;
};
static const ui_arts_info arts_info[] =
{
{ __("Snapshots"), OPTION_SNAPSHOT_DIRECTORY, "snap" },
{ __("Cabinets"), OPTION_CABINETS_PATH, "cabinets;cabdevs" },
{ __("Control Panels"), OPTION_CPANELS_PATH, "cpanel" },
{ __("PCBs"), OPTION_PCBS_PATH, "pcb" },
{ __("Flyers"), OPTION_FLYERS_PATH, "flyers" },
{ __("Titles"), OPTION_TITLES_PATH, "titles" },
{ __("Ends"), OPTION_ENDS_PATH, "ends" },
{ __("Artwork Preview"), OPTION_ARTPREV_PATH, "artwork preview" },
{ __("Bosses"), OPTION_BOSSES_PATH, "bosses" },
{ __("Logos"), OPTION_LOGOS_PATH, "logo" },
{ __("Versus"), OPTION_VERSUS_PATH, "versus" },
{ __("Game Over"), OPTION_GAMEOVER_PATH, "gameover" },
{ __("HowTo"), OPTION_HOWTO_PATH, "howto" },
{ __("Scores"), OPTION_SCORES_PATH, "scores" },
{ __("Select"), OPTION_SELECT_PATH, "select" },
{ __("Marquees"), OPTION_MARQUEES_PATH, "marquees" },
{ __("Snapshots"), OPTION_SNAPSHOT_DIRECTORY },
{ __("Cabinets"), OPTION_CABINETS_PATH },
{ __("Control Panels"), OPTION_CPANELS_PATH },
{ __("PCBs"), OPTION_PCBS_PATH },
{ __("Flyers"), OPTION_FLYERS_PATH },
{ __("Titles"), OPTION_TITLES_PATH },
{ __("Ends"), OPTION_ENDS_PATH },
{ __("Artwork Preview"), OPTION_ARTPREV_PATH },
{ __("Bosses"), OPTION_BOSSES_PATH },
{ __("Logos"), OPTION_LOGOS_PATH },
{ __("Versus"), OPTION_VERSUS_PATH },
{ __("Game Over"), OPTION_GAMEOVER_PATH },
{ __("HowTo"), OPTION_HOWTO_PATH },
{ __("Scores"), OPTION_SCORES_PATH },
{ __("Select"), OPTION_SELECT_PATH },
{ __("Marquees"), OPTION_MARQUEES_PATH },
{ __("Covers"), OPTION_COVER_PATH },
{ nullptr }
};
@ -1653,9 +1654,35 @@ void ui_menu::get_title_search(std::string &snaptext, std::string &searchstr)
std::string tmp(searchstr);
path_iterator path(tmp.c_str());
std::string curpath;
std::string curpath, addpath;
path_iterator path_iter(arts_info[ui_globals::curimage_view].addpath);
if (ui_globals::curimage_view != SNAPSHOT_VIEW)
{
ui_options moptions;
for (ui_options::entry *f_entry = moptions.first(); f_entry != nullptr; f_entry = f_entry->next())
{
const char *name = f_entry->name();
if (name && strlen(name) && !strcmp(arts_info[ui_globals::curimage_view].path, f_entry->name()))
{
addpath = f_entry->default_value();
break;
}
}
}
else
{
emu_options moptions;
for (emu_options::entry *f_entry = moptions.first(); f_entry != nullptr; f_entry = f_entry->next())
{
const char *name = f_entry->name();
if (name && strlen(name) && !strcmp(arts_info[ui_globals::curimage_view].path, f_entry->name()))
{
addpath = f_entry->default_value();
break;
}
}
}
path_iterator path_iter(addpath.c_str());
std::string c_path;
// iterate over path and add path for zipped formats

View File

@ -1,8 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods,Dankan1890
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods, Maurizio Petrarota
/*********************************************************************
miscmenu.c
ui/miscmenu.cpp
Internal MAME menus for the user interface.

View File

@ -2,7 +2,7 @@
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/moptions.c
ui/moptions.cpp
UI main options manager.
@ -19,26 +19,27 @@
const options_entry ui_options::s_option_entries[] =
{
// seach path options
{ nullptr, nullptr, OPTION_HEADER, "UI SEARCH PATH OPTIONS" },
{ OPTION_HISTORY_PATH, "history;dats;.", OPTION_STRING, "path to history files" },
{ OPTION_EXTRAINI_PATH, "folders", OPTION_STRING, "path to extra ini files" },
{ OPTION_CABINETS_PATH, "cabinets;cabdevs", OPTION_STRING, "path to cabinets / devices image" },
{ OPTION_CPANELS_PATH, "cpanel", OPTION_STRING, "path to control panel image" },
{ OPTION_PCBS_PATH, "pcb", OPTION_STRING, "path to pcbs image" },
{ OPTION_FLYERS_PATH, "flyers", OPTION_STRING, "path to flyers image" },
{ OPTION_TITLES_PATH, "titles", OPTION_STRING, "path to titles image" },
{ OPTION_ENDS_PATH, "ends", OPTION_STRING, "path to ends image" },
{ OPTION_MARQUEES_PATH, "marquees", OPTION_STRING, "path to marquees image" },
{ OPTION_ARTPREV_PATH, "artwork preview", OPTION_STRING, "path to artwork preview image" },
{ OPTION_BOSSES_PATH, "bosses", OPTION_STRING, "path to bosses image" },
{ OPTION_LOGOS_PATH, "logo", OPTION_STRING, "path to logos image" },
{ OPTION_SCORES_PATH, "scores", OPTION_STRING, "path to scores image" },
{ OPTION_VERSUS_PATH, "versus", OPTION_STRING, "path to versus image" },
{ OPTION_GAMEOVER_PATH, "gameover", OPTION_STRING, "path to gameover image" },
{ OPTION_HOWTO_PATH, "howto", OPTION_STRING, "path to howto image" },
{ OPTION_SELECT_PATH, "select", OPTION_STRING, "path to select image" },
{ OPTION_ICONS_PATH, "icons", OPTION_STRING, "path to ICOns image" },
{ OPTION_UI_PATH, "ui", OPTION_STRING, "path to UI files" },
{ nullptr, nullptr, OPTION_HEADER, "UI SEARCH PATH OPTIONS" },
{ OPTION_HISTORY_PATH, "history;dats;.", OPTION_STRING, "path to history files" },
{ OPTION_EXTRAINI_PATH, "folders", OPTION_STRING, "path to extra ini files" },
{ OPTION_CABINETS_PATH, "cabinets;cabdevs", OPTION_STRING, "path to cabinets / devices image" },
{ OPTION_CPANELS_PATH, "cpanel", OPTION_STRING, "path to control panel image" },
{ OPTION_PCBS_PATH, "pcb", OPTION_STRING, "path to pcbs image" },
{ OPTION_FLYERS_PATH, "flyers", OPTION_STRING, "path to flyers image" },
{ OPTION_TITLES_PATH, "titles", OPTION_STRING, "path to titles image" },
{ OPTION_ENDS_PATH, "ends", OPTION_STRING, "path to ends image" },
{ OPTION_MARQUEES_PATH, "marquees", OPTION_STRING, "path to marquees image" },
{ OPTION_ARTPREV_PATH, "artwork preview;artpreview", OPTION_STRING, "path to artwork preview image" },
{ OPTION_BOSSES_PATH, "bosses", OPTION_STRING, "path to bosses image" },
{ OPTION_LOGOS_PATH, "logo", OPTION_STRING, "path to logos image" },
{ OPTION_SCORES_PATH, "scores", OPTION_STRING, "path to scores image" },
{ OPTION_VERSUS_PATH, "versus", OPTION_STRING, "path to versus image" },
{ OPTION_GAMEOVER_PATH, "gameover", OPTION_STRING, "path to gameover image" },
{ OPTION_HOWTO_PATH, "howto", OPTION_STRING, "path to howto image" },
{ OPTION_SELECT_PATH, "select", OPTION_STRING, "path to select image" },
{ OPTION_ICONS_PATH, "icons", OPTION_STRING, "path to ICOns image" },
{ OPTION_COVER_PATH, "covers", OPTION_STRING, "path to software cover image" },
{ OPTION_UI_PATH, "ui", OPTION_STRING, "path to UI files" },
// misc options
{ nullptr, nullptr, OPTION_HEADER, "UI MISC OPTIONS" },

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/moptions.h
@ -34,6 +34,7 @@
#define OPTION_HOWTO_PATH "howto_directory"
#define OPTION_SELECT_PATH "select_directory"
#define OPTION_ICONS_PATH "icons_directory"
#define OPTION_COVER_PATH "covers_directory"
#define OPTION_UI_PATH "ui_path"
// core misc options
@ -95,6 +96,7 @@ public:
const char *howto_directory() const { return value(OPTION_HOWTO_PATH); }
const char *select_directory() const { return value(OPTION_SELECT_PATH); }
const char *icons_directory() const { return value(OPTION_ICONS_PATH); }
const char *covers_directory() const { return value(OPTION_COVER_PATH); }
const char *ui_path() const { return value(OPTION_UI_PATH); }
// Misc options

View File

@ -91,26 +91,24 @@ void ui_menu_game_options::handle()
{
if (m_event->iptkey == IPT_UI_LEFT)
{
machine().inifile().current_file--;
machine().inifile().current_category = 0;
machine().inifile().move_file(-1);
changed = true;
}
else if (m_event->iptkey == IPT_UI_RIGHT)
{
machine().inifile().current_file++;
machine().inifile().current_category = 0;
machine().inifile().move_file(1);
changed = true;
}
else if (m_event->iptkey == IPT_UI_SELECT)
{
inifile_manager &ifile = machine().inifile();
int total = ifile.ini_index.size();
int total = ifile.total();
std::vector<std::string> s_sel(total);
machine().inifile().current_category = 0;
machine().inifile().set_cat(0);
for (size_t index = 0; index < total; ++index)
s_sel[index] = ifile.ini_index[index].name;
s_sel[index] = ifile.get_file(index);
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, ifile.current_file, SELECTOR_INIFILE));
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, ifile.cur_file(), SELECTOR_INIFILE));
}
break;
}
@ -118,24 +116,23 @@ void ui_menu_game_options::handle()
{
if (m_event->iptkey == IPT_UI_LEFT)
{
machine().inifile().current_category--;
machine().inifile().move_cat(-1);
changed = true;
}
else if (m_event->iptkey == IPT_UI_RIGHT)
{
machine().inifile().current_category++;
machine().inifile().move_cat(1);
changed = true;
}
else if (m_event->iptkey == IPT_UI_SELECT)
{
inifile_manager &ifile = machine().inifile();
int cfile = ifile.current_file;
int total = ifile.ini_index[cfile].category.size();
int total = ifile.cat_total();
std::vector<std::string> s_sel(total);
for (int index = 0; index < total; ++index)
s_sel[index] = ifile.ini_index[cfile].category[index].name;
s_sel[index] = ifile.get_category(index);
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, ifile.current_category, SELECTOR_CATEGORY));
ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, ifile.cur_cat(), SELECTOR_CATEGORY));
}
break;
}
@ -217,20 +214,19 @@ void ui_menu_game_options::populate()
item_append(_("Filter"), main_filters::text[m_main], arrow_flags, (void *)(FPTR)FILTER_MENU);
// add category subitem
if (m_main == FILTER_CATEGORY && !machine().inifile().ini_index.empty())
if (m_main == FILTER_CATEGORY && machine().inifile().total() > 0)
{
inifile_manager &inif = machine().inifile();
int afile = inif.current_file;
arrow_flags = get_arrow_flags(0, inif.ini_index.size() - 1, afile);
arrow_flags = get_arrow_flags(0, inif.total() - 1, inif.cur_file());
fbuff = _(" ^!File");
convert_command_glyph(fbuff);
item_append(fbuff.c_str(), inif.actual_file().c_str(), arrow_flags, (void *)(FPTR)FILE_CATEGORY_FILTER);
item_append(fbuff.c_str(), inif.get_file().c_str(), arrow_flags, (void *)(FPTR)FILE_CATEGORY_FILTER);
arrow_flags = get_arrow_flags(0, inif.ini_index[afile].category.size() - 1, inif.current_category);
arrow_flags = get_arrow_flags(0, inif.cat_total() - 1, inif.cur_cat());
fbuff = _(" ^!Category");
convert_command_glyph(fbuff);
item_append(fbuff.c_str(), inif.actual_category().c_str(), arrow_flags, (void *)(FPTR)CATEGORY_FILTER);
item_append(fbuff.c_str(), inif.get_category().c_str(), arrow_flags, (void *)(FPTR)CATEGORY_FILTER);
}
// add manufacturer subitem
else if (m_main == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0)

View File

@ -1,8 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/m_selector.cpp
ui/selector.cpp
Internal UI user interface.
@ -66,13 +66,13 @@ void ui_menu_selector::handle()
switch (m_category)
{
case SELECTOR_INIFILE:
machine().inifile().current_file = m_selector;
machine().inifile().current_category = 0;
machine().inifile().set_file(m_selector);
machine().inifile().set_cat(0);
ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF);
break;
case SELECTOR_CATEGORY:
machine().inifile().current_category = m_selector;
machine().inifile().set_cat(m_selector);
ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF);
break;

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/selector.h

View File

@ -194,6 +194,7 @@ ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_contai
ui_globals::switch_image = false;
ui_globals::default_image = true;
ui_globals::panels_status = moptions.hide_panels();
m_searchlist[0] = nullptr;
}
//-------------------------------------------------
@ -810,12 +811,12 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott
m_isabios);
std::string filtered;
if (main_filters::actual == FILTER_CATEGORY && !machine().inifile().ini_index.empty())
if (main_filters::actual == FILTER_CATEGORY && machine().inifile().total() > 0)
{
filtered = string_format(_("%1$s (%2$s - %3$s) - "),
main_filters::text[main_filters::actual],
machine().inifile().actual_file(),
machine().inifile().actual_category());
machine().inifile().get_file(),
machine().inifile().get_category());
}
else if (main_filters::actual == FILTER_MANUFACTURER)
{
@ -1097,7 +1098,7 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event)
}
}
std::vector<s_bios> biosname;
s_bios biosname;
if (!machine().ui().options().skip_bios_menu() && has_multiple_bios(driver, biosname))
ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(machine(), container, biosname, (void *)driver, false, false));
else
@ -1154,7 +1155,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
// if everything looks good, schedule the new driver
if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
{
std::vector<s_bios> biosname;
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>(machine(), container, biosname, (void *)ui_swinfo->driver, false, false));
else
@ -1187,7 +1188,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
media_auditor::summary summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST);
if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
{
std::vector<s_bios> biosname;
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>(machine(), container, biosname, (void *)ui_swinfo, true, false));
@ -1195,7 +1196,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event)
}
else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str()))
{
std::unordered_map<std::string, std::string> parts;
s_parts parts;
for (const software_part *swpart = swinfo->first_part(); swpart != nullptr; swpart = swpart->next())
{
if (swpart->matches_interface(ui_swinfo->interface.c_str()))

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/selgame.h

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/selsoft.cpp
@ -86,7 +86,7 @@ bool compare_software(ui_software_info a, ui_software_info b)
// get bios count
//-------------------------------------------------
bool has_multiple_bios(const game_driver *driver, std::vector<s_bios> &biosname)
bool has_multiple_bios(const game_driver *driver, s_bios &biosname)
{
if (driver->rom == nullptr)
return 0;
@ -901,7 +901,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event)
if (ui_swinfo->startempty == 1)
{
std::vector<s_bios> biosname;
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>(machine(), container, biosname, (void *)ui_swinfo->driver, false, true));
else
@ -929,7 +929,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event)
if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
{
std::vector<s_bios> biosname;
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>(machine(), container, biosname, (void *)ui_swinfo, true, false));
@ -937,7 +937,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event)
}
else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str()))
{
std::unordered_map<std::string, std::string> parts;
s_parts parts;
for (const software_part *swpart = swinfo->first_part(); swpart != nullptr; swpart = swpart->next())
{
if (swpart->matches_interface(ui_swinfo->interface.c_str()))
@ -1926,7 +1926,7 @@ void ui_menu_select_software::draw_right_panel(void *selectedref, float origx1,
// ctor
//-------------------------------------------------
ui_software_parts::ui_software_parts(running_machine &machine, render_container *container, std::unordered_map<std::string, std::string> parts, ui_software_info *ui_info) : ui_menu(machine, container)
ui_software_parts::ui_software_parts(running_machine &machine, render_container *container, s_parts parts, ui_software_info *ui_info) : ui_menu(machine, container)
{
m_parts = parts;
m_uiinfo = ui_info;
@ -2019,7 +2019,7 @@ void ui_software_parts::custom_render(void *selectedref, float top, float bottom
// ctor
//-------------------------------------------------
ui_bios_selection::ui_bios_selection(running_machine &machine, render_container *container, std::vector<s_bios> biosname, void *_driver, bool _software, bool _inlist) : ui_menu(machine, container)
ui_bios_selection::ui_bios_selection(running_machine &machine, render_container *container, s_bios biosname, void *_driver, bool _software, bool _inlist) : ui_menu(machine, container)
{
m_bios = biosname;
m_driver = _driver;
@ -2042,7 +2042,7 @@ ui_bios_selection::~ui_bios_selection()
void ui_bios_selection::populate()
{
for (auto & elem : m_bios)
item_append(elem.name.c_str(), nullptr, 0, (void *)&elem.name);
item_append(elem.first.c_str(), nullptr, 0, (void *)&elem.first);
item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
@ -2059,7 +2059,7 @@ void ui_bios_selection::handle()
emu_options &moptions = machine().options();
if (event != nullptr && event->iptkey == IPT_UI_SELECT && event->itemref != nullptr)
for (auto & elem : m_bios)
if ((void*)&elem.name == event->itemref)
if ((void*)&elem.first == event->itemref)
{
if (!m_software)
{
@ -2075,7 +2075,7 @@ void ui_bios_selection::handle()
}
std::string error;
moptions.set_value("bios", elem.id, OPTION_PRIORITY_CMDLINE, error);
moptions.set_value("bios", elem.second, OPTION_PRIORITY_CMDLINE, error);
machine().manager().schedule_new_driver(*s_driver);
machine().schedule_hard_reset();
ui_menu::stack_reset(machine());
@ -2084,14 +2084,14 @@ void ui_bios_selection::handle()
{
ui_software_info *ui_swinfo = (ui_software_info *)m_driver;
std::string error;
machine().options().set_value("bios", elem.id, OPTION_PRIORITY_CMDLINE, error);
machine().options().set_value("bios", elem.second, OPTION_PRIORITY_CMDLINE, error);
driver_enumerator drivlist(machine().options(), *ui_swinfo->driver);
drivlist.next();
software_list_device *swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str());
software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str());
if (!machine().ui().options().skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str()))
{
std::unordered_map<std::string, std::string> parts;
s_parts parts;
for (const software_part *swpart = swinfo->first_part(); swpart != nullptr; swpart = swpart->next())
{
if (swpart->matches_interface(ui_swinfo->interface.c_str()))

View File

@ -14,12 +14,8 @@
#include "ui/custmenu.h"
struct s_bios
{
s_bios(std::string _name, int _id) { name = _name; id = _id; }
std::string name;
int id;
};
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
@ -69,7 +65,7 @@ private:
class ui_software_parts : public ui_menu
{
public:
ui_software_parts(running_machine &machine, render_container *container, std::unordered_map<std::string, std::string> parts, ui_software_info *ui_info);
ui_software_parts(running_machine &machine, render_container *container, s_parts parts, ui_software_info *ui_info);
virtual ~ui_software_parts();
virtual void populate() override;
virtual void handle() override;
@ -77,13 +73,13 @@ public:
private:
ui_software_info *m_uiinfo;
std::unordered_map<std::string, std::string> m_parts;
s_parts m_parts;
};
class ui_bios_selection : public ui_menu
{
public:
ui_bios_selection(running_machine &machine, render_container *container, std::vector<s_bios> biosname, void *driver, bool software, bool inlist);
ui_bios_selection(running_machine &machine, render_container *container, s_bios biosname, void *driver, bool software, bool inlist);
virtual ~ui_bios_selection();
virtual void populate() override;
virtual void handle() override;
@ -91,9 +87,9 @@ public:
private:
void *m_driver;
bool m_software, m_inlist;
std::vector<s_bios> m_bios;
void *m_driver;
bool m_software, m_inlist;
s_bios m_bios;
};
struct reselect_last
@ -108,7 +104,7 @@ private:
};
// Getter
bool has_multiple_bios(const game_driver *driver, std::vector<s_bios> &biosname);
bool has_multiple_bios(const game_driver *driver, s_bios &biosname);
#endif /* __UI_SELSOFT_H__ */

View File

@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/*********************************************************************
miscmenu.c
ui/sliders.cpp
Internal MAME menus for the user interface.

View File

@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/*********************************************************************
ui/slotopt.c
ui/slotopt.cpp
Internal menu for the slot options.

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/sndmenu.cpp

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/sndmenu.h

View File

@ -1,5 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
static const UINT32 favorite_star_bmp[] =
{
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,

View File

@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/*********************************************************************
ui/swlist.c
ui/swlist.cpp
Internal MAME user interface for software list.

View File

@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/***************************************************************************
ui/tapectrl.c
ui/tapectrl.cpp
Tape control

View File

@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/*********************************************************************
ui.c
ui.cpp
Functions used to handle MAME's user interface.

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/utils.h

View File

@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/*********************************************************************
ui/videoopt.c
ui/videoopt.cpp
Internal menus for video options