From d2536ab13923aff8ea7c314ae319466f2fadfdb7 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Thu, 14 Mar 2013 14:38:18 +0000 Subject: [PATCH] (MESS) simplified handling of must_be_loaded for md slots. nw. --- src/mess/machine/md_sk.c | 3 ++- src/mess/machine/md_sk.h | 2 +- src/mess/machine/md_slot.c | 9 ++------- src/mess/machine/md_slot.h | 28 +++++++--------------------- src/mess/machine/nes_slot.h | 17 +++++++++-------- 5 files changed, 21 insertions(+), 38 deletions(-) diff --git a/src/mess/machine/md_sk.c b/src/mess/machine/md_sk.c index 88c20eaa334..c0c33e86ae0 100644 --- a/src/mess/machine/md_sk.c +++ b/src/mess/machine/md_sk.c @@ -77,7 +77,8 @@ static SLOT_INTERFACE_START(sk_sub_cart) SLOT_INTERFACE_END static MACHINE_CONFIG_FRAGMENT( sk_slot ) - MCFG_MDSUB_CARTRIDGE_ADD("subslot", sk_sub_cart, NULL, NULL) + MCFG_MD_CARTRIDGE_ADD("subslot", sk_sub_cart, NULL, NULL) + MCFG_MD_CARTRIDGE_NOT_MANDATORY MACHINE_CONFIG_END diff --git a/src/mess/machine/md_sk.h b/src/mess/machine/md_sk.h index 58427fa9442..9feb3a6220c 100644 --- a/src/mess/machine/md_sk.h +++ b/src/mess/machine/md_sk.h @@ -24,7 +24,7 @@ public: virtual DECLARE_WRITE16_MEMBER(write); private: - required_device m_exp; + required_device m_exp; }; diff --git a/src/mess/machine/md_slot.c b/src/mess/machine/md_slot.c index 082bd0ed12b..744e9a6977f 100644 --- a/src/mess/machine/md_slot.c +++ b/src/mess/machine/md_slot.c @@ -51,7 +51,6 @@ const device_type MD_CART_SLOT = &device_creator; const device_type PICO_CART_SLOT = &device_creator; -const device_type MD_SUBCART_SLOT = &device_creator; //************************************************************************** @@ -169,7 +168,8 @@ base_md_cart_slot_device::base_md_cart_slot_device(const machine_config &mconfig device_t(mconfig, type, name, tag, owner, clock), device_image_interface(mconfig, *this), device_slot_interface(mconfig, *this), - m_type(SEGA_STD) + m_type(SEGA_STD), + m_must_be_loaded(1) { } @@ -178,11 +178,6 @@ md_cart_slot_device::md_cart_slot_device(const machine_config &mconfig, const ch { } -md_subcart_slot_device::md_subcart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - base_md_cart_slot_device(mconfig, MD_SUBCART_SLOT, "MD Cartridge SubSlot", tag, owner, clock) -{ -} - pico_cart_slot_device::pico_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : base_md_cart_slot_device(mconfig, PICO_CART_SLOT, "Pico Cartridge Slot", tag, owner, clock) { diff --git a/src/mess/machine/md_slot.h b/src/mess/machine/md_slot.h index ecdcab9fa1f..ebb24db5ff1 100644 --- a/src/mess/machine/md_slot.h +++ b/src/mess/machine/md_slot.h @@ -155,7 +155,7 @@ public: virtual bool is_readable() const { return 1; } virtual bool is_writeable() const { return 0; } virtual bool is_creatable() const { return 0; } - virtual bool must_be_loaded() const { return 1; } + virtual bool must_be_loaded() const { return m_must_be_loaded; } virtual bool is_reset_on_load() const { return 1; } virtual const option_guide *create_option_guide() const { return NULL; } @@ -168,7 +168,8 @@ public: void setup_custom_mappers(); void setup_nvram(); - + void set_must_be_loaded(bool _must_be_loaded) { m_must_be_loaded = _must_be_loaded; } + // reading and writing virtual DECLARE_READ16_MEMBER(read); virtual DECLARE_WRITE16_MEMBER(write); @@ -183,6 +184,7 @@ public: int m_type; device_md_cart_interface* m_cart; + bool m_must_be_loaded; }; // ======================> md_cart_slot_device @@ -196,20 +198,6 @@ public: virtual const char *file_extensions() const { return "smd,bin,md,gen"; } }; - -// ======================> md_subcart_slot_device - -class md_subcart_slot_device : public base_md_cart_slot_device -{ -public: - // construction/destruction - md_subcart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual bool must_be_loaded() const { return 0; } - virtual const char *image_interface() const { return "megadriv_cart"; } - virtual const char *file_extensions() const { return "smd,bin,md,gen"; } -}; - - // ======================> pico_cart_slot_device class pico_cart_slot_device : public base_md_cart_slot_device @@ -224,7 +212,6 @@ public: // device type definition extern const device_type MD_CART_SLOT; -extern const device_type MD_SUBCART_SLOT; // needed to allow S&K pass-through to have non-mandatory cart extern const device_type PICO_CART_SLOT; @@ -236,13 +223,12 @@ extern const device_type PICO_CART_SLOT; MCFG_DEVICE_ADD(_tag, MD_CART_SLOT, 0) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false) -#define MCFG_MDSUB_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot,_def_inp) \ - MCFG_DEVICE_ADD(_tag, MD_SUBCART_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false) - #define MCFG_PICO_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot,_def_inp) \ MCFG_DEVICE_ADD(_tag, PICO_CART_SLOT, 0) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false) +#define MCFG_MD_CARTRIDGE_NOT_MANDATORY \ + static_cast(device)->set_must_be_loaded(FALSE); + #endif diff --git a/src/mess/machine/nes_slot.h b/src/mess/machine/nes_slot.h index 24d348fc386..5c5a86e0ed3 100644 --- a/src/mess/machine/nes_slot.h +++ b/src/mess/machine/nes_slot.h @@ -113,7 +113,6 @@ public: virtual bool is_writeable() const { return 0; } virtual bool is_creatable() const { return 0; } virtual bool must_be_loaded() const { return m_must_be_loaded; } - void set_must_be_loaded(bool _must_be_loaded) { m_must_be_loaded = _must_be_loaded; } virtual bool is_reset_on_load() const { return 1; } virtual const char *image_interface() const { return "nes_cart"; } virtual const char *file_extensions() const { return "nes,unf,unif"; } @@ -142,13 +141,15 @@ public: int m_vrc_ls_chr; int m_crc_hack; - virtual int get_chr_open_bus() { return m_chr_open_bus; }; - virtual int get_ce_mask() { return m_ce_mask; }; - virtual int get_ce_state() { return m_ce_state; }; - virtual int get_vrc_ls_prg_a() { return m_vrc_ls_prg_a; }; - virtual int get_vrc_ls_prg_b() { return m_vrc_ls_prg_b; }; - virtual int get_vrc_ls_chr() { return m_vrc_ls_chr; }; - virtual int get_crc_hack() { return m_crc_hack; }; + int get_chr_open_bus() { return m_chr_open_bus; }; + int get_ce_mask() { return m_ce_mask; }; + int get_ce_state() { return m_ce_state; }; + int get_vrc_ls_prg_a() { return m_vrc_ls_prg_a; }; + int get_vrc_ls_prg_b() { return m_vrc_ls_prg_b; }; + int get_vrc_ls_chr() { return m_vrc_ls_chr; }; + int get_crc_hack() { return m_crc_hack; }; + + void set_must_be_loaded(bool _must_be_loaded) { m_must_be_loaded = _must_be_loaded; } //private: