diff options
author | 2010-01-18 09:34:43 +0000 | |
---|---|---|
committer | 2010-01-18 09:34:43 +0000 | |
commit | e738b79785852050ce8b83e369a7fc4dd46a071b (patch) | |
tree | 1ac39e9f40790b375c57fea4e5d56ca8d132babc /src/emu/render.c | |
parent | 3f87f47a2ecdccb9d9627d0d52b76f262becb949 (diff) |
Correct a long-standing design flaw: device configuration state
is now separate from runtime device state. I have larger plans
for devices, so there is some temporary scaffolding to hold
everything together, but this first step does separate things
out.
There is a new class 'running_device' which represents the
state of a live device. A list of these running_devices sits
in machine->devicelist and is created when a running_machine
is instantiated.
To access the configuration state, use device->baseconfig()
which returns a reference to the configuration.
The list of running_devices in machine->devicelist has a 1:1
correspondance with the list of device configurations in
machine->config->devicelist, and most navigation options work
equally on either (scanning by class, type, etc.)
For the most part, drivers will now deal with running_device
objects instead of const device_config objects. In fact, in
order to do this patch, I did the following global search &
replace:
const device_config -> running_device
device->static_config -> device->baseconfig().static_config
device->inline_config -> device->baseconfig().inline_config
and then fixed up the compiler errors that fell out.
Some specifics:
Removed device_get_info_* functions and replaced them with
methods called get_config_*.
Added methods for get_runtime_* to access runtime state from
the running_device.
DEVICE_GET_INFO callbacks are only passed a device_config *.
This means they have no access to the token or runtime state
at all. For most cases this is fine.
Added new DEVICE_GET_RUNTIME_INFO callback that is passed
the running_device for accessing data that is live at runtime.
In the future this will go away to make room for a cleaner
mechanism.
Cleaned up the handoff of memory regions from the memory
subsystem to the devices.
Diffstat (limited to 'src/emu/render.c')
-rw-r--r-- | src/emu/render.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/emu/render.c b/src/emu/render.c index eb3d1b74653..b3f84981dc7 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -952,7 +952,7 @@ static void render_save(running_machine *machine, int config_type, xml_data_node is 'live' -------------------------------------------------*/ -int render_is_live_screen(const device_config *screen) +int render_is_live_screen(running_device *screen) { render_target *target; int screen_index; @@ -963,7 +963,7 @@ int render_is_live_screen(const device_config *screen) assert(screen->machine->config != NULL); assert(screen->tag != NULL); - screen_index = screen->machine->config->devicelist.index(VIDEO_SCREEN, screen->tag); + screen_index = screen->machine->devicelist.index(VIDEO_SCREEN, screen->tag); assert(screen_index != -1); @@ -1468,6 +1468,7 @@ void render_target_get_minimum_size(render_target *target, INT32 *minwidth, INT3 { const device_config *screen = target->machine->config->devicelist.find(VIDEO_SCREEN, item->index); const screen_config *scrconfig = (const screen_config *)screen->inline_config; + running_device *screendev = target->machine->device(screen->tag); const rectangle vectorvis = { 0, 639, 0, 479 }; const rectangle *visarea = NULL; render_container *container = get_screen_container_by_index(item->index); @@ -1477,8 +1478,8 @@ void render_target_get_minimum_size(render_target *target, INT32 *minwidth, INT3 /* we may be called very early, before machine->visible_area is initialized; handle that case */ if (scrconfig->type == SCREEN_TYPE_VECTOR) visarea = &vectorvis; - else if (screen->token != NULL) - visarea = video_screen_get_visible_area(screen); + else if (screendev != NULL && screendev->token != NULL) + visarea = video_screen_get_visible_area(screendev); else visarea = &scrconfig->visarea; @@ -2946,6 +2947,12 @@ render_container *render_container_get_screen(const device_config *screen) } +render_container *render_container_get_screen(running_device *screen) +{ + return render_container_get_screen(&screen->baseconfig()); +} + + /*------------------------------------------------- render_container_item_add_generic - add a generic item to a container |