static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state) { palette_device_iterator pal_iter(machine.root_device()); gfx_interface_iterator gfx_iter(machine.root_device()); // count the palette devices state.palette.devcount = pal_iter.count(); // set the pointer to the first palette if (state.palette.devcount > 0) palette_set_device(machine, state); // count the gfx devices state.gfxset.devcount = 0; int tempcount = gfx_iter.count(); // count the gfx sets in each device, skipping devices with none if (tempcount > 0) { device_gfx_interface *interface; int i, count; for (i = 0, interface = gfx_iter.first(); i < tempcount && state.gfxset.devcount < MAX_GFX_DECODERS; i++, interface = gfx_iter.next()) { for (count = 0; count < MAX_GFX_ELEMENTS && interface->gfx(count) != nullptr; count++) { } // count = index of first NULL if (count > 0) { state.gfxdev[state.gfxset.devcount].interface = interface; state.gfxdev[state.gfxset.devcount].setcount = count; state.gfxset.devcount++; } } } state.started = true; }
static void palette_set_device(running_machine &machine, ui_gfx_state &state) { palette_interface_iterator pal_iter(machine.root_device()); state.palette.interface = pal_iter.byindex(state.palette.devindex); }