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/fmopl.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/fmopl.c')
-rw-r--r-- | src/emu/sound/fmopl.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/emu/sound/fmopl.c b/src/emu/sound/fmopl.c index f2d10ec69ea..510d7be7cc8 100644 --- a/src/emu/sound/fmopl.c +++ b/src/emu/sound/fmopl.c @@ -312,7 +312,7 @@ typedef struct fm_opl_f { UINT32 rate; /* sampling rate (Hz) */ double freqbase; /* frequency base */ attotime TimerBase; /* Timer base time (==sampling time)*/ - const device_config *device; + running_device *device; } FM_OPL; @@ -1722,7 +1722,7 @@ static TIMER_CALLBACK( cymfile_callback ) } /* lock/unlock for common table */ -static int OPL_LockTable(const device_config *device) +static int OPL_LockTable(running_device *device) { num_lock++; if(num_lock>1) return 0; @@ -1868,7 +1868,7 @@ static STATE_POSTLOAD( OPL_postload ) } -static void OPLsave_state_channel(const device_config *device, OPL_CH *CH) +static void OPLsave_state_channel(running_device *device, OPL_CH *CH) { int slot, ch; @@ -1912,7 +1912,7 @@ static void OPLsave_state_channel(const device_config *device, OPL_CH *CH) /* Register savestate for a virtual YM3812/YM3526Y8950 */ -static void OPL_save_state(FM_OPL *OPL, const device_config *device) +static void OPL_save_state(FM_OPL *OPL, running_device *device) { OPLsave_state_channel(device, OPL->P_CH); @@ -1962,7 +1962,7 @@ static void OPL_save_state(FM_OPL *OPL, const device_config *device) /* Create one of virtual YM3812/YM3526/Y8950 */ /* 'clock' is chip clock in Hz */ /* 'rate' is sampling rate */ -static FM_OPL *OPLCreate(const device_config *device, UINT32 clock, UINT32 rate, int type) +static FM_OPL *OPLCreate(running_device *device, UINT32 clock, UINT32 rate, int type) { char *ptr; FM_OPL *OPL; @@ -2150,7 +2150,7 @@ static int OPLTimerOver(FM_OPL *OPL,int c) #if (BUILD_YM3812) -void * ym3812_init(const device_config *device, UINT32 clock, UINT32 rate) +void * ym3812_init(running_device *device, UINT32 clock, UINT32 rate) { /* emulator create */ FM_OPL *YM3812 = OPLCreate(device,clock,rate,OPL_TYPE_YM3812); @@ -2286,7 +2286,7 @@ void ym3812_update_one(void *chip, OPLSAMPLE *buffer, int length) #if (BUILD_YM3526) -void *ym3526_init(const device_config *device, UINT32 clock, UINT32 rate) +void *ym3526_init(running_device *device, UINT32 clock, UINT32 rate) { /* emulator create */ FM_OPL *YM3526 = OPLCreate(device,clock,rate,OPL_TYPE_YM3526); @@ -2433,7 +2433,7 @@ static void Y8950_deltat_status_reset(void *chip, UINT8 changebits) OPL_STATUS_RESET(Y8950, changebits); } -void *y8950_init(const device_config *device, UINT32 clock, UINT32 rate) +void *y8950_init(running_device *device, UINT32 clock, UINT32 rate) { /* emulator create */ FM_OPL *Y8950 = OPLCreate(device,clock,rate,OPL_TYPE_Y8950); |