diff options
author | 2025-02-25 00:05:33 +1100 | |
---|---|---|
committer | 2025-02-25 00:05:33 +1100 | |
commit | 9960028d9c2ce6e48ad1c52e2d9ed00f751969d3 (patch) | |
tree | 833af7c4ad9ce239545ccb1bd38a0dca1c9b2186 | |
parent | 6addc09da6ee16ac537dd4c46183ba5edb6f28f0 (diff) |
misc/vgmplay.cpp: Give visual feedback for playing/paused and loop state.
-rw-r--r-- | src/mame/layout/vgmplay.lay | 24 | ||||
-rw-r--r-- | src/mame/virtual/vgmplay.cpp | 31 |
2 files changed, 40 insertions, 15 deletions
diff --git a/src/mame/layout/vgmplay.lay b/src/mame/layout/vgmplay.lay index 0101a2375cd..9cc22dd7115 100644 --- a/src/mame/layout/vgmplay.lay +++ b/src/mame/layout/vgmplay.lay @@ -108,9 +108,10 @@ license:CC0-1.0 </rect> <image> <bounds xc="5.5" yc="2.5" width="4" height="2" /> + <color red="0.7" green="0.7" blue="0.2" /> <data><![CDATA[ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="100" viewBox="0 0 200 100"> - <path fill="#E5E533" stroke="none" d="M 50,0 l 100,0 l 0,100 l -100,0 z" /> + <path fill="#FFFFFF" stroke="none" d="M 50,0 l 100,0 l 0,100 l -100,0 z" /> </svg> ]]></data> </image> @@ -122,9 +123,11 @@ license:CC0-1.0 </rect> <image> <bounds xc="5.5" yc="2.5" width="4" height="2" /> + <color state="0" red="1.0" green="0.3" blue="0.1" /> + <color state="1" red="0.7" green="0.7" blue="0.2" /> <data><![CDATA[ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="100" viewBox="0 0 200 100"> - <path fill="#E5E533" stroke="none" d="M 55,0 l 30,0 l 0,100 l -30,0 z m 60,0 l 30,0 l 0,100 l -30,0 z" /> + <path fill="#FFFFFF" stroke="none" d="M 55,0 l 30,0 l 0,100 l -30,0 z m 60,0 l 30,0 l 0,100 l -30,0 z" /> </svg> ]]></data> </image> @@ -136,9 +139,11 @@ license:CC0-1.0 </rect> <image> <bounds xc="5.5" yc="2.5" width="4" height="2" /> + <color state="0" red="0.7" green="0.7" blue="0.2" /> + <color state="1" red="1.0" green="0.3" blue="0.1" /> <data><![CDATA[ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="100" viewBox="0 0 200 100"> - <path fill="#E5E533" stroke="none" d="M 40,0 l 120,50 l -120,50 z" /> + <path fill="#FFFFFF" stroke="none" d="M 40,0 l 120,50 l -120,50 z" /> </svg> ]]></data> </image> @@ -150,9 +155,10 @@ license:CC0-1.0 </rect> <image> <bounds xc="5.5" yc="2.5" width="4" height="2" /> + <color red="0.7" green="0.7" blue="0.2" /> <data><![CDATA[ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="100" viewBox="0 0 200 100"> - <path fill="#E5E533" stroke="none" d="M 10,0 l 15,0 l 0,45 l 85,-45 l 0,45 l 85,-45 l 0,100 l -85,-45 l 0,45 l -85,-45 l 0,45 l -15,0 z" /> + <path fill="#FFFFFF" stroke="none" d="M 10,0 l 15,0 l 0,45 l 85,-45 l 0,45 l 85,-45 l 0,100 l -85,-45 l 0,45 l -85,-45 l 0,45 l -15,0 z" /> </svg> ]]></data> </image> @@ -164,9 +170,11 @@ license:CC0-1.0 </rect> <image> <bounds xc="5.5" yc="2.5" width="4" height="2" /> + <color state="0" red="0.7" green="0.7" blue="0.2" /> + <color state="1" red="1.0" green="0.3" blue="0.1" /> <data><![CDATA[ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="100" viewBox="0 0 200 100"> - <path fill="#E5E533" stroke="none" d="M 120,15 l 40,0 a 40,40,0,0,1,0,80 l -120,0 a 40,40,0,0,1,0,-80 l 30,0 l 0,-15 l 40,25 l -40,25 l 0,-15 l -30,0 a 20,20,0,0,0,0,40 l 120,0 a 20,20,0,0,0,0,-40 l -40,0 z" /> + <path fill="#FFFFFF" stroke="none" d="M 120,15 l 40,0 a 40,40,0,0,1,0,80 l -120,0 a 40,40,0,0,1,0,-80 l 30,0 l 0,-15 l 40,25 l -40,25 l 0,-15 l -30,0 a 20,20,0,0,0,0,40 l 120,0 a 20,20,0,0,0,0,-40 l -40,0 z" /> </svg> ]]></data> </image> @@ -269,10 +277,10 @@ license:CC0-1.0 <view name="Full View"> <collection name="Controls"> <element ref="button_l1"><bounds x="0" y="4" width="11" height="5" /></element> - <element ref="button_l2"><bounds x="12" y="4" width="11" height="5" /></element> - <element ref="button_l3"><bounds x="24" y="4" width="11" height="5" /></element> + <element ref="button_l2" name="playing"><bounds x="12" y="4" width="11" height="5" /></element> + <element ref="button_l3" name="playing"><bounds x="24" y="4" width="11" height="5" /></element> <element ref="button_l4"><bounds x="36" y="4" width="11" height="5" /></element> - <element ref="button_l5"><bounds x="48" y="4" width="11" height="5" /></element> + <element ref="button_l5" name="loop"><bounds x="48" y="4" width="11" height="5" /></element> <element ref="hl1" inputtag="CONTROLS" inputmask="0x0001"><bounds x="0" y="4" width="11" height="5" /><color alpha="0.15" /></element> <element ref="hl1" inputtag="CONTROLS" inputmask="0x0002"><bounds x="12" y="4" width="11" height="5" /><color alpha="0.15" /></element> diff --git a/src/mame/virtual/vgmplay.cpp b/src/mame/virtual/vgmplay.cpp index 0433c40f6c4..eb39cb463e5 100644 --- a/src/mame/virtual/vgmplay.cpp +++ b/src/mame/virtual/vgmplay.cpp @@ -8,11 +8,16 @@ #define QSOUND_LLE -#include "imagedev/snapquik.h" +#include "mega32x.h" +#include "vboysound.h" +#include "wswansound.h" #include "cpu/h6280/h6280.h" #include "cpu/m6502/rp2a03.h" #include "cpu/m68000/m68000.h" + +#include "imagedev/snapquik.h" + #include "sound/ay8910.h" #include "sound/c140.h" #include "sound/c352.h" @@ -43,11 +48,6 @@ #include "sound/ymopn.h" #include "sound/ymz280b.h" -#include "mega32x.h" -#include "vboysound.h" -#include "wswansound.h" - -#include "vgmplay.lh" #include "debugger.h" #include "softlist_dev.h" #include "speaker.h" @@ -62,6 +62,8 @@ #include <utility> #include <vector> +#include "vgmplay.lh" + #define AS_IO16LE 1 #define AS_IO16BE 4 @@ -278,7 +280,7 @@ public: void pause(); bool paused() const { return m_paused; } void play(); - void toggle_loop() { m_loop = !m_loop; } + void toggle_loop() { m_loop = !m_loop; m_loop_led = m_loop ? 1 : 0; } protected: virtual void device_start() override ATTR_COLD; @@ -337,6 +339,8 @@ private: uint32_t handle_pcm_write(uint32_t address); void blocks_clear(); + output_finder<> m_playing_led; + output_finder<> m_loop_led; output_finder<CT_COUNT> m_act_leds; led_expiry_list m_act_led_expiries; std::unique_ptr<led_expiry_iterator[]> m_act_led_index; @@ -537,6 +541,8 @@ private: vgmplay_device::vgmplay_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : cpu_device(mconfig, VGMPLAY, tag, owner, clock), + m_playing_led(*this, "playing"), + m_loop_led(*this, "loop"), m_act_leds(*this, "led_act_%u", 0U), m_file_config("file", ENDIANNESS_LITTLE, 8, 32), m_io_config("io", ENDIANNESS_LITTLE, 8, 32), @@ -553,6 +559,8 @@ void vgmplay_device::device_start() m_io16le = &space(AS_IO16LE); m_io16be = &space(AS_IO16BE); + m_playing_led.resolve(); + m_loop_led.resolve(); m_act_leds.resolve(); m_act_led_index = std::make_unique<led_expiry_iterator[]>(CT_COUNT); for (vgm_chip led = vgm_chip(0); led != CT_COUNT; led = vgm_chip(led + 1)) @@ -574,6 +582,8 @@ void vgmplay_device::device_reset() { m_state = RESET; m_paused = false; + m_playing_led = 1; + m_loop_led = m_loop ? 1 : 0; m_ym2612_stream_offset = 0; std::fill(std::begin(m_upd7759_bank), std::end(m_upd7759_bank), 0); @@ -638,19 +648,26 @@ void vgmplay_device::stop() { device_reset(); m_paused = true; + m_playing_led = 0; } void vgmplay_device::pause() { m_paused = !m_paused; + m_playing_led = m_paused ? 0 : 1; } void vgmplay_device::play() { if (m_paused && m_state != DONE) + { m_paused = false; + m_playing_led = 1; + } else + { device_reset(); + } } uint32_t vgmplay_device::execute_min_cycles() const noexcept |