summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/ui/menu.cpp
diff options
context:
space:
mode:
author dankan1890 <mewuidev2@gmail.com>2016-02-17 11:32:06 +0100
committer dankan1890 <mewuidev2@gmail.com>2016-02-17 11:32:06 +0100
commit32630f09aacaec2d9c3eaf384dd80f886f50c3ac (patch)
tree2d5b9e3e352b9ebee27c58f1db5f4531972b17ea /src/emu/ui/menu.cpp
parent97f515d8c4f49013a17856893f9c1802867b5711 (diff)
menu: allocate and draw icons only if available. nw
Diffstat (limited to 'src/emu/ui/menu.cpp')
-rw-r--r--src/emu/ui/menu.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp
index fbe7d46e541..8017748321f 100644
--- a/src/emu/ui/menu.cpp
+++ b/src/emu/ui/menu.cpp
@@ -1309,11 +1309,27 @@ void ui_menu::init_ui(running_machine &machine)
star_texture = mrender.texture_alloc();
star_texture->set_bitmap(*star_bitmap, star_bitmap->cliprect(), TEXFORMAT_ARGB32);
- // allocates icons bitmap and texture
- for (int i = 0; i < MAX_ICONS_RENDER; i++)
+ // check and allocate icons
+ file_enumerator path(machine.ui().options().icons_directory());
+ const osd_directory_entry *dir;
+ while ((dir = path.next()) != nullptr)
{
- icons_bitmap[i] = auto_alloc(machine, bitmap_argb32);
- icons_texture[i] = mrender.texture_alloc();
+ char drivername[50];
+ char *dst = drivername;
+ const char *src;
+
+ // build a name for it
+ src = dir->name;
+ if (*src != 0 && *src != '.')
+ {
+ ui_globals::has_icons = true;
+ for (int i = 0; i < MAX_ICONS_RENDER; i++)
+ {
+ icons_bitmap[i] = auto_alloc(machine, bitmap_argb32);
+ icons_texture[i] = mrender.texture_alloc();
+ }
+ break;
+ }
}
// create a texture for main menu background