From 1b54456be5fd090b039b3e9f691ac0464ffdff12 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Sat, 12 Feb 2011 03:47:37 +0000 Subject: mame_file is now emu_file and is a class. It is required to pass a core_options object to the constructor, along with a search path. This required pushing either a running_machine or a core_options through some code that wasn't previously ready to handle it. emu_files can be reused over multiple open/close sessions, and a lot of core code cleaned up nicely as things were converted to them. Also created a file_enumerator class for iterating over files in a searchpath. This replaces the old mame_openpath functions. Changed machine->options() to return a reference. Removed public nvram_open() and fixed jchan/kaneko16 to stop directly saving NVRAM. Removed most of the mame_options() calls; this will soon go away entirely, so don't add any more. Added core_options to device_validity_check() so they can be used to validate things. --- src/emu/rendlay.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/emu/rendlay.c') diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index deb4b8a0893..6b2f09ab623 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -596,6 +596,7 @@ layout_element::component::component(running_machine &machine, xml_data_node &co m_type(CTYPE_INVALID), m_state(0), m_bitmap(NULL), + m_file(NULL), m_hasalpha(false) { // fetch common data @@ -610,6 +611,7 @@ layout_element::component::component(running_machine &machine, xml_data_node &co m_dirname = dirname; m_imagefile = xml_get_attribute_string_with_subst(machine, compnode, "file", ""); m_alphafile = xml_get_attribute_string_with_subst(machine, compnode, "alphafile", ""); + m_file = global_alloc(emu_file(machine.options(), OPTION_ARTPATH, OPEN_FLAG_READ)); } // text nodes @@ -663,6 +665,7 @@ layout_element::component::component(running_machine &machine, xml_data_node &co layout_element::component::~component() { + global_free(m_file); global_free(m_bitmap); } @@ -898,11 +901,12 @@ void layout_element::component::draw_text(running_machine &machine, bitmap_t &de bitmap_t *layout_element::component::load_bitmap() { // load the basic bitmap - bitmap_t *bitmap = render_load_png(OPTION_ARTPATH, m_dirname, m_imagefile, NULL, &m_hasalpha); + assert(m_file != NULL); + bitmap_t *bitmap = render_load_png(*m_file, m_dirname, m_imagefile, NULL, &m_hasalpha); if (bitmap != NULL && m_alphafile) // load the alpha bitmap if specified - if (render_load_png(OPTION_ARTPATH, m_dirname, m_alphafile, bitmap, &m_hasalpha) == NULL) + if (render_load_png(*m_file, m_dirname, m_alphafile, bitmap, &m_hasalpha) == NULL) { global_free(bitmap); bitmap = NULL; -- cgit v1.2.3-70-g09d2