mirror of
https://github.com/holub/mame
synced 2025-04-29 11:30:28 +03:00
vector instead of simple_list (nw)
This commit is contained in:
parent
f21c96ce8a
commit
864486b7e6
@ -241,7 +241,7 @@ static void CLIB_DECL ATTR_PRINTF(1,2) debugload(const char *string, ...)
|
|||||||
|
|
||||||
chd_file *rom_load_manager::get_disk_handle(const char *region)
|
chd_file *rom_load_manager::get_disk_handle(const char *region)
|
||||||
{
|
{
|
||||||
for (open_chd *curdisk = m_chd_list.first(); curdisk != nullptr; curdisk = curdisk->next())
|
for (auto &curdisk : m_chd_list)
|
||||||
if (strcmp(curdisk->region(), region) == 0)
|
if (strcmp(curdisk->region(), region) == 0)
|
||||||
return &curdisk->chd();
|
return &curdisk->chd();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -255,12 +255,10 @@ chd_file *rom_load_manager::get_disk_handle(const char *region)
|
|||||||
|
|
||||||
int rom_load_manager::set_disk_handle(const char *region, const char *fullpath)
|
int rom_load_manager::set_disk_handle(const char *region, const char *fullpath)
|
||||||
{
|
{
|
||||||
auto chd = global_alloc(open_chd(region));
|
auto chd = std::make_unique<open_chd>(region);
|
||||||
chd_error err = chd->orig_chd().open(fullpath);
|
auto err = chd->orig_chd().open(fullpath);
|
||||||
if (err == CHDERR_NONE)
|
if (err == CHDERR_NONE)
|
||||||
m_chd_list.append(*chd);
|
m_chd_list.push_back(std::move(chd));
|
||||||
else
|
|
||||||
global_free(chd);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1161,7 +1159,7 @@ void rom_load_manager::process_disk_entries(const char *regiontag, const rom_ent
|
|||||||
/* handle files */
|
/* handle files */
|
||||||
if (ROMENTRY_ISFILE(romp))
|
if (ROMENTRY_ISFILE(romp))
|
||||||
{
|
{
|
||||||
auto chd = global_alloc(open_chd(regiontag));
|
auto chd = std::make_unique<open_chd>(regiontag);
|
||||||
|
|
||||||
hash_collection hashes(ROM_GETHASHDATA(romp));
|
hash_collection hashes(ROM_GETHASHDATA(romp));
|
||||||
chd_error err;
|
chd_error err;
|
||||||
@ -1175,7 +1173,7 @@ void rom_load_manager::process_disk_entries(const char *regiontag, const rom_ent
|
|||||||
if (err != CHDERR_NONE)
|
if (err != CHDERR_NONE)
|
||||||
{
|
{
|
||||||
handle_missing_file(romp, std::string(), err);
|
handle_missing_file(romp, std::string(), err);
|
||||||
global_free(chd);
|
chd = nullptr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,14 +1203,14 @@ void rom_load_manager::process_disk_entries(const char *regiontag, const rom_ent
|
|||||||
{
|
{
|
||||||
strcatprintf(m_errorstring, "%s DIFF CHD ERROR: %s\n", filename.c_str(), chd_file::error_string(err));
|
strcatprintf(m_errorstring, "%s DIFF CHD ERROR: %s\n", filename.c_str(), chd_file::error_string(err));
|
||||||
m_errors++;
|
m_errors++;
|
||||||
global_free(chd);
|
chd = nullptr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we're okay, add to the list of disks */
|
/* we're okay, add to the list of disks */
|
||||||
LOG(("Assigning to handle %d\n", DISK_GETINDEX(romp)));
|
LOG(("Assigning to handle %d\n", DISK_GETINDEX(romp)));
|
||||||
m_chd_list.append(*chd);
|
m_chd_list.push_back(std::move(chd));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1478,7 +1476,7 @@ rom_load_manager::rom_load_manager(running_machine &machine)
|
|||||||
count_roms();
|
count_roms();
|
||||||
|
|
||||||
/* reset the disk list */
|
/* reset the disk list */
|
||||||
m_chd_list.reset();
|
m_chd_list.clear();
|
||||||
|
|
||||||
/* process the ROM entries we were passed */
|
/* process the ROM entries we were passed */
|
||||||
process_region_list();
|
process_region_list();
|
||||||
|
@ -264,21 +264,16 @@ class rom_load_manager
|
|||||||
{
|
{
|
||||||
class open_chd
|
class open_chd
|
||||||
{
|
{
|
||||||
friend class simple_list<open_chd>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
open_chd(const char *region)
|
open_chd(const char *region)
|
||||||
: m_next(nullptr),
|
: m_region(region) { }
|
||||||
m_region(region) { }
|
|
||||||
|
|
||||||
open_chd *next() const { return m_next; }
|
|
||||||
const char *region() const { return m_region.c_str(); }
|
const char *region() const { return m_region.c_str(); }
|
||||||
chd_file &chd() { return m_diffchd.opened() ? m_diffchd : m_origchd; }
|
chd_file &chd() { return m_diffchd.opened() ? m_diffchd : m_origchd; }
|
||||||
chd_file &orig_chd() { return m_origchd; }
|
chd_file &orig_chd() { return m_origchd; }
|
||||||
chd_file &diff_chd() { return m_diffchd; }
|
chd_file &diff_chd() { return m_diffchd; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
open_chd * m_next; /* pointer to next in the list */
|
|
||||||
std::string m_region; /* disk region we came from */
|
std::string m_region; /* disk region we came from */
|
||||||
chd_file m_origchd; /* handle to the original CHD */
|
chd_file m_origchd; /* handle to the original CHD */
|
||||||
chd_file m_diffchd; /* handle to the diff CHD */
|
chd_file m_diffchd; /* handle to the diff CHD */
|
||||||
@ -344,7 +339,7 @@ private:
|
|||||||
UINT32 m_romstotalsize; /* total size of ROMs to read */
|
UINT32 m_romstotalsize; /* total size of ROMs to read */
|
||||||
|
|
||||||
emu_file * m_file; /* current file */
|
emu_file * m_file; /* current file */
|
||||||
simple_list<open_chd> m_chd_list; /* disks */
|
std::vector<std::unique_ptr<open_chd>> m_chd_list; /* disks */
|
||||||
|
|
||||||
memory_region * m_region; /* info about current region */
|
memory_region * m_region; /* info about current region */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user