mirror of
https://github.com/holub/mame
synced 2025-04-20 15:32:45 +03:00
vgmplay: Bug fixes
- Fix clock speed for dual POKEY (MT #6631) - Produce error message when nonexistent file specified rather than create a spurious empty file and segfault trying to read it
This commit is contained in:
parent
e5f6ac04d8
commit
8c4d9e4dfe
@ -24,7 +24,8 @@ DEFINE_DEVICE_TYPE(BITBANGER, bitbanger_device, "bitbanger", "Bitbanger")
|
||||
bitbanger_device::bitbanger_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, BITBANGER, tag, owner, clock),
|
||||
device_image_interface(mconfig, *this),
|
||||
m_interface(nullptr)
|
||||
m_interface(nullptr),
|
||||
m_is_readonly(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ class bitbanger_device : public device_t,
|
||||
{
|
||||
public:
|
||||
static void static_set_interface(device_t &device, const char *_interface) { downcast<bitbanger_device &>(device).m_interface = _interface; }
|
||||
static void static_set_readonly(device_t &device, bool is_readonly) { downcast<bitbanger_device &>(device).m_is_readonly = is_readonly; }
|
||||
|
||||
// construction/destruction
|
||||
bitbanger_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
@ -26,8 +27,8 @@ public:
|
||||
// image device
|
||||
virtual iodevice_t image_type() const override { return IO_SERIAL; }
|
||||
virtual bool is_readable() const override { return 1; }
|
||||
virtual bool is_writeable() const override { return 1; }
|
||||
virtual bool is_creatable() const override { return 1; }
|
||||
virtual bool is_writeable() const override { return !m_is_readonly; }
|
||||
virtual bool is_creatable() const override { return !m_is_readonly; }
|
||||
virtual bool must_be_loaded() const override { return 0; }
|
||||
virtual bool is_reset_on_load() const override { return 0; }
|
||||
virtual const char *image_interface() const override { return m_interface; }
|
||||
@ -44,10 +45,13 @@ protected:
|
||||
|
||||
private:
|
||||
char const *m_interface;
|
||||
bool m_is_readonly;
|
||||
};
|
||||
|
||||
#define MCFG_BITBANGER_INTERFACE(_interface) \
|
||||
bitbanger_device::static_set_interface(*device, _interface);
|
||||
#define MCFG_BITBANGER_READONLY(_readonly) \
|
||||
bitbanger_device::static_set_readonly(*device, _readonly);
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(BITBANGER, bitbanger_device)
|
||||
|
@ -982,7 +982,7 @@ void vgmplay_state::machine_start()
|
||||
{
|
||||
//m_nescpu->
|
||||
uint32_t size = 0;
|
||||
if(m_file->exists()) {
|
||||
if(m_file->exists() && m_file->length() > 0) {
|
||||
size = m_file->length();
|
||||
m_file_data.resize(size);
|
||||
m_file->input(&m_file_data[0], size);
|
||||
@ -1176,7 +1176,7 @@ void vgmplay_state::machine_start()
|
||||
}
|
||||
if(version >= 0x161 && r32(0xb0)) {
|
||||
uint32_t clock = r32(0xb0);
|
||||
m_pokeya->set_unscaled_clock(clock);
|
||||
m_pokeya->set_unscaled_clock(clock & ~0x40000000);
|
||||
if (clock & 0x40000000) {
|
||||
clock &= ~0x40000000;
|
||||
m_pokeyb->set_unscaled_clock(clock);
|
||||
@ -1334,6 +1334,7 @@ static MACHINE_CONFIG_START( vgmplay )
|
||||
MCFG_CPU_IO16_MAP( soundchips16_map )
|
||||
|
||||
MCFG_DEVICE_ADD("file", BITBANGER, 0)
|
||||
MCFG_BITBANGER_READONLY(true)
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user