diff options
Diffstat (limited to 'src/devices/imagedev/cassette.cpp')
-rw-r--r-- | src/devices/imagedev/cassette.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/src/devices/imagedev/cassette.cpp b/src/devices/imagedev/cassette.cpp index c045533a1b3..96937bac6ea 100644 --- a/src/devices/imagedev/cassette.cpp +++ b/src/devices/imagedev/cassette.cpp @@ -358,17 +358,47 @@ void cassette_image_device::call_unload() +#define ANIMATION_FPS 1 +#define ANIMATION_FRAMES 4 + /* display a small tape icon, with the current position in the tape image */ -void cassette_image_device::call_display() +int cassette_image_device::call_display(std::string& s) { /* abort if we should not be showing the image */ if (!exists()) - return; + return -1; if (!is_motor_on()) - return; - machine().ui().image_display(CASSETTE, this); + return -1; + + char buf[65]; + int n; + double position, length; + cassette_state uistate; + static const UINT8 shapes[8] = { 0x2d, 0x5c, 0x7c, 0x2f, 0x2d, 0x20, 0x20, 0x20 }; + + /* figure out where we are in the cassette */ + position = get_position(); + length = get_length(); + uistate = (cassette_state)(get_state() & CASSETTE_MASK_UISTATE); + + /* choose which frame of the animation we are at */ + n = ((int)position / ANIMATION_FPS) % ANIMATION_FRAMES; + /* Since you can have anything in a BDF file, we will use crude ascii characters instead */ + snprintf(buf, ARRAY_LENGTH(buf), "%c%c %c %02d:%02d (%04d) [%02d:%02d (%04d)]", + shapes[n], /* cassette icon left */ + shapes[n | 4], /* cassette icon right */ + (uistate == CASSETTE_PLAY) ? 0x50 : 0x52, /* play (P) or record (R) */ + ((int)position / 60), + ((int)position % 60), + (int)position, + ((int)length / 60), + ((int)length % 60), + (int)length); + + s = buf; + // make sure tape stops at end when playing if ((m_state & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) { @@ -380,4 +410,6 @@ void cassette_image_device::call_display() } } } + + return cassette_device_iterator(machine().root_device()).indexof(*this); } |