mirror of
https://github.com/holub/mame
synced 2025-05-10 16:21:42 +03:00
Converted render.c objects into C++ objects. Updated all callers.
This commit is contained in:
parent
f391c5f8d7
commit
3beb0ec246
@ -522,7 +522,7 @@ void cheat_render_text(running_machine *machine, render_container *container)
|
||||
{
|
||||
/* output the text */
|
||||
ui_draw_text_full(container, cheatinfo->output[linenum],
|
||||
0.0f, (float)linenum * ui_get_line_height(), 1.0f,
|
||||
0.0f, (float)linenum * ui_get_line_height(*machine), 1.0f,
|
||||
cheatinfo->justify[linenum], WRAP_NEVER, DRAW_OPAQUE,
|
||||
ARGB_WHITE, ARGB_BLACK, NULL, NULL);
|
||||
}
|
||||
@ -901,7 +901,7 @@ static void cheat_frame(running_machine &machine)
|
||||
|
||||
/* set up for accumulating output */
|
||||
cheatinfo->lastline = 0;
|
||||
cheatinfo->numlines = floor(1.0f / ui_get_line_height());
|
||||
cheatinfo->numlines = floor(1.0f / ui_get_line_height(machine));
|
||||
cheatinfo->numlines = MIN(cheatinfo->numlines, ARRAY_LENGTH(cheatinfo->output));
|
||||
for (linenum = 0; linenum < ARRAY_LENGTH(cheatinfo->output); linenum++)
|
||||
cheatinfo->output[linenum].reset();
|
||||
|
@ -196,8 +196,8 @@ static void create_bitmap(running_machine *machine, int player)
|
||||
}
|
||||
|
||||
/* create a texture to reference the bitmap */
|
||||
global.texture[player] = render_texture_alloc(render_texture_hq_scale, NULL);
|
||||
render_texture_set_bitmap(global.texture[player], global.bitmap[player], NULL, TEXFORMAT_ARGB32, NULL);
|
||||
global.texture[player] = machine->render().texture_alloc(render_texture::hq_scale);
|
||||
global.texture[player]->set_bitmap(global.bitmap[player], NULL, TEXFORMAT_ARGB32);
|
||||
}
|
||||
|
||||
|
||||
@ -263,8 +263,7 @@ static void crosshair_exit(running_machine &machine)
|
||||
/* free bitmaps and textures for each player */
|
||||
for (player = 0; player < MAX_PLAYERS; player++)
|
||||
{
|
||||
if (global.texture[player] != NULL)
|
||||
render_texture_free(global.texture[player]);
|
||||
machine.render().texture_free(global.texture[player]);
|
||||
global.texture[player] = NULL;
|
||||
|
||||
global_free(global.bitmap[player]);
|
||||
@ -396,11 +395,10 @@ void crosshair_render(screen_device &screen)
|
||||
((global.screen[player] == &screen) || (global.screen[player] == CROSSHAIR_SCREEN_ALL)))
|
||||
{
|
||||
/* add a quad assuming a 4:3 screen (this is not perfect) */
|
||||
render_screen_add_quad(&screen,
|
||||
global.x[player] - 0.03f, global.y[player] - 0.04f,
|
||||
global.x[player] + 0.03f, global.y[player] + 0.04f,
|
||||
MAKE_ARGB(0xc0, global.fade, global.fade, global.fade),
|
||||
global.texture[player], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
screen.container().add_quad(global.x[player] - 0.03f, global.y[player] - 0.04f,
|
||||
global.x[player] + 0.03f, global.y[player] + 0.04f,
|
||||
MAKE_ARGB(0xc0, global.fade, global.fade, global.fade),
|
||||
global.texture[player], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ static void execute_comment(running_machine *machine, int ref, int params, const
|
||||
|
||||
/* Now try adding the comment */
|
||||
cpu->debug()->comment_add(address, param[1], 0x00ff0000);
|
||||
cpu->machine->m_debug_view->update_all(DVT_DISASSEMBLY);
|
||||
cpu->machine->debug_view().update_all(DVT_DISASSEMBLY);
|
||||
}
|
||||
|
||||
|
||||
@ -1138,7 +1138,7 @@ static void execute_comment_del(running_machine *machine, int ref, int params, c
|
||||
/* If it's a number, it must be an address */
|
||||
/* The bankoff and cbn will be pulled from what's currently active */
|
||||
cpu->debug()->comment_remove(address);
|
||||
cpu->machine->m_debug_view->update_all(DVT_DISASSEMBLY);
|
||||
cpu->machine->debug_view().update_all(DVT_DISASSEMBLY);
|
||||
}
|
||||
|
||||
|
||||
@ -2427,9 +2427,9 @@ static void execute_snap(running_machine *machine, int ref, int params, const ch
|
||||
const char *filename = param[0];
|
||||
int scrnum = (params > 1) ? atoi(param[1]) : 0;
|
||||
|
||||
device_t *screen = machine->m_devicelist.find(SCREEN, scrnum);
|
||||
screen_device *screen = downcast<screen_device *>(machine->m_devicelist.find(SCREEN, scrnum));
|
||||
|
||||
if ((screen == NULL) || !render_is_live_screen(screen))
|
||||
if ((screen == NULL) || !machine->render().is_live(*screen))
|
||||
{
|
||||
debug_console_printf(machine, "Invalid screen number '%d'\n", scrnum);
|
||||
return;
|
||||
|
@ -382,7 +382,7 @@ CMDERR debug_console_execute_command(running_machine *machine, const char *comma
|
||||
/* update all views */
|
||||
if (echo)
|
||||
{
|
||||
machine->m_debug_view->update_all();
|
||||
machine->debug_view().update_all();
|
||||
debugger_refresh_display(machine);
|
||||
}
|
||||
return result;
|
||||
@ -481,7 +481,7 @@ void CLIB_DECL debug_console_printf(running_machine *machine, const char *format
|
||||
text_buffer_print(console_textbuf, buffer);
|
||||
|
||||
/* force an update of any console views */
|
||||
machine->m_debug_view->update_all(DVT_CONSOLE);
|
||||
machine->debug_view().update_all(DVT_CONSOLE);
|
||||
}
|
||||
|
||||
|
||||
@ -499,7 +499,7 @@ void CLIB_DECL debug_console_vprintf(running_machine *machine, const char *forma
|
||||
text_buffer_print(console_textbuf, buffer);
|
||||
|
||||
/* force an update of any console views */
|
||||
machine->m_debug_view->update_all(DVT_CONSOLE);
|
||||
machine->debug_view().update_all(DVT_CONSOLE);
|
||||
}
|
||||
|
||||
|
||||
@ -521,7 +521,7 @@ void CLIB_DECL debug_console_printf_wrap(running_machine *machine, int wrapcol,
|
||||
text_buffer_print_wrap(console_textbuf, buffer, wrapcol);
|
||||
|
||||
/* force an update of any console views */
|
||||
machine->m_debug_view->update_all(DVT_CONSOLE);
|
||||
machine->debug_view().update_all(DVT_CONSOLE);
|
||||
}
|
||||
|
||||
|
||||
@ -547,7 +547,7 @@ void debug_errorlog_write_line(running_machine &machine, const char *line)
|
||||
text_buffer_print(errorlog_textbuf, line);
|
||||
|
||||
/* force an update of any log views */
|
||||
machine.m_debug_view->update_all(DVT_LOG);
|
||||
machine.debug_view().update_all(DVT_LOG);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1813,8 +1813,8 @@ void device_debug::start_hook(attotime endtime)
|
||||
// check for periodic updates
|
||||
if (&m_device == global->visiblecpu && osd_ticks() > global->last_periodic_update_time + osd_ticks_per_second()/4)
|
||||
{
|
||||
m_device.machine->m_debug_view->update_all();
|
||||
m_device.machine->m_debug_view->flush_osd_updates();
|
||||
m_device.machine->debug_view().update_all();
|
||||
m_device.machine->debug_view().flush_osd_updates();
|
||||
global->last_periodic_update_time = osd_ticks();
|
||||
}
|
||||
|
||||
@ -1949,8 +1949,8 @@ void device_debug::instruction_hook(offs_t curpc)
|
||||
// update every 100 steps until we are within 200 of the end
|
||||
else if ((m_flags & DEBUG_FLAG_STEPPING_OUT) == 0 && (m_stepsleft < 200 || m_stepsleft % 100 == 0))
|
||||
{
|
||||
m_device.machine->m_debug_view->update_all();
|
||||
m_device.machine->m_debug_view->flush_osd_updates();
|
||||
m_device.machine->debug_view().update_all();
|
||||
m_device.machine->debug_view().flush_osd_updates();
|
||||
debugger_refresh_display(m_device.machine);
|
||||
}
|
||||
}
|
||||
@ -1998,7 +1998,7 @@ void device_debug::instruction_hook(offs_t curpc)
|
||||
global->visiblecpu = &m_device;
|
||||
|
||||
// update all views
|
||||
m_device.machine->m_debug_view->update_all();
|
||||
m_device.machine->debug_view().update_all();
|
||||
debugger_refresh_display(m_device.machine);
|
||||
|
||||
// wait for the debugger; during this time, disable sound output
|
||||
@ -2006,7 +2006,7 @@ void device_debug::instruction_hook(offs_t curpc)
|
||||
while (global->execution_state == EXECUTION_STATE_STOPPED)
|
||||
{
|
||||
// flush any pending updates before waiting again
|
||||
m_device.machine->m_debug_view->flush_osd_updates();
|
||||
m_device.machine->debug_view().flush_osd_updates();
|
||||
|
||||
// clear the memory modified flag and wait
|
||||
global->memory_modified = false;
|
||||
@ -2019,7 +2019,7 @@ void device_debug::instruction_hook(offs_t curpc)
|
||||
// if something modified memory, update the screen
|
||||
if (global->memory_modified)
|
||||
{
|
||||
m_device.machine->m_debug_view->update_all(DVT_DISASSEMBLY);
|
||||
m_device.machine->debug_view().update_all(DVT_DISASSEMBLY);
|
||||
debugger_refresh_display(m_device.machine);
|
||||
}
|
||||
|
||||
|
@ -159,8 +159,8 @@ public:
|
||||
{
|
||||
this->target = target;
|
||||
//dv->container = render_target_get_component_container(target, name, &pos);
|
||||
this->container = render_debug_alloc(target);
|
||||
this->view = machine->m_debug_view->alloc_view(type, dview_update, this);
|
||||
this->container = target->debug_alloc();
|
||||
this->view = machine->debug_view().alloc_view(type, dview_update, this);
|
||||
this->type = type;
|
||||
this->machine = machine;
|
||||
this->state = flags | VIEW_STATE_NEEDS_UPDATE;
|
||||
@ -185,8 +185,8 @@ public:
|
||||
}
|
||||
~DView()
|
||||
{
|
||||
render_debug_free(this->target, this->container);
|
||||
machine->m_debug_view->free_view(*this->view);
|
||||
this->target->debug_free(*this->container);
|
||||
machine->debug_view().free_view(*this->view);
|
||||
}
|
||||
|
||||
DView * next;
|
||||
@ -295,7 +295,7 @@ static void set_focus_view(DView *dv)
|
||||
focus_view = dv;
|
||||
LIST_REMOVE(list, dv, DView);
|
||||
LIST_ADD_FRONT(list, dv, DView);
|
||||
render_debug_top(dv->target, dv->container);
|
||||
dv->target->debug_top(*dv->container);
|
||||
}
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ static void dview_get_rect(DView *dv, int type, rectangle *rect)
|
||||
|
||||
static void dview_clear(DView *dv)
|
||||
{
|
||||
render_container_empty(dv->container);
|
||||
dv->container->empty();
|
||||
}
|
||||
|
||||
static void dview_draw_outlined_box(DView *dv, int rtype, int x, int y, int w, int h, rgb_t bg)
|
||||
@ -381,7 +381,7 @@ static void dview_draw_box(DView *dv, int rtype, int x, int y, int w, int h, rgb
|
||||
rectangle r;
|
||||
|
||||
dview_get_rect(dv, rtype, &r);
|
||||
render_container_add_rect(dv->container, NX(dv, x + r.min_x), NY(dv, y + r.min_y),
|
||||
dv->container->add_rect(NX(dv, x + r.min_x), NY(dv, y + r.min_y),
|
||||
NX(dv, x + r.min_x + w), NY(dv, y + r.min_y + h), col,
|
||||
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
}
|
||||
@ -391,14 +391,14 @@ static void dview_draw_char(DView *dv, int rtype, int x, int y, int h, rgb_t col
|
||||
rectangle r;
|
||||
|
||||
dview_get_rect(dv, rtype, &r);
|
||||
render_container_add_char(dv->container,
|
||||
dv->container->add_char(
|
||||
NX(dv, x + r.min_x),
|
||||
NY(dv, y + r.min_y),
|
||||
NY(dv, h),
|
||||
debug_font_aspect,
|
||||
//(float) rect_get_height(&dv->bounds) / (float) rect_get_width(&dv->bounds), //render_get_ui_aspect(),
|
||||
col,
|
||||
debug_font,
|
||||
*debug_font,
|
||||
ch);
|
||||
}
|
||||
|
||||
@ -777,15 +777,15 @@ static void dview_draw(DView *dv)
|
||||
static void dview_size_allocate(DView *dv)
|
||||
{
|
||||
debug_view_xy size, pos, col, vsize;
|
||||
render_container_user_settings rcus;
|
||||
render_container::user_settings rcus;
|
||||
rectangle r;
|
||||
|
||||
render_container_get_user_settings(dv->container, &rcus);
|
||||
rcus.xoffset = (float) dv->ofs_x / (float) dv->rt_width;
|
||||
rcus.yoffset = (float) dv->ofs_y / (float) dv->rt_height;
|
||||
rcus.xscale = 1.0; //(float) rect_get_width(&dv->bounds) / (float) dv->rt_width;
|
||||
rcus.yscale = 1.0; //(float) rect_get_height(&dv->bounds) / (float) dv->rt_height;
|
||||
render_container_set_user_settings(dv->container, &rcus);
|
||||
dv->container->get_user_settings(rcus);
|
||||
rcus.m_xoffset = (float) dv->ofs_x / (float) dv->rt_width;
|
||||
rcus.m_yoffset = (float) dv->ofs_y / (float) dv->rt_height;
|
||||
rcus.m_xscale = 1.0; //(float) rect_get_width(&dv->bounds) / (float) dv->rt_width;
|
||||
rcus.m_yscale = 1.0; //(float) rect_get_height(&dv->bounds) / (float) dv->rt_height;
|
||||
dv->container->set_user_settings(rcus);
|
||||
//printf("%d %d %d %d\n", wpos.min_x, wpos.max_x, wpos.min_y, wpos.max_y);
|
||||
|
||||
pos = dv->view->visible_position();
|
||||
@ -899,7 +899,7 @@ void debugint_init(running_machine *machine)
|
||||
{
|
||||
unicode_char ch;
|
||||
int chw;
|
||||
debug_font = render_font_alloc("ui.bdf"); //ui_get_font();
|
||||
debug_font = render_font_alloc(*machine, "ui.bdf"); //ui_get_font();
|
||||
debug_font_width = 0;
|
||||
debug_font_height = 15;
|
||||
|
||||
@ -908,7 +908,7 @@ void debugint_init(running_machine *machine)
|
||||
list = NULL;
|
||||
focus_view = NULL;
|
||||
|
||||
debug_font_aspect = render_get_ui_aspect();
|
||||
debug_font_aspect = machine->render().ui_aspect();
|
||||
|
||||
for (ch=0;ch<=127;ch++)
|
||||
{
|
||||
@ -930,14 +930,14 @@ static void set_view_by_name(render_target *target, const char *name)
|
||||
|
||||
for (i = 0; ; i++ )
|
||||
{
|
||||
s = render_target_get_view_name(target, i);
|
||||
s = target->view_name(i);
|
||||
if (s == NULL)
|
||||
return;
|
||||
//printf("%d %s\n", i, s);
|
||||
if (strcmp(name, s) == 0)
|
||||
{
|
||||
render_target_set_view(target, i);
|
||||
//printf("%d\n", render_target_get_view(target) );
|
||||
target->set_view(i);
|
||||
//printf("%d\n", target->view() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -977,11 +977,11 @@ static void on_disassembly_window_activate(DView *dv, const ui_menu_event *event
|
||||
render_target *target;
|
||||
const debug_view_source *source;
|
||||
|
||||
target = render_get_ui_target();
|
||||
target = &dv->machine->render().ui_target();
|
||||
|
||||
ndv = dview_alloc(target, dv->machine, DVT_DISASSEMBLY, 0);
|
||||
ndv->editor.active = TRUE;
|
||||
ndv->editor.container = render_container_get_ui();
|
||||
ndv->editor.container = &dv->machine->render().ui_container();
|
||||
source = ndv->view->source();
|
||||
dview_set_title(ndv, source->name());
|
||||
set_focus_view(ndv);
|
||||
@ -1010,7 +1010,7 @@ static void on_log_window_activate(DView *dv, const ui_menu_event *event)
|
||||
DView *ndv;
|
||||
render_target *target;
|
||||
|
||||
target = render_get_ui_target();
|
||||
target = &dv->machine->render().ui_target();
|
||||
ndv = dview_alloc(target, dv->machine, DVT_LOG, 0);
|
||||
dview_set_title(ndv, "Log");
|
||||
set_focus_view(ndv);
|
||||
@ -1125,7 +1125,7 @@ static void render_editor(DView_edit *editor)
|
||||
float width, maxwidth;
|
||||
float x1, y1, x2, y2;
|
||||
|
||||
render_container_empty(editor->container);
|
||||
editor->container->empty();
|
||||
/* get the size of the text */
|
||||
ui_draw_text_full(editor->container, editor->str, 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL);
|
||||
@ -1165,7 +1165,7 @@ static void CreateMainMenu(running_machine *machine)
|
||||
|
||||
if (menu != NULL)
|
||||
ui_menu_free(menu);
|
||||
menu = ui_menu_alloc(machine, render_container_get_ui(),NULL,NULL);
|
||||
menu = ui_menu_alloc(machine, &machine->render().ui_container(),NULL,NULL);
|
||||
|
||||
switch (focus_view->type)
|
||||
{
|
||||
@ -1348,7 +1348,7 @@ static void handle_menus(running_machine *machine)
|
||||
{
|
||||
const ui_menu_event *event;
|
||||
|
||||
render_container_empty(render_container_get_ui());
|
||||
machine->render().ui_container().empty();
|
||||
ui_input_frame_update(*machine);
|
||||
if (menu != NULL)
|
||||
{
|
||||
@ -1414,7 +1414,8 @@ static void dview_update_view(DView *dv)
|
||||
INT32 old_rt_width = dv->rt_width;
|
||||
INT32 old_rt_height = dv->rt_height;
|
||||
|
||||
render_target_get_bounds(dv->target, &dv->rt_width, &dv->rt_height, NULL);
|
||||
dv->rt_width = dv->target->width();
|
||||
dv->rt_height = dv->target->height();
|
||||
if (dview_is_state(dv, VIEW_STATE_NEEDS_UPDATE) || dv->rt_width != old_rt_width || dv->rt_height != old_rt_height)
|
||||
{
|
||||
dview_size_allocate(dv);
|
||||
@ -1446,24 +1447,24 @@ void debugint_wait_for_debugger(running_device *device, int firststop)
|
||||
DView *dv;
|
||||
render_target *target;
|
||||
|
||||
target = render_get_ui_target();
|
||||
target = &device->machine->render().ui_target();
|
||||
|
||||
//set_view_by_name(target, "Debug");
|
||||
|
||||
dv = dview_alloc(target, device->machine, DVT_DISASSEMBLY, VIEW_STATE_FOLLOW_CPU);
|
||||
dv->editor.active = TRUE;
|
||||
dv->editor.container = render_container_get_ui();
|
||||
dv->editor.container = &device->machine->render().ui_container();
|
||||
dv = dview_alloc(target, device->machine, DVT_STATE, VIEW_STATE_FOLLOW_CPU);
|
||||
dv = dview_alloc(target, device->machine, DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU);
|
||||
dview_set_title(dv, "Console");
|
||||
dv->editor.active = TRUE;
|
||||
dv->editor.container = render_container_get_ui();
|
||||
dv->editor.container = &device->machine->render().ui_container();
|
||||
set_focus_view(dv);
|
||||
}
|
||||
|
||||
followers_set_cpu(device);
|
||||
|
||||
//ui_update_and_render(device->machine, render_container_get_ui());
|
||||
//ui_update_and_render(device->machine, &device->machine->render().ui_container()());
|
||||
update_views();
|
||||
osd_update(device->machine, FALSE);
|
||||
handle_menus(device->machine);
|
||||
|
@ -23,7 +23,7 @@
|
||||
static MACHINE_START( empty )
|
||||
{
|
||||
/* force the UI to show the game select screen */
|
||||
ui_menu_force_game_select(machine, render_container_get_ui());
|
||||
ui_menu_force_game_select(machine, &machine->render().ui_container());
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,11 +77,11 @@ public:
|
||||
void * m_base; // base of the allocation
|
||||
const char * m_file; // file the allocation was made from
|
||||
int m_line; // line number within that file
|
||||
int m_id; // unique id
|
||||
UINT64 m_id; // unique id
|
||||
|
||||
static const int k_hash_prime = 193;
|
||||
|
||||
static int s_curid; // current ID
|
||||
static UINT64 s_curid; // current ID
|
||||
static osd_lock * s_lock; // lock for managing the list
|
||||
static bool s_lock_alloc; // set to true temporarily during lock allocation
|
||||
static memory_entry *s_hash[k_hash_prime];// hash table based on pointer
|
||||
@ -110,7 +110,7 @@ resource_pool global_resource_pool;
|
||||
const zeromem_t zeromem = { };
|
||||
|
||||
// globals for memory_entry
|
||||
int memory_entry::s_curid = 0;
|
||||
UINT64 memory_entry::s_curid = 0;
|
||||
osd_lock *memory_entry::s_lock = NULL;
|
||||
bool memory_entry::s_lock_alloc = false;
|
||||
memory_entry *memory_entry::s_hash[memory_entry::k_hash_prime] = { NULL };
|
||||
@ -134,10 +134,10 @@ void *malloc_file_line(size_t size, const char *file, int line)
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
// add a new entry
|
||||
memory_entry::allocate(size, result, file, line);
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
// randomize the memory
|
||||
rand_memory(result, size);
|
||||
#endif
|
||||
@ -153,7 +153,6 @@ void *malloc_file_line(size_t size, const char *file, int line)
|
||||
|
||||
void free_file_line(void *memory, const char *file, int line)
|
||||
{
|
||||
#ifdef MAME_DEBUG
|
||||
// find the memory entry
|
||||
memory_entry *entry = memory_entry::find(memory);
|
||||
|
||||
@ -165,6 +164,7 @@ void free_file_line(void *memory, const char *file, int line)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
// clear memory to a bogus value
|
||||
memset(memory, 0xfc, entry->m_size);
|
||||
|
||||
@ -236,15 +236,42 @@ void resource_pool::add(resource_pool_item &item)
|
||||
int hashval = reinterpret_cast<FPTR>(item.m_ptr) % k_hash_prime;
|
||||
item.m_next = m_hash[hashval];
|
||||
m_hash[hashval] = &item;
|
||||
|
||||
// insert into ordered list
|
||||
item.m_ordered_next = NULL;
|
||||
item.m_ordered_prev = m_ordered_tail;
|
||||
if (m_ordered_tail != NULL)
|
||||
m_ordered_tail->m_ordered_next = &item;
|
||||
m_ordered_tail = &item;
|
||||
if (m_ordered_head == NULL)
|
||||
|
||||
// fetch the ID of this item's pointer; some implementations put hidden data
|
||||
// before, so if we don't find it, check 4 bytes ahead
|
||||
memory_entry *entry = memory_entry::find(item.m_ptr);
|
||||
if (entry == NULL)
|
||||
entry = memory_entry::find(reinterpret_cast<UINT8 *>(item.m_ptr) - sizeof(size_t));
|
||||
assert(entry != NULL);
|
||||
item.m_id = entry->m_id;
|
||||
|
||||
// find the entry to insert after
|
||||
resource_pool_item *insert_after;
|
||||
for (insert_after = m_ordered_tail; insert_after != NULL; insert_after = insert_after->m_ordered_prev)
|
||||
if (insert_after->m_id < item.m_id)
|
||||
break;
|
||||
|
||||
// insert into the appropriate spot
|
||||
if (insert_after != NULL)
|
||||
{
|
||||
item.m_ordered_next = insert_after->m_ordered_next;
|
||||
if (item.m_ordered_next != NULL)
|
||||
item.m_ordered_next->m_ordered_prev = &item;
|
||||
else
|
||||
m_ordered_tail = &item;
|
||||
item.m_ordered_prev = insert_after;
|
||||
insert_after->m_ordered_next = &item;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.m_ordered_next = m_ordered_head;
|
||||
if (item.m_ordered_next != NULL)
|
||||
item.m_ordered_next->m_ordered_prev = &item;
|
||||
else
|
||||
m_ordered_tail = &item;
|
||||
item.m_ordered_prev = NULL;
|
||||
m_ordered_head = &item;
|
||||
}
|
||||
|
||||
osd_lock_release(m_listlock);
|
||||
}
|
||||
@ -516,7 +543,7 @@ void memory_entry::report_unfreed()
|
||||
if (total == 0)
|
||||
fprintf(stderr, "--- memory leak warning ---\n");
|
||||
total += entry->m_size;
|
||||
fprintf(stderr, "allocation #%06d, %d bytes (%s:%d)\n", entry->m_id, static_cast<UINT32>(entry->m_size), entry->m_file, (int)entry->m_line);
|
||||
fprintf(stderr, "allocation #%06d, %d bytes (%s:%d)\n", (UINT32)entry->m_id, static_cast<UINT32>(entry->m_size), entry->m_file, (int)entry->m_line);
|
||||
}
|
||||
|
||||
release_lock();
|
||||
|
@ -87,7 +87,8 @@ public:
|
||||
m_ordered_next(NULL),
|
||||
m_ordered_prev(NULL),
|
||||
m_ptr(ptr),
|
||||
m_size(size) { }
|
||||
m_size(size),
|
||||
m_id(~(UINT64)0) { }
|
||||
virtual ~resource_pool_item() { }
|
||||
|
||||
resource_pool_item * m_next;
|
||||
@ -95,6 +96,7 @@ public:
|
||||
resource_pool_item * m_ordered_prev;
|
||||
void * m_ptr;
|
||||
size_t m_size;
|
||||
UINT64 m_id;
|
||||
};
|
||||
|
||||
|
||||
|
@ -381,17 +381,6 @@ public:
|
||||
|
||||
void reset() { while (m_head != NULL) remove(*m_head); }
|
||||
|
||||
int index(T *object) const
|
||||
{
|
||||
int num = 0;
|
||||
for (T *cur = m_head; cur != NULL; cur = cur->m_next)
|
||||
if (cur == object)
|
||||
return num;
|
||||
else
|
||||
num++;
|
||||
return -1;
|
||||
}
|
||||
|
||||
T &prepend(T &object)
|
||||
{
|
||||
object.m_next = m_head;
|
||||
@ -401,6 +390,20 @@ public:
|
||||
m_count++;
|
||||
return object;
|
||||
}
|
||||
|
||||
void prepend_list(simple_list<T> &list)
|
||||
{
|
||||
int count = list.count();
|
||||
if (count == 0)
|
||||
return;
|
||||
T *tail = list.last();
|
||||
T *head = list.detach_all();
|
||||
tail->m_next = m_head;
|
||||
m_head = head;
|
||||
if (m_tail == NULL)
|
||||
m_tail = tail;
|
||||
m_count += count;
|
||||
}
|
||||
|
||||
T &append(T &object)
|
||||
{
|
||||
@ -413,7 +416,35 @@ public:
|
||||
return object;
|
||||
}
|
||||
|
||||
void detach(T &object)
|
||||
void append_list(simple_list<T> &list)
|
||||
{
|
||||
int count = list.count();
|
||||
if (count == 0)
|
||||
return;
|
||||
T *tail = list.last();
|
||||
T *head = list.detach_all();
|
||||
if (m_tail != NULL)
|
||||
m_tail->m_next = head;
|
||||
else
|
||||
m_head = head;
|
||||
m_tail = tail;
|
||||
m_count += count;
|
||||
}
|
||||
|
||||
T *detach_head()
|
||||
{
|
||||
T *result = m_head;
|
||||
if (result != NULL)
|
||||
{
|
||||
m_head = result->m_next;
|
||||
m_count--;
|
||||
if (m_head == NULL)
|
||||
m_tail = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
T &detach(T &object)
|
||||
{
|
||||
T *prev = NULL;
|
||||
for (T *cur = m_head; cur != NULL; prev = cur, cur = cur->m_next)
|
||||
@ -426,8 +457,17 @@ public:
|
||||
if (m_tail == &object)
|
||||
m_tail = prev;
|
||||
m_count--;
|
||||
return;
|
||||
return object;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
T *detach_all()
|
||||
{
|
||||
T *result = m_head;
|
||||
m_head = m_tail = NULL;
|
||||
m_count = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
void remove(T &object)
|
||||
@ -435,7 +475,7 @@ public:
|
||||
detach(object);
|
||||
pool_free(m_pool, &object);
|
||||
}
|
||||
|
||||
|
||||
T *find(int index) const
|
||||
{
|
||||
for (T *cur = m_head; cur != NULL; cur = cur->m_next)
|
||||
@ -443,6 +483,48 @@ public:
|
||||
return cur;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int indexof(const T &object) const
|
||||
{
|
||||
int index = 0;
|
||||
for (T *cur = m_head; cur != NULL; cur = cur->m_next)
|
||||
{
|
||||
if (cur == &object)
|
||||
return index;
|
||||
index++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// ======================> fixed_allocator
|
||||
|
||||
template<class T>
|
||||
class fixed_allocator
|
||||
{
|
||||
DISABLE_COPYING(fixed_allocator);
|
||||
|
||||
public:
|
||||
fixed_allocator(resource_pool &pool = global_resource_pool)
|
||||
: m_pool(pool),
|
||||
m_freelist(pool) { }
|
||||
|
||||
T *alloc()
|
||||
{
|
||||
T *result = m_freelist.detach_head();
|
||||
if (result == NULL)
|
||||
result = m_pool.add_object(new T);
|
||||
return result;
|
||||
}
|
||||
|
||||
void reclaim(T *item) { if (item != NULL) m_freelist.append(*item); }
|
||||
void reclaim(T &item) { m_freelist.append(item); }
|
||||
void reclaim_all(simple_list<T> &list) { m_freelist.append_list(list); }
|
||||
|
||||
private:
|
||||
resource_pool &m_pool;
|
||||
simple_list<T> m_freelist;
|
||||
};
|
||||
|
||||
|
||||
|
@ -2490,7 +2490,8 @@ g_profiler.start(PROFILER_INPUT);
|
||||
{
|
||||
const char *tag = NULL;
|
||||
input_port_value mask;
|
||||
if (render_target_map_point_input(mouse_target, mouse_target_x, mouse_target_y, &tag, &mask, NULL, NULL))
|
||||
float x, y;
|
||||
if (mouse_target->map_point_input(mouse_target_x, mouse_target_y, tag, mask, x, y))
|
||||
mouse_field = input_field_by_tag_and_mask(machine->m_portlist, tag, mask);
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,6 @@ running_machine::running_machine(const machine_config &_config, core_options &op
|
||||
generic_machine_data(NULL),
|
||||
generic_video_data(NULL),
|
||||
generic_audio_data(NULL),
|
||||
m_debug_view(NULL),
|
||||
m_logerror_list(NULL),
|
||||
m_scheduler(*this),
|
||||
m_options(options),
|
||||
@ -190,7 +189,9 @@ running_machine::running_machine(const machine_config &_config, core_options &op
|
||||
m_saveload_schedule_time(attotime_zero),
|
||||
m_saveload_searchpath(NULL),
|
||||
m_rand_seed(0x9d14abd7),
|
||||
m_driver_device(NULL)
|
||||
m_driver_device(NULL),
|
||||
m_render(NULL),
|
||||
m_debug_view(NULL)
|
||||
{
|
||||
memset(gfx, 0, sizeof(gfx));
|
||||
memset(&generic, 0, sizeof(generic));
|
||||
@ -271,7 +272,7 @@ void running_machine::start()
|
||||
state_init(this);
|
||||
state_save_allow_registration(this, true);
|
||||
palette_init(this);
|
||||
render_init(this);
|
||||
m_render = auto_alloc(this, render_manager(*this));
|
||||
ui_init(this);
|
||||
generic_machine_init(this);
|
||||
generic_video_init(this);
|
||||
@ -453,7 +454,7 @@ void running_machine::schedule_exit()
|
||||
if (m_exit_to_game_select && options_get_string(&m_options, OPTION_GAMENAME)[0] != 0)
|
||||
{
|
||||
options_set_string(&m_options, OPTION_GAMENAME, "", OPTION_PRIORITY_CMDLINE);
|
||||
ui_menu_force_game_select(this, render_container_get_ui());
|
||||
ui_menu_force_game_select(this, &render().ui_container());
|
||||
}
|
||||
|
||||
// otherwise, exit for real
|
||||
|
@ -181,6 +181,7 @@ const int DEBUG_FLAG_OSD_ENABLED = 0x00001000; // The OSD debugger is enabled
|
||||
class gfx_element;
|
||||
class colortable_t;
|
||||
class debug_view_manager;
|
||||
class render_manager;
|
||||
|
||||
typedef struct _mame_private mame_private;
|
||||
typedef struct _cpuexec_private cpuexec_private;
|
||||
@ -329,6 +330,8 @@ class running_machine : public bindable_object
|
||||
{
|
||||
DISABLE_COPYING(running_machine);
|
||||
|
||||
friend void debugger_init(running_machine *machine);
|
||||
|
||||
typedef void (*notify_callback)(running_machine &machine);
|
||||
typedef void (*logerror_callback)(running_machine &machine, const char *string);
|
||||
|
||||
@ -381,6 +384,10 @@ public:
|
||||
// regions
|
||||
region_info *region_alloc(const char *name, UINT32 length, UINT32 flags);
|
||||
void region_free(const char *name);
|
||||
|
||||
// managers
|
||||
render_manager &render() const { assert(m_render != NULL); return *m_render; }
|
||||
debug_view_manager &debug_view() const { assert(m_debug_view != NULL); return *m_debug_view; }
|
||||
|
||||
// misc
|
||||
void CLIB_DECL logerror(const char *format, ...);
|
||||
@ -449,8 +456,6 @@ public:
|
||||
generic_video_private * generic_video_data; // internal data from video/generic.c
|
||||
generic_audio_private * generic_audio_data; // internal data from audio/generic.c
|
||||
|
||||
debug_view_manager * m_debug_view; // internal data from debugvw.c
|
||||
|
||||
// driver-specific information
|
||||
driver_device *driver_data() const { return m_driver_device; }
|
||||
|
||||
@ -520,6 +525,8 @@ private:
|
||||
time_t m_base_time;
|
||||
|
||||
driver_device * m_driver_device;
|
||||
render_manager * m_render; // internal data from render.c
|
||||
debug_view_manager * m_debug_view; // internal data from debugvw.c
|
||||
};
|
||||
|
||||
|
||||
|
@ -1246,22 +1246,22 @@ VIDEO_UPDATE( laserdisc )
|
||||
if (overbitmap != NULL)
|
||||
{
|
||||
if (overbitmap->format == BITMAP_FORMAT_INDEXED16)
|
||||
render_texture_set_bitmap(ldcore->overtex, overbitmap, &ldcore->config.overclip, TEXFORMAT_PALETTEA16, laserdisc->machine->palette);
|
||||
ldcore->overtex->set_bitmap(overbitmap, &ldcore->config.overclip, TEXFORMAT_PALETTEA16, laserdisc->machine->palette);
|
||||
else if (overbitmap->format == BITMAP_FORMAT_RGB32)
|
||||
render_texture_set_bitmap(ldcore->overtex, overbitmap, &ldcore->config.overclip, TEXFORMAT_ARGB32, NULL);
|
||||
ldcore->overtex->set_bitmap(overbitmap, &ldcore->config.overclip, TEXFORMAT_ARGB32);
|
||||
}
|
||||
|
||||
/* get the laserdisc video */
|
||||
laserdisc_get_video(laserdisc, &vidbitmap);
|
||||
if (vidbitmap != NULL)
|
||||
render_texture_set_bitmap(ldcore->videotex, vidbitmap, NULL, TEXFORMAT_YUY16, ldcore->videopalette);
|
||||
ldcore->videotex->set_bitmap(vidbitmap, NULL, TEXFORMAT_YUY16, ldcore->videopalette);
|
||||
|
||||
/* reset the screen contents */
|
||||
render_container_empty(render_container_get_screen(screen));
|
||||
screen->container().empty();
|
||||
|
||||
/* add the video texture */
|
||||
if (ldcore->videoenable)
|
||||
render_screen_add_quad(screen, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), ldcore->videotex, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
|
||||
screen->container().add_quad(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), ldcore->videotex, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
|
||||
|
||||
/* add the overlay */
|
||||
if (ldcore->overenable && overbitmap != NULL)
|
||||
@ -1270,7 +1270,7 @@ VIDEO_UPDATE( laserdisc )
|
||||
float y0 = 0.5f - 0.5f * ldcore->config.overscaley + ldcore->config.overposy;
|
||||
float x1 = x0 + ldcore->config.overscalex;
|
||||
float y1 = y0 + ldcore->config.overscaley;
|
||||
render_screen_add_quad(screen, x0, y0, x1, y1, MAKE_ARGB(0xff,0xff,0xff,0xff), ldcore->overtex, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_SCREENTEX(1));
|
||||
screen->container().add_quad(x0, y0, x1, y1, MAKE_ARGB(0xff,0xff,0xff,0xff), ldcore->overtex, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_SCREENTEX(1));
|
||||
}
|
||||
|
||||
/* swap to the next bitmap */
|
||||
@ -1418,7 +1418,7 @@ static void init_video(running_device *device)
|
||||
|
||||
/* allocate texture for rendering */
|
||||
ldcore->videoenable = TRUE;
|
||||
ldcore->videotex = render_texture_alloc(NULL, NULL);
|
||||
ldcore->videotex = device->machine->render().texture_alloc();
|
||||
if (ldcore->videotex == NULL)
|
||||
fatalerror("Out of memory allocating video texture");
|
||||
|
||||
@ -1435,7 +1435,7 @@ static void init_video(running_device *device)
|
||||
ldcore->overenable = TRUE;
|
||||
ldcore->overbitmap[0] = auto_bitmap_alloc(device->machine, ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat);
|
||||
ldcore->overbitmap[1] = auto_bitmap_alloc(device->machine, ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat);
|
||||
ldcore->overtex = render_texture_alloc(NULL, NULL);
|
||||
ldcore->overtex = device->machine->render().texture_alloc();
|
||||
if (ldcore->overtex == NULL)
|
||||
fatalerror("Out of memory allocating overlay texture");
|
||||
}
|
||||
@ -1536,12 +1536,10 @@ static DEVICE_STOP( laserdisc )
|
||||
chd_async_complete(ldcore->disc);
|
||||
|
||||
/* free any textures and palettes */
|
||||
if (ldcore->videotex != NULL)
|
||||
render_texture_free(ldcore->videotex);
|
||||
device->machine->render().texture_free(ldcore->videotex);
|
||||
if (ldcore->videopalette != NULL)
|
||||
palette_deref(ldcore->videopalette);
|
||||
if (ldcore->overtex != NULL)
|
||||
render_texture_free(ldcore->overtex);
|
||||
device->machine->render().texture_free(ldcore->overtex);
|
||||
}
|
||||
|
||||
|
||||
|
5197
src/emu/render.c
5197
src/emu/render.c
File diff suppressed because it is too large
Load Diff
950
src/emu/render.h
950
src/emu/render.h
File diff suppressed because it is too large
Load Diff
@ -2333,24 +2333,27 @@ static void FUNC_PREFIX(setup_and_draw_textured_quad)(const render_primitive *pr
|
||||
using a software rasterizer
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void FUNC_PREFIX(draw_primitives)(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch)
|
||||
static void FUNC_PREFIX(draw_primitives)(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch)
|
||||
{
|
||||
const render_primitive *prim;
|
||||
|
||||
/* loop over the list and render each element */
|
||||
for (prim = primlist; prim != NULL; prim = prim->next)
|
||||
for (prim = primlist.first(); prim != NULL; prim = prim->next())
|
||||
switch (prim->type)
|
||||
{
|
||||
case RENDER_PRIMITIVE_LINE:
|
||||
case render_primitive::LINE:
|
||||
FUNC_PREFIX(draw_line)(prim, dstdata, width, height, pitch);
|
||||
break;
|
||||
|
||||
case RENDER_PRIMITIVE_QUAD:
|
||||
case render_primitive::QUAD:
|
||||
if (!prim->texture.base)
|
||||
FUNC_PREFIX(draw_rect)(prim, dstdata, width, height, pitch);
|
||||
else
|
||||
FUNC_PREFIX(setup_and_draw_textured_quad)(prim, dstdata, width, height, pitch);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw emu_fatalerror("Unexpected render_primitive type");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ struct _render_font_char
|
||||
/*typedef struct _render_font render_font; -- defined in rendfont.h */
|
||||
struct _render_font
|
||||
{
|
||||
running_machine * machine;
|
||||
int format; /* format of font data */
|
||||
int height; /* height of the font, from ascent to descent */
|
||||
int yoffs; /* y offset from baseline to descent */
|
||||
@ -136,7 +137,7 @@ INLINE render_font_char *get_char(render_font *font, unicode_char chnum)
|
||||
and load the BDF file
|
||||
-------------------------------------------------*/
|
||||
|
||||
render_font *render_font_alloc(const char *filename)
|
||||
render_font *render_font_alloc(running_machine &machine, const char *filename)
|
||||
{
|
||||
file_error filerr;
|
||||
mame_file *ramfile;
|
||||
@ -144,6 +145,7 @@ render_font *render_font_alloc(const char *filename)
|
||||
|
||||
/* allocate and clear memory */
|
||||
font = global_alloc_clear(render_font);
|
||||
font->machine = &machine;
|
||||
|
||||
/* attempt to load the cached version of the font first */
|
||||
if (filename != NULL && render_font_load_cached_bdf(font, filename) == 0)
|
||||
@ -152,6 +154,7 @@ render_font *render_font_alloc(const char *filename)
|
||||
/* if we failed, clean up and realloc */
|
||||
render_font_free(font);
|
||||
font = global_alloc_clear(render_font);
|
||||
font->machine = &machine;
|
||||
|
||||
/* load the raw data instead */
|
||||
filerr = mame_fopen_ram(font_uismall, sizeof(font_uismall), OPEN_FLAG_READ, &ramfile);
|
||||
@ -183,8 +186,7 @@ void render_font_free(render_font *font)
|
||||
for (charnum = 0; charnum < 256; charnum++)
|
||||
{
|
||||
render_font_char *ch = &font->chars[tablenum][charnum];
|
||||
if (ch->texture != NULL)
|
||||
render_texture_free(ch->texture);
|
||||
font->machine->render().texture_free(ch->texture);
|
||||
global_free(ch->bitmap);
|
||||
}
|
||||
|
||||
@ -274,8 +276,8 @@ static void render_font_char_expand(render_font *font, render_font_char *ch)
|
||||
}
|
||||
|
||||
/* wrap a texture around the bitmap */
|
||||
ch->texture = render_texture_alloc(render_texture_hq_scale, NULL);
|
||||
render_texture_set_bitmap(ch->texture, ch->bitmap, NULL, TEXFORMAT_ARGB32, NULL);
|
||||
ch->texture = font->machine->render().texture_alloc(render_texture::hq_scale);
|
||||
ch->texture->set_bitmap(ch->bitmap, NULL, TEXFORMAT_ARGB32);
|
||||
}
|
||||
|
||||
|
||||
@ -343,7 +345,11 @@ void render_font_get_scaled_bitmap_and_bounds(render_font *font, bitmap_t *dest,
|
||||
origheight = dest->height;
|
||||
dest->width = bounds->max_x - bounds->min_x;
|
||||
dest->height = bounds->max_y - bounds->min_y;
|
||||
render_texture_hq_scale(dest, ch->bitmap, NULL, NULL);
|
||||
rectangle clip;
|
||||
clip.min_x = clip.min_y = 0;
|
||||
clip.max_x = ch->bitmap->width - 1;
|
||||
clip.max_y = ch->bitmap->height - 1;
|
||||
render_texture::hq_scale(*dest, *ch->bitmap, clip, NULL);
|
||||
dest->width = origwidth;
|
||||
dest->height = origheight;
|
||||
}
|
||||
@ -812,8 +818,7 @@ static int render_font_save_cached(render_font *font, const char *filename, UINT
|
||||
goto error;
|
||||
|
||||
/* free the bitmap and texture */
|
||||
if (ch->texture != NULL)
|
||||
render_texture_free(ch->texture);
|
||||
font->machine->render().texture_free(ch->texture);
|
||||
ch->texture = NULL;
|
||||
global_free(ch->bitmap);
|
||||
ch->bitmap = NULL;
|
||||
|
@ -20,7 +20,7 @@
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
render_font *render_font_alloc(const char *filename);
|
||||
render_font *render_font_alloc(running_machine &machine, const char *filename);
|
||||
void render_font_free(render_font *font);
|
||||
INT32 render_font_get_pixel_height(render_font *font);
|
||||
render_texture *render_font_get_char_texture_and_bounds(render_font *font, float height, float aspect, unicode_char ch, render_bounds *bounds);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -96,6 +96,7 @@ struct _element_texture
|
||||
struct _layout_element
|
||||
{
|
||||
layout_element * next; /* link to next element */
|
||||
running_machine * machine;
|
||||
const char * name; /* name of this element */
|
||||
element_component * complist; /* head of the list of components */
|
||||
int defstate; /* default state of this element */
|
||||
@ -164,7 +165,7 @@ void layout_view_recompute(layout_view *view, int layerconfig);
|
||||
|
||||
|
||||
/* ----- layout file parsing ----- */
|
||||
layout_file *layout_file_load(const machine_config *config, const char *dirname, const char *filename);
|
||||
layout_file *layout_file_load(running_machine &machine, const char *dirname, const char *filename);
|
||||
void layout_file_free(layout_file *file);
|
||||
|
||||
|
||||
|
@ -1455,7 +1455,7 @@ void ui_image_menu_software(running_machine *machine, ui_menu *menu, void *param
|
||||
|
||||
if (event != NULL && event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
ui_menu *child_menu = ui_menu_alloc(machine, render_container_get_ui(), ui_mess_menu_software_list, NULL);
|
||||
ui_menu *child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), ui_mess_menu_software_list, NULL);
|
||||
software_menu_state *child_menustate = (software_menu_state *)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL);
|
||||
child_menustate->list_name = (char *)event->itemref;
|
||||
child_menustate->image = image;
|
||||
|
155
src/emu/ui.c
155
src/emu/ui.c
@ -240,7 +240,7 @@ int ui_init(running_machine *machine)
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_exit);
|
||||
|
||||
/* allocate the font and messagebox string */
|
||||
ui_font = render_font_alloc("ui.bdf");
|
||||
ui_font = render_font_alloc(*machine, "ui.bdf");
|
||||
|
||||
/* initialize the other UI bits */
|
||||
ui_menu_init(machine);
|
||||
@ -374,7 +374,7 @@ void ui_set_startup_text(running_machine *machine, const char *text, int force)
|
||||
void ui_update_and_render(running_machine *machine, render_container *container)
|
||||
{
|
||||
/* always start clean */
|
||||
render_container_empty(container);
|
||||
container->empty();
|
||||
|
||||
/* if we're paused, dim the whole screen */
|
||||
if (machine->phase() >= MACHINE_PHASE_RESET && (single_step || machine->paused()))
|
||||
@ -385,7 +385,7 @@ void ui_update_and_render(running_machine *machine, render_container *container)
|
||||
if (alpha > 255)
|
||||
alpha = 255;
|
||||
if (alpha >= 0)
|
||||
render_container_add_rect(container, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
container->add_rect(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
}
|
||||
|
||||
/* render any cheat stuff at the bottom */
|
||||
@ -422,17 +422,14 @@ render_font *ui_get_font(void)
|
||||
of a line
|
||||
-------------------------------------------------*/
|
||||
|
||||
float ui_get_line_height(void)
|
||||
float ui_get_line_height(running_machine &machine)
|
||||
{
|
||||
INT32 raw_font_pixel_height = render_font_get_pixel_height(ui_font);
|
||||
INT32 target_pixel_width, target_pixel_height;
|
||||
render_target &ui_target = machine.render().ui_target();
|
||||
INT32 target_pixel_height = ui_target.height();
|
||||
float one_to_one_line_height;
|
||||
float target_aspect;
|
||||
float scale_factor;
|
||||
|
||||
/* get info about the UI target */
|
||||
render_target_get_bounds(render_get_ui_target(), &target_pixel_width, &target_pixel_height, &target_aspect);
|
||||
|
||||
/* compute the font pixel height at the nominal size */
|
||||
one_to_one_line_height = (float)raw_font_pixel_height / (float)target_pixel_height;
|
||||
|
||||
@ -470,9 +467,9 @@ float ui_get_line_height(void)
|
||||
single character
|
||||
-------------------------------------------------*/
|
||||
|
||||
float ui_get_char_width(unicode_char ch)
|
||||
float ui_get_char_width(running_machine &machine, unicode_char ch)
|
||||
{
|
||||
return render_font_get_char_width(ui_font, ui_get_line_height(), render_get_ui_aspect(), ch);
|
||||
return render_font_get_char_width(ui_font, ui_get_line_height(machine), machine.render().ui_aspect(), ch);
|
||||
}
|
||||
|
||||
|
||||
@ -481,9 +478,9 @@ float ui_get_char_width(unicode_char ch)
|
||||
character string
|
||||
-------------------------------------------------*/
|
||||
|
||||
float ui_get_string_width(const char *s)
|
||||
float ui_get_string_width(running_machine &machine, const char *s)
|
||||
{
|
||||
return render_font_get_utf8string_width(ui_font, ui_get_line_height(), render_get_ui_aspect(), s);
|
||||
return render_font_get_utf8string_width(ui_font, ui_get_line_height(machine), machine.render().ui_aspect(), s);
|
||||
}
|
||||
|
||||
|
||||
@ -495,11 +492,11 @@ float ui_get_string_width(const char *s)
|
||||
|
||||
void ui_draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor)
|
||||
{
|
||||
render_container_add_rect(container, x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
render_container_add_line(container, x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
render_container_add_line(container, x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
render_container_add_line(container, x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
render_container_add_line(container, x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
container->add_rect(x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
container->add_line(x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
container->add_line(x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
container->add_line(x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
container->add_line(x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
}
|
||||
|
||||
|
||||
@ -521,7 +518,8 @@ void ui_draw_text(render_container *container, const char *buf, float x, float y
|
||||
|
||||
void ui_draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight)
|
||||
{
|
||||
float lineheight = ui_get_line_height();
|
||||
running_machine &machine = container->manager().machine();
|
||||
float lineheight = ui_get_line_height(machine);
|
||||
const char *ends = origs + strlen(origs);
|
||||
float wrapwidth = origwrapwidth;
|
||||
const char *s = origs;
|
||||
@ -576,7 +574,7 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
|
||||
break;
|
||||
|
||||
/* get the width of this character */
|
||||
chwidth = ui_get_char_width(schar);
|
||||
chwidth = ui_get_char_width(machine, schar);
|
||||
|
||||
/* if we hit a space, remember the location and width *without* the space */
|
||||
if (schar == ' ')
|
||||
@ -620,7 +618,7 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
|
||||
if (scharcount == -1)
|
||||
break;
|
||||
|
||||
curwidth -= ui_get_char_width(schar);
|
||||
curwidth -= ui_get_char_width(machine, schar);
|
||||
}
|
||||
}
|
||||
|
||||
@ -628,7 +626,7 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
|
||||
else if (wrap == WRAP_TRUNCATE)
|
||||
{
|
||||
/* add in the width of the ... */
|
||||
curwidth += 3.0f * ui_get_char_width('.');
|
||||
curwidth += 3.0f * ui_get_char_width(machine, '.');
|
||||
|
||||
/* while we are above the wrap width, back up one character */
|
||||
while (curwidth > wrapwidth && s > linestart)
|
||||
@ -639,7 +637,7 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
|
||||
if (scharcount == -1)
|
||||
break;
|
||||
|
||||
curwidth -= ui_get_char_width(schar);
|
||||
curwidth -= ui_get_char_width(machine, schar);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -656,7 +654,7 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
|
||||
|
||||
/* if opaque, add a black box */
|
||||
if (draw == DRAW_OPAQUE)
|
||||
render_container_add_rect(container, curx, cury, curx + curwidth, cury + lineheight, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
container->add_rect(curx, cury, curx + curwidth, cury + lineheight, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
|
||||
/* loop from the line start and add the characters */
|
||||
while (linestart < s)
|
||||
@ -669,8 +667,8 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
|
||||
|
||||
if (draw != DRAW_NONE)
|
||||
{
|
||||
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, linechar);
|
||||
curx += ui_get_char_width(linechar);
|
||||
container->add_char(curx, cury, lineheight, machine.render().ui_aspect(), fgcolor, *ui_font, linechar);
|
||||
curx += ui_get_char_width(machine, linechar);
|
||||
}
|
||||
linestart += linecharcount;
|
||||
}
|
||||
@ -678,12 +676,12 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
|
||||
/* append ellipses if needed */
|
||||
if (wrap == WRAP_TRUNCATE && *s != 0 && draw != DRAW_NONE)
|
||||
{
|
||||
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
|
||||
curx += ui_get_char_width('.');
|
||||
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
|
||||
curx += ui_get_char_width('.');
|
||||
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
|
||||
curx += ui_get_char_width('.');
|
||||
container->add_char(curx, cury, lineheight, machine.render().ui_aspect(), fgcolor, *ui_font, '.');
|
||||
curx += ui_get_char_width(machine, '.');
|
||||
container->add_char(curx, cury, lineheight, machine.render().ui_aspect(), fgcolor, *ui_font, '.');
|
||||
curx += ui_get_char_width(machine, '.');
|
||||
container->add_char(curx, cury, lineheight, machine.render().ui_aspect(), fgcolor, *ui_font, '.');
|
||||
curx += ui_get_char_width(machine, '.');
|
||||
}
|
||||
|
||||
/* if we're not word-wrapping, we're done */
|
||||
@ -732,7 +730,7 @@ void ui_draw_text_box(render_container *container, const char *text, int justify
|
||||
ui_draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER,
|
||||
justify, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height);
|
||||
if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER)
|
||||
target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / ui_get_line_height()) * ui_get_line_height();
|
||||
target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / ui_get_line_height(container->manager().machine())) * ui_get_line_height(container->manager().machine());
|
||||
|
||||
/* determine the target location */
|
||||
target_x = xpos - 0.5f * target_width;
|
||||
@ -1848,18 +1846,17 @@ static INT32 slider_refresh(running_machine *machine, void *arg, astring *string
|
||||
static INT32 slider_brightness(running_machine *machine, void *arg, astring *string, INT32 newval)
|
||||
{
|
||||
screen_device *screen = reinterpret_cast<screen_device *>(arg);
|
||||
render_container *container = render_container_get_screen(screen);
|
||||
render_container_user_settings settings;
|
||||
render_container::user_settings settings;
|
||||
|
||||
render_container_get_user_settings(container, &settings);
|
||||
screen->container().get_user_settings(settings);
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
settings.brightness = (float)newval * 0.001f;
|
||||
render_container_set_user_settings(container, &settings);
|
||||
settings.m_brightness = (float)newval * 0.001f;
|
||||
screen->container().set_user_settings(settings);
|
||||
}
|
||||
if (string != NULL)
|
||||
string->printf("%.3f", settings.brightness);
|
||||
return floor(settings.brightness * 1000.0f + 0.5f);
|
||||
string->printf("%.3f", settings.m_brightness);
|
||||
return floor(settings.m_brightness * 1000.0f + 0.5f);
|
||||
}
|
||||
|
||||
|
||||
@ -1871,18 +1868,17 @@ static INT32 slider_brightness(running_machine *machine, void *arg, astring *str
|
||||
static INT32 slider_contrast(running_machine *machine, void *arg, astring *string, INT32 newval)
|
||||
{
|
||||
screen_device *screen = reinterpret_cast<screen_device *>(arg);
|
||||
render_container *container = render_container_get_screen(screen);
|
||||
render_container_user_settings settings;
|
||||
render_container::user_settings settings;
|
||||
|
||||
render_container_get_user_settings(container, &settings);
|
||||
screen->container().get_user_settings(settings);
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
settings.contrast = (float)newval * 0.001f;
|
||||
render_container_set_user_settings(container, &settings);
|
||||
settings.m_contrast = (float)newval * 0.001f;
|
||||
screen->container().set_user_settings(settings);
|
||||
}
|
||||
if (string != NULL)
|
||||
string->printf("%.3f", settings.contrast);
|
||||
return floor(settings.contrast * 1000.0f + 0.5f);
|
||||
string->printf("%.3f", settings.m_contrast);
|
||||
return floor(settings.m_contrast * 1000.0f + 0.5f);
|
||||
}
|
||||
|
||||
|
||||
@ -1893,18 +1889,17 @@ static INT32 slider_contrast(running_machine *machine, void *arg, astring *strin
|
||||
static INT32 slider_gamma(running_machine *machine, void *arg, astring *string, INT32 newval)
|
||||
{
|
||||
screen_device *screen = reinterpret_cast<screen_device *>(arg);
|
||||
render_container *container = render_container_get_screen(screen);
|
||||
render_container_user_settings settings;
|
||||
render_container::user_settings settings;
|
||||
|
||||
render_container_get_user_settings(container, &settings);
|
||||
screen->container().get_user_settings(settings);
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
settings.gamma = (float)newval * 0.001f;
|
||||
render_container_set_user_settings(container, &settings);
|
||||
settings.m_gamma = (float)newval * 0.001f;
|
||||
screen->container().set_user_settings(settings);
|
||||
}
|
||||
if (string != NULL)
|
||||
string->printf("%.3f", settings.gamma);
|
||||
return floor(settings.gamma * 1000.0f + 0.5f);
|
||||
string->printf("%.3f", settings.m_gamma);
|
||||
return floor(settings.m_gamma * 1000.0f + 0.5f);
|
||||
}
|
||||
|
||||
|
||||
@ -1916,18 +1911,17 @@ static INT32 slider_gamma(running_machine *machine, void *arg, astring *string,
|
||||
static INT32 slider_xscale(running_machine *machine, void *arg, astring *string, INT32 newval)
|
||||
{
|
||||
screen_device *screen = reinterpret_cast<screen_device *>(arg);
|
||||
render_container *container = render_container_get_screen(screen);
|
||||
render_container_user_settings settings;
|
||||
render_container::user_settings settings;
|
||||
|
||||
render_container_get_user_settings(container, &settings);
|
||||
screen->container().get_user_settings(settings);
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
settings.xscale = (float)newval * 0.001f;
|
||||
render_container_set_user_settings(container, &settings);
|
||||
settings.m_xscale = (float)newval * 0.001f;
|
||||
screen->container().set_user_settings(settings);
|
||||
}
|
||||
if (string != NULL)
|
||||
string->printf("%.3f", settings.xscale);
|
||||
return floor(settings.xscale * 1000.0f + 0.5f);
|
||||
string->printf("%.3f", settings.m_xscale);
|
||||
return floor(settings.m_xscale * 1000.0f + 0.5f);
|
||||
}
|
||||
|
||||
|
||||
@ -1939,18 +1933,17 @@ static INT32 slider_xscale(running_machine *machine, void *arg, astring *string,
|
||||
static INT32 slider_yscale(running_machine *machine, void *arg, astring *string, INT32 newval)
|
||||
{
|
||||
screen_device *screen = reinterpret_cast<screen_device *>(arg);
|
||||
render_container *container = render_container_get_screen(screen);
|
||||
render_container_user_settings settings;
|
||||
render_container::user_settings settings;
|
||||
|
||||
render_container_get_user_settings(container, &settings);
|
||||
screen->container().get_user_settings(settings);
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
settings.yscale = (float)newval * 0.001f;
|
||||
render_container_set_user_settings(container, &settings);
|
||||
settings.m_yscale = (float)newval * 0.001f;
|
||||
screen->container().set_user_settings(settings);
|
||||
}
|
||||
if (string != NULL)
|
||||
string->printf("%.3f", settings.yscale);
|
||||
return floor(settings.yscale * 1000.0f + 0.5f);
|
||||
string->printf("%.3f", settings.m_yscale);
|
||||
return floor(settings.m_yscale * 1000.0f + 0.5f);
|
||||
}
|
||||
|
||||
|
||||
@ -1962,18 +1955,17 @@ static INT32 slider_yscale(running_machine *machine, void *arg, astring *string,
|
||||
static INT32 slider_xoffset(running_machine *machine, void *arg, astring *string, INT32 newval)
|
||||
{
|
||||
screen_device *screen = reinterpret_cast<screen_device *>(arg);
|
||||
render_container *container = render_container_get_screen(screen);
|
||||
render_container_user_settings settings;
|
||||
render_container::user_settings settings;
|
||||
|
||||
render_container_get_user_settings(container, &settings);
|
||||
screen->container().get_user_settings(settings);
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
settings.xoffset = (float)newval * 0.001f;
|
||||
render_container_set_user_settings(container, &settings);
|
||||
settings.m_xoffset = (float)newval * 0.001f;
|
||||
screen->container().set_user_settings(settings);
|
||||
}
|
||||
if (string != NULL)
|
||||
string->printf("%.3f", settings.xoffset);
|
||||
return floor(settings.xoffset * 1000.0f + 0.5f);
|
||||
string->printf("%.3f", settings.m_xoffset);
|
||||
return floor(settings.m_xoffset * 1000.0f + 0.5f);
|
||||
}
|
||||
|
||||
|
||||
@ -1985,18 +1977,17 @@ static INT32 slider_xoffset(running_machine *machine, void *arg, astring *string
|
||||
static INT32 slider_yoffset(running_machine *machine, void *arg, astring *string, INT32 newval)
|
||||
{
|
||||
screen_device *screen = reinterpret_cast<screen_device *>(arg);
|
||||
render_container *container = render_container_get_screen(screen);
|
||||
render_container_user_settings settings;
|
||||
render_container::user_settings settings;
|
||||
|
||||
render_container_get_user_settings(container, &settings);
|
||||
screen->container().get_user_settings(settings);
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
settings.yoffset = (float)newval * 0.001f;
|
||||
render_container_set_user_settings(container, &settings);
|
||||
settings.m_yoffset = (float)newval * 0.001f;
|
||||
screen->container().set_user_settings(settings);
|
||||
}
|
||||
if (string != NULL)
|
||||
string->printf("%.3f", settings.yoffset);
|
||||
return floor(settings.yoffset * 1000.0f + 0.5f);
|
||||
string->printf("%.3f", settings.m_yoffset);
|
||||
return floor(settings.m_yoffset * 1000.0f + 0.5f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,11 +136,11 @@ void ui_update_and_render(running_machine *machine, render_container *container)
|
||||
render_font *ui_get_font(void);
|
||||
|
||||
/* returns the line height of the font used by the UI system */
|
||||
float ui_get_line_height(void);
|
||||
float ui_get_line_height(running_machine &machine);
|
||||
|
||||
/* returns the width of a character or string in the UI font */
|
||||
float ui_get_char_width(unicode_char ch);
|
||||
float ui_get_string_width(const char *s);
|
||||
float ui_get_char_width(running_machine &machine, unicode_char ch);
|
||||
float ui_get_string_width(running_machine &machine, const char *s);
|
||||
|
||||
/* draw an outlined box filled with a given color */
|
||||
void ui_draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor);
|
||||
|
@ -136,8 +136,7 @@ void ui_gfx_init(running_machine *machine)
|
||||
static void ui_gfx_exit(running_machine &machine)
|
||||
{
|
||||
/* free the texture */
|
||||
if (ui_gfx.texture != NULL)
|
||||
render_texture_free(ui_gfx.texture);
|
||||
machine.render().texture_free(ui_gfx.texture);
|
||||
ui_gfx.texture = NULL;
|
||||
|
||||
/* free the bitmap */
|
||||
@ -253,8 +252,8 @@ static void palette_handler(running_machine *machine, render_container *containe
|
||||
int x, y, skip;
|
||||
|
||||
/* add a half character padding for the box */
|
||||
chheight = ui_get_line_height();
|
||||
chwidth = render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), '0');
|
||||
chheight = ui_get_line_height(*machine);
|
||||
chwidth = render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), '0');
|
||||
boxbounds.x0 = 0.0f + 0.5f * chwidth;
|
||||
boxbounds.x1 = 1.0f - 0.5f * chwidth;
|
||||
boxbounds.y0 = 0.0f + 0.5f * chheight;
|
||||
@ -274,7 +273,7 @@ static void palette_handler(running_machine *machine, render_container *containe
|
||||
cellboxbounds.y0 += 3.0f * chheight;
|
||||
|
||||
/* figure out the title and expand the outer box to fit */
|
||||
titlewidth = render_font_get_string_width(ui_font, chheight, render_get_ui_aspect(), title);
|
||||
titlewidth = render_font_get_string_width(ui_font, chheight, machine->render().ui_aspect(), title);
|
||||
x0 = 0.0f;
|
||||
if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth)
|
||||
x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth));
|
||||
@ -287,8 +286,8 @@ static void palette_handler(running_machine *machine, render_container *containe
|
||||
y0 = boxbounds.y0 + 0.5f * chheight;
|
||||
for (x = 0; title[x] != 0; x++)
|
||||
{
|
||||
render_container_add_char(container, x0, y0, chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, title[x]);
|
||||
x0 += render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), title[x]);
|
||||
container->add_char(x0, y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]);
|
||||
x0 += render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), title[x]);
|
||||
}
|
||||
|
||||
/* compute the cell size */
|
||||
@ -301,12 +300,12 @@ static void palette_handler(running_machine *machine, render_container *containe
|
||||
{
|
||||
x0 = boxbounds.x0 + 6.0f * chwidth + (float)x * cellwidth;
|
||||
y0 = boxbounds.y0 + 2.0f * chheight;
|
||||
render_container_add_char(container, x0 + 0.5f * (cellwidth - chwidth), y0, chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, "0123456789ABCDEF"[x & 0xf]);
|
||||
container->add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, "0123456789ABCDEF"[x & 0xf]);
|
||||
|
||||
/* if we're skipping, draw a point between the character and the box to indicate which */
|
||||
/* one it's referring to */
|
||||
if (skip != 0)
|
||||
render_container_add_point(container, x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + cellboxbounds.y0), UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
container->add_point(x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + cellboxbounds.y0), UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
}
|
||||
|
||||
/* draw the side column headers */
|
||||
@ -323,14 +322,14 @@ static void palette_handler(running_machine *machine, render_container *containe
|
||||
x0 = boxbounds.x0 + 5.5f * chwidth;
|
||||
y0 = boxbounds.y0 + 3.5f * chheight + (float)y * cellheight;
|
||||
if (skip != 0)
|
||||
render_container_add_point(container, 0.5f * (x0 + cellboxbounds.x0), y0 + 0.5f * cellheight, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
container->add_point(0.5f * (x0 + cellboxbounds.x0), y0 + 0.5f * cellheight, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
|
||||
/* draw the row header */
|
||||
sprintf(buffer, "%5X", state->palette.offset + y * state->palette.count);
|
||||
for (x = 4; x >= 0; x--)
|
||||
{
|
||||
x0 -= render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), buffer[x]);
|
||||
render_container_add_char(container, x0, y0 + 0.5f * (cellheight - chheight), chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, buffer[x]);
|
||||
x0 -= render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), buffer[x]);
|
||||
container->add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, buffer[x]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -342,7 +341,7 @@ static void palette_handler(running_machine *machine, render_container *containe
|
||||
if (index < total)
|
||||
{
|
||||
pen_t pen = state->palette.which ? colortable_palette_get_color(machine->colortable, index) : raw_color[index];
|
||||
render_container_add_rect(container, cellboxbounds.x0 + x * cellwidth, cellboxbounds.y0 + y * cellheight,
|
||||
container->add_rect(cellboxbounds.x0 + x * cellwidth, cellboxbounds.y0 + y * cellheight,
|
||||
cellboxbounds.x0 + (x + 1) * cellwidth, cellboxbounds.y0 + (y + 1) * cellheight,
|
||||
0xff000000 | pen, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
}
|
||||
@ -440,19 +439,17 @@ static void gfxset_handler(running_machine *machine, render_container *container
|
||||
render_bounds cellboxbounds;
|
||||
render_bounds boxbounds;
|
||||
int cellboxwidth, cellboxheight;
|
||||
int targwidth, targheight;
|
||||
int targwidth = machine->render().ui_target().width();
|
||||
int targheight = machine->render().ui_target().height();
|
||||
int cellxpix, cellypix;
|
||||
int xcells, ycells;
|
||||
int pixelscale = 0;
|
||||
int x, y, skip;
|
||||
char title[100];
|
||||
|
||||
/* get the bounds of our target */
|
||||
render_target_get_bounds(render_get_ui_target(), &targwidth, &targheight, NULL);
|
||||
|
||||
/* add a half character padding for the box */
|
||||
chheight = ui_get_line_height();
|
||||
chwidth = render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), '0');
|
||||
chheight = ui_get_line_height(*machine);
|
||||
chwidth = render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), '0');
|
||||
boxbounds.x0 = 0.0f + 0.5f * chwidth;
|
||||
boxbounds.x1 = 1.0f - 0.5f * chwidth;
|
||||
boxbounds.y0 = 0.0f + 0.5f * chheight;
|
||||
@ -517,7 +514,7 @@ static void gfxset_handler(running_machine *machine, render_container *container
|
||||
/* figure out the title and expand the outer box to fit */
|
||||
for (x = 0; x < MAX_GFX_ELEMENTS && machine->gfx[x] != NULL; x++) ;
|
||||
sprintf(title, "GFX %d/%d %dx%d COLOR %X", state->gfxset.set, x - 1, gfx->width, gfx->height, state->gfxset.color[set]);
|
||||
titlewidth = render_font_get_string_width(ui_font, chheight, render_get_ui_aspect(), title);
|
||||
titlewidth = render_font_get_string_width(ui_font, chheight, machine->render().ui_aspect(), title);
|
||||
x0 = 0.0f;
|
||||
if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth)
|
||||
x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth));
|
||||
@ -530,8 +527,8 @@ static void gfxset_handler(running_machine *machine, render_container *container
|
||||
y0 = boxbounds.y0 + 0.5f * chheight;
|
||||
for (x = 0; title[x] != 0; x++)
|
||||
{
|
||||
render_container_add_char(container, x0, y0, chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, title[x]);
|
||||
x0 += render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), title[x]);
|
||||
container->add_char(x0, y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]);
|
||||
x0 += render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), title[x]);
|
||||
}
|
||||
|
||||
/* draw the top column headers */
|
||||
@ -540,12 +537,12 @@ static void gfxset_handler(running_machine *machine, render_container *container
|
||||
{
|
||||
x0 = boxbounds.x0 + 6.0f * chwidth + (float)x * cellwidth;
|
||||
y0 = boxbounds.y0 + 2.0f * chheight;
|
||||
render_container_add_char(container, x0 + 0.5f * (cellwidth - chwidth), y0, chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, "0123456789ABCDEF"[x & 0xf]);
|
||||
container->add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, "0123456789ABCDEF"[x & 0xf]);
|
||||
|
||||
/* if we're skipping, draw a point between the character and the box to indicate which */
|
||||
/* one it's referring to */
|
||||
if (skip != 0)
|
||||
render_container_add_point(container, x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + boxbounds.y0 + 3.5f * chheight), UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
container->add_point(x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + boxbounds.y0 + 3.5f * chheight), UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
}
|
||||
|
||||
/* draw the side column headers */
|
||||
@ -562,14 +559,14 @@ static void gfxset_handler(running_machine *machine, render_container *container
|
||||
x0 = boxbounds.x0 + 5.5f * chwidth;
|
||||
y0 = boxbounds.y0 + 3.5f * chheight + (float)y * cellheight;
|
||||
if (skip != 0)
|
||||
render_container_add_point(container, 0.5f * (x0 + boxbounds.x0 + 6.0f * chwidth), y0 + 0.5f * cellheight, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
container->add_point(0.5f * (x0 + boxbounds.x0 + 6.0f * chwidth), y0 + 0.5f * cellheight, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
|
||||
/* draw the row header */
|
||||
sprintf(buffer, "%5X", state->gfxset.offset[set] + y * xcells);
|
||||
for (x = 4; x >= 0; x--)
|
||||
{
|
||||
x0 -= render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), buffer[x]);
|
||||
render_container_add_char(container, x0, y0 + 0.5f * (cellheight - chheight), chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, buffer[x]);
|
||||
x0 -= render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), buffer[x]);
|
||||
container->add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, buffer[x]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -577,7 +574,7 @@ static void gfxset_handler(running_machine *machine, render_container *container
|
||||
gfxset_update_bitmap(machine, state, xcells, ycells, gfx);
|
||||
|
||||
/* add the final quad */
|
||||
render_container_add_quad(container, boxbounds.x0 + 6.0f * chwidth, boxbounds.y0 + 3.5f * chheight,
|
||||
container->add_quad(boxbounds.x0 + 6.0f * chwidth, boxbounds.y0 + 3.5f * chheight,
|
||||
boxbounds.x0 + 6.0f * chwidth + (float)cellboxwidth / (float)targwidth,
|
||||
boxbounds.y0 + 3.5f * chheight + (float)cellboxheight / (float)targheight,
|
||||
ARGB_WHITE, state->texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
@ -699,14 +696,13 @@ static void gfxset_update_bitmap(running_machine *machine, ui_gfx_state *state,
|
||||
if (state->bitmap == NULL || state->texture == NULL || state->bitmap->bpp != 32 || state->bitmap->width != cellxpix * xcells || state->bitmap->height != cellypix * ycells)
|
||||
{
|
||||
/* free the old stuff */
|
||||
if (state->texture != NULL)
|
||||
render_texture_free(state->texture);
|
||||
machine->render().texture_free(state->texture);
|
||||
global_free(state->bitmap);
|
||||
|
||||
/* allocate new stuff */
|
||||
state->bitmap = global_alloc(bitmap_t(cellxpix * xcells, cellypix * ycells, BITMAP_FORMAT_ARGB32));
|
||||
state->texture = render_texture_alloc(NULL, NULL);
|
||||
render_texture_set_bitmap(state->texture, state->bitmap, NULL, TEXFORMAT_ARGB32, NULL);
|
||||
state->texture = machine->render().texture_alloc();
|
||||
state->texture->set_bitmap(state->bitmap, NULL, TEXFORMAT_ARGB32);
|
||||
|
||||
/* force a redraw */
|
||||
state->bitmap_dirty = TRUE;
|
||||
@ -754,7 +750,7 @@ static void gfxset_update_bitmap(running_machine *machine, ui_gfx_state *state,
|
||||
}
|
||||
|
||||
/* reset the texture to force an update */
|
||||
render_texture_set_bitmap(state->texture, state->bitmap, NULL, TEXFORMAT_ARGB32, NULL);
|
||||
state->texture->set_bitmap(state->bitmap, NULL, TEXFORMAT_ARGB32);
|
||||
state->bitmap_dirty = FALSE;
|
||||
}
|
||||
}
|
||||
@ -848,7 +844,8 @@ static void tilemap_handler(running_machine *machine, render_container *containe
|
||||
float chwidth, chheight;
|
||||
render_bounds mapboxbounds;
|
||||
render_bounds boxbounds;
|
||||
int targwidth, targheight;
|
||||
int targwidth = machine->render().ui_target().width();
|
||||
int targheight = machine->render().ui_target().height();
|
||||
float titlewidth;
|
||||
float x0, y0;
|
||||
int mapboxwidth, mapboxheight;
|
||||
@ -857,17 +854,14 @@ static void tilemap_handler(running_machine *machine, render_container *containe
|
||||
int x, pixelscale;
|
||||
char title[100];
|
||||
|
||||
/* get the bounds of our target */
|
||||
render_target_get_bounds(render_get_ui_target(), &targwidth, &targheight, NULL);
|
||||
|
||||
/* get the size of the tilemap itself */
|
||||
tilemap_size_by_index(machine, state->tilemap.which, &mapwidth, &mapheight);
|
||||
if (state->tilemap.rotate & ORIENTATION_SWAP_XY)
|
||||
{ UINT32 temp = mapwidth; mapwidth = mapheight; mapheight = temp; }
|
||||
|
||||
/* add a half character padding for the box */
|
||||
chheight = ui_get_line_height();
|
||||
chwidth = render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), '0');
|
||||
chheight = ui_get_line_height(*machine);
|
||||
chwidth = render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), '0');
|
||||
boxbounds.x0 = 0.0f + 0.5f * chwidth;
|
||||
boxbounds.x1 = 1.0f - 0.5f * chwidth;
|
||||
boxbounds.y0 = 0.0f + 0.5f * chheight;
|
||||
@ -914,7 +908,7 @@ static void tilemap_handler(running_machine *machine, render_container *containe
|
||||
|
||||
/* figure out the title and expand the outer box to fit */
|
||||
sprintf(title, "TMAP %d/%d %dx%d OFFS %d,%d", state->tilemap.which, tilemap_count(machine) - 1, mapwidth, mapheight, state->tilemap.xoffs, state->tilemap.yoffs);
|
||||
titlewidth = render_font_get_string_width(ui_font, chheight, render_get_ui_aspect(), title);
|
||||
titlewidth = render_font_get_string_width(ui_font, chheight, machine->render().ui_aspect(), title);
|
||||
if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth)
|
||||
{
|
||||
boxbounds.x0 = 0.5f - 0.5f * (titlewidth + chwidth);
|
||||
@ -929,15 +923,15 @@ static void tilemap_handler(running_machine *machine, render_container *containe
|
||||
y0 = boxbounds.y0 + 0.5f * chheight;
|
||||
for (x = 0; title[x] != 0; x++)
|
||||
{
|
||||
render_container_add_char(container, x0, y0, chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, title[x]);
|
||||
x0 += render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), title[x]);
|
||||
container->add_char(x0, y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]);
|
||||
x0 += render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), title[x]);
|
||||
}
|
||||
|
||||
/* update the bitmap */
|
||||
tilemap_update_bitmap(machine, state, mapboxwidth / pixelscale, mapboxheight / pixelscale);
|
||||
|
||||
/* add the final quad */
|
||||
render_container_add_quad(container, mapboxbounds.x0, mapboxbounds.y0,
|
||||
container->add_quad(mapboxbounds.x0, mapboxbounds.y0,
|
||||
mapboxbounds.x1, mapboxbounds.y1,
|
||||
ARGB_WHITE, state->texture,
|
||||
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(state->tilemap.rotate));
|
||||
@ -1058,14 +1052,13 @@ static void tilemap_update_bitmap(running_machine *machine, ui_gfx_state *state,
|
||||
if (state->bitmap == NULL || state->texture == NULL || state->bitmap->format != screen_format || state->bitmap->width != width || state->bitmap->height != height)
|
||||
{
|
||||
/* free the old stuff */
|
||||
if (state->texture != NULL)
|
||||
render_texture_free(state->texture);
|
||||
machine->render().texture_free(state->texture);
|
||||
global_free(state->bitmap);
|
||||
|
||||
/* allocate new stuff */
|
||||
state->bitmap = global_alloc(bitmap_t(width, height, screen_format));
|
||||
state->texture = render_texture_alloc(NULL, NULL);
|
||||
render_texture_set_bitmap(state->texture, state->bitmap, NULL, screen_texformat, palette);
|
||||
state->texture = machine->render().texture_alloc();
|
||||
state->texture->set_bitmap(state->bitmap, NULL, screen_texformat, palette);
|
||||
|
||||
/* force a redraw */
|
||||
state->bitmap_dirty = TRUE;
|
||||
@ -1077,7 +1070,7 @@ static void tilemap_update_bitmap(running_machine *machine, ui_gfx_state *state,
|
||||
tilemap_draw_by_index(machine, state->bitmap, state->tilemap.which, state->tilemap.xoffs, state->tilemap.yoffs);
|
||||
|
||||
/* reset the texture to force an update */
|
||||
render_texture_set_bitmap(state->texture, state->bitmap, NULL, screen_texformat, palette);
|
||||
state->texture->set_bitmap(state->bitmap, NULL, screen_texformat, palette);
|
||||
state->bitmap_dirty = FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -147,14 +147,14 @@ static void input_character(char *buffer, size_t buffer_length, unicode_char uni
|
||||
or footer text
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void extra_text_draw_box(float origx1, float origx2, float origy, float yspan, const char *text, int direction)
|
||||
static void extra_text_draw_box(render_container &ui_container, float origx1, float origx2, float origy, float yspan, const char *text, int direction)
|
||||
{
|
||||
float text_width, text_height;
|
||||
float width, maxwidth;
|
||||
float x1, y1, x2, y2, temp;
|
||||
|
||||
/* get the size of the text */
|
||||
ui_draw_text_full( render_container_get_ui(),text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD,
|
||||
ui_draw_text_full(&ui_container,text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD,
|
||||
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &text_width, &text_height);
|
||||
width = text_width + (2 * UI_BOX_LR_BORDER);
|
||||
maxwidth = MAX(width, origx2 - origx1);
|
||||
@ -173,7 +173,7 @@ static void extra_text_draw_box(float origx1, float origx2, float origy, float y
|
||||
}
|
||||
|
||||
/* draw a box */
|
||||
ui_draw_outlined_box(render_container_get_ui(),x1, y1, x2, y2, UI_BACKGROUND_COLOR);
|
||||
ui_draw_outlined_box(&ui_container,x1, y1, x2, y2, UI_BACKGROUND_COLOR);
|
||||
|
||||
/* take off the borders */
|
||||
x1 += UI_BOX_LR_BORDER;
|
||||
@ -182,7 +182,7 @@ static void extra_text_draw_box(float origx1, float origx2, float origy, float y
|
||||
y2 -= UI_BOX_TB_BORDER;
|
||||
|
||||
/* draw the text within it */
|
||||
ui_draw_text_full(render_container_get_ui(),text, x1, y1, text_width, JUSTIFY_LEFT, WRAP_WORD,
|
||||
ui_draw_text_full(&ui_container,text, x1, y1, text_width, JUSTIFY_LEFT, WRAP_WORD,
|
||||
DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
|
||||
}
|
||||
|
||||
@ -201,9 +201,9 @@ static void extra_text_render(running_machine *machine, ui_menu *menu, void *sta
|
||||
footer = ((footer != NULL) && (footer[0] != '\0')) ? footer : NULL;
|
||||
|
||||
if (header != NULL)
|
||||
extra_text_draw_box(origx1, origx2, origy1, top, header, -1);
|
||||
extra_text_draw_box(machine->render().ui_container(), origx1, origx2, origy1, top, header, -1);
|
||||
if (footer != NULL)
|
||||
extra_text_draw_box(origx1, origx2, origy2, bottom, footer, +1);
|
||||
extra_text_draw_box(machine->render().ui_container(), origx1, origx2, origy2, bottom, footer, +1);
|
||||
}
|
||||
|
||||
|
||||
@ -338,7 +338,7 @@ static void menu_file_create_populate(running_machine *machine, ui_menu *menu, v
|
||||
ui_menu_item_append(menu, "Create", NULL, 0, ITEMREF_CREATE);
|
||||
|
||||
/* set up custom render proc */
|
||||
ui_menu_set_custom_render(menu, file_create_render_extra, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 0);
|
||||
ui_menu_set_custom_render(menu, file_create_render_extra, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -379,7 +379,7 @@ static int create_new_image(device_image_interface *image, const char *directory
|
||||
|
||||
case ENTTYPE_FILE:
|
||||
/* a file exists here - ask for permission from the user */
|
||||
child_menu = ui_menu_alloc(image->device().machine, render_container_get_ui(), menu_confirm_save_as, NULL);
|
||||
child_menu = ui_menu_alloc(image->device().machine, &image->device().machine->render().ui_container(), menu_confirm_save_as, NULL);
|
||||
child_menustate = (confirm_save_as_menu_state*)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL);
|
||||
child_menustate->yes = yes;
|
||||
ui_menu_stack_push(child_menu);
|
||||
@ -742,7 +742,7 @@ static file_error menu_file_selector_populate(running_machine *machine, ui_menu
|
||||
ui_menu_set_selection(menu, (void *) selected_entry);
|
||||
|
||||
/* set up custom render proc */
|
||||
ui_menu_set_custom_render(menu, file_selector_render_extra, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 0);
|
||||
ui_menu_set_custom_render(menu, file_selector_render_extra, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER, 0);
|
||||
|
||||
done:
|
||||
if (directory != NULL)
|
||||
@ -811,13 +811,13 @@ static void menu_file_selector(running_machine *machine, ui_menu *menu, void *pa
|
||||
|
||||
case SELECTOR_ENTRY_TYPE_CREATE:
|
||||
/* create */
|
||||
child_menu = ui_menu_alloc(machine, render_container_get_ui(), menu_file_create, NULL);
|
||||
child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), menu_file_create, NULL);
|
||||
child_menustate = (file_create_menu_state*)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL);
|
||||
child_menustate->manager_menustate = menustate->manager_menustate;
|
||||
ui_menu_stack_push(child_menu);
|
||||
break;
|
||||
case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST:
|
||||
child_menu = ui_menu_alloc(machine, render_container_get_ui(), ui_image_menu_software, menustate->manager_menustate->selected_device);
|
||||
child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), ui_image_menu_software, menustate->manager_menustate->selected_device);
|
||||
ui_menu_stack_push(child_menu);
|
||||
break;
|
||||
case SELECTOR_ENTRY_TYPE_DRIVE:
|
||||
@ -919,7 +919,7 @@ static void menu_file_manager_populate(running_machine *machine, ui_menu *menu,
|
||||
}
|
||||
|
||||
/* set up custom render proc */
|
||||
ui_menu_set_custom_render(menu, file_manager_render_extra, 0, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER);
|
||||
ui_menu_set_custom_render(menu, file_manager_render_extra, 0, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER);
|
||||
}
|
||||
|
||||
|
||||
@ -988,7 +988,7 @@ void ui_image_menu_file_manager(running_machine *machine, ui_menu *menu, void *p
|
||||
ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_POSITION);
|
||||
|
||||
/* push the menu */
|
||||
child_menu = ui_menu_alloc(machine, render_container_get_ui(), menu_file_selector, NULL);
|
||||
child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), menu_file_selector, NULL);
|
||||
child_menustate = (file_selector_menu_state *)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL);
|
||||
child_menustate->manager_menustate = menustate;
|
||||
ui_menu_stack_push(child_menu);
|
||||
|
163
src/emu/uimenu.c
163
src/emu/uimenu.c
@ -80,9 +80,14 @@ enum
|
||||
enum
|
||||
{
|
||||
VIDEO_ITEM_ROTATE = 0x80000000,
|
||||
VIDEO_ITEM_BACKDROPS,
|
||||
VIDEO_ITEM_OVERLAYS,
|
||||
VIDEO_ITEM_BEZELS,
|
||||
VIDEO_ITEM_ZOOM,
|
||||
VIDEO_ITEM_VIEW
|
||||
};
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
CROSSHAIR_ITEM_VIS = 0,
|
||||
@ -300,7 +305,7 @@ static void menu_select_game_build_driver_list(ui_menu *menu, select_game_state
|
||||
static void menu_select_game_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
|
||||
|
||||
/* menu helpers */
|
||||
static void menu_render_triangle(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param);
|
||||
static void menu_render_triangle(bitmap_t &dest, const bitmap_t &source, const rectangle &sbounds, void *param);
|
||||
static void menu_settings_custom_render_one(render_container *container, float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask);
|
||||
static void menu_settings_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
|
||||
|
||||
@ -394,11 +399,11 @@ void ui_menu_init(running_machine *machine)
|
||||
if (x > 256 - 25) alpha = 0xff * (255 - x) / 25;
|
||||
*BITMAP_ADDR32(hilight_bitmap, 0, x) = MAKE_ARGB(alpha,0xff,0xff,0xff);
|
||||
}
|
||||
hilight_texture = render_texture_alloc(NULL, NULL);
|
||||
render_texture_set_bitmap(hilight_texture, hilight_bitmap, NULL, TEXFORMAT_ARGB32, NULL);
|
||||
hilight_texture = machine->render().texture_alloc();
|
||||
hilight_texture->set_bitmap(hilight_bitmap, NULL, TEXFORMAT_ARGB32);
|
||||
|
||||
/* create a texture for arrow icons */
|
||||
arrow_texture = render_texture_alloc(menu_render_triangle, NULL);
|
||||
arrow_texture = machine->render().texture_alloc(menu_render_triangle);
|
||||
|
||||
/* add an exit callback to free memory */
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_menu_exit);
|
||||
@ -416,8 +421,8 @@ static void ui_menu_exit(running_machine &machine)
|
||||
ui_menu_clear_free_list(&machine);
|
||||
|
||||
/* free textures */
|
||||
render_texture_free(hilight_texture);
|
||||
render_texture_free(arrow_texture);
|
||||
machine.render().texture_free(hilight_texture);
|
||||
machine.render().texture_free(arrow_texture);
|
||||
}
|
||||
|
||||
|
||||
@ -735,9 +740,9 @@ void ui_menu_set_selection(ui_menu *menu, void *selected_itemref)
|
||||
|
||||
static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly)
|
||||
{
|
||||
float line_height = ui_get_line_height();
|
||||
float lr_arrow_width = 0.4f * line_height * render_get_ui_aspect();
|
||||
float ud_arrow_width = line_height * render_get_ui_aspect();
|
||||
float line_height = ui_get_line_height(*machine);
|
||||
float lr_arrow_width = 0.4f * line_height * machine->render().ui_aspect();
|
||||
float ud_arrow_width = line_height * machine->render().ui_aspect();
|
||||
float gutter_width = lr_arrow_width * 1.3f;
|
||||
float x1, y1, x2, y2;
|
||||
|
||||
@ -763,11 +768,11 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
|
||||
float total_width;
|
||||
|
||||
/* compute width of left hand side */
|
||||
total_width = gutter_width + ui_get_string_width(item->text) + gutter_width;
|
||||
total_width = gutter_width + ui_get_string_width(*machine, item->text) + gutter_width;
|
||||
|
||||
/* add in width of right hand side */
|
||||
if (item->subtext)
|
||||
total_width += 2.0f * gutter_width + ui_get_string_width(item->subtext);
|
||||
total_width += 2.0f * gutter_width + ui_get_string_width(*machine, item->subtext);
|
||||
|
||||
/* track the maximum */
|
||||
if (total_width > visible_width)
|
||||
@ -828,7 +833,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
|
||||
{
|
||||
mouse_target = ui_input_find_mouse(machine, &mouse_target_x, &mouse_target_y, &mouse_button);
|
||||
if (mouse_target != NULL)
|
||||
if (render_target_map_point_container(mouse_target, mouse_target_x, mouse_target_y, menu->container, &mouse_x, &mouse_y))
|
||||
if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *menu->container, mouse_x, mouse_y))
|
||||
mouse_hit = TRUE;
|
||||
}
|
||||
|
||||
@ -874,13 +879,13 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
|
||||
|
||||
/* if we have some background hilighting to do, add a quad behind everything else */
|
||||
if (bgcolor != UI_TEXT_BG_COLOR)
|
||||
render_container_add_quad(menu->container, line_x0, line_y0, line_x1, line_y1, bgcolor, hilight_texture,
|
||||
menu->container->add_quad(line_x0, line_y0, line_x1, line_y1, bgcolor, hilight_texture,
|
||||
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
|
||||
|
||||
/* if we're on the top line, display the up arrow */
|
||||
if (linenum == 0 && top_line != 0)
|
||||
{
|
||||
render_container_add_quad( menu->container,
|
||||
menu->container->add_quad(
|
||||
0.5f * (x1 + x2) - 0.5f * ud_arrow_width,
|
||||
line_y + 0.25f * line_height,
|
||||
0.5f * (x1 + x2) + 0.5f * ud_arrow_width,
|
||||
@ -895,7 +900,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
|
||||
/* if we're on the bottom line, display the down arrow */
|
||||
else if (linenum == visible_lines - 1 && itemnum != menu->numitems - 1)
|
||||
{
|
||||
render_container_add_quad( menu->container,
|
||||
menu->container->add_quad(
|
||||
0.5f * (x1 + x2) - 0.5f * ud_arrow_width,
|
||||
line_y + 0.25f * line_height,
|
||||
0.5f * (x1 + x2) + 0.5f * ud_arrow_width,
|
||||
@ -909,7 +914,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
|
||||
|
||||
/* if we're just a divider, draw a line */
|
||||
else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0)
|
||||
render_container_add_line(menu->container, visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
menu->container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
|
||||
/* if we don't have a subitem, just draw the string centered */
|
||||
else if (item->subtext == NULL)
|
||||
@ -931,7 +936,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
|
||||
item_width += 2.0f * gutter_width;
|
||||
|
||||
/* if the subitem doesn't fit here, display dots */
|
||||
if (ui_get_string_width(subitem_text) > effective_width - item_width)
|
||||
if (ui_get_string_width(*machine, subitem_text) > effective_width - item_width)
|
||||
{
|
||||
subitem_text = "...";
|
||||
if (itemnum == menu->selected)
|
||||
@ -945,7 +950,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
|
||||
/* apply arrows */
|
||||
if (itemnum == menu->selected && (item->flags & MENU_FLAG_LEFT_ARROW))
|
||||
{
|
||||
render_container_add_quad( menu->container,
|
||||
menu->container->add_quad(
|
||||
effective_left + effective_width - subitem_width - gutter_width,
|
||||
line_y + 0.1f * line_height,
|
||||
effective_left + effective_width - subitem_width - gutter_width + lr_arrow_width,
|
||||
@ -956,7 +961,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
|
||||
}
|
||||
if (itemnum == menu->selected && (item->flags & MENU_FLAG_RIGHT_ARROW))
|
||||
{
|
||||
render_container_add_quad( menu->container,
|
||||
menu->container->add_quad(
|
||||
effective_left + effective_width + gutter_width - lr_arrow_width,
|
||||
line_y + 0.1f * line_height,
|
||||
effective_left + effective_width + gutter_width,
|
||||
@ -1019,8 +1024,8 @@ static void ui_menu_draw_text_box(ui_menu *menu)
|
||||
{
|
||||
const char *text = menu->item[0].text;
|
||||
const char *backtext = menu->item[1].text;
|
||||
float line_height = ui_get_line_height();
|
||||
float lr_arrow_width = 0.4f * line_height * render_get_ui_aspect();
|
||||
float line_height = ui_get_line_height(*menu->machine);
|
||||
float lr_arrow_width = 0.4f * line_height * menu->machine->render().ui_aspect();
|
||||
float gutter_width = lr_arrow_width;
|
||||
float target_width, target_height, prior_width;
|
||||
float target_x, target_y;
|
||||
@ -1033,7 +1038,7 @@ static void ui_menu_draw_text_box(ui_menu *menu)
|
||||
target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height;
|
||||
|
||||
/* maximum against "return to prior menu" text */
|
||||
prior_width = ui_get_string_width(backtext) + 2.0f * gutter_width;
|
||||
prior_width = ui_get_string_width(*menu->machine, backtext) + 2.0f * gutter_width;
|
||||
target_width = MAX(target_width, prior_width);
|
||||
|
||||
/* determine the target location */
|
||||
@ -1059,7 +1064,7 @@ static void ui_menu_draw_text_box(ui_menu *menu)
|
||||
JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
|
||||
|
||||
/* draw the "return to prior menu" text with a hilight behind it */
|
||||
render_container_add_quad(menu->container,
|
||||
menu->container->add_quad(
|
||||
target_x + 0.5f * UI_LINE_WIDTH,
|
||||
target_y + target_height - line_height,
|
||||
target_x + target_width - 0.5f * UI_LINE_WIDTH,
|
||||
@ -1557,7 +1562,7 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st
|
||||
ui_menu_item_append(menu, "Slider Controls", NULL, 0, (void *)menu_sliders);
|
||||
|
||||
/* add video options menu */
|
||||
ui_menu_item_append(menu, "Video Options", NULL, 0, (render_target_get_indexed(1) != NULL) ? (void *)menu_video_targets : (void *)menu_video_options);
|
||||
ui_menu_item_append(menu, "Video Options", NULL, 0, (machine->render().target_by_index(1) != NULL) ? (void *)menu_video_targets : (void *)menu_video_options);
|
||||
|
||||
/* add crosshair options menu */
|
||||
if (crosshair_get_usage(machine))
|
||||
@ -2177,8 +2182,8 @@ static void menu_settings_custom_render(running_machine *machine, ui_menu *menu,
|
||||
|
||||
static void menu_settings_custom_render_one(render_container *container, float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask)
|
||||
{
|
||||
float switch_field_width = SINGLE_TOGGLE_SWITCH_FIELD_WIDTH * render_get_ui_aspect();
|
||||
float switch_width = SINGLE_TOGGLE_SWITCH_WIDTH * render_get_ui_aspect();
|
||||
float switch_field_width = SINGLE_TOGGLE_SWITCH_FIELD_WIDTH * container->manager().ui_aspect();
|
||||
float switch_width = SINGLE_TOGGLE_SWITCH_WIDTH * container->manager().ui_aspect();
|
||||
int numtoggles, toggle;
|
||||
float switch_toggle_gap;
|
||||
float y1_off, y1_on;
|
||||
@ -2194,7 +2199,7 @@ static void menu_settings_custom_render_one(render_container *container, float x
|
||||
dip->name,
|
||||
0,
|
||||
y1 + (DIP_SWITCH_HEIGHT - UI_TARGET_FONT_HEIGHT) / 2,
|
||||
x1 - ui_get_string_width(" "),
|
||||
x1 - ui_get_string_width(container->manager().machine(), " "),
|
||||
JUSTIFY_RIGHT,
|
||||
WRAP_NEVER,
|
||||
DRAW_NORMAL,
|
||||
@ -2223,13 +2228,13 @@ static void menu_settings_custom_render_one(render_container *container, float x
|
||||
if (dip->mask & (1 << toggle))
|
||||
{
|
||||
float innery1 = (dip->state & (1 << toggle)) ? y1_on : y1_off;
|
||||
render_container_add_rect(container, innerx1, innery1, innerx1 + switch_width, innery1 + SINGLE_TOGGLE_SWITCH_HEIGHT,
|
||||
container->add_rect(innerx1, innery1, innerx1 + switch_width, innery1 + SINGLE_TOGGLE_SWITCH_HEIGHT,
|
||||
(selectedmask & (1 << toggle)) ? UI_DIPSW_COLOR : UI_TEXT_COLOR,
|
||||
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
}
|
||||
else
|
||||
{
|
||||
render_container_add_rect(container, innerx1, y1_off, innerx1 + switch_width, y1_on + SINGLE_TOGGLE_SWITCH_HEIGHT,
|
||||
container->add_rect(innerx1, y1_off, innerx1 + switch_width, y1_on + SINGLE_TOGGLE_SWITCH_HEIGHT,
|
||||
UI_UNAVAILABLE_COLOR,
|
||||
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
}
|
||||
@ -2871,7 +2876,7 @@ static void menu_sliders_populate(running_machine *machine, ui_menu *menu, int m
|
||||
break;
|
||||
}
|
||||
|
||||
ui_menu_set_custom_render(menu, menu_sliders_custom_render, 0.0f, 2.0f * ui_get_line_height() + 2.0f * UI_BOX_TB_BORDER);
|
||||
ui_menu_set_custom_render(menu, menu_sliders_custom_render, 0.0f, 2.0f * ui_get_line_height(*machine) + 2.0f * UI_BOX_TB_BORDER);
|
||||
}
|
||||
|
||||
|
||||
@ -2886,7 +2891,7 @@ static void menu_sliders_custom_render(running_machine *machine, ui_menu *menu,
|
||||
if (curslider != NULL)
|
||||
{
|
||||
float bar_left, bar_area_top, bar_width, bar_area_height, bar_top, bar_bottom, default_x, current_x;
|
||||
float line_height = ui_get_line_height();
|
||||
float line_height = ui_get_line_height(*machine);
|
||||
float percentage, default_percentage;
|
||||
astring tempstring;
|
||||
float text_height;
|
||||
@ -2929,15 +2934,15 @@ static void menu_sliders_custom_render(running_machine *machine, ui_menu *menu,
|
||||
current_x = bar_left + bar_width * percentage;
|
||||
|
||||
/* fill in the percentage */
|
||||
render_container_add_rect(menu->container, bar_left, bar_top, current_x, bar_bottom, UI_SLIDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
menu->container->add_rect(bar_left, bar_top, current_x, bar_bottom, UI_SLIDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
|
||||
/* draw the top and bottom lines */
|
||||
render_container_add_line(menu->container, bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
render_container_add_line(menu->container, bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
menu->container->add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
menu->container->add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
|
||||
/* draw default marker */
|
||||
render_container_add_line(menu->container, default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
render_container_add_line(menu->container, default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
menu->container->add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
menu->container->add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
|
||||
/* draw the actual text */
|
||||
ui_draw_text_full(menu->container, tempstring, x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
|
||||
@ -2978,7 +2983,7 @@ static void menu_video_targets_populate(running_machine *machine, ui_menu *menu)
|
||||
/* find the targets */
|
||||
for (targetnum = 0; ; targetnum++)
|
||||
{
|
||||
render_target *target = render_target_get_indexed(targetnum);
|
||||
render_target *target = machine->render().target_by_index(targetnum);
|
||||
char buffer[40];
|
||||
|
||||
/* stop when we run out */
|
||||
@ -2999,7 +3004,7 @@ static void menu_video_targets_populate(running_machine *machine, ui_menu *menu)
|
||||
|
||||
static void menu_video_options(running_machine *machine, ui_menu *menu, void *parameter, void *state)
|
||||
{
|
||||
render_target *target = (parameter != NULL) ? (render_target *)parameter : render_target_get_indexed(0);
|
||||
render_target *target = (parameter != NULL) ? (render_target *)parameter : machine->render().first_target();
|
||||
const ui_menu_event *event;
|
||||
int changed = FALSE;
|
||||
|
||||
@ -3018,26 +3023,47 @@ static void menu_video_options(running_machine *machine, ui_menu *menu, void *pa
|
||||
if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
int delta = (event->iptkey == IPT_UI_LEFT) ? ROT270 : ROT90;
|
||||
render_target_set_orientation(target, orientation_add(delta, render_target_get_orientation(target)));
|
||||
if (target == render_get_ui_target())
|
||||
target->set_orientation(orientation_add(delta, target->orientation()));
|
||||
if (target->is_ui_target())
|
||||
{
|
||||
render_container_user_settings settings;
|
||||
render_container_get_user_settings(menu->container, &settings);
|
||||
settings.orientation = orientation_add(delta ^ ROT180, settings.orientation);
|
||||
render_container_set_user_settings(menu->container, &settings);
|
||||
render_container::user_settings settings;
|
||||
menu->container->get_user_settings(settings);
|
||||
settings.m_orientation = orientation_add(delta ^ ROT180, settings.m_orientation);
|
||||
menu->container->set_user_settings(settings);
|
||||
}
|
||||
changed = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
/* layer config bitmasks handle left/right keys the same (toggle) */
|
||||
case LAYER_CONFIG_ENABLE_BACKDROP:
|
||||
case LAYER_CONFIG_ENABLE_OVERLAY:
|
||||
case LAYER_CONFIG_ENABLE_BEZEL:
|
||||
case LAYER_CONFIG_ZOOM_TO_SCREEN:
|
||||
case VIDEO_ITEM_BACKDROPS:
|
||||
if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
render_target_set_layer_config(target, render_target_get_layer_config(target) ^ (FPTR)event->itemref);
|
||||
target->set_backdrops_enabled(!target->backdrops_enabled());
|
||||
changed = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIDEO_ITEM_OVERLAYS:
|
||||
if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
target->set_overlays_enabled(!target->overlays_enabled());
|
||||
changed = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIDEO_ITEM_BEZELS:
|
||||
if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
target->set_bezels_enabled(!target->bezels_enabled());
|
||||
changed = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIDEO_ITEM_ZOOM:
|
||||
if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
target->set_zoom_to_screen(!target->zoom_to_screen());
|
||||
changed = TRUE;
|
||||
}
|
||||
break;
|
||||
@ -3046,7 +3072,7 @@ static void menu_video_options(running_machine *machine, ui_menu *menu, void *pa
|
||||
default:
|
||||
if (event->iptkey == IPT_UI_SELECT && (int)(FPTR)event->itemref >= VIDEO_ITEM_VIEW)
|
||||
{
|
||||
render_target_set_view(target, (FPTR)event->itemref - VIDEO_ITEM_VIEW);
|
||||
target->set_view((FPTR)event->itemref - VIDEO_ITEM_VIEW);
|
||||
changed = TRUE;
|
||||
}
|
||||
break;
|
||||
@ -3066,7 +3092,6 @@ static void menu_video_options(running_machine *machine, ui_menu *menu, void *pa
|
||||
|
||||
static void menu_video_options_populate(running_machine *machine, ui_menu *menu, render_target *target)
|
||||
{
|
||||
int layermask = render_target_get_layer_config(target);
|
||||
const char *subtext = "";
|
||||
astring tempstring;
|
||||
int viewnum;
|
||||
@ -3075,7 +3100,7 @@ static void menu_video_options_populate(running_machine *machine, ui_menu *menu,
|
||||
/* add items for each view */
|
||||
for (viewnum = 0; ; viewnum++)
|
||||
{
|
||||
const char *name = render_target_get_view_name(target, viewnum);
|
||||
const char *name = target->view_name(viewnum);
|
||||
if (name == NULL)
|
||||
break;
|
||||
|
||||
@ -3088,7 +3113,7 @@ static void menu_video_options_populate(running_machine *machine, ui_menu *menu,
|
||||
ui_menu_item_append(menu, MENU_SEPARATOR_ITEM, NULL, 0, NULL);
|
||||
|
||||
/* add a rotate item */
|
||||
switch (render_target_get_orientation(target))
|
||||
switch (target->orientation())
|
||||
{
|
||||
case ROT0: subtext = "None"; break;
|
||||
case ROT90: subtext = "CW 90" UTF8_DEGREES; break;
|
||||
@ -3098,20 +3123,20 @@ static void menu_video_options_populate(running_machine *machine, ui_menu *menu,
|
||||
ui_menu_item_append(menu, "Rotate", subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE);
|
||||
|
||||
/* backdrop item */
|
||||
enabled = layermask & LAYER_CONFIG_ENABLE_BACKDROP;
|
||||
ui_menu_item_append(menu, "Backdrops", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)LAYER_CONFIG_ENABLE_BACKDROP);
|
||||
enabled = target->backdrops_enabled();
|
||||
ui_menu_item_append(menu, "Backdrops", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS);
|
||||
|
||||
/* overlay item */
|
||||
enabled = layermask & LAYER_CONFIG_ENABLE_OVERLAY;
|
||||
ui_menu_item_append(menu, "Overlays", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)LAYER_CONFIG_ENABLE_OVERLAY);
|
||||
enabled = target->overlays_enabled();
|
||||
ui_menu_item_append(menu, "Overlays", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS);
|
||||
|
||||
/* bezel item */
|
||||
enabled = layermask & LAYER_CONFIG_ENABLE_BEZEL;
|
||||
ui_menu_item_append(menu, "Bezels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)LAYER_CONFIG_ENABLE_BEZEL);
|
||||
enabled = target->bezels_enabled();
|
||||
ui_menu_item_append(menu, "Bezels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS);
|
||||
|
||||
/* cropping */
|
||||
enabled = layermask & LAYER_CONFIG_ZOOM_TO_SCREEN;
|
||||
ui_menu_item_append(menu, "View", enabled ? "Cropped" : "Full", enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)LAYER_CONFIG_ZOOM_TO_SCREEN);
|
||||
enabled = target->zoom_to_screen();
|
||||
ui_menu_item_append(menu, "View", enabled ? "Cropped" : "Full", enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM);
|
||||
}
|
||||
|
||||
|
||||
@ -3556,7 +3581,7 @@ static void menu_select_game_populate(running_machine *machine, ui_menu *menu, s
|
||||
}
|
||||
|
||||
/* configure the custom rendering */
|
||||
ui_menu_set_custom_render(menu, menu_select_game_custom_render, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 4.0f * ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER);
|
||||
ui_menu_set_custom_render(menu, menu_select_game_custom_render, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER, 4.0f * ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER);
|
||||
}
|
||||
|
||||
|
||||
@ -3787,7 +3812,7 @@ static void menu_select_game_custom_render(running_machine *machine, ui_menu *me
|
||||
{
|
||||
ui_draw_text_full(menu->container, &tempbuf[line][0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
|
||||
y1 += ui_get_line_height();
|
||||
y1 += ui_get_line_height(*machine);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3803,23 +3828,23 @@ static void menu_select_game_custom_render(running_machine *machine, ui_menu *me
|
||||
indicators
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void menu_render_triangle(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param)
|
||||
static void menu_render_triangle(bitmap_t &dest, const bitmap_t &source, const rectangle &sbounds, void *param)
|
||||
{
|
||||
int halfwidth = dest->width / 2;
|
||||
int height = dest->height;
|
||||
int halfwidth = dest.width / 2;
|
||||
int height = dest.height;
|
||||
int x, y;
|
||||
|
||||
/* start with all-transparent */
|
||||
bitmap_fill(dest, NULL, MAKE_ARGB(0x00,0x00,0x00,0x00));
|
||||
bitmap_fill(&dest, NULL, MAKE_ARGB(0x00,0x00,0x00,0x00));
|
||||
|
||||
/* render from the tip to the bottom */
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
int linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height;
|
||||
UINT32 *target = BITMAP_ADDR32(dest, y, halfwidth);
|
||||
UINT32 *target = BITMAP_ADDR32(&dest, y, halfwidth);
|
||||
|
||||
/* don't antialias if height < 12 */
|
||||
if (dest->height < 12)
|
||||
if (dest.height < 12)
|
||||
{
|
||||
int pixels = (linewidth + 254) / 255;
|
||||
if (pixels % 2 == 0) pixels++;
|
||||
|
@ -193,7 +193,7 @@ static void video_mng_record_frame(running_machine *machine);
|
||||
static void video_avi_record_frame(running_machine *machine);
|
||||
|
||||
/* software rendering */
|
||||
static void rgb888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void rgb888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
|
||||
|
||||
|
||||
@ -311,18 +311,16 @@ void video_init(running_machine *machine)
|
||||
/* the native target is hard-coded to our internal layout and has all options disabled */
|
||||
if (global.snap_native)
|
||||
{
|
||||
global.snap_target = render_target_alloc(machine, layout_snap, RENDER_CREATE_SINGLE_FILE | RENDER_CREATE_HIDDEN);
|
||||
assert(global.snap_target != NULL);
|
||||
render_target_set_layer_config(global.snap_target, 0);
|
||||
global.snap_target = machine->render().target_alloc(layout_snap, RENDER_CREATE_SINGLE_FILE | RENDER_CREATE_HIDDEN);
|
||||
global.snap_target->set_layer_config(0);
|
||||
}
|
||||
|
||||
/* other targets select the specified view and turn off effects */
|
||||
else
|
||||
{
|
||||
global.snap_target = render_target_alloc(machine, NULL, RENDER_CREATE_HIDDEN);
|
||||
assert(global.snap_target != NULL);
|
||||
render_target_set_view(global.snap_target, video_get_view_for_target(machine, global.snap_target, viewname, 0, 1));
|
||||
render_target_set_layer_config(global.snap_target, render_target_get_layer_config(global.snap_target) & ~LAYER_CONFIG_ENABLE_SCREEN_OVERLAY);
|
||||
global.snap_target = machine->render().target_alloc(NULL, RENDER_CREATE_HIDDEN);
|
||||
global.snap_target->set_view(video_get_view_for_target(machine, global.snap_target, viewname, 0, 1));
|
||||
global.snap_target->set_screen_overlay_enabled(false);
|
||||
}
|
||||
|
||||
/* extract snap resolution if present */
|
||||
@ -364,8 +362,7 @@ static void video_exit(running_machine &machine)
|
||||
gfx_element_free(machine.gfx[i]);
|
||||
|
||||
/* free the snapshot target */
|
||||
if (global.snap_target != NULL)
|
||||
render_target_free(global.snap_target);
|
||||
machine.render().target_free(global.snap_target);
|
||||
if (global.snap_bitmap != NULL)
|
||||
global_free(global.snap_bitmap);
|
||||
|
||||
@ -455,7 +452,7 @@ void video_frame_update(running_machine *machine, int debug)
|
||||
}
|
||||
|
||||
/* draw the user interface */
|
||||
ui_update_and_render(machine, render_container_get_ui());
|
||||
ui_update_and_render(machine, &machine->render().ui_container());
|
||||
|
||||
/* update the internal render debugger */
|
||||
debugint_update_during_game(machine);
|
||||
@ -991,7 +988,7 @@ static void update_refresh_speed(running_machine *machine)
|
||||
/* only do this if the refreshspeed option is used */
|
||||
if (options_get_bool(machine->options(), OPTION_REFRESHSPEED))
|
||||
{
|
||||
float minrefresh = render_get_max_update_rate();
|
||||
float minrefresh = machine->render().max_update_rate();
|
||||
if (minrefresh != 0)
|
||||
{
|
||||
attoseconds_t min_frame_period = ATTOSECONDS_PER_SECOND;
|
||||
@ -1156,7 +1153,7 @@ void video_save_active_screen_snapshots(running_machine *machine)
|
||||
{
|
||||
/* write one snapshot per visible screen */
|
||||
for (screen_device *screen = screen_first(*machine); screen != NULL; screen = screen_next(screen))
|
||||
if (render_is_live_screen(screen))
|
||||
if (machine->render().is_live(*screen))
|
||||
{
|
||||
file_error filerr = mame_fopen_next(machine, SEARCHPATH_SCREENSHOT, "png", &fp);
|
||||
if (filerr == FILERR_NONE)
|
||||
@ -1188,7 +1185,6 @@ void video_save_active_screen_snapshots(running_machine *machine)
|
||||
|
||||
static void create_snapshot_bitmap(device_t *screen)
|
||||
{
|
||||
const render_primitive_list *primlist;
|
||||
INT32 width, height;
|
||||
int view_index;
|
||||
|
||||
@ -1197,15 +1193,15 @@ static void create_snapshot_bitmap(device_t *screen)
|
||||
{
|
||||
view_index = screen->machine->m_devicelist.index(SCREEN, screen->tag());
|
||||
assert(view_index != -1);
|
||||
render_target_set_view(global.snap_target, view_index);
|
||||
global.snap_target->set_view(view_index);
|
||||
}
|
||||
|
||||
/* get the minimum width/height and set it on the target */
|
||||
width = global.snap_width;
|
||||
height = global.snap_height;
|
||||
if (width == 0 || height == 0)
|
||||
render_target_get_minimum_size(global.snap_target, &width, &height);
|
||||
render_target_set_bounds(global.snap_target, width, height, 0);
|
||||
global.snap_target->compute_minimum_size(width, height);
|
||||
global.snap_target->set_bounds(width, height);
|
||||
|
||||
/* if we don't have a bitmap, or if it's not the right size, allocate a new one */
|
||||
if (global.snap_bitmap == NULL || width != global.snap_bitmap->width || height != global.snap_bitmap->height)
|
||||
@ -1217,10 +1213,10 @@ static void create_snapshot_bitmap(device_t *screen)
|
||||
}
|
||||
|
||||
/* render the screen there */
|
||||
primlist = render_target_get_primitives(global.snap_target);
|
||||
osd_lock_acquire(primlist->lock);
|
||||
rgb888_draw_primitives(primlist->head, global.snap_bitmap->base, width, height, global.snap_bitmap->rowpixels);
|
||||
osd_lock_release(primlist->lock);
|
||||
render_primitive_list &primlist = global.snap_target->get_primitives();
|
||||
primlist.acquire_lock();
|
||||
rgb888_draw_primitives(primlist, global.snap_bitmap->base, width, height, global.snap_bitmap->rowpixels);
|
||||
primlist.release_lock();
|
||||
}
|
||||
|
||||
|
||||
@ -1586,7 +1582,7 @@ int video_get_view_for_target(running_machine *machine, render_target *target, c
|
||||
/* scan for a matching view name */
|
||||
for (viewindex = 0; ; viewindex++)
|
||||
{
|
||||
const char *name = render_target_get_view_name(target, viewindex);
|
||||
const char *name = target->view_name(viewindex);
|
||||
|
||||
/* stop scanning when we hit NULL */
|
||||
if (name == NULL)
|
||||
@ -1610,7 +1606,7 @@ int video_get_view_for_target(running_machine *machine, render_target *target, c
|
||||
/* find the first view with this screen and this screen only */
|
||||
for (viewindex = 0; ; viewindex++)
|
||||
{
|
||||
UINT32 viewscreens = render_target_get_view_screens(target, viewindex);
|
||||
UINT32 viewscreens = target->view_screens(viewindex);
|
||||
if (viewscreens == (1 << targetindex))
|
||||
break;
|
||||
if (viewscreens == 0)
|
||||
@ -1626,7 +1622,7 @@ int video_get_view_for_target(running_machine *machine, render_target *target, c
|
||||
{
|
||||
for (viewindex = 0; ; viewindex++)
|
||||
{
|
||||
UINT32 viewscreens = render_target_get_view_screens(target, viewindex);
|
||||
UINT32 viewscreens = target->view_screens(viewindex);
|
||||
if (viewscreens == (1 << scrcount) - 1)
|
||||
break;
|
||||
if (viewscreens == 0)
|
||||
@ -1636,7 +1632,7 @@ int video_get_view_for_target(running_machine *machine, render_target *target, c
|
||||
}
|
||||
|
||||
/* make sure it's a valid view */
|
||||
if (render_target_get_view_name(target, viewindex) == NULL)
|
||||
if (target->view_name(viewindex) == NULL)
|
||||
viewindex = 0;
|
||||
|
||||
return viewindex;
|
||||
@ -1897,6 +1893,7 @@ bool screen_device_config::device_validity_check(const game_driver &driver) cons
|
||||
screen_device::screen_device(running_machine &_machine, const screen_device_config &config)
|
||||
: device_t(_machine, config),
|
||||
m_config(config),
|
||||
m_container(NULL),
|
||||
m_width(m_config.m_width),
|
||||
m_height(m_config.m_height),
|
||||
m_visarea(m_config.m_visarea),
|
||||
@ -1930,10 +1927,8 @@ screen_device::screen_device(running_machine &_machine, const screen_device_conf
|
||||
|
||||
screen_device::~screen_device()
|
||||
{
|
||||
if (m_texture[0] != NULL)
|
||||
render_texture_free(m_texture[0]);
|
||||
if (m_texture[1] != NULL)
|
||||
render_texture_free(m_texture[1]);
|
||||
m_machine.render().texture_free(m_texture[0]);
|
||||
m_machine.render().texture_free(m_texture[1]);
|
||||
if (m_burnin != NULL)
|
||||
finalize_burnin();
|
||||
}
|
||||
@ -1946,17 +1941,16 @@ screen_device::~screen_device()
|
||||
void screen_device::device_start()
|
||||
{
|
||||
// get and validate that the container for this screen exists
|
||||
render_container *container = render_container_get_screen(this);
|
||||
assert(container != NULL);
|
||||
m_container = m_machine.render().container_for_screen(this);
|
||||
|
||||
// configure the default cliparea
|
||||
render_container_user_settings settings;
|
||||
render_container_get_user_settings(container, &settings);
|
||||
settings.xoffset = m_config.m_xoffset;
|
||||
settings.yoffset = m_config.m_yoffset;
|
||||
settings.xscale = m_config.m_xscale;
|
||||
settings.yscale = m_config.m_yscale;
|
||||
render_container_set_user_settings(container, &settings);
|
||||
render_container::user_settings settings;
|
||||
m_container->get_user_settings(settings);
|
||||
settings.m_xoffset = m_config.m_xoffset;
|
||||
settings.m_yoffset = m_config.m_yoffset;
|
||||
settings.m_xscale = m_config.m_xscale;
|
||||
settings.m_yscale = m_config.m_yscale;
|
||||
m_container->set_user_settings(settings);
|
||||
|
||||
// allocate the VBLANK timers
|
||||
m_vblank_begin_timer = timer_alloc(machine, static_vblank_begin_callback, (void *)this);
|
||||
@ -2096,10 +2090,8 @@ void screen_device::realloc_screen_bitmaps()
|
||||
if (m_width > curwidth || m_height > curheight)
|
||||
{
|
||||
// free what we have currently
|
||||
if (m_texture[0] != NULL)
|
||||
render_texture_free(m_texture[0]);
|
||||
if (m_texture[1] != NULL)
|
||||
render_texture_free(m_texture[1]);
|
||||
global_free(m_texture[0]);
|
||||
global_free(m_texture[1]);
|
||||
if (m_bitmap[0] != NULL)
|
||||
auto_free(machine, m_bitmap[0]);
|
||||
if (m_bitmap[1] != NULL)
|
||||
@ -2126,10 +2118,10 @@ void screen_device::realloc_screen_bitmaps()
|
||||
bitmap_set_palette(m_bitmap[1], machine->palette);
|
||||
|
||||
// allocate textures
|
||||
m_texture[0] = render_texture_alloc(NULL, NULL);
|
||||
render_texture_set_bitmap(m_texture[0], m_bitmap[0], &m_visarea, m_texture_format, palette);
|
||||
m_texture[1] = render_texture_alloc(NULL, NULL);
|
||||
render_texture_set_bitmap(m_texture[1], m_bitmap[1], &m_visarea, m_texture_format, palette);
|
||||
m_texture[0] = m_machine.render().texture_alloc();
|
||||
m_texture[0]->set_bitmap(m_bitmap[0], &m_visarea, m_texture_format, palette);
|
||||
m_texture[1] = m_machine.render().texture_alloc();
|
||||
m_texture[1]->set_bitmap(m_bitmap[1], &m_visarea, m_texture_format, palette);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2180,7 +2172,7 @@ bool screen_device::update_partial(int scanline)
|
||||
}
|
||||
|
||||
// skip if this screen is not visible anywhere
|
||||
if (!render_is_live_screen(this))
|
||||
if (!m_machine.render().is_live(*this))
|
||||
{
|
||||
LOG_PARTIAL_UPDATES(("skipped because screen not live\n"));
|
||||
return FALSE;
|
||||
@ -2460,7 +2452,7 @@ void screen_device::scanline_update_callback(int scanline)
|
||||
bool screen_device::update_quads()
|
||||
{
|
||||
// only update if live
|
||||
if (render_is_live_screen(this))
|
||||
if (m_machine.render().is_live(*this))
|
||||
{
|
||||
// only update if empty and not a vector game; otherwise assume the driver did it directly
|
||||
if (m_config.m_type != SCREEN_TYPE_VECTOR && (machine->config->m_video_attributes & VIDEO_SELF_RENDER) == 0)
|
||||
@ -2473,15 +2465,15 @@ bool screen_device::update_quads()
|
||||
fixedvis.max_y++;
|
||||
|
||||
palette_t *palette = (m_texture_format == TEXFORMAT_PALETTE16) ? machine->palette : NULL;
|
||||
render_texture_set_bitmap(m_texture[m_curbitmap], m_bitmap[m_curbitmap], &fixedvis, m_texture_format, palette);
|
||||
m_texture[m_curbitmap]->set_bitmap(m_bitmap[m_curbitmap], &fixedvis, m_texture_format, palette);
|
||||
|
||||
m_curtexture = m_curbitmap;
|
||||
m_curbitmap = 1 - m_curbitmap;
|
||||
}
|
||||
|
||||
// create an empty container with a single quad
|
||||
render_container_empty(render_container_get_screen(this));
|
||||
render_screen_add_quad(this, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), m_texture[m_curtexture], PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
|
||||
m_container->empty();
|
||||
m_container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), m_texture[m_curtexture], PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ enum screen_type_enum
|
||||
|
||||
// forward references
|
||||
class render_target;
|
||||
struct render_texture;
|
||||
class render_texture;
|
||||
class screen_device;
|
||||
|
||||
|
||||
@ -155,6 +155,7 @@ public:
|
||||
int height() const { return m_height; }
|
||||
const rectangle &visible_area() const { return m_visarea; }
|
||||
bitmap_format format() const { return m_config.m_format; }
|
||||
render_container &container() const { assert(m_container != NULL); return *m_container; }
|
||||
|
||||
// dynamic configuration
|
||||
void configure(int width, int height, const rectangle &visarea, attoseconds_t frame_period);
|
||||
@ -218,6 +219,7 @@ private:
|
||||
|
||||
// internal state
|
||||
const screen_device_config &m_config;
|
||||
render_container * m_container; // pointer to our container
|
||||
|
||||
// dimensions
|
||||
int m_width; // current width (HTOTAL)
|
||||
|
@ -269,8 +269,8 @@ VIDEO_UPDATE( vector )
|
||||
|
||||
curpoint = vector_list;
|
||||
|
||||
render_container_empty(render_container_get_screen(screen));
|
||||
render_screen_add_rect(screen, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
screen->container().empty();
|
||||
screen->container().add_rect(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
|
||||
clip.x0 = clip.y0 = 0.0f;
|
||||
clip.x1 = clip.y1 = 1.0f;
|
||||
@ -300,7 +300,7 @@ VIDEO_UPDATE( vector )
|
||||
|
||||
if (curpoint->intensity != 0)
|
||||
if (!render_clip_line(&coords, &clip))
|
||||
render_screen_add_line(screen, coords.x0, coords.y0, coords.x1, coords.y1,
|
||||
screen->container().add_line(coords.x0, coords.y0, coords.x1, coords.y1,
|
||||
beam_width * (1.0f / (float)VECTOR_WIDTH_DENOM),
|
||||
(curpoint->intensity << 24) | (curpoint->col & 0xffffff),
|
||||
flags);
|
||||
|
@ -215,7 +215,7 @@ VIDEO_UPDATE( test_vcu )
|
||||
if (dbg_info)
|
||||
{
|
||||
sprintf(buf,"I-info, G-gfx, C-color, V-vbank, 1-4 enable planes");
|
||||
ui_draw_text(buf, 10, 0 * ui_get_line_height());
|
||||
ui_draw_text(buf, 10, 0 * ui_get_line_height(*screen->machine));
|
||||
|
||||
sprintf(buf,"g:%1i c:%1i v:%1i vbk=%1i planes=%1i%1i%1i%1i ", dbg_gfx_e&1, dbg_clr_e&1, dbg_vbank, vbank&1,
|
||||
planes_enabled[0],
|
||||
@ -223,7 +223,7 @@ VIDEO_UPDATE( test_vcu )
|
||||
planes_enabled[2],
|
||||
planes_enabled[3] );
|
||||
|
||||
ui_draw_text(buf, 10, 1 * ui_get_line_height());
|
||||
ui_draw_text(buf, 10, 1 * ui_get_line_height(*screen->machine));
|
||||
|
||||
if (dbg_lookup!=4)
|
||||
{
|
||||
@ -238,7 +238,7 @@ VIDEO_UPDATE( test_vcu )
|
||||
{
|
||||
sprintf(buf + strlen(buf), "%02x ", lookup_ram[lookup_offs + x + y * 16]);
|
||||
}
|
||||
ui_draw_text(buf, 0, (2 + y) * ui_get_line_height());
|
||||
ui_draw_text(buf, 0, (2 + y) * ui_get_line_height(*screen->machine));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -676,8 +676,8 @@ void fd1094_regenerate_key(running_machine *machine)
|
||||
(*key_changed)(machine);
|
||||
|
||||
/* force all memory and disassembly views to update */
|
||||
machine->m_debug_view->update_all(DVT_MEMORY);
|
||||
machine->m_debug_view->update_all(DVT_DISASSEMBLY);
|
||||
machine->debug_view().update_all(DVT_MEMORY);
|
||||
machine->debug_view().update_all(DVT_DISASSEMBLY);
|
||||
|
||||
/* reset keydirty */
|
||||
keydirty = FALSE;
|
||||
@ -1014,8 +1014,8 @@ static void execute_fdstate(running_machine *machine, int ref, int params, const
|
||||
return;
|
||||
fd1094_set_state(keyregion, newstate);
|
||||
fd1094_regenerate_key(machine);
|
||||
machine->m_debug_view->update_all(DVT_MEMORY);
|
||||
machine->m_debug_view->update_all(DVT_DISASSEMBLY);
|
||||
machine->debug_view().update_all(DVT_MEMORY);
|
||||
machine->debug_view().update_all(DVT_DISASSEMBLY);
|
||||
}
|
||||
|
||||
/* 0 parameters displays the current state */
|
||||
|
@ -1077,7 +1077,7 @@ void deco16ic_print_debug_info(running_device *device, bitmap_t *bitmap)
|
||||
|
||||
sprintf(&buf[strlen(buf)],"%04X", deco16ic->priority);
|
||||
|
||||
ui_draw_text(render_container_get_ui(), buf, 60, 40);
|
||||
ui_draw_text(&device->machine->render().ui_container(), buf, 60, 40);
|
||||
}
|
||||
|
||||
/*****************************************************************************************/
|
||||
|
@ -948,7 +948,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
if (input_code_pressed(machine, KEYCODE_Z)) /* Display some info on each sprite */
|
||||
{ char buf[30];
|
||||
sprintf(buf, "%02X",/*(s2[2] & ~0x3ff)>>8*/mode>>8);
|
||||
ui_draw_text(render_container_get_ui(), buf, sx, sy);
|
||||
ui_draw_text(&machine->render().ui_container(), buf, sx, sy);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1129,7 +1129,7 @@ static void gdfs_draw_zooming_sprites(running_machine *machine, bitmap_t *bitmap
|
||||
{
|
||||
char buf[10];
|
||||
sprintf(buf, "%X",size);
|
||||
ui_draw_text(render_container_get_ui(), buf, sx / 0x10000, sy / 0x10000);
|
||||
ui_draw_text(&machine->render().ui_container(), buf, sx / 0x10000, sy / 0x10000);
|
||||
}
|
||||
#endif
|
||||
} /* single-sprites */
|
||||
|
@ -411,7 +411,7 @@ static int (**dpix_sp[9])(UINT32 s_pix);
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static void print_debug_info(bitmap_t *bitmap)
|
||||
static void print_debug_info(running_machine *machine, bitmap_t *bitmap)
|
||||
{
|
||||
int l[16];
|
||||
char buf[64*16];
|
||||
@ -480,7 +480,7 @@ static void print_debug_info(bitmap_t *bitmap)
|
||||
l[3]=f3_line_ram[0x15e0]&0xffff;
|
||||
bufptr += sprintf(bufptr,"5000: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]);
|
||||
|
||||
ui_draw_text(render_container_get_ui(), buf, 60, 40);
|
||||
ui_draw_text(&machine->render().ui_container(), buf, 60, 40);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
@ -3292,6 +3292,6 @@ VIDEO_UPDATE( f3 )
|
||||
scanline_draw(screen->machine, bitmap,cliprect);
|
||||
|
||||
if (VERBOSE)
|
||||
print_debug_info(bitmap);
|
||||
print_debug_info(screen->machine, bitmap);
|
||||
return 0;
|
||||
}
|
||||
|
@ -124,7 +124,6 @@ static UINT8 *tx1_obj_bmp;
|
||||
static UINT8 *tx1_rod_bmp;
|
||||
|
||||
static bitmap_t *tx1_bitmap;
|
||||
static render_texture *tx1_texture;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@ -1122,7 +1121,6 @@ VIDEO_START( tx1 )
|
||||
{
|
||||
/* Allocate a large bitmap that covers the three screens */
|
||||
tx1_bitmap = auto_bitmap_alloc(machine, 768, 256, BITMAP_FORMAT_INDEXED16);
|
||||
tx1_texture = render_texture_alloc(NULL, NULL);
|
||||
|
||||
/* Allocate some bitmaps */
|
||||
tx1_chr_bmp = auto_alloc_array(machine, UINT8, 256 * 3 * 240);
|
||||
|
@ -105,9 +105,7 @@ int main(int argc, char *argv[])
|
||||
void osd_init(running_machine *machine)
|
||||
{
|
||||
// initialize the video system by allocating a rendering target
|
||||
our_target = render_target_alloc(machine, NULL, 0);
|
||||
if (our_target == NULL)
|
||||
fatalerror("Error creating render target");
|
||||
our_target = machine->render().target_alloc();
|
||||
|
||||
// nothing yet to do to initialize sound, since we don't have any
|
||||
// sound updates are handled by osd_update_audio_stream() below
|
||||
@ -164,13 +162,13 @@ void osd_update(running_machine *machine, int skip_redraw)
|
||||
int minwidth, minheight;
|
||||
|
||||
// get the minimum width/height for the current layout
|
||||
render_target_get_minimum_size(our_target, &minwidth, &minheight);
|
||||
our_target->compute_minimum_size(minwidth, minheight);
|
||||
|
||||
// make that the size of our target
|
||||
render_target_set_bounds(our_target, minwidth, minheight, 0);
|
||||
our_target->render_target_set_bounds(minwidth, minheight);
|
||||
|
||||
// get the list of primitives for the target at the current size
|
||||
primlist = render_target_get_primitives(our_target);
|
||||
primlist = our_target->get_primitives();
|
||||
|
||||
// lock them, and then render them
|
||||
osd_lock_acquire(primlist->lock);
|
||||
|
@ -686,8 +686,8 @@ static const render_primitive_list *draw13_window_get_primitives(sdl_window_info
|
||||
{
|
||||
sdlwindow_blit_surface_size(window, window->monitor->center_width, window->monitor->center_height);
|
||||
}
|
||||
render_target_set_bounds(window->target, window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor));
|
||||
return render_target_get_primitives(window->target);
|
||||
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor));
|
||||
return window->target->get_primitives();
|
||||
}
|
||||
|
||||
//============================================================
|
||||
@ -758,7 +758,7 @@ static int draw13_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
||||
|
||||
switch (prim->type)
|
||||
{
|
||||
case RENDER_PRIMITIVE_LINE:
|
||||
case render_primitive::LINE:
|
||||
sr = (int)(255.0f * prim->color.r);
|
||||
sg = (int)(255.0f * prim->color.g);
|
||||
sb = (int)(255.0f * prim->color.b);
|
||||
@ -769,7 +769,7 @@ static int draw13_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
||||
SDL_RenderDrawLine(prim->bounds.x0 + hofs, prim->bounds.y0 + vofs,
|
||||
prim->bounds.x1 + hofs, prim->bounds.y1 + vofs);
|
||||
break;
|
||||
case RENDER_PRIMITIVE_QUAD:
|
||||
case render_primitive::QUAD:
|
||||
texture = texture_update(window, prim);
|
||||
if (texture)
|
||||
blit_pixels += (texture->rawheight * texture->rawwidth);
|
||||
|
@ -349,7 +349,7 @@ static int drawogl_window_create(sdl_window_info *window, int width, int height)
|
||||
static void drawogl_window_resize(sdl_window_info *window, int width, int height);
|
||||
static void drawogl_window_destroy(sdl_window_info *window);
|
||||
static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update);
|
||||
static const render_primitive_list *drawogl_window_get_primitives(sdl_window_info *window);
|
||||
static render_primitive_list &drawogl_window_get_primitives(sdl_window_info *window);
|
||||
static void drawogl_destroy_all_textures(sdl_window_info *window);
|
||||
static void drawogl_window_clear(sdl_window_info *window);
|
||||
static int drawogl_xy_to_render_target(sdl_window_info *window, int x, int y, int *xt, int *yt);
|
||||
@ -837,7 +837,7 @@ static int drawogl_xy_to_render_target(sdl_window_info *window, int x, int y, in
|
||||
// drawogl_window_get_primitives
|
||||
//============================================================
|
||||
|
||||
static const render_primitive_list *drawogl_window_get_primitives(sdl_window_info *window)
|
||||
static render_primitive_list &drawogl_window_get_primitives(sdl_window_info *window)
|
||||
{
|
||||
if ((!window->fullscreen) || (video_config.switchres))
|
||||
{
|
||||
@ -847,8 +847,8 @@ static const render_primitive_list *drawogl_window_get_primitives(sdl_window_inf
|
||||
{
|
||||
sdlwindow_blit_surface_size(window, window->monitor->center_width, window->monitor->center_height);
|
||||
}
|
||||
render_target_set_bounds(window->target, window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor));
|
||||
return render_target_get_primitives(window->target);
|
||||
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor));
|
||||
return window->target->get_primitives();
|
||||
}
|
||||
|
||||
//============================================================
|
||||
@ -1324,10 +1324,10 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
||||
sdl->last_hofs = hofs;
|
||||
sdl->last_vofs = vofs;
|
||||
|
||||
osd_lock_acquire(window->primlist->lock);
|
||||
window->primlist->acquire_lock();
|
||||
|
||||
// now draw
|
||||
for (prim = window->primlist->head; prim != NULL; prim = prim->next)
|
||||
for (prim = window->primlist->first(); prim != NULL; prim = prim->next())
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1337,7 +1337,7 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
||||
* Try to stay in one Begin/End block as long as possible,
|
||||
* since entering and leaving one is most expensive..
|
||||
*/
|
||||
case RENDER_PRIMITIVE_LINE:
|
||||
case render_primitive::LINE:
|
||||
#if !USE_WIN32_STYLE_LINES
|
||||
// check if it's really a point
|
||||
if (((prim->bounds.x1 - prim->bounds.x0) == 0) && ((prim->bounds.y1 - prim->bounds.y0) == 0))
|
||||
@ -1465,7 +1465,7 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RENDER_PRIMITIVE_QUAD:
|
||||
case render_primitive::QUAD:
|
||||
|
||||
if(pendingPrimitive!=GL_NO_PRIMITIVE)
|
||||
{
|
||||
@ -1531,6 +1531,9 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
||||
texture=NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw emu_fatalerror("Unexpected render_primitive type");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1540,7 +1543,7 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
||||
pendingPrimitive=GL_NO_PRIMITIVE;
|
||||
}
|
||||
|
||||
osd_lock_release(window->primlist->lock);
|
||||
window->primlist->release_lock();
|
||||
sdl->init_context = 0;
|
||||
|
||||
#if (!SDL_VERSION_ATLEAST(1,3,0))
|
||||
@ -2945,7 +2948,7 @@ static void texture_shader_update(sdl_window_info *window, texture_info *texture
|
||||
{
|
||||
if (scrnum == window->start_viewscreen)
|
||||
{
|
||||
container = render_container_get_screen(screen);
|
||||
container = &screen->container();
|
||||
}
|
||||
|
||||
scrnum++;
|
||||
@ -2953,8 +2956,8 @@ static void texture_shader_update(sdl_window_info *window, texture_info *texture
|
||||
|
||||
if (container!=NULL)
|
||||
{
|
||||
render_container_user_settings settings;
|
||||
render_container_get_user_settings(container, &settings);
|
||||
render_container::user_settings settings;
|
||||
container->get_user_settings(settings);
|
||||
//FIXME: Intended behaviour
|
||||
#if 1
|
||||
vid_attributes[0] = options_get_float(window->machine->options(), OPTION_GAMMA);
|
||||
@ -3128,10 +3131,10 @@ static void drawogl_destroy_all_textures(sdl_window_info *window)
|
||||
SDL_GL_MakeCurrent(window->sdl_window, sdl->gl_context_id);
|
||||
#endif
|
||||
|
||||
if(window->primlist && window->primlist->lock)
|
||||
if(window->primlist)
|
||||
{
|
||||
lock=TRUE;
|
||||
osd_lock_acquire(window->primlist->lock);
|
||||
window->primlist->acquire_lock();
|
||||
}
|
||||
|
||||
glFinish();
|
||||
@ -3210,7 +3213,7 @@ static void drawogl_destroy_all_textures(sdl_window_info *window)
|
||||
sdl->initialized = 0;
|
||||
|
||||
if (lock)
|
||||
osd_lock_release(window->primlist->lock);
|
||||
window->primlist->release_lock();
|
||||
}
|
||||
|
||||
//============================================================
|
||||
|
@ -102,7 +102,7 @@ static void drawsdl_attach(sdl_draw_info *info, sdl_window_info *window);
|
||||
static int drawsdl_window_create(sdl_window_info *window, int width, int height);
|
||||
static void drawsdl_window_resize(sdl_window_info *window, int width, int height);
|
||||
static void drawsdl_window_destroy(sdl_window_info *window);
|
||||
static const render_primitive_list *drawsdl_window_get_primitives(sdl_window_info *window);
|
||||
static render_primitive_list &drawsdl_window_get_primitives(sdl_window_info *window);
|
||||
static int drawsdl_window_draw(sdl_window_info *window, UINT32 dc, int update);
|
||||
static void drawsdl_destroy_all_textures(sdl_window_info *window);
|
||||
static void drawsdl_window_clear(sdl_window_info *window);
|
||||
@ -113,11 +113,11 @@ static void setup_texture(sdl_window_info *window, int tempwidth, int tempheight
|
||||
#endif
|
||||
|
||||
// soft rendering
|
||||
static void drawsdl_rgb888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawsdl_bgr888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawsdl_bgra888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawsdl_rgb565_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawsdl_rgb555_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawsdl_rgb888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawsdl_bgr888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawsdl_bgra888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawsdl_rgb565_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawsdl_rgb555_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
|
||||
// YUV overlays
|
||||
|
||||
@ -265,7 +265,7 @@ static void setup_texture(sdl_window_info *window, int tempwidth, int tempheight
|
||||
|
||||
if (sdl_sm->is_scale)
|
||||
{
|
||||
render_target_get_minimum_size(window->target, &sdl->hw_scale_width, &sdl->hw_scale_height);
|
||||
window->target->compute_minimum_size(sdl->hw_scale_width, sdl->hw_scale_height);
|
||||
if (video_config.prescale)
|
||||
{
|
||||
sdl->hw_scale_width *= video_config.prescale;
|
||||
@ -308,7 +308,7 @@ static void yuv_overlay_init(sdl_window_info *window)
|
||||
const sdl_scale_mode *sdl_sm = sdl->scale_mode;
|
||||
int minimum_width, minimum_height;
|
||||
|
||||
render_target_get_minimum_size(window->target, &minimum_width, &minimum_height);
|
||||
window->target->compute_minimum_size(minimum_width, minimum_height);
|
||||
|
||||
if (video_config.prescale)
|
||||
{
|
||||
@ -615,7 +615,7 @@ static int drawsdl_xy_to_render_target(sdl_window_info *window, int x, int y, in
|
||||
// drawsdl_window_get_primitives
|
||||
//============================================================
|
||||
|
||||
static const render_primitive_list *drawsdl_window_get_primitives(sdl_window_info *window)
|
||||
static render_primitive_list &drawsdl_window_get_primitives(sdl_window_info *window)
|
||||
{
|
||||
sdl_info *sdl = (sdl_info *) window->dxdata;
|
||||
|
||||
@ -628,10 +628,10 @@ static const render_primitive_list *drawsdl_window_get_primitives(sdl_window_inf
|
||||
sdlwindow_blit_surface_size(window, window->monitor->center_width, window->monitor->center_height);
|
||||
}
|
||||
if (!sdl->scale_mode->is_scale)
|
||||
render_target_set_bounds(window->target, window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor));
|
||||
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor));
|
||||
else
|
||||
render_target_set_bounds(window->target, sdl->hw_scale_width, sdl->hw_scale_height, 0);
|
||||
return render_target_get_primitives(window->target);
|
||||
window->target->set_bounds(sdl->hw_scale_width, sdl->hw_scale_height);
|
||||
return window->target->get_primitives();
|
||||
}
|
||||
|
||||
//============================================================
|
||||
@ -768,7 +768,7 @@ static int drawsdl_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
||||
sdl->last_hofs = hofs;
|
||||
sdl->last_vofs = vofs;
|
||||
|
||||
osd_lock_acquire(window->primlist->lock);
|
||||
window->primlist->acquire_lock();
|
||||
|
||||
// render to it
|
||||
if (!sdl->scale_mode->is_yuv)
|
||||
@ -791,23 +791,23 @@ static int drawsdl_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
||||
switch (rmask)
|
||||
{
|
||||
case 0x0000ff00:
|
||||
drawsdl_bgra888_draw_primitives(window->primlist->head, surfptr, mamewidth, mameheight, pitch / 4);
|
||||
drawsdl_bgra888_draw_primitives(*window->primlist, surfptr, mamewidth, mameheight, pitch / 4);
|
||||
break;
|
||||
|
||||
case 0x00ff0000:
|
||||
drawsdl_rgb888_draw_primitives(window->primlist->head, surfptr, mamewidth, mameheight, pitch / 4);
|
||||
drawsdl_rgb888_draw_primitives(*window->primlist, surfptr, mamewidth, mameheight, pitch / 4);
|
||||
break;
|
||||
|
||||
case 0x000000ff:
|
||||
drawsdl_bgr888_draw_primitives(window->primlist->head, surfptr, mamewidth, mameheight, pitch / 4);
|
||||
drawsdl_bgr888_draw_primitives(*window->primlist, surfptr, mamewidth, mameheight, pitch / 4);
|
||||
break;
|
||||
|
||||
case 0xf800:
|
||||
drawsdl_rgb565_draw_primitives(window->primlist->head, surfptr, mamewidth, mameheight, pitch / 2);
|
||||
drawsdl_rgb565_draw_primitives(*window->primlist, surfptr, mamewidth, mameheight, pitch / 2);
|
||||
break;
|
||||
|
||||
case 0x7c00:
|
||||
drawsdl_rgb555_draw_primitives(window->primlist->head, surfptr, mamewidth, mameheight, pitch / 2);
|
||||
drawsdl_rgb555_draw_primitives(*window->primlist, surfptr, mamewidth, mameheight, pitch / 2);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -819,11 +819,11 @@ static int drawsdl_window_draw(sdl_window_info *window, UINT32 dc, int update)
|
||||
{
|
||||
assert (sdl->yuv_bitmap != NULL);
|
||||
assert (surfptr != NULL);
|
||||
drawsdl_rgb555_draw_primitives(window->primlist->head, sdl->yuv_bitmap, sdl->hw_scale_width, sdl->hw_scale_height, sdl->hw_scale_width);
|
||||
drawsdl_rgb555_draw_primitives(*window->primlist, sdl->yuv_bitmap, sdl->hw_scale_width, sdl->hw_scale_height, sdl->hw_scale_width);
|
||||
sdl->scale_mode->yuv_blit((UINT16 *)sdl->yuv_bitmap, sdl, surfptr, pitch);
|
||||
}
|
||||
|
||||
osd_lock_release(window->primlist->lock);
|
||||
window->primlist->release_lock();
|
||||
|
||||
// unlock and flip
|
||||
#if (!SDL_VERSION_ATLEAST(1,3,0))
|
||||
|
@ -423,6 +423,6 @@ GtkWidget *dview_new(const gchar *widget_name, const gchar *string1, const gchar
|
||||
|
||||
void dview_set_debug_view(DView *dv, running_machine *machine, debug_view_type type)
|
||||
{
|
||||
dv->view = machine->m_debug_view->alloc_view(type, dview_update, dv);
|
||||
dv->view = machine->debug_view().alloc_view(type, dview_update, dv);
|
||||
dv->dv_type = type;
|
||||
}
|
||||
|
@ -838,7 +838,7 @@ static void load_effect_overlay(running_machine *machine, const char *filename)
|
||||
|
||||
// set the overlay on all screens
|
||||
for (screen_device *screen = screen_first(*machine); screen != NULL; screen = screen_next(screen))
|
||||
render_container_set_overlay(render_container_get_screen(screen), effect_bitmap);
|
||||
screen->container().set_overlay(effect_bitmap);
|
||||
|
||||
global_free(tempstr);
|
||||
}
|
||||
|
@ -347,14 +347,14 @@ void sdlwindow_blit_surface_size(sdl_window_info *window, int window_width, int
|
||||
INT32 target_height = window_height;
|
||||
|
||||
// start with the minimum size
|
||||
render_target_get_minimum_size(window->target, &newwidth, &newheight);
|
||||
window->target->compute_minimum_size(newwidth, newheight);
|
||||
|
||||
// compute the appropriate visible area if we're trying to keepaspect
|
||||
if (video_config.keepaspect)
|
||||
{
|
||||
// make sure the monitor is up-to-date
|
||||
sdlvideo_monitor_refresh(window->monitor);
|
||||
render_target_compute_visible_area(window->target, target_width, target_height, sdlvideo_monitor_get_aspect(window->monitor), render_target_get_orientation(window->target), &target_width, &target_height);
|
||||
window->target->compute_visible_area(target_width, target_height, sdlvideo_monitor_get_aspect(window->monitor), window->target->orientation(), target_width, target_height);
|
||||
desired_aspect = (float)target_width / (float)target_height;
|
||||
}
|
||||
|
||||
@ -406,7 +406,7 @@ void sdlwindow_blit_surface_size(sdl_window_info *window, int window_width, int
|
||||
}
|
||||
|
||||
//FIXME: really necessary to distinguish for yuv_modes ?
|
||||
if ((render_target_get_layer_config(window->target) & LAYER_CONFIG_ZOOM_TO_SCREEN)
|
||||
if (window->target->zoom_to_screen()
|
||||
&& (window->scale_mode == VIDEO_SCALE_MODE_NONE ))
|
||||
newwidth = window_width;
|
||||
|
||||
@ -695,12 +695,7 @@ int sdlwindow_video_window_create(running_machine *machine, int index, sdl_monit
|
||||
window->rendered_event = osd_event_alloc(FALSE, TRUE);
|
||||
|
||||
// load the layout
|
||||
window->target = render_target_alloc(machine, NULL, FALSE);
|
||||
if (window->target == NULL)
|
||||
{
|
||||
osd_free(wp);
|
||||
goto error;
|
||||
}
|
||||
window->target = machine->render().target_alloc();
|
||||
|
||||
// set the specific view
|
||||
sprintf(option, SDLOPTION_VIEW("%d"), index);
|
||||
@ -789,8 +784,7 @@ static void sdlwindow_video_window_destroy(running_machine *machine, sdl_window_
|
||||
execute_async_wait(&sdlwindow_video_window_destroy_wt, &wp);
|
||||
|
||||
// free the render target, after the textures!
|
||||
if (window->target != NULL)
|
||||
render_target_free(window->target);
|
||||
window->machine->render().target_free(window->target);
|
||||
|
||||
// free the event
|
||||
osd_event_free(window->rendered_event);
|
||||
@ -813,7 +807,7 @@ static void pick_best_mode(sdl_window_info *window, int *fswidth, int *fsheight)
|
||||
float size_score, best_score = 0.0f;
|
||||
|
||||
// determine the minimum width/height for the selected target
|
||||
render_target_get_minimum_size(window->target, &minimum_width, &minimum_height);
|
||||
window->target->compute_minimum_size(minimum_width, minimum_height);
|
||||
|
||||
// use those as the target for now
|
||||
target_width = minimum_width * MAX(1, window->prescale);
|
||||
@ -880,7 +874,7 @@ static void pick_best_mode(sdl_window_info *window, int *fswidth, int *fsheight)
|
||||
SDL_Rect **modes;
|
||||
|
||||
// determine the minimum width/height for the selected target
|
||||
render_target_get_minimum_size(window->target, &minimum_width, &minimum_height);
|
||||
window->target->compute_minimum_size(minimum_width, minimum_height);
|
||||
|
||||
// use those as the target for now
|
||||
target_width = minimum_width * MAX(1, window->prescale);
|
||||
@ -966,7 +960,7 @@ void sdlwindow_video_window_update(running_machine *machine, sdl_window_info *wi
|
||||
int tempwidth, tempheight;
|
||||
|
||||
// see if the games video mode has changed
|
||||
render_target_get_minimum_size(window->target, &tempwidth, &tempheight);
|
||||
window->target->compute_minimum_size(tempwidth, tempheight);
|
||||
if (tempwidth != window->minwidth || tempheight != window->minheight)
|
||||
{
|
||||
window->minwidth = tempwidth;
|
||||
@ -1026,7 +1020,7 @@ static void set_starting_view(running_machine *machine, int index, sdl_window_in
|
||||
viewindex = video_get_view_for_target(machine, window->target, view, index, video_config.numscreens);
|
||||
|
||||
// set the view
|
||||
render_target_set_view(window->target, viewindex);
|
||||
window->target->set_view(viewindex);
|
||||
window->start_viewscreen=viewindex;
|
||||
}
|
||||
|
||||
@ -1208,21 +1202,21 @@ static void constrain_to_aspect_ratio(sdl_window_info *window, int *window_width
|
||||
{
|
||||
case WMSZ_BOTTOM:
|
||||
case WMSZ_TOP:
|
||||
render_target_compute_visible_area(window->target, 10000, propheight, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight);
|
||||
window->target->compute_visible_area(10000, propheight, pixel_aspect, window->target->orientation(), propwidth, propheight);
|
||||
break;
|
||||
|
||||
case WMSZ_LEFT:
|
||||
case WMSZ_RIGHT:
|
||||
render_target_compute_visible_area(window->target, propwidth, 10000, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight);
|
||||
window->target->compute_visible_area(propwidth, 10000, pixel_aspect, window->target->orientation(), propwidth, propheight);
|
||||
break;
|
||||
|
||||
default:
|
||||
render_target_compute_visible_area(window->target, propwidth, propheight, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight);
|
||||
window->target->compute_visible_area(propwidth, propheight, pixel_aspect, window->target->orientation(), propwidth, propheight);
|
||||
break;
|
||||
}
|
||||
|
||||
// get the minimum width/height for the current layout
|
||||
render_target_get_minimum_size(window->target, &minwidth, &minheight);
|
||||
window->target->compute_minimum_size(minwidth, minheight);
|
||||
|
||||
// clamp against the absolute minimum
|
||||
propwidth = MAX(propwidth, MIN_WINDOW_DIM);
|
||||
@ -1255,7 +1249,7 @@ static void constrain_to_aspect_ratio(sdl_window_info *window, int *window_width
|
||||
propheight = MIN(propheight, maxheight);
|
||||
|
||||
// compute the visible area based on the proposed rectangle
|
||||
render_target_compute_visible_area(window->target, propwidth, propheight, pixel_aspect, render_target_get_orientation(window->target), &viswidth, &visheight);
|
||||
window->target->compute_visible_area(propwidth, propheight, pixel_aspect, window->target->orientation(), viswidth, visheight);
|
||||
|
||||
*window_width = viswidth;
|
||||
*window_height = visheight;
|
||||
@ -1272,7 +1266,7 @@ static void get_min_bounds(sdl_window_info *window, int *window_width, int *wind
|
||||
INT32 minwidth, minheight;
|
||||
|
||||
// get the minimum target size
|
||||
render_target_get_minimum_size(window->target, &minwidth, &minheight);
|
||||
window->target->compute_minimum_size(minwidth, minheight);
|
||||
|
||||
// expand to our minimum dimensions
|
||||
if (minwidth < MIN_WINDOW_DIM)
|
||||
|
@ -45,7 +45,7 @@ struct _sdl_window_info
|
||||
int (*create)(sdl_window_info *window, int width, int height);
|
||||
void (*resize)(sdl_window_info *window, int width, int height);
|
||||
int (*draw)(sdl_window_info *window, UINT32 dc, int update);
|
||||
const render_primitive_list *(*get_primitives)(sdl_window_info *window);
|
||||
render_primitive_list &(*get_primitives)(sdl_window_info *window);
|
||||
int (*xy_to_render_target)(sdl_window_info *window, int x, int y, int *xt, int *yt);
|
||||
void (*destroy_all_textures)(sdl_window_info *window);
|
||||
void (*destroy)(sdl_window_info *window);
|
||||
@ -71,7 +71,7 @@ struct _sdl_window_info
|
||||
// rendering info
|
||||
osd_event * rendered_event;
|
||||
render_target * target;
|
||||
const render_primitive_list *primlist;
|
||||
render_primitive_list *primlist;
|
||||
|
||||
// drawing data
|
||||
void * dxdata;
|
||||
|
@ -607,7 +607,7 @@ static void debugwin_window_free(debugwin_info *info)
|
||||
for (viewnum = 0; viewnum < ARRAY_LENGTH(info->view); viewnum++)
|
||||
if (info->view[viewnum].view != NULL)
|
||||
{
|
||||
info->machine->m_debug_view->free_view(*info->view[viewnum].view);
|
||||
info->machine->debug_view().free_view(*info->view[viewnum].view);
|
||||
info->view[viewnum].view = NULL;
|
||||
}
|
||||
|
||||
@ -851,7 +851,7 @@ static int debugwin_view_create(debugwin_info *info, int which, debug_view_type
|
||||
goto cleanup;
|
||||
|
||||
// create the debug view
|
||||
view->view = info->machine->m_debug_view->alloc_view(type, debugwin_view_update, view);
|
||||
view->view = info->machine->debug_view().alloc_view(type, debugwin_view_update, view);
|
||||
if (view->view == NULL)
|
||||
goto cleanup;
|
||||
|
||||
@ -859,7 +859,7 @@ static int debugwin_view_create(debugwin_info *info, int which, debug_view_type
|
||||
|
||||
cleanup:
|
||||
if (view->view)
|
||||
info->machine->m_debug_view->free_view(*view->view);
|
||||
info->machine->debug_view().free_view(*view->view);
|
||||
if (view->hscroll)
|
||||
DestroyWindow(view->hscroll);
|
||||
if (view->vscroll)
|
||||
@ -1468,7 +1468,7 @@ static LRESULT CALLBACK debugwin_view_proc(HWND wnd, UINT message, WPARAM wparam
|
||||
debug_view_xy topleft = info->view->visible_position();
|
||||
topleft.x = debugwin_view_process_scroll(info, LOWORD(wparam), (HWND)lparam);
|
||||
info->view->set_visible_position(topleft);
|
||||
info->owner->machine->m_debug_view->flush_osd_updates();
|
||||
info->owner->machine->debug_view().flush_osd_updates();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1478,7 +1478,7 @@ static LRESULT CALLBACK debugwin_view_proc(HWND wnd, UINT message, WPARAM wparam
|
||||
debug_view_xy topleft = info->view->visible_position();
|
||||
topleft.y = debugwin_view_process_scroll(info, LOWORD(wparam), (HWND)lparam);
|
||||
info->view->set_visible_position(topleft);
|
||||
info->owner->machine->m_debug_view->flush_osd_updates();
|
||||
info->owner->machine->debug_view().flush_osd_updates();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2484,11 +2484,11 @@ void console_create_window(running_machine *machine)
|
||||
|
||||
cleanup:
|
||||
if (info->view[2].view)
|
||||
machine->m_debug_view->free_view(*info->view[2].view);
|
||||
machine->debug_view().free_view(*info->view[2].view);
|
||||
if (info->view[1].view)
|
||||
machine->m_debug_view->free_view(*info->view[1].view);
|
||||
machine->debug_view().free_view(*info->view[1].view);
|
||||
if (info->view[0].view)
|
||||
machine->m_debug_view->free_view(*info->view[0].view);
|
||||
machine->debug_view().free_view(*info->view[0].view);
|
||||
}
|
||||
|
||||
|
||||
|
@ -439,7 +439,7 @@ INLINE void reset_render_states(d3d_info *d3d)
|
||||
static void drawd3d_exit(void);
|
||||
static int drawd3d_window_init(win_window_info *window);
|
||||
static void drawd3d_window_destroy(win_window_info *window);
|
||||
static const render_primitive_list *drawd3d_window_get_primitives(win_window_info *window);
|
||||
static render_primitive_list *drawd3d_window_get_primitives(win_window_info *window);
|
||||
static int drawd3d_window_draw(win_window_info *window, HDC dc, int update);
|
||||
|
||||
// devices
|
||||
@ -591,7 +591,7 @@ static void drawd3d_window_destroy(win_window_info *window)
|
||||
// drawd3d_window_get_primitives
|
||||
//============================================================
|
||||
|
||||
static const render_primitive_list *drawd3d_window_get_primitives(win_window_info *window)
|
||||
static render_primitive_list *drawd3d_window_get_primitives(win_window_info *window)
|
||||
{
|
||||
d3d_info *d3d = (d3d_info *)window->drawdata;
|
||||
RECT client;
|
||||
@ -599,10 +599,10 @@ static const render_primitive_list *drawd3d_window_get_primitives(win_window_inf
|
||||
GetClientRectExceptMenu(window->hwnd, &client, window->fullscreen);
|
||||
if (rect_width(&client) > 0 && rect_height(&client) > 0)
|
||||
{
|
||||
render_target_set_bounds(window->target, rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor));
|
||||
render_target_set_max_update_rate(window->target, (d3d->refresh == 0) ? d3d->origmode.RefreshRate : d3d->refresh);
|
||||
window->target->set_bounds(rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor));
|
||||
window->target->set_max_update_rate((d3d->refresh == 0) ? d3d->origmode.RefreshRate : d3d->refresh);
|
||||
}
|
||||
return render_target_get_primitives(window->target);
|
||||
return &window->target->get_primitives();
|
||||
}
|
||||
|
||||
|
||||
@ -614,7 +614,7 @@ static const render_primitive_list *drawd3d_window_get_primitives(win_window_inf
|
||||
static int drawd3d_window_draw(win_window_info *window, HDC dc, int update)
|
||||
{
|
||||
d3d_info *d3d = (d3d_info *)window->drawdata;
|
||||
const render_primitive *prim;
|
||||
render_primitive *prim;
|
||||
HRESULT result;
|
||||
|
||||
// if we haven't been created, just punt
|
||||
@ -644,8 +644,8 @@ static int drawd3d_window_draw(win_window_info *window, HDC dc, int update)
|
||||
mtlog_add("drawd3d_window_draw: begin");
|
||||
|
||||
// first update any textures
|
||||
osd_lock_acquire(window->primlist->lock);
|
||||
for (prim = window->primlist->head; prim != NULL; prim = prim->next)
|
||||
window->primlist->acquire_lock();
|
||||
for (prim = window->primlist->first(); prim != NULL; prim = prim->next())
|
||||
if (prim->texture.base != NULL)
|
||||
texture_update(d3d, prim);
|
||||
|
||||
@ -658,19 +658,22 @@ mtlog_add("drawd3d_window_draw: begin_scene");
|
||||
|
||||
// loop over primitives
|
||||
mtlog_add("drawd3d_window_draw: primitive loop begin");
|
||||
for (prim = window->primlist->head; prim != NULL; prim = prim->next)
|
||||
for (prim = window->primlist->first(); prim != NULL; prim = prim->next())
|
||||
switch (prim->type)
|
||||
{
|
||||
case RENDER_PRIMITIVE_LINE:
|
||||
case render_primitive::LINE:
|
||||
draw_line(d3d, prim);
|
||||
break;
|
||||
|
||||
case RENDER_PRIMITIVE_QUAD:
|
||||
case render_primitive::QUAD:
|
||||
draw_quad(d3d, prim);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw emu_fatalerror("Unexpected render_primitive type");
|
||||
}
|
||||
mtlog_add("drawd3d_window_draw: primitive loop end");
|
||||
osd_lock_release(window->primlist->lock);
|
||||
window->primlist->release_lock();
|
||||
|
||||
// flush any pending polygons
|
||||
mtlog_add("drawd3d_window_draw: flush_pending begin");
|
||||
@ -796,7 +799,7 @@ try_again:
|
||||
mame_printf_verbose("Direct3D: Device created at %dx%d\n", d3d->width, d3d->height);
|
||||
|
||||
// set the max texture size
|
||||
render_target_set_max_texture_size(window->target, d3d->texture_max_width, d3d->texture_max_height);
|
||||
window->target->set_max_texture_size(d3d->texture_max_width, d3d->texture_max_height);
|
||||
mame_printf_verbose("Direct3D: Max texture size = %dx%d\n", (int)d3d->texture_max_width, (int)d3d->texture_max_height);
|
||||
|
||||
// set the gamma if we need to
|
||||
@ -1288,7 +1291,7 @@ static void pick_best_mode(win_window_info *window)
|
||||
// note: technically we should not be calling this from an alternate window
|
||||
// thread; however, it is only done during init time, and the init code on
|
||||
// the main thread is waiting for us to finish, so it is safe to do so here
|
||||
render_target_get_minimum_size(window->target, &minwidth, &minheight);
|
||||
window->target->compute_minimum_size(minwidth, minheight);
|
||||
|
||||
// use those as the target for now
|
||||
target_width = minwidth;
|
||||
|
@ -178,7 +178,7 @@ INLINE int better_mode(int width0, int height0, int width1, int height1, float d
|
||||
static void drawdd_exit(void);
|
||||
static int drawdd_window_init(win_window_info *window);
|
||||
static void drawdd_window_destroy(win_window_info *window);
|
||||
static const render_primitive_list *drawdd_window_get_primitives(win_window_info *window);
|
||||
static render_primitive_list *drawdd_window_get_primitives(win_window_info *window);
|
||||
static int drawdd_window_draw(win_window_info *window, HDC dc, int update);
|
||||
|
||||
// surface management
|
||||
@ -201,14 +201,14 @@ static void get_adapter_for_monitor(dd_info *dd, win_monitor_info *monitor);
|
||||
static void pick_best_mode(win_window_info *window);
|
||||
|
||||
// rendering
|
||||
static void drawdd_rgb888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_bgr888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_rgb565_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_rgb555_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_rgb888_nr_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_bgr888_nr_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_rgb565_nr_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_rgb555_nr_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_rgb888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_bgr888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_rgb565_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_rgb555_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_rgb888_nr_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_bgr888_nr_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_rgb565_nr_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawdd_rgb555_nr_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
|
||||
|
||||
|
||||
@ -327,15 +327,15 @@ static void drawdd_window_destroy(win_window_info *window)
|
||||
// drawdd_window_get_primitives
|
||||
//============================================================
|
||||
|
||||
static const render_primitive_list *drawdd_window_get_primitives(win_window_info *window)
|
||||
static render_primitive_list *drawdd_window_get_primitives(win_window_info *window)
|
||||
{
|
||||
dd_info *dd = (dd_info *)window->drawdata;
|
||||
|
||||
compute_blit_surface_size(window);
|
||||
render_target_set_bounds(window->target, dd->blitwidth, dd->blitheight, 0);
|
||||
render_target_set_max_update_rate(window->target, (dd->refresh == 0) ? dd->origmode.dwRefreshRate : dd->refresh);
|
||||
window->target->set_bounds(dd->blitwidth, dd->blitheight, 0);
|
||||
window->target->set_max_update_rate((dd->refresh == 0) ? dd->origmode.dwRefreshRate : dd->refresh);
|
||||
|
||||
return render_target_get_primitives(window->target);
|
||||
return &window->target->get_primitives();
|
||||
}
|
||||
|
||||
|
||||
@ -347,7 +347,7 @@ static const render_primitive_list *drawdd_window_get_primitives(win_window_info
|
||||
static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
|
||||
{
|
||||
dd_info *dd = (dd_info *)window->drawdata;
|
||||
const render_primitive *prim;
|
||||
render_primitive *prim;
|
||||
int usemembuffer = FALSE;
|
||||
HRESULT result;
|
||||
|
||||
@ -386,10 +386,10 @@ static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
|
||||
}
|
||||
|
||||
// render to it
|
||||
osd_lock_acquire(window->primlist->lock);
|
||||
window->primlist->acquire_lock();
|
||||
|
||||
// scan the list of primitives for tricky stuff
|
||||
for (prim = window->primlist->head; prim != NULL; prim = prim->next)
|
||||
for (prim = window->primlist->first(); prim != NULL; prim = prim->next())
|
||||
if (PRIMFLAG_GET_BLENDMODE(prim->flags) != BLENDMODE_NONE ||
|
||||
(prim->texture.base != NULL && PRIMFLAG_GET_TEXFORMAT(prim->flags) == TEXFORMAT_ARGB32))
|
||||
{
|
||||
@ -405,10 +405,10 @@ static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
|
||||
// based on the target format, use one of our standard renderers
|
||||
switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask)
|
||||
{
|
||||
case 0x00ff0000: drawdd_rgb888_draw_primitives(window->primlist->head, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
|
||||
case 0x000000ff: drawdd_bgr888_draw_primitives(window->primlist->head, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
|
||||
case 0xf800: drawdd_rgb565_draw_primitives(window->primlist->head, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
|
||||
case 0x7c00: drawdd_rgb555_draw_primitives(window->primlist->head, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
|
||||
case 0x00ff0000: drawdd_rgb888_draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
|
||||
case 0x000000ff: drawdd_bgr888_draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
|
||||
case 0xf800: drawdd_rgb565_draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
|
||||
case 0x7c00: drawdd_rgb555_draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
|
||||
default:
|
||||
mame_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask);
|
||||
break;
|
||||
@ -441,16 +441,16 @@ static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
|
||||
// based on the target format, use one of our standard renderers
|
||||
switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask)
|
||||
{
|
||||
case 0x00ff0000: drawdd_rgb888_nr_draw_primitives(window->primlist->head, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
|
||||
case 0x000000ff: drawdd_bgr888_nr_draw_primitives(window->primlist->head, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
|
||||
case 0xf800: drawdd_rgb565_nr_draw_primitives(window->primlist->head, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
|
||||
case 0x7c00: drawdd_rgb555_nr_draw_primitives(window->primlist->head, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
|
||||
case 0x00ff0000: drawdd_rgb888_nr_draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
|
||||
case 0x000000ff: drawdd_bgr888_nr_draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
|
||||
case 0xf800: drawdd_rgb565_nr_draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
|
||||
case 0x7c00: drawdd_rgb555_nr_draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
|
||||
default:
|
||||
mame_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
osd_lock_release(window->primlist->lock);
|
||||
window->primlist->release_lock();
|
||||
|
||||
// unlock and blit
|
||||
result = IDirectDrawSurface7_Unlock(dd->blit, NULL);
|
||||
@ -879,7 +879,7 @@ static void compute_blit_surface_size(win_window_info *window)
|
||||
RECT client;
|
||||
|
||||
// start with the minimum size
|
||||
render_target_get_minimum_size(window->target, &newwidth, &newheight);
|
||||
window->target->compute_minimum_size(newwidth, newheight);
|
||||
|
||||
// get the window's client rectangle
|
||||
GetClientRect(window->hwnd, &client);
|
||||
@ -909,7 +909,7 @@ static void compute_blit_surface_size(win_window_info *window)
|
||||
if (video_config.keepaspect)
|
||||
{
|
||||
win_monitor_info *monitor = winwindow_video_window_monitor(window, NULL);
|
||||
render_target_compute_visible_area(window->target, target_width, target_height, winvideo_monitor_get_aspect(monitor), render_target_get_orientation(window->target), &target_width, &target_height);
|
||||
window->target->compute_visible_area(target_width, target_height, winvideo_monitor_get_aspect(monitor), window->target->orientation(), target_width, target_height);
|
||||
desired_aspect = (float)target_width / (float)target_height;
|
||||
}
|
||||
|
||||
@ -1054,7 +1054,7 @@ static void blit_to_primary(win_window_info *window, int srcwidth, int srcheight
|
||||
else if (video_config.keepaspect)
|
||||
{
|
||||
// compute the appropriate visible area
|
||||
render_target_compute_visible_area(window->target, rect_width(&outer), rect_height(&outer), winvideo_monitor_get_aspect(monitor), render_target_get_orientation(window->target), &dstwidth, &dstheight);
|
||||
window->target->compute_visible_area(rect_width(&outer), rect_height(&outer), winvideo_monitor_get_aspect(monitor), window->target->orientation(), dstwidth, dstheight);
|
||||
}
|
||||
|
||||
// center within
|
||||
@ -1325,7 +1325,7 @@ static void pick_best_mode(win_window_info *window)
|
||||
// note: technically we should not be calling this from an alternate window
|
||||
// thread; however, it is only done during init time, and the init code on
|
||||
// the main thread is waiting for us to finish, so it is safe to do so here
|
||||
render_target_get_minimum_size(window->target, &einfo.minimum_width, &einfo.minimum_height);
|
||||
window->target->compute_minimum_size(einfo.minimum_width, einfo.minimum_height);
|
||||
|
||||
// use those as the target for now
|
||||
einfo.target_width = einfo.minimum_width * MAX(1, video_config.prescale);
|
||||
|
@ -75,11 +75,11 @@ struct _gdi_info
|
||||
static void drawgdi_exit(void);
|
||||
static int drawgdi_window_init(win_window_info *window);
|
||||
static void drawgdi_window_destroy(win_window_info *window);
|
||||
static const render_primitive_list *drawgdi_window_get_primitives(win_window_info *window);
|
||||
static render_primitive_list *drawgdi_window_get_primitives(win_window_info *window);
|
||||
static int drawgdi_window_draw(win_window_info *window, HDC dc, int update);
|
||||
|
||||
// rendering
|
||||
static void drawgdi_rgb888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
static void drawgdi_rgb888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
|
||||
|
||||
|
||||
|
||||
@ -172,12 +172,12 @@ static void drawgdi_window_destroy(win_window_info *window)
|
||||
// drawgdi_window_get_primitives
|
||||
//============================================================
|
||||
|
||||
static const render_primitive_list *drawgdi_window_get_primitives(win_window_info *window)
|
||||
static render_primitive_list *drawgdi_window_get_primitives(win_window_info *window)
|
||||
{
|
||||
RECT client;
|
||||
GetClientRect(window->hwnd, &client);
|
||||
render_target_set_bounds(window->target, rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor));
|
||||
return render_target_get_primitives(window->target);
|
||||
window->target->set_bounds(rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor));
|
||||
return &window->target->get_primitives();
|
||||
}
|
||||
|
||||
|
||||
@ -213,9 +213,9 @@ static int drawgdi_window_draw(win_window_info *window, HDC dc, int update)
|
||||
}
|
||||
|
||||
// draw the primitives to the bitmap
|
||||
osd_lock_acquire(window->primlist->lock);
|
||||
drawgdi_rgb888_draw_primitives(window->primlist->head, gdi->bmdata, width, height, pitch);
|
||||
osd_lock_release(window->primlist->lock);
|
||||
window->primlist->acquire_lock();
|
||||
drawgdi_rgb888_draw_primitives(*window->primlist, gdi->bmdata, width, height, pitch);
|
||||
window->primlist->release_lock();
|
||||
|
||||
// fill in bitmap-specific info
|
||||
gdi->bminfo.bmiHeader.biWidth = pitch;
|
||||
|
@ -59,7 +59,7 @@
|
||||
static void drawnone_exit(void);
|
||||
static int drawnone_window_init(win_window_info *window);
|
||||
static void drawnone_window_destroy(win_window_info *window);
|
||||
static const render_primitive_list *drawnone_window_get_primitives(win_window_info *window);
|
||||
static render_primitive_list *drawnone_window_get_primitives(win_window_info *window);
|
||||
static int drawnone_window_draw(win_window_info *window, HDC dc, int update);
|
||||
|
||||
|
||||
@ -116,12 +116,12 @@ static void drawnone_window_destroy(win_window_info *window)
|
||||
// drawnone_window_get_primitives
|
||||
//============================================================
|
||||
|
||||
static const render_primitive_list *drawnone_window_get_primitives(win_window_info *window)
|
||||
static render_primitive_list *drawnone_window_get_primitives(win_window_info *window)
|
||||
{
|
||||
RECT client;
|
||||
GetClientRect(window->hwnd, &client);
|
||||
render_target_set_bounds(window->target, rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor));
|
||||
return render_target_get_primitives(window->target);
|
||||
window->target->set_bounds(rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor));
|
||||
return &window->target->get_primitives();
|
||||
}
|
||||
|
||||
|
||||
|
@ -490,7 +490,7 @@ static void load_effect_overlay(running_machine *machine, const char *filename)
|
||||
|
||||
// set the overlay on all screens
|
||||
for (screen_device *screen = screen_first(*machine); screen != NULL; screen = screen_next(screen))
|
||||
render_container_set_overlay(render_container_get_screen(screen), effect_bitmap);
|
||||
screen->container().set_overlay(effect_bitmap);
|
||||
|
||||
global_free(tempstr);
|
||||
}
|
||||
|
@ -636,18 +636,16 @@ void winwindow_video_window_create(running_machine *machine, int index, win_moni
|
||||
window->render_lock = osd_lock_alloc();
|
||||
|
||||
// load the layout
|
||||
window->target = render_target_alloc(machine, NULL, 0);
|
||||
if (window->target == NULL)
|
||||
fatalerror("Error creating render target for window %d", index);
|
||||
window->target = machine->render().target_alloc();
|
||||
|
||||
// set the specific view
|
||||
sprintf(option, "view%d", index);
|
||||
set_starting_view(index, window, options_get_string(machine->options(), option));
|
||||
|
||||
// remember the current values in case they change
|
||||
window->targetview = render_target_get_view(window->target);
|
||||
window->targetorient = render_target_get_orientation(window->target);
|
||||
window->targetlayerconfig = render_target_get_layer_config(window->target);
|
||||
window->targetview = window->target->view();
|
||||
window->targetorient = window->target->orientation();
|
||||
window->targetlayerconfig = window->target->layer_config();
|
||||
|
||||
// make the window title
|
||||
if (video_config.numscreens == 1)
|
||||
@ -702,8 +700,7 @@ static void winwindow_video_window_destroy(win_window_info *window)
|
||||
SendMessage(window->hwnd, WM_USER_SELF_TERMINATE, 0, 0);
|
||||
|
||||
// free the render target
|
||||
if (window->target != NULL)
|
||||
render_target_free(window->target);
|
||||
window->machine->render().target_free(window->target);
|
||||
|
||||
// free the lock
|
||||
osd_lock_free(window->render_lock);
|
||||
@ -728,9 +725,9 @@ void winwindow_video_window_update(win_window_info *window)
|
||||
mtlog_add("winwindow_video_window_update: begin");
|
||||
|
||||
// see if the target has changed significantly in window mode
|
||||
targetview = render_target_get_view(window->target);
|
||||
targetorient = render_target_get_orientation(window->target);
|
||||
targetlayerconfig = render_target_get_layer_config(window->target);
|
||||
targetview = window->target->view();
|
||||
targetorient = window->target->orientation();
|
||||
targetlayerconfig = window->target->layer_config();
|
||||
if (targetview != window->targetview || targetorient != window->targetorient || targetlayerconfig != window->targetlayerconfig)
|
||||
{
|
||||
window->targetview = targetview;
|
||||
@ -763,7 +760,7 @@ void winwindow_video_window_update(win_window_info *window)
|
||||
// only render if we were able to get the lock
|
||||
if (got_lock)
|
||||
{
|
||||
const render_primitive_list *primlist;
|
||||
render_primitive_list *primlist;
|
||||
|
||||
mtlog_add("winwindow_video_window_update: got lock");
|
||||
|
||||
@ -873,7 +870,7 @@ static void set_starting_view(int index, win_window_info *window, const char *vi
|
||||
viewindex = video_get_view_for_target(window->machine, window->target, view, index, video_config.numscreens);
|
||||
|
||||
// set the view
|
||||
render_target_set_view(window->target, viewindex);
|
||||
window->target->set_view(viewindex);
|
||||
}
|
||||
|
||||
|
||||
@ -1361,7 +1358,7 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar
|
||||
HDC hdc = GetDC(wnd);
|
||||
|
||||
mtlog_add("winwindow_video_window_proc: WM_USER_REDRAW begin");
|
||||
window->primlist = (const render_primitive_list *)lparam;
|
||||
window->primlist = (render_primitive_list *)lparam;
|
||||
draw_video_contents(window, hdc, FALSE);
|
||||
mtlog_add("winwindow_video_window_proc: WM_USER_REDRAW end");
|
||||
|
||||
@ -1480,21 +1477,21 @@ static void constrain_to_aspect_ratio(win_window_info *window, RECT *rect, int a
|
||||
{
|
||||
case WMSZ_BOTTOM:
|
||||
case WMSZ_TOP:
|
||||
render_target_compute_visible_area(window->target, 10000, propheight, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight);
|
||||
window->target->compute_visible_area(10000, propheight, pixel_aspect, window->target->orientation(), propwidth, propheight);
|
||||
break;
|
||||
|
||||
case WMSZ_LEFT:
|
||||
case WMSZ_RIGHT:
|
||||
render_target_compute_visible_area(window->target, propwidth, 10000, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight);
|
||||
window->target->compute_visible_area(propwidth, 10000, pixel_aspect, window->target->orientation(), propwidth, propheight);
|
||||
break;
|
||||
|
||||
default:
|
||||
render_target_compute_visible_area(window->target, propwidth, propheight, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight);
|
||||
window->target->compute_visible_area(propwidth, propheight, pixel_aspect, window->target->orientation(), propwidth, propheight);
|
||||
break;
|
||||
}
|
||||
|
||||
// get the minimum width/height for the current layout
|
||||
render_target_get_minimum_size(window->target, &minwidth, &minheight);
|
||||
window->target->compute_minimum_size(minwidth, minheight);
|
||||
|
||||
// clamp against the absolute minimum
|
||||
propwidth = MAX(propwidth, MIN_WINDOW_DIM);
|
||||
@ -1527,7 +1524,7 @@ static void constrain_to_aspect_ratio(win_window_info *window, RECT *rect, int a
|
||||
propheight = MIN(propheight, maxheight);
|
||||
|
||||
// compute the visible area based on the proposed rectangle
|
||||
render_target_compute_visible_area(window->target, propwidth, propheight, pixel_aspect, render_target_get_orientation(window->target), &viswidth, &visheight);
|
||||
window->target->compute_visible_area(propwidth, propheight, pixel_aspect, window->target->orientation(), viswidth, visheight);
|
||||
|
||||
// compute the adjustments we need to make
|
||||
adjwidth = (viswidth + extrawidth) - rect_width(rect);
|
||||
@ -1576,7 +1573,7 @@ static void get_min_bounds(win_window_info *window, RECT *bounds, int constrain)
|
||||
assert(GetCurrentThreadId() == window_threadid);
|
||||
|
||||
// get the minimum target size
|
||||
render_target_get_minimum_size(window->target, &minwidth, &minheight);
|
||||
window->target->compute_minimum_size(minwidth, minheight);
|
||||
|
||||
// expand to our minimum dimensions
|
||||
if (minwidth < MIN_WINDOW_DIM)
|
||||
|
@ -101,7 +101,7 @@ struct _win_window_info
|
||||
int targetview;
|
||||
int targetorient;
|
||||
int targetlayerconfig;
|
||||
const render_primitive_list *primlist;
|
||||
render_primitive_list *primlist;
|
||||
|
||||
// input info
|
||||
DWORD lastclicktime;
|
||||
@ -121,7 +121,7 @@ struct _win_draw_callbacks
|
||||
void (*exit)(void);
|
||||
|
||||
int (*window_init)(win_window_info *window);
|
||||
const render_primitive_list *(*window_get_primitives)(win_window_info *window);
|
||||
render_primitive_list *(*window_get_primitives)(win_window_info *window);
|
||||
int (*window_draw)(win_window_info *window, HDC dc, int update);
|
||||
void (*window_destroy)(win_window_info *window);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user