Skip to content

Commit

Permalink
Added support and configuration for the image collection "covers".
Browse files Browse the repository at this point in the history
Slightly modernized and simplified the code.
  • Loading branch information
dankan1890 committed Mar 18, 2016
1 parent 95aa75c commit 25bc100
Show file tree
Hide file tree
Showing 52 changed files with 209 additions and 192 deletions.
2 changes: 1 addition & 1 deletion src/emu/ui/auditmenu.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/auditmenu.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/auditmenu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/auditmenu.h
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/barcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// copyright-holders:Fabio Priuli
/***************************************************************************
ui/barcode.c
ui/barcode.cpp
"Barcode Reader" control
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/cheatopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/*********************************************************************
ui/cheatopt.c
ui/cheatopt.cpp
Internal menu for the cheat interface.
Expand Down
4 changes: 1 addition & 3 deletions src/emu/ui/cmddata.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/cmddata.h
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/cmdrender.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/cmdrender.h
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/ctrlmenu.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/ctrlmenu.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/ctrlmenu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/ctrlmenu.h
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/custmenu.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/custmenu.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/custmenu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/custmenu.h
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/custui.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/custui.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/custui.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/custui.h
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/datfile.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/datfile.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/datfile.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/datfile.h
Expand Down
32 changes: 17 additions & 15 deletions src/emu/ui/datmenu.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/datmenu.cpp
Expand Down Expand Up @@ -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();
}
Expand All @@ -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());
Expand All @@ -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);
}
}
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -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())
Expand All @@ -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)
Expand All @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions src/emu/ui/datmenu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/datmenu.h
Expand Down Expand Up @@ -31,14 +31,14 @@ class ui_menu_dats_view : public ui_menu
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; }
Expand Down
3 changes: 2 additions & 1 deletion src/emu/ui/defimg.h
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/devopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// copyright-holders:Nathan Woods
/*********************************************************************
ui/devopt.c
ui/devopt.cpp
Internal menu for the device configuration.
Expand Down
1 change: 1 addition & 0 deletions src/emu/ui/dirmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
};


Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/dirmenu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/dirmenu.h
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/dsplmenu.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/*********************************************************************
ui/dsplmenu.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/dsplmenu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/dsplmenu.h
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/filemngr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// copyright-holders:Nathan Woods
/*********************************************************************
ui/filemngr.c
ui/filemngr.cpp
MESS's clunky built-in file manager
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/filesel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// copyright-holders:Nathan Woods
/***************************************************************************
ui/filesel.c
ui/filesel.cpp
MESS's clunky built-in file manager
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/icorender.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890;Victor Laskin
// copyright-holders:Maurizio Petrarota, Victor Laskin
/***************************************************************************
ui/icorender.h
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/***************************************************************************
ui/info.c
ui/info.cpp
System and image info screens
Expand Down
2 changes: 1 addition & 1 deletion src/emu/ui/info_pty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// copyright-holders:F.Ulivi
/***************************************************************************
ui/info_pty.c
ui/info_pty.cpp
Information screen on pseudo terminals
Expand Down
14 changes: 5 additions & 9 deletions src/emu/ui/inifile.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Dankan1890
// copyright-holders:Maurizio Petrarota
/***************************************************************************
ui/inifile.cpp
Expand All @@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 25bc100

Please sign in to comment.