mirror of
https://github.com/holub/mame
synced 2025-06-16 17:29:27 +03:00
cassette: add more items to savestate
This commit is contained in:
parent
e41fb3b287
commit
fefe91b571
@ -72,7 +72,7 @@ void cassette_image_device::device_config_complete()
|
|||||||
{
|
{
|
||||||
m_extension_list[0] = '\0';
|
m_extension_list[0] = '\0';
|
||||||
for (int i = 0; m_formats[i]; i++ )
|
for (int i = 0; m_formats[i]; i++ )
|
||||||
image_specify_extension( m_extension_list, 256, m_formats[i]->extensions );
|
image_specify_extension(m_extension_list, 256, m_formats[i]->extensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -86,9 +86,9 @@ void cassette_image_device::update()
|
|||||||
|
|
||||||
if (!is_stopped() && motor_on())
|
if (!is_stopped() && motor_on())
|
||||||
{
|
{
|
||||||
double new_position = m_position + (cur_time - m_position_time)*m_speed*m_direction;
|
double new_position = m_position + (cur_time - m_position_time) * m_speed * m_direction;
|
||||||
|
|
||||||
switch (int(m_state & CASSETTE_MASK_UISTATE)) // cast to int to suppress unhandled enum value warning
|
switch (m_state & CASSETTE_MASK_UISTATE) // cast to int to suppress unhandled enum value warning
|
||||||
{
|
{
|
||||||
case CASSETTE_RECORD:
|
case CASSETTE_RECORD:
|
||||||
m_cassette->put_sample(m_channel, m_position, new_position - m_position, m_value);
|
m_cassette->put_sample(m_channel, m_position, new_position - m_position, m_value);
|
||||||
@ -112,6 +112,9 @@ void cassette_image_device::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
m_position = new_position;
|
m_position = new_position;
|
||||||
}
|
}
|
||||||
@ -167,7 +170,7 @@ double cassette_image_device::get_position()
|
|||||||
double position = m_position;
|
double position = m_position;
|
||||||
|
|
||||||
if (!is_stopped() && motor_on())
|
if (!is_stopped() && motor_on())
|
||||||
position += (machine().time().as_double() - m_position_time)*m_speed*m_direction;
|
position += (machine().time().as_double() - m_position_time) * m_speed * m_direction;
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +238,9 @@ void cassette_image_device::seek(double time, int origin)
|
|||||||
cassette device init/load/unload/specify
|
cassette device init/load/unload/specify
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
// allow save_item on a non-fundamental type
|
||||||
|
ALLOW_SAVE_TYPE(cassette_state);
|
||||||
|
|
||||||
void cassette_image_device::device_start()
|
void cassette_image_device::device_start()
|
||||||
{
|
{
|
||||||
/* set to default state */
|
/* set to default state */
|
||||||
@ -242,12 +248,14 @@ void cassette_image_device::device_start()
|
|||||||
m_state = m_default_state;
|
m_state = m_default_state;
|
||||||
m_value = 0;
|
m_value = 0;
|
||||||
|
|
||||||
stream_alloc(0, m_stereo? 2:1, machine().sample_rate());
|
stream_alloc(0, m_stereo ? 2 : 1, machine().sample_rate());
|
||||||
|
|
||||||
|
save_item(NAME(m_state));
|
||||||
save_item(NAME(m_position));
|
save_item(NAME(m_position));
|
||||||
save_item(NAME(m_position_time));
|
save_item(NAME(m_position_time));
|
||||||
save_item(NAME(m_value));
|
save_item(NAME(m_value));
|
||||||
save_item(NAME(m_channel));
|
save_item(NAME(m_channel));
|
||||||
|
save_item(NAME(m_speed));
|
||||||
save_item(NAME(m_direction));
|
save_item(NAME(m_direction));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "formats/cassimg.h"
|
#include "formats/cassimg.h"
|
||||||
|
|
||||||
|
|
||||||
enum cassette_state
|
enum cassette_state : uint8_t
|
||||||
{
|
{
|
||||||
// this part of the state is controlled by the UI
|
// this part of the state is controlled by the UI
|
||||||
CASSETTE_STOPPED = 0,
|
CASSETTE_STOPPED = 0,
|
||||||
@ -129,8 +129,8 @@ private:
|
|||||||
char m_extension_list[256];
|
char m_extension_list[256];
|
||||||
const cassette_image::Format* const *m_formats;
|
const cassette_image::Format* const *m_formats;
|
||||||
const cassette_image::Options *m_create_opts;
|
const cassette_image::Options *m_create_opts;
|
||||||
cassette_state m_default_state;
|
cassette_state m_default_state;
|
||||||
const char * m_interface;
|
const char * m_interface;
|
||||||
|
|
||||||
std::error_condition internal_load(bool is_create);
|
std::error_condition internal_load(bool is_create);
|
||||||
bool has_any_extension(std::string_view candidate_extensions) const;
|
bool has_any_extension(std::string_view candidate_extensions) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user