diff --git a/src/devices/bus/a7800/a78_slot.cpp b/src/devices/bus/a7800/a78_slot.cpp index 8b55aa228c7..5f6544b5c03 100644 --- a/src/devices/bus/a7800/a78_slot.cpp +++ b/src/devices/bus/a7800/a78_slot.cpp @@ -528,7 +528,7 @@ int a78_cart_slot_device::verify_header(char *header) get default card software -------------------------------------------------*/ -void a78_cart_slot_device::get_default_card_software(std::string &result) +std::string a78_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -586,10 +586,10 @@ void a78_cart_slot_device::get_default_card_software(std::string &result) clear(); - result.assign(slot_string); + return std::string(slot_string); } else - software_get_default_slot(result, "a78_rom"); + return software_get_default_slot("a78_rom"); } diff --git a/src/devices/bus/a7800/a78_slot.h b/src/devices/bus/a7800/a78_slot.h index 791f9291981..cbdc38741f2 100644 --- a/src/devices/bus/a7800/a78_slot.h +++ b/src/devices/bus/a7800/a78_slot.h @@ -113,7 +113,7 @@ public: virtual device_image_partialhash_func get_partial_hash() const override { return &a78_partialhash; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_04xx); diff --git a/src/devices/bus/a800/a800_slot.cpp b/src/devices/bus/a800/a800_slot.cpp index 952975a649a..bd3d8ec0abe 100644 --- a/src/devices/bus/a800/a800_slot.cpp +++ b/src/devices/bus/a800/a800_slot.cpp @@ -406,7 +406,7 @@ int a800_cart_slot_device::identify_cart_type(UINT8 *header) get default card software -------------------------------------------------*/ -void a800_cart_slot_device::get_default_card_software(std::string &result) +std::string a800_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -436,14 +436,14 @@ void a800_cart_slot_device::get_default_card_software(std::string &result) clear(); - result.assign(slot_string); + return std::string(slot_string); } else - software_get_default_slot(result, "a800_8k"); + return software_get_default_slot("a800_8k"); } -void a5200_cart_slot_device::get_default_card_software(std::string &result) +std::string a5200_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -469,14 +469,14 @@ void a5200_cart_slot_device::get_default_card_software(std::string &result) clear(); - result.assign(slot_string); + return std::string(slot_string); } else - software_get_default_slot(result, "a5200"); + return software_get_default_slot("a5200"); } -void xegs_cart_slot_device::get_default_card_software(std::string &result) +std::string xegs_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -504,10 +504,10 @@ void xegs_cart_slot_device::get_default_card_software(std::string &result) clear(); - result.assign(slot_string); + return std::string(slot_string); } else - software_get_default_slot(result, "xegs"); + return software_get_default_slot("xegs"); } diff --git a/src/devices/bus/a800/a800_slot.h b/src/devices/bus/a800/a800_slot.h index 95948109653..6efdd0839e9 100644 --- a/src/devices/bus/a800/a800_slot.h +++ b/src/devices/bus/a800/a800_slot.h @@ -113,7 +113,7 @@ public: virtual const char *file_extensions() const override { return "bin,rom,car"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_80xx); @@ -142,7 +142,7 @@ public: virtual const char *file_extensions() const override { return "bin,rom,car,a52"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; }; // ======================> xegs_cart_slot_device @@ -157,7 +157,7 @@ public: virtual const char *file_extensions() const override { return "bin,rom,car"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; }; // device type definition diff --git a/src/devices/bus/adam/exp.cpp b/src/devices/bus/adam/exp.cpp index 2e907aca39a..29a53947dd2 100644 --- a/src/devices/bus/adam/exp.cpp +++ b/src/devices/bus/adam/exp.cpp @@ -124,9 +124,9 @@ bool adam_expansion_slot_device::call_softlist_load(software_list_device &swlist // get_default_card_software - //------------------------------------------------- -void adam_expansion_slot_device::get_default_card_software(std::string &result) +std::string adam_expansion_slot_device::get_default_card_software() { - software_get_default_slot(result, "standard"); + return software_get_default_slot("standard"); } diff --git a/src/devices/bus/adam/exp.h b/src/devices/bus/adam/exp.h index 0ede272e340..bd764c667c9 100644 --- a/src/devices/bus/adam/exp.h +++ b/src/devices/bus/adam/exp.h @@ -87,7 +87,7 @@ protected: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; devcb_write_line m_write_irq; diff --git a/src/devices/bus/apf/slot.cpp b/src/devices/bus/apf/slot.cpp index 89c04a95dc6..461c7bd68ef 100644 --- a/src/devices/bus/apf/slot.cpp +++ b/src/devices/bus/apf/slot.cpp @@ -221,7 +221,7 @@ bool apf_cart_slot_device::call_softlist_load(software_list_device &swlist, cons get default card software -------------------------------------------------*/ -void apf_cart_slot_device::get_default_card_software(std::string &result) +std::string apf_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -240,11 +240,10 @@ void apf_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "std"); + return software_get_default_slot("std"); } /*------------------------------------------------- diff --git a/src/devices/bus/apf/slot.h b/src/devices/bus/apf/slot.h index 15d2c8500a9..e8260ab55bc 100644 --- a/src/devices/bus/apf/slot.h +++ b/src/devices/bus/apf/slot.h @@ -84,7 +84,7 @@ public: virtual const char *file_extensions() const override { return "bin"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom); diff --git a/src/devices/bus/arcadia/slot.cpp b/src/devices/bus/arcadia/slot.cpp index eec8c412775..3ae3d45c645 100644 --- a/src/devices/bus/arcadia/slot.cpp +++ b/src/devices/bus/arcadia/slot.cpp @@ -230,9 +230,9 @@ bool arcadia_cart_slot_device::call_softlist_load(software_list_device &swlist, get default card software -------------------------------------------------*/ -void arcadia_cart_slot_device::get_default_card_software(std::string &result) +std::string arcadia_cart_slot_device::get_default_card_software() { - software_get_default_slot(result, "std"); + return software_get_default_slot("std"); } /*------------------------------------------------- diff --git a/src/devices/bus/arcadia/slot.h b/src/devices/bus/arcadia/slot.h index b4777024f2c..e018b40595d 100644 --- a/src/devices/bus/arcadia/slot.h +++ b/src/devices/bus/arcadia/slot.h @@ -73,7 +73,7 @@ public: virtual const char *file_extensions() const override { return "bin"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom); diff --git a/src/devices/bus/astrocde/slot.cpp b/src/devices/bus/astrocde/slot.cpp index 80b429a18c3..02d2294b7b5 100644 --- a/src/devices/bus/astrocde/slot.cpp +++ b/src/devices/bus/astrocde/slot.cpp @@ -198,7 +198,7 @@ bool astrocade_cart_slot_device::call_softlist_load(software_list_device &swlist get default card software -------------------------------------------------*/ -void astrocade_cart_slot_device::get_default_card_software(std::string &result) +std::string astrocade_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -216,11 +216,10 @@ void astrocade_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "rom"); + return software_get_default_slot("rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/astrocde/slot.h b/src/devices/bus/astrocde/slot.h index 76eb2f8ed20..1a28ccf4b96 100644 --- a/src/devices/bus/astrocde/slot.h +++ b/src/devices/bus/astrocde/slot.h @@ -73,7 +73,7 @@ public: virtual const char *file_extensions() const override { return "bin"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom); diff --git a/src/devices/bus/c64/exp.cpp b/src/devices/bus/c64/exp.cpp index 8ffc963d0e2..a78706d80cb 100644 --- a/src/devices/bus/c64/exp.cpp +++ b/src/devices/bus/c64/exp.cpp @@ -217,20 +217,17 @@ bool c64_expansion_slot_device::call_softlist_load(software_list_device &swlist, // get_default_card_software - //------------------------------------------------- -void c64_expansion_slot_device::get_default_card_software(std::string &result) +std::string c64_expansion_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { if (!core_stricmp(filetype(), "crt")) - { - cbm_crt_get_card(result, m_file); - return; - } + return cbm_crt_get_card(m_file); clear(); } - software_get_default_slot(result, "standard"); + return software_get_default_slot("standard"); } diff --git a/src/devices/bus/c64/exp.h b/src/devices/bus/c64/exp.h index 1e3c4ad049c..d72a91475be 100644 --- a/src/devices/bus/c64/exp.h +++ b/src/devices/bus/c64/exp.h @@ -149,7 +149,7 @@ protected: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; devcb_read8 m_read_dma_cd; devcb_write8 m_write_dma_cd; diff --git a/src/devices/bus/cbm2/exp.cpp b/src/devices/bus/cbm2/exp.cpp index 8e9c03c022a..f673abc7395 100644 --- a/src/devices/bus/cbm2/exp.cpp +++ b/src/devices/bus/cbm2/exp.cpp @@ -155,9 +155,9 @@ bool cbm2_expansion_slot_device::call_softlist_load(software_list_device &swlist // get_default_card_software - //------------------------------------------------- -void cbm2_expansion_slot_device::get_default_card_software(std::string &result) +std::string cbm2_expansion_slot_device::get_default_card_software() { - software_get_default_slot(result, "standard"); + return software_get_default_slot("standard"); } diff --git a/src/devices/bus/cbm2/exp.h b/src/devices/bus/cbm2/exp.h index 771a66604cc..ce5daf10dbb 100644 --- a/src/devices/bus/cbm2/exp.h +++ b/src/devices/bus/cbm2/exp.h @@ -96,7 +96,7 @@ protected: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; device_cbm2_expansion_card_interface *m_card; }; diff --git a/src/devices/bus/chanf/slot.cpp b/src/devices/bus/chanf/slot.cpp index a533c85bb05..442c5e05c70 100644 --- a/src/devices/bus/chanf/slot.cpp +++ b/src/devices/bus/chanf/slot.cpp @@ -217,7 +217,7 @@ bool channelf_cart_slot_device::call_softlist_load(software_list_device &swlist, get default card software -------------------------------------------------*/ -void channelf_cart_slot_device::get_default_card_software(std::string &result) +std::string channelf_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -235,10 +235,9 @@ void channelf_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "chess"); + return software_get_default_slot("chess"); } /*------------------------------------------------- diff --git a/src/devices/bus/chanf/slot.h b/src/devices/bus/chanf/slot.h index cd20ce557c4..78ee692640e 100644 --- a/src/devices/bus/chanf/slot.h +++ b/src/devices/bus/chanf/slot.h @@ -87,7 +87,7 @@ public: virtual const char *file_extensions() const override { return "bin,chf"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom); diff --git a/src/devices/bus/coco/cococart.cpp b/src/devices/bus/coco/cococart.cpp index 9943378996c..684f7a5d156 100644 --- a/src/devices/bus/coco/cococart.cpp +++ b/src/devices/bus/coco/cococart.cpp @@ -364,9 +364,9 @@ bool cococart_slot_device::call_softlist_load(software_list_device &swlist, cons // get_default_card_software //------------------------------------------------- -void cococart_slot_device::get_default_card_software(std::string &result) +std::string cococart_slot_device::get_default_card_software() { - software_get_default_slot(result, "pak"); + return software_get_default_slot("pak"); } diff --git a/src/devices/bus/coco/cococart.h b/src/devices/bus/coco/cococart.h index ac53c52a0da..f92459b4388 100644 --- a/src/devices/bus/coco/cococart.h +++ b/src/devices/bus/coco/cococart.h @@ -102,7 +102,7 @@ public: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing to $FF40-$FF7F DECLARE_READ8_MEMBER(read); diff --git a/src/devices/bus/coleco/exp.cpp b/src/devices/bus/coleco/exp.cpp index bf79854d857..4da0d060398 100644 --- a/src/devices/bus/coleco/exp.cpp +++ b/src/devices/bus/coleco/exp.cpp @@ -112,18 +112,15 @@ bool colecovision_cartridge_slot_device::call_softlist_load(software_list_device // get_default_card_software - //------------------------------------------------- -void colecovision_cartridge_slot_device::get_default_card_software(std::string &result) +std::string colecovision_cartridge_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { UINT32 length = core_fsize(m_file); if (length == 0x100000 || length == 0x200000) - { - software_get_default_slot(result, "xin1"); - return; - } + return software_get_default_slot("xin1"); } - software_get_default_slot(result, "standard"); + return software_get_default_slot("standard"); } diff --git a/src/devices/bus/coleco/exp.h b/src/devices/bus/coleco/exp.h index c70b06959a0..e64e3c8d6d1 100644 --- a/src/devices/bus/coleco/exp.h +++ b/src/devices/bus/coleco/exp.h @@ -93,7 +93,7 @@ protected: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; device_colecovision_cartridge_interface *m_card; }; diff --git a/src/devices/bus/crvision/slot.cpp b/src/devices/bus/crvision/slot.cpp index 5953c1c5cb6..47173a1cf5d 100644 --- a/src/devices/bus/crvision/slot.cpp +++ b/src/devices/bus/crvision/slot.cpp @@ -229,7 +229,7 @@ bool crvision_cart_slot_device::call_softlist_load(software_list_device &swlist, get default card software -------------------------------------------------*/ -void crvision_cart_slot_device::get_default_card_software(std::string &result) +std::string crvision_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -267,11 +267,10 @@ void crvision_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "crv_rom4k"); + return software_get_default_slot("crv_rom4k"); } /*------------------------------------------------- diff --git a/src/devices/bus/crvision/slot.h b/src/devices/bus/crvision/slot.h index b6da6c165df..d3bb02d6790 100644 --- a/src/devices/bus/crvision/slot.h +++ b/src/devices/bus/crvision/slot.h @@ -78,7 +78,7 @@ public: virtual const char *file_extensions() const override { return "bin,rom"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom40); diff --git a/src/devices/bus/gameboy/gb_slot.cpp b/src/devices/bus/gameboy/gb_slot.cpp index 32e0f46db29..9202bbfb358 100644 --- a/src/devices/bus/gameboy/gb_slot.cpp +++ b/src/devices/bus/gameboy/gb_slot.cpp @@ -600,7 +600,7 @@ int base_gb_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) get default card software -------------------------------------------------*/ -void base_gb_cart_slot_device::get_default_card_software(std::string &result) +std::string base_gb_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -623,23 +623,19 @@ void base_gb_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "rom"); + return software_get_default_slot("rom"); } -void megaduck_cart_slot_device::get_default_card_software(std::string &result) +std::string megaduck_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) - { - result.assign("rom"); - return; - } + return std::string("rom"); - software_get_default_slot(result, "rom"); + return software_get_default_slot("rom"); } diff --git a/src/devices/bus/gameboy/gb_slot.h b/src/devices/bus/gameboy/gb_slot.h index 3d37b7b11ec..a0108ec03c7 100644 --- a/src/devices/bus/gameboy/gb_slot.h +++ b/src/devices/bus/gameboy/gb_slot.h @@ -141,7 +141,7 @@ public: virtual const char *file_extensions() const override { return "bin,gb,gbc"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom); @@ -182,7 +182,7 @@ public: virtual const char *file_extensions() const override { return "bin"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; }; diff --git a/src/devices/bus/gba/gba_slot.cpp b/src/devices/bus/gba/gba_slot.cpp index 82ef6663a93..1fa9372faa4 100644 --- a/src/devices/bus/gba/gba_slot.cpp +++ b/src/devices/bus/gba/gba_slot.cpp @@ -400,7 +400,7 @@ int gba_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) get default card software -------------------------------------------------*/ -void gba_cart_slot_device::get_default_card_software(std::string &result) +std::string gba_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -417,11 +417,10 @@ void gba_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "gba_rom"); + return software_get_default_slot("gba_rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/gba/gba_slot.h b/src/devices/bus/gba/gba_slot.h index 339be075733..9d9a6a48be7 100644 --- a/src/devices/bus/gba/gba_slot.h +++ b/src/devices/bus/gba/gba_slot.h @@ -91,7 +91,7 @@ public: virtual const char *file_extensions() const override { return "gba,bin"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ32_MEMBER(read_rom); diff --git a/src/devices/bus/generic/slot.cpp b/src/devices/bus/generic/slot.cpp index 40a32ffcecd..94644ba728f 100644 --- a/src/devices/bus/generic/slot.cpp +++ b/src/devices/bus/generic/slot.cpp @@ -179,9 +179,9 @@ bool generic_slot_device::call_softlist_load(software_list_device &swlist, const get default card software -------------------------------------------------*/ -void generic_slot_device::get_default_card_software(std::string &result) +std::string generic_slot_device::get_default_card_software() { - software_get_default_slot(result, m_default_card); + return software_get_default_slot(m_default_card); } diff --git a/src/devices/bus/generic/slot.h b/src/devices/bus/generic/slot.h index bf3833558da..6a12c1cd84c 100644 --- a/src/devices/bus/generic/slot.h +++ b/src/devices/bus/generic/slot.h @@ -124,7 +124,7 @@ public: virtual const char *file_extensions() const override { return m_extensions; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom); diff --git a/src/devices/bus/intv/slot.cpp b/src/devices/bus/intv/slot.cpp index 3cb214753f0..daa41e57f7c 100644 --- a/src/devices/bus/intv/slot.cpp +++ b/src/devices/bus/intv/slot.cpp @@ -459,7 +459,7 @@ bool intv_cart_slot_device::call_softlist_load(software_list_device &swlist, con get default card software -------------------------------------------------*/ -void intv_cart_slot_device::get_default_card_software(std::string &result) +std::string intv_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -503,10 +503,9 @@ void intv_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "intv_rom"); + return software_get_default_slot("intv_rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/intv/slot.h b/src/devices/bus/intv/slot.h index 865866ca2e0..7d970f18a52 100644 --- a/src/devices/bus/intv/slot.h +++ b/src/devices/bus/intv/slot.h @@ -120,7 +120,7 @@ public: virtual const char *file_extensions() const override { return "bin,int,rom,itv"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ16_MEMBER(read_rom04) { if (m_cart) return m_cart->read_rom04(space, offset, mem_mask); else return 0xffff; } diff --git a/src/devices/bus/iq151/iq151.cpp b/src/devices/bus/iq151/iq151.cpp index 1a3f2d3018f..5f2d522c1d9 100644 --- a/src/devices/bus/iq151/iq151.cpp +++ b/src/devices/bus/iq151/iq151.cpp @@ -204,7 +204,7 @@ bool iq151cart_slot_device::call_softlist_load(software_list_device &swlist, con get default card software -------------------------------------------------*/ -void iq151cart_slot_device::get_default_card_software(std::string &result) +std::string iq151cart_slot_device::get_default_card_software() { - software_get_default_slot(result, "basic6"); + return software_get_default_slot("basic6"); } diff --git a/src/devices/bus/iq151/iq151.h b/src/devices/bus/iq151/iq151.h index c88948c925c..292362f0d45 100644 --- a/src/devices/bus/iq151/iq151.h +++ b/src/devices/bus/iq151/iq151.h @@ -106,7 +106,7 @@ public: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual void read(offs_t offset, UINT8 &data); diff --git a/src/devices/bus/kc/kc.cpp b/src/devices/bus/kc/kc.cpp index fdd2de706e6..13bca495f89 100644 --- a/src/devices/bus/kc/kc.cpp +++ b/src/devices/bus/kc/kc.cpp @@ -370,7 +370,7 @@ bool kccart_slot_device::call_softlist_load(software_list_device &swlist, const get default card software -------------------------------------------------*/ -void kccart_slot_device::get_default_card_software(std::string &result) +std::string kccart_slot_device::get_default_card_software() { - software_get_default_slot(result, "standard"); + return software_get_default_slot("standard"); } diff --git a/src/devices/bus/kc/kc.h b/src/devices/bus/kc/kc.h index 85146d4cfe8..e31007ea85e 100644 --- a/src/devices/bus/kc/kc.h +++ b/src/devices/bus/kc/kc.h @@ -104,7 +104,7 @@ public: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; }; // device type definition diff --git a/src/devices/bus/megadrive/md_slot.cpp b/src/devices/bus/megadrive/md_slot.cpp index f1a5700b0e1..92eb9fa1b8f 100644 --- a/src/devices/bus/megadrive/md_slot.cpp +++ b/src/devices/bus/megadrive/md_slot.cpp @@ -900,7 +900,7 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) get default card software -------------------------------------------------*/ -void base_md_cart_slot_device::get_default_card_software(std::string &result) +std::string base_md_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -919,10 +919,10 @@ void base_md_cart_slot_device::get_default_card_software(std::string &result) clear(); - result.assign(slot_string); + return std::string(slot_string); } else - software_get_default_slot(result, "rom"); + return software_get_default_slot("rom"); } diff --git a/src/devices/bus/megadrive/md_slot.h b/src/devices/bus/megadrive/md_slot.h index 2adac9e01d0..086d02bc79f 100644 --- a/src/devices/bus/megadrive/md_slot.h +++ b/src/devices/bus/megadrive/md_slot.h @@ -161,7 +161,7 @@ public: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; int get_type() { return m_type; } diff --git a/src/devices/bus/msx_slot/cartridge.cpp b/src/devices/bus/msx_slot/cartridge.cpp index 43a92a94906..274e6f1875c 100644 --- a/src/devices/bus/msx_slot/cartridge.cpp +++ b/src/devices/bus/msx_slot/cartridge.cpp @@ -278,7 +278,7 @@ int msx_slot_cartridge_device::get_cart_type(UINT8 *rom, UINT32 length) } -void msx_slot_cartridge_device::get_default_card_software(std::string &result) +std::string msx_slot_cartridge_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -337,10 +337,9 @@ void msx_slot_cartridge_device::get_default_card_software(std::string &result) slot_string = msx_cart_get_slot_option(type); } - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "nomapper"); + return software_get_default_slot("nomapper"); } diff --git a/src/devices/bus/msx_slot/cartridge.h b/src/devices/bus/msx_slot/cartridge.h index 7eaaf7a3242..ce8303ff3d4 100644 --- a/src/devices/bus/msx_slot/cartridge.h +++ b/src/devices/bus/msx_slot/cartridge.h @@ -55,7 +55,7 @@ public: virtual const char *file_extensions() const override { return "mx1,bin,rom"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // msx_internal_slot-level overrides virtual DECLARE_READ8_MEMBER(read) override; diff --git a/src/devices/bus/neogeo/neogeo_slot.cpp b/src/devices/bus/neogeo/neogeo_slot.cpp index 100e53e6e18..3f8eea06635 100644 --- a/src/devices/bus/neogeo/neogeo_slot.cpp +++ b/src/devices/bus/neogeo/neogeo_slot.cpp @@ -204,9 +204,9 @@ bool neogeo_cart_slot_device::call_softlist_load(software_list_device &swlist, c get default card software -------------------------------------------------*/ -void neogeo_cart_slot_device::get_default_card_software(std::string &result) +std::string neogeo_cart_slot_device::get_default_card_software() { - software_get_default_slot(result, "rom"); + return software_get_default_slot("rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/neogeo/neogeo_slot.h b/src/devices/bus/neogeo/neogeo_slot.h index ae46e619f0e..1b037103165 100644 --- a/src/devices/bus/neogeo/neogeo_slot.h +++ b/src/devices/bus/neogeo/neogeo_slot.h @@ -41,7 +41,7 @@ public: virtual const char *file_extensions() const override { return "bin"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ16_MEMBER(read_rom); diff --git a/src/devices/bus/nes/aladdin.cpp b/src/devices/bus/nes/aladdin.cpp index ff3598d9052..95834d239aa 100644 --- a/src/devices/bus/nes/aladdin.cpp +++ b/src/devices/bus/nes/aladdin.cpp @@ -142,7 +142,7 @@ bool nes_aladdin_slot_device::call_softlist_load(software_list_device &swlist, c return TRUE; } -void nes_aladdin_slot_device::get_default_card_software(std::string &result) +std::string nes_aladdin_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -163,10 +163,10 @@ void nes_aladdin_slot_device::get_default_card_software(std::string &result) clear(); - result.assign(slot_string); + return std::string(slot_string); } else - software_get_default_slot(result, "algn"); + return software_get_default_slot("algn"); } diff --git a/src/devices/bus/nes/aladdin.h b/src/devices/bus/nes/aladdin.h index ad6b7a4a796..20786c3cab3 100644 --- a/src/devices/bus/nes/aladdin.h +++ b/src/devices/bus/nes/aladdin.h @@ -65,7 +65,7 @@ public: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; virtual DECLARE_READ8_MEMBER(read); void write_prg(UINT32 offset, UINT8 data) { if (m_cart) m_cart->write_prg(offset, data); } diff --git a/src/devices/bus/nes/datach.cpp b/src/devices/bus/nes/datach.cpp index e0629f74fd3..aff526a755f 100644 --- a/src/devices/bus/nes/datach.cpp +++ b/src/devices/bus/nes/datach.cpp @@ -143,10 +143,10 @@ bool nes_datach_slot_device::call_softlist_load(software_list_device &swlist, co return TRUE; } -void nes_datach_slot_device::get_default_card_software(std::string &result) +std::string nes_datach_slot_device::get_default_card_software() { // any way to detect the game with X24C01? - software_get_default_slot(result, "datach_rom"); + return software_get_default_slot("datach_rom"); } diff --git a/src/devices/bus/nes/datach.h b/src/devices/bus/nes/datach.h index 3fe70c2a531..bda9edfe50e 100644 --- a/src/devices/bus/nes/datach.h +++ b/src/devices/bus/nes/datach.h @@ -67,7 +67,7 @@ public: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; virtual DECLARE_READ8_MEMBER(read); void write_prg_bank(UINT8 bank) { if (m_cart) m_cart->write_prg_bank(bank); } diff --git a/src/devices/bus/nes/karastudio.cpp b/src/devices/bus/nes/karastudio.cpp index 9342f18dd40..1e9317db284 100644 --- a/src/devices/bus/nes/karastudio.cpp +++ b/src/devices/bus/nes/karastudio.cpp @@ -132,9 +132,9 @@ bool nes_kstudio_slot_device::call_softlist_load(software_list_device &swlist, c return TRUE; } -void nes_kstudio_slot_device::get_default_card_software(std::string &result) +std::string nes_kstudio_slot_device::get_default_card_software() { - software_get_default_slot(result, "ks_exp"); + return software_get_default_slot("ks_exp"); } diff --git a/src/devices/bus/nes/karastudio.h b/src/devices/bus/nes/karastudio.h index c39020d38ce..3a2f0c6d919 100644 --- a/src/devices/bus/nes/karastudio.h +++ b/src/devices/bus/nes/karastudio.h @@ -64,7 +64,7 @@ public: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; virtual DECLARE_READ8_MEMBER(read); void write_prg_bank(UINT8 bank) { if (m_cart) m_cart->write_prg_bank(bank); } diff --git a/src/devices/bus/nes/nes_slot.cpp b/src/devices/bus/nes/nes_slot.cpp index 7a4065a6d80..dc9b2e8e639 100644 --- a/src/devices/bus/nes/nes_slot.cpp +++ b/src/devices/bus/nes/nes_slot.cpp @@ -912,7 +912,7 @@ bool nes_cart_slot_device::call_softlist_load(software_list_device &swlist, cons get default card software -------------------------------------------------*/ -void nes_cart_slot_device::get_default_card_software(std::string &result) +std::string nes_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -930,10 +930,10 @@ void nes_cart_slot_device::get_default_card_software(std::string &result) clear(); - result.assign(slot_string); + return std::string(slot_string); } else - software_get_default_slot(result, "nrom"); + return software_get_default_slot("nrom"); } diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index 975357c81aa..ad2a1b1c28a 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -363,7 +363,7 @@ public: virtual device_image_partialhash_func get_partial_hash() const override { return &nes_partialhash; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; const char * get_default_card_ines(UINT8 *ROM, UINT32 len); const char * get_default_card_unif(UINT8 *ROM, UINT32 len); const char * nes_get_slot(int pcb_id); diff --git a/src/devices/bus/nes/sunsoft_dcs.cpp b/src/devices/bus/nes/sunsoft_dcs.cpp index 8be24a9c66d..a4f86e7e781 100644 --- a/src/devices/bus/nes/sunsoft_dcs.cpp +++ b/src/devices/bus/nes/sunsoft_dcs.cpp @@ -111,9 +111,9 @@ bool nes_ntb_slot_device::call_softlist_load(software_list_device &swlist, const return TRUE; } -void nes_ntb_slot_device::get_default_card_software(std::string &result) +std::string nes_ntb_slot_device::get_default_card_software() { - software_get_default_slot(result, "ntbrom"); + return software_get_default_slot("ntbrom"); } //----------------------------------------------- diff --git a/src/devices/bus/nes/sunsoft_dcs.h b/src/devices/bus/nes/sunsoft_dcs.h index a6437cb4638..83393719cf7 100644 --- a/src/devices/bus/nes/sunsoft_dcs.h +++ b/src/devices/bus/nes/sunsoft_dcs.h @@ -61,7 +61,7 @@ public: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; virtual DECLARE_READ8_MEMBER(read); diff --git a/src/devices/bus/odyssey2/slot.cpp b/src/devices/bus/odyssey2/slot.cpp index fe12540494f..4d540411a7f 100644 --- a/src/devices/bus/odyssey2/slot.cpp +++ b/src/devices/bus/odyssey2/slot.cpp @@ -209,7 +209,7 @@ bool o2_cart_slot_device::call_softlist_load(software_list_device &swlist, const get default card software -------------------------------------------------*/ -void o2_cart_slot_device::get_default_card_software(std::string &result) +std::string o2_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -227,11 +227,10 @@ void o2_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "o2_rom"); + return software_get_default_slot("o2_rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/odyssey2/slot.h b/src/devices/bus/odyssey2/slot.h index 59b576af30f..6634ed57c61 100644 --- a/src/devices/bus/odyssey2/slot.h +++ b/src/devices/bus/odyssey2/slot.h @@ -84,7 +84,7 @@ public: virtual const char *file_extensions() const override { return "bin,rom"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom04); diff --git a/src/devices/bus/pce/pce_slot.cpp b/src/devices/bus/pce/pce_slot.cpp index 913f22110b8..3ecd0e9cb7b 100644 --- a/src/devices/bus/pce/pce_slot.cpp +++ b/src/devices/bus/pce/pce_slot.cpp @@ -339,7 +339,7 @@ int pce_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) get default card software -------------------------------------------------*/ -void pce_cart_slot_device::get_default_card_software(std::string &result) +std::string pce_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -356,11 +356,10 @@ void pce_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "rom"); + return software_get_default_slot("rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/pce/pce_slot.h b/src/devices/bus/pce/pce_slot.h index 2b859d7236f..e680ef7b950 100644 --- a/src/devices/bus/pce/pce_slot.h +++ b/src/devices/bus/pce/pce_slot.h @@ -88,7 +88,7 @@ public: virtual const char *file_extensions() const override { return "pce,bin"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_cart); diff --git a/src/devices/bus/plus4/exp.cpp b/src/devices/bus/plus4/exp.cpp index 5ea6289b2cc..efea87851e1 100644 --- a/src/devices/bus/plus4/exp.cpp +++ b/src/devices/bus/plus4/exp.cpp @@ -157,9 +157,9 @@ bool plus4_expansion_slot_device::call_softlist_load(software_list_device &swlis // get_default_card_software - //------------------------------------------------- -void plus4_expansion_slot_device::get_default_card_software(std::string &result) +std::string plus4_expansion_slot_device::get_default_card_software() { - software_get_default_slot(result, "standard"); + return software_get_default_slot("standard"); } diff --git a/src/devices/bus/plus4/exp.h b/src/devices/bus/plus4/exp.h index 616857711c8..3595b013f98 100644 --- a/src/devices/bus/plus4/exp.h +++ b/src/devices/bus/plus4/exp.h @@ -135,7 +135,7 @@ protected: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; devcb_write_line m_write_irq; devcb_read8 m_read_dma_cd; diff --git a/src/devices/bus/ql/rom.cpp b/src/devices/bus/ql/rom.cpp index 3a1dc4dd171..c15ac21b872 100644 --- a/src/devices/bus/ql/rom.cpp +++ b/src/devices/bus/ql/rom.cpp @@ -114,9 +114,9 @@ bool ql_rom_cartridge_slot_t::call_softlist_load(software_list_device &swlist, c // get_default_card_software - //------------------------------------------------- -void ql_rom_cartridge_slot_t::get_default_card_software(std::string &result) +std::string ql_rom_cartridge_slot_t::get_default_card_software() { - software_get_default_slot(result, "standard"); + return software_get_default_slot("standard"); } diff --git a/src/devices/bus/ql/rom.h b/src/devices/bus/ql/rom.h index e2c9a89818e..282c47cac3d 100644 --- a/src/devices/bus/ql/rom.h +++ b/src/devices/bus/ql/rom.h @@ -110,7 +110,7 @@ protected: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; device_ql_rom_cartridge_card_interface *m_card; }; diff --git a/src/devices/bus/saturn/sat_slot.cpp b/src/devices/bus/saturn/sat_slot.cpp index 7e1f0cd1233..d1160c68e29 100644 --- a/src/devices/bus/saturn/sat_slot.cpp +++ b/src/devices/bus/saturn/sat_slot.cpp @@ -219,9 +219,9 @@ bool sat_cart_slot_device::call_softlist_load(software_list_device &swlist, cons get default card software -------------------------------------------------*/ -void sat_cart_slot_device::get_default_card_software(std::string &result) +std::string sat_cart_slot_device::get_default_card_software() { - software_get_default_slot(result, "rom"); + return software_get_default_slot("rom"); } diff --git a/src/devices/bus/saturn/sat_slot.h b/src/devices/bus/saturn/sat_slot.h index 075848ee409..e8a711c3a0b 100644 --- a/src/devices/bus/saturn/sat_slot.h +++ b/src/devices/bus/saturn/sat_slot.h @@ -89,7 +89,7 @@ public: virtual const char *file_extensions() const override { return "bin"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ32_MEMBER(read_rom); diff --git a/src/devices/bus/scv/slot.cpp b/src/devices/bus/scv/slot.cpp index e2c6dece7c0..6cb7157b5bb 100644 --- a/src/devices/bus/scv/slot.cpp +++ b/src/devices/bus/scv/slot.cpp @@ -259,7 +259,7 @@ int scv_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) get default card software -------------------------------------------------*/ -void scv_cart_slot_device::get_default_card_software(std::string &result) +std::string scv_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -276,11 +276,10 @@ void scv_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "rom8k"); + return software_get_default_slot("rom8k"); } /*------------------------------------------------- diff --git a/src/devices/bus/scv/slot.h b/src/devices/bus/scv/slot.h index 1befef08f28..3fa5a02578a 100644 --- a/src/devices/bus/scv/slot.h +++ b/src/devices/bus/scv/slot.h @@ -88,7 +88,7 @@ public: virtual const char *file_extensions() const override { return "bin"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_cart); diff --git a/src/devices/bus/sega8/sega8_slot.cpp b/src/devices/bus/sega8/sega8_slot.cpp index a3fee762e91..9f85e6b810c 100644 --- a/src/devices/bus/sega8/sega8_slot.cpp +++ b/src/devices/bus/sega8/sega8_slot.cpp @@ -603,7 +603,7 @@ int sega8_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) get default card software -------------------------------------------------*/ -void sega8_cart_slot_device::get_default_card_software(std::string &result) +std::string sega8_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -623,11 +623,10 @@ void sega8_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "rom"); + return software_get_default_slot("rom"); } diff --git a/src/devices/bus/sega8/sega8_slot.h b/src/devices/bus/sega8/sega8_slot.h index cf56effa4f0..439bc3be7a2 100644 --- a/src/devices/bus/sega8/sega8_slot.h +++ b/src/devices/bus/sega8/sega8_slot.h @@ -137,7 +137,7 @@ public: virtual const char *file_extensions() const override { return m_extensions; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_cart); diff --git a/src/devices/bus/snes/snes_slot.cpp b/src/devices/bus/snes/snes_slot.cpp index 6098824921f..15d68f41afe 100644 --- a/src/devices/bus/snes/snes_slot.cpp +++ b/src/devices/bus/snes/snes_slot.cpp @@ -999,7 +999,7 @@ void base_sns_cart_slot_device::get_cart_type_addon(UINT8 *ROM, UINT32 len, int get default card software -------------------------------------------------*/ -void base_sns_cart_slot_device::get_default_card_software(std::string &result) +std::string base_sns_cart_slot_device::get_default_card_software() { bool fullpath = open_image_file(mconfig().options()); @@ -1058,11 +1058,10 @@ void base_sns_cart_slot_device::get_default_card_software(std::string &result) clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "lorom"); + return software_get_default_slot("lorom"); } diff --git a/src/devices/bus/snes/snes_slot.h b/src/devices/bus/snes/snes_slot.h index 8b433d1128a..02b00a1cb87 100644 --- a/src/devices/bus/snes/snes_slot.h +++ b/src/devices/bus/snes/snes_slot.h @@ -180,7 +180,7 @@ public: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_l); diff --git a/src/devices/bus/vboy/slot.cpp b/src/devices/bus/vboy/slot.cpp index 88ef2ce7a2f..151d6f93ef0 100644 --- a/src/devices/bus/vboy/slot.cpp +++ b/src/devices/bus/vboy/slot.cpp @@ -233,9 +233,9 @@ bool vboy_cart_slot_device::call_softlist_load(software_list_device &swlist, con get default card software -------------------------------------------------*/ -void vboy_cart_slot_device::get_default_card_software(std::string &result) +std::string vboy_cart_slot_device::get_default_card_software() { - software_get_default_slot(result, "vb_rom"); + return software_get_default_slot("vb_rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/vboy/slot.h b/src/devices/bus/vboy/slot.h index c663b37252b..ca9e784ad8c 100644 --- a/src/devices/bus/vboy/slot.h +++ b/src/devices/bus/vboy/slot.h @@ -83,7 +83,7 @@ public: virtual const char *file_extensions() const override { return "vb,bin"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ32_MEMBER(read_cart); diff --git a/src/devices/bus/vc4000/slot.cpp b/src/devices/bus/vc4000/slot.cpp index 88d7b9b4f7e..f7f8b797cfb 100644 --- a/src/devices/bus/vc4000/slot.cpp +++ b/src/devices/bus/vc4000/slot.cpp @@ -235,7 +235,7 @@ bool vc4000_cart_slot_device::call_softlist_load(software_list_device &swlist, c get default card software -------------------------------------------------*/ -void vc4000_cart_slot_device::get_default_card_software(std::string &result) +std::string vc4000_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -254,11 +254,10 @@ void vc4000_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "std"); + return software_get_default_slot("std"); } /*------------------------------------------------- diff --git a/src/devices/bus/vc4000/slot.h b/src/devices/bus/vc4000/slot.h index 089bdf5fc3a..6b40c6cbcbe 100644 --- a/src/devices/bus/vc4000/slot.h +++ b/src/devices/bus/vc4000/slot.h @@ -85,7 +85,7 @@ public: virtual const char *file_extensions() const override { return "bin,rom"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom); diff --git a/src/devices/bus/vcs/vcs_slot.cpp b/src/devices/bus/vcs/vcs_slot.cpp index 73d01ef1547..f37c00a1f97 100755 --- a/src/devices/bus/vcs/vcs_slot.cpp +++ b/src/devices/bus/vcs/vcs_slot.cpp @@ -781,7 +781,7 @@ int vcs_cart_slot_device::identify_cart_type(UINT8 *ROM, UINT32 len) get default card software -------------------------------------------------*/ -void vcs_cart_slot_device::get_default_card_software(std::string &result) +std::string vcs_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -797,10 +797,10 @@ void vcs_cart_slot_device::get_default_card_software(std::string &result) clear(); - result.assign(slot_string); + return std::string(slot_string); } else - software_get_default_slot(result, "a26_4k"); + return software_get_default_slot("a26_4k"); } diff --git a/src/devices/bus/vcs/vcs_slot.h b/src/devices/bus/vcs/vcs_slot.h index f77eda9056c..984cf5c9d12 100755 --- a/src/devices/bus/vcs/vcs_slot.h +++ b/src/devices/bus/vcs/vcs_slot.h @@ -112,7 +112,7 @@ public: virtual const char *file_extensions() const override { return "bin,a26"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom); diff --git a/src/devices/bus/vectrex/slot.cpp b/src/devices/bus/vectrex/slot.cpp index c97b007642a..eadf505484a 100644 --- a/src/devices/bus/vectrex/slot.cpp +++ b/src/devices/bus/vectrex/slot.cpp @@ -217,7 +217,7 @@ bool vectrex_cart_slot_device::call_softlist_load(software_list_device &swlist, get default card software -------------------------------------------------*/ -void vectrex_cart_slot_device::get_default_card_software(std::string &result) +std::string vectrex_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -238,11 +238,10 @@ void vectrex_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "vec_rom"); + return software_get_default_slot("vec_rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/vectrex/slot.h b/src/devices/bus/vectrex/slot.h index f9007ca01a6..5a1bf306213 100644 --- a/src/devices/bus/vectrex/slot.h +++ b/src/devices/bus/vectrex/slot.h @@ -84,7 +84,7 @@ public: virtual const char *file_extensions() const override { return "bin,gam,vec"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom); diff --git a/src/devices/bus/vic10/exp.cpp b/src/devices/bus/vic10/exp.cpp index 6aca9930c13..9a4ab019eb2 100644 --- a/src/devices/bus/vic10/exp.cpp +++ b/src/devices/bus/vic10/exp.cpp @@ -182,20 +182,17 @@ bool vic10_expansion_slot_device::call_softlist_load(software_list_device &swlis // get_default_card_software - //------------------------------------------------- -void vic10_expansion_slot_device::get_default_card_software(std::string &result) +std::string vic10_expansion_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { if (!core_stricmp(filetype(), "crt")) - { - cbm_crt_get_card(result, m_file); - return; - } + return cbm_crt_get_card(m_file); clear(); } - software_get_default_slot(result, "standard"); + return software_get_default_slot("standard"); } diff --git a/src/devices/bus/vic10/exp.h b/src/devices/bus/vic10/exp.h index f334668ada8..9ca71e33653 100644 --- a/src/devices/bus/vic10/exp.h +++ b/src/devices/bus/vic10/exp.h @@ -134,7 +134,7 @@ protected: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; devcb_write_line m_write_irq; devcb_write_line m_write_res; diff --git a/src/devices/bus/vic20/exp.cpp b/src/devices/bus/vic20/exp.cpp index 42907bbb0d9..946405a13eb 100644 --- a/src/devices/bus/vic20/exp.cpp +++ b/src/devices/bus/vic20/exp.cpp @@ -167,9 +167,9 @@ bool vic20_expansion_slot_device::call_softlist_load(software_list_device &swlis // get_default_card_software - //------------------------------------------------- -void vic20_expansion_slot_device::get_default_card_software(std::string &result) +std::string vic20_expansion_slot_device::get_default_card_software() { - software_get_default_slot(result, "standard"); + return software_get_default_slot("standard"); } diff --git a/src/devices/bus/vic20/exp.h b/src/devices/bus/vic20/exp.h index ddcffa82569..15d67b00e53 100644 --- a/src/devices/bus/vic20/exp.h +++ b/src/devices/bus/vic20/exp.h @@ -125,7 +125,7 @@ protected: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; devcb_write_line m_write_irq; devcb_write_line m_write_nmi; diff --git a/src/devices/bus/vidbrain/exp.cpp b/src/devices/bus/vidbrain/exp.cpp index 2aea10bfc8a..a2044481a6a 100644 --- a/src/devices/bus/vidbrain/exp.cpp +++ b/src/devices/bus/vidbrain/exp.cpp @@ -154,9 +154,9 @@ bool videobrain_expansion_slot_device::call_softlist_load(software_list_device & // get_default_card_software - //------------------------------------------------- -void videobrain_expansion_slot_device::get_default_card_software(std::string &result) +std::string videobrain_expansion_slot_device::get_default_card_software() { - software_get_default_slot(result, "standard"); + return software_get_default_slot("standard"); } diff --git a/src/devices/bus/vidbrain/exp.h b/src/devices/bus/vidbrain/exp.h index 2579d92a08d..e431ff3f1a6 100644 --- a/src/devices/bus/vidbrain/exp.h +++ b/src/devices/bus/vidbrain/exp.h @@ -150,7 +150,7 @@ protected: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; devcb_write_line m_write_extres; diff --git a/src/devices/bus/wswan/slot.cpp b/src/devices/bus/wswan/slot.cpp index 0a7383ea8a9..372a40a851a 100644 --- a/src/devices/bus/wswan/slot.cpp +++ b/src/devices/bus/wswan/slot.cpp @@ -306,7 +306,7 @@ int ws_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len, UINT32 &nvram_len get default card software -------------------------------------------------*/ -void ws_cart_slot_device::get_default_card_software(std::string &result) +std::string ws_cart_slot_device::get_default_card_software() { if (open_image_file(mconfig().options())) { @@ -325,11 +325,10 @@ void ws_cart_slot_device::get_default_card_software(std::string &result) //printf("type: %s\n", slot_string); clear(); - result.assign(slot_string); - return; + return std::string(slot_string); } - software_get_default_slot(result, "ws_rom"); + return software_get_default_slot("ws_rom"); } /*------------------------------------------------- diff --git a/src/devices/bus/wswan/slot.h b/src/devices/bus/wswan/slot.h index 59dd49550ca..ae5ab7d81d6 100644 --- a/src/devices/bus/wswan/slot.h +++ b/src/devices/bus/wswan/slot.h @@ -96,7 +96,7 @@ public: virtual const char *file_extensions() const override { return "ws,wsc,bin"; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read_rom20); diff --git a/src/devices/bus/z88/z88.cpp b/src/devices/bus/z88/z88.cpp index 228805142be..647ea838fed 100644 --- a/src/devices/bus/z88/z88.cpp +++ b/src/devices/bus/z88/z88.cpp @@ -182,9 +182,9 @@ bool z88cart_slot_device::call_softlist_load(software_list_device &swlist, const get default card software -------------------------------------------------*/ -void z88cart_slot_device::get_default_card_software(std::string &result) +std::string z88cart_slot_device::get_default_card_software() { - software_get_default_slot(result, "128krom"); + return software_get_default_slot("128krom"); } diff --git a/src/devices/bus/z88/z88.h b/src/devices/bus/z88/z88.h index 19785d4a7b1..0c39edd5e24 100644 --- a/src/devices/bus/z88/z88.h +++ b/src/devices/bus/z88/z88.h @@ -109,7 +109,7 @@ public: virtual const option_guide *create_option_guide() const override { return nullptr; } // slot interface overrides - virtual void get_default_card_software(std::string &result) override; + virtual std::string get_default_card_software() override; // reading and writing virtual DECLARE_READ8_MEMBER(read); diff --git a/src/devices/cpu/8x300/8x300.cpp b/src/devices/cpu/8x300/8x300.cpp index ae1fa8bb906..a18f4d50c73 100644 --- a/src/devices/cpu/8x300/8x300.cpp +++ b/src/devices/cpu/8x300/8x300.cpp @@ -145,7 +145,7 @@ void n8x300_cpu_device::device_start() m_icountptr = &m_icount; } -void n8x300_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void n8x300_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/8x300/8x300.h b/src/devices/cpu/8x300/8x300.h index fe6b95259b0..dd236372e5d 100644 --- a/src/devices/cpu/8x300/8x300.h +++ b/src/devices/cpu/8x300/8x300.h @@ -66,7 +66,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/adsp2100/adsp2100.cpp b/src/devices/cpu/adsp2100/adsp2100.cpp index 5554513e42f..63788892288 100644 --- a/src/devices/cpu/adsp2100/adsp2100.cpp +++ b/src/devices/cpu/adsp2100/adsp2100.cpp @@ -544,15 +544,14 @@ void adsp21xx_device::device_start() state_add(ADSP2100_SR0_SEC, "SR0_SEC", m_alt.sr.srx.sr0.u); state_add(ADSP2100_SR1_SEC, "SR1_SEC", m_alt.sr.srx.sr1.u); - std::string tempstring; for (int ireg = 0; ireg < 8; ireg++) - state_add(ADSP2100_I0 + ireg, strformat(tempstring, "I%d", ireg).c_str(), m_i[ireg]).mask(0x3fff).callimport(); + state_add(ADSP2100_I0 + ireg, strformat("I%d", ireg).c_str(), m_i[ireg]).mask(0x3fff).callimport(); for (int lreg = 0; lreg < 8; lreg++) - state_add(ADSP2100_L0 + lreg, strformat(tempstring, "L%d", lreg).c_str(), m_l[lreg]).mask(0x3fff).callimport(); + state_add(ADSP2100_L0 + lreg, strformat("L%d", lreg).c_str(), m_l[lreg]).mask(0x3fff).callimport(); for (int mreg = 0; mreg < 8; mreg++) - state_add(ADSP2100_M0 + mreg, strformat(tempstring, "M%d", mreg).c_str(), m_m[mreg]).signed_mask(0x3fff); + state_add(ADSP2100_M0 + mreg, strformat("M%d", mreg).c_str(), m_m[mreg]).signed_mask(0x3fff); state_add(ADSP2100_PX, "PX", m_px); state_add(ADSP2100_CNTR, "CNTR", m_cntr).mask(0x3fff); @@ -571,7 +570,7 @@ void adsp21xx_device::device_start() for (int irqnum = 0; irqnum < 4; irqnum++) if (irqnum < 4 || m_chip_type == CHIP_TYPE_ADSP2100) - state_add(ADSP2100_IRQSTATE0 + irqnum, strformat(tempstring, "IRQ%d", irqnum).c_str(), m_irq_state[irqnum]).mask(1).callimport(); + state_add(ADSP2100_IRQSTATE0 + irqnum, strformat("IRQ%d", irqnum).c_str(), m_irq_state[irqnum]).mask(1).callimport(); state_add(ADSP2100_FLAGIN, "FLAGIN", m_flagin).mask(1); state_add(ADSP2100_FLAGOUT, "FLAGOUT", m_flagout).mask(1); @@ -720,7 +719,7 @@ void adsp21xx_device::state_import(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void adsp21xx_device::state_string_export(const device_state_entry &entry, std::string &str) +void adsp21xx_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/adsp2100/adsp2100.h b/src/devices/cpu/adsp2100/adsp2100.h index 816255eea4a..f2393f986d2 100644 --- a/src/devices/cpu/adsp2100/adsp2100.h +++ b/src/devices/cpu/adsp2100/adsp2100.h @@ -237,7 +237,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/alph8201/alph8201.cpp b/src/devices/cpu/alph8201/alph8201.cpp index 06c4deb020e..9c40d8d55ee 100644 --- a/src/devices/cpu/alph8201/alph8201.cpp +++ b/src/devices/cpu/alph8201/alph8201.cpp @@ -527,7 +527,7 @@ void alpha8201_cpu_device::state_export(const device_state_entry &entry) } -void alpha8201_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void alpha8201_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/alph8201/alph8201.h b/src/devices/cpu/alph8201/alph8201.h index 740bd1b1042..22130bc5464 100644 --- a/src/devices/cpu/alph8201/alph8201.h +++ b/src/devices/cpu/alph8201/alph8201.h @@ -75,7 +75,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/alto2/alto2cpu.cpp b/src/devices/cpu/alto2/alto2cpu.cpp index 6b35a076ec3..a3538dee290 100644 --- a/src/devices/cpu/alto2/alto2cpu.cpp +++ b/src/devices/cpu/alto2/alto2cpu.cpp @@ -1002,7 +1002,7 @@ void alto2_cpu_device::device_start() // for the debugger //------------------------------------------------- -void alto2_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void alto2_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/alto2/alto2cpu.h b/src/devices/cpu/alto2/alto2cpu.h index 9a9fdf0d031..071cbd3cb2a 100644 --- a/src/devices/cpu/alto2/alto2cpu.h +++ b/src/devices/cpu/alto2/alto2cpu.h @@ -213,7 +213,7 @@ protected: //! device (P)ROMs virtual const rom_entry *device_rom_region() const override; //! device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; //! device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/am29000/am29000.cpp b/src/devices/cpu/am29000/am29000.cpp index 27924fa163f..a31dc3b0374 100644 --- a/src/devices/cpu/am29000/am29000.cpp +++ b/src/devices/cpu/am29000/am29000.cpp @@ -404,7 +404,7 @@ void am29000_cpu_device::device_start() } -void am29000_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void am29000_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/am29000/am29000.h b/src/devices/cpu/am29000/am29000.h index 221e7309cea..4f0c1a1a4af 100644 --- a/src/devices/cpu/am29000/am29000.h +++ b/src/devices/cpu/am29000/am29000.h @@ -462,7 +462,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/amis2000/amis2000.cpp b/src/devices/cpu/amis2000/amis2000.cpp index 3082b09f14b..57ed4d99578 100644 --- a/src/devices/cpu/amis2000/amis2000.cpp +++ b/src/devices/cpu/amis2000/amis2000.cpp @@ -70,7 +70,7 @@ amis2152_cpu_device::amis2152_cpu_device(const machine_config &mconfig, const ch // disasm -void amis2000_base_device::state_string_export(const device_state_entry &entry, std::string &str) +void amis2000_base_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/amis2000/amis2000.h b/src/devices/cpu/amis2000/amis2000.h index e30522d7719..5beee90fae9 100644 --- a/src/devices/cpu/amis2000/amis2000.h +++ b/src/devices/cpu/amis2000/amis2000.h @@ -89,7 +89,7 @@ protected: virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } virtual UINT32 disasm_max_opcode_bytes() const override { return 1; } virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; address_space_config m_program_config; address_space_config m_data_config; diff --git a/src/devices/cpu/apexc/apexc.cpp b/src/devices/cpu/apexc/apexc.cpp index 77e5c919f44..87c5ff9a351 100644 --- a/src/devices/cpu/apexc/apexc.cpp +++ b/src/devices/cpu/apexc/apexc.cpp @@ -814,7 +814,7 @@ void apexc_cpu_device::state_export(const device_state_entry &entry) } -void apexc_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void apexc_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/apexc/apexc.h b/src/devices/cpu/apexc/apexc.h index 99b64812702..ad07fba71c6 100644 --- a/src/devices/cpu/apexc/apexc.h +++ b/src/devices/cpu/apexc/apexc.h @@ -44,7 +44,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/arm/arm.cpp b/src/devices/cpu/arm/arm.cpp index aa07ddcfecb..41724668f53 100644 --- a/src/devices/cpu/arm/arm.cpp +++ b/src/devices/cpu/arm/arm.cpp @@ -552,7 +552,7 @@ void arm_cpu_device::device_start() } -void arm_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void arm_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { static const char *s[4] = { "USER", "FIRQ", "IRQ ", "SVC " }; diff --git a/src/devices/cpu/arm/arm.h b/src/devices/cpu/arm/arm.h index f0639f384c1..d2f6156127b 100644 --- a/src/devices/cpu/arm/arm.h +++ b/src/devices/cpu/arm/arm.h @@ -61,7 +61,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/arm7/arm7.cpp b/src/devices/cpu/arm7/arm7.cpp index 346dcb1020d..828f8562811 100644 --- a/src/devices/cpu/arm7/arm7.cpp +++ b/src/devices/cpu/arm7/arm7.cpp @@ -564,7 +564,7 @@ void arm7_cpu_device::state_export(const device_state_entry &entry) } -void arm7_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void arm7_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/arm7/arm7.h b/src/devices/cpu/arm7/arm7.h index 210abe73cf6..24ab02f2b86 100644 --- a/src/devices/cpu/arm7/arm7.h +++ b/src/devices/cpu/arm7/arm7.h @@ -71,7 +71,7 @@ protected: // device_state_interface overrides virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/asap/asap.cpp b/src/devices/cpu/asap/asap.cpp index 9f36eb6116f..c22d0cdcee2 100644 --- a/src/devices/cpu/asap/asap.cpp +++ b/src/devices/cpu/asap/asap.cpp @@ -186,7 +186,6 @@ void asap_device::device_start() m_direct = &m_program->direct(); // register our state for the debugger - std::string tempstr; state_add(STATE_GENPC, "GENPC", m_pc).noshow(); state_add(STATE_GENPCBASE, "GENPCBASE", m_ppc).noshow(); state_add(STATE_GENSP, "GENSP", m_src2val[REGBASE + 31]).noshow(); @@ -194,7 +193,7 @@ void asap_device::device_start() state_add(ASAP_PC, "PC", m_pc); state_add(ASAP_PS, "PS", m_flagsio).callimport().callexport(); for (int regnum = 0; regnum < 32; regnum++) - state_add(ASAP_R0 + regnum, strformat(tempstr, "R%d", regnum).c_str(), m_src2val[REGBASE + regnum]); + state_add(ASAP_R0 + regnum, strformat("R%d", regnum).c_str(), m_src2val[REGBASE + regnum]); // register our state for saving save_item(NAME(m_pc)); @@ -281,7 +280,7 @@ void asap_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void asap_device::state_string_export(const device_state_entry &entry, std::string &str) +void asap_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/asap/asap.h b/src/devices/cpu/asap/asap.h index 287f2056af2..87d11282072 100644 --- a/src/devices/cpu/asap/asap.h +++ b/src/devices/cpu/asap/asap.h @@ -48,7 +48,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/avr8/avr8.cpp b/src/devices/cpu/avr8/avr8.cpp index f8f357a2a9b..756562f0ea7 100644 --- a/src/devices/cpu/avr8/avr8.cpp +++ b/src/devices/cpu/avr8/avr8.cpp @@ -905,7 +905,7 @@ const address_space_config *avr8_device::memory_space_config(address_spacenum sp // for the debugger //------------------------------------------------- -void avr8_device::state_string_export(const device_state_entry &entry, std::string &str) +void avr8_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/avr8/avr8.h b/src/devices/cpu/avr8/avr8.h index 45174d48741..86207566ffc 100644 --- a/src/devices/cpu/avr8/avr8.h +++ b/src/devices/cpu/avr8/avr8.h @@ -131,7 +131,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // address spaces const address_space_config m_program_config; diff --git a/src/devices/cpu/ccpu/ccpu.cpp b/src/devices/cpu/ccpu/ccpu.cpp index e8893580f0c..85756d12794 100644 --- a/src/devices/cpu/ccpu/ccpu.cpp +++ b/src/devices/cpu/ccpu/ccpu.cpp @@ -139,7 +139,7 @@ void ccpu_cpu_device::device_start() } -void ccpu_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void ccpu_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/ccpu/ccpu.h b/src/devices/cpu/ccpu/ccpu.h index 349b9e9ffc4..bfae00383e3 100644 --- a/src/devices/cpu/ccpu/ccpu.h +++ b/src/devices/cpu/ccpu/ccpu.h @@ -82,7 +82,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/cop400/cop400.cpp b/src/devices/cpu/cop400/cop400.cpp index 9f68a8c0545..ae14bd59cab 100644 --- a/src/devices/cpu/cop400/cop400.cpp +++ b/src/devices/cpu/cop400/cop400.cpp @@ -1205,7 +1205,7 @@ void cop400_cpu_device::state_export(const device_state_entry &entry) } } -void cop400_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void cop400_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/cop400/cop400.h b/src/devices/cpu/cop400/cop400.h index 3b2cbf349bc..43e7755f1f4 100644 --- a/src/devices/cpu/cop400/cop400.h +++ b/src/devices/cpu/cop400/cop400.h @@ -170,7 +170,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/cosmac/cosmac.cpp b/src/devices/cpu/cosmac/cosmac.cpp index 73170762cbf..d8e3d52c6fd 100644 --- a/src/devices/cpu/cosmac/cosmac.cpp +++ b/src/devices/cpu/cosmac/cosmac.cpp @@ -353,9 +353,8 @@ void cosmac_device::device_start() state_add(COSMAC_I, "I", m_i).mask(0xf); state_add(COSMAC_N, "N", m_n).mask(0xf); - std::string tempstr; for (int regnum = 0; regnum < 16; regnum++) - state_add(COSMAC_R0 + regnum, strformat(tempstr, "R%x", regnum).c_str(), m_r[regnum]); + state_add(COSMAC_R0 + regnum, strformat("R%x", regnum).c_str(), m_r[regnum]); state_add(COSMAC_DF, "DF", m_df).mask(0x1).noshow(); state_add(COSMAC_IE, "IE", m_ie).mask(0x1).noshow(); @@ -469,7 +468,7 @@ void cosmac_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void cosmac_device::state_string_export(const device_state_entry &entry, std::string &str) +void cosmac_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/cosmac/cosmac.h b/src/devices/cpu/cosmac/cosmac.h index 26a60021335..31b1d8dc11c 100644 --- a/src/devices/cpu/cosmac/cosmac.h +++ b/src/devices/cpu/cosmac/cosmac.h @@ -232,7 +232,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/cp1610/cp1610.cpp b/src/devices/cpu/cp1610/cp1610.cpp index fd6fd5eceb7..a05bbbc0d49 100644 --- a/src/devices/cpu/cp1610/cp1610.cpp +++ b/src/devices/cpu/cp1610/cp1610.cpp @@ -3401,7 +3401,7 @@ cp1610_cpu_device::cp1610_cpu_device(const machine_config &mconfig, const char * } -void cp1610_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void cp1610_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/cp1610/cp1610.h b/src/devices/cpu/cp1610/cp1610.h index ec9618eefff..84611f75a2c 100644 --- a/src/devices/cpu/cp1610/cp1610.h +++ b/src/devices/cpu/cp1610/cp1610.h @@ -56,7 +56,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/cubeqcpu/cubeqcpu.cpp b/src/devices/cpu/cubeqcpu/cubeqcpu.cpp index 0582c9a2679..a657a23680e 100644 --- a/src/devices/cpu/cubeqcpu/cubeqcpu.cpp +++ b/src/devices/cpu/cubeqcpu/cubeqcpu.cpp @@ -347,7 +347,7 @@ void cquestrot_cpu_device::device_reset() } -void cquestrot_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void cquestrot_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { @@ -471,7 +471,7 @@ void cquestlin_cpu_device::device_reset() } -void cquestlin_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void cquestlin_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/cubeqcpu/cubeqcpu.h b/src/devices/cpu/cubeqcpu/cubeqcpu.h index 1faa4fc5db7..23bfbf84f5b 100644 --- a/src/devices/cpu/cubeqcpu/cubeqcpu.h +++ b/src/devices/cpu/cubeqcpu/cubeqcpu.h @@ -232,7 +232,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 8; } @@ -316,7 +316,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 8; } diff --git a/src/devices/cpu/drcbex64.cpp b/src/devices/cpu/drcbex64.cpp index 5b2b2cb2eb5..034f06def80 100644 --- a/src/devices/cpu/drcbex64.cpp +++ b/src/devices/cpu/drcbex64.cpp @@ -787,7 +787,6 @@ void drcbe_x64::generate(drcuml_block &block, const instruction *instlist, UINT3 x86code *dst = base; // generate code - std::string tempstring; const char *blockname = nullptr; for (int inum = 0; inum < numinst; inum++) { @@ -797,8 +796,7 @@ void drcbe_x64::generate(drcuml_block &block, const instruction *instlist, UINT3 // add a comment if (m_log != nullptr) { - std::string dasm; - inst.disasm(dasm, &m_drcuml); + std::string dasm = inst.disasm(&m_drcuml); x86log_add_comment(m_log, dst, "%s", dasm.c_str()); } @@ -808,7 +806,7 @@ void drcbe_x64::generate(drcuml_block &block, const instruction *instlist, UINT3 if (inst.opcode() == OP_HANDLE) blockname = inst.param(0).handle().string(); else if (inst.opcode() == OP_HASH) - blockname = strformat(tempstring, "Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str(); + blockname = strformat("Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str(); } // generate code diff --git a/src/devices/cpu/drcbex86.cpp b/src/devices/cpu/drcbex86.cpp index 625f702160f..3ca840e1c6f 100644 --- a/src/devices/cpu/drcbex86.cpp +++ b/src/devices/cpu/drcbex86.cpp @@ -770,7 +770,6 @@ void drcbe_x86::generate(drcuml_block &block, const instruction *instlist, UINT3 x86code *dst = base; // generate code - std::string tempstring; const char *blockname = nullptr; for (int inum = 0; inum < numinst; inum++) { @@ -780,8 +779,7 @@ void drcbe_x86::generate(drcuml_block &block, const instruction *instlist, UINT3 // add a comment if (m_log != nullptr) { - std::string dasm; - inst.disasm(dasm, &m_drcuml); + std::string dasm = inst.disasm(&m_drcuml); x86log_add_comment(m_log, dst, "%s", dasm.c_str()); } @@ -791,7 +789,7 @@ void drcbe_x86::generate(drcuml_block &block, const instruction *instlist, UINT3 if (inst.opcode() == OP_HANDLE) blockname = inst.param(0).handle().string(); else if (inst.opcode() == OP_HASH) - blockname = strformat(tempstring, "Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str(); + blockname = strformat("Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str(); } // generate code diff --git a/src/devices/cpu/drcuml.cpp b/src/devices/cpu/drcuml.cpp index 4cf2fc981c0..3bbd610cfa9 100644 --- a/src/devices/cpu/drcuml.cpp +++ b/src/devices/cpu/drcuml.cpp @@ -456,7 +456,6 @@ void drcuml_block::optimize() void drcuml_block::disassemble() { std::string comment; - std::string dasm; // iterate over instructions and output int firstcomment = -1; @@ -483,7 +482,7 @@ void drcuml_block::disassemble() // indent everything else with a tab else { - m_inst[instnum].disasm(dasm, &m_drcuml); + std::string dasm = m_inst[instnum].disasm(&m_drcuml); // include the first accumulated comment with this line if (firstcomment != -1) @@ -1119,16 +1118,14 @@ static int bevalidate_verify_state(drcuml_state *drcuml, const drcuml_machine_st // output the error if we have one if (errend != errorbuf) { - char disasm[256]; - // disassemble the test instruction - testinst->disasm(disasm, drcuml); + std::string disasm = testinst->disasm(drcuml); // output a description of what went wrong printf("\n"); printf("----------------------------------------------\n"); printf("Backend validation error:\n"); - printf(" %s\n", disasm); + printf(" %s\n", disasm.c_str()); printf("\n"); printf("Errors:\n"); printf("%s\n", errorbuf); diff --git a/src/devices/cpu/dsp16/dsp16.cpp b/src/devices/cpu/dsp16/dsp16.cpp index f7b68e50d75..8b97ce4c064 100644 --- a/src/devices/cpu/dsp16/dsp16.cpp +++ b/src/devices/cpu/dsp16/dsp16.cpp @@ -214,7 +214,7 @@ const address_space_config *dsp16_device::memory_space_config(address_spacenum s // for the debugger //------------------------------------------------- -void dsp16_device::state_string_export(const device_state_entry &entry, std::string &str) +void dsp16_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/dsp16/dsp16.h b/src/devices/cpu/dsp16/dsp16.h index f574aeae03e..6e509da0569 100644 --- a/src/devices/cpu/dsp16/dsp16.h +++ b/src/devices/cpu/dsp16/dsp16.h @@ -46,7 +46,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/dsp32/dsp32.cpp b/src/devices/cpu/dsp32/dsp32.cpp index a8e65846559..f060e81d13c 100644 --- a/src/devices/cpu/dsp32/dsp32.cpp +++ b/src/devices/cpu/dsp32/dsp32.cpp @@ -194,14 +194,13 @@ void dsp32c_device::device_start() m_direct = &m_program->direct(); // register our state for the debugger - std::string tempstr; state_add(STATE_GENPC, "GENPC", m_r[15]).noshow(); state_add(STATE_GENPCBASE, "GENPCBASE", m_ppc).noshow(); state_add(STATE_GENSP, "GENSP", m_r[21]).noshow(); state_add(STATE_GENFLAGS, "GENFLAGS", m_iotemp).callimport().callexport().formatstr("%6s").noshow(); state_add(DSP32_PC, "PC", m_r[15]).mask(0xffffff); for (int regnum = 0; regnum <= 14; regnum++) - state_add(DSP32_R0 + regnum, strformat(tempstr, "R%d", regnum).c_str(), m_r[regnum]).mask(0xffffff); + state_add(DSP32_R0 + regnum, strformat("R%d", regnum).c_str(), m_r[regnum]).mask(0xffffff); state_add(DSP32_R15, "R15", m_r[17]).mask(0xffffff); state_add(DSP32_R16, "R16", m_r[18]).mask(0xffffff); state_add(DSP32_R17, "R17", m_r[19]).mask(0xffffff); @@ -369,7 +368,7 @@ void dsp32c_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void dsp32c_device::state_string_export(const device_state_entry &entry, std::string &str) +void dsp32c_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/dsp32/dsp32.h b/src/devices/cpu/dsp32/dsp32.h index 2b0b9e2b07e..b83888b7a6a 100644 --- a/src/devices/cpu/dsp32/dsp32.h +++ b/src/devices/cpu/dsp32/dsp32.h @@ -123,7 +123,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/dsp56k/dsp56k.cpp b/src/devices/cpu/dsp56k/dsp56k.cpp index 9e151019c7e..7c4b7abd163 100644 --- a/src/devices/cpu/dsp56k/dsp56k.cpp +++ b/src/devices/cpu/dsp56k/dsp56k.cpp @@ -340,9 +340,9 @@ void dsp56k_device::device_start() } -void dsp56k_device::state_string_export(const device_state_entry &entry, std::string &str) +void dsp56k_device::state_string_export(const device_state_entry &entry, std::string &str) const { - dsp56k_core *cpustate = &m_dsp56k_core; + const dsp56k_core *cpustate = &m_dsp56k_core; switch (entry.index()) { diff --git a/src/devices/cpu/dsp56k/dsp56k.h b/src/devices/cpu/dsp56k/dsp56k.h index 8b2eeb4561c..185b52dc033 100644 --- a/src/devices/cpu/dsp56k/dsp56k.h +++ b/src/devices/cpu/dsp56k/dsp56k.h @@ -231,7 +231,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ((spacenum == AS_DATA) ? &m_data_config : nullptr ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/dsp56k/dsp56pcu.cpp b/src/devices/cpu/dsp56k/dsp56pcu.cpp index 68b35199c73..637f7b6e067 100644 --- a/src/devices/cpu/dsp56k/dsp56pcu.cpp +++ b/src/devices/cpu/dsp56k/dsp56pcu.cpp @@ -14,18 +14,18 @@ namespace DSP56K /* |-------------------------------------| |-------------------------------| */ /* */ /* ************************************************************************* */ -UINT8 LF_bit(dsp56k_core* cpustate) { return (SR & 0x8000) >> 15; } -UINT8 FV_bit(dsp56k_core* cpustate) { return (SR & 0x4000) >> 14; } -// UINT8 S_bits(dsp56k_core* cpustate) { return (SR & 0x0c00) >> 10; } -UINT8 I_bits(dsp56k_core* cpustate) { return (SR & 0x0300) >> 8; } -UINT8 S_bit (dsp56k_core* cpustate) { return (SR & 0x0080) >> 7; } -UINT8 L_bit (dsp56k_core* cpustate) { return (SR & 0x0040) >> 6; } -UINT8 E_bit (dsp56k_core* cpustate) { return (SR & 0x0020) >> 5; } -UINT8 U_bit (dsp56k_core* cpustate) { return (SR & 0x0010) >> 4; } -UINT8 N_bit (dsp56k_core* cpustate) { return (SR & 0x0008) >> 3; } -UINT8 Z_bit (dsp56k_core* cpustate) { return (SR & 0x0004) >> 2; } -UINT8 V_bit (dsp56k_core* cpustate) { return (SR & 0x0002) >> 1; } -UINT8 C_bit (dsp56k_core* cpustate) { return (SR & 0x0001) >> 0; } +UINT8 LF_bit(const dsp56k_core* cpustate) { return (SR & 0x8000) >> 15; } +UINT8 FV_bit(const dsp56k_core* cpustate) { return (SR & 0x4000) >> 14; } +// UINT8 S_bits(const dsp56k_core* cpustate) { return (SR & 0x0c00) >> 10; } +UINT8 I_bits(const dsp56k_core* cpustate) { return (SR & 0x0300) >> 8; } +UINT8 S_bit (const dsp56k_core* cpustate) { return (SR & 0x0080) >> 7; } +UINT8 L_bit (const dsp56k_core* cpustate) { return (SR & 0x0040) >> 6; } +UINT8 E_bit (const dsp56k_core* cpustate) { return (SR & 0x0020) >> 5; } +UINT8 U_bit (const dsp56k_core* cpustate) { return (SR & 0x0010) >> 4; } +UINT8 N_bit (const dsp56k_core* cpustate) { return (SR & 0x0008) >> 3; } +UINT8 Z_bit (const dsp56k_core* cpustate) { return (SR & 0x0004) >> 2; } +UINT8 V_bit (const dsp56k_core* cpustate) { return (SR & 0x0002) >> 1; } +UINT8 C_bit (const dsp56k_core* cpustate) { return (SR & 0x0001) >> 0; } /* MR setters */ void LF_bit_set(dsp56k_core* cpustate, UINT8 value) { if (value) (SR |= 0x8000); else (SR &= (~0x8000)); } @@ -54,13 +54,13 @@ void C_bit_set(dsp56k_core* cpustate, UINT8 value) { if (value) (SR |= 0x0001); /* |---------------------------------------------------------------------| */ /* */ /* ************************************************************************* */ -// UINT8 CD_bit(dsp56k_core* cpustate) { return ((OMR & 0x0080) != 0); } -// UINT8 SD_bit(dsp56k_core* cpustate) { return ((OMR & 0x0040) != 0); } -// UINT8 R_bit(dsp56k_core* cpustate) { return ((OMR & 0x0020) != 0); } -// UINT8 SA_bit(dsp56k_core* cpustate) { return ((OMR & 0x0010) != 0); } -// UINT8 MC_bit(dsp56k_core* cpustate) { return ((OMR & 0x0004) != 0); } -UINT8 MB_bit(dsp56k_core* cpustate) { return ((OMR & 0x0002) != 0); } -UINT8 MA_bit(dsp56k_core* cpustate) { return ((OMR & 0x0001) != 0); } +// UINT8 CD_bit(const dsp56k_core* cpustate) { return ((OMR & 0x0080) != 0); } +// UINT8 SD_bit(const dsp56k_core* cpustate) { return ((OMR & 0x0040) != 0); } +// UINT8 R_bit(const dsp56k_core* cpustate) { return ((OMR & 0x0020) != 0); } +// UINT8 SA_bit(const dsp56k_core* cpustate) { return ((OMR & 0x0010) != 0); } +// UINT8 MC_bit(const dsp56k_core* cpustate) { return ((OMR & 0x0004) != 0); } +UINT8 MB_bit(const dsp56k_core* cpustate) { return ((OMR & 0x0002) != 0); } +UINT8 MA_bit(const dsp56k_core* cpustate) { return ((OMR & 0x0001) != 0); } void CD_bit_set(dsp56k_core* cpustate, UINT8 value) { if (value) (OMR |= 0x0080); else (OMR &= (~0x0080)); } void SD_bit_set(dsp56k_core* cpustate, UINT8 value) { if (value) (OMR |= 0x0040); else (OMR &= (~0x0040)); } @@ -70,7 +70,7 @@ void MC_bit_set(dsp56k_core* cpustate, UINT8 value) { if (value) (OMR |= 0x0004) void MB_bit_set(dsp56k_core* cpustate, UINT8 value) { if (value) (OMR |= 0x0002); else (OMR &= (~0x0002)); } void MA_bit_set(dsp56k_core* cpustate, UINT8 value) { if (value) (OMR |= 0x0001); else (OMR &= (~0x0001)); } -UINT8 dsp56k_operating_mode(dsp56k_core* cpustate) +UINT8 dsp56k_operating_mode(const dsp56k_core* cpustate) { return ((MB_bit(cpustate) << 1) | MA_bit(cpustate)); } @@ -86,8 +86,8 @@ UINT8 dsp56k_operating_mode(dsp56k_core* cpustate) /* |---------------------------------------------------------------------| */ /* */ /* ************************************************************************* */ -UINT8 UF_bit(dsp56k_core* cpustate) { return ((SP & 0x0020) != 0); } -UINT8 SE_bit(dsp56k_core* cpustate) { return ((SP & 0x0010) != 0); } +UINT8 UF_bit(const dsp56k_core* cpustate) { return ((SP & 0x0020) != 0); } +UINT8 SE_bit(const dsp56k_core* cpustate) { return ((SP & 0x0010) != 0); } //void UF_bit_set(dsp56k_core* cpustate, UINT8 value) {}; //void SE_bit_set(dsp56k_core* cpustate, UINT8 value) {}; diff --git a/src/devices/cpu/dsp56k/dsp56pcu.h b/src/devices/cpu/dsp56k/dsp56pcu.h index 7463ac11d35..b3b83109a35 100644 --- a/src/devices/cpu/dsp56k/dsp56pcu.h +++ b/src/devices/cpu/dsp56k/dsp56pcu.h @@ -42,28 +42,28 @@ void pcu_init(dsp56k_core* cpustate, device_t *device); /* STATUS REGISTER (SR) BITS (1-25) */ /* MR */ -UINT8 LF_bit(dsp56k_core* cpustate); -UINT8 FV_bit(dsp56k_core* cpustate); -//UINT8 S_bits(dsp56k_core* cpustate); -UINT8 I_bits(dsp56k_core* cpustate); +UINT8 LF_bit(const dsp56k_core* cpustate); +UINT8 FV_bit(const dsp56k_core* cpustate); +//UINT8 S_bits(const dsp56k_core* cpustate); +UINT8 I_bits(const dsp56k_core* cpustate); /* CCR - with macros for easy access */ #define S() (S_bit(cpustate)) -UINT8 S_bit(dsp56k_core* cpustate); +UINT8 S_bit(const dsp56k_core* cpustate); #define L() (L_bit(cpustate)) -UINT8 L_bit(dsp56k_core* cpustate); +UINT8 L_bit(const dsp56k_core* cpustate); #define E() (E_bit(cpustate)) -UINT8 E_bit(dsp56k_core* cpustate); +UINT8 E_bit(const dsp56k_core* cpustate); #define U() (U_bit(cpustate)) -UINT8 U_bit(dsp56k_core* cpustate); +UINT8 U_bit(const dsp56k_core* cpustate); #define N() (N_bit(cpustate)) -UINT8 N_bit(dsp56k_core* cpustate); +UINT8 N_bit(const dsp56k_core* cpustate); #define Z() (Z_bit(cpustate)) -UINT8 Z_bit(dsp56k_core* cpustate); +UINT8 Z_bit(const dsp56k_core* cpustate); #define V() (V_bit(cpustate)) -UINT8 V_bit(dsp56k_core* cpustate); +UINT8 V_bit(const dsp56k_core* cpustate); #define C() (C_bit(cpustate)) -UINT8 C_bit(dsp56k_core* cpustate); +UINT8 C_bit(const dsp56k_core* cpustate); /* MR setters */ void LF_bit_set(dsp56k_core* cpustate, UINT8 value); @@ -101,13 +101,13 @@ void C_bit_set(dsp56k_core* cpustate, UINT8 value); /* 1-28 OPERATING MODE REGISTER (OMR) BITS */ -//UINT8 CD_bit(dsp56k_core* cpustate); -//UINT8 SD_bit(dsp56k_core* cpustate); -//UINT8 R_bit(dsp56k_core* cpustate); -//UINT8 SA_bit(dsp56k_core* cpustate); -//UINT8 MC_bit(dsp56k_core* cpustate); -UINT8 MB_bit(dsp56k_core* cpustate); -UINT8 MA_bit(dsp56k_core* cpustate); +//UINT8 CD_bit(const dsp56k_core* cpustate); +//UINT8 SD_bit(const dsp56k_core* cpustate); +//UINT8 R_bit(const dsp56k_core* cpustate); +//UINT8 SA_bit(const dsp56k_core* cpustate); +//UINT8 MC_bit(const dsp56k_core* cpustate); +UINT8 MB_bit(const dsp56k_core* cpustate); +UINT8 MA_bit(const dsp56k_core* cpustate); void CD_bit_set(dsp56k_core* cpustate, UINT8 value); void SD_bit_set(dsp56k_core* cpustate, UINT8 value); @@ -118,8 +118,8 @@ void MB_bit_set(dsp56k_core* cpustate, UINT8 value); void MA_bit_set(dsp56k_core* cpustate, UINT8 value); /* 1-27 STACK POINTER (SP) BITS */ -UINT8 UF_bit(dsp56k_core* cpustate); -UINT8 SE_bit(dsp56k_core* cpustate); +UINT8 UF_bit(const dsp56k_core* cpustate); +UINT8 SE_bit(const dsp56k_core* cpustate); //void UF_bit_set(dsp56k_core* cpustate, UINT8 value) {}; //void SE_bit_set(dsp56k_core* cpustate, UINT8 value) {}; diff --git a/src/devices/cpu/e0c6200/e0c6200.cpp b/src/devices/cpu/e0c6200/e0c6200.cpp index e0b6a2eb8d2..0b87b9eaa7d 100644 --- a/src/devices/cpu/e0c6200/e0c6200.cpp +++ b/src/devices/cpu/e0c6200/e0c6200.cpp @@ -25,7 +25,7 @@ // disasm -void e0c6200_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void e0c6200_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/e0c6200/e0c6200.h b/src/devices/cpu/e0c6200/e0c6200.h index c55aae83505..7e47f817380 100644 --- a/src/devices/cpu/e0c6200/e0c6200.h +++ b/src/devices/cpu/e0c6200/e0c6200.h @@ -44,7 +44,7 @@ protected: virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } virtual UINT32 disasm_max_opcode_bytes() const override { return 2; } virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; address_space_config m_program_config; address_space_config m_data_config; diff --git a/src/devices/cpu/e132xs/e132xs.cpp b/src/devices/cpu/e132xs/e132xs.cpp index 95622ee095a..afa0da8d962 100644 --- a/src/devices/cpu/e132xs/e132xs.cpp +++ b/src/devices/cpu/e132xs/e132xs.cpp @@ -1848,7 +1848,7 @@ const address_space_config *hyperstone_device::memory_space_config(address_space // for the debugger //------------------------------------------------- -void hyperstone_device::state_string_export(const device_state_entry &entry, std::string &str) +void hyperstone_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/e132xs/e132xs.h b/src/devices/cpu/e132xs/e132xs.h index 719c139ae84..28149e1a742 100644 --- a/src/devices/cpu/e132xs/e132xs.h +++ b/src/devices/cpu/e132xs/e132xs.h @@ -241,7 +241,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // address spaces const address_space_config m_program_config; diff --git a/src/devices/cpu/esrip/esrip.cpp b/src/devices/cpu/esrip/esrip.cpp index 4a1b27b62de..a788c2a3ab3 100644 --- a/src/devices/cpu/esrip/esrip.cpp +++ b/src/devices/cpu/esrip/esrip.cpp @@ -350,7 +350,7 @@ const address_space_config *esrip_device::memory_space_config(address_spacenum s // for the debugger //------------------------------------------------- -void esrip_device::state_string_export(const device_state_entry &entry, std::string &str) +void esrip_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { @@ -408,13 +408,13 @@ offs_t esrip_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *op PRIVATE FUNCTIONS ***************************************************************************/ -int esrip_device::get_hblank() +int esrip_device::get_hblank() const { return machine().first_screen()->hblank(); } /* Return the state of the LBRM line (Y-scaling related) */ -int esrip_device::get_lbrm() +int esrip_device::get_lbrm() const { int addr = ((m_y_scale & 0x3f) << 3) | ((m_line_latch >> 3) & 7); int sel = (m_line_latch & 7); @@ -424,7 +424,7 @@ int esrip_device::get_lbrm() return (val >> sel) & 1; } -int esrip_device::check_jmp(UINT8 jmp_ctrl) +int esrip_device::check_jmp(UINT8 jmp_ctrl) const { int ret = 0; diff --git a/src/devices/cpu/esrip/esrip.h b/src/devices/cpu/esrip/esrip.h index 468139701f6..852ce65533e 100644 --- a/src/devices/cpu/esrip/esrip.h +++ b/src/devices/cpu/esrip/esrip.h @@ -152,7 +152,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // address spaces const address_space_config m_program_config; @@ -223,9 +223,9 @@ protected: static const ophandler s_opcodetable[24]; private: - int get_hblank(); - int get_lbrm(); - int check_jmp(UINT8 jmp_ctrl); + int get_hblank() const; + int get_lbrm() const; + int check_jmp(UINT8 jmp_ctrl) const; // flags void calc_z_flag(UINT16 res); diff --git a/src/devices/cpu/f8/f8.cpp b/src/devices/cpu/f8/f8.cpp index 182638543d7..2bc875e12ee 100644 --- a/src/devices/cpu/f8/f8.cpp +++ b/src/devices/cpu/f8/f8.cpp @@ -2045,7 +2045,7 @@ void f8_cpu_device::device_start() } -void f8_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void f8_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/f8/f8.h b/src/devices/cpu/f8/f8.h index 277383c4fec..8afddae22bd 100644 --- a/src/devices/cpu/f8/f8.h +++ b/src/devices/cpu/f8/f8.h @@ -51,7 +51,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/g65816/g65816.cpp b/src/devices/cpu/g65816/g65816.cpp index 8373ddbeecf..47b0e035798 100644 --- a/src/devices/cpu/g65816/g65816.cpp +++ b/src/devices/cpu/g65816/g65816.cpp @@ -952,7 +952,7 @@ void g65816_device::state_export(const device_state_entry &entry) } } -void g65816_device::state_string_export(const device_state_entry &entry, std::string &str) +void g65816_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/g65816/g65816.h b/src/devices/cpu/g65816/g65816.h index 54294ad4f74..c04b9adf71c 100644 --- a/src/devices/cpu/g65816/g65816.h +++ b/src/devices/cpu/g65816/g65816.h @@ -82,7 +82,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/h6280/h6280.cpp b/src/devices/cpu/h6280/h6280.cpp index d1be228e732..ec0b62b5076 100644 --- a/src/devices/cpu/h6280/h6280.cpp +++ b/src/devices/cpu/h6280/h6280.cpp @@ -2191,7 +2191,7 @@ OP(op,ff) { h6280_cycles(4); bbs(7, rd_zpg()); } // 6/8 BBS7 ZPG,REL // for the debugger //------------------------------------------------- -void h6280_device::state_string_export(const device_state_entry &entry, std::string &str) +void h6280_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/h6280/h6280.h b/src/devices/cpu/h6280/h6280.h index a344f6392be..ecf93dee843 100644 --- a/src/devices/cpu/h6280/h6280.h +++ b/src/devices/cpu/h6280/h6280.h @@ -98,7 +98,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // opcode accessors UINT8 program_read8(offs_t addr); diff --git a/src/devices/cpu/h8/h8.cpp b/src/devices/cpu/h8/h8.cpp index 2692dc4372c..bc78626b00b 100644 --- a/src/devices/cpu/h8/h8.cpp +++ b/src/devices/cpu/h8/h8.cpp @@ -216,7 +216,7 @@ void h8_device::state_export(const device_state_entry &entry) { } -void h8_device::state_string_export(const device_state_entry &entry, std::string &str) +void h8_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch(entry.index()) { case STATE_GENFLAGS: diff --git a/src/devices/cpu/h8/h8.h b/src/devices/cpu/h8/h8.h index d55d8ea7784..8ed2bee2796 100644 --- a/src/devices/cpu/h8/h8.h +++ b/src/devices/cpu/h8/h8.h @@ -157,7 +157,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/hcd62121/hcd62121.cpp b/src/devices/cpu/hcd62121/hcd62121.cpp index 692297048c0..e6104627990 100644 --- a/src/devices/cpu/hcd62121/hcd62121.cpp +++ b/src/devices/cpu/hcd62121/hcd62121.cpp @@ -363,7 +363,7 @@ void hcd62121_cpu_device::device_start() } -void hcd62121_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void hcd62121_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/hcd62121/hcd62121.h b/src/devices/cpu/hcd62121/hcd62121.h index dc1c7477409..2339f2229c3 100644 --- a/src/devices/cpu/hcd62121/hcd62121.h +++ b/src/devices/cpu/hcd62121/hcd62121.h @@ -54,7 +54,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/hd61700/hd61700.cpp b/src/devices/cpu/hd61700/hd61700.cpp index 3d08c23473e..c786c7235ba 100644 --- a/src/devices/cpu/hd61700/hd61700.cpp +++ b/src/devices/cpu/hd61700/hd61700.cpp @@ -183,8 +183,7 @@ void hd61700_cpu_device::device_start() for (int ireg=0; ireg<32; ireg++) { - std::string tmpstr; - state_add(HD61700_MAINREG + ireg, strformat(tmpstr, "R%d", ireg).c_str(), m_regmain[ireg]).callimport().callexport().formatstr("%02X"); + state_add(HD61700_MAINREG + ireg, strformat("R%d", ireg).c_str(), m_regmain[ireg]).callimport().callexport().formatstr("%02X"); } state_add(STATE_GENPC, "curpc", m_curpc).callimport().callexport().formatstr("%8s").noshow(); @@ -271,7 +270,7 @@ void hd61700_cpu_device::state_import(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void hd61700_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void hd61700_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/hd61700/hd61700.h b/src/devices/cpu/hd61700/hd61700.h index 6f99aeca899..838ea8833bb 100644 --- a/src/devices/cpu/hd61700/hd61700.h +++ b/src/devices/cpu/hd61700/hd61700.h @@ -92,7 +92,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_memory_interface overrides virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } diff --git a/src/devices/cpu/hmcs40/hmcs40.cpp b/src/devices/cpu/hmcs40/hmcs40.cpp index c9b7220cf2a..58cd711f8da 100644 --- a/src/devices/cpu/hmcs40/hmcs40.cpp +++ b/src/devices/cpu/hmcs40/hmcs40.cpp @@ -133,7 +133,7 @@ hd44828_device::hd44828_device(const machine_config &mconfig, const char *tag, d // disasm -void hmcs40_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void hmcs40_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/hmcs40/hmcs40.h b/src/devices/cpu/hmcs40/hmcs40.h index a06d3848cbc..d9e30a92f72 100644 --- a/src/devices/cpu/hmcs40/hmcs40.h +++ b/src/devices/cpu/hmcs40/hmcs40.h @@ -175,7 +175,7 @@ protected: virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } virtual UINT32 disasm_max_opcode_bytes() const override { return 2; } virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; address_space_config m_program_config; address_space_config m_data_config; diff --git a/src/devices/cpu/hphybrid/hphybrid.cpp b/src/devices/cpu/hphybrid/hphybrid.cpp index 22bc74eea08..3d9c9631c5d 100644 --- a/src/devices/cpu/hphybrid/hphybrid.cpp +++ b/src/devices/cpu/hphybrid/hphybrid.cpp @@ -616,15 +616,15 @@ UINT16 hp_hybrid_cpu_device::execute_one_sub(UINT16 opcode) return m_reg_P + 1; } -void hp_hybrid_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void hp_hybrid_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { - if (entry.index() == STATE_GENFLAGS) { - strprintf(str, "%s %s %c %c", - BIT(m_flags , HPHYBRID_DB_BIT) ? "Db":"..", - BIT(m_flags , HPHYBRID_CB_BIT) ? "Cb":"..", - BIT(m_flags , HPHYBRID_O_BIT) ? 'O':'.', - BIT(m_flags , HPHYBRID_C_BIT) ? 'E':'.'); - } + if (entry.index() == STATE_GENFLAGS) { + strprintf(str, "%s %s %c %c", + BIT(m_flags , HPHYBRID_DB_BIT) ? "Db":"..", + BIT(m_flags , HPHYBRID_CB_BIT) ? "Cb":"..", + BIT(m_flags , HPHYBRID_O_BIT) ? 'O':'.', + BIT(m_flags , HPHYBRID_C_BIT) ? 'E':'.'); + } } offs_t hp_hybrid_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) diff --git a/src/devices/cpu/hphybrid/hphybrid.h b/src/devices/cpu/hphybrid/hphybrid.h index 10060d751f6..8baeeb66c1d 100644 --- a/src/devices/cpu/hphybrid/hphybrid.h +++ b/src/devices/cpu/hphybrid/hphybrid.h @@ -112,7 +112,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp index 5ce7fdb4f4e..f0d57ada9a0 100644 --- a/src/devices/cpu/i386/i386.cpp +++ b/src/devices/cpu/i386/i386.cpp @@ -275,7 +275,7 @@ UINT32 i386_device::i386_get_stack_ptr(UINT8 privilege) return ret; } -UINT32 i386_device::get_flags() +UINT32 i386_device::get_flags() const { UINT32 f = 0x2; f |= m_CF; @@ -3465,7 +3465,7 @@ void i386_device::state_export(const device_state_entry &entry) } } -void i386_device::state_string_export(const device_state_entry &entry, std::string &str) +void i386_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/i386/i386.h b/src/devices/cpu/i386/i386.h index ed2cf432ee3..c9ef38b4280 100644 --- a/src/devices/cpu/i386/i386.h +++ b/src/devices/cpu/i386/i386.h @@ -59,7 +59,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } @@ -362,7 +362,7 @@ struct I386_CALL_GATE void i386_load_segment_descriptor(int segment ); UINT32 i386_get_stack_segment(UINT8 privilege); UINT32 i386_get_stack_ptr(UINT8 privilege); - UINT32 get_flags(); + UINT32 get_flags() const; void set_flags(UINT32 f ); void sib_byte(UINT8 mod, UINT32* out_ea, UINT8* out_segment); void modrm_to_EA(UINT8 mod_rm, UINT32* out_ea, UINT8* out_segment); diff --git a/src/devices/cpu/i4004/i4004.cpp b/src/devices/cpu/i4004/i4004.cpp index 51258268e8a..d4ba8891260 100644 --- a/src/devices/cpu/i4004/i4004.cpp +++ b/src/devices/cpu/i4004/i4004.cpp @@ -419,15 +419,14 @@ void i4004_cpu_device::device_start() state_add(STATE_GENFLAGS, "GENFLAGS", m_flags).mask(0x0f).callimport().callexport().noshow().formatstr("%4s"); state_add(I4004_A, "A", m_A).mask(0x0f); - std::string tempstr; for (int regnum = 0; regnum < 8; regnum++) { - state_add(I4004_R01 + regnum, strformat(tempstr, "R%X%X", regnum * 2, regnum * 2 + 1).c_str(), m_R[regnum]); + state_add(I4004_R01 + regnum, strformat("R%X%X", regnum * 2, regnum * 2 + 1).c_str(), m_R[regnum]); } for (int addrnum = 0; addrnum < 4; addrnum++) { - state_add(I4004_ADDR1 + addrnum, strformat(tempstr, "ADDR%d", addrnum + 1).c_str(), m_ADDR[addrnum].w.l).mask(0xfff); + state_add(I4004_ADDR1 + addrnum, strformat("ADDR%d", addrnum + 1).c_str(), m_ADDR[addrnum].w.l).mask(0xfff); } state_add(I4004_RAM, "RAM", m_RAM.w.l).mask(0x0fff); @@ -507,7 +506,7 @@ void i4004_cpu_device::state_export(const device_state_entry &entry) } } -void i4004_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void i4004_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/i4004/i4004.h b/src/devices/cpu/i4004/i4004.h index 3bdc7cddcfd..fd60a9a5d10 100644 --- a/src/devices/cpu/i4004/i4004.h +++ b/src/devices/cpu/i4004/i4004.h @@ -57,7 +57,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/i8008/i8008.cpp b/src/devices/cpu/i8008/i8008.cpp index 319e6ccd56b..6baeacfe7bb 100644 --- a/src/devices/cpu/i8008/i8008.cpp +++ b/src/devices/cpu/i8008/i8008.cpp @@ -92,9 +92,8 @@ void i8008_device::device_start() state_add(I8008_H, "H", m_H); state_add(I8008_L, "L", m_L); - std::string tempstr; for (int addrnum = 0; addrnum < 8; addrnum++) - state_add(I8008_ADDR1 + addrnum, strformat(tempstr, "ADDR%d", addrnum + 1).c_str(), m_ADDR[addrnum].w.l).mask(0xfff); + state_add(I8008_ADDR1 + addrnum, strformat("ADDR%d", addrnum + 1).c_str(), m_ADDR[addrnum].w.l).mask(0xfff); init_tables(); } @@ -187,7 +186,7 @@ void i8008_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void i8008_device::state_string_export(const device_state_entry &entry, std::string &str) +void i8008_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/i8008/i8008.h b/src/devices/cpu/i8008/i8008.h index 35b9c0b41ad..74c727290eb 100644 --- a/src/devices/cpu/i8008/i8008.h +++ b/src/devices/cpu/i8008/i8008.h @@ -48,7 +48,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides diff --git a/src/devices/cpu/i8085/i8085.cpp b/src/devices/cpu/i8085/i8085.cpp index 55daea22fee..308de09e4a1 100644 --- a/src/devices/cpu/i8085/i8085.cpp +++ b/src/devices/cpu/i8085/i8085.cpp @@ -1048,7 +1048,7 @@ void i8085a_cpu_device::state_export(const device_state_entry &entry) } } -void i8085a_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void i8085a_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/i8085/i8085.h b/src/devices/cpu/i8085/i8085.h index 59d630393db..9a866577ca6 100644 --- a/src/devices/cpu/i8085/i8085.h +++ b/src/devices/cpu/i8085/i8085.h @@ -85,9 +85,9 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; - void state_export(const device_state_entry &entry) override; - void state_import(const device_state_entry &entry) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; + virtual void state_export(const device_state_entry &entry) override; + virtual void state_import(const device_state_entry &entry) override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/i8089/i8089.cpp b/src/devices/cpu/i8089/i8089.cpp index f3772286f6f..22494cfdd2f 100644 --- a/src/devices/cpu/i8089/i8089.cpp +++ b/src/devices/cpu/i8089/i8089.cpp @@ -158,9 +158,9 @@ offs_t i8089_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *op // for the debugger //------------------------------------------------- -void i8089_device::state_string_export(const device_state_entry &entry, std::string &str) +void i8089_device::state_string_export(const device_state_entry &entry, std::string &str) const { - i8089_channel *ch = m_ch1; + const i8089_channel *ch = m_ch1; if (entry.index() >= CH2_GA && entry.index() <= CH2_PSW) ch = m_ch2; diff --git a/src/devices/cpu/i8089/i8089.h b/src/devices/cpu/i8089/i8089.h index 66477c4e6c3..e4100b8fa94 100644 --- a/src/devices/cpu/i8089/i8089.h +++ b/src/devices/cpu/i8089/i8089.h @@ -88,15 +88,15 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // optional information overrides virtual machine_config_constructor device_mconfig_additions() const override; private: - bool sysbus_width() { return BIT(m_sysbus, 0); } - bool remotebus_width() { return BIT(m_soc, 0); } - bool request_grant() { return BIT(m_soc, 1); } + bool sysbus_width() const { return BIT(m_sysbus, 0); } + bool remotebus_width() const { return BIT(m_soc, 0); } + bool request_grant() const { return BIT(m_soc, 1); } UINT8 read_byte(bool space, offs_t address); UINT16 read_word(bool space, offs_t address); diff --git a/src/devices/cpu/i86/i286.cpp b/src/devices/cpu/i86/i286.cpp index 819ce92f69d..9f79007506a 100644 --- a/src/devices/cpu/i86/i286.cpp +++ b/src/devices/cpu/i86/i286.cpp @@ -277,12 +277,12 @@ void i80286_cpu_device::device_start() m_out_shutdown_func.resolve_safe(); } -void i80286_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void i80286_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { case STATE_GENPC: - strprintf(str, "%08X", pc()); + strprintf(str, "%08X", m_base[CS] + m_ip); break; case STATE_GENFLAGS: diff --git a/src/devices/cpu/i86/i286.h b/src/devices/cpu/i86/i286.h index 62ee771ac0a..8df1bf43d94 100644 --- a/src/devices/cpu/i86/i286.h +++ b/src/devices/cpu/i86/i286.h @@ -77,7 +77,7 @@ protected: virtual void execute_run() override; virtual void device_reset() override; virtual void device_start() override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; virtual UINT32 execute_input_lines() const override { return 1; } virtual void execute_set_input(int inputnum, int state) override; bool memory_translate(address_spacenum spacenum, int intention, offs_t &address) override; diff --git a/src/devices/cpu/i86/i86.cpp b/src/devices/cpu/i86/i86.cpp index 70af764f1a2..cffe2793516 100644 --- a/src/devices/cpu/i86/i86.cpp +++ b/src/devices/cpu/i86/i86.cpp @@ -314,12 +314,12 @@ i8086_common_cpu_device::i8086_common_cpu_device(const machine_config &mconfig, memset(m_sregs, 0x00, sizeof(m_sregs)); } -void i8086_common_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void i8086_common_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { case STATE_GENPC: - strprintf(str, "%08X", pc()); + strprintf(str, "%08X", (m_sregs[CS] << 4) + m_ip); break; case STATE_GENFLAGS: diff --git a/src/devices/cpu/i86/i86.h b/src/devices/cpu/i86/i86.h index a142d6672f2..978fa7d1690 100644 --- a/src/devices/cpu/i86/i86.h +++ b/src/devices/cpu/i86/i86.h @@ -127,7 +127,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; virtual void interrupt(int int_num, int trap = 1); bool common_op(UINT8 op); @@ -192,7 +192,7 @@ protected: inline void set_OFB_Add(UINT32 x,UINT32 y,UINT32 z); inline void set_OFW_Sub(UINT32 x,UINT32 y,UINT32 z); inline void set_OFB_Sub(UINT32 x,UINT32 y,UINT32 z); - inline UINT16 CompressFlags(); + inline UINT16 CompressFlags() const; inline void ExpandFlags(UINT16 f); // rep instructions diff --git a/src/devices/cpu/i86/i86inline.h b/src/devices/cpu/i86/i86inline.h index d848e336e35..8a9ad703fec 100644 --- a/src/devices/cpu/i86/i86inline.h +++ b/src/devices/cpu/i86/i86inline.h @@ -504,7 +504,7 @@ inline void i8086_common_cpu_device::set_OFB_Sub(UINT32 x,UINT32 y,UINT32 z) } -inline UINT16 i8086_common_cpu_device::CompressFlags() +inline UINT16 i8086_common_cpu_device::CompressFlags() const { return (CF ? 1 : 0) | (1 << 1) diff --git a/src/devices/cpu/i960/i960.cpp b/src/devices/cpu/i960/i960.cpp index d2bb39e709c..224b844387c 100644 --- a/src/devices/cpu/i960/i960.cpp +++ b/src/devices/cpu/i960/i960.cpp @@ -2081,7 +2081,7 @@ void i960_cpu_device::device_start() m_icountptr = &m_icount; } -void i960_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void i960_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { static const char *const conditions[8] = { diff --git a/src/devices/cpu/i960/i960.h b/src/devices/cpu/i960/i960.h index 833ae7d741a..3f26fbb46d1 100644 --- a/src/devices/cpu/i960/i960.h +++ b/src/devices/cpu/i960/i960.h @@ -95,7 +95,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/ie15/ie15.cpp b/src/devices/cpu/ie15/ie15.cpp index 95851497236..87de1cb2217 100644 --- a/src/devices/cpu/ie15/ie15.cpp +++ b/src/devices/cpu/ie15/ie15.cpp @@ -64,9 +64,8 @@ void ie15_device::device_start() state_add(STATE_GENFLAGS,"GENFLAGS", m_flags).mask(0x0f).callimport().callexport().noshow().formatstr("%4s"); state_add(IE15_A, "A", m_A); - std::string tempstring; for (int ireg = 0; ireg < 32; ireg++) - state_add(IE15_R0 + ireg, strformat(tempstring, "R%d", ireg).c_str(), m_REGS[ireg]); + state_add(IE15_R0 + ireg, strformat("R%d", ireg).c_str(), m_REGS[ireg]); } //------------------------------------------------- @@ -133,7 +132,7 @@ void ie15_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void ie15_device::state_string_export(const device_state_entry &entry, std::string &str) +void ie15_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/ie15/ie15.h b/src/devices/cpu/ie15/ie15.h index a68b7acbd15..ce5cb46bf81 100644 --- a/src/devices/cpu/ie15/ie15.h +++ b/src/devices/cpu/ie15/ie15.h @@ -48,7 +48,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/jaguar/jaguar.cpp b/src/devices/cpu/jaguar/jaguar.cpp index 81fcba812bf..000d6375cce 100644 --- a/src/devices/cpu/jaguar/jaguar.cpp +++ b/src/devices/cpu/jaguar/jaguar.cpp @@ -400,7 +400,7 @@ void jaguar_cpu_device::device_start() } -void jaguar_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void jaguar_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/jaguar/jaguar.h b/src/devices/cpu/jaguar/jaguar.h index d2ab5f235e6..cc2e8938961 100644 --- a/src/devices/cpu/jaguar/jaguar.h +++ b/src/devices/cpu/jaguar/jaguar.h @@ -127,7 +127,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/lc8670/lc8670.cpp b/src/devices/cpu/lc8670/lc8670.cpp index a397f8505bb..d24b3f64775 100644 --- a/src/devices/cpu/lc8670/lc8670.cpp +++ b/src/devices/cpu/lc8670/lc8670.cpp @@ -369,7 +369,7 @@ void lc8670_cpu_device::state_import(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void lc8670_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void lc8670_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/lc8670/lc8670.h b/src/devices/cpu/lc8670/lc8670.h index 6d2522dcef4..e6211a4522f 100644 --- a/src/devices/cpu/lc8670/lc8670.h +++ b/src/devices/cpu/lc8670/lc8670.h @@ -110,7 +110,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_memory_interface overrides virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; diff --git a/src/devices/cpu/lh5801/lh5801.cpp b/src/devices/cpu/lh5801/lh5801.cpp index 0287e0d0859..2e748c63905 100644 --- a/src/devices/cpu/lh5801/lh5801.cpp +++ b/src/devices/cpu/lh5801/lh5801.cpp @@ -142,7 +142,7 @@ void lh5801_cpu_device::device_start() m_icountptr = &m_icount; } -void lh5801_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void lh5801_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/lh5801/lh5801.h b/src/devices/cpu/lh5801/lh5801.h index ff47135b262..fe6f3c44f63 100644 --- a/src/devices/cpu/lh5801/lh5801.h +++ b/src/devices/cpu/lh5801/lh5801.h @@ -90,7 +90,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/lr35902/lr35902.cpp b/src/devices/cpu/lr35902/lr35902.cpp index 02cb785e1ff..8f365c18c54 100644 --- a/src/devices/cpu/lr35902/lr35902.cpp +++ b/src/devices/cpu/lr35902/lr35902.cpp @@ -180,7 +180,7 @@ void lr35902_cpu_device::device_start() } -void lr35902_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void lr35902_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/lr35902/lr35902.h b/src/devices/cpu/lr35902/lr35902.h index 0a9999ba10c..74ad24d07f8 100644 --- a/src/devices/cpu/lr35902/lr35902.h +++ b/src/devices/cpu/lr35902/lr35902.h @@ -70,7 +70,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/m37710/m37710.cpp b/src/devices/cpu/m37710/m37710.cpp index 26a2accfe76..43568915dce 100644 --- a/src/devices/cpu/m37710/m37710.cpp +++ b/src/devices/cpu/m37710/m37710.cpp @@ -1136,7 +1136,7 @@ void m37710_cpu_device::state_export(const device_state_entry &entry) } -void m37710_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void m37710_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/m37710/m37710.h b/src/devices/cpu/m37710/m37710.h index 1f085da0c1f..e88408e527a 100644 --- a/src/devices/cpu/m37710/m37710.h +++ b/src/devices/cpu/m37710/m37710.h @@ -117,7 +117,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/m6502/m6502.cpp b/src/devices/cpu/m6502/m6502.cpp index eae369f4960..0ecd12258f1 100644 --- a/src/devices/cpu/m6502/m6502.cpp +++ b/src/devices/cpu/m6502/m6502.cpp @@ -439,7 +439,7 @@ void m6502_device::state_export(const device_state_entry &entry) { } -void m6502_device::state_string_export(const device_state_entry &entry, std::string &str) +void m6502_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch(entry.index()) { case STATE_GENFLAGS: diff --git a/src/devices/cpu/m6502/m6502.h b/src/devices/cpu/m6502/m6502.h index 6f5ef092891..b8f8b16a6dd 100644 --- a/src/devices/cpu/m6502/m6502.h +++ b/src/devices/cpu/m6502/m6502.h @@ -144,7 +144,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/m6502/m65ce02.cpp b/src/devices/cpu/m6502/m65ce02.cpp index fdedc99369d..01f6fe34b2f 100644 --- a/src/devices/cpu/m6502/m65ce02.cpp +++ b/src/devices/cpu/m6502/m65ce02.cpp @@ -75,7 +75,7 @@ void m65ce02_device::state_export(const device_state_entry &entry) { } -void m65ce02_device::state_string_export(const device_state_entry &entry, std::string &str) +void m65ce02_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch(entry.index()) { case STATE_GENFLAGS: diff --git a/src/devices/cpu/m6502/m65ce02.h b/src/devices/cpu/m6502/m65ce02.h index 3b5dc800954..d0d457d313c 100644 --- a/src/devices/cpu/m6502/m65ce02.h +++ b/src/devices/cpu/m6502/m65ce02.h @@ -34,7 +34,7 @@ protected: virtual void device_reset() override; virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; inline void dec_SP_ce() { if(P & F_E) SP = set_l(SP, SP-1); else SP--; } inline void inc_SP_ce() { if(P & F_E) SP = set_l(SP, SP+1); else SP++; } diff --git a/src/devices/cpu/m6502/m740.cpp b/src/devices/cpu/m6502/m740.cpp index 4987b26e31a..061f6dd75c7 100644 --- a/src/devices/cpu/m6502/m740.cpp +++ b/src/devices/cpu/m6502/m740.cpp @@ -53,7 +53,7 @@ void m740_device::device_reset() SP = 0x00ff; } -void m740_device::state_string_export(const device_state_entry &entry, std::string &str) +void m740_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch(entry.index()) { case STATE_GENFLAGS: diff --git a/src/devices/cpu/m6502/m740.h b/src/devices/cpu/m6502/m740.h index c08eda19609..7f312b256cd 100644 --- a/src/devices/cpu/m6502/m740.h +++ b/src/devices/cpu/m6502/m740.h @@ -44,7 +44,7 @@ public: static const disasm_entry disasm_entries[0x200]; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; virtual void do_exec_full() override; diff --git a/src/devices/cpu/m6800/m6800.cpp b/src/devices/cpu/m6800/m6800.cpp index 302ba478445..84d3b8d03e2 100644 --- a/src/devices/cpu/m6800/m6800.cpp +++ b/src/devices/cpu/m6800/m6800.cpp @@ -1140,7 +1140,7 @@ void m6800_cpu_device::device_start() m_icountptr = &m_icount; } -void m6800_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void m6800_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/m6800/m6800.h b/src/devices/cpu/m6800/m6800.h index 45c24d2e039..bb6055e8ad0 100644 --- a/src/devices/cpu/m6800/m6800.h +++ b/src/devices/cpu/m6800/m6800.h @@ -87,7 +87,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/m68000/m68000.h b/src/devices/cpu/m68000/m68000.h index 4fb372fdf12..013627ac6c0 100644 --- a/src/devices/cpu/m68000/m68000.h +++ b/src/devices/cpu/m68000/m68000.h @@ -396,7 +396,7 @@ public: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_memory_interface overrides virtual bool memory_translate(address_spacenum space, int intention, offs_t &address) override; diff --git a/src/devices/cpu/m68000/m68kcpu.cpp b/src/devices/cpu/m68000/m68kcpu.cpp index 5b6d2a602bf..dc7e0b14a6f 100644 --- a/src/devices/cpu/m68000/m68kcpu.cpp +++ b/src/devices/cpu/m68000/m68kcpu.cpp @@ -1166,7 +1166,7 @@ void m68000_base_device::state_export(const device_state_entry &entry) } } -void m68000_base_device::state_string_export(const device_state_entry &entry, std::string &str) +void m68000_base_device::state_string_export(const device_state_entry &entry, std::string &str) const { UINT16 sr; @@ -1734,14 +1734,11 @@ void m68000_base_device::define_state(void) if (cpu_type & MASK_020_OR_LATER) state_add(M68K_MSP, "MSP", iotemp).callimport().callexport(); - std::string tempstr; for (int regnum = 0; regnum < 8; regnum++) { - strprintf(tempstr,"D%d", regnum); - state_add(M68K_D0 + regnum, tempstr.c_str(), dar[regnum]); + state_add(M68K_D0 + regnum, strformat("D%d", regnum).c_str(), dar[regnum]); } for (int regnum = 0; regnum < 8; regnum++) { - strprintf(tempstr,"A%d", regnum); - state_add(M68K_A0 + regnum, tempstr.c_str(), dar[8 + regnum]); + state_add(M68K_A0 + regnum, strformat("A%d", regnum).c_str(), dar[8 + regnum]); } state_add(M68K_PREF_ADDR, "PREF_ADDR", pref_addr).mask(addrmask); @@ -1763,8 +1760,7 @@ void m68000_base_device::define_state(void) if (cpu_type & MASK_030_OR_LATER) { for (int regnum = 0; regnum < 8; regnum++) { - strprintf(tempstr,"FP%d", regnum); - state_add(M68K_FP0 + regnum, tempstr.c_str(), iotemp).callimport().callexport().formatstr("%10s"); + state_add(M68K_FP0 + regnum, strformat("FP%d", regnum).c_str(), iotemp).callimport().callexport().formatstr("%10s"); } state_add(M68K_FPSR, "FPSR", fpsr); state_add(M68K_FPCR, "FPCR", fpcr); diff --git a/src/devices/cpu/m6805/m6805.cpp b/src/devices/cpu/m6805/m6805.cpp index d3905118b48..0bb5ac3877e 100644 --- a/src/devices/cpu/m6805/m6805.cpp +++ b/src/devices/cpu/m6805/m6805.cpp @@ -493,7 +493,7 @@ const address_space_config *m6805_base_device::memory_space_config(address_space // for the debugger //------------------------------------------------- -void m6805_base_device::state_string_export(const device_state_entry &entry, std::string &str) +void m6805_base_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/m6805/m6805.h b/src/devices/cpu/m6805/m6805.h index 063fe0f4689..40fd8b3db9b 100644 --- a/src/devices/cpu/m6805/m6805.h +++ b/src/devices/cpu/m6805/m6805.h @@ -51,7 +51,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; private: // opcode/condition tables diff --git a/src/devices/cpu/m6809/m6809.cpp b/src/devices/cpu/m6809/m6809.cpp index 30690ed5db5..61337f180f0 100644 --- a/src/devices/cpu/m6809/m6809.cpp +++ b/src/devices/cpu/m6809/m6809.cpp @@ -302,7 +302,7 @@ const address_space_config *m6809_base_device::memory_space_config(address_space // for the debugger //------------------------------------------------- -void m6809_base_device::state_string_export(const device_state_entry &entry, std::string &str) +void m6809_base_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/m6809/m6809.h b/src/devices/cpu/m6809/m6809.h index 53ca385f81c..a992be78789 100644 --- a/src/devices/cpu/m6809/m6809.h +++ b/src/devices/cpu/m6809/m6809.h @@ -84,7 +84,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // addressing modes enum diff --git a/src/devices/cpu/mb86233/mb86233.cpp b/src/devices/cpu/mb86233/mb86233.cpp index b818924fa15..341309d8c12 100644 --- a/src/devices/cpu/mb86233/mb86233.cpp +++ b/src/devices/cpu/mb86233/mb86233.cpp @@ -161,7 +161,7 @@ void mb86233_cpu_device::device_start() } -void mb86233_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void mb86233_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/mb86233/mb86233.h b/src/devices/cpu/mb86233/mb86233.h index 0d1e3843737..26fc5b3e9f6 100644 --- a/src/devices/cpu/mb86233/mb86233.h +++ b/src/devices/cpu/mb86233/mb86233.h @@ -74,7 +74,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_DATA) ? &m_data_config : nullptr ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/mb86235/mb86235.cpp b/src/devices/cpu/mb86235/mb86235.cpp index c68a66e4e7b..edcc6a0471f 100644 --- a/src/devices/cpu/mb86235/mb86235.cpp +++ b/src/devices/cpu/mb86235/mb86235.cpp @@ -108,7 +108,7 @@ mb86235_cpu_device::mb86235_cpu_device(const machine_config &mconfig, const char } -void mb86235_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void mb86235_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/mb86235/mb86235.h b/src/devices/cpu/mb86235/mb86235.h index 4fdda0030be..35f586c7290 100644 --- a/src/devices/cpu/mb86235/mb86235.h +++ b/src/devices/cpu/mb86235/mb86235.h @@ -42,7 +42,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 8; } diff --git a/src/devices/cpu/mb88xx/mb88xx.cpp b/src/devices/cpu/mb88xx/mb88xx.cpp index 5d8ca5f7e09..9ab07538e6e 100644 --- a/src/devices/cpu/mb88xx/mb88xx.cpp +++ b/src/devices/cpu/mb88xx/mb88xx.cpp @@ -269,7 +269,7 @@ void mb88_cpu_device::state_export(const device_state_entry &entry) } -void mb88_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void mb88_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/mb88xx/mb88xx.h b/src/devices/cpu/mb88xx/mb88xx.h index 8a9e555d968..6dc4252f706 100644 --- a/src/devices/cpu/mb88xx/mb88xx.h +++ b/src/devices/cpu/mb88xx/mb88xx.h @@ -90,9 +90,9 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_DATA) ? &m_data_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr ) ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; - void state_import(const device_state_entry &entry) override; - void state_export(const device_state_entry &entry) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; + virtual void state_import(const device_state_entry &entry) override; + virtual void state_export(const device_state_entry &entry) override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/mc68hc11/mc68hc11.cpp b/src/devices/cpu/mc68hc11/mc68hc11.cpp index f05d9126334..a208a618c4b 100644 --- a/src/devices/cpu/mc68hc11/mc68hc11.cpp +++ b/src/devices/cpu/mc68hc11/mc68hc11.cpp @@ -448,7 +448,7 @@ void mc68hc11_cpu_device::device_start() } -void mc68hc11_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void mc68hc11_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/mc68hc11/mc68hc11.h b/src/devices/cpu/mc68hc11/mc68hc11.h index 3f76577b29c..047a1f559e2 100644 --- a/src/devices/cpu/mc68hc11/mc68hc11.h +++ b/src/devices/cpu/mc68hc11/mc68hc11.h @@ -70,7 +70,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/mcs48/mcs48.cpp b/src/devices/cpu/mcs48/mcs48.cpp index 0f7a72f0f89..b49899ca498 100644 --- a/src/devices/cpu/mcs48/mcs48.cpp +++ b/src/devices/cpu/mcs48/mcs48.cpp @@ -978,10 +978,8 @@ void mcs48_cpu_device::device_start() state_add(MCS48_P1, "P1", m_p1); state_add(MCS48_P2, "P2", m_p2); - std::string tempstr; for (int regnum = 0; regnum < 8; regnum++) { - strprintf(tempstr, "R%d", regnum); - state_add(MCS48_R0 + regnum, tempstr.c_str(), m_rtemp).callimport().callexport(); + state_add(MCS48_R0 + regnum, strformat("R%d", regnum).c_str(), m_rtemp).callimport().callexport(); } state_add(MCS48_EA, "EA", m_ea).mask(0x1); @@ -1298,7 +1296,7 @@ void mcs48_cpu_device::state_export(const device_state_entry &entry) } } -void mcs48_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void mcs48_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/mcs48/mcs48.h b/src/devices/cpu/mcs48/mcs48.h index ed994d1030e..a916ccd2016 100644 --- a/src/devices/cpu/mcs48/mcs48.h +++ b/src/devices/cpu/mcs48/mcs48.h @@ -152,7 +152,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/mcs51/mcs51.cpp b/src/devices/cpu/mcs51/mcs51.cpp index d77a84a20d0..f3d5816d722 100644 --- a/src/devices/cpu/mcs51/mcs51.cpp +++ b/src/devices/cpu/mcs51/mcs51.cpp @@ -2213,7 +2213,7 @@ void mcs51_cpu_device::state_export(const device_state_entry &entry) } } -void mcs51_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void mcs51_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/mcs51/mcs51.h b/src/devices/cpu/mcs51/mcs51.h index 3babfda9f50..7b769de24ad 100644 --- a/src/devices/cpu/mcs51/mcs51.h +++ b/src/devices/cpu/mcs51/mcs51.h @@ -109,7 +109,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/mcs96/mcs96.cpp b/src/devices/cpu/mcs96/mcs96.cpp index 8c52a8c029d..3c8284f8555 100644 --- a/src/devices/cpu/mcs96/mcs96.cpp +++ b/src/devices/cpu/mcs96/mcs96.cpp @@ -128,7 +128,7 @@ void mcs96_device::state_export(const device_state_entry &entry) { } -void mcs96_device::state_string_export(const device_state_entry &entry, std::string &str) +void mcs96_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch(entry.index()) { case STATE_GENFLAGS: diff --git a/src/devices/cpu/mcs96/mcs96.h b/src/devices/cpu/mcs96/mcs96.h index ed9b64709ec..0111361899c 100644 --- a/src/devices/cpu/mcs96/mcs96.h +++ b/src/devices/cpu/mcs96/mcs96.h @@ -85,7 +85,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/melps4/melps4.cpp b/src/devices/cpu/melps4/melps4.cpp index 7a3653dfe96..d228b42fbee 100644 --- a/src/devices/cpu/melps4/melps4.cpp +++ b/src/devices/cpu/melps4/melps4.cpp @@ -42,7 +42,7 @@ // disasm -void melps4_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void melps4_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/melps4/melps4.h b/src/devices/cpu/melps4/melps4.h index 2d80cfcf8d2..b0aa67fd6d4 100644 --- a/src/devices/cpu/melps4/melps4.h +++ b/src/devices/cpu/melps4/melps4.h @@ -160,7 +160,7 @@ protected: // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } virtual UINT32 disasm_max_opcode_bytes() const override { return 2; } - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; address_space_config m_program_config; address_space_config m_data_config; diff --git a/src/devices/cpu/minx/minx.cpp b/src/devices/cpu/minx/minx.cpp index e822fbd9ecc..bae0338da76 100644 --- a/src/devices/cpu/minx/minx.cpp +++ b/src/devices/cpu/minx/minx.cpp @@ -121,7 +121,7 @@ void minx_cpu_device::device_start() } -void minx_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void minx_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/minx/minx.h b/src/devices/cpu/minx/minx.h index e530b3cf88a..a31db6ab7a0 100644 --- a/src/devices/cpu/minx/minx.h +++ b/src/devices/cpu/minx/minx.h @@ -36,7 +36,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp index 3588db1b888..f4747b7304c 100644 --- a/src/devices/cpu/mips/mips3.cpp +++ b/src/devices/cpu/mips/mips3.cpp @@ -659,7 +659,7 @@ void mips3_device::state_export(const device_state_entry &entry) } -void mips3_device::state_string_export(const device_state_entry &entry, std::string &str) +void mips3_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/mips/mips3.h b/src/devices/cpu/mips/mips3.h index e87f8862f40..9e0de9ed419 100644 --- a/src/devices/cpu/mips/mips3.h +++ b/src/devices/cpu/mips/mips3.h @@ -303,7 +303,7 @@ protected: // device_state_interface overrides virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/mips/r3000.cpp b/src/devices/cpu/mips/r3000.cpp index b53afb83d29..f14c6adc93f 100644 --- a/src/devices/cpu/mips/r3000.cpp +++ b/src/devices/cpu/mips/r3000.cpp @@ -443,7 +443,7 @@ void r3000_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void r3000_device::state_string_export(const device_state_entry &entry, std::string &str) +void r3000_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/mips/r3000.h b/src/devices/cpu/mips/r3000.h index f9063806cde..a7541eaab85 100644 --- a/src/devices/cpu/mips/r3000.h +++ b/src/devices/cpu/mips/r3000.h @@ -126,7 +126,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/mn10200/mn10200.cpp b/src/devices/cpu/mn10200/mn10200.cpp index bf00be5b984..1b4af66e13f 100644 --- a/src/devices/cpu/mn10200/mn10200.cpp +++ b/src/devices/cpu/mn10200/mn10200.cpp @@ -51,7 +51,7 @@ mn1020012a_device::mn1020012a_device(const machine_config &mconfig, const char * // disasm -void mn10200_device::state_string_export(const device_state_entry &entry, std::string &str) +void mn10200_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/mn10200/mn10200.h b/src/devices/cpu/mn10200/mn10200.h index f3dc2dcfee7..38073fb8e27 100644 --- a/src/devices/cpu/mn10200/mn10200.h +++ b/src/devices/cpu/mn10200/mn10200.h @@ -88,7 +88,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/nec/nec.cpp b/src/devices/cpu/nec/nec.cpp index 7b282e2570c..42ef74df7d5 100644 --- a/src/devices/cpu/nec/nec.cpp +++ b/src/devices/cpu/nec/nec.cpp @@ -437,7 +437,7 @@ void nec_common_device::device_start() m_icountptr = &m_icount; } -void nec_common_device::state_string_export(const device_state_entry &entry, std::string &str) +void nec_common_device::state_string_export(const device_state_entry &entry, std::string &str) const { UINT16 flags = CompressFlags(); diff --git a/src/devices/cpu/nec/nec.h b/src/devices/cpu/nec/nec.h index 50a3adc7656..c0c1fa82327 100644 --- a/src/devices/cpu/nec/nec.h +++ b/src/devices/cpu/nec/nec.h @@ -42,7 +42,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; diff --git a/src/devices/cpu/nec/v25.cpp b/src/devices/cpu/nec/v25.cpp index 8612c5f8760..c5e62446cb0 100644 --- a/src/devices/cpu/nec/v25.cpp +++ b/src/devices/cpu/nec/v25.cpp @@ -525,7 +525,7 @@ void v25_common_device::device_start() } -void v25_common_device::state_string_export(const device_state_entry &entry, std::string &str) +void v25_common_device::state_string_export(const device_state_entry &entry, std::string &str) const { UINT16 flags = CompressFlags(); diff --git a/src/devices/cpu/nec/v25.h b/src/devices/cpu/nec/v25.h index 0e996468942..1cd5ab91012 100644 --- a/src/devices/cpu/nec/v25.h +++ b/src/devices/cpu/nec/v25.h @@ -59,7 +59,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; diff --git a/src/devices/cpu/pdp1/pdp1.cpp b/src/devices/cpu/pdp1/pdp1.cpp index b36e7242967..cbb43535d7f 100644 --- a/src/devices/cpu/pdp1/pdp1.cpp +++ b/src/devices/cpu/pdp1/pdp1.cpp @@ -737,7 +737,7 @@ void pdp1_device::state_export(const device_state_entry &entry) } -void pdp1_device::state_string_export(const device_state_entry &entry, std::string &str) +void pdp1_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/pdp1/pdp1.h b/src/devices/cpu/pdp1/pdp1.h index 9f421716366..2cb01f5c20b 100644 --- a/src/devices/cpu/pdp1/pdp1.h +++ b/src/devices/cpu/pdp1/pdp1.h @@ -107,7 +107,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/pdp8/pdp8.cpp b/src/devices/cpu/pdp8/pdp8.cpp index 1ed24effe12..2679c7e9205 100644 --- a/src/devices/cpu/pdp8/pdp8.cpp +++ b/src/devices/cpu/pdp8/pdp8.cpp @@ -72,7 +72,6 @@ void pdp8_device::device_start() m_program = &space(AS_PROGRAM); // register our state for the debugger - std::string tempstr; state_add(STATE_GENPC, "GENPC", m_pc).noshow(); state_add(STATE_GENFLAGS, "GENFLAGS", m_l).callimport().callexport().formatstr("%1s").noshow(); state_add(PDP8_PC, "PC", m_pc).mask(0xfff); @@ -136,7 +135,7 @@ const address_space_config *pdp8_device::memory_space_config(address_spacenum sp // for the debugger //------------------------------------------------- -void pdp8_device::state_string_export(const device_state_entry &entry, std::string &str) +void pdp8_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/pdp8/pdp8.h b/src/devices/cpu/pdp8/pdp8.h index 70393e3f0bf..66f04682d7e 100644 --- a/src/devices/cpu/pdp8/pdp8.h +++ b/src/devices/cpu/pdp8/pdp8.h @@ -45,7 +45,7 @@ public: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // address spaces const address_space_config m_program_config; diff --git a/src/devices/cpu/pic16c5x/pic16c5x.cpp b/src/devices/cpu/pic16c5x/pic16c5x.cpp index 3acd46944f7..c568b27b4c7 100644 --- a/src/devices/cpu/pic16c5x/pic16c5x.cpp +++ b/src/devices/cpu/pic16c5x/pic16c5x.cpp @@ -923,7 +923,7 @@ void pic16c5x_device::state_export(const device_state_entry &entry) } } -void pic16c5x_device::state_string_export(const device_state_entry &entry, std::string &str) +void pic16c5x_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/pic16c5x/pic16c5x.h b/src/devices/cpu/pic16c5x/pic16c5x.h index 0e34f97178f..c3d2480fd86 100644 --- a/src/devices/cpu/pic16c5x/pic16c5x.h +++ b/src/devices/cpu/pic16c5x/pic16c5x.h @@ -117,7 +117,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/pic16c62x/pic16c62x.cpp b/src/devices/cpu/pic16c62x/pic16c62x.cpp index 2bbbd9f3439..9fb6e2324ab 100644 --- a/src/devices/cpu/pic16c62x/pic16c62x.cpp +++ b/src/devices/cpu/pic16c62x/pic16c62x.cpp @@ -990,7 +990,7 @@ void pic16c62x_device::state_export(const device_state_entry &entry) } } -void pic16c62x_device::state_string_export(const device_state_entry &entry, std::string &str) +void pic16c62x_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/pic16c62x/pic16c62x.h b/src/devices/cpu/pic16c62x/pic16c62x.h index 300fc6d77e5..7e8af51ca40 100644 --- a/src/devices/cpu/pic16c62x/pic16c62x.h +++ b/src/devices/cpu/pic16c62x/pic16c62x.h @@ -79,7 +79,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/powerpc/ppc.h b/src/devices/cpu/powerpc/ppc.h index c9b37cbb196..5e40ee88249 100644 --- a/src/devices/cpu/powerpc/ppc.h +++ b/src/devices/cpu/powerpc/ppc.h @@ -264,7 +264,7 @@ protected: // device_state_interface overrides virtual void state_export(const device_state_entry &entry) override; virtual void state_import(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp index 5fc2ea00b9b..9036ff2c794 100644 --- a/src/devices/cpu/powerpc/ppccom.cpp +++ b/src/devices/cpu/powerpc/ppccom.cpp @@ -1007,7 +1007,7 @@ void ppc_device::state_import(const device_state_entry &entry) } -void ppc_device::state_string_export(const device_state_entry &entry, std::string &str) +void ppc_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/pps4/pps4.cpp b/src/devices/cpu/pps4/pps4.cpp index 5be986f2c3d..43c79059d4b 100644 --- a/src/devices/cpu/pps4/pps4.cpp +++ b/src/devices/cpu/pps4/pps4.cpp @@ -1552,7 +1552,7 @@ void pps4_device::device_start() m_icountptr = &m_icount; } -void pps4_device::state_string_export(const device_state_entry &entry, std::string &str) +void pps4_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/pps4/pps4.h b/src/devices/cpu/pps4/pps4.h index 44c9f27d00e..a2797668751 100644 --- a/src/devices/cpu/pps4/pps4.h +++ b/src/devices/cpu/pps4/pps4.h @@ -62,7 +62,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/psx/psx.cpp b/src/devices/cpu/psx/psx.cpp index f98c6fccc8f..c3e2e340d24 100644 --- a/src/devices/cpu/psx/psx.cpp +++ b/src/devices/cpu/psx/psx.cpp @@ -2026,7 +2026,7 @@ void psxcpu_device::state_import( const device_state_entry &entry ) // for the debugger //------------------------------------------------- -void psxcpu_device::state_string_export( const device_state_entry &entry, std::string &str ) +void psxcpu_device::state_string_export( const device_state_entry &entry, std::string &str ) const { switch( entry.index() ) { diff --git a/src/devices/cpu/psx/psx.h b/src/devices/cpu/psx/psx.h index e15bb9663ae..98b15819f32 100644 --- a/src/devices/cpu/psx/psx.h +++ b/src/devices/cpu/psx/psx.h @@ -222,7 +222,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/rsp/rsp.cpp b/src/devices/cpu/rsp/rsp.cpp index 5541c643c6b..1939cb33b5f 100644 --- a/src/devices/cpu/rsp/rsp.cpp +++ b/src/devices/cpu/rsp/rsp.cpp @@ -539,7 +539,7 @@ void rsp_device::state_export(const device_state_entry &entry) } } -void rsp_device::state_string_export(const device_state_entry &entry, std::string &str) +void rsp_device::state_string_export(const device_state_entry &entry, std::string &str) const { const int index = entry.index(); if (index >= RSP_V0 && index <= RSP_V31) diff --git a/src/devices/cpu/rsp/rsp.h b/src/devices/cpu/rsp/rsp.h index 5688dbdab59..93215bd0649 100644 --- a/src/devices/cpu/rsp/rsp.h +++ b/src/devices/cpu/rsp/rsp.h @@ -184,7 +184,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/rsp/rspcp2.cpp b/src/devices/cpu/rsp/rspcp2.cpp index ce16a351b5a..cb45d906bde 100644 --- a/src/devices/cpu/rsp/rspcp2.cpp +++ b/src/devices/cpu/rsp/rspcp2.cpp @@ -746,7 +746,7 @@ void rsp_cop2::start() } } -void rsp_cop2::state_string_export(const int index, std::string &str) +void rsp_cop2::state_string_export(const int index, std::string &str) const { switch (index) { diff --git a/src/devices/cpu/rsp/rspcp2.h b/src/devices/cpu/rsp/rspcp2.h index bfa5b91a7fb..9eb0bb37fdc 100644 --- a/src/devices/cpu/rsp/rspcp2.h +++ b/src/devices/cpu/rsp/rspcp2.h @@ -89,7 +89,7 @@ protected: virtual int generate_lwc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) { return TRUE; } virtual int generate_swc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) { return TRUE; } - virtual void state_string_export(const int index, std::string &str); + virtual void state_string_export(const int index, std::string &str) const; public: virtual ~rsp_cop2(); diff --git a/src/devices/cpu/rsp/rspcp2d.cpp b/src/devices/cpu/rsp/rspcp2d.cpp index c16eb109449..4caacd28a0d 100644 --- a/src/devices/cpu/rsp/rspcp2d.cpp +++ b/src/devices/cpu/rsp/rspcp2d.cpp @@ -147,7 +147,7 @@ static void unimplemented_opcode(void *param) ((rsp_cop2 *)param)->cfunc_unimplemented_opcode(); } -void rsp_cop2_drc::state_string_export(const int index, std::string &str) +void rsp_cop2_drc::state_string_export(const int index, std::string &str) const { switch (index) { diff --git a/src/devices/cpu/rsp/rspcp2d.h b/src/devices/cpu/rsp/rspcp2d.h index c918d825e60..62fc25fe475 100644 --- a/src/devices/cpu/rsp/rspcp2d.h +++ b/src/devices/cpu/rsp/rspcp2d.h @@ -28,7 +28,7 @@ private: virtual int generate_lwc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) override; virtual int generate_swc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) override; - virtual void state_string_export(const int index, std::string &str) override; + virtual void state_string_export(const int index, std::string &str) const override; void cfunc_unimplemented_opcode() override; diff --git a/src/devices/cpu/s2650/s2650.cpp b/src/devices/cpu/s2650/s2650.cpp index ae842ca9fa6..8a257ff5a9e 100644 --- a/src/devices/cpu/s2650/s2650.cpp +++ b/src/devices/cpu/s2650/s2650.cpp @@ -876,7 +876,7 @@ void s2650_device::state_export(const device_state_entry &entry) } } -void s2650_device::state_string_export(const device_state_entry &entry, std::string &str) +void s2650_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/s2650/s2650.h b/src/devices/cpu/s2650/s2650.h index 2be3f99ce1c..cd5dc1c12f1 100644 --- a/src/devices/cpu/s2650/s2650.h +++ b/src/devices/cpu/s2650/s2650.h @@ -66,7 +66,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/saturn/saturn.cpp b/src/devices/cpu/saturn/saturn.cpp index a8c86f934c0..3e25ae6b76f 100644 --- a/src/devices/cpu/saturn/saturn.cpp +++ b/src/devices/cpu/saturn/saturn.cpp @@ -169,7 +169,7 @@ void saturn_device::device_start() m_icountptr = &m_icount; } -void saturn_device::state_string_export(const device_state_entry &entry, std::string &str) +void saturn_device::state_string_export(const device_state_entry &entry, std::string &str) const { #define Reg64Data(s) s[15],s[14],s[13],s[12],s[11],s[10],s[9],s[8],s[7],s[6],s[5],s[4],s[3],s[2],s[1],s[0] #define Reg64Format "%x %x%x%x%x%x%x%x %x%x%x %x%x%x%x%x" diff --git a/src/devices/cpu/saturn/saturn.h b/src/devices/cpu/saturn/saturn.h index 3281ade5fcd..28de3e41910 100644 --- a/src/devices/cpu/saturn/saturn.h +++ b/src/devices/cpu/saturn/saturn.h @@ -104,7 +104,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; diff --git a/src/devices/cpu/sc61860/sc61860.cpp b/src/devices/cpu/sc61860/sc61860.cpp index a36c02a658a..27251e10e78 100644 --- a/src/devices/cpu/sc61860/sc61860.cpp +++ b/src/devices/cpu/sc61860/sc61860.cpp @@ -171,7 +171,7 @@ void sc61860_device::device_start() } -void sc61860_device::state_string_export(const device_state_entry &entry, std::string &str) +void sc61860_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/sc61860/sc61860.h b/src/devices/cpu/sc61860/sc61860.h index 65a42862bb8..855d0d91e21 100644 --- a/src/devices/cpu/sc61860/sc61860.h +++ b/src/devices/cpu/sc61860/sc61860.h @@ -106,7 +106,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/scmp/scmp.cpp b/src/devices/cpu/scmp/scmp.cpp index 4ceb90c9f8f..2e1cf4cd021 100644 --- a/src/devices/cpu/scmp/scmp.cpp +++ b/src/devices/cpu/scmp/scmp.cpp @@ -547,7 +547,7 @@ void scmp_device::device_reset() COMMON STATE IMPORT/EXPORT ***************************************************************************/ -void scmp_device::state_string_export(const device_state_entry &entry, std::string &str) +void scmp_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/scmp/scmp.h b/src/devices/cpu/scmp/scmp.h index e89dc2e9088..03f284589eb 100644 --- a/src/devices/cpu/scmp/scmp.h +++ b/src/devices/cpu/scmp/scmp.h @@ -56,7 +56,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/score/score.cpp b/src/devices/cpu/score/score.cpp index f949efe7453..984f832b464 100644 --- a/src/devices/cpu/score/score.cpp +++ b/src/devices/cpu/score/score.cpp @@ -80,16 +80,14 @@ void score7_cpu_device::device_start() // register state for debugger state_add(SCORE_PC , "PC" , m_pc).callimport().callexport().formatstr("%08X"); - std::string tmp_string; + for(int i=0; i<0x20; i++) + state_add(SCORE_GPR + i, strformat("r%d", i).c_str(), m_gpr[i]).callimport().callexport().formatstr("%08X"); for(int i=0; i<0x20; i++) - state_add(SCORE_GPR + i, strformat(tmp_string, "r%d", i).c_str(), m_gpr[i]).callimport().callexport().formatstr("%08X"); - - for(int i=0; i<0x20; i++) - state_add(SCORE_CR + i, strformat(tmp_string, "cr%d", i).c_str(), m_cr[i]).callimport().callexport().formatstr("%08X"); + state_add(SCORE_CR + i, strformat("cr%d", i).c_str(), m_cr[i]).callimport().callexport().formatstr("%08X"); for(int i=0; i<3; i++) - state_add(SCORE_SR + i, strformat(tmp_string, "sr%d", i).c_str(), m_sr[i]).callimport().callexport().formatstr("%08X"); + state_add(SCORE_SR + i, strformat("sr%d", i).c_str(), m_sr[i]).callimport().callexport().formatstr("%08X"); state_add(SCORE_CEH, "ceh", REG_CEH).callimport().callexport().formatstr("%08X"); state_add(SCORE_CEL, "cel", REG_CEL).callimport().callexport().formatstr("%08X"); @@ -132,7 +130,7 @@ void score7_cpu_device::device_reset() // for the debugger //------------------------------------------------- -void score7_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void score7_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/score/score.h b/src/devices/cpu/score/score.h index 83e724e7785..ba7058196f8 100644 --- a/src/devices/cpu/score/score.h +++ b/src/devices/cpu/score/score.h @@ -47,7 +47,7 @@ protected: virtual void execute_set_input(int inputnum, int state) override; // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_memory_interface overrides virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; diff --git a/src/devices/cpu/scudsp/scudsp.cpp b/src/devices/cpu/scudsp/scudsp.cpp index 14d1565caa2..f0ec1644af5 100644 --- a/src/devices/cpu/scudsp/scudsp.cpp +++ b/src/devices/cpu/scudsp/scudsp.cpp @@ -1010,7 +1010,7 @@ scudsp_cpu_device::scudsp_cpu_device(const machine_config &mconfig, const char * } -void scudsp_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void scudsp_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/scudsp/scudsp.h b/src/devices/cpu/scudsp/scudsp.h index e8f52f661f1..a5827b05e41 100644 --- a/src/devices/cpu/scudsp/scudsp.h +++ b/src/devices/cpu/scudsp/scudsp.h @@ -96,7 +96,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_DATA) ? &m_data_config : nullptr ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } diff --git a/src/devices/cpu/se3208/se3208.cpp b/src/devices/cpu/se3208/se3208.cpp index b37a8e09f5f..011cc103909 100644 --- a/src/devices/cpu/se3208/se3208.cpp +++ b/src/devices/cpu/se3208/se3208.cpp @@ -1821,7 +1821,7 @@ void se3208_device::device_start() } -void se3208_device::state_string_export(const device_state_entry &entry, std::string &str) +void se3208_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/se3208/se3208.h b/src/devices/cpu/se3208/se3208.h index e548b7f7621..fbed0d6452b 100644 --- a/src/devices/cpu/se3208/se3208.h +++ b/src/devices/cpu/se3208/se3208.h @@ -32,7 +32,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/sh2/sh2.cpp b/src/devices/cpu/sh2/sh2.cpp index 71b960ac341..481f2544126 100644 --- a/src/devices/cpu/sh2/sh2.cpp +++ b/src/devices/cpu/sh2/sh2.cpp @@ -2583,7 +2583,7 @@ void sh2_device::device_start() } -void sh2_device::state_string_export(const device_state_entry &entry, std::string &str) +void sh2_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/sh2/sh2.h b/src/devices/cpu/sh2/sh2.h index da6c928b939..d7fe6c36935 100644 --- a/src/devices/cpu/sh2/sh2.h +++ b/src/devices/cpu/sh2/sh2.h @@ -131,7 +131,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/sh4/sh4.cpp b/src/devices/cpu/sh4/sh4.cpp index e0835b1f9c0..fc67b4d9d86 100644 --- a/src/devices/cpu/sh4/sh4.cpp +++ b/src/devices/cpu/sh4/sh4.cpp @@ -4447,7 +4447,7 @@ void sh34_base_device::state_export(const device_state_entry &entry) } } -void sh34_base_device::state_string_export(const device_state_entry &entry, std::string &str) +void sh34_base_device::state_string_export(const device_state_entry &entry, std::string &str) const { #ifdef LSB_FIRST UINT8 fpu_xor = m_fpu_pr; diff --git a/src/devices/cpu/sh4/sh4.h b/src/devices/cpu/sh4/sh4.h index bba3483b9a1..badaacd4558 100644 --- a/src/devices/cpu/sh4/sh4.h +++ b/src/devices/cpu/sh4/sh4.h @@ -220,7 +220,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/sm8500/sm8500.cpp b/src/devices/cpu/sm8500/sm8500.cpp index 11fc61132fc..66c51c61e5b 100644 --- a/src/devices/cpu/sm8500/sm8500.cpp +++ b/src/devices/cpu/sm8500/sm8500.cpp @@ -53,7 +53,7 @@ void sm8500_cpu_device::get_sp() } -UINT8 sm8500_cpu_device::mem_readbyte( UINT32 offset ) +UINT8 sm8500_cpu_device::mem_readbyte( UINT32 offset ) const { offset &= 0xffff; if ( offset < 0x10) @@ -141,7 +141,7 @@ void sm8500_cpu_device::device_start() } -void sm8500_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void sm8500_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/sm8500/sm8500.h b/src/devices/cpu/sm8500/sm8500.h index 8dd4802efb6..ab9f3c9ea65 100644 --- a/src/devices/cpu/sm8500/sm8500.h +++ b/src/devices/cpu/sm8500/sm8500.h @@ -71,7 +71,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } @@ -79,9 +79,9 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; inline void get_sp(); - UINT8 mem_readbyte(UINT32 offset); + UINT8 mem_readbyte(UINT32 offset) const; void mem_writebyte(UINT32 offset, UINT8 data); - inline UINT16 mem_readword(UINT32 address) { return (mem_readbyte(address ) << 8) | (mem_readbyte(address+1)); } + inline UINT16 mem_readword(UINT32 address) const { return (mem_readbyte(address ) << 8) | (mem_readbyte(address+1)); } inline void mem_writeword(UINT32 address, UINT16 value) { mem_writebyte(address, value >> 8); mem_writebyte(address+1, value); } inline void take_interrupt(UINT16 vector); void process_interrupts(); diff --git a/src/devices/cpu/spc700/spc700.cpp b/src/devices/cpu/spc700/spc700.cpp index 968aad0f10c..22969235ae7 100644 --- a/src/devices/cpu/spc700/spc700.cpp +++ b/src/devices/cpu/spc700/spc700.cpp @@ -1244,7 +1244,7 @@ void spc700_device::device_start() } -void spc700_device::state_string_export(const device_state_entry &entry, std::string &str) +void spc700_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/spc700/spc700.h b/src/devices/cpu/spc700/spc700.h index ad5085b38a9..30b9b2ccdf3 100644 --- a/src/devices/cpu/spc700/spc700.h +++ b/src/devices/cpu/spc700/spc700.h @@ -30,7 +30,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/ssem/ssem.cpp b/src/devices/cpu/ssem/ssem.cpp index 0dfec9b9cfb..438e36cbd9e 100644 --- a/src/devices/cpu/ssem/ssem.cpp +++ b/src/devices/cpu/ssem/ssem.cpp @@ -149,7 +149,7 @@ const address_space_config *ssem_device::memory_space_config(address_spacenum sp // for the debugger //------------------------------------------------- -void ssem_device::state_string_export(const device_state_entry &entry, std::string &str) +void ssem_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/ssem/ssem.h b/src/devices/cpu/ssem/ssem.h index e57294fbbf5..8d2c0c21044 100644 --- a/src/devices/cpu/ssem/ssem.h +++ b/src/devices/cpu/ssem/ssem.h @@ -45,7 +45,7 @@ public: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // address spaces const address_space_config m_program_config; diff --git a/src/devices/cpu/ssp1601/ssp1601.cpp b/src/devices/cpu/ssp1601/ssp1601.cpp index d15fa2525e5..e8cc1f501af 100644 --- a/src/devices/cpu/ssp1601/ssp1601.cpp +++ b/src/devices/cpu/ssp1601/ssp1601.cpp @@ -547,7 +547,7 @@ void ssp1601_device::device_start() } -void ssp1601_device::state_string_export(const device_state_entry &entry, std::string &str) +void ssp1601_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/ssp1601/ssp1601.h b/src/devices/cpu/ssp1601/ssp1601.h index 5d67827b288..1917af79adb 100644 --- a/src/devices/cpu/ssp1601/ssp1601.h +++ b/src/devices/cpu/ssp1601/ssp1601.h @@ -40,7 +40,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ((spacenum == AS_IO) ? &m_io_config : nullptr); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/t11/t11.cpp b/src/devices/cpu/t11/t11.cpp index 4a012ec0505..72c2e80c91b 100644 --- a/src/devices/cpu/t11/t11.cpp +++ b/src/devices/cpu/t11/t11.cpp @@ -291,7 +291,7 @@ void t11_device::device_start() m_icountptr = &m_icount; } -void t11_device::state_string_export(const device_state_entry &entry, std::string &str) +void t11_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { @@ -310,7 +310,7 @@ void t11_device::state_string_export(const device_state_entry &entry, std::strin } } -void k1801vm2_device::state_string_export(const device_state_entry &entry, std::string &str) +void k1801vm2_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/t11/t11.h b/src/devices/cpu/t11/t11.h index d2d0896445b..55d11c9666a 100644 --- a/src/devices/cpu/t11/t11.h +++ b/src/devices/cpu/t11/t11.h @@ -59,7 +59,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } @@ -1145,7 +1145,7 @@ protected: virtual void device_reset() override; // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; }; diff --git a/src/devices/cpu/tlcs90/tlcs90.cpp b/src/devices/cpu/tlcs90/tlcs90.cpp index 67745e1f0e2..994d0abb3da 100644 --- a/src/devices/cpu/tlcs90/tlcs90.cpp +++ b/src/devices/cpu/tlcs90/tlcs90.cpp @@ -2766,7 +2766,7 @@ void tlcs90_device::device_start() } -void tlcs90_device::state_string_export(const device_state_entry &entry, std::string &str) +void tlcs90_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/tlcs90/tlcs90.h b/src/devices/cpu/tlcs90/tlcs90.h index 7921444d7fd..42a7e5f5c08 100644 --- a/src/devices/cpu/tlcs90/tlcs90.h +++ b/src/devices/cpu/tlcs90/tlcs90.h @@ -51,7 +51,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/tlcs900/tlcs900.cpp b/src/devices/cpu/tlcs900/tlcs900.cpp index 03f7a014c56..4ac6f8b07a3 100644 --- a/src/devices/cpu/tlcs900/tlcs900.cpp +++ b/src/devices/cpu/tlcs900/tlcs900.cpp @@ -384,7 +384,7 @@ void tlcs900h_device::device_start() } -void tlcs900h_device::state_string_export(const device_state_entry &entry, std::string &str) +void tlcs900h_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/tlcs900/tlcs900.h b/src/devices/cpu/tlcs900/tlcs900.h index c095c848cf1..0dcf3d84994 100644 --- a/src/devices/cpu/tlcs900/tlcs900.h +++ b/src/devices/cpu/tlcs900/tlcs900.h @@ -71,7 +71,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/tms0980/tms0980.cpp b/src/devices/cpu/tms0980/tms0980.cpp index 0bf75012555..7bc62b5a475 100644 --- a/src/devices/cpu/tms0980/tms0980.cpp +++ b/src/devices/cpu/tms0980/tms0980.cpp @@ -475,7 +475,7 @@ offs_t tms0980_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UIN return CPU_DISASSEMBLE_NAME(tms0980)(this, buffer, pc, oprom, opram, options); } -void tms1xxx_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void tms1xxx_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/tms0980/tms0980.h b/src/devices/cpu/tms0980/tms0980.h index 35ea954efa0..2572eb1b1ef 100644 --- a/src/devices/cpu/tms0980/tms0980.h +++ b/src/devices/cpu/tms0980/tms0980.h @@ -137,7 +137,8 @@ protected: virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } virtual UINT32 disasm_max_opcode_bytes() const override { return 1; } - void state_string_export(const device_state_entry &entry, std::string &str) override; + // device_state_interface overrides + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; void next_pc(); diff --git a/src/devices/cpu/tms32010/tms32010.cpp b/src/devices/cpu/tms32010/tms32010.cpp index e6264d3f1dd..3a164e8f984 100644 --- a/src/devices/cpu/tms32010/tms32010.cpp +++ b/src/devices/cpu/tms32010/tms32010.cpp @@ -895,7 +895,7 @@ void tms32010_device::device_reset() } -void tms32010_device::state_string_export(const device_state_entry &entry, std::string &str) +void tms32010_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/tms32010/tms32010.h b/src/devices/cpu/tms32010/tms32010.h index 2185e324346..a1c0692c566 100644 --- a/src/devices/cpu/tms32010/tms32010.h +++ b/src/devices/cpu/tms32010/tms32010.h @@ -72,7 +72,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : ( (spacenum == AS_DATA) ? &m_data_config : nullptr ) ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/tms32025/tms32025.cpp b/src/devices/cpu/tms32025/tms32025.cpp index 562b86b2a6a..2d40b2d3448 100644 --- a/src/devices/cpu/tms32025/tms32025.cpp +++ b/src/devices/cpu/tms32025/tms32025.cpp @@ -1801,7 +1801,7 @@ void tms32025_device::state_export(const device_state_entry &entry) } -void tms32025_device::state_string_export(const device_state_entry &entry, std::string &str) +void tms32025_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/tms32025/tms32025.h b/src/devices/cpu/tms32025/tms32025.h index 464843cbe95..daac81c8314 100644 --- a/src/devices/cpu/tms32025/tms32025.h +++ b/src/devices/cpu/tms32025/tms32025.h @@ -97,7 +97,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/tms32031/tms32031.cpp b/src/devices/cpu/tms32031/tms32031.cpp index d391285f314..cfab62a7929 100644 --- a/src/devices/cpu/tms32031/tms32031.cpp +++ b/src/devices/cpu/tms32031/tms32031.cpp @@ -529,7 +529,7 @@ void tms3203x_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void tms3203x_device::state_string_export(const device_state_entry &entry, std::string &str) +void tms3203x_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/tms32031/tms32031.h b/src/devices/cpu/tms32031/tms32031.h index 46706f774c8..4ce0decf010 100644 --- a/src/devices/cpu/tms32031/tms32031.h +++ b/src/devices/cpu/tms32031/tms32031.h @@ -179,7 +179,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/tms32082/tms32082.cpp b/src/devices/cpu/tms32082/tms32082.cpp index 615cdc68fe1..8b89bc3ef88 100644 --- a/src/devices/cpu/tms32082/tms32082.cpp +++ b/src/devices/cpu/tms32082/tms32082.cpp @@ -214,7 +214,7 @@ void tms32082_mp_device::device_start() m_icountptr = &m_icount; } -void tms32082_mp_device::state_string_export(const device_state_entry &entry, std::string &str) +void tms32082_mp_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { @@ -511,7 +511,7 @@ void tms32082_pp_device::device_start() m_icountptr = &m_icount; } -void tms32082_pp_device::state_string_export(const device_state_entry &entry, std::string &str) +void tms32082_pp_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/tms32082/tms32082.h b/src/devices/cpu/tms32082/tms32082.h index 07476c700d4..80163cc6145 100644 --- a/src/devices/cpu/tms32082/tms32082.h +++ b/src/devices/cpu/tms32082/tms32082.h @@ -97,7 +97,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } @@ -192,7 +192,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 8; } diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp index 3fffd1c03c5..1ad1879c3b0 100644 --- a/src/devices/cpu/tms34010/tms34010.cpp +++ b/src/devices/cpu/tms34010/tms34010.cpp @@ -592,14 +592,13 @@ void tms340x0_device::device_start() state_add(TMS34010_ST, "ST", m_st); state_add(STATE_GENFLAGS, "GENFLAGS", m_st).noshow().formatstr("%18s"); - std::string tempstr; for (int regnum = 0; regnum < 15; regnum++) { - state_add(TMS34010_A0 + regnum, strformat(tempstr, "A%d", regnum).c_str(), m_regs[regnum].reg); + state_add(TMS34010_A0 + regnum, strformat("A%d", regnum).c_str(), m_regs[regnum].reg); } for (int regnum = 0; regnum < 15; regnum++) { - state_add(TMS34010_B0 + regnum, strformat(tempstr, "B%d", regnum).c_str(), m_regs[30 - regnum].reg); + state_add(TMS34010_B0 + regnum, strformat("B%d", regnum).c_str(), m_regs[30 - regnum].reg); } } @@ -1599,7 +1598,7 @@ READ16_MEMBER( tms340x0_device::host_r ) } -void tms340x0_device::state_string_export(const device_state_entry &entry, std::string &str) +void tms340x0_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/tms34010/tms34010.h b/src/devices/cpu/tms34010/tms34010.h index 733674d4279..f87a3df37b1 100644 --- a/src/devices/cpu/tms34010/tms34010.h +++ b/src/devices/cpu/tms34010/tms34010.h @@ -282,7 +282,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : nullptr; } // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/tms7000/tms7000.cpp b/src/devices/cpu/tms7000/tms7000.cpp index 99451e30d6b..42e76319855 100644 --- a/src/devices/cpu/tms7000/tms7000.cpp +++ b/src/devices/cpu/tms7000/tms7000.cpp @@ -257,7 +257,7 @@ void tms7000_device::device_start() state_add(STATE_GENFLAGS, "GENFLAGS", m_sr).formatstr("%8s").noshow(); } -void tms7000_device::state_string_export(const device_state_entry &entry, std::string &str) +void tms7000_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/tms7000/tms7000.h b/src/devices/cpu/tms7000/tms7000.h index 53d940232d2..b44ac9324c7 100644 --- a/src/devices/cpu/tms7000/tms7000.h +++ b/src/devices/cpu/tms7000/tms7000.h @@ -80,7 +80,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/tms9900/tms9900.cpp b/src/devices/cpu/tms9900/tms9900.cpp index 0c3de4547c0..b1fad1bbeeb 100644 --- a/src/devices/cpu/tms9900/tms9900.cpp +++ b/src/devices/cpu/tms9900/tms9900.cpp @@ -349,11 +349,11 @@ void tms99xx_device::state_export(const device_state_entry &entry) /* state_string_export - export state as a string for the debugger */ -void tms99xx_device::state_string_export(const device_state_entry &entry, std::string &str) +void tms99xx_device::state_string_export(const device_state_entry &entry, std::string &str) const { static const char *statestr = "LAECOPX-----IIII"; char flags[17]; - memset(flags, 0x00, ARRAY_LENGTH(flags)); + for (auto &flag : flags) flag = 0x00; UINT16 val = 0x8000; if (entry.index()==STATE_GENFLAGS) { diff --git a/src/devices/cpu/tms9900/tms9900.h b/src/devices/cpu/tms9900/tms9900.h index 32953477172..4669eeb439a 100644 --- a/src/devices/cpu/tms9900/tms9900.h +++ b/src/devices/cpu/tms9900/tms9900.h @@ -224,9 +224,9 @@ private: // State / debug management UINT16 m_state_any; static const char* s_statename[]; - void state_import(const device_state_entry &entry) override; - void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_import(const device_state_entry &entry) override; + virtual void state_export(const device_state_entry &entry) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // Interrupt handling void service_interrupt(); diff --git a/src/devices/cpu/tms9900/tms9995.cpp b/src/devices/cpu/tms9900/tms9995.cpp index 6eec831e927..855f00499a0 100644 --- a/src/devices/cpu/tms9900/tms9995.cpp +++ b/src/devices/cpu/tms9900/tms9995.cpp @@ -372,7 +372,7 @@ void tms9995_device::state_export(const device_state_entry &entry) /* state_string_export - export state as a string for the debugger */ -void tms9995_device::state_string_export(const device_state_entry &entry, std::string &str) +void tms9995_device::state_string_export(const device_state_entry &entry, std::string &str) const { static const char *statestr = "LAECOPX-----IIII"; char flags[17]; diff --git a/src/devices/cpu/tms9900/tms9995.h b/src/devices/cpu/tms9900/tms9995.h index fc24c82801d..e5dc055f36f 100644 --- a/src/devices/cpu/tms9900/tms9995.h +++ b/src/devices/cpu/tms9900/tms9995.h @@ -106,7 +106,7 @@ private: static const char* s_statename[]; void state_import(const device_state_entry &entry) override; void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + void state_string_export(const device_state_entry &entry, std::string &str) const override; UINT16 read_workspace_register_debug(int reg); void write_workspace_register_debug(int reg, UINT16 data); diff --git a/src/devices/cpu/ucom4/ucom4.cpp b/src/devices/cpu/ucom4/ucom4.cpp index 0c6bd280358..69b608a6592 100644 --- a/src/devices/cpu/ucom4/ucom4.cpp +++ b/src/devices/cpu/ucom4/ucom4.cpp @@ -76,7 +76,7 @@ upd552_cpu_device::upd552_cpu_device(const machine_config &mconfig, const char * // disasm -void ucom4_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void ucom4_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/ucom4/ucom4.h b/src/devices/cpu/ucom4/ucom4.h index a01ccaa37a7..01a7f2ecc1c 100644 --- a/src/devices/cpu/ucom4/ucom4.h +++ b/src/devices/cpu/ucom4/ucom4.h @@ -157,7 +157,8 @@ protected: virtual UINT32 disasm_max_opcode_bytes() const override { return 2; } virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + // device_state_interface overrides + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; address_space_config m_program_config; address_space_config m_data_config; diff --git a/src/devices/cpu/uml.cpp b/src/devices/cpu/uml.cpp index e01b34cdcb6..5b9785f792c 100644 --- a/src/devices/cpu/uml.cpp +++ b/src/devices/cpu/uml.cpp @@ -739,9 +739,8 @@ void uml::instruction::simplify() /* if (LOG_SIMPLIFICATIONS && memcmp(&orig, inst, sizeof(orig)) != 0) { - std::string disasm1, disasm2; - orig.disasm(disasm1, block->drcuml); - inst->disasm(disasm2, block->drcuml); + std::string disasm1 = orig.disasm(block->drcuml); + std::string disasm2 = inst->disasm(block->drcuml); osd_printf_debug("Simplified: %-50.50s -> %s\n", disasm1.c_str(), disasm2.c_str()); } */ @@ -854,7 +853,7 @@ UINT8 uml::instruction::modified_flags() const // given buffer //------------------------------------------------- -const char *uml::instruction::disasm(std::string &buffer, drcuml_state *drcuml) const +std::string uml::instruction::disasm(drcuml_state *drcuml) const { static const char *const conditions[] = { "z", "nz", "s", "ns", "c", "nc", "v", "nv", "u", "nu", "a", "be", "g", "le", "l", "ge" }; static const char *const pound_size[] = { "?", "?", "?", "?", "s", "?", "?", "?", "d" }; @@ -868,7 +867,7 @@ const char *uml::instruction::disasm(std::string &buffer, drcuml_state *drcuml) assert(m_opcode != OP_INVALID && m_opcode < OP_MAX); // start with the raw mnemonic and substitute sizes - buffer.clear(); + std::string buffer; for (const char *opsrc = opinfo.mnemonic; *opsrc != 0; opsrc++) if (*opsrc == '!') strcatprintf(buffer, "%s", bang_size[m_size]); @@ -1025,5 +1024,5 @@ const char *uml::instruction::disasm(std::string &buffer, drcuml_state *drcuml) if (m_flags & FLAG_C) buffer.push_back('C'); } - return buffer.c_str(); + return buffer; } diff --git a/src/devices/cpu/uml.h b/src/devices/cpu/uml.h index 6086320cf99..2dfd95adbea 100644 --- a/src/devices/cpu/uml.h +++ b/src/devices/cpu/uml.h @@ -409,7 +409,7 @@ namespace uml void set_mapvar(int paramnum, UINT32 value) { assert(paramnum < m_numparams); assert(m_param[paramnum].is_mapvar()); m_param[paramnum] = value; } // misc - const char *disasm(std::string &str, drcuml_state *drcuml = nullptr) const; + std::string disasm(drcuml_state *drcuml = nullptr) const; UINT8 input_flags() const; UINT8 output_flags() const; UINT8 modified_flags() const; diff --git a/src/devices/cpu/upd7725/upd7725.cpp b/src/devices/cpu/upd7725/upd7725.cpp index 5820d6fe4e0..ef211dd13c3 100644 --- a/src/devices/cpu/upd7725/upd7725.cpp +++ b/src/devices/cpu/upd7725/upd7725.cpp @@ -202,7 +202,7 @@ void necdsp_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void necdsp_device::state_string_export(const device_state_entry &entry, std::string &str) +void necdsp_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/upd7725/upd7725.h b/src/devices/cpu/upd7725/upd7725.h index 856014dc7d1..94a7f85869f 100644 --- a/src/devices/cpu/upd7725/upd7725.h +++ b/src/devices/cpu/upd7725/upd7725.h @@ -110,7 +110,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override; diff --git a/src/devices/cpu/upd7810/upd7810.cpp b/src/devices/cpu/upd7810/upd7810.cpp index 16734940564..d0974d00a74 100644 --- a/src/devices/cpu/upd7810/upd7810.cpp +++ b/src/devices/cpu/upd7810/upd7810.cpp @@ -1696,7 +1696,7 @@ void upd78c05_device::device_start() } -void upd7810_device::state_string_export(const device_state_entry &entry, std::string &str) +void upd7810_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/upd7810/upd7810.h b/src/devices/cpu/upd7810/upd7810.h index d25b22e49a7..d7d96be75d7 100644 --- a/src/devices/cpu/upd7810/upd7810.h +++ b/src/devices/cpu/upd7810/upd7810.h @@ -170,7 +170,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/v30mz/v30mz.cpp b/src/devices/cpu/v30mz/v30mz.cpp index 3bc7c28236a..ec720d59f9a 100644 --- a/src/devices/cpu/v30mz/v30mz.cpp +++ b/src/devices/cpu/v30mz/v30mz.cpp @@ -185,12 +185,12 @@ void v30mz_cpu_device::device_start() } -void v30mz_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void v30mz_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { case STATE_GENPC: - strprintf(str, "%08X", pc()); + strprintf(str, "%08X", ( m_sregs[CS] << 4 ) + m_ip); break; case STATE_GENFLAGS: @@ -781,7 +781,7 @@ inline void v30mz_cpu_device::set_OFB_Sub(UINT32 x,UINT32 y,UINT32 z) } -inline UINT16 v30mz_cpu_device::CompressFlags() +inline UINT16 v30mz_cpu_device::CompressFlags() const { return (CF ? 1 : 0) | (PF ? 4 : 0) diff --git a/src/devices/cpu/v30mz/v30mz.h b/src/devices/cpu/v30mz/v30mz.h index 7696cda2f0d..6ba07800b9e 100644 --- a/src/devices/cpu/v30mz/v30mz.h +++ b/src/devices/cpu/v30mz/v30mz.h @@ -44,7 +44,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } @@ -112,7 +112,7 @@ protected: inline void set_OFB_Add(UINT32 x,UINT32 y,UINT32 z); inline void set_OFW_Sub(UINT32 x,UINT32 y,UINT32 z); inline void set_OFB_Sub(UINT32 x,UINT32 y,UINT32 z); - inline UINT16 CompressFlags(); + inline UINT16 CompressFlags() const; inline void ExpandFlags(UINT16 f); // rep instructions diff --git a/src/devices/cpu/v810/v810.cpp b/src/devices/cpu/v810/v810.cpp index 84293a990ae..958c28edc49 100644 --- a/src/devices/cpu/v810/v810.cpp +++ b/src/devices/cpu/v810/v810.cpp @@ -1314,7 +1314,7 @@ void v810_device::device_start() m_icountptr = &m_icount; } -void v810_device::state_string_export(const device_state_entry &entry, std::string &str) +void v810_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/v810/v810.h b/src/devices/cpu/v810/v810.h index dbe9cf10b55..4e85ed7b540 100644 --- a/src/devices/cpu/v810/v810.h +++ b/src/devices/cpu/v810/v810.h @@ -101,7 +101,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ((spacenum == AS_IO) ? &m_io_config : nullptr); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/cpu/z180/z180.cpp b/src/devices/cpu/z180/z180.cpp index 214062cfe79..c8f3b968468 100644 --- a/src/devices/cpu/z180/z180.cpp +++ b/src/devices/cpu/z180/z180.cpp @@ -2560,7 +2560,7 @@ void z180_device::state_export(const device_state_entry &entry) } } -void z180_device::state_string_export(const device_state_entry &entry, std::string &str) +void z180_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/z180/z180.h b/src/devices/cpu/z180/z180.h index 9f36266fc94..e76c75501ba 100644 --- a/src/devices/cpu/z180/z180.h +++ b/src/devices/cpu/z180/z180.h @@ -152,7 +152,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/z8/z8.cpp b/src/devices/cpu/z8/z8.cpp index 3d8c6746c5b..d6c4fe3de77 100644 --- a/src/devices/cpu/z8/z8.cpp +++ b/src/devices/cpu/z8/z8.cpp @@ -677,9 +677,8 @@ void z8_device::device_start() state_add(Z8_T1, "T1", m_t1); state_add(STATE_GENFLAGS, "GENFLAGS", m_r[Z8_REGISTER_FLAGS]).noshow().formatstr("%6s"); - std::string tempstr; for (int regnum = 0; regnum < 16; regnum++) - state_add(Z8_R0 + regnum, strformat(tempstr, "R%d", regnum).c_str(), m_fake_r[regnum]).callimport().callexport(); + state_add(Z8_R0 + regnum, strformat("R%d", regnum).c_str(), m_fake_r[regnum]).callimport().callexport(); } /* find address spaces */ @@ -806,7 +805,7 @@ void z8_device::state_export(const device_state_entry &entry) } } -void z8_device::state_string_export(const device_state_entry &entry, std::string &str) +void z8_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/z8/z8.h b/src/devices/cpu/z8/z8.h index 11758a771d7..6ef667c74cc 100644 --- a/src/devices/cpu/z8/z8.h +++ b/src/devices/cpu/z8/z8.h @@ -59,7 +59,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp index 37ae5938426..345ea4334bf 100644 --- a/src/devices/cpu/z80/z80.cpp +++ b/src/devices/cpu/z80/z80.cpp @@ -3666,7 +3666,7 @@ void z80_device::state_export( const device_state_entry &entry ) } } -void z80_device::state_string_export(const device_state_entry &entry, std::string &str) +void z80_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/z80/z80.h b/src/devices/cpu/z80/z80.h index 679e7444435..c523f101a24 100644 --- a/src/devices/cpu/z80/z80.h +++ b/src/devices/cpu/z80/z80.h @@ -68,7 +68,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; virtual void state_export(const device_state_entry &entry) override; - virtual void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 1; } diff --git a/src/devices/cpu/z8000/z8000.cpp b/src/devices/cpu/z8000/z8000.cpp index 9cd356225d6..dcc52f92fb0 100644 --- a/src/devices/cpu/z8000/z8000.cpp +++ b/src/devices/cpu/z8000/z8000.cpp @@ -616,7 +616,7 @@ void z8002_device::register_debug_state() state_add( STATE_GENSP, "GENSP", m_nspoff ).noshow(); } -void z8002_device::state_string_export(const device_state_entry &entry, std::string &str) +void z8002_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/devices/cpu/z8000/z8000.h b/src/devices/cpu/z8000/z8000.h index aaea89f7600..98ccc6ddea4 100644 --- a/src/devices/cpu/z8000/z8000.h +++ b/src/devices/cpu/z8000/z8000.h @@ -67,7 +67,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str) override; + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const override { return 2; } diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h index 04d0a962b31..961bb7a26ea 100644 --- a/src/devices/machine/netlist.h +++ b/src/devices/machine/netlist.h @@ -220,7 +220,7 @@ protected: // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, std::string &str) override + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override { if (entry.index() >= 0) { diff --git a/src/emu/audit.cpp b/src/emu/audit.cpp index 714fadcc32e..b1016967931 100644 --- a/src/emu/audit.cpp +++ b/src/emu/audit.cpp @@ -369,10 +369,9 @@ media_auditor::summary media_auditor::summarize(const char *name, std::string *o case audit_record::SUBSTATUS_FOUND_BAD_CHECKSUM: if (output != nullptr) { - std::string tempstr; strcatprintf(*output,"INCORRECT CHECKSUM:\n"); - strcatprintf(*output,"EXPECTED: %s\n", record->expected_hashes().macro_string(tempstr)); - strcatprintf(*output," FOUND: %s\n", record->actual_hashes().macro_string(tempstr)); + strcatprintf(*output,"EXPECTED: %s\n", record->expected_hashes().macro_string().c_str()); + strcatprintf(*output," FOUND: %s\n", record->actual_hashes().macro_string().c_str()); } break; diff --git a/src/emu/cheat.cpp b/src/emu/cheat.cpp index 8b1584bbd2a..16291063985 100644 --- a/src/emu/cheat.cpp +++ b/src/emu/cheat.cpp @@ -102,28 +102,23 @@ // the format //------------------------------------------------- -inline const char *number_and_format::format(std::string &str) const +inline std::string number_and_format::format() const { switch (m_format) { default: case XML_INT_FORMAT_DECIMAL: - strprintf(str, "%d", (UINT32)m_value); - break; + return strformat("%d", (UINT32)m_value); case XML_INT_FORMAT_DECIMAL_POUND: - strprintf(str, "#%d", (UINT32)m_value); - break; + return strformat("#%d", (UINT32)m_value); case XML_INT_FORMAT_HEX_DOLLAR: - strprintf(str, "$%X", (UINT32)m_value); - break; + return strformat("$%X", (UINT32)m_value); case XML_INT_FORMAT_HEX_C: - strprintf(str, "0x%X", (UINT32)m_value); - break; + return strformat("0x%X", (UINT32)m_value); } - return str.c_str(); } @@ -206,15 +201,14 @@ void cheat_parameter::save(emu_file &cheatfile) const cheatfile.printf("\t\t\n"); } @@ -222,7 +216,7 @@ void cheat_parameter::save(emu_file &cheatfile) const else { for (const item *curitem = m_itemlist.first(); curitem != nullptr; curitem = curitem->next()) - cheatfile.printf("\t\t\t%s\n", curitem->value().format(str), curitem->text()); + cheatfile.printf("\t\t\t%s\n", curitem->value().format().c_str(), curitem->text()); cheatfile.printf("\t\t\n"); } } @@ -527,15 +521,13 @@ void cheat_script::script_entry::execute(cheat_manager &manager, UINT64 &arginde void cheat_script::script_entry::save(emu_file &cheatfile) const { - std::string tempstring; - // output an action if (m_format.empty()) { cheatfile.printf("\t\t\t%s\n", cheat_manager::quote_expression(tempstring, m_expression)); + cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(m_condition).c_str()); + cheatfile.printf(">%s\n", cheat_manager::quote_expression(m_expression).c_str()); } // output an output @@ -543,7 +535,7 @@ void cheat_script::script_entry::save(emu_file &cheatfile) const { cheatfile.printf("\t\t\t%s\n", cheat_manager::quote_expression(tempstring, m_expression)); + cheatfile.printf(">%s\n", cheat_manager::quote_expression(m_expression).c_str()); } @@ -706,10 +696,8 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons // create the symbol table m_symbols.add("argindex", symbol_table::READ_ONLY, &m_argindex); - std::string tempname; for (int curtemp = 0; curtemp < tempcount; curtemp++) { - strprintf(tempname,"temp%d", curtemp); - m_symbols.add(tempname.c_str(), symbol_table::READ_WRITE); + m_symbols.add(strformat("temp%d", curtemp).c_str(), symbol_table::READ_WRITE); } // read the first comment node @@ -1267,9 +1255,9 @@ std::string &cheat_manager::get_output_astring(int row, int justify) // document //------------------------------------------------- -const char *cheat_manager::quote_expression(std::string &str, const parsed_expression &expression) +std::string cheat_manager::quote_expression(const parsed_expression &expression) { - str.assign(expression.original_string()); + std::string str = expression.original_string(); strreplace(str, " && ", " and "); strreplace(str, " &&", " and "); @@ -1296,7 +1284,7 @@ const char *cheat_manager::quote_expression(std::string &str, const parsed_expre strreplace(str, "<< ", " lshift "); strreplace(str, "<<", " lshift "); - return str.c_str(); + return str; } diff --git a/src/emu/cheat.h b/src/emu/cheat.h index 197de382cd3..8e49a8888bb 100644 --- a/src/emu/cheat.h +++ b/src/emu/cheat.h @@ -56,7 +56,7 @@ public: operator const UINT64 &() const { return m_value; } // format the number according to its format - const char *format(std::string &str) const; + std::string format() const; private: // internal state @@ -308,7 +308,7 @@ public: std::string &get_output_astring(int row, int justify); // global helpers - static const char *quote_expression(std::string &str, const parsed_expression &expression); + static std::string quote_expression(const parsed_expression &expression); static UINT64 execute_frombcd(symbol_table &table, void *ref, int params, const UINT64 *param); static UINT64 execute_tobcd(symbol_table &table, void *ref, int params, const UINT64 *param); diff --git a/src/emu/clifront.cpp b/src/emu/clifront.cpp index 6ca7cd1e738..aa224126a60 100644 --- a/src/emu/clifront.cpp +++ b/src/emu/clifront.cpp @@ -184,8 +184,7 @@ int cli_frontend::execute(int argc, char **argv) osd_printf_error("Error in command line:\n%s\n", strtrimspace(option_errors).c_str()); // determine the base name of the EXE - std::string exename; - core_filename_extract_base(exename, argv[0], true); + std::string exename = core_filename_extract_base(argv[0], true); // if we have a command, execute that if (*(m_options.command()) != 0) @@ -321,9 +320,8 @@ void cli_frontend::listsource(const char *gamename) throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // iterate through drivers and output the info - std::string filename; while (drivlist.next()) - osd_printf_info("%-16s %s\n", drivlist.driver().name, core_filename_extract_base(filename, drivlist.driver().source_file).c_str()); + osd_printf_info("%-16s %s\n", drivlist.driver().name, core_filename_extract_base(drivlist.driver().source_file).c_str()); } @@ -409,11 +407,10 @@ void cli_frontend::listbrothers(const char *gamename) // output the entries found drivlist.reset(); - std::string filename; while (drivlist.next()) { int clone_of = drivlist.clone(); - osd_printf_info("%-16s %-16s %-16s\n", core_filename_extract_base(filename, drivlist.driver().source_file).c_str(), drivlist.driver().name, (clone_of == -1 ? "" : drivlist.driver(clone_of).name)); + osd_printf_info("%-16s %-16s %-16s\n", core_filename_extract_base(drivlist.driver().source_file).c_str(), drivlist.driver().name, (clone_of == -1 ? "" : drivlist.driver(clone_of).name)); } } @@ -460,7 +457,6 @@ void cli_frontend::listroms(const char *gamename) throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // iterate through matches - std::string tempstr; bool first = true; while (drivlist.next()) { @@ -498,7 +494,7 @@ void cli_frontend::listroms(const char *gamename) { if (hashes.flag(hash_collection::FLAG_BAD_DUMP)) osd_printf_info(" BAD"); - osd_printf_info(" %s", hashes.macro_string(tempstr)); + osd_printf_info(" %s", hashes.macro_string().c_str()); } else osd_printf_info(" NO GOOD DUMP KNOWN"); @@ -1174,8 +1170,6 @@ void cli_frontend::verifysamples(const char *gamename) void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlistdev) { - std::string tempstr; - fprintf(out, "\t\n", swlistdev.list_name(), xml_normalize_string(swlistdev.description())); for (software_info *swinfo = swlistdev.first_software_info(); swinfo != nullptr; swinfo = swinfo->next()) { @@ -1227,7 +1221,7 @@ void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlis /* dump checksum information only if there is a known dump */ hash_collection hashes(ROM_GETHASHDATA(rom)); if ( !hashes.flag(hash_collection::FLAG_NO_DUMP) ) - fprintf( out, " %s", hashes.attribute_string(tempstr) ); + fprintf( out, " %s", hashes.attribute_string().c_str() ); else fprintf( out, " status=\"nodump\"" ); @@ -1592,9 +1586,8 @@ void cli_frontend::execute_commands(const char *exename) // showusage? if (strcmp(m_options.command(), CLICOMMAND_SHOWUSAGE) == 0) { - std::string helpstring; emulator_info::printf_usage(exename, emulator_info::get_gamenoun()); - osd_printf_info("\n\nOptions:\n%s", m_options.output_help(helpstring)); + osd_printf_info("\n\nOptions:\n%s", m_options.output_help().c_str()); return; } @@ -1623,8 +1616,7 @@ void cli_frontend::execute_commands(const char *exename) throw emu_fatalerror("Unable to create file %s.ini\n",emulator_info::get_configname()); // generate the updated INI - std::string initext; - file.puts(m_options.output_ini(initext)); + file.puts(m_options.output_ini().c_str()); return; } @@ -1632,8 +1624,7 @@ void cli_frontend::execute_commands(const char *exename) if (strcmp(m_options.command(), CLICOMMAND_SHOWCONFIG) == 0) { // print the INI text - std::string initext; - printf("%s\n", m_options.output_ini(initext)); + printf("%s\n", m_options.output_ini().c_str()); return; } @@ -1834,8 +1825,7 @@ void media_identifier::identify_file(const char *name) if (core_filename_ends_with(name, ".chd")) { // output the name - std::string basename; - osd_printf_info("%-20s", core_filename_extract_base(basename, name).c_str()); + osd_printf_info("%-20s", core_filename_extract_base(name).c_str()); m_total++; // attempt to open as a CHD; fail if not @@ -1910,8 +1900,7 @@ void media_identifier::identify_data(const char *name, const UINT8 *data, int le // output the name m_total++; - std::string basename; - osd_printf_info("%-20s", core_filename_extract_base(basename, name).c_str()); + osd_printf_info("%-20s", core_filename_extract_base(name).c_str()); // see if we can find a match in the ROMs int found = find_by_hash(hashes, length); diff --git a/src/emu/debug/dvstate.cpp b/src/emu/debug/dvstate.cpp index dd3f3d33f9c..578b423725d 100644 --- a/src/emu/debug/dvstate.cpp +++ b/src/emu/debug/dvstate.cpp @@ -276,7 +276,7 @@ void debug_view_state::view_update() if (m_last_update != total_cycles) curitem->m_lastval = curitem->m_currval; curitem->m_currval = source.m_stateintf->state_int(curitem->m_index); - source.m_stateintf->state_string(curitem->m_index, valstr); + valstr = source.m_stateintf->state_string(curitem->m_index); } // see if we changed diff --git a/src/emu/devcb.h b/src/emu/devcb.h index 5aefb2b3429..2cbc85649ba 100644 --- a/src/emu/devcb.h +++ b/src/emu/devcb.h @@ -295,8 +295,8 @@ class devcb_read_line : public devcb_read_base { public: devcb_read_line(device_t &device) : devcb_read_base(device, 0xff) { } - int operator()() { return (this->*m_adapter)(*m_space, 0, U64(0xff)) & 1; } - int operator()(address_space &space) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, 0, U64(0xff)) & 1; } + int operator()() const { return (this->*m_adapter)(*m_space, 0, U64(0xff)) & 1; } + int operator()(address_space &space) const { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, 0, U64(0xff)) & 1; } }; @@ -306,8 +306,8 @@ class devcb_read8 : public devcb_read_base { public: devcb_read8(device_t &device) : devcb_read_base(device, 0xff) { } - UINT8 operator()(offs_t offset = 0, UINT8 mask = 0xff) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } - UINT8 operator()(address_space &space, offs_t offset = 0, UINT8 mask = 0xff) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } + UINT8 operator()(offs_t offset = 0, UINT8 mask = 0xff) const { return (this->*m_adapter)(*m_space, offset, mask) & mask; } + UINT8 operator()(address_space &space, offs_t offset = 0, UINT8 mask = 0xff) const { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } }; @@ -317,8 +317,8 @@ class devcb_read16 : public devcb_read_base { public: devcb_read16(device_t &device) : devcb_read_base(device, 0xffff) { } - UINT16 operator()(offs_t offset = 0, UINT16 mask = 0xffff) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } - UINT16 operator()(address_space &space, offs_t offset = 0, UINT16 mask = 0xffff) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } + UINT16 operator()(offs_t offset = 0, UINT16 mask = 0xffff) const { return (this->*m_adapter)(*m_space, offset, mask) & mask; } + UINT16 operator()(address_space &space, offs_t offset = 0, UINT16 mask = 0xffff) const { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } }; @@ -328,8 +328,8 @@ class devcb_read32 : public devcb_read_base { public: devcb_read32(device_t &device) : devcb_read_base(device, 0xffffffff) { } - UINT32 operator()(offs_t offset = 0, UINT32 mask = 0xffffffff) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } - UINT32 operator()(address_space &space, offs_t offset = 0, UINT32 mask = 0xffffffff) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } + UINT32 operator()(offs_t offset = 0, UINT32 mask = 0xffffffff) const { return (this->*m_adapter)(*m_space, offset, mask) & mask; } + UINT32 operator()(address_space &space, offs_t offset = 0, UINT32 mask = 0xffffffff) const { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } }; @@ -339,8 +339,8 @@ class devcb_read64 : public devcb_read_base { public: devcb_read64(device_t &device) : devcb_read_base(device, U64(0xffffffffffffffff)) { } - UINT64 operator()(offs_t offset = 0, UINT64 mask = U64(0xffffffffffffffff)) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } - UINT64 operator()(address_space &space, offs_t offset = 0, UINT64 mask = U64(0xffffffffffffffff)) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } + UINT64 operator()(offs_t offset = 0, UINT64 mask = U64(0xffffffffffffffff)) const { return (this->*m_adapter)(*m_space, offset, mask) & mask; } + UINT64 operator()(address_space &space, offs_t offset = 0, UINT64 mask = U64(0xffffffffffffffff)) const { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } }; diff --git a/src/emu/devfind.h b/src/emu/devfind.h index d3bc00711a4..ede407a725f 100644 --- a/src/emu/devfind.h +++ b/src/emu/devfind.h @@ -270,7 +270,7 @@ public: { for (int index = 0; index < _Count; index++) { - strformat(m_tag[index], "%s.%d", basetag, index); + strprintf(m_tag[index], "%s.%d", basetag, index); m_array[index] = std::make_unique(base, m_tag[index].c_str()); } } @@ -441,7 +441,7 @@ public: { for (int index = 0; index < _Count; index++) { - strformat(m_tag[index],"%s.%d", basetag, index); + strprintf(m_tag[index],"%s.%d", basetag, index); m_array[index] = std::make_unique(base, m_tag[index].c_str(), width); } } diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index 99fe4c7be3b..4e5f02a461c 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -711,9 +711,8 @@ void device_image_interface::determine_open_plan(int is_create, UINT32 *open_pla static void dump_wrong_and_correct_checksums(const hash_collection &hashes, const hash_collection &acthashes) { - std::string tempstr; - osd_printf_error(" EXPECTED: %s\n", hashes.macro_string(tempstr)); - osd_printf_error(" FOUND: %s\n", acthashes.macro_string(tempstr)); + osd_printf_error(" EXPECTED: %s\n", hashes.macro_string().c_str()); + osd_printf_error(" FOUND: %s\n", acthashes.macro_string().c_str()); } /*------------------------------------------------- @@ -735,8 +734,7 @@ static int verify_length_and_hash(emu_file *file, const char *name, UINT32 exple } /* If there is no good dump known, write it */ - std::string tempstr; - hash_collection &acthashes = file->hashes(hashes.hash_types(tempstr)); + hash_collection &acthashes = file->hashes(hashes.hash_types().c_str()); if (hashes.flag(hash_collection::FLAG_NO_DUMP)) { osd_printf_error("%s NO GOOD DUMP KNOWN\n", name); @@ -1209,7 +1207,7 @@ void device_image_interface::software_name_split(const char *swlist_swname, std: } -software_part *device_image_interface::find_software_item(const char *path, bool restrict_to_interface) +software_part *device_image_interface::find_software_item(const char *path, bool restrict_to_interface) const { // split full software name into software list name and short software name std::string swlist_name, swinfo_name, swpart_name; @@ -1307,7 +1305,7 @@ bool device_image_interface::load_software_part(const char *path, software_part { const char *option = device().mconfig().options().value(req_image->brief_instance_name()); // mount only if not already mounted - if (strlen(option) == 0 && !req_image->filename()) + if (*option == '\0' && !req_image->filename()) { req_image->set_init_phase(); req_image->load(requirement); @@ -1325,11 +1323,11 @@ bool device_image_interface::load_software_part(const char *path, software_part // software_get_default_slot //------------------------------------------------- -void device_image_interface::software_get_default_slot(std::string &result, const char *default_card_slot) +std::string device_image_interface::software_get_default_slot(const char *default_card_slot) const { const char *path = device().mconfig().options().value(instance_name()); - result.clear(); - if (strlen(path) > 0) + std::string result; + if (*path != '\0') { result.assign(default_card_slot); software_part *swpart = find_software_item(path, true); @@ -1340,6 +1338,7 @@ void device_image_interface::software_get_default_slot(std::string &result, cons result.assign(slot); } } + return result; } /*------------------------------------------------- diff --git a/src/emu/diimage.h b/src/emu/diimage.h index e699194fd6c..f9b8ef3b5d2 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -257,9 +257,9 @@ protected: void image_checkhash(); void update_names(const device_type device_type = nullptr, const char *inst = nullptr, const char *brief = nullptr); - software_part *find_software_item(const char *path, bool restrict_to_interface); + software_part *find_software_item(const char *path, bool restrict_to_interface) const; bool load_software_part(const char *path, software_part *&swpart); - void software_get_default_slot(std::string &result, const char *default_card_slot); + std::string software_get_default_slot(const char *default_card_slot) const; // derived class overrides diff --git a/src/emu/dislot.cpp b/src/emu/dislot.cpp index 697eb673a9f..051dc33bdb2 100644 --- a/src/emu/dislot.cpp +++ b/src/emu/dislot.cpp @@ -63,17 +63,15 @@ device_slot_option *device_slot_interface::static_option(device_t &device, const device_t* device_slot_interface::get_card_device() { - const char *subtag; + std::string subtag; device_t *dev = nullptr; - std::string temp; - if (!device().mconfig().options().exists(device().tag()+1)) { - subtag = m_default_option; - } else { - subtag = device().mconfig().options().main_value(temp,device().tag()+1); - } - if (subtag && *subtag != 0) { + if (device().mconfig().options().exists(device().tag()+1)) + subtag = device().mconfig().options().main_value(device().tag()+1); + else if (m_default_option != nullptr) + subtag.assign(m_default_option); + if (!subtag.empty()) { device_slot_card_interface *intf = nullptr; - dev = device().subdevice(subtag); + dev = device().subdevice(subtag.c_str()); if (dev!=nullptr && !dev->interface(intf)) throw emu_fatalerror("get_card_device called for device '%s' with no slot card interface", dev->tag()); } diff --git a/src/emu/dislot.h b/src/emu/dislot.h index 3c89b1350d3..573d8fa2221 100644 --- a/src/emu/dislot.h +++ b/src/emu/dislot.h @@ -116,7 +116,7 @@ public: const char *default_option() const { return m_default_option; } device_slot_option *first_option() const { return m_options.first(); } device_slot_option *option(const char *name) const { if (name) return m_options.find(name); return nullptr; } - virtual void get_default_card_software(std::string &result) { result.clear(); } + virtual std::string get_default_card_software() { return std::string(); } device_t *get_card_device(); private: diff --git a/src/emu/distate.cpp b/src/emu/distate.cpp index 77ed3307946..9986b261e93 100644 --- a/src/emu/distate.cpp +++ b/src/emu/distate.cpp @@ -113,8 +113,7 @@ device_state_entry &device_state_entry::formatstr(const char *_format) // set the DSF_CUSTOM_STRING flag by formatting with a NULL string m_flags &= ~DSF_CUSTOM_STRING; - std::string dummy; - format(dummy, nullptr); + format(nullptr); return *this; } @@ -164,8 +163,9 @@ UINT64 device_state_entry::value() const // pieces of indexed state as a string //------------------------------------------------- -std::string &device_state_entry::format(std::string &dest, const char *string, bool maxout) const +std::string device_state_entry::format(const char *string, bool maxout) const { + std::string dest; UINT64 result = value(); // parse the format @@ -436,12 +436,12 @@ UINT64 device_state_interface::state_int(int index) // pieces of indexed state as a string //------------------------------------------------- -std::string &device_state_interface::state_string(int index, std::string &dest) +std::string device_state_interface::state_string(int index) const { // NULL or out-of-range entry returns bogus string const device_state_entry *entry = state_find_entry(index); if (entry == nullptr) - return dest.assign("???"); + return std::string("???"); // get the custom string if needed std::string custom; @@ -449,7 +449,7 @@ std::string &device_state_interface::state_string(int index, std::string &dest) state_string_export(*entry, custom); // ask the entry to format itself - return entry->format(dest, custom.c_str()); + return entry->format(custom.c_str()); } @@ -466,8 +466,7 @@ int device_state_interface::state_string_max_length(int index) return 3; // ask the entry to format itself maximally - std::string tempstring; - return entry->format(tempstring, "", true).length(); + return entry->format("", true).length(); } @@ -591,7 +590,7 @@ void device_state_interface::state_string_import(const device_state_entry &entry // written to perform any post-processing //------------------------------------------------- -void device_state_interface::state_string_export(const device_state_entry &entry, std::string &str) +void device_state_interface::state_string_export(const device_state_entry &entry, std::string &str) const { // do nothing by default } @@ -615,7 +614,7 @@ void device_state_interface::interface_post_start() // state entry for the given index //------------------------------------------------- -const device_state_entry *device_state_interface::state_find_entry(int index) +const device_state_entry *device_state_interface::state_find_entry(int index) const { // use fast lookup if possible if (index >= FAST_STATE_MIN && index <= FAST_STATE_MAX) diff --git a/src/emu/distate.h b/src/emu/distate.h index f762bd9fb13..67734fefa4b 100644 --- a/src/emu/distate.h +++ b/src/emu/distate.h @@ -87,7 +87,7 @@ protected: // return the current value -- only for our friends who handle export bool needs_export() const { return ((m_flags & DSF_EXPORT) != 0); } UINT64 value() const; - std::string &format(std::string &dest, const char *string, bool maxout = false) const; + std::string format(const char *string, bool maxout = false) const; // set the current value -- only for our friends who handle import bool needs_import() const { return ((m_flags & DSF_IMPORT) != 0); } @@ -128,7 +128,7 @@ public: // state getters UINT64 state_int(int index); - std::string &state_string(int index, std::string &dest); + std::string state_string(int index) const; int state_string_max_length(int index); offs_t pc() { return state_int(STATE_GENPC); } offs_t pcbase() { return state_int(STATE_GENPCBASE); } @@ -163,13 +163,13 @@ protected: virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); virtual void state_string_import(const device_state_entry &entry, std::string &str); - virtual void state_string_export(const device_state_entry &entry, std::string &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str) const; // internal operation overrides virtual void interface_post_start() override; // find the entry for a given index - const device_state_entry *state_find_entry(int index); + const device_state_entry *state_find_entry(int index) const; // constants static const int FAST_STATE_MIN = -4; // range for fast state diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index c27064b1521..aa1b0482edc 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -281,8 +281,7 @@ void emu_options::update_slot_options() const char *name = slot->device().tag() + 1; if (exists(name) && slot->first_option() != nullptr) { - std::string defvalue; - slot->get_default_card_software(defvalue); + std::string defvalue = slot->get_default_card_software(); if (defvalue.length() > 0) { set_default_value(name, defvalue.c_str()); @@ -470,11 +469,10 @@ void emu_options::parse_standard_inis(std::string &error_string) } // next parse "source/.ini"; if that doesn't exist, try .ini - std::string sourcename; - core_filename_extract_base(sourcename, cursystem->source_file, true).insert(0, "source" PATH_SEPARATOR); + std::string sourcename = core_filename_extract_base(cursystem->source_file, true).insert(0, "source" PATH_SEPARATOR); if (!parse_one_ini(sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_string)) { - core_filename_extract_base(sourcename, cursystem->source_file, true); + sourcename = core_filename_extract_base(cursystem->source_file, true); parse_one_ini(sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_string); } @@ -501,8 +499,7 @@ void emu_options::parse_standard_inis(std::string &error_string) const game_driver *emu_options::system() const { - std::string tempstr; - int index = driver_list::find(core_filename_extract_base(tempstr, system_name(), true).c_str()); + int index = driver_list::find(core_filename_extract_base(system_name(), true).c_str()); return (index != -1) ? &driver_list::driver(index) : nullptr; } @@ -568,19 +565,19 @@ bool emu_options::parse_one_ini(const char *basename, int priority, std::string } -const char *emu_options::main_value(std::string &buffer, const char *name) const +std::string emu_options::main_value(const char *name) const { - buffer = value(name); + std::string buffer = value(name); int pos = buffer.find_first_of(','); if (pos != -1) buffer = buffer.substr(0, pos); - return buffer.c_str(); + return buffer; } -const char *emu_options::sub_value(std::string &buffer, const char *name, const char *subname) const +std::string emu_options::sub_value(const char *name, const char *subname) const { std::string tmp = std::string(",").append(subname).append("="); - buffer = value(name); + std::string buffer = value(name); int pos = buffer.find(tmp); if (pos != -1) { @@ -591,7 +588,7 @@ const char *emu_options::sub_value(std::string &buffer, const char *name, const } else buffer.clear(); - return buffer.c_str(); + return buffer; } diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index 09452859488..14597d0e67d 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -368,8 +368,8 @@ public: // FIXME: Couriersud: This should be in image_device_exit void remove_device_options(); - const char *main_value(std::string &buffer, const char *option) const; - const char *sub_value(std::string &buffer, const char *name, const char *subname) const; + std::string main_value(const char *option) const; + std::string sub_value(const char *name, const char *subname) const; bool add_slot_options(bool isfirst); private: diff --git a/src/emu/fileio.cpp b/src/emu/fileio.cpp index 8c982d03f19..0de5e021800 100644 --- a/src/emu/fileio.cpp +++ b/src/emu/fileio.cpp @@ -219,8 +219,7 @@ emu_file::operator core_file &() hash_collection &emu_file::hashes(const char *types) { // determine the hashes we already have - std::string already_have; - m_hashes.hash_types(already_have); + std::string already_have = m_hashes.hash_types(); // determine which hashes we need std::string needed; diff --git a/src/emu/hash.cpp b/src/emu/hash.cpp index 20894f4fa3e..20fd59ecab6 100644 --- a/src/emu/hash.cpp +++ b/src/emu/hash.cpp @@ -115,14 +115,14 @@ bool hash_collection::operator==(const hash_collection &rhs) const // a string //------------------------------------------------- -const char *hash_collection::hash_types(std::string &buffer) const +std::string hash_collection::hash_types() const { - buffer.clear(); + std::string buffer; if (m_has_crc32) buffer.push_back(HASH_CRC); if (m_has_sha1) buffer.push_back(HASH_SHA1); - return buffer.c_str(); + return buffer; } @@ -190,24 +190,24 @@ bool hash_collection::remove(char type) // format //------------------------------------------------- -const char *hash_collection::internal_string(std::string &buffer) const +std::string hash_collection::internal_string() const { - buffer.clear(); + std::string buffer; // handle CRCs - std::string temp; if (m_has_crc32) { buffer.push_back(HASH_CRC); - buffer.append(m_crc32.as_string(temp)); + buffer.append(m_crc32.as_string()); } // handle SHA1s if (m_has_sha1) { buffer.push_back(HASH_SHA1); - buffer.append(m_sha1.as_string(temp)); + buffer.append(m_sha1.as_string()); } // append flags - return buffer.append(m_flags).c_str(); + buffer.append(m_flags); + return buffer; } @@ -216,18 +216,17 @@ const char *hash_collection::internal_string(std::string &buffer) const // flags to a string in the macroized format //------------------------------------------------- -const char *hash_collection::macro_string(std::string &buffer) const +std::string hash_collection::macro_string() const { - buffer.clear(); + std::string buffer; // handle CRCs - std::string temp; if (m_has_crc32) - buffer.append("CRC(").append(m_crc32.as_string(temp)).append(") "); + buffer.append("CRC(").append(m_crc32.as_string()).append(") "); // handle SHA1s if (m_has_sha1) - buffer.append("SHA1(").append(m_sha1.as_string(temp)).append(") "); + buffer.append("SHA1(").append(m_sha1.as_string()).append(") "); // append flags if (flag(FLAG_NO_DUMP)) @@ -235,7 +234,7 @@ const char *hash_collection::macro_string(std::string &buffer) const if (flag(FLAG_BAD_DUMP)) buffer.append("BAD_DUMP "); strtrimspace(buffer); - return buffer.c_str(); + return buffer; } @@ -244,18 +243,17 @@ const char *hash_collection::macro_string(std::string &buffer) const // flags to a string in XML attribute format //------------------------------------------------- -const char *hash_collection::attribute_string(std::string &buffer) const +std::string hash_collection::attribute_string() const { - buffer.clear(); + std::string buffer; // handle CRCs - std::string temp; if (m_has_crc32) - buffer.append("crc=\"").append(m_crc32.as_string(temp)).append("\" "); + buffer.append("crc=\"").append(m_crc32.as_string()).append("\" "); // handle SHA1s if (m_has_sha1) - buffer.append("sha1=\"").append(m_sha1.as_string(temp)).append("\" "); + buffer.append("sha1=\"").append(m_sha1.as_string()).append("\" "); // append flags if (flag(FLAG_NO_DUMP)) @@ -263,7 +261,7 @@ const char *hash_collection::attribute_string(std::string &buffer) const if (flag(FLAG_BAD_DUMP)) buffer.append("status=\"baddump\""); strtrimspace(buffer); - return buffer.c_str(); + return buffer; } diff --git a/src/emu/hash.h b/src/emu/hash.h index 52d5c6bf3b6..f225c7827a3 100644 --- a/src/emu/hash.h +++ b/src/emu/hash.h @@ -67,7 +67,7 @@ public: // getters bool flag(char flag) const { return (m_flags.find_first_of(flag) != std::string::npos); } - const char *hash_types(std::string &buffer) const; + std::string hash_types() const; // hash manipulators void reset(); @@ -83,9 +83,9 @@ public: void add_sha1(sha1_t sha1) { m_has_sha1 = true; m_sha1 = sha1; } // string conversion - const char *internal_string(std::string &buffer) const; - const char *macro_string(std::string &buffer) const; - const char *attribute_string(std::string &buffer) const; + std::string internal_string() const; + std::string macro_string() const; + std::string attribute_string() const; bool from_internal_string(const char *string); // creation diff --git a/src/emu/image.cpp b/src/emu/image.cpp index ab7f7406854..dbd26739f5e 100644 --- a/src/emu/image.cpp +++ b/src/emu/image.cpp @@ -141,8 +141,7 @@ static int write_config(emu_options &options, const char *filename, const game_d file_error filerr = file.open(filename); if (filerr == FILERR_NONE) { - std::string inistring; - options.output_ini(inistring); + std::string inistring = options.output_ini(); file.puts(inistring.c_str()); retval = 0; } diff --git a/src/emu/info.cpp b/src/emu/info.cpp index e48726fbe0f..4bae0daf37a 100644 --- a/src/emu/info.cpp +++ b/src/emu/info.cpp @@ -572,8 +572,7 @@ void info_xml_creator::output_rom(device_t &device) if (!hashes.flag(hash_collection::FLAG_NO_DUMP)) { // iterate over hash function types and print m_output their values - std::string tempstr; - strcatprintf(output," %s", hashes.attribute_string(tempstr)); + output.append(" ").append(hashes.attribute_string()); } else output.append(" status=\"nodump\""); @@ -1306,11 +1305,8 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag) fprintf(m_output, "\t\t\tname())); fprintf(m_output, " devname=\"%s\"", xml_normalize_string(dev->shortname())); - if (slot->default_option()) - { - if (strcmp(slot->default_option(),option->name())==0) - fprintf(m_output, " default=\"yes\""); - } + if (slot->default_option() != nullptr && strcmp(slot->default_option(),option->name())==0) + fprintf(m_output, " default=\"yes\""); fprintf(m_output, "/>\n"); const_cast(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), "dummy"); } diff --git a/src/emu/input.cpp b/src/emu/input.cpp index 4a1100db177..474680a7409 100644 --- a/src/emu/input.cpp +++ b/src/emu/input.cpp @@ -529,9 +529,10 @@ bool joystick_map::parse(const char *mapstring) // friendly display //------------------------------------------------- -const char *joystick_map::to_string(std::string &str) const +std::string joystick_map::to_string() const { - strprintf(str, "%s\n", m_origstring.c_str()); + std::string str(m_origstring); + str.append("\n"); for (auto & elem : m_map) { str.append(" "); @@ -553,7 +554,7 @@ const char *joystick_map::to_string(std::string &str) const str.append("\n"); } - return str.c_str(); + return str; } @@ -808,14 +809,13 @@ input_device::input_device(input_class &_class, int devindex, const char *name, mapstring = joystick_map_8way; // parse it - std::string tempstr; if (!m_joymap.parse(mapstring)) { osd_printf_error("Invalid joystick map: %s\n", mapstring); m_joymap.parse(joystick_map_8way); } else if (mapstring != joystick_map_8way) - osd_printf_verbose("Input: Default joystick map = %s\n", m_joymap.to_string(tempstr)); + osd_printf_verbose("Input: Default joystick map = %s\n", m_joymap.to_string().c_str()); } } @@ -1460,21 +1460,18 @@ input_code input_manager::code_from_itemid(input_item_id itemid) const // friendly name //------------------------------------------------- -const char *input_manager::code_name(std::string &str, input_code code) const +std::string input_manager::code_name(input_code code) const { - str.clear(); - // if nothing there, return an empty string input_device_item *item = item_from_code(code); if (item == nullptr) - return str.c_str(); + return std::string(); // determine the devclass part const char *devclass = (*devclass_string_table)[code.device_class()]; // determine the devindex part - std::string devindex; - strprintf(devindex, "%d", code.device_index() + 1); + std::string devindex = strformat("%d", code.device_index() + 1); // if we're unifying all devices, don't display a number if (!m_class[code.device_class()]->multi()) @@ -1500,7 +1497,7 @@ const char *input_manager::code_name(std::string &str, input_code code) const devcode = ""; // concatenate the strings - str.assign(devclass); + std::string str(devclass); if (!devindex.empty()) str.append(" ").append(devindex); if (devcode[0] != 0) @@ -1510,7 +1507,7 @@ const char *input_manager::code_name(std::string &str, input_code code) const // delete any leading spaces strtrimspace(str); - return str.c_str(); + return str; } @@ -1518,14 +1515,13 @@ const char *input_manager::code_name(std::string &str, input_code code) const // code_to_token - create a token for a given code //------------------------------------------------- -const char *input_manager::code_to_token(std::string &str, input_code code) const +std::string input_manager::code_to_token(input_code code) const { // determine the devclass part const char *devclass = (*devclass_token_table)[code.device_class()]; // determine the devindex part; keyboard 0 doesn't show an index - std::string devindex; - strprintf(devindex, "%d", code.device_index() + 1); + std::string devindex = strformat("%d", code.device_index() + 1); if (code.device_class() == DEVICE_CLASS_KEYBOARD && code.device_index() == 0) devindex.clear(); @@ -1542,7 +1538,7 @@ const char *input_manager::code_to_token(std::string &str, input_code code) cons itemclass = (*itemclass_token_table)[code.item_class()]; // concatenate the strings - str.assign(devclass); + std::string str(devclass); if (!devindex.empty()) str.append("_").append(devindex); if (devcode[0] != 0) @@ -1551,7 +1547,7 @@ const char *input_manager::code_to_token(std::string &str, input_code code) cons str.append("_").append(modifier); if (itemclass[0] != 0) str.append("_").append(itemclass); - return str.c_str(); + return str; } @@ -1925,17 +1921,16 @@ bool input_manager::seq_poll() // sequence //------------------------------------------------- -const char *input_manager::seq_name(std::string &str, const input_seq &seq) const +std::string input_manager::seq_name(const input_seq &seq) const { // make a copy of our sequence, removing any invalid bits input_code clean_codes[sizeof(seq) / sizeof(input_code)]; int clean_index = 0; - std::string codestr; for (int codenum = 0; seq[codenum] != input_seq::end_code; codenum++) { // if this is a code item which is not valid, don't copy it and remove any preceding ORs/NOTs input_code code = seq[codenum]; - if (!code.internal() && *(code_name(codestr, code)) == 0) + if (!code.internal() && code_name(code).empty()) { while (clean_index > 0 && clean_codes[clean_index - 1].internal()) clean_index--; @@ -1946,10 +1941,10 @@ const char *input_manager::seq_name(std::string &str, const input_seq &seq) cons // special case: empty if (clean_index == 0) - return str.assign((seq.length() == 0) ? "None" : "n/a").c_str(); + return std::string((seq.length() == 0) ? "None" : "n/a"); // start with an empty buffer - str.clear(); + std::string str; // loop until we hit the end for (int codenum = 0; codenum < clean_index; codenum++) @@ -1967,9 +1962,9 @@ const char *input_manager::seq_name(std::string &str, const input_seq &seq) cons // otherwise, assume it is an input code and ask the input system to generate it else - str.append(code_name(codestr, code)); + str.append(code_name(code)); } - return str.c_str(); + return str; } @@ -1978,13 +1973,12 @@ const char *input_manager::seq_name(std::string &str, const input_seq &seq) cons // a sequence //------------------------------------------------- -const char *input_manager::seq_to_tokens(std::string &str, const input_seq &seq) const +std::string input_manager::seq_to_tokens(const input_seq &seq) const { // start with an empty buffer - str.clear(); + std::string str; // loop until we hit the end - std::string codestr; for (int codenum = 0; seq[codenum] != input_seq::end_code; codenum++) { // append a space if not the first code @@ -2002,9 +1996,9 @@ const char *input_manager::seq_to_tokens(std::string &str, const input_seq &seq) // otherwise, assume it is an input code and ask the input system to generate it else - str.append(code_to_token(codestr, code)); + str.append(code_to_token(code)); } - return str.c_str(); + return str; } @@ -2072,8 +2066,7 @@ bool input_manager::set_global_joystick_map(const char *mapstring) if (!map.parse(mapstring)) return false; - std::string tempstr; - osd_printf_verbose("Input: Changing default joystick map = %s\n", map.to_string(tempstr)); + osd_printf_verbose("Input: Changing default joystick map = %s\n", map.to_string().c_str()); // iterate over joysticks and set the map for (int joynum = 0; joynum <= m_joystick_class.maxindex(); joynum++) diff --git a/src/emu/input.h b/src/emu/input.h index b0f006d3fd9..a14f08099c0 100644 --- a/src/emu/input.h +++ b/src/emu/input.h @@ -365,7 +365,7 @@ public: bool parse(const char *mapstring); // create a friendly string - const char *to_string(std::string &str) const; + std::string to_string() const; // update the state of a live map UINT8 update(INT32 xaxisval, INT32 yaxisval); @@ -654,8 +654,8 @@ public: input_device *device_from_code(input_code code) const; input_device_item *item_from_code(input_code code) const; input_code code_from_itemid(input_item_id itemid) const; - const char *code_name(std::string &str, input_code code) const; - const char *code_to_token(std::string &str, input_code code) const; + std::string code_name(input_code code) const; + std::string code_to_token(input_code code) const; input_code code_from_token(const char *_token); // input sequence readers @@ -668,8 +668,8 @@ public: const input_seq &seq_poll_final() const { return m_poll_seq; } // input sequence helpers - const char *seq_name(std::string &str, const input_seq &seq) const; - const char *seq_to_tokens(std::string &str, const input_seq &seq) const; + std::string seq_name(const input_seq &seq) const; + std::string seq_to_tokens(const input_seq &seq) const; void seq_from_tokens(input_seq &seq, const char *_token); // misc diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index af099545f48..ec6f32f8fae 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -897,8 +897,7 @@ void natural_keyboard::post(unicode_char ch) if (LOG_NATURAL_KEYBOARD) { const keycode_map_entry *code = find_code(ch); - std::string tempstr; - machine().logerror("natural_keyboard::post(): code=%i (%s) field->name='%s'\n", int(ch), unicode_to_string(tempstr, ch), (code != nullptr && code->field[0] != nullptr) ? code->field[0]->name() : ""); + machine().logerror("natural_keyboard::post(): code=%i (%s) field->name='%s'\n", int(ch), unicode_to_string(ch).c_str(), (code != nullptr && code->field[0] != nullptr) ? code->field[0]->name() : ""); } // can we post this key in the queue directly? @@ -1101,8 +1100,7 @@ void natural_keyboard::build_codes(ioport_manager &manager) if (LOG_NATURAL_KEYBOARD) { - std::string tempstr; - machine().logerror("natural_keyboard: code=%i (%s) port=%p field->name='%s'\n", int(code), unicode_to_string(tempstr, code), (void *)port, field->name()); + machine().logerror("natural_keyboard: code=%i (%s) port=%p field->name='%s'\n", int(code), unicode_to_string(code).c_str(), (void *)port, field->name()); } } } @@ -1234,9 +1232,9 @@ void natural_keyboard::timer(void *ptr, int param) // logging and debugging //------------------------------------------------- -const char *natural_keyboard::unicode_to_string(std::string &buffer, unicode_char ch) +std::string natural_keyboard::unicode_to_string(unicode_char ch) { - buffer.clear(); + std::string buffer; switch (ch) { // check some magic values @@ -1256,15 +1254,15 @@ const char *natural_keyboard::unicode_to_string(std::string &buffer, unicode_cha { // try to obtain a codename with code_name(); this can result in an empty string input_code code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, input_item_id(ch - UCHAR_MAMEKEY_BEGIN)); - machine().input().code_name(buffer, code); + buffer = machine().input().code_name(code); } // did we fail to resolve? if so, we have a last resort - if (buffer.length() == 0) + if (buffer.empty()) strprintf(buffer,"U+%04X", unsigned(ch)); break; } - return buffer.c_str(); + return buffer; } @@ -1307,8 +1305,10 @@ void natural_keyboard::frame_update(ioport_port &port, ioport_value &digital) // key_name - returns the name of a specific key //------------------------------------------------- -const char *natural_keyboard::key_name(std::string &str, unicode_char ch) +std::string natural_keyboard::key_name(unicode_char ch) const { + std::string str; + // attempt to get the string from the character info table const char_info *ci = char_info::find(ch); const char *result = (ci != nullptr) ? ci->name : nullptr; @@ -1327,7 +1327,7 @@ const char *natural_keyboard::key_name(std::string &str, unicode_char ch) // otherwise, opt for question marks else str.assign("???"); - return str.c_str(); + return str; } @@ -1337,7 +1337,7 @@ const char *natural_keyboard::key_name(std::string &str, unicode_char ch) std::string natural_keyboard::dump() { - std::string buffer, tempstr; + std::string buffer; const size_t left_column_width = 24; // loop through all codes @@ -1345,7 +1345,7 @@ std::string natural_keyboard::dump() { // describe the character code - strcatprintf(buffer,"%08X (%s) ", code.ch, unicode_to_string(tempstr, code.ch)); + strcatprintf(buffer,"%08X (%s) ", code.ch, unicode_to_string(code.ch).c_str()); // pad with spaces while (buffer.length() < left_column_width) @@ -2173,20 +2173,19 @@ ioport_field_live::ioport_field_live(ioport_field &field, analog_field *analog) if (field.type_class() == INPUT_CLASS_KEYBOARD && field.specific_name() == nullptr) { // loop through each character on the field - std::string tempstr; for (int which = 0; ; which++) { unicode_char ch = field.keyboard_code(which); if (ch == 0) break; - strcatprintf(name, "%-*s ", MAX(SPACE_COUNT - 1, 0), field.manager().natkeyboard().key_name(tempstr, ch)); + strcatprintf(name, "%-*s ", MAX(SPACE_COUNT - 1, 0), field.manager().natkeyboard().key_name(ch).c_str()); } // trim extra spaces strtrimspace(name); // special case - if (name.length() == 0) + if (name.empty()) name.assign("Unnamed Key"); } } @@ -3175,7 +3174,7 @@ void ioport_manager::save_sequence(xml_data_node *parentnode, input_seq_type typ if (seq.length() == 0) seqstring.assign("NONE"); else - machine().input().seq_to_tokens(seqstring, seq); + seqstring = machine().input().seq_to_tokens(seq); // add the new node xml_data_node *seqnode = xml_add_child(parentnode, "newseq", seqstring.c_str()); @@ -3233,8 +3232,7 @@ void ioport_manager::save_default_inputs(xml_data_node *parentnode) if (portnode != nullptr) { // add the port information and attributes - std::string tempstr; - xml_set_attribute(portnode, "type", input_type_to_token(tempstr, entry->type(), entry->player())); + xml_set_attribute(portnode, "type", input_type_to_token(entry->type(), entry->player()).c_str()); // add only the sequences that have changed from the defaults for (input_seq_type type = SEQ_TYPE_STANDARD; type < SEQ_TYPE_TOTAL; ++type) @@ -3288,9 +3286,8 @@ void ioport_manager::save_game_inputs(xml_data_node *parentnode) if (portnode != nullptr) { // add the identifying information and attributes - std::string tempstr; xml_set_attribute(portnode, "tag", port->tag()); - xml_set_attribute(portnode, "type", input_type_to_token(tempstr, field->type(), field->player())); + xml_set_attribute(portnode, "type", input_type_to_token(field->type(), field->player()).c_str()); xml_set_attribute_int(portnode, "mask", field->mask()); xml_set_attribute_int(portnode, "defvalue", field->defvalue() & field->mask()); @@ -4399,15 +4396,15 @@ ioport_type ioport_manager::token_to_input_type(const char *string, int &player) // type and player to a string token //------------------------------------------------- -const char *ioport_manager::input_type_to_token(std::string &str, ioport_type type, int player) +std::string ioport_manager::input_type_to_token(ioport_type type, int player) { // look up the port and return the token input_type_entry *entry = m_type_to_entry[type][player]; if (entry != nullptr) - return str.assign(entry->token()).c_str(); + return std::string(entry->token()); // if that fails, carry on - return strformat(str, "TYPE_OTHER(%d,%d)", type, player).c_str(); + return strformat("TYPE_OTHER(%d,%d)", type, player); } diff --git a/src/emu/ioport.h b/src/emu/ioport.h index ddb653b5926..3081f6f4e7d 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -830,7 +830,7 @@ public: void post_coded(const char *text, size_t length = 0, const attotime &rate = attotime::zero); void frame_update(ioport_port &port, ioport_value &digital); - const char *key_name(std::string &str, unicode_char ch); + std::string key_name(unicode_char ch) const; // debugging std::string dump(); @@ -850,7 +850,7 @@ private: attotime choose_delay(unicode_char ch); void internal_post(unicode_char ch); void timer(void *ptr, int param); - const char *unicode_to_string(std::string &buffer, unicode_char ch); + std::string unicode_to_string(unicode_char ch); const keycode_map_entry *find_code(unicode_char ch) const; // internal state @@ -1396,7 +1396,7 @@ public: bool has_keyboard() const; INT32 frame_interpolate(INT32 oldval, INT32 newval); ioport_type token_to_input_type(const char *string, int &player) const; - const char *input_type_to_token(std::string &str, ioport_type type, int player); + std::string input_type_to_token(ioport_type type, int player); private: // internal helpers diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index 4445cf96dff..6979b2cfec5 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -494,7 +494,7 @@ void running_machine::schedule_soft_reset() // software //------------------------------------------------- -std::string running_machine::get_statename(const char *option) +std::string running_machine::get_statename(const char *option) const { std::string statename_str(""); if (option == nullptr || option[0] == 0) @@ -1172,42 +1172,35 @@ void running_machine::postload_all_devices() NVRAM MANAGEMENT ***************************************************************************/ -const char *running_machine::image_parent_basename(device_t *device) -{ - device_t *dev = device; - while(dev != &root_device()) - { - device_image_interface *intf = nullptr; - if (dev!=nullptr && dev->interface(intf)) - { - return intf->basename_noext(); - } - dev = dev->owner(); - } - return nullptr; -} - /*------------------------------------------------- nvram_filename - returns filename of system's NVRAM depending of selected BIOS -------------------------------------------------*/ -std::string &running_machine::nvram_filename(std::string &result, device_t &device) +std::string running_machine::nvram_filename(device_t &device) const { // start with either basename or basename_biosnum - result.assign(basename()); + std::string result(basename()); if (root_device().system_bios() != 0 && root_device().default_bios() != root_device().system_bios()) strcatprintf(result, "_%d", root_device().system_bios() - 1); // device-based NVRAM gets its own name in a subdirectory - if (&device != &root_device()) + if (device.owner() != nullptr) { // add per software nvrams into one folder - const char *software = image_parent_basename(&device); - if (software!=nullptr && strlen(software)>0) + const char *software = nullptr; + for (device_t *dev = &device; dev->owner() != nullptr; dev = dev->owner()) { - result.append(PATH_SEPARATOR).append(software); + device_image_interface *intf; + if (dev->interface(intf)) + { + software = intf->basename_noext(); + break; + } } + if (software != nullptr && *software != '\0') + result.append(PATH_SEPARATOR).append(software); + std::string tag(device.tag()); tag.erase(0, 1); strreplacechr(tag,':', '_'); @@ -1225,9 +1218,8 @@ void running_machine::nvram_load() nvram_interface_iterator iter(root_device()); for (device_nvram_interface *nvram = iter.first(); nvram != nullptr; nvram = iter.next()) { - std::string filename; emu_file file(options().nvram_directory(), OPEN_FLAG_READ); - if (file.open(nvram_filename(filename, nvram->device()).c_str()) == FILERR_NONE) + if (file.open(nvram_filename(nvram->device()).c_str()) == FILERR_NONE) { nvram->nvram_load(file); file.close(); @@ -1247,9 +1239,8 @@ void running_machine::nvram_save() nvram_interface_iterator iter(root_device()); for (device_nvram_interface *nvram = iter.first(); nvram != nullptr; nvram = iter.next()) { - std::string filename; emu_file file(options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open(nvram_filename(filename, nvram->device()).c_str()) == FILERR_NONE) + if (file.open(nvram_filename(nvram->device()).c_str()) == FILERR_NONE) { nvram->nvram_save(file); file.close(); diff --git a/src/emu/machine.h b/src/emu/machine.h index 1b5e5ad6369..cee2a640b74 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -246,13 +246,12 @@ private: // internal helpers void start(); void set_saveload_filename(const char *filename); - std::string get_statename(const char *statename_opt); + std::string get_statename(const char *statename_opt) const; void handle_saveload(); void soft_reset(void *ptr = nullptr, INT32 param = 0); void watchdog_fired(void *ptr = nullptr, INT32 param = 0); void watchdog_vblank(screen_device &screen, bool vblank_state); - const char *image_parent_basename(device_t *device); - std::string &nvram_filename(std::string &result, device_t &device); + std::string nvram_filename(device_t &device) const; void nvram_load(); void nvram_save(); diff --git a/src/emu/mconfig.cpp b/src/emu/mconfig.cpp index 1d3b5a2effd..6c052d7ce23 100644 --- a/src/emu/mconfig.cpp +++ b/src/emu/mconfig.cpp @@ -39,15 +39,16 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options) for (device_slot_interface *slot = slotiter.first(); slot != nullptr; slot = slotiter.next()) { device_t &owner = slot->device(); - std::string temp; - const char *selval = options.main_value(temp, owner.tag()+1); + std::string selval; bool isdefault = (options.priority(owner.tag()+1)==OPTION_PRIORITY_DEFAULT); - if (!is_selected_driver || !options.exists(owner.tag()+1)) - selval = slot->default_option(); + if (is_selected_driver && options.exists(owner.tag()+1)) + selval = options.main_value(owner.tag()+1); + else if (slot->default_option() != nullptr) + selval.assign(slot->default_option()); - if (selval != nullptr && *selval != 0) + if (!selval.empty()) { - const device_slot_option *option = slot->option(selval); + const device_slot_option *option = slot->option(selval.c_str()); if (option && (isdefault || option->selectable())) { @@ -66,7 +67,7 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options) device_t::static_set_input_default(*new_dev, input_device_defaults); } else - throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval, owner.tag()+1); + throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval.c_str(), owner.tag()+1); } } diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index 065a29ecf42..11af35dcdf2 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -474,9 +474,8 @@ static void handle_missing_file(romload_private *romdata, const rom_entry *romp, static void dump_wrong_and_correct_checksums(romload_private *romdata, const hash_collection &hashes, const hash_collection &acthashes) { - std::string tempstr; - strcatprintf(romdata->errorstring, " EXPECTED: %s\n", hashes.macro_string(tempstr)); - strcatprintf(romdata->errorstring, " FOUND: %s\n", acthashes.macro_string(tempstr)); + strcatprintf(romdata->errorstring, " EXPECTED: %s\n", hashes.macro_string().c_str()); + strcatprintf(romdata->errorstring, " FOUND: %s\n", acthashes.macro_string().c_str()); } @@ -500,8 +499,7 @@ static void verify_length_and_hash(romload_private *romdata, const char *name, U } /* If there is no good dump known, write it */ - std::string tempstr; - hash_collection &acthashes = romdata->file->hashes(hashes.hash_types(tempstr)); + hash_collection &acthashes = romdata->file->hashes(hashes.hash_types().c_str()); if (hashes.flag(hash_collection::FLAG_NO_DUMP)) { strcatprintf(romdata->errorstring, "%s NO GOOD DUMP KNOWN\n", name); @@ -1538,17 +1536,16 @@ void rom_init(running_machine &machine) device_iterator deviter(romdata->machine().config().root_device()); for (device_t *device = deviter.first(); device != nullptr; device = deviter.next()) { if (device->rom_region()) { - const char *specbios; - std::string temp; - if (strcmp(device->tag(),":")==0) { - specbios = romdata->machine().options().bios(); + std::string specbios; + if (device->owner() == nullptr) { + specbios.assign(romdata->machine().options().bios()); } else { - specbios = romdata->machine().options().sub_value(temp,device->owner()->tag()+1,"bios"); - if (strlen(specbios) == 0) { - specbios = device->default_bios_tag().c_str(); + specbios = romdata->machine().options().sub_value(device->owner()->tag()+1,"bios"); + if (specbios.empty()) { + specbios = device->default_bios_tag(); } } - determine_bios_rom(romdata, device, specbios); + determine_bios_rom(romdata, device, specbios.c_str()); } } diff --git a/src/emu/ui/inputmap.cpp b/src/emu/ui/inputmap.cpp index d72f3df1dc6..f47774a372e 100644 --- a/src/emu/ui/inputmap.cpp +++ b/src/emu/ui/inputmap.cpp @@ -434,7 +434,7 @@ void ui_menu_input::populate_and_sort(input_item_data *itemlist) /* otherwise, generate the sequence name and invert it if different from the default */ else { - machine().input().seq_name(subtext, item->seq); + subtext = machine().input().seq_name(item->seq); flags |= (item->seq != *item->defseq) ? MENU_FLAG_INVERT : 0; } diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp index af11fd54cea..5c6bc57c9b9 100644 --- a/src/emu/ui/miscmenu.cpp +++ b/src/emu/ui/miscmenu.cpp @@ -124,9 +124,8 @@ void ui_menu_bios_selection::handle() assert(error.empty()); } else { std::string error; - std::string value; - std::string temp; - strprintf(value,"%s,bios=%d",machine().options().main_value(temp,dev->owner()->tag()+1),val-1); + std::string value = machine().options().main_value(dev->owner()->tag()+1); + strcatprintf(value,",bios=%d",val-1); machine().options().set_value(dev->owner()->tag()+1, value.c_str(), OPTION_PRIORITY_CMDLINE, error); assert(error.empty()); } diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 2bad0004f85..6c12a38e276 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -325,7 +325,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott strprintf(tempbuf[1], "%s, %-.100s", driver->year, driver->manufacturer); // next line source path - strprintf(tempbuf[2],"Driver: %-.100s", core_filename_extract_base(tempbuf[3], driver->source_file).c_str()); + strprintf(tempbuf[2],"Driver: %-.100s", core_filename_extract_base(driver->source_file).c_str()); // next line is overall driver status if (driver->flags & MACHINE_NOT_WORKING) diff --git a/src/emu/ui/slotopt.cpp b/src/emu/ui/slotopt.cpp index df4d0fec6b2..cce17353532 100644 --- a/src/emu/ui/slotopt.cpp +++ b/src/emu/ui/slotopt.cpp @@ -21,18 +21,18 @@ -------------------------------------------------*/ device_slot_option *ui_menu_slot_devices::slot_get_current_option(device_slot_interface *slot) { - const char *current; + std::string current; if (slot->fixed()) { - current = slot->default_option(); + if (slot->default_option() == nullptr) return nullptr; + current.assign(slot->default_option()); } else { - std::string temp; - current = machine().options().main_value(temp, slot->device().tag() + 1); + current = machine().options().main_value(slot->device().tag() + 1); } - return slot->option(current); + return slot->option(current.c_str()); } /*------------------------------------------------- diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 39eeb6e5edb..db0f6f6d424 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -1153,8 +1153,7 @@ std::string &ui_manager::warnings_string(std::string &str) std::string &ui_manager::game_info_astring(std::string &str) { // print description, manufacturer, and CPU: - std::string tempstr; - strprintf(str, "%s\n%s %s\nDriver: %s\n\nCPU:\n", machine().system().description, machine().system().year, machine().system().manufacturer, core_filename_extract_base(tempstr, machine().system().source_file).c_str()); + strprintf(str, "%s\n%s %s\nDriver: %s\n\nCPU:\n", machine().system().description, machine().system().year, machine().system().manufacturer, core_filename_extract_base(machine().system().source_file).c_str()); // loop over all CPUs execute_interface_iterator execiter(machine().root_device()); @@ -1489,7 +1488,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (machine.ui().show_fps_counter()) { std::string tempstring; - machine.ui().draw_text_full(container, machine.video().speed_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, + machine.ui().draw_text_full(container, machine.video().speed_text().c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); } @@ -1767,17 +1766,13 @@ void ui_manager::request_quit() UINT32 ui_manager::handler_confirm_quit(running_machine &machine, render_container *container, UINT32 state) { // get the text for 'UI Select' - std::string ui_select_text; - machine.input().seq_name(ui_select_text, machine.ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)); + std::string ui_select_text = machine.input().seq_name(machine.ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)); // get the text for 'UI Cancel' - std::string ui_cancel_text; - machine.input().seq_name(ui_cancel_text, machine.ioport().type_seq(IPT_UI_CANCEL, 0, SEQ_TYPE_STANDARD)); + std::string ui_cancel_text = machine.input().seq_name(machine.ioport().type_seq(IPT_UI_CANCEL, 0, SEQ_TYPE_STANDARD)); // assemble the quit message - std::string quit_message; - strprintf(quit_message, - "Are you sure you want to quit?\n\n" + std::string quit_message = strformat("Are you sure you want to quit?\n\n" "Press ''%s'' to quit,\n" "Press ''%s'' to return to emulation.", ui_select_text.c_str(), diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index cd33ed1bc43..f1d685e7cd3 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -295,8 +295,7 @@ void validity_checker::validate_one(const game_driver &driver) // if we had warnings or errors, output if (m_errors > start_errors || m_warnings > start_warnings || !m_verbose_text.empty()) { - std::string tempstr; - output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): %d errors, %d warnings\n", driver.name, core_filename_extract_base(tempstr, driver.source_file).c_str(), m_errors - start_errors, m_warnings - start_warnings); + output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): %d errors, %d warnings\n", driver.name, core_filename_extract_base(driver.source_file).c_str(), m_errors - start_errors, m_warnings - start_warnings); if (m_errors > start_errors) output_indented_errors(m_error_text, "Errors"); if (m_warnings > start_warnings) @@ -524,18 +523,17 @@ void validity_checker::validate_inlines() void validity_checker::validate_driver() { // check for duplicate names - std::string tempstr; if (!m_names_map.insert(std::make_pair(m_current_driver->name, m_current_driver)).second) { const game_driver *match = m_names_map.find(m_current_driver->name)->second; - osd_printf_error("Driver name is a duplicate of %s(%s)\n", core_filename_extract_base(tempstr, match->source_file).c_str(), match->name); + osd_printf_error("Driver name is a duplicate of %s(%s)\n", core_filename_extract_base(match->source_file).c_str(), match->name); } // check for duplicate descriptions if (!m_descriptions_map.insert(std::make_pair(m_current_driver->description, m_current_driver)).second) { const game_driver *match = m_descriptions_map.find(m_current_driver->description)->second; - osd_printf_error("Driver description is a duplicate of %s(%s)\n", core_filename_extract_base(tempstr, match->source_file).c_str(), match->name); + osd_printf_error("Driver description is a duplicate of %s(%s)\n", core_filename_extract_base(match->source_file).c_str(), match->name); } // determine if we are a clone diff --git a/src/emu/video.cpp b/src/emu/video.cpp index 1d7c9096b3a..a9d2442b1ba 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -258,9 +258,9 @@ void video_manager::frame_update(bool debug) // into a string buffer //------------------------------------------------- -std::string &video_manager::speed_text(std::string &str) +std::string video_manager::speed_text() { - str.clear(); + std::string str; // if we're paused, just display Paused bool paused = machine().paused(); diff --git a/src/emu/video.h b/src/emu/video.h index 9eb67b70353..4938cf67f34 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -81,7 +81,7 @@ public: void frame_update(bool debug = false); // current speed helpers - std::string &speed_text(std::string &str); + std::string speed_text(); double speed_percent() const { return m_speed_percent; } // snapshots diff --git a/src/lib/formats/cbm_crt.cpp b/src/lib/formats/cbm_crt.cpp index d169d0c2fd7..6484dbf108c 100644 --- a/src/lib/formats/cbm_crt.cpp +++ b/src/lib/formats/cbm_crt.cpp @@ -122,7 +122,7 @@ static const char * CRT_C64_SLOT_NAMES[_CRT_C64_COUNT] = // cbm_crt_get_card - get slot interface card //------------------------------------------------- -void cbm_crt_get_card(std::string &result, core_file *file) +std::string cbm_crt_get_card(core_file *file) { // read the header cbm_crt_header header; @@ -132,11 +132,10 @@ void cbm_crt_get_card(std::string &result, core_file *file) { UINT16 hardware = pick_integer_be(header.hardware, 0, 2); - result.assign(CRT_C64_SLOT_NAMES[hardware]); - return; + return std::string(CRT_C64_SLOT_NAMES[hardware]); } - result.clear(); + return std::string(); } diff --git a/src/lib/formats/cbm_crt.h b/src/lib/formats/cbm_crt.h index 9be37bc0740..f3cfb6bb164 100644 --- a/src/lib/formats/cbm_crt.h +++ b/src/lib/formats/cbm_crt.h @@ -135,7 +135,7 @@ struct cbm_crt_chip // FUNCTION PROTOTYPES //************************************************************************** -void cbm_crt_get_card(std::string &result, core_file *file); +std::string cbm_crt_get_card(core_file *file); bool cbm_crt_read_header(core_file* file, size_t *roml_size, size_t *romh_size, int *exrom, int *game); bool cbm_crt_read_data(core_file* file, UINT8 *roml, UINT8 *romh); diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp index a2242c133c6..344a2922bfe 100644 --- a/src/lib/util/corefile.cpp +++ b/src/lib/util/corefile.cpp @@ -909,7 +909,7 @@ file_error core_truncate(core_file *f, UINT64 offset) assumptions about path separators -------------------------------------------------*/ -std::string &core_filename_extract_base(std::string &result, const char *name, bool strip_extension) +std::string core_filename_extract_base(const char *name, bool strip_extension) { /* find the start of the name */ const char *start = name + strlen(name); @@ -917,7 +917,7 @@ std::string &core_filename_extract_base(std::string &result, const char *name, b start--; /* copy the rest into an astring */ - result.assign(start); + std::string result(start); /* chop the extension if present */ if (strip_extension) diff --git a/src/lib/util/corefile.h b/src/lib/util/corefile.h index eeb5a8efa22..5266832c374 100644 --- a/src/lib/util/corefile.h +++ b/src/lib/util/corefile.h @@ -125,7 +125,7 @@ file_error core_truncate(core_file *f, UINT64 offset); /* ----- filename utilities ----- */ /* extract the base part of a filename (remove extensions and paths) */ -std::string &core_filename_extract_base(std::string &result, const char *name, bool strip_extension = false); +std::string core_filename_extract_base(const char *name, bool strip_extension = false); /* true if the given filename ends with a particular extension */ int core_filename_ends_with(const char *filename, const char *extension); diff --git a/src/lib/util/corestr.cpp b/src/lib/util/corestr.cpp index 336d788cabb..ce5976869d4 100644 --- a/src/lib/util/corestr.cpp +++ b/src/lib/util/corestr.cpp @@ -217,14 +217,13 @@ int strprintf(std::string &str, const char *format, ...) return retVal; } -std::string strformat(std::string &str, const char *format, ...) +std::string strformat(const char *format, ...) { std::string retVal; va_list ap; va_start(ap, format); - strvprintf(str, format, ap); + strvprintf(retVal, format, ap); va_end(ap); - retVal.assign(str); return retVal; } diff --git a/src/lib/util/corestr.h b/src/lib/util/corestr.h index 519e1edc849..94f13c4061b 100644 --- a/src/lib/util/corestr.h +++ b/src/lib/util/corestr.h @@ -68,7 +68,7 @@ int strvprintf(std::string &str, const char *format, va_list args); int strcatvprintf(std::string &str, const char *format, va_list args); int strprintf(std::string &str, const char *format, ...) ATTR_PRINTF(2, 3); int strcatprintf(std::string &str, const char *format, ...) ATTR_PRINTF(2, 3); -std::string strformat(std::string &str, const char *format, ...) ATTR_PRINTF(2, 3); +std::string strformat(const char *format, ...) ATTR_PRINTF(1, 2); void strdelchr(std::string& str, char chr); void strreplacechr(std::string& str, char ch, char newch); diff --git a/src/lib/util/hashing.cpp b/src/lib/util/hashing.cpp index 785127e01e8..8e85e4a42d2 100644 --- a/src/lib/util/hashing.cpp +++ b/src/lib/util/hashing.cpp @@ -79,12 +79,12 @@ bool sha1_t::from_string(const char *string, int length) // as_string - convert to a string //------------------------------------------------- -const char *sha1_t::as_string(std::string &buffer) const +std::string sha1_t::as_string() const { - buffer.clear(); + std::string buffer; for (auto & elem : m_raw) strcatprintf(buffer, "%02x", elem); - return buffer.c_str(); + return buffer; } @@ -122,12 +122,12 @@ bool md5_t::from_string(const char *string, int length) // as_string - convert to a string //------------------------------------------------- -const char *md5_t::as_string(std::string &buffer) const +std::string md5_t::as_string() const { - buffer.clear(); + std::string buffer; for (auto & elem : m_raw) strcatprintf(buffer, "%02x", elem); - return buffer.c_str(); + return buffer; } @@ -166,10 +166,9 @@ bool crc32_t::from_string(const char *string, int length) // as_string - convert to a string //------------------------------------------------- -const char *crc32_t::as_string(std::string &buffer) const +std::string crc32_t::as_string() const { - strprintf(buffer, "%08x", m_raw); - return buffer.c_str(); + return strformat("%08x", m_raw); } @@ -215,21 +214,18 @@ bool crc16_t::from_string(const char *string, int length) } /** - * @fn const char *crc16_t::as_string(std::string &buffer) const + * @fn std::string crc16_t::as_string() const * * @brief ------------------------------------------------- * as_string - convert to a string * -------------------------------------------------. * - * @param [in,out] buffer The buffer. - * - * @return null if it fails, else a char*. + * @return a std::string. */ -const char *crc16_t::as_string(std::string &buffer) const +std::string crc16_t::as_string() const { - strprintf(buffer, "%04x", m_raw); - return buffer.c_str(); + return strformat("%04x", m_raw); } /** diff --git a/src/lib/util/hashing.h b/src/lib/util/hashing.h index b0de6a5c3c8..51a7da7c694 100644 --- a/src/lib/util/hashing.h +++ b/src/lib/util/hashing.h @@ -34,7 +34,7 @@ struct sha1_t bool operator!=(const sha1_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) != 0; } operator UINT8 *() { return m_raw; } bool from_string(const char *string, int length = -1); - const char *as_string(std::string &buffer) const; + std::string as_string() const; UINT8 m_raw[20]; static const sha1_t null; }; @@ -85,7 +85,7 @@ struct md5_t bool operator!=(const md5_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) != 0; } operator UINT8 *() { return m_raw; } bool from_string(const char *string, int length = -1); - const char *as_string(std::string &buffer) const; + std::string as_string() const; UINT8 m_raw[16]; static const md5_t null; }; @@ -136,7 +136,7 @@ struct crc32_t crc32_t &operator=(const UINT32 crc) { m_raw = crc; return *this; } operator UINT32() const { return m_raw; } bool from_string(const char *string, int length = -1); - const char *as_string(std::string &buffer) const; + std::string as_string() const; UINT32 m_raw; static const crc32_t null; }; @@ -182,7 +182,7 @@ struct crc16_t crc16_t &operator=(const UINT16 crc) { m_raw = crc; return *this; } operator UINT16() const { return m_raw; } bool from_string(const char *string, int length = -1); - const char *as_string(std::string &buffer) const; + std::string as_string() const; UINT16 m_raw; static const crc16_t null; }; diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp index 0e02b7dc735..d7ab454d063 100644 --- a/src/lib/util/options.cpp +++ b/src/lib/util/options.cpp @@ -478,10 +478,10 @@ void core_options::revert(int priority) // the optional diff //------------------------------------------------- -const char *core_options::output_ini(std::string &buffer, const core_options *diff) +std::string core_options::output_ini(const core_options *diff) const { // INI files are complete, so always start with a blank buffer - buffer.clear(); + std::string buffer; int num_valid_headers = 0; int unadorned_index = 0; @@ -534,7 +534,7 @@ const char *core_options::output_ini(std::string &buffer, const core_options *di } } } - return buffer.c_str(); + return buffer; } @@ -542,10 +542,10 @@ const char *core_options::output_ini(std::string &buffer, const core_options *di // output_help - output option help to a string //------------------------------------------------- -const char *core_options::output_help(std::string &buffer) +std::string core_options::output_help() const { // start empty - buffer.clear(); + std::string buffer; // loop over all items for (entry *curentry = m_entrylist.first(); curentry != nullptr; curentry = curentry->next()) @@ -558,7 +558,7 @@ const char *core_options::output_help(std::string &buffer) else if (curentry->description() != nullptr) strcatprintf(buffer,"-%-20s%s\n", curentry->name(), curentry->description()); } - return buffer.c_str(); + return buffer; } @@ -634,15 +634,13 @@ bool core_options::set_value(const char *name, const char *value, int priority, bool core_options::set_value(const char *name, int value, int priority, std::string &error_string) { - std::string tempstr; - strprintf(tempstr,"%d", value); + std::string tempstr = strformat("%d", value); return set_value(name, tempstr.c_str(), priority, error_string); } bool core_options::set_value(const char *name, float value, int priority, std::string &error_string) { - std::string tempstr; - strprintf(tempstr, "%f", (double) value); + std::string tempstr = strformat("%f", (double)value); return set_value(name, tempstr.c_str(), priority, error_string); } diff --git a/src/lib/util/options.h b/src/lib/util/options.h index f193d4a4976..1df89bed6c7 100644 --- a/src/lib/util/options.h +++ b/src/lib/util/options.h @@ -145,8 +145,8 @@ public: void revert(int priority = OPTION_PRIORITY_MAXIMUM); // output - const char *output_ini(std::string &buffer, const core_options *diff = nullptr); - const char *output_help(std::string &buffer); + std::string output_ini(const core_options *diff = nullptr) const; + std::string output_help() const; // reading const char *value(const char *option) const; diff --git a/src/mame/drivers/bfm_sc45_helper.cpp b/src/mame/drivers/bfm_sc45_helper.cpp index 264f9dbe71f..d49c449a230 100644 --- a/src/mame/drivers/bfm_sc45_helper.cpp +++ b/src/mame/drivers/bfm_sc45_helper.cpp @@ -155,10 +155,7 @@ int find_input_strings(running_machine &machine) { for (int j = 0; j < 16; j++) { - char tempstr[32]; - sprintf(tempstr, "IN%d-%d", i, j); - - sc4inputs[i][j].name = tempstr; + sc4inputs[i][j].name = strformat("IN%d-%d", i, j); sc4inputs[i][j].used = false; } } diff --git a/src/mame/drivers/cps3.cpp b/src/mame/drivers/cps3.cpp index 4c76c2ca32a..af0104474a6 100644 --- a/src/mame/drivers/cps3.cpp +++ b/src/mame/drivers/cps3.cpp @@ -772,10 +772,9 @@ void cps3_state::cps3_decrypt_bios() void cps3_state::init_common(void) { // flash roms - std::string tempstr; for (int simmnum = 0; simmnum < 7; simmnum++) for (int chipnum = 0; chipnum < 8; chipnum++) - m_simm[simmnum][chipnum] = machine().device(strformat(tempstr,"simm%d.%d", simmnum + 1, chipnum).c_str()); + m_simm[simmnum][chipnum] = machine().device(strformat("simm%d.%d", simmnum + 1, chipnum).c_str()); m_eeprom = std::make_unique(0x400/4); machine().device("eeprom")->set_base(m_eeprom.get(), 0x400); diff --git a/src/mame/etc/template_cpu.cpp b/src/mame/etc/template_cpu.cpp index eaf99a72996..3f85ad1dddc 100644 --- a/src/mame/etc/template_cpu.cpp +++ b/src/mame/etc/template_cpu.cpp @@ -107,7 +107,7 @@ xxx_cpu_device::xxx_cpu_device(const machine_config &mconfig, const char *tag, d } -void xxx_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) +void xxx_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const { switch (entry.index()) { diff --git a/src/mame/etc/template_cpu.h b/src/mame/etc/template_cpu.h index d174e572f4c..07fb81e6284 100644 --- a/src/mame/etc/template_cpu.h +++ b/src/mame/etc/template_cpu.h @@ -28,26 +28,26 @@ public: protected: // device-level overrides - virtual void device_start(); - virtual void device_reset(); + virtual void device_start() override; + virtual void device_reset() override; // device_execute_interface overrides - virtual UINT32 execute_min_cycles() const { return 1; } - virtual UINT32 execute_max_cycles() const { return 7; } - virtual UINT32 execute_input_lines() const { return 0; } - virtual void execute_run(); - virtual void execute_set_input(int inputnum, int state); + virtual UINT32 execute_min_cycles() const override { return 1; } + virtual UINT32 execute_max_cycles() const override { return 7; } + virtual UINT32 execute_input_lines() const override { return 0; } + virtual void execute_run() override; + virtual void execute_set_input(int inputnum, int state) override; // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_DATA) ? &m_data_config : NULL ); } + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_DATA) ? &m_data_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, std::string &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; // device_disasm_interface overrides - virtual UINT32 disasm_min_opcode_bytes() const { return 4; } - virtual UINT32 disasm_max_opcode_bytes() const { return 4; } - virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); + virtual UINT32 disasm_min_opcode_bytes() const override { return 4; } + virtual UINT32 disasm_max_opcode_bytes() const override { return 4; } + virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; private: address_space_config m_program_config; diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index bf8e4535cdf..e82c75406cc 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -119,12 +119,12 @@ public: const char *keymap_file() const { return value(SDLOPTION_KEYMAP_FILE); } // joystick mapping - const char *joy_index(int index) const { std::string temp; return value(strformat(temp, "%s%d", SDLOPTION_JOYINDEX, index).c_str()); } + const char *joy_index(int index) const { return value(strformat("%s%d", SDLOPTION_JOYINDEX, index).c_str()); } bool sixaxis() const { return bool_value(SDLOPTION_SIXAXIS); } #if (SDLMAME_SDL2) - const char *mouse_index(int index) const { std::string temp; return value(strformat(temp, "%s%d", SDLOPTION_MOUSEINDEX, index).c_str()); } - const char *keyboard_index(int index) const { std::string temp; return value(strformat(temp, "%s%d", SDLOPTION_KEYBINDEX, index).c_str()); } + const char *mouse_index(int index) const { return value(strformat("%s%d", SDLOPTION_MOUSEINDEX, index).c_str()); } + const char *keyboard_index(int index) const { return value(strformat("%s%d", SDLOPTION_KEYBINDEX, index).c_str()); } #endif const char *video_driver() const { return value(SDLOPTION_VIDEODRIVER); } diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp index 75da3c76741..c17e7fa071f 100644 --- a/src/tools/chdman.cpp +++ b/src/tools/chdman.cpp @@ -2406,14 +2406,13 @@ static void do_extract_cd(parameters_t ¶ms) // output the metadata about the track to the TOC file const cdrom_track_info &trackinfo = toc->tracks[tracknum]; - std::string temp; if (mode == MODE_GDI) { - output_track_metadata(mode, output_toc_file, tracknum, trackinfo, core_filename_extract_base(temp, trackbin_name.c_str()).c_str(), discoffs, outputoffs); + output_track_metadata(mode, output_toc_file, tracknum, trackinfo, core_filename_extract_base(trackbin_name.c_str()).c_str(), discoffs, outputoffs); } else { - output_track_metadata(mode, output_toc_file, tracknum, trackinfo, core_filename_extract_base(temp, output_bin_file_str->c_str()).c_str(), discoffs, outputoffs); + output_track_metadata(mode, output_toc_file, tracknum, trackinfo, core_filename_extract_base(output_bin_file_str->c_str()).c_str(), discoffs, outputoffs); } // If this is bin/cue output and the CHD contains subdata, warn the user and don't include