device_image_interface cleanups (nw)

- Replace comparisons of software_entry() or part_entry() with nullptr with loaded_through_softlist() predicate.
- Eliminate the superfluous m_software_info_ptr member. The software_entry() accessor is still provided, but now rarely used.
- Eliminate two of the three arguments to load_software_part.
- Remove some unnecessary auto-typing in ui/inifile.cpp.
This commit is contained in:
AJR 2017-02-27 00:38:50 -05:00
parent 73d399e9e5
commit 2a89da877b
79 changed files with 186 additions and 183 deletions

View File

@ -349,7 +349,7 @@ image_init_result a78_cart_slot_device::call_load()
{ {
uint32_t len; uint32_t len;
if (software_entry() != nullptr) if (loaded_through_softlist())
{ {
const char *pcb_name; const char *pcb_name;
bool has_ram = get_software_region("ram") ? true : false; bool has_ram = get_software_region("ram") ? true : false;

View File

@ -242,7 +242,7 @@ image_init_result a800_cart_slot_device::call_load()
{ {
uint32_t len; uint32_t len;
if (software_entry() != nullptr) if (loaded_through_softlist())
{ {
const char *pcb_name; const char *pcb_name;
len = get_software_region_length("rom"); len = get_software_region_length("rom");

View File

@ -93,7 +93,7 @@ image_init_result adam_expansion_slot_device::call_load()
{ {
size_t size; size_t size;
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
size = length(); size = length();

View File

@ -160,7 +160,7 @@ image_init_result apf_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
uint32_t size = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size > 0x3800) if (size > 0x3800)
{ {
@ -170,12 +170,12 @@ image_init_result apf_cart_slot_device::call_load()
m_cart->rom_alloc(size, tag()); m_cart->rom_alloc(size, tag());
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(m_cart->get_rom_base(), size); fread(m_cart->get_rom_base(), size);
else else
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
m_type = APF_STD; m_type = APF_STD;
// attempt to identify Space Destroyer, which needs 1K of additional RAM // attempt to identify Space Destroyer, which needs 1K of additional RAM

View File

@ -150,16 +150,16 @@ image_init_result arcadia_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
uint32_t len = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
m_cart->rom_alloc(len, tag()); m_cart->rom_alloc(len, tag());
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(m_cart->get_rom_base(), len); fread(m_cart->get_rom_base(), len);
else else
memcpy(m_cart->get_rom_base(), get_software_region("rom"), len); memcpy(m_cart->get_rom_base(), get_software_region("rom"), len);
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
// we need to identify Golf! // we need to identify Golf!
m_type = ARCADIA_STD; m_type = ARCADIA_STD;

View File

@ -150,15 +150,15 @@ image_init_result astrocade_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
uint32_t size = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
m_cart->rom_alloc(size, tag()); m_cart->rom_alloc(size, tag());
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(m_cart->get_rom_base(), size); fread(m_cart->get_rom_base(), size);
else else
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
m_type = ASTROCADE_STD; m_type = ASTROCADE_STD;

View File

@ -120,7 +120,7 @@ image_init_result c64_expansion_slot_device::call_load()
{ {
size_t size; size_t size;
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
size = length(); size = length();

View File

@ -108,7 +108,7 @@ image_init_result cbm2_expansion_slot_device::call_load()
if (m_card) if (m_card)
{ {
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
size = length(); size = length();

View File

@ -163,15 +163,15 @@ image_init_result channelf_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
uint32_t len = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
m_cart->rom_alloc(len, tag()); m_cart->rom_alloc(len, tag());
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(m_cart->get_rom_base(), len); fread(m_cart->get_rom_base(), len);
else else
memcpy(m_cart->get_rom_base(), get_software_region("rom"), len); memcpy(m_cart->get_rom_base(), get_software_region("rom"), len);
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
// we default to "chess" slot because some homebrew programs have been written to run // we default to "chess" slot because some homebrew programs have been written to run
// on PCBs with RAM at $2000-$2800 as Saba Schach! // on PCBs with RAM at $2000-$2800 as Saba Schach!

View File

@ -327,7 +327,7 @@ image_init_result cococart_slot_device::call_load()
if (m_cart) if (m_cart)
{ {
offs_t read_length; offs_t read_length;
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
read_length = fread(m_cart->get_cart_base(), 0x8000); read_length = fread(m_cart->get_cart_base(), 0x8000);
} }

View File

@ -79,10 +79,10 @@ image_init_result colecovision_cartridge_slot_device::call_load()
{ {
if (m_card) if (m_card)
{ {
size_t size = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); size_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
m_card->rom_alloc(size); m_card->rom_alloc(size);
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
fread(m_card->m_rom, size); fread(m_card->m_rom, size);
} }

View File

@ -154,7 +154,7 @@ image_init_result crvision_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
uint32_t size = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size > 0x4800) if (size > 0x4800)
{ {
@ -164,12 +164,12 @@ image_init_result crvision_cart_slot_device::call_load()
m_cart->rom_alloc(size, tag()); m_cart->rom_alloc(size, tag());
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(m_cart->get_rom_base(), size); fread(m_cart->get_rom_base(), size);
else else
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
m_type = CRV_4K; m_type = CRV_4K;

View File

@ -263,12 +263,12 @@ image_init_result base_gb_cart_slot_device::call_load()
if (m_cart) if (m_cart)
{ {
uint32_t offset; uint32_t offset;
uint32_t len = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint8_t *ROM; uint8_t *ROM;
int rambanks = 0; int rambanks = 0;
// From fullpath, check for presence of a header and skip it + check filesize is valid // From fullpath, check for presence of a header and skip it + check filesize is valid
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
if ((len % 0x4000) == 512) if ((len % 0x4000) == 512)
{ {
@ -288,7 +288,7 @@ image_init_result base_gb_cart_slot_device::call_load()
m_cart->rom_alloc(len, tag()); m_cart->rom_alloc(len, tag());
ROM = m_cart->get_rom_base(); ROM = m_cart->get_rom_base();
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(ROM, len); fread(ROM, len);
else else
memcpy(ROM, get_software_region("rom"), len); memcpy(ROM, get_software_region("rom"), len);
@ -298,7 +298,7 @@ image_init_result base_gb_cart_slot_device::call_load()
if (get_mmm01_candidate(ROM, len)) if (get_mmm01_candidate(ROM, len))
offset = len - 0x8000; offset = len - 0x8000;
if (software_entry() != nullptr) if (loaded_through_softlist())
m_type = gb_get_pcb_id(get_feature("slot") ? get_feature("slot") : "rom"); m_type = gb_get_pcb_id(get_feature("slot") ? get_feature("slot") : "rom");
else else
m_type = get_cart_type(ROM + offset, len - offset); m_type = get_cart_type(ROM + offset, len - offset);
@ -312,7 +312,7 @@ image_init_result base_gb_cart_slot_device::call_load()
m_cart->set_additional_wirings(0x0f, -1); m_cart->set_additional_wirings(0x0f, -1);
// setup RAM/NVRAM/RTC/RUMBLE // setup RAM/NVRAM/RTC/RUMBLE
if (software_entry() != nullptr) if (loaded_through_softlist())
{ {
// from softlist we only rely on xml // from softlist we only rely on xml
if (get_software_region("ram")) if (get_software_region("ram"))
@ -413,11 +413,11 @@ image_init_result megaduck_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
uint32_t len = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
m_cart->rom_alloc(len, tag()); m_cart->rom_alloc(len, tag());
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(m_cart->get_rom_base(), len); fread(m_cart->get_rom_base(), len);
else else
memcpy(m_cart->get_rom_base(), get_software_region("rom"), len); memcpy(m_cart->get_rom_base(), get_software_region("rom"), len);

View File

@ -181,7 +181,7 @@ image_init_result gba_cart_slot_device::call_load()
if (m_cart) if (m_cart)
{ {
uint8_t *ROM; uint8_t *ROM;
uint32_t size = (software_entry() != nullptr) ? get_software_region_length("rom") : length(); uint32_t size = loaded_through_softlist() ? get_software_region_length("rom") : length();
if (size > 0x4000000) if (size > 0x4000000)
{ {
seterror(IMAGE_ERROR_UNSPECIFIED, "Attempted loading a cart larger than 64MB"); seterror(IMAGE_ERROR_UNSPECIFIED, "Attempted loading a cart larger than 64MB");
@ -191,7 +191,7 @@ image_init_result gba_cart_slot_device::call_load()
m_cart->rom_alloc(size, tag()); m_cart->rom_alloc(size, tag());
ROM = (uint8_t *)m_cart->get_rom_base(); ROM = (uint8_t *)m_cart->get_rom_base();
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
fread(ROM, size); fread(ROM, size);
m_type = get_cart_type(ROM, size); m_type = get_cart_type(ROM, size);

View File

@ -189,9 +189,9 @@ std::string generic_slot_device::get_default_card_software()
uint32_t generic_slot_device::common_get_size(const char *region) uint32_t generic_slot_device::common_get_size(const char *region)
{ {
// if we are loading from softlist, you have to specify a region // if we are loading from softlist, you have to specify a region
assert((software_entry() == nullptr) || (region != nullptr)); assert(!loaded_through_softlist() || (region != nullptr));
return (software_entry() == nullptr) ? length() : get_software_region_length(region); return !loaded_through_softlist() ? length() : get_software_region_length(region);
} }
/*------------------------------------------------- /*-------------------------------------------------
@ -205,9 +205,9 @@ void generic_slot_device::common_load_rom(uint8_t *ROM, uint32_t len, const char
assert((ROM != nullptr) && (len > 0)); assert((ROM != nullptr) && (len > 0));
// if we are loading from softlist, you have to specify a region // if we are loading from softlist, you have to specify a region
assert((software_entry() == nullptr) || (region != nullptr)); assert(!loaded_through_softlist() || (region != nullptr));
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(ROM, len); fread(ROM, len);
else else
memcpy(ROM, get_software_region(region), len); memcpy(ROM, get_software_region(region), len);

View File

@ -391,7 +391,7 @@ image_init_result intv_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
if (software_entry() == nullptr) if (!loaded_through_softlist())
return load_fullpath(); return load_fullpath();
else else
{ {

View File

@ -171,7 +171,7 @@ image_init_result iq151cart_slot_device::call_load()
if (cart_base != nullptr) if (cart_base != nullptr)
{ {
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
read_length = length(); read_length = length();
fread(m_cart->get_cart_base(), read_length); fread(m_cart->get_cart_base(), read_length);

View File

@ -1352,7 +1352,7 @@ void sc499_ctape_image_device::call_unload()
{ {
m_ctape_data.resize(0); m_ctape_data.resize(0);
// TODO: add save tape on exit? // TODO: add save tape on exit?
//if (software_entry() == nullptr) //if (!loaded_through_softlist())
//{ //{
// fseek(0, SEEK_SET); // fseek(0, SEEK_SET);
// fwrite(m_ctape_data, m_ctape_data.size); // fwrite(m_ctape_data, m_ctape_data.size);

View File

@ -337,7 +337,7 @@ image_init_result kccart_slot_device::call_load()
if (cart_base != nullptr) if (cart_base != nullptr)
{ {
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
read_length = length(); read_length = length();
fread(m_cart->get_cart_base(), read_length); fread(m_cart->get_cart_base(), read_length);

View File

@ -163,10 +163,9 @@ image_init_result m5_cart_slot_device::call_load()
{ {
m_type=M5_STD; m_type=M5_STD;
if (software_entry() != nullptr) if (loaded_through_softlist())
{ {
const char *pcb_name = get_feature("slot"); const char *pcb_name = get_feature("slot");
//software_info *name=m_software_info_ptr;
if (pcb_name) //is it ram cart? if (pcb_name) //is it ram cart?
m_type = m5_get_pcb_id(m_full_software_name.c_str()); m_type = m5_get_pcb_id(m_full_software_name.c_str());
else else
@ -175,7 +174,7 @@ image_init_result m5_cart_slot_device::call_load()
if (m_type == M5_STD || m_type>2) //carts with roms if (m_type == M5_STD || m_type>2) //carts with roms
{ {
uint32_t size = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size > 0x5000 && m_type == M5_STD) if (size > 0x5000 && m_type == M5_STD)
{ {
@ -185,7 +184,7 @@ image_init_result m5_cart_slot_device::call_load()
m_cart->rom_alloc(size, tag()); m_cart->rom_alloc(size, tag());
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(m_cart->get_rom_base(), size); fread(m_cart->get_rom_base(), size);
else else
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);

View File

@ -332,7 +332,7 @@ image_init_result base_md_cart_slot_device::call_load()
// STEP 1: load the file image and keep a copy for later banking // STEP 1: load the file image and keep a copy for later banking
// STEP 2: identify the cart type // STEP 2: identify the cart type
// The two steps are carried out differently if we are loading from a list or not // The two steps are carried out differently if we are loading from a list or not
if (software_entry() == nullptr) if (!loaded_through_softlist())
res = load_nonlist(); res = load_nonlist();
else else
res = load_list(); res = load_list();
@ -1008,7 +1008,7 @@ void base_md_cart_slot_device::file_logging(uint8_t *ROM8, uint32_t rom_len, uin
logerror("FILE DETAILS\n"); logerror("FILE DETAILS\n");
logerror("============\n"); logerror("============\n");
logerror("Name: %s\n", basename()); logerror("Name: %s\n", basename());
logerror("File Size: 0x%08x\n", (software_entry() == nullptr) ? (int)length() : (int)get_software_region_length("rom")); logerror("File Size: 0x%08x\n", !loaded_through_softlist() ? (int)length() : (int)get_software_region_length("rom"));
logerror("Detected type: %s\n", md_get_slot(m_type)); logerror("Detected type: %s\n", md_get_slot(m_type));
logerror("ROM (Allocated) Size: 0x%X\n", rom_len); logerror("ROM (Allocated) Size: 0x%X\n", rom_len);
logerror("NVRAM: %s\n", nvram_len ? "Yes" : "No"); logerror("NVRAM: %s\n", nvram_len ? "Yes" : "No");

View File

@ -106,7 +106,7 @@ image_init_result msx_slot_cartridge_device::call_load()
{ {
if ( m_cartridge ) if ( m_cartridge )
{ {
if ( software_entry() ) if (loaded_through_softlist())
{ {
uint32_t length; uint32_t length;

View File

@ -239,7 +239,7 @@ image_init_result neogeo_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
if (software_entry() != nullptr) if (loaded_through_softlist())
{ {
uint16_t *ROM16; uint16_t *ROM16;
uint8_t *ROM8; uint8_t *ROM8;

View File

@ -102,7 +102,7 @@ image_init_result nes_aladdin_slot_device::call_load()
if (!ROM) if (!ROM)
return image_init_result::FAIL; return image_init_result::FAIL;
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
if (length() != 0x20010 && length() != 0x40010) if (length() != 0x20010 && length() != 0x40010)
return image_init_result::FAIL; return image_init_result::FAIL;

View File

@ -102,7 +102,7 @@ image_init_result nes_datach_slot_device::call_load()
return image_init_result::FAIL; return image_init_result::FAIL;
// Existing Datach carts are all 256K, so we only load files of this size // Existing Datach carts are all 256K, so we only load files of this size
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
if (length() != 0x40000 && length() != 0x40010) if (length() != 0x40000 && length() != 0x40010)
return image_init_result::FAIL; return image_init_result::FAIL;

View File

@ -105,8 +105,8 @@ image_init_result nes_kstudio_slot_device::call_load()
if (!ROM) if (!ROM)
return image_init_result::FAIL; return image_init_result::FAIL;
// Existing exapnsion carts are all 128K, so we only load files of this size // Existing expansion carts are all 128K, so we only load files of this size
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
if (length() != 0x20000) if (length() != 0x20000)
return image_init_result::FAIL; return image_init_result::FAIL;

View File

@ -833,7 +833,7 @@ image_init_result nes_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
char magic[4]; char magic[4];

View File

@ -85,7 +85,7 @@ image_init_result nes_ntb_slot_device::call_load()
if (!ROM) if (!ROM)
return image_init_result::FAIL; return image_init_result::FAIL;
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
if (length() != 0x4000) if (length() != 0x4000)
return image_init_result::FAIL; return image_init_result::FAIL;

View File

@ -162,15 +162,15 @@ image_init_result o2_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
uint32_t size = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
m_cart->rom_alloc(size, tag()); m_cart->rom_alloc(size, tag());
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(m_cart->get_rom_base(), size); fread(m_cart->get_rom_base(), size);
else else
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
m_type = O2_STD; m_type = O2_STD;
if (size == 12288) if (size == 12288)

View File

@ -227,11 +227,11 @@ image_init_result pce_cart_slot_device::call_load()
if (m_cart) if (m_cart)
{ {
uint32_t offset; uint32_t offset;
uint32_t len = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint8_t *ROM; uint8_t *ROM;
// From fullpath, check for presence of a header and skip it // From fullpath, check for presence of a header and skip it
if (software_entry() == nullptr && (len % 0x4000) == 512) if (!loaded_through_softlist() && (len % 0x4000) == 512)
{ {
logerror("Rom-header found, skipping\n"); logerror("Rom-header found, skipping\n");
offset = 512; offset = 512;
@ -242,7 +242,7 @@ image_init_result pce_cart_slot_device::call_load()
m_cart->rom_alloc(len, tag()); m_cart->rom_alloc(len, tag());
ROM = m_cart->get_rom_base(); ROM = m_cart->get_rom_base();
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(ROM, len); fread(ROM, len);
else else
memcpy(ROM, get_software_region("rom"), len); memcpy(ROM, get_software_region("rom"), len);
@ -263,7 +263,7 @@ image_init_result pce_cart_slot_device::call_load()
m_cart->rom_map_setup(len); m_cart->rom_map_setup(len);
if (software_entry() == nullptr) if (!loaded_through_softlist())
m_type = get_cart_type(ROM, len); m_type = get_cart_type(ROM, len);
else else
{ {

View File

@ -125,7 +125,7 @@ image_init_result plus4_expansion_slot_device::call_load()
{ {
if (m_card) if (m_card)
{ {
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
// TODO // TODO
} }

View File

@ -72,7 +72,7 @@ image_init_result portfolio_memory_card_slot_t::call_load()
{ {
if (m_card) if (m_card)
{ {
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
fread(m_card->m_rom, length()); fread(m_card->m_rom, length());
} }

View File

@ -82,7 +82,7 @@ image_init_result ql_rom_cartridge_slot_t::call_load()
{ {
size_t size; size_t size;
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
size = length(); size = length();

View File

@ -149,18 +149,18 @@ image_init_result sat_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
bool is_rom = ((software_entry() == nullptr) || ((software_entry() != nullptr) && get_software_region("rom"))); bool is_rom = (!loaded_through_softlist() || (loaded_through_softlist() && get_software_region("rom")));
if (is_rom) if (is_rom)
{ {
// from fullpath, only ROM carts // from fullpath, only ROM carts
uint32_t len = (software_entry() != nullptr) ? get_software_region_length("rom") : length(); uint32_t len = loaded_through_softlist() ? get_software_region_length("rom") : length();
uint32_t *ROM; uint32_t *ROM;
m_cart->rom_alloc(len, tag()); m_cart->rom_alloc(len, tag());
ROM = m_cart->get_rom_base(); ROM = m_cart->get_rom_base();
if (software_entry() != nullptr) if (loaded_through_softlist())
memcpy(ROM, get_software_region("rom"), len); memcpy(ROM, get_software_region("rom"), len);
else else
fread(ROM, len); fread(ROM, len);

View File

@ -165,8 +165,8 @@ image_init_result scv_cart_slot_device::call_load()
if (m_cart) if (m_cart)
{ {
uint8_t *ROM; uint8_t *ROM;
uint32_t len = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
bool has_ram = (software_entry() != nullptr) && get_software_region("ram"); bool has_ram = loaded_through_softlist() && get_software_region("ram");
if (len > 0x20000) if (len > 0x20000)
{ {
@ -180,12 +180,12 @@ image_init_result scv_cart_slot_device::call_load()
ROM = m_cart->get_rom_base(); ROM = m_cart->get_rom_base();
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(ROM, len); fread(ROM, len);
else else
memcpy(ROM, get_software_region("rom"), len); memcpy(ROM, get_software_region("rom"), len);
if (software_entry() == nullptr) if (!loaded_through_softlist())
m_type = get_cart_type(ROM, len); m_type = get_cart_type(ROM, len);
else else
{ {

View File

@ -271,7 +271,7 @@ void sega8_cart_slot_device::set_lphaser_xoffset( uint8_t *rom, int size )
void sega8_cart_slot_device::setup_ram() void sega8_cart_slot_device::setup_ram()
{ {
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
if (m_type == SEGA8_CASTLE) if (m_type == SEGA8_CASTLE)
{ {
@ -336,7 +336,7 @@ image_init_result sega8_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
uint32_t len = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint32_t offset = 0; uint32_t offset = 0;
uint8_t *ROM; uint8_t *ROM;
@ -360,7 +360,7 @@ image_init_result sega8_cart_slot_device::call_load()
m_cart->rom_alloc(len, tag()); m_cart->rom_alloc(len, tag());
ROM = m_cart->get_rom_base(); ROM = m_cart->get_rom_base();
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
fseek(offset, SEEK_SET); fseek(offset, SEEK_SET);
fread(ROM, len); fread(ROM, len);
@ -372,7 +372,7 @@ image_init_result sega8_cart_slot_device::call_load()
if (verify_cart(ROM, len) != image_verify_result::PASS) if (verify_cart(ROM, len) != image_verify_result::PASS)
logerror("Warning loading image: verify_cart failed\n"); logerror("Warning loading image: verify_cart failed\n");
if (software_entry() != nullptr) if (loaded_through_softlist())
m_type = sega8_get_pcb_id(get_feature("slot") ? get_feature("slot") : "rom"); m_type = sega8_get_pcb_id(get_feature("slot") ? get_feature("slot") : "rom");
else else
m_type = get_cart_type(ROM, len); m_type = get_cart_type(ROM, len);
@ -382,7 +382,7 @@ image_init_result sega8_cart_slot_device::call_load()
setup_ram(); setup_ram();
// Check for gamegear cartridges with PIN 42 set to SMS mode // Check for gamegear cartridges with PIN 42 set to SMS mode
if (software_entry() != nullptr) if (loaded_through_softlist())
{ {
const char *pin_42 = get_feature("pin_42"); const char *pin_42 = get_feature("pin_42");
if (pin_42 && !strcmp(pin_42, "sms_mode")) if (pin_42 && !strcmp(pin_42, "sms_mode"))
@ -720,7 +720,7 @@ void sega8_cart_slot_device::internal_header_logging(uint8_t *ROM, uint32_t len,
logerror("FILE DETAILS\n" ); logerror("FILE DETAILS\n" );
logerror("============\n" ); logerror("============\n" );
logerror("Name: %s\n", basename()); logerror("Name: %s\n", basename());
logerror("File Size: 0x%08x\n", (software_entry() == nullptr) ? (int)length() : (int)get_software_region_length("rom")); logerror("File Size: 0x%08x\n", !loaded_through_softlist() ? (int)length() : (int)get_software_region_length("rom"));
logerror("Detected type: %s\n", sega8_get_slot(m_type)); logerror("Detected type: %s\n", sega8_get_slot(m_type));
logerror("ROM (Allocated) Size: 0x%X\n", len); logerror("ROM (Allocated) Size: 0x%X\n", len);
logerror("RAM: %s\n", nvram_len ? "Yes" : "No"); logerror("RAM: %s\n", nvram_len ? "Yes" : "No");

View File

@ -609,7 +609,7 @@ image_init_result base_sns_cart_slot_device::call_load()
const char *slot_name; const char *slot_name;
/* Check for a header (512 bytes), and skip it if found */ /* Check for a header (512 bytes), and skip it if found */
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
uint32_t tmplen = length(); uint32_t tmplen = length();
std::vector<uint8_t> tmpROM(tmplen); std::vector<uint8_t> tmpROM(tmplen);
@ -618,11 +618,11 @@ image_init_result base_sns_cart_slot_device::call_load()
fseek(offset, SEEK_SET); fseek(offset, SEEK_SET);
} }
len = (software_entry() == nullptr) ? (length() - offset) : get_software_region_length("rom"); len = !loaded_through_softlist() ? (length() - offset) : get_software_region_length("rom");
m_cart->rom_alloc(len, tag()); m_cart->rom_alloc(len, tag());
ROM = m_cart->get_rom_base(); ROM = m_cart->get_rom_base();
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(ROM, len); fread(ROM, len);
else else
memcpy(ROM, get_software_region("rom"), len); memcpy(ROM, get_software_region("rom"), len);
@ -630,7 +630,7 @@ image_init_result base_sns_cart_slot_device::call_load()
m_cart->rom_map_setup(len); m_cart->rom_map_setup(len);
// check for on-cart CPU bios // check for on-cart CPU bios
if (software_entry() != nullptr) if (loaded_through_softlist())
{ {
if (get_software_region("addon")) if (get_software_region("addon"))
{ {
@ -640,7 +640,7 @@ image_init_result base_sns_cart_slot_device::call_load()
} }
// get pcb type // get pcb type
if (software_entry() == nullptr) if (!loaded_through_softlist())
get_cart_type_addon(ROM, len, m_type, m_addon); get_cart_type_addon(ROM, len, m_type, m_addon);
else else
{ {
@ -653,7 +653,7 @@ image_init_result base_sns_cart_slot_device::call_load()
m_type = SNES_DSP_2MB; m_type = SNES_DSP_2MB;
} }
if (software_entry() == nullptr) if (!loaded_through_softlist())
setup_addon_from_fullpath(); setup_addon_from_fullpath();
// in carts with an add-on CPU having internal dump, this speeds up access to the internal rom // in carts with an add-on CPU having internal dump, this speeds up access to the internal rom
@ -845,7 +845,7 @@ void base_sns_cart_slot_device::setup_nvram()
{ {
uint8_t *ROM = (uint8_t *)m_cart->get_rom_base(); uint8_t *ROM = (uint8_t *)m_cart->get_rom_base();
uint32_t size = 0; uint32_t size = 0;
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
int hilo_mode = snes_find_hilo_mode(this, ROM, m_cart->get_rom_size()); int hilo_mode = snes_find_hilo_mode(this, ROM, m_cart->get_rom_size());
uint8_t sram_size = (m_type == SNES_SFX) ? (ROM[0x00ffbd] & 0x07) : (ROM[hilo_mode + 0x18] & 0x07); uint8_t sram_size = (m_type == SNES_SFX) ? (ROM[0x00ffbd] & 0x07) : (ROM[hilo_mode + 0x18] & 0x07);

View File

@ -163,8 +163,8 @@ image_init_result vboy_cart_slot_device::call_load()
if (m_cart) if (m_cart)
{ {
uint8_t *ROM; uint8_t *ROM;
uint32_t len = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
bool has_eeprom = (software_entry() != nullptr) && get_software_region("eeprom"); bool has_eeprom = loaded_through_softlist() && get_software_region("eeprom");
if (len > 0x200000) if (len > 0x200000)
{ {
@ -180,7 +180,7 @@ image_init_result vboy_cart_slot_device::call_load()
ROM = (uint8_t *)m_cart->get_rom_base(); ROM = (uint8_t *)m_cart->get_rom_base();
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(ROM, len); fread(ROM, len);
else else
memcpy(ROM, get_software_region("rom"), len); memcpy(ROM, get_software_region("rom"), len);
@ -189,7 +189,7 @@ image_init_result vboy_cart_slot_device::call_load()
if (len < 0x100000) { memcpy(ROM + 0x080000, ROM, 0x080000); } if (len < 0x100000) { memcpy(ROM + 0x080000, ROM, 0x080000); }
if (len < 0x200000) { memcpy(ROM + 0x100000, ROM, 0x100000); } if (len < 0x200000) { memcpy(ROM + 0x100000, ROM, 0x100000); }
if (software_entry() == nullptr) if (!loaded_through_softlist())
m_type = vboy_get_pcb_id("vb_rom"); m_type = vboy_get_pcb_id("vb_rom");
else else
{ {

View File

@ -174,7 +174,7 @@ image_init_result vc4000_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
uint32_t size = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size > 0x1800) if (size > 0x1800)
{ {
@ -184,12 +184,12 @@ image_init_result vc4000_cart_slot_device::call_load()
m_cart->rom_alloc(size, tag()); m_cart->rom_alloc(size, tag());
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(m_cart->get_rom_base(), size); fread(m_cart->get_rom_base(), size);
else else
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
m_type = VC4000_STD; m_type = VC4000_STD;
// attempt to identify the non-standard types // attempt to identify the non-standard types

View File

@ -189,7 +189,7 @@ image_init_result vcs_cart_slot_device::call_load()
uint8_t *ROM; uint8_t *ROM;
uint32_t len; uint32_t len;
if (software_entry() != nullptr) if (loaded_through_softlist())
len = get_software_region_length("rom"); len = get_software_region_length("rom");
else else
len = length(); len = length();
@ -219,7 +219,7 @@ image_init_result vcs_cart_slot_device::call_load()
m_cart->rom_alloc(len, tag()); m_cart->rom_alloc(len, tag());
ROM = m_cart->get_rom_base(); ROM = m_cart->get_rom_base();
if (software_entry() != nullptr) if (loaded_through_softlist())
{ {
const char *pcb_name; const char *pcb_name;
bool has_ram = get_software_region("ram") ? true : false; bool has_ram = get_software_region("ram") ? true : false;

View File

@ -152,7 +152,7 @@ image_init_result vectrex_cart_slot_device::call_load()
{ {
if (m_cart) if (m_cart)
{ {
uint32_t size = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint8_t *ROM; uint8_t *ROM;
if (size > 0x10000) if (size > 0x10000)
@ -164,7 +164,7 @@ image_init_result vectrex_cart_slot_device::call_load()
m_cart->rom_alloc((size < 0x1000) ? 0x1000 : size, tag()); m_cart->rom_alloc((size < 0x1000) ? 0x1000 : size, tag());
ROM = m_cart->get_rom_base(); ROM = m_cart->get_rom_base();
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(ROM, size); fread(ROM, size);
else else
memcpy(ROM, get_software_region("rom"), size); memcpy(ROM, get_software_region("rom"), size);

View File

@ -115,7 +115,7 @@ image_init_result vic10_expansion_slot_device::call_load()
{ {
size_t size; size_t size;
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
size = length(); size = length();

View File

@ -112,7 +112,7 @@ image_init_result vic20_expansion_slot_device::call_load()
{ {
if (m_card) if (m_card)
{ {
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
if (is_filetype("20")) fread(m_card->m_blk1, 0x2000); if (is_filetype("20")) fread(m_card->m_blk1, 0x2000);
else if (is_filetype("40")) fread(m_card->m_blk2, 0x2000); else if (is_filetype("40")) fread(m_card->m_blk2, 0x2000);

View File

@ -119,7 +119,7 @@ image_init_result videobrain_expansion_slot_device::call_load()
{ {
size_t size; size_t size;
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
size = length(); size = length();

View File

@ -165,18 +165,18 @@ image_init_result ws_cart_slot_device::call_load()
if (m_cart) if (m_cart)
{ {
uint8_t *ROM; uint8_t *ROM;
uint32_t size = (software_entry() == nullptr) ? length() : get_software_region_length("rom"); uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint32_t nvram_size = 0; uint32_t nvram_size = 0;
m_cart->rom_alloc(size, tag()); m_cart->rom_alloc(size, tag());
ROM = m_cart->get_rom_base(); ROM = m_cart->get_rom_base();
if (software_entry() == nullptr) if (!loaded_through_softlist())
fread(ROM, size); fread(ROM, size);
else else
memcpy(ROM, get_software_region("rom"), size); memcpy(ROM, get_software_region("rom"), size);
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
int chunks = size / 0x10000; int chunks = size / 0x10000;
// get cart type and nvram length // get cart type and nvram length

View File

@ -125,7 +125,7 @@ image_init_result z88cart_slot_device::call_load()
if (cart_base != nullptr) if (cart_base != nullptr)
{ {
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
read_length = length(); read_length = length();
fread(cart_base + (m_cart->get_cart_size() - read_length), read_length); fread(cart_base + (m_cart->get_cart_size() - read_length), read_length);

View File

@ -94,7 +94,7 @@ image_init_result cdrom_image_device::call_load()
if (m_cdrom_handle) if (m_cdrom_handle)
cdrom_close(m_cdrom_handle); cdrom_close(m_cdrom_handle);
if (software_entry() == nullptr) if (!loaded_through_softlist())
{ {
if (is_filetype("chd") && is_loaded()) { if (is_filetype("chd") && is_loaded()) {
err = m_self_chd.open( image_core_file() ); /* CDs are never writeable */ err = m_self_chd.open( image_core_file() ); /* CDs are never writeable */

View File

@ -214,7 +214,7 @@ image_init_result diablo_image_device::internal_load_dsk()
hard_disk_close(m_hard_disk_handle); hard_disk_close(m_hard_disk_handle);
/* open the CHD file */ /* open the CHD file */
if (software_entry() != nullptr) if (loaded_through_softlist())
{ {
m_chd = device().machine().rom_load().get_disk_handle(device().subtag("harddriv").c_str()); m_chd = device().machine().rom_load().get_disk_handle(device().subtag("harddriv").c_str());
} }

View File

@ -244,7 +244,7 @@ image_init_result harddisk_image_device::internal_load_hd()
} }
/* open the CHD file */ /* open the CHD file */
if (software_entry() != nullptr) if (loaded_through_softlist())
{ {
m_chd = machine().rom_load().get_disk_handle(device().subtag("harddriv").c_str()); m_chd = machine().rom_load().get_disk_handle(device().subtag("harddriv").c_str());
} }

View File

@ -89,7 +89,6 @@ device_image_interface::device_image_interface(const machine_config &mconfig, de
m_err(), m_err(),
m_file(), m_file(),
m_mame_file(), m_mame_file(),
m_software_info_ptr(nullptr),
m_software_part_ptr(nullptr), m_software_part_ptr(nullptr),
m_supported(0), m_supported(0),
m_readonly(false), m_readonly(false),
@ -427,6 +426,17 @@ const std::string &device_image_interface::working_directory()
} }
//-------------------------------------------------
// software_entry - return a pointer to the
// software_info structure from the softlist
//-------------------------------------------------
const software_info *device_image_interface::software_entry() const
{
return (m_software_part_ptr == nullptr) ? nullptr : &m_software_part_ptr->info();
}
//------------------------------------------------- //-------------------------------------------------
// get_software_region // get_software_region
//------------------------------------------------- //-------------------------------------------------
@ -435,7 +445,7 @@ u8 *device_image_interface::get_software_region(const char *tag)
{ {
char full_tag[256]; char full_tag[256];
if ( m_software_info_ptr == nullptr || m_software_part_ptr == nullptr ) if (!loaded_through_softlist())
return nullptr; return nullptr;
sprintf( full_tag, "%s:%s", device().tag(), tag ); sprintf( full_tag, "%s:%s", device().tag(), tag );
@ -536,7 +546,7 @@ void device_image_interface::image_checkhash()
return; return;
// Skip calculating the hash when we have an image mounted through a software list // Skip calculating the hash when we have an image mounted through a software list
if ( m_software_info_ptr ) if (loaded_through_softlist())
return; return;
// retrieve the partial hash func // retrieve the partial hash func
@ -700,7 +710,6 @@ bool device_image_interface::is_loaded()
return (m_file != nullptr); return (m_file != nullptr);
} }
//------------------------------------------------- //-------------------------------------------------
// image_error_from_file_error - converts an image // image_error_from_file_error - converts an image
// error to a file error // error to a file error
@ -1081,8 +1090,7 @@ image_init_result device_image_interface::load_software(const std::string &softw
m_is_loading = true; m_is_loading = true;
// Check if there's a software list defined for this device and use that if we're not creating an image // Check if there's a software list defined for this device and use that if we're not creating an image
std::string list_name; bool softload = load_software_part(software_identifier);
bool softload = load_software_part(software_identifier, m_software_part_ptr, &list_name);
if (!softload) if (!softload)
{ {
m_is_loading = false; m_is_loading = false;
@ -1090,8 +1098,6 @@ image_init_result device_image_interface::load_software(const std::string &softw
} }
// set up softlist stuff // set up softlist stuff
m_software_info_ptr = &m_software_part_ptr->info();
m_software_list_name = std::move(list_name);
m_full_software_name = m_software_part_ptr->info().shortname(); m_full_software_name = m_software_part_ptr->info().shortname();
// specify image name with softlist-derived names // specify image name with softlist-derived names
@ -1107,23 +1113,22 @@ image_init_result device_image_interface::load_software(const std::string &softw
if (read_only && !strcmp(read_only, "true")) if (read_only && !strcmp(read_only, "true"))
{ {
// Copy some image information when we have been loaded through a software list // Copy some image information when we have been loaded through a software list
if (m_software_info_ptr) software_info &swinfo = m_software_part_ptr->info();
{
// sanitize
if (m_software_info_ptr->longname().empty() || m_software_info_ptr->publisher().empty() || m_software_info_ptr->year().empty())
fatalerror("Each entry in an XML list must have all of the following fields: description, publisher, year!\n");
// store // sanitize
m_longname = m_software_info_ptr->longname(); if (swinfo.longname().empty() || swinfo.publisher().empty() || swinfo.year().empty())
m_manufacturer = m_software_info_ptr->publisher(); fatalerror("Each entry in an XML list must have all of the following fields: description, publisher, year!\n");
m_year = m_software_info_ptr->year();
// set file type // store
std::string filename = (m_mame_file != nullptr) && (m_mame_file->filename() != nullptr) m_longname = swinfo.longname();
m_manufacturer = swinfo.publisher();
m_year = swinfo.year();
// set file type
std::string filename = (m_mame_file != nullptr) && (m_mame_file->filename() != nullptr)
? m_mame_file->filename() ? m_mame_file->filename()
: ""; : "";
m_filetype = core_filename_extract_extension(filename, true); m_filetype = core_filename_extract_extension(filename, true);
}
} }
// call finish_load if necessary // call finish_load if necessary
@ -1158,7 +1163,7 @@ bool device_image_interface::open_image_file(emu_options &options)
set_init_phase(); set_init_phase();
if (load_internal(path, false, 0, nullptr, true) == image_init_result::PASS) if (load_internal(path, false, 0, nullptr, true) == image_init_result::PASS)
{ {
if (software_entry()==nullptr) return true; if (!loaded_through_softlist()) return true;
} }
} }
return false; return false;
@ -1260,7 +1265,6 @@ void device_image_interface::clear()
m_filetype.clear(); m_filetype.clear();
m_full_software_name.clear(); m_full_software_name.clear();
m_software_info_ptr = nullptr;
m_software_part_ptr = nullptr; m_software_part_ptr = nullptr;
m_software_list_name.clear(); m_software_list_name.clear();
} }
@ -1272,7 +1276,7 @@ void device_image_interface::clear()
void device_image_interface::unload() void device_image_interface::unload()
{ {
if (is_loaded() || m_software_info_ptr) if (is_loaded() || loaded_through_softlist())
{ {
call_unload(); call_unload();
} }
@ -1406,12 +1410,12 @@ const software_list_loader &device_image_interface::get_software_list_loader() c
// sw_info and sw_part are also set. // sw_info and sw_part are also set.
//------------------------------------------------- //-------------------------------------------------
bool device_image_interface::load_software_part(const std::string &identifier, const software_part *&swpart, std::string *list_name) bool device_image_interface::load_software_part(const std::string &identifier)
{ {
// if no match has been found, we suggest similar shortnames // if no match has been found, we suggest similar shortnames
software_list_device *swlist; software_list_device *swlist;
swpart = find_software_item(identifier, true, &swlist); m_software_part_ptr = find_software_item(identifier, true, &swlist);
if (swpart == nullptr) if (m_software_part_ptr == nullptr)
{ {
software_list_device::display_matches(device().machine().config(), image_interface(), identifier); software_list_device::display_matches(device().machine().config(), image_interface(), identifier);
return false; return false;
@ -1422,33 +1426,33 @@ bool device_image_interface::load_software_part(const std::string &identifier, c
set_init_phase(); set_init_phase();
// Load the software part // Load the software part
const char *swname = swpart->info().shortname().c_str(); const char *swname = m_software_part_ptr->info().shortname().c_str();
const rom_entry *start_entry = swpart->romdata().data(); const rom_entry *start_entry = m_software_part_ptr->romdata().data();
const software_list_loader &loader = get_software_list_loader(); const software_list_loader &loader = get_software_list_loader();
bool result = loader.load_software(*this, *swlist, swname, start_entry); bool result = loader.load_software(*this, *swlist, swname, start_entry);
#ifdef UNUSED_VARIABLE #ifdef UNUSED_VARIABLE
// Tell the world which part we actually loaded // Tell the world which part we actually loaded
std::string full_sw_name = string_format("%s:%s:%s", swlist.list_name(), swpart->info().shortname(), swpart->name()); std::string full_sw_name = string_format("%s:%s:%s", swlist->list_name(), m_software_part_ptr->info().shortname(), m_software_part_ptr->name());
#endif #endif
// check compatibility // check compatibility
switch (swlist->is_compatible(*swpart)) switch (swlist->is_compatible(*m_software_part_ptr))
{ {
case SOFTWARE_IS_COMPATIBLE: case SOFTWARE_IS_COMPATIBLE:
break; break;
case SOFTWARE_IS_INCOMPATIBLE: case SOFTWARE_IS_INCOMPATIBLE:
swlist->popmessage("WARNING! the set %s might not work on this system due to incompatible filter(s) '%s'\n", swpart->info().shortname(), swlist->filter()); swlist->popmessage("WARNING! the set %s might not work on this system due to incompatible filter(s) '%s'\n", m_software_part_ptr->info().shortname(), swlist->filter());
break; break;
case SOFTWARE_NOT_COMPATIBLE: case SOFTWARE_NOT_COMPATIBLE:
swlist->popmessage("WARNING! the set %s might not work on this system due to missing filter(s) '%s'\n", swpart->info().shortname(), swlist->filter()); swlist->popmessage("WARNING! the set %s might not work on this system due to missing filter(s) '%s'\n", m_software_part_ptr->info().shortname(), swlist->filter());
break; break;
} }
// check requirements and load those images // check requirements and load those images
const char *requirement = swpart->feature("requirement"); const char *requirement = m_software_part_ptr->feature("requirement");
if (requirement != nullptr) if (requirement != nullptr)
{ {
const software_part *req_swpart = find_software_item(requirement, false); const software_part *req_swpart = find_software_item(requirement, false);
@ -1462,8 +1466,8 @@ bool device_image_interface::load_software_part(const std::string &identifier, c
} }
} }
} }
if (list_name != nullptr)
*list_name = swlist->list_name(); m_software_list_name = swlist->list_name();
return result; return result;
} }

View File

@ -199,10 +199,10 @@ public:
const std::string &year() const { return m_year; } const std::string &year() const { return m_year; }
u32 supported() const { return m_supported; } u32 supported() const { return m_supported; }
const software_info *software_entry() const { return m_software_info_ptr; } const software_info *software_entry() const;
const software_part *part_entry() const { return m_software_part_ptr; } const software_part *part_entry() const { return m_software_part_ptr; }
const char *software_list_name() const { return m_software_list_name.c_str(); } const char *software_list_name() const { return m_software_list_name.c_str(); }
bool loaded_through_softlist() const { return m_software_info_ptr != nullptr; } bool loaded_through_softlist() const { return m_software_part_ptr != nullptr; }
void set_working_directory(const char *working_directory) { m_working_directory = working_directory; } void set_working_directory(const char *working_directory) { m_working_directory = working_directory; }
const std::string &working_directory(); const std::string &working_directory();
@ -275,7 +275,7 @@ protected:
void update_names(const device_type device_type = nullptr, const char *inst = nullptr, const char *brief = nullptr); void update_names(const device_type device_type = nullptr, const char *inst = nullptr, const char *brief = nullptr);
const software_part *find_software_item(const std::string &identifier, bool restrict_to_interface, software_list_device **device = nullptr) const; const software_part *find_software_item(const std::string &identifier, bool restrict_to_interface, software_list_device **device = nullptr) const;
bool load_software_part(const std::string &identifier, const software_part *&swpart, std::string *list_name = nullptr); bool load_software_part(const std::string &identifier);
std::string software_get_default_slot(const char *default_card_slot) const; std::string software_get_default_slot(const char *default_card_slot) const;
void add_format(std::unique_ptr<image_device_format> &&format); void add_format(std::unique_ptr<image_device_format> &&format);
@ -301,7 +301,6 @@ protected:
// Software information // Software information
std::string m_full_software_name; std::string m_full_software_name;
const software_info *m_software_info_ptr;
const software_part *m_software_part_ptr; const software_part *m_software_part_ptr;
std::string m_software_list_name; std::string m_software_list_name;

View File

@ -1159,7 +1159,7 @@ void cheat_manager::reload()
// if we are loading through a software list, try to load softlist_name/shortname.xml // if we are loading through a software list, try to load softlist_name/shortname.xml
// this allows the coexistence of arcade cheats with cheats for home conversions which // this allows the coexistence of arcade cheats with cheats for home conversions which
// have the same shortname // have the same shortname
if (image.software_entry() != nullptr) if (image.loaded_through_softlist())
{ {
load_cheats(string_format("%s%s%s", image.software_list_name(), PATH_SEPARATOR, image.basename()).c_str()); load_cheats(string_format("%s%s%s", image.software_list_name(), PATH_SEPARATOR, image.basename()).c_str());
break; break;

View File

@ -78,7 +78,7 @@ void menu_file_manager::fill_image_line(device_image_interface *img, std::string
filename.assign(img->basename()); filename.assign(img->basename());
// if the image has been loaded through softlist, also show the loaded part // if the image has been loaded through softlist, also show the loaded part
if (img->part_entry() != nullptr) if (img->loaded_through_softlist())
{ {
const software_part *tmp = img->part_entry(); const software_part *tmp = img->part_entry();
if (!tmp->name().empty()) if (!tmp->name().empty())

View File

@ -411,7 +411,7 @@ void menu_image_info::image_info(device_image_interface *image)
item_append(image->brief_instance_name(), image->basename(), 0, nullptr); item_append(image->brief_instance_name(), image->basename(), 0, nullptr);
// if image has been loaded through softlist, let's add some more info // if image has been loaded through softlist, let's add some more info
if (image->software_entry()) if (image->loaded_through_softlist())
{ {
// display long filename // display long filename
item_append(image->longname(), "", FLAG_DISABLE, nullptr); item_append(image->longname(), "", FLAG_DISABLE, nullptr);

View File

@ -188,10 +188,10 @@ void favorite_manager::add_favorite_game()
auto software_avail = false; auto software_avail = false;
for (device_image_interface &image : image_interface_iterator(machine().root_device())) for (device_image_interface &image : image_interface_iterator(machine().root_device()))
{ {
if (image.exists() && image.software_entry()) if (image.exists() && image.loaded_through_softlist())
{ {
auto swinfo = image.software_entry(); const software_info *swinfo = image.software_entry();
auto part = image.part_entry(); const software_part *part = image.part_entry();
ui_software_info tmpmatches; ui_software_info tmpmatches;
tmpmatches.shortname = swinfo->shortname(); tmpmatches.shortname = swinfo->shortname();
tmpmatches.longname = image.longname(); tmpmatches.longname = image.longname();

View File

@ -157,7 +157,7 @@ image_init_result aim65_state::load_cart(device_image_interface &image, generic_
return image_init_result::FAIL; return image_init_result::FAIL;
} }
if (image.software_entry() != nullptr && image.get_software_region(slot_tag) == nullptr) if (image.loaded_through_softlist() && image.get_software_region(slot_tag) == nullptr)
{ {
std::string errmsg = string_format( std::string errmsg = string_format(
"Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension", "Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension",

View File

@ -300,7 +300,7 @@ DEVICE_IMAGE_LOAD_MEMBER( beta_state, beta_eprom )
DEVICE_IMAGE_UNLOAD_MEMBER( beta_state, beta_eprom ) DEVICE_IMAGE_UNLOAD_MEMBER( beta_state, beta_eprom )
{ {
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
image.fwrite(&m_eprom_rom[0], 0x800); image.fwrite(&m_eprom_rom[0], 0x800);
} }

View File

@ -770,7 +770,7 @@ DEVICE_IMAGE_LOAD_MEMBER(geniusiq_state,iq128_cart)
m_cart_state = IQ128_ROM_CART; m_cart_state = IQ128_ROM_CART;
if (image.software_entry() != nullptr) if (image.loaded_through_softlist())
{ {
const char *pcb_type = image.get_feature("pcb_type"); const char *pcb_type = image.get_feature("pcb_type");
if (pcb_type) if (pcb_type)

View File

@ -441,7 +441,7 @@ image_init_result pcjr_state::load_cart(device_image_interface &image, generic_s
uint32_t size = slot->common_get_size("rom"); uint32_t size = slot->common_get_size("rom");
bool imagic_hack = false; bool imagic_hack = false;
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
int header_size = 0; int header_size = 0;

View File

@ -2057,7 +2057,7 @@ DEVICE_IMAGE_LOAD_MEMBER( jaguar_state, jaguar_cart )
{ {
uint32_t size, load_offset = 0; uint32_t size, load_offset = 0;
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
size = image.length(); size = image.length();

View File

@ -532,7 +532,7 @@ DEVICE_IMAGE_LOAD_MEMBER( md_cons_state, _32x_cart )
uint32_t *ROM32; uint32_t *ROM32;
int i; int i;
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
length = image.length(); length = image.length();
temp_copy.resize(length); temp_copy.resize(length);

View File

@ -724,7 +724,7 @@ image_init_result mtech_state::load_cart(device_image_interface &image, generic_
const char *pcb_name; const char *pcb_name;
uint32_t size = slot->common_get_size("rom"); uint32_t size = slot->common_get_size("rom");
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
return image_init_result::FAIL; return image_init_result::FAIL;
slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);

View File

@ -516,7 +516,7 @@ DEVICE_IMAGE_LOAD_MEMBER(microvision_state, microvsn_cart)
} }
/* Read cartridge */ /* Read cartridge */
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
if (image.fread(rom1, file_size) != file_size) if (image.fread(rom1, file_size) != file_size)
{ {

View File

@ -298,7 +298,7 @@ DEVICE_IMAGE_LOAD_MEMBER(n64_mess_state,n64_cart)
n64_periphs *periphs = machine().device<n64_periphs>("rcp"); n64_periphs *periphs = machine().device<n64_periphs>("rcp");
uint8_t *cart = memregion("user2")->base(); uint8_t *cart = memregion("user2")->base();
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
length = image.fread(cart, 0x4000000); length = image.fread(cart, 0x4000000);
} }

View File

@ -261,7 +261,7 @@ SNAPSHOT_LOAD_MEMBER( nascom_state, nascom1 )
image_init_result nascom2_state::load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id) image_init_result nascom2_state::load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id)
{ {
// loading directly from file // loading directly from file
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
if (slot->length() > 0x1000) if (slot->length() > 0x1000)
{ {

View File

@ -185,7 +185,8 @@ void patinho_feio_state::load_raw_data(const char* name, unsigned int start_addr
DEVICE_IMAGE_LOAD_MEMBER( patinho_feio_state, patinho_tape ) DEVICE_IMAGE_LOAD_MEMBER( patinho_feio_state, patinho_tape )
{ {
if (image.software_entry() != nullptr){ if (image.loaded_through_softlist())
{
paper_tape_length = image.get_software_region_length("rom"); paper_tape_length = image.get_software_region_length("rom");
paper_tape_data = image.get_software_region("rom"); paper_tape_data = image.get_software_region("rom");
paper_tape_address = 0; paper_tape_address = 0;

View File

@ -421,7 +421,7 @@ image_init_result pegasus_state::load_cart(device_image_interface &image, generi
return image_init_result::FAIL; return image_init_result::FAIL;
} }
if (image.software_entry() != nullptr && size == 0) if (image.loaded_through_softlist() && size == 0)
{ {
// we might be loading a cart compatible with all sockets! // we might be loading a cart compatible with all sockets!
// so try to get region "rom" // so try to get region "rom"

View File

@ -533,7 +533,7 @@ DEVICE_IMAGE_LOAD_MEMBER( studio2_state, studio2_cart_load )
// always alloc 3K, even if range $400-$600 is not read by the system (RAM is present there) // always alloc 3K, even if range $400-$600 is not read by the system (RAM is present there)
m_cart->rom_alloc(0xc00, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); m_cart->rom_alloc(0xc00, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
if (image.is_filetype("st2")) if (image.is_filetype("st2"))
{ {

View File

@ -1130,7 +1130,7 @@ image_init_result stv_state::load_cart(device_image_interface &image, generic_sl
uint8_t *ROM; uint8_t *ROM;
uint32_t size = slot->common_get_size("rom"); uint32_t size = slot->common_get_size("rom");
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
return image_init_result::FAIL; return image_init_result::FAIL;
slot->rom_alloc(size, GENERIC_ROM32_WIDTH, ENDIANNESS_BIG); slot->rom_alloc(size, GENERIC_ROM32_WIDTH, ENDIANNESS_BIG);

View File

@ -602,7 +602,7 @@ DEVICE_IMAGE_LOAD_MEMBER( spectrum_state, timex_cart )
{ {
uint32_t size = m_dock->common_get_size("rom"); uint32_t size = m_dock->common_get_size("rom");
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
uint8_t *DOCK; uint8_t *DOCK;
int chunks_in_file = 0; int chunks_in_file = 0;
@ -614,7 +614,7 @@ DEVICE_IMAGE_LOAD_MEMBER( spectrum_state, timex_cart )
image.seterror(IMAGE_ERROR_UNSPECIFIED, "File corrupted"); image.seterror(IMAGE_ERROR_UNSPECIFIED, "File corrupted");
return image_init_result::FAIL; return image_init_result::FAIL;
} }
if (image.software_entry() != nullptr) if (!image.loaded_through_softlist())
{ {
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Loading from softlist is not supported yet"); image.seterror(IMAGE_ERROR_UNSPECIFIED, "Loading from softlist is not supported yet");
return image_init_result::FAIL; return image_init_result::FAIL;

View File

@ -247,7 +247,7 @@ DEVICE_IMAGE_LOAD_MEMBER(uzebox_state, uzebox_cart)
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
std::vector<uint8_t> data(size); std::vector<uint8_t> data(size);
image.fread(&data[0], size); image.fread(&data[0], size);

View File

@ -1053,7 +1053,7 @@ DEVICE_IMAGE_LOAD_MEMBER( x07_state, x07_card )
uint32_t size = m_card->common_get_size("rom"); uint32_t size = m_card->common_get_size("rom");
// check card type // check card type
if (image.software_entry() != nullptr) if (image.loaded_through_softlist())
{ {
const char *card_type = image.get_feature("card_type"); const char *card_type = image.get_feature("card_type");

View File

@ -3291,7 +3291,7 @@ DEVICE_IMAGE_LOAD_MEMBER(amstrad_state, amstrad_plus_cartridge)
logerror("IMG: loading CPC+ cartridge file\n"); logerror("IMG: loading CPC+ cartridge file\n");
// check for .CPR header // check for .CPR header
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
image.fread(header, 12); image.fread(header, 12);
if (strncmp((char *)header, "RIFF", 4) != 0) if (strncmp((char *)header, "RIFF", 4) != 0)
@ -3310,7 +3310,7 @@ DEVICE_IMAGE_LOAD_MEMBER(amstrad_state, amstrad_plus_cartridge)
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
// actually load the cart into ROM // actually load the cart into ROM
if (image.software_entry() != nullptr) if (image.loaded_through_softlist())
{ {
logerror("IMG: raw CPC+ cartridge from softlist\n"); logerror("IMG: raw CPC+ cartridge from softlist\n");
memcpy(m_cart->get_rom_base(), image.get_software_region("rom"), size); memcpy(m_cart->get_rom_base(), image.get_software_region("rom"), size);

View File

@ -144,7 +144,7 @@ void atari_fdc_device::atari_load_proc(device_image_interface &image, bool is_cr
//m_drv[id].image = (uint8_t*)image.image_realloc(m_drv[id].image, size); //m_drv[id].image = (uint8_t*)image.image_realloc(m_drv[id].image, size);
// hack alert, this means we can only load ATR via the softlist at the moment, image.filetype returns "" :/ // hack alert, this means we can only load ATR via the softlist at the moment, image.filetype returns "" :/
bool is_softlist_entry = image.software_entry() != nullptr; bool is_softlist_entry = image.loaded_through_softlist();
/* no extension: assume XFD format (no header) */ /* no extension: assume XFD format (no header) */
if (image.is_filetype("") && !is_softlist_entry) if (image.is_filetype("") && !is_softlist_entry)

View File

@ -1595,7 +1595,7 @@ image_init_result bbc_state::bbc_load_rom(device_image_interface &image, generic
image_init_result bbc_state::bbcm_load_cart(device_image_interface &image, generic_slot_device *slot) image_init_result bbc_state::bbcm_load_cart(device_image_interface &image, generic_slot_device *slot)
{ {
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
uint32_t filesize = image.length(); uint32_t filesize = image.length();

View File

@ -407,7 +407,7 @@ void electron_state::machine_start()
DEVICE_IMAGE_LOAD_MEMBER( electron_state, electron_cart ) DEVICE_IMAGE_LOAD_MEMBER( electron_state, electron_cart )
{ {
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
uint32_t filesize = image.length(); uint32_t filesize = image.length();

View File

@ -2066,7 +2066,7 @@ DEVICE_IMAGE_LOAD_MEMBER( lynx_state, lynx_cart )
uint32_t size = m_cart->common_get_size("rom"); uint32_t size = m_cart->common_get_size("rom");
uint16_t gran = 0; uint16_t gran = 0;
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
// check for lnx header // check for lnx header
if (image.is_filetype("lnx")) if (image.is_filetype("lnx"))
@ -2098,7 +2098,7 @@ DEVICE_IMAGE_LOAD_MEMBER( lynx_state, lynx_cart )
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
// set-up granularity // set-up granularity
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
if (image.is_filetype("lnx")) // from header if (image.is_filetype("lnx")) // from header
m_granularity = gran; m_granularity = gran;
@ -2124,7 +2124,7 @@ DEVICE_IMAGE_LOAD_MEMBER( lynx_state, lynx_cart )
} }
// set-up rotation from softlist // set-up rotation from softlist
if (image.software_entry() != nullptr) if (image.loaded_through_softlist())
{ {
const char *rotate = image.get_feature("rotation"); const char *rotate = image.get_feature("rotation");
m_rotate = 0; m_rotate = 0;

View File

@ -128,7 +128,7 @@ void datapack_device::update()
if ((m_control & DP_LINE_OUTPUT_ENABLE) && !(m_control & DP_LINE_RESET)) if ((m_control & DP_LINE_OUTPUT_ENABLE) && !(m_control & DP_LINE_RESET))
{ {
// write data // write data
if (software_entry() == nullptr && (m_id & DP_ID_WRITE)) if (!loaded_through_softlist() && (m_id & DP_ID_WRITE))
{ {
fseek(pack_addr + OPK_HEAD_SIZE, SEEK_SET); fseek(pack_addr + OPK_HEAD_SIZE, SEEK_SET);
fwrite(&m_data, 1); fwrite(&m_data, 1);
@ -164,7 +164,7 @@ void datapack_device::update()
else if (!(m_control & DP_LINE_OUTPUT_ENABLE) && (m_control & DP_LINE_RESET)) else if (!(m_control & DP_LINE_OUTPUT_ENABLE) && (m_control & DP_LINE_RESET))
{ {
// read datapack ID // read datapack ID
if ((m_id & DP_ID_EPROM) || software_entry() != nullptr) if ((m_id & DP_ID_EPROM) || loaded_through_softlist())
m_data = m_id; m_data = m_id;
else else
m_data = 0x01; // for identify RAM pack m_data = 0x01; // for identify RAM pack

View File

@ -363,7 +363,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state, to7_cartridge )
offs_t size; offs_t size;
char name[129]; char name[129];
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
size = image.length(); size = image.length();
else else
size = image.get_software_region_length("rom"); size = image.get_software_region_length("rom");
@ -383,7 +383,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state, to7_cartridge )
return image_init_result::FAIL; return image_init_result::FAIL;
} }
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
if ( image.fread( pos, size ) != size ) if ( image.fread( pos, size ) != size )
{ {
@ -1473,7 +1473,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state, mo5_cartridge )
int j; int j;
char name[129]; char name[129];
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
size = image.length(); size = image.length();
else else
size = image.get_software_region_length("rom"); size = image.get_software_region_length("rom");
@ -1493,7 +1493,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state, mo5_cartridge )
return image_init_result::FAIL; return image_init_result::FAIL;
} }
if (image.software_entry() == nullptr) if (!image.loaded_through_softlist())
{ {
if ( image.fread(pos, size ) != size ) if ( image.fread(pos, size ) != size )
{ {