mirror of
https://github.com/holub/mame
synced 2025-05-24 23:05:32 +03:00
Fix crash when restoring system with OKI6295. Basically, move the
state callback registration earlier for streams so that they are all properly restored before any devices get their callbacks.
This commit is contained in:
parent
9199da5ddf
commit
302396a054
@ -231,6 +231,7 @@ void streams_init(running_machine *machine)
|
||||
/* register global states */
|
||||
state_save_register_global(machine, strdata->last_update.seconds);
|
||||
state_save_register_global(machine, strdata->last_update.attoseconds);
|
||||
state_save_register_postload(machine, stream_postload, strdata);
|
||||
}
|
||||
|
||||
|
||||
@ -359,7 +360,6 @@ sound_stream *stream_create(device_t *device, int inputs, int outputs, int sampl
|
||||
/* create a unique tag for saving */
|
||||
sprintf(statetag, "%d", stream->index);
|
||||
state_save_register_item(machine, "stream", statetag, 0, stream->sample_rate);
|
||||
state_save_register_postload(machine, stream_postload, stream);
|
||||
|
||||
/* allocate space for the inputs */
|
||||
if (inputs > 0)
|
||||
@ -692,15 +692,14 @@ void stream_set_output_gain(sound_stream *stream, int output, float gain)
|
||||
|
||||
static STATE_POSTLOAD( stream_postload )
|
||||
{
|
||||
streams_private *strdata = machine->streams_data;
|
||||
sound_stream *stream = (sound_stream *)param;
|
||||
int outputnum;
|
||||
|
||||
streams_private *strdata = reinterpret_cast<streams_private *>(param);
|
||||
for (sound_stream *stream = strdata->stream_head; stream != NULL; stream = stream->next)
|
||||
{
|
||||
/* recompute the same rate information */
|
||||
recompute_sample_rate_data(machine, stream);
|
||||
|
||||
/* make sure our output buffers are fully cleared */
|
||||
for (outputnum = 0; outputnum < stream->outputs; outputnum++)
|
||||
for (int outputnum = 0; outputnum < stream->outputs; outputnum++)
|
||||
memset(stream->output[outputnum].buffer, 0, stream->output_bufalloc * sizeof(stream->output[outputnum].buffer[0]));
|
||||
|
||||
/* recompute the sample indexes to make sense */
|
||||
@ -708,6 +707,7 @@ static STATE_POSTLOAD( stream_postload )
|
||||
stream->output_update_sampindex = stream->output_sampindex;
|
||||
stream->output_base_sampindex = stream->output_sampindex - stream->max_samples_per_update;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user