mirror of
https://github.com/holub/mame
synced 2025-04-25 01:40:16 +03:00
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:
parent
73d399e9e5
commit
2a89da877b
@ -349,7 +349,7 @@ image_init_result a78_cart_slot_device::call_load()
|
||||
{
|
||||
uint32_t len;
|
||||
|
||||
if (software_entry() != nullptr)
|
||||
if (loaded_through_softlist())
|
||||
{
|
||||
const char *pcb_name;
|
||||
bool has_ram = get_software_region("ram") ? true : false;
|
||||
|
@ -242,7 +242,7 @@ image_init_result a800_cart_slot_device::call_load()
|
||||
{
|
||||
uint32_t len;
|
||||
|
||||
if (software_entry() != nullptr)
|
||||
if (loaded_through_softlist())
|
||||
{
|
||||
const char *pcb_name;
|
||||
len = get_software_region_length("rom");
|
||||
|
@ -93,7 +93,7 @@ image_init_result adam_expansion_slot_device::call_load()
|
||||
{
|
||||
size_t size;
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
size = length();
|
||||
|
||||
|
@ -160,7 +160,7 @@ image_init_result apf_cart_slot_device::call_load()
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -170,12 +170,12 @@ image_init_result apf_cart_slot_device::call_load()
|
||||
|
||||
m_cart->rom_alloc(size, tag());
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(m_cart->get_rom_base(), size);
|
||||
else
|
||||
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
m_type = APF_STD;
|
||||
// attempt to identify Space Destroyer, which needs 1K of additional RAM
|
||||
|
@ -150,16 +150,16 @@ image_init_result arcadia_cart_slot_device::call_load()
|
||||
{
|
||||
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());
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(m_cart->get_rom_base(), len);
|
||||
else
|
||||
memcpy(m_cart->get_rom_base(), get_software_region("rom"), len);
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
// we need to identify Golf!
|
||||
m_type = ARCADIA_STD;
|
||||
|
@ -150,15 +150,15 @@ image_init_result astrocade_cart_slot_device::call_load()
|
||||
{
|
||||
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());
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(m_cart->get_rom_base(), size);
|
||||
else
|
||||
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
m_type = ASTROCADE_STD;
|
||||
|
||||
|
@ -120,7 +120,7 @@ image_init_result c64_expansion_slot_device::call_load()
|
||||
{
|
||||
size_t size;
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
size = length();
|
||||
|
||||
|
@ -108,7 +108,7 @@ image_init_result cbm2_expansion_slot_device::call_load()
|
||||
|
||||
if (m_card)
|
||||
{
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
size = length();
|
||||
|
||||
|
@ -163,15 +163,15 @@ image_init_result channelf_cart_slot_device::call_load()
|
||||
{
|
||||
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());
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(m_cart->get_rom_base(), len);
|
||||
else
|
||||
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
|
||||
// on PCBs with RAM at $2000-$2800 as Saba Schach!
|
||||
|
@ -327,7 +327,7 @@ image_init_result cococart_slot_device::call_load()
|
||||
if (m_cart)
|
||||
{
|
||||
offs_t read_length;
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
read_length = fread(m_cart->get_cart_base(), 0x8000);
|
||||
}
|
||||
|
@ -79,10 +79,10 @@ image_init_result colecovision_cartridge_slot_device::call_load()
|
||||
{
|
||||
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);
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
fread(m_card->m_rom, size);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ image_init_result crvision_cart_slot_device::call_load()
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -164,12 +164,12 @@ image_init_result crvision_cart_slot_device::call_load()
|
||||
|
||||
m_cart->rom_alloc(size, tag());
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(m_cart->get_rom_base(), size);
|
||||
else
|
||||
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
m_type = CRV_4K;
|
||||
|
||||
|
@ -263,12 +263,12 @@ image_init_result base_gb_cart_slot_device::call_load()
|
||||
if (m_cart)
|
||||
{
|
||||
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;
|
||||
int rambanks = 0;
|
||||
|
||||
// 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)
|
||||
{
|
||||
@ -288,7 +288,7 @@ image_init_result base_gb_cart_slot_device::call_load()
|
||||
m_cart->rom_alloc(len, tag());
|
||||
ROM = m_cart->get_rom_base();
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(ROM, len);
|
||||
else
|
||||
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))
|
||||
offset = len - 0x8000;
|
||||
|
||||
if (software_entry() != nullptr)
|
||||
if (loaded_through_softlist())
|
||||
m_type = gb_get_pcb_id(get_feature("slot") ? get_feature("slot") : "rom");
|
||||
else
|
||||
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);
|
||||
|
||||
// setup RAM/NVRAM/RTC/RUMBLE
|
||||
if (software_entry() != nullptr)
|
||||
if (loaded_through_softlist())
|
||||
{
|
||||
// from softlist we only rely on xml
|
||||
if (get_software_region("ram"))
|
||||
@ -413,11 +413,11 @@ image_init_result megaduck_cart_slot_device::call_load()
|
||||
{
|
||||
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());
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(m_cart->get_rom_base(), len);
|
||||
else
|
||||
memcpy(m_cart->get_rom_base(), get_software_region("rom"), len);
|
||||
|
@ -181,7 +181,7 @@ image_init_result gba_cart_slot_device::call_load()
|
||||
if (m_cart)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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());
|
||||
ROM = (uint8_t *)m_cart->get_rom_base();
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
fread(ROM, size);
|
||||
m_type = get_cart_type(ROM, size);
|
||||
|
@ -189,9 +189,9 @@ std::string generic_slot_device::get_default_card_software()
|
||||
uint32_t generic_slot_device::common_get_size(const char *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));
|
||||
|
||||
// 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);
|
||||
else
|
||||
memcpy(ROM, get_software_region(region), len);
|
||||
|
@ -391,7 +391,7 @@ image_init_result intv_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
return load_fullpath();
|
||||
else
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ image_init_result iq151cart_slot_device::call_load()
|
||||
|
||||
if (cart_base != nullptr)
|
||||
{
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
read_length = length();
|
||||
fread(m_cart->get_cart_base(), read_length);
|
||||
|
@ -1352,7 +1352,7 @@ void sc499_ctape_image_device::call_unload()
|
||||
{
|
||||
m_ctape_data.resize(0);
|
||||
// TODO: add save tape on exit?
|
||||
//if (software_entry() == nullptr)
|
||||
//if (!loaded_through_softlist())
|
||||
//{
|
||||
// fseek(0, SEEK_SET);
|
||||
// fwrite(m_ctape_data, m_ctape_data.size);
|
||||
|
@ -337,7 +337,7 @@ image_init_result kccart_slot_device::call_load()
|
||||
|
||||
if (cart_base != nullptr)
|
||||
{
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
read_length = length();
|
||||
fread(m_cart->get_cart_base(), read_length);
|
||||
|
@ -163,10 +163,9 @@ image_init_result m5_cart_slot_device::call_load()
|
||||
{
|
||||
m_type=M5_STD;
|
||||
|
||||
if (software_entry() != nullptr)
|
||||
if (loaded_through_softlist())
|
||||
{
|
||||
const char *pcb_name = get_feature("slot");
|
||||
//software_info *name=m_software_info_ptr;
|
||||
if (pcb_name) //is it ram cart?
|
||||
m_type = m5_get_pcb_id(m_full_software_name.c_str());
|
||||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -185,7 +184,7 @@ image_init_result m5_cart_slot_device::call_load()
|
||||
|
||||
m_cart->rom_alloc(size, tag());
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(m_cart->get_rom_base(), size);
|
||||
else
|
||||
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
|
||||
|
@ -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 2: identify the cart type
|
||||
// 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();
|
||||
else
|
||||
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("============\n");
|
||||
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("ROM (Allocated) Size: 0x%X\n", rom_len);
|
||||
logerror("NVRAM: %s\n", nvram_len ? "Yes" : "No");
|
||||
|
@ -106,7 +106,7 @@ image_init_result msx_slot_cartridge_device::call_load()
|
||||
{
|
||||
if ( m_cartridge )
|
||||
{
|
||||
if ( software_entry() )
|
||||
if (loaded_through_softlist())
|
||||
{
|
||||
uint32_t length;
|
||||
|
||||
|
@ -239,7 +239,7 @@ image_init_result neogeo_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
if (software_entry() != nullptr)
|
||||
if (loaded_through_softlist())
|
||||
{
|
||||
uint16_t *ROM16;
|
||||
uint8_t *ROM8;
|
||||
|
@ -102,7 +102,7 @@ image_init_result nes_aladdin_slot_device::call_load()
|
||||
if (!ROM)
|
||||
return image_init_result::FAIL;
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
if (length() != 0x20010 && length() != 0x40010)
|
||||
return image_init_result::FAIL;
|
||||
|
@ -102,7 +102,7 @@ image_init_result nes_datach_slot_device::call_load()
|
||||
return image_init_result::FAIL;
|
||||
|
||||
// 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)
|
||||
return image_init_result::FAIL;
|
||||
|
@ -105,8 +105,8 @@ image_init_result nes_kstudio_slot_device::call_load()
|
||||
if (!ROM)
|
||||
return image_init_result::FAIL;
|
||||
|
||||
// Existing exapnsion carts are all 128K, so we only load files of this size
|
||||
if (software_entry() == nullptr)
|
||||
// Existing expansion carts are all 128K, so we only load files of this size
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
if (length() != 0x20000)
|
||||
return image_init_result::FAIL;
|
||||
|
@ -833,7 +833,7 @@ image_init_result nes_cart_slot_device::call_load()
|
||||
{
|
||||
if (m_cart)
|
||||
{
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
char magic[4];
|
||||
|
||||
|
@ -85,7 +85,7 @@ image_init_result nes_ntb_slot_device::call_load()
|
||||
if (!ROM)
|
||||
return image_init_result::FAIL;
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
if (length() != 0x4000)
|
||||
return image_init_result::FAIL;
|
||||
|
@ -162,15 +162,15 @@ image_init_result o2_cart_slot_device::call_load()
|
||||
{
|
||||
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());
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(m_cart->get_rom_base(), size);
|
||||
else
|
||||
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
m_type = O2_STD;
|
||||
if (size == 12288)
|
||||
|
@ -227,11 +227,11 @@ image_init_result pce_cart_slot_device::call_load()
|
||||
if (m_cart)
|
||||
{
|
||||
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;
|
||||
|
||||
// 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");
|
||||
offset = 512;
|
||||
@ -242,7 +242,7 @@ image_init_result pce_cart_slot_device::call_load()
|
||||
m_cart->rom_alloc(len, tag());
|
||||
ROM = m_cart->get_rom_base();
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(ROM, len);
|
||||
else
|
||||
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);
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
m_type = get_cart_type(ROM, len);
|
||||
else
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ image_init_result plus4_expansion_slot_device::call_load()
|
||||
{
|
||||
if (m_card)
|
||||
{
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ image_init_result portfolio_memory_card_slot_t::call_load()
|
||||
{
|
||||
if (m_card)
|
||||
{
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
fread(m_card->m_rom, length());
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ image_init_result ql_rom_cartridge_slot_t::call_load()
|
||||
{
|
||||
size_t size;
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
size = length();
|
||||
|
||||
|
@ -149,18 +149,18 @@ image_init_result sat_cart_slot_device::call_load()
|
||||
{
|
||||
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)
|
||||
{
|
||||
// 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;
|
||||
|
||||
m_cart->rom_alloc(len, tag());
|
||||
ROM = m_cart->get_rom_base();
|
||||
|
||||
if (software_entry() != nullptr)
|
||||
if (loaded_through_softlist())
|
||||
memcpy(ROM, get_software_region("rom"), len);
|
||||
else
|
||||
fread(ROM, len);
|
||||
|
@ -165,8 +165,8 @@ image_init_result scv_cart_slot_device::call_load()
|
||||
if (m_cart)
|
||||
{
|
||||
uint8_t *ROM;
|
||||
uint32_t len = (software_entry() == nullptr) ? length() : get_software_region_length("rom");
|
||||
bool has_ram = (software_entry() != nullptr) && get_software_region("ram");
|
||||
uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||
bool has_ram = loaded_through_softlist() && get_software_region("ram");
|
||||
|
||||
if (len > 0x20000)
|
||||
{
|
||||
@ -180,12 +180,12 @@ image_init_result scv_cart_slot_device::call_load()
|
||||
|
||||
ROM = m_cart->get_rom_base();
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(ROM, len);
|
||||
else
|
||||
memcpy(ROM, get_software_region("rom"), len);
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
m_type = get_cart_type(ROM, len);
|
||||
else
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ void sega8_cart_slot_device::set_lphaser_xoffset( uint8_t *rom, int size )
|
||||
|
||||
void sega8_cart_slot_device::setup_ram()
|
||||
{
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
if (m_type == SEGA8_CASTLE)
|
||||
{
|
||||
@ -336,7 +336,7 @@ image_init_result sega8_cart_slot_device::call_load()
|
||||
{
|
||||
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;
|
||||
uint8_t *ROM;
|
||||
|
||||
@ -360,7 +360,7 @@ image_init_result sega8_cart_slot_device::call_load()
|
||||
m_cart->rom_alloc(len, tag());
|
||||
ROM = m_cart->get_rom_base();
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
fseek(offset, SEEK_SET);
|
||||
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)
|
||||
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");
|
||||
else
|
||||
m_type = get_cart_type(ROM, len);
|
||||
@ -382,7 +382,7 @@ image_init_result sega8_cart_slot_device::call_load()
|
||||
setup_ram();
|
||||
|
||||
// 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");
|
||||
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("============\n" );
|
||||
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("ROM (Allocated) Size: 0x%X\n", len);
|
||||
logerror("RAM: %s\n", nvram_len ? "Yes" : "No");
|
||||
|
@ -609,7 +609,7 @@ image_init_result base_sns_cart_slot_device::call_load()
|
||||
const char *slot_name;
|
||||
|
||||
/* Check for a header (512 bytes), and skip it if found */
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
uint32_t tmplen = length();
|
||||
std::vector<uint8_t> tmpROM(tmplen);
|
||||
@ -618,11 +618,11 @@ image_init_result base_sns_cart_slot_device::call_load()
|
||||
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());
|
||||
ROM = m_cart->get_rom_base();
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(ROM, len);
|
||||
else
|
||||
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);
|
||||
|
||||
// check for on-cart CPU bios
|
||||
if (software_entry() != nullptr)
|
||||
if (loaded_through_softlist())
|
||||
{
|
||||
if (get_software_region("addon"))
|
||||
{
|
||||
@ -640,7 +640,7 @@ image_init_result base_sns_cart_slot_device::call_load()
|
||||
}
|
||||
|
||||
// get pcb type
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
get_cart_type_addon(ROM, len, m_type, m_addon);
|
||||
else
|
||||
{
|
||||
@ -653,7 +653,7 @@ image_init_result base_sns_cart_slot_device::call_load()
|
||||
m_type = SNES_DSP_2MB;
|
||||
}
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
setup_addon_from_fullpath();
|
||||
|
||||
// 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();
|
||||
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());
|
||||
uint8_t sram_size = (m_type == SNES_SFX) ? (ROM[0x00ffbd] & 0x07) : (ROM[hilo_mode + 0x18] & 0x07);
|
||||
|
@ -163,8 +163,8 @@ image_init_result vboy_cart_slot_device::call_load()
|
||||
if (m_cart)
|
||||
{
|
||||
uint8_t *ROM;
|
||||
uint32_t len = (software_entry() == nullptr) ? length() : get_software_region_length("rom");
|
||||
bool has_eeprom = (software_entry() != nullptr) && get_software_region("eeprom");
|
||||
uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||
bool has_eeprom = loaded_through_softlist() && get_software_region("eeprom");
|
||||
|
||||
if (len > 0x200000)
|
||||
{
|
||||
@ -180,7 +180,7 @@ image_init_result vboy_cart_slot_device::call_load()
|
||||
|
||||
ROM = (uint8_t *)m_cart->get_rom_base();
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(ROM, len);
|
||||
else
|
||||
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 < 0x200000) { memcpy(ROM + 0x100000, ROM, 0x100000); }
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
m_type = vboy_get_pcb_id("vb_rom");
|
||||
else
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ image_init_result vc4000_cart_slot_device::call_load()
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -184,12 +184,12 @@ image_init_result vc4000_cart_slot_device::call_load()
|
||||
|
||||
m_cart->rom_alloc(size, tag());
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(m_cart->get_rom_base(), size);
|
||||
else
|
||||
memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
m_type = VC4000_STD;
|
||||
// attempt to identify the non-standard types
|
||||
|
@ -189,7 +189,7 @@ image_init_result vcs_cart_slot_device::call_load()
|
||||
uint8_t *ROM;
|
||||
uint32_t len;
|
||||
|
||||
if (software_entry() != nullptr)
|
||||
if (loaded_through_softlist())
|
||||
len = get_software_region_length("rom");
|
||||
else
|
||||
len = length();
|
||||
@ -219,7 +219,7 @@ image_init_result vcs_cart_slot_device::call_load()
|
||||
m_cart->rom_alloc(len, tag());
|
||||
ROM = m_cart->get_rom_base();
|
||||
|
||||
if (software_entry() != nullptr)
|
||||
if (loaded_through_softlist())
|
||||
{
|
||||
const char *pcb_name;
|
||||
bool has_ram = get_software_region("ram") ? true : false;
|
||||
|
@ -152,7 +152,7 @@ image_init_result vectrex_cart_slot_device::call_load()
|
||||
{
|
||||
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;
|
||||
|
||||
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());
|
||||
ROM = m_cart->get_rom_base();
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(ROM, size);
|
||||
else
|
||||
memcpy(ROM, get_software_region("rom"), size);
|
||||
|
@ -115,7 +115,7 @@ image_init_result vic10_expansion_slot_device::call_load()
|
||||
{
|
||||
size_t size;
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
size = length();
|
||||
|
||||
|
@ -112,7 +112,7 @@ image_init_result vic20_expansion_slot_device::call_load()
|
||||
{
|
||||
if (m_card)
|
||||
{
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
if (is_filetype("20")) fread(m_card->m_blk1, 0x2000);
|
||||
else if (is_filetype("40")) fread(m_card->m_blk2, 0x2000);
|
||||
|
@ -119,7 +119,7 @@ image_init_result videobrain_expansion_slot_device::call_load()
|
||||
{
|
||||
size_t size;
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
size = length();
|
||||
|
||||
|
@ -165,18 +165,18 @@ image_init_result ws_cart_slot_device::call_load()
|
||||
if (m_cart)
|
||||
{
|
||||
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;
|
||||
|
||||
m_cart->rom_alloc(size, tag());
|
||||
ROM = m_cart->get_rom_base();
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
fread(ROM, size);
|
||||
else
|
||||
memcpy(ROM, get_software_region("rom"), size);
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
int chunks = size / 0x10000;
|
||||
// get cart type and nvram length
|
||||
|
@ -125,7 +125,7 @@ image_init_result z88cart_slot_device::call_load()
|
||||
|
||||
if (cart_base != nullptr)
|
||||
{
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
read_length = length();
|
||||
fread(cart_base + (m_cart->get_cart_size() - read_length), read_length);
|
||||
|
@ -94,7 +94,7 @@ image_init_result cdrom_image_device::call_load()
|
||||
if (m_cdrom_handle)
|
||||
cdrom_close(m_cdrom_handle);
|
||||
|
||||
if (software_entry() == nullptr)
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
if (is_filetype("chd") && is_loaded()) {
|
||||
err = m_self_chd.open( image_core_file() ); /* CDs are never writeable */
|
||||
|
@ -214,7 +214,7 @@ image_init_result diablo_image_device::internal_load_dsk()
|
||||
hard_disk_close(m_hard_disk_handle);
|
||||
|
||||
/* 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());
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ image_init_result harddisk_image_device::internal_load_hd()
|
||||
}
|
||||
|
||||
/* 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());
|
||||
}
|
||||
|
@ -89,7 +89,6 @@ device_image_interface::device_image_interface(const machine_config &mconfig, de
|
||||
m_err(),
|
||||
m_file(),
|
||||
m_mame_file(),
|
||||
m_software_info_ptr(nullptr),
|
||||
m_software_part_ptr(nullptr),
|
||||
m_supported(0),
|
||||
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
|
||||
//-------------------------------------------------
|
||||
@ -435,7 +445,7 @@ u8 *device_image_interface::get_software_region(const char *tag)
|
||||
{
|
||||
char full_tag[256];
|
||||
|
||||
if ( m_software_info_ptr == nullptr || m_software_part_ptr == nullptr )
|
||||
if (!loaded_through_softlist())
|
||||
return nullptr;
|
||||
|
||||
sprintf( full_tag, "%s:%s", device().tag(), tag );
|
||||
@ -536,7 +546,7 @@ void device_image_interface::image_checkhash()
|
||||
return;
|
||||
|
||||
// Skip calculating the hash when we have an image mounted through a software list
|
||||
if ( m_software_info_ptr )
|
||||
if (loaded_through_softlist())
|
||||
return;
|
||||
|
||||
// retrieve the partial hash func
|
||||
@ -700,7 +710,6 @@ bool device_image_interface::is_loaded()
|
||||
return (m_file != nullptr);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// image_error_from_file_error - converts an image
|
||||
// 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;
|
||||
|
||||
// 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, m_software_part_ptr, &list_name);
|
||||
bool softload = load_software_part(software_identifier);
|
||||
if (!softload)
|
||||
{
|
||||
m_is_loading = false;
|
||||
@ -1090,8 +1098,6 @@ image_init_result device_image_interface::load_software(const std::string &softw
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
// 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"))
|
||||
{
|
||||
// Copy some image information when we have been loaded through a software list
|
||||
if (m_software_info_ptr)
|
||||
{
|
||||
// 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");
|
||||
software_info &swinfo = m_software_part_ptr->info();
|
||||
|
||||
// store
|
||||
m_longname = m_software_info_ptr->longname();
|
||||
m_manufacturer = m_software_info_ptr->publisher();
|
||||
m_year = m_software_info_ptr->year();
|
||||
// sanitize
|
||||
if (swinfo.longname().empty() || swinfo.publisher().empty() || swinfo.year().empty())
|
||||
fatalerror("Each entry in an XML list must have all of the following fields: description, publisher, year!\n");
|
||||
|
||||
// set file type
|
||||
std::string filename = (m_mame_file != nullptr) && (m_mame_file->filename() != nullptr)
|
||||
// store
|
||||
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_filetype = core_filename_extract_extension(filename, true);
|
||||
}
|
||||
m_filetype = core_filename_extract_extension(filename, true);
|
||||
}
|
||||
|
||||
// call finish_load if necessary
|
||||
@ -1158,7 +1163,7 @@ bool device_image_interface::open_image_file(emu_options &options)
|
||||
set_init_phase();
|
||||
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;
|
||||
@ -1260,7 +1265,6 @@ void device_image_interface::clear()
|
||||
m_filetype.clear();
|
||||
|
||||
m_full_software_name.clear();
|
||||
m_software_info_ptr = nullptr;
|
||||
m_software_part_ptr = nullptr;
|
||||
m_software_list_name.clear();
|
||||
}
|
||||
@ -1272,7 +1276,7 @@ void device_image_interface::clear()
|
||||
|
||||
void device_image_interface::unload()
|
||||
{
|
||||
if (is_loaded() || m_software_info_ptr)
|
||||
if (is_loaded() || loaded_through_softlist())
|
||||
{
|
||||
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.
|
||||
//-------------------------------------------------
|
||||
|
||||
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
|
||||
software_list_device *swlist;
|
||||
swpart = find_software_item(identifier, true, &swlist);
|
||||
if (swpart == nullptr)
|
||||
m_software_part_ptr = find_software_item(identifier, true, &swlist);
|
||||
if (m_software_part_ptr == nullptr)
|
||||
{
|
||||
software_list_device::display_matches(device().machine().config(), image_interface(), identifier);
|
||||
return false;
|
||||
@ -1422,33 +1426,33 @@ bool device_image_interface::load_software_part(const std::string &identifier, c
|
||||
set_init_phase();
|
||||
|
||||
// Load the software part
|
||||
const char *swname = swpart->info().shortname().c_str();
|
||||
const rom_entry *start_entry = swpart->romdata().data();
|
||||
const char *swname = m_software_part_ptr->info().shortname().c_str();
|
||||
const rom_entry *start_entry = m_software_part_ptr->romdata().data();
|
||||
const software_list_loader &loader = get_software_list_loader();
|
||||
bool result = loader.load_software(*this, *swlist, swname, start_entry);
|
||||
|
||||
#ifdef UNUSED_VARIABLE
|
||||
// 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
|
||||
|
||||
// check compatibility
|
||||
switch (swlist->is_compatible(*swpart))
|
||||
switch (swlist->is_compatible(*m_software_part_ptr))
|
||||
{
|
||||
case SOFTWARE_IS_COMPATIBLE:
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// check requirements and load those images
|
||||
const char *requirement = swpart->feature("requirement");
|
||||
const char *requirement = m_software_part_ptr->feature("requirement");
|
||||
if (requirement != nullptr)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -199,10 +199,10 @@ public:
|
||||
const std::string &year() const { return m_year; }
|
||||
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 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; }
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
void add_format(std::unique_ptr<image_device_format> &&format);
|
||||
@ -301,7 +301,6 @@ protected:
|
||||
|
||||
// Software information
|
||||
std::string m_full_software_name;
|
||||
const software_info *m_software_info_ptr;
|
||||
const software_part *m_software_part_ptr;
|
||||
std::string m_software_list_name;
|
||||
|
||||
|
@ -1159,7 +1159,7 @@ void cheat_manager::reload()
|
||||
// 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
|
||||
// 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());
|
||||
break;
|
||||
|
@ -78,7 +78,7 @@ void menu_file_manager::fill_image_line(device_image_interface *img, std::string
|
||||
filename.assign(img->basename());
|
||||
|
||||
// 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();
|
||||
if (!tmp->name().empty())
|
||||
|
@ -411,7 +411,7 @@ void menu_image_info::image_info(device_image_interface *image)
|
||||
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->software_entry())
|
||||
if (image->loaded_through_softlist())
|
||||
{
|
||||
// display long filename
|
||||
item_append(image->longname(), "", FLAG_DISABLE, nullptr);
|
||||
|
@ -188,10 +188,10 @@ void favorite_manager::add_favorite_game()
|
||||
auto software_avail = false;
|
||||
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();
|
||||
auto part = image.part_entry();
|
||||
const software_info *swinfo = image.software_entry();
|
||||
const software_part *part = image.part_entry();
|
||||
ui_software_info tmpmatches;
|
||||
tmpmatches.shortname = swinfo->shortname();
|
||||
tmpmatches.longname = image.longname();
|
||||
|
@ -157,7 +157,7 @@ image_init_result aim65_state::load_cart(device_image_interface &image, generic_
|
||||
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(
|
||||
"Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension",
|
||||
|
@ -300,7 +300,7 @@ DEVICE_IMAGE_LOAD_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);
|
||||
}
|
||||
|
||||
|
@ -770,7 +770,7 @@ DEVICE_IMAGE_LOAD_MEMBER(geniusiq_state,iq128_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");
|
||||
if (pcb_type)
|
||||
|
@ -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");
|
||||
bool imagic_hack = false;
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
int header_size = 0;
|
||||
|
||||
|
@ -2057,7 +2057,7 @@ DEVICE_IMAGE_LOAD_MEMBER( jaguar_state, jaguar_cart )
|
||||
{
|
||||
uint32_t size, load_offset = 0;
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
size = image.length();
|
||||
|
||||
|
@ -532,7 +532,7 @@ DEVICE_IMAGE_LOAD_MEMBER( md_cons_state, _32x_cart )
|
||||
uint32_t *ROM32;
|
||||
int i;
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
length = image.length();
|
||||
temp_copy.resize(length);
|
||||
|
@ -724,7 +724,7 @@ image_init_result mtech_state::load_cart(device_image_interface &image, generic_
|
||||
const char *pcb_name;
|
||||
uint32_t size = slot->common_get_size("rom");
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
return image_init_result::FAIL;
|
||||
|
||||
slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
|
@ -516,7 +516,7 @@ DEVICE_IMAGE_LOAD_MEMBER(microvision_state, microvsn_cart)
|
||||
}
|
||||
|
||||
/* Read cartridge */
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
if (image.fread(rom1, file_size) != file_size)
|
||||
{
|
||||
|
@ -298,7 +298,7 @@ DEVICE_IMAGE_LOAD_MEMBER(n64_mess_state,n64_cart)
|
||||
n64_periphs *periphs = machine().device<n64_periphs>("rcp");
|
||||
uint8_t *cart = memregion("user2")->base();
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
length = image.fread(cart, 0x4000000);
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
// loading directly from file
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
if (slot->length() > 0x1000)
|
||||
{
|
||||
|
@ -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 )
|
||||
{
|
||||
if (image.software_entry() != nullptr){
|
||||
if (image.loaded_through_softlist())
|
||||
{
|
||||
paper_tape_length = image.get_software_region_length("rom");
|
||||
paper_tape_data = image.get_software_region("rom");
|
||||
paper_tape_address = 0;
|
||||
|
@ -421,7 +421,7 @@ image_init_result pegasus_state::load_cart(device_image_interface &image, generi
|
||||
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!
|
||||
// so try to get region "rom"
|
||||
|
@ -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)
|
||||
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"))
|
||||
{
|
||||
|
@ -1130,7 +1130,7 @@ image_init_result stv_state::load_cart(device_image_interface &image, generic_sl
|
||||
uint8_t *ROM;
|
||||
uint32_t size = slot->common_get_size("rom");
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
return image_init_result::FAIL;
|
||||
|
||||
slot->rom_alloc(size, GENERIC_ROM32_WIDTH, ENDIANNESS_BIG);
|
||||
|
@ -602,7 +602,7 @@ DEVICE_IMAGE_LOAD_MEMBER( spectrum_state, timex_cart )
|
||||
{
|
||||
uint32_t size = m_dock->common_get_size("rom");
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
uint8_t *DOCK;
|
||||
int chunks_in_file = 0;
|
||||
@ -614,7 +614,7 @@ DEVICE_IMAGE_LOAD_MEMBER( spectrum_state, timex_cart )
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "File corrupted");
|
||||
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");
|
||||
return image_init_result::FAIL;
|
||||
|
@ -247,7 +247,7 @@ DEVICE_IMAGE_LOAD_MEMBER(uzebox_state, uzebox_cart)
|
||||
|
||||
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);
|
||||
image.fread(&data[0], size);
|
||||
|
@ -1053,7 +1053,7 @@ DEVICE_IMAGE_LOAD_MEMBER( x07_state, x07_card )
|
||||
uint32_t size = m_card->common_get_size("rom");
|
||||
|
||||
// check card type
|
||||
if (image.software_entry() != nullptr)
|
||||
if (image.loaded_through_softlist())
|
||||
{
|
||||
const char *card_type = image.get_feature("card_type");
|
||||
|
||||
|
@ -3291,7 +3291,7 @@ DEVICE_IMAGE_LOAD_MEMBER(amstrad_state, amstrad_plus_cartridge)
|
||||
logerror("IMG: loading CPC+ cartridge file\n");
|
||||
|
||||
// check for .CPR header
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
image.fread(header, 12);
|
||||
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);
|
||||
|
||||
// actually load the cart into ROM
|
||||
if (image.software_entry() != nullptr)
|
||||
if (image.loaded_through_softlist())
|
||||
{
|
||||
logerror("IMG: raw CPC+ cartridge from softlist\n");
|
||||
memcpy(m_cart->get_rom_base(), image.get_software_region("rom"), size);
|
||||
|
@ -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);
|
||||
|
||||
// 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) */
|
||||
if (image.is_filetype("") && !is_softlist_entry)
|
||||
|
@ -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)
|
||||
{
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
uint32_t filesize = image.length();
|
||||
|
||||
|
@ -407,7 +407,7 @@ void electron_state::machine_start()
|
||||
|
||||
DEVICE_IMAGE_LOAD_MEMBER( electron_state, electron_cart )
|
||||
{
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
uint32_t filesize = image.length();
|
||||
|
||||
|
@ -2066,7 +2066,7 @@ DEVICE_IMAGE_LOAD_MEMBER( lynx_state, lynx_cart )
|
||||
uint32_t size = m_cart->common_get_size("rom");
|
||||
uint16_t gran = 0;
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
// check for lnx header
|
||||
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");
|
||||
|
||||
// set-up granularity
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
if (image.is_filetype("lnx")) // from header
|
||||
m_granularity = gran;
|
||||
@ -2124,7 +2124,7 @@ DEVICE_IMAGE_LOAD_MEMBER( lynx_state, lynx_cart )
|
||||
}
|
||||
|
||||
// set-up rotation from softlist
|
||||
if (image.software_entry() != nullptr)
|
||||
if (image.loaded_through_softlist())
|
||||
{
|
||||
const char *rotate = image.get_feature("rotation");
|
||||
m_rotate = 0;
|
||||
|
@ -128,7 +128,7 @@ void datapack_device::update()
|
||||
if ((m_control & DP_LINE_OUTPUT_ENABLE) && !(m_control & DP_LINE_RESET))
|
||||
{
|
||||
// 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);
|
||||
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))
|
||||
{
|
||||
// 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;
|
||||
else
|
||||
m_data = 0x01; // for identify RAM pack
|
||||
|
@ -363,7 +363,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state, to7_cartridge )
|
||||
offs_t size;
|
||||
char name[129];
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
size = image.length();
|
||||
else
|
||||
size = image.get_software_region_length("rom");
|
||||
@ -383,7 +383,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state, to7_cartridge )
|
||||
return image_init_result::FAIL;
|
||||
}
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
if ( image.fread( pos, size ) != size )
|
||||
{
|
||||
@ -1473,7 +1473,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state, mo5_cartridge )
|
||||
int j;
|
||||
char name[129];
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
size = image.length();
|
||||
else
|
||||
size = image.get_software_region_length("rom");
|
||||
@ -1493,7 +1493,7 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state, mo5_cartridge )
|
||||
return image_init_result::FAIL;
|
||||
}
|
||||
|
||||
if (image.software_entry() == nullptr)
|
||||
if (!image.loaded_through_softlist())
|
||||
{
|
||||
if ( image.fread(pos, size ) != size )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user