This commit is contained in:
Robbbert 2016-06-19 12:56:38 +10:00
commit b54accd6b3
6 changed files with 43 additions and 39 deletions

View File

@ -603,10 +603,8 @@ void ay8910_device::ay8910_write_reg(int r, int v)
/* No action required */
break;
case AY_ECOARSE:
#ifdef MAME_DEBUG
if ( (v & 0x0f) > 0)
popmessage("ECoarse");
#endif
osd_printf_verbose("ECoarse\n");
/* No action required */
break;
case AY_ENABLE:
@ -628,10 +626,8 @@ void ay8910_device::ay8910_write_reg(int r, int v)
m_last_enable = m_regs[AY_ENABLE];
break;
case AY_ESHAPE:
#ifdef MAME_DEBUG
if ( (v & 0x0f) > 0)
popmessage("EShape");
#endif
osd_printf_verbose("EShape\n");
m_attack = (m_regs[AY_ESHAPE] & 0x04) ? m_env_step_mask : 0x00;
if ((m_regs[AY_ESHAPE] & 0x08) == 0)
{

View File

@ -772,6 +772,11 @@ render_container::item &render_container::add_generic(UINT8 type, float x0, floa
{
item *newitem = m_item_allocator.alloc();
assert(x0 == x0);
assert(x1 == x1);
assert(y0 == y0);
assert(y1 == y1);
// copy the data into the new item
newitem->m_type = type;
newitem->m_bounds.x0 = x0;

View File

@ -88,6 +88,7 @@ std::vector<std::unique_ptr<bitmap_argb32>> menu::icons_bitmap;
std::unique_ptr<bitmap_rgb32> menu::hilight_main_bitmap;
std::vector<std::shared_ptr<bitmap_argb32>> menu::toolbar_bitmap;
std::vector<std::shared_ptr<bitmap_argb32>> menu::sw_toolbar_bitmap;
std::vector<const game_driver *> menu::m_old_icons;
/***************************************************************************
INLINE FUNCTIONS
@ -187,6 +188,7 @@ void menu::exit(running_machine &machine)
}
icons_bitmap.clear();
m_old_icons.clear();
}
@ -1370,6 +1372,7 @@ void menu::init_ui(running_machine &machine, ui_options &mopt)
// allocate icons
for (auto & icons : icons_texture)
{
m_old_icons.emplace_back(nullptr);
icons_bitmap.emplace_back(std::make_unique<bitmap_argb32>());
icons = mrender.texture_alloc();
}
@ -1440,7 +1443,6 @@ void menu::draw_select_game(UINT32 flags)
float primary_left = (1.0f - visible_width) * 0.5f;
float primary_width = visible_width;
bool is_swlist = (item[0].flags & FLAG_UI_SWLIST);
bool is_favorites = (item[0].flags & FLAG_UI_FAVORITE);
// draw background image if available
if (ui().options().use_background_image() && bgrnd_bitmap->valid())
@ -1578,27 +1580,13 @@ void menu::draw_select_game(UINT32 flags)
else if (pitem.subtext == nullptr)
{
int item_invert = pitem.flags & FLAG_INVERT;
float space = 0.0f;
if (ui_globals::has_icons && !is_swlist)
{
if (is_favorites)
{
ui_software_info *soft = (ui_software_info *)item[itemnum].ref;
if (soft->startempty == 1)
draw_icon(linenum, (void *)soft->driver, effective_left, line_y);
}
else
draw_icon(linenum, item[itemnum].ref, effective_left, line_y);
space = ud_arrow_width * 1.5f;
}
ui().draw_text_full(container, pitem.text, effective_left + space, line_y, effective_width - space, ui::text_layout::LEFT, ui::text_layout::TRUNCATE,
auto icon = draw_icon(linenum, item[itemnum].ref, effective_left, line_y);
ui().draw_text_full(container, pitem.text, effective_left + icon, line_y, effective_width - icon, ui::text_layout::LEFT, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr);
}
else
{
int item_invert = pitem.flags & FLAG_INVERT;
auto item_invert = pitem.flags & FLAG_INVERT;
float item_width, subitem_width;
// compute right space for subitem
@ -2452,16 +2440,29 @@ void menu::draw_common_arrow(float origx1, float origy1, float origx2, float ori
// draw icons
//-------------------------------------------------
void menu::draw_icon(int linenum, void *selectedref, float x0, float y0)
float menu::draw_icon(int linenum, void *selectedref, float x0, float y0)
{
static const game_driver *olddriver[MAX_ICONS_RENDER] = { nullptr };
auto x1 = x0 + ui().get_line_height() * container->manager().ui_aspect(container);
auto y1 = y0 + ui().get_line_height();
auto driver = (const game_driver *)selectedref;
if (!ui_globals::has_icons || (item[0].flags & FLAG_UI_SWLIST))
return 0.0f;
if (olddriver[linenum] != driver || ui_globals::redraw_icon)
float ud_arrow_width = ui().get_line_height() * container->manager().ui_aspect(container);
const game_driver *driver = nullptr;
if (item[0].flags & FLAG_UI_FAVORITE)
{
olddriver[linenum] = driver;
ui_software_info *soft = (ui_software_info *)selectedref;
if (soft->startempty == 1)
driver = soft->driver;
}
else
driver = (const game_driver *)selectedref;
auto x1 = x0 + ud_arrow_width;
auto y1 = y0 + ui().get_line_height();
if (m_old_icons[linenum] != driver || ui_globals::redraw_icon)
{
m_old_icons[linenum] = driver;
// set clone status
bool cloneof = strcmp(driver->parent, "0");
@ -2532,7 +2533,6 @@ void menu::draw_icon(int linenum, void *selectedref, float x0, float y0)
else
dest_bitmap = tmp;
icons_bitmap[linenum]->reset();
icons_bitmap[linenum]->allocate(panel_width_pixel, panel_height_pixel);
for (int x = 0; x < dest_xPixel; x++)
@ -2551,6 +2551,8 @@ void menu::draw_icon(int linenum, void *selectedref, float x0, float y0)
if (icons_bitmap[linenum] != nullptr && icons_bitmap[linenum]->valid())
container->add_quad(x0, y0, x1, y1, rgb_t::white, icons_texture[linenum], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
return ud_arrow_width * 1.5f;
}
//-------------------------------------------------

View File

@ -347,7 +347,7 @@ private:
// handle mouse
void handle_main_events();
void draw_icon(int linenum, void *selectedref, float x1, float y1);
float draw_icon(int linenum, void *selectedref, float x1, float y1);
void extra_text_draw_box(float origx1, float origx2, float origy, float yspan, const char *text, int direction);
bool m_special_main_menu;
@ -358,6 +358,7 @@ private:
event m_event; // the UI event that occurred
pool *m_pool; // list of memory pools
focused_menu m_focus;
static std::vector<const game_driver *> m_old_icons;
static std::unique_ptr<menu> menu_stack;
static std::unique_ptr<menu> menu_free;

View File

@ -78,7 +78,7 @@ CORE IMPLEMENTATION
//-------------------------------------------------
text_layout::text_layout(render_font &font, float xscale, float yscale, float width, text_layout::text_justify justify, text_layout::word_wrapping wrap)
: m_font(font), m_xscale(xscale), m_yscale(yscale), m_width(width), m_justify(justify), m_wrap(wrap), m_current_line(nullptr), m_last_break(0), m_text_position(0), m_truncating(false)
: m_font(font), m_xscale(xscale), m_yscale(yscale), m_width(width), m_maximum_line_width(0.0f), m_justify(justify), m_wrap(wrap), m_current_line(nullptr), m_last_break(0), m_text_position(0), m_truncating(false)
{
}
@ -89,7 +89,7 @@ text_layout::text_layout(render_font &font, float xscale, float yscale, float wi
//-------------------------------------------------
text_layout::text_layout(text_layout &&that)
: m_font(that.m_font), m_xscale(that.m_xscale), m_yscale(that.m_yscale), m_width(that.m_width), m_justify(that.m_justify), m_wrap(that.m_wrap), m_lines(std::move(that.m_lines)),
: m_font(that.m_font), m_xscale(that.m_xscale), m_yscale(that.m_yscale), m_width(that.m_width), m_maximum_line_width(that.m_maximum_line_width), m_justify(that.m_justify), m_wrap(that.m_wrap), m_lines(std::move(that.m_lines)),
m_current_line(that.m_current_line), m_last_break(that.m_last_break), m_text_position(that.m_text_position), m_truncating(false)
{
}

View File

@ -1434,16 +1434,16 @@ void halleys_state::copy_fixed_2b(bitmap_ind16 &bitmap, UINT16 *source)
bx = esi[ecx+1];
if ((ax && !(ax & SP_2BACK)) || !edi[ecx + 0]) edi[ecx + 0] = ax; ax = esi[ecx + 2];
if ((ax && !(bx & SP_2BACK)) || !edi[ecx + 1]) edi[ecx + 1] = bx; bx = esi[ecx + 3];
if ((bx && !(bx & SP_2BACK)) || !edi[ecx + 1]) edi[ecx + 1] = bx; bx = esi[ecx + 3];
if ((ax && !(ax & SP_2BACK)) || !edi[ecx + 2]) edi[ecx + 2] = ax; ax = esi[ecx + 4];
if ((ax && !(bx & SP_2BACK)) || !edi[ecx + 3]) edi[ecx + 3] = bx; bx = esi[ecx + 5];
if ((bx && !(bx & SP_2BACK)) || !edi[ecx + 3]) edi[ecx + 3] = bx; bx = esi[ecx + 5];
if ((ax && !(ax & SP_2BACK)) || !edi[ecx + 4]) edi[ecx + 4] = ax; ax = esi[ecx + 6];
if ((ax && !(bx & SP_2BACK)) || !edi[ecx + 5]) edi[ecx + 5] = bx; bx = esi[ecx + 7];
if ((bx && !(bx & SP_2BACK)) || !edi[ecx + 5]) edi[ecx + 5] = bx; bx = esi[ecx + 7];
if ((ax && !(ax & SP_2BACK)) || !edi[ecx + 6]) edi[ecx + 6] = ax;
if ((ax && !(bx & SP_2BACK)) || !edi[ecx + 7]) edi[ecx + 7] = bx;
if ((bx && !(bx & SP_2BACK)) || !edi[ecx + 7]) edi[ecx + 7] = bx;
} while (ecx += 8);
ecx = -CLIP_W;