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/sound/ymf262.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/sound/ymf262.c')
-rw-r--r-- | src/emu/sound/ymf262.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/emu/sound/ymf262.c b/src/emu/sound/ymf262.c index f28798097fb..674c249e6ac 100644 --- a/src/emu/sound/ymf262.c +++ b/src/emu/sound/ymf262.c @@ -267,7 +267,7 @@ typedef struct { int rate; /* sampling rate (Hz) */ double freqbase; /* frequency base */ attotime TimerBase; /* Timer base time (==sampling time)*/ - const device_config *device; + running_device *device; } OPL3; @@ -2243,7 +2243,7 @@ static TIMER_CALLBACK( cymfile_callback ) } /* lock/unlock for common table */ -static int OPL3_LockTable(const device_config *device) +static int OPL3_LockTable(running_device *device) { num_lock++; if(num_lock>1) return 0; @@ -2330,7 +2330,7 @@ static void OPL3ResetChip(OPL3 *chip) /* Create one of virtual YMF262 */ /* 'clock' is chip clock in Hz */ /* 'rate' is sampling rate */ -static OPL3 *OPL3Create(const device_config *device, int clock, int rate, int type) +static OPL3 *OPL3Create(running_device *device, int clock, int rate, int type) { OPL3 *chip; @@ -2457,7 +2457,7 @@ static int OPL3TimerOver(OPL3 *chip,int c) -void * ymf262_init(const device_config *device, int clock, int rate) +void * ymf262_init(running_device *device, int clock, int rate) { return OPL3Create(device,clock,rate,OPL3_TYPE_YMF262); } |