From afa6a83728be7339b7f9e76c719736665af611a2 Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Sat, 8 Apr 2017 20:43:15 -0400 Subject: Changes to make get_default_card_software() less stupid The goals with this change is to make get_default_card_software() a bit more standalone by making it a const method that does not mutate the state of the device_image_interface. This is done by passing in a small structure that encapsulates the minimum of information that get_default_card_software() needs. This also eliminates the need for device_image_interface::open_image_file() I agree with Sarayan that get_default_card_software() is terrible and needs to ultimately go away. This is a small step in that direction. Lastly, I don't care for the name of get_default_card_software_hook (or get_default_card_software() for that matter). If anybody has better ideas, let me know. --- src/devices/bus/astrocde/slot.cpp | 7 +++---- src/devices/bus/astrocde/slot.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/devices/bus/astrocde') diff --git a/src/devices/bus/astrocde/slot.cpp b/src/devices/bus/astrocde/slot.cpp index 6dfd7a47e33..d997b6454e5 100644 --- a/src/devices/bus/astrocde/slot.cpp +++ b/src/devices/bus/astrocde/slot.cpp @@ -175,12 +175,12 @@ image_init_result astrocade_cart_slot_device::call_load() get default card software -------------------------------------------------*/ -std::string astrocade_cart_slot_device::get_default_card_software() +std::string astrocade_cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { - if (open_image_file(mconfig().options())) + if (hook.image_file()) { const char *slot_string; - uint32_t size = m_file->size(); + uint32_t size = hook.image_file()->size(); int type = ASTROCADE_STD; if (size == 0x40000) @@ -191,7 +191,6 @@ std::string astrocade_cart_slot_device::get_default_card_software() slot_string = astrocade_get_slot(type); //printf("type: %s\n", slot_string); - clear(); return std::string(slot_string); } diff --git a/src/devices/bus/astrocde/slot.h b/src/devices/bus/astrocde/slot.h index 2d0ad1005a4..702342aad8c 100644 --- a/src/devices/bus/astrocde/slot.h +++ b/src/devices/bus/astrocde/slot.h @@ -74,7 +74,7 @@ public: virtual const char *file_extensions() const override { return "bin"; } // slot interface overrides - virtual std::string get_default_card_software() override; + virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom); -- cgit v1.2.3-70-g09d2