mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
imagedev/cdromimg.cpp: Fixed object lifecycles when loading from softlist or ROM region.
* Reverted workaround 4c0957d7f0
.
* Cleaned up a few things.
This commit is contained in:
parent
8eaf308e15
commit
e4d6dc1be9
@ -82,6 +82,8 @@ void vic10_expansion_slot_device::device_start()
|
||||
|
||||
std::pair<std::error_condition, std::string> vic10_expansion_slot_device::call_load()
|
||||
{
|
||||
std::error_condition err;
|
||||
|
||||
if (m_card)
|
||||
{
|
||||
if (!loaded_through_softlist())
|
||||
@ -122,6 +124,10 @@ std::pair<std::error_condition, std::string> vic10_expansion_slot_device::call_l
|
||||
cbm_crt_read_data(image_core_file(), roml, romh);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = image_error::INVALIDIMAGE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -131,7 +137,7 @@ std::pair<std::error_condition, std::string> vic10_expansion_slot_device::call_l
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_pair(std::error_condition(), std::string());
|
||||
return std::make_pair(err, std::string());
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,8 +109,10 @@ std::pair<std::error_condition, std::string> cdrom_image_device::call_load()
|
||||
m_cdrom_handle.reset();
|
||||
m_dvdrom_handle.reset();
|
||||
|
||||
if (!loaded_through_softlist()) {
|
||||
if (is_filetype("chd") && is_loaded()) {
|
||||
if (!loaded_through_softlist())
|
||||
{
|
||||
if (is_filetype("chd") && is_loaded())
|
||||
{
|
||||
util::core_file::ptr proxy;
|
||||
err = util::core_file::open_proxy(image_core_file(), proxy);
|
||||
if (!err)
|
||||
@ -119,8 +121,10 @@ std::pair<std::error_condition, std::string> cdrom_image_device::call_load()
|
||||
goto error;
|
||||
chd = &m_self_chd;
|
||||
}
|
||||
} else {
|
||||
chd = device().machine().rom_load().get_disk_handle(device().subtag("cdrom").c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
chd = device().machine().rom_load().get_disk_handle(device().subtag("cdrom"));
|
||||
}
|
||||
|
||||
// open the CHD file
|
||||
@ -128,25 +132,28 @@ std::pair<std::error_condition, std::string> cdrom_image_device::call_load()
|
||||
{
|
||||
if (chd->is_cd() || (m_gd_compat && chd->is_gd()))
|
||||
m_cdrom_handle.reset(new cdrom_file(chd));
|
||||
else if(m_dvd_compat && chd->is_dvd())
|
||||
else if (m_dvd_compat && chd->is_dvd())
|
||||
m_dvdrom_handle.reset(new dvdrom_file(chd));
|
||||
else
|
||||
{
|
||||
err = image_error::UNSUPPORTED;
|
||||
goto error;
|
||||
}
|
||||
m_cdrom_handle.reset(new cdrom_file(chd));
|
||||
}
|
||||
else
|
||||
{
|
||||
try {
|
||||
auto *cdrom = new cdrom_file(filename());
|
||||
m_cdrom_handle.reset(cdrom);
|
||||
} catch(void *) {
|
||||
try {
|
||||
auto *dvdrom = new dvdrom_file(filename());
|
||||
m_dvdrom_handle.reset(dvdrom);
|
||||
} catch(void *) {
|
||||
try
|
||||
{
|
||||
m_cdrom_handle.reset(new cdrom_file(filename()));
|
||||
}
|
||||
catch (void *)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_dvdrom_handle.reset(new dvdrom_file(filename()));
|
||||
}
|
||||
catch (void *)
|
||||
{
|
||||
err = image_error::UNSUPPORTED;
|
||||
goto error;
|
||||
}
|
||||
|
@ -45,10 +45,11 @@
|
||||
#define LOG_STATE (1U << 3)
|
||||
#define LOG_DATA (1U << 4)
|
||||
#define LOG_COMMAND (1U << 5)
|
||||
#define VERBOSE (0)
|
||||
|
||||
#define VERBOSE (0)
|
||||
#include "logmacro.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
@ -465,7 +466,7 @@ bool ds2430a_device::nvram_read(util::read_stream &file)
|
||||
|
||||
if (m_rom[0] != 0x14)
|
||||
osd_printf_error("Incorrect ROM family code (expected 14h, found %02Xh in saved data)\n", m_rom[0]);
|
||||
u8 crc = std::accumulate(std::begin(m_rom), std::end(m_rom) - 1, u8(0), &ds1wire_crc);
|
||||
u8 const crc = std::accumulate(std::begin(m_rom), std::end(m_rom) - 1, u8(0), &ds1wire_crc);
|
||||
if (m_rom[7] != crc)
|
||||
osd_printf_error("Incorrect ROM CRC (expected %02Xh, found %02Xh in saved data)\n", crc, m_rom[7]);
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
// tracks are padded to a multiple of this many frames
|
||||
static constexpr uint32_t TRACK_PADDING = 4;
|
||||
|
||||
static constexpr uint32_t MAX_TRACKS = 99 + 1;
|
||||
static constexpr uint32_t MAX_TRACKS = 99; /* AFAIK the theoretical limit */
|
||||
static constexpr uint32_t MAX_SECTOR_DATA = 2352;
|
||||
static constexpr uint32_t MAX_SUBCODE_DATA = 96;
|
||||
|
||||
|
@ -11,26 +11,30 @@
|
||||
|
||||
#include "cpu/z80/z80.h"
|
||||
|
||||
#define VERBOSE 1
|
||||
#include "logmacro.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
PARAMETERS
|
||||
***************************************************************************/
|
||||
|
||||
#define VERBOSE 1
|
||||
#include "logmacro.h"
|
||||
enum : uint8_t
|
||||
{
|
||||
CMD_TYPE_OBJECT_CODE = 0x01,
|
||||
CMD_TYPE_TRANSFER_ADDRESS = 0x02,
|
||||
CMD_TYPE_END_OF_PARTITIONED_DATA_SET_MEMBER = 0x04,
|
||||
CMD_TYPE_LOAD_MODULE_HEADER = 0x05,
|
||||
CMD_TYPE_PARTITIONED_DATA_SET_HEADER = 0x06,
|
||||
CMD_TYPE_PATCH_NAME_HEADER = 0x07,
|
||||
CMD_TYPE_ISAM_DIRECTORY_ENTRY = 0x08,
|
||||
CMD_TYPE_END_OF_ISAM_DIRECTORY_ENTRY = 0x0a,
|
||||
CMD_TYPE_PDS_DIRECTORY_ENTRY = 0x0c,
|
||||
CMD_TYPE_END_OF_PDS_DIRECTORY_ENTRY = 0x0e,
|
||||
CMD_TYPE_YANKED_LOAD_BLOCK = 0x10,
|
||||
CMD_TYPE_COPYRIGHT_BLOCK = 0x1f
|
||||
};
|
||||
|
||||
#define CMD_TYPE_OBJECT_CODE 0x01
|
||||
#define CMD_TYPE_TRANSFER_ADDRESS 0x02
|
||||
#define CMD_TYPE_END_OF_PARTITIONED_DATA_SET_MEMBER 0x04
|
||||
#define CMD_TYPE_LOAD_MODULE_HEADER 0x05
|
||||
#define CMD_TYPE_PARTITIONED_DATA_SET_HEADER 0x06
|
||||
#define CMD_TYPE_PATCH_NAME_HEADER 0x07
|
||||
#define CMD_TYPE_ISAM_DIRECTORY_ENTRY 0x08
|
||||
#define CMD_TYPE_END_OF_ISAM_DIRECTORY_ENTRY 0x0a
|
||||
#define CMD_TYPE_PDS_DIRECTORY_ENTRY 0x0c
|
||||
#define CMD_TYPE_END_OF_PDS_DIRECTORY_ENTRY 0x0e
|
||||
#define CMD_TYPE_YANKED_LOAD_BLOCK 0x10
|
||||
#define CMD_TYPE_COPYRIGHT_BLOCK 0x1f
|
||||
|
||||
/***************************************************************************
|
||||
IMPLEMENTATION
|
||||
|
Loading…
Reference in New Issue
Block a user