Sync source to mame0238

This commit is contained in:
CharlesThobe 2022-01-04 05:27:00 +02:00
parent 1e2ee32734
commit 0ee0c559b3
135 changed files with 67512 additions and 2201 deletions

View File

@ -38,7 +38,6 @@ address_map_entry::address_map_entry(device_t &device, address_map &map, offs_t
, m_addrselect(0) , m_addrselect(0)
, m_mask(0) , m_mask(0)
, m_cswidth(0) , m_cswidth(0)
, m_flags(0)
, m_share(nullptr) , m_share(nullptr)
, m_region(nullptr) , m_region(nullptr)
, m_rgnoffs(0) , m_rgnoffs(0)
@ -816,7 +815,7 @@ address_map::address_map(device_t &device, address_map_entry *entry)
// address_map - constructor dynamic device mapping case // address_map - constructor dynamic device mapping case
//---------------------------------------------------------- //----------------------------------------------------------
address_map::address_map(const address_space &space, offs_t start, offs_t end, u64 unitmask, int cswidth, u16 flags, device_t &device, address_map_constructor submap_delegate) address_map::address_map(const address_space &space, offs_t start, offs_t end, u64 unitmask, int cswidth, device_t &device, address_map_constructor submap_delegate)
: m_spacenum(space.spacenum()), : m_spacenum(space.spacenum()),
m_device(&device), m_device(&device),
m_view(nullptr), m_view(nullptr),
@ -824,7 +823,7 @@ address_map::address_map(const address_space &space, offs_t start, offs_t end, u
m_unmapval(space.unmap()), m_unmapval(space.unmap()),
m_globalmask(space.addrmask()) m_globalmask(space.addrmask())
{ {
(*this)(start, end).m(DEVICE_SELF, submap_delegate).umask64(unitmask).cswidth(cswidth).flags(flags); (*this)(start, end).m(DEVICE_SELF, submap_delegate).umask64(unitmask).cswidth(cswidth);
} }
@ -996,7 +995,6 @@ void address_map::import_submaps(running_machine &machine, device_t &owner, int
subentry->m_mask = entry->m_mask; subentry->m_mask = entry->m_mask;
subentry->m_cswidth = std::max(subentry->m_cswidth, entry->m_cswidth); subentry->m_cswidth = std::max(subentry->m_cswidth, entry->m_cswidth);
subentry->m_flags = subentry->m_flags | entry->m_flags;
if (subentry->m_addrend > max_end) if (subentry->m_addrend > max_end)
subentry->m_addrend = max_end; subentry->m_addrend = max_end;

View File

@ -156,9 +156,6 @@ public:
// chip select width setting // chip select width setting
address_map_entry &cswidth(int _cswidth) { m_cswidth = _cswidth; return *this; } address_map_entry &cswidth(int _cswidth) { m_cswidth = _cswidth; return *this; }
// flags setting
address_map_entry &flags(u16 _flags) { m_flags = _flags; return *this; }
// I/O port configuration // I/O port configuration
address_map_entry &portr(const char *tag) { m_read.m_type = AMH_PORT; m_read.m_tag = tag; return *this; } address_map_entry &portr(const char *tag) { m_read.m_type = AMH_PORT; m_read.m_tag = tag; return *this; }
address_map_entry &portw(const char *tag) { m_write.m_type = AMH_PORT; m_write.m_tag = tag; return *this; } address_map_entry &portw(const char *tag) { m_write.m_type = AMH_PORT; m_write.m_tag = tag; return *this; }
@ -368,7 +365,6 @@ public:
offs_t m_addrselect; // select bits offs_t m_addrselect; // select bits
u64 m_mask; // mask for which lanes apply u64 m_mask; // mask for which lanes apply
int m_cswidth; // chip select width override int m_cswidth; // chip select width override
u16 m_flags; // user flags
map_handler_data m_read; // data for read handler map_handler_data m_read; // data for read handler
map_handler_data m_write; // data for write handler map_handler_data m_write; // data for write handler
const char * m_share; // tag of a shared memory block const char * m_share; // tag of a shared memory block
@ -508,7 +504,7 @@ public:
address_map(device_t &device, int spacenum); address_map(device_t &device, int spacenum);
address_map(memory_view &view); address_map(memory_view &view);
address_map(device_t &device, address_map_entry *entry); address_map(device_t &device, address_map_entry *entry);
address_map(const address_space &space, offs_t start, offs_t end, u64 unitmask, int cswidth, u16 flags, device_t &device, address_map_constructor submap_delegate); address_map(const address_space &space, offs_t start, offs_t end, u64 unitmask, int cswidth, device_t &device, address_map_constructor submap_delegate);
~address_map(); ~address_map();
// setters // setters

View File

@ -710,33 +710,33 @@ void address_space_installer::populate_map_entry(const address_map_entry &entry,
// fall through to the RAM case otherwise // fall through to the RAM case otherwise
[[fallthrough]]; [[fallthrough]];
case AMH_RAM: case AMH_RAM:
install_ram_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, entry.m_flags, readorwrite, entry.m_memory); install_ram_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, readorwrite, entry.m_memory);
break; break;
case AMH_NOP: case AMH_NOP:
unmap_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, entry.m_flags, readorwrite, true); unmap_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, readorwrite, true);
break; break;
case AMH_UNMAP: case AMH_UNMAP:
unmap_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, entry.m_flags, readorwrite, false); unmap_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, readorwrite, false);
break; break;
case AMH_DEVICE_DELEGATE: case AMH_DEVICE_DELEGATE:
if (readorwrite == read_or_write::READ) if (readorwrite == read_or_write::READ)
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8, entry.m_mask, entry.m_cswidth); break;
case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16, entry.m_mask, entry.m_cswidth); break;
case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32, entry.m_mask, entry.m_cswidth); break;
case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64, entry.m_mask, entry.m_cswidth); break;
} }
else else
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8, entry.m_mask, entry.m_cswidth); break;
case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16, entry.m_mask, entry.m_cswidth); break;
case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32, entry.m_mask, entry.m_cswidth); break;
case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64, entry.m_mask, entry.m_cswidth); break;
} }
break; break;
@ -744,18 +744,18 @@ void address_space_installer::populate_map_entry(const address_map_entry &entry,
if (readorwrite == read_or_write::READ) if (readorwrite == read_or_write::READ)
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8m, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8m, entry.m_mask, entry.m_cswidth); break;
case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16m, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16m, entry.m_mask, entry.m_cswidth); break;
case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32m, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32m, entry.m_mask, entry.m_cswidth); break;
case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64m, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64m, entry.m_mask, entry.m_cswidth); break;
} }
else else
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8m, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8m, entry.m_mask, entry.m_cswidth); break;
case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16m, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16m, entry.m_mask, entry.m_cswidth); break;
case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32m, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32m, entry.m_mask, entry.m_cswidth); break;
case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64m, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64m, entry.m_mask, entry.m_cswidth); break;
} }
break; break;
@ -763,18 +763,18 @@ void address_space_installer::populate_map_entry(const address_map_entry &entry,
if (readorwrite == read_or_write::READ) if (readorwrite == read_or_write::READ)
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8s, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8s, entry.m_mask, entry.m_cswidth); break;
case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16s, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16s, entry.m_mask, entry.m_cswidth); break;
case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32s, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32s, entry.m_mask, entry.m_cswidth); break;
case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64s, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64s, entry.m_mask, entry.m_cswidth); break;
} }
else else
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8s, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8s, entry.m_mask, entry.m_cswidth); break;
case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16s, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16s, entry.m_mask, entry.m_cswidth); break;
case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32s, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32s, entry.m_mask, entry.m_cswidth); break;
case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64s, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64s, entry.m_mask, entry.m_cswidth); break;
} }
break; break;
@ -782,18 +782,18 @@ void address_space_installer::populate_map_entry(const address_map_entry &entry,
if (readorwrite == read_or_write::READ) if (readorwrite == read_or_write::READ)
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8sm, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8sm, entry.m_mask, entry.m_cswidth); break;
case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16sm, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16sm, entry.m_mask, entry.m_cswidth); break;
case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32sm, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32sm, entry.m_mask, entry.m_cswidth); break;
case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64sm, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64sm, entry.m_mask, entry.m_cswidth); break;
} }
else else
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8sm, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8sm, entry.m_mask, entry.m_cswidth); break;
case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16sm, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16sm, entry.m_mask, entry.m_cswidth); break;
case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32sm, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32sm, entry.m_mask, entry.m_cswidth); break;
case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64sm, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64sm, entry.m_mask, entry.m_cswidth); break;
} }
break; break;
@ -801,18 +801,18 @@ void address_space_installer::populate_map_entry(const address_map_entry &entry,
if (readorwrite == read_or_write::READ) if (readorwrite == read_or_write::READ)
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8mo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8mo, entry.m_mask, entry.m_cswidth); break;
case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16mo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16mo, entry.m_mask, entry.m_cswidth); break;
case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32mo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32mo, entry.m_mask, entry.m_cswidth); break;
case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64mo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64mo, entry.m_mask, entry.m_cswidth); break;
} }
else else
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8mo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8mo, entry.m_mask, entry.m_cswidth); break;
case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16mo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16mo, entry.m_mask, entry.m_cswidth); break;
case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32mo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32mo, entry.m_mask, entry.m_cswidth); break;
case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64mo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64mo, entry.m_mask, entry.m_cswidth); break;
} }
break; break;
@ -820,23 +820,23 @@ void address_space_installer::populate_map_entry(const address_map_entry &entry,
if (readorwrite == read_or_write::READ) if (readorwrite == read_or_write::READ)
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8smo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto8smo, entry.m_mask, entry.m_cswidth); break;
case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16smo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto16smo, entry.m_mask, entry.m_cswidth); break;
case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32smo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto32smo, entry.m_mask, entry.m_cswidth); break;
case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64smo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_rproto64smo, entry.m_mask, entry.m_cswidth); break;
} }
else else
switch (data.m_bits) switch (data.m_bits)
{ {
case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8smo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 8: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto8smo, entry.m_mask, entry.m_cswidth); break;
case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16smo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 16: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto16smo, entry.m_mask, entry.m_cswidth); break;
case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32smo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 32: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto32smo, entry.m_mask, entry.m_cswidth); break;
case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64smo, entry.m_mask, entry.m_cswidth, entry.m_flags); break; case 64: install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, entry.m_addrselect, entry.m_wproto64smo, entry.m_mask, entry.m_cswidth); break;
} }
break; break;
case AMH_PORT: case AMH_PORT:
install_readwrite_port(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, entry.m_flags, install_readwrite_port(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror,
(readorwrite == read_or_write::READ) ? entry.m_devbase.subtag(data.m_tag) : "", (readorwrite == read_or_write::READ) ? entry.m_devbase.subtag(data.m_tag) : "",
(readorwrite == read_or_write::WRITE) ? entry.m_devbase.subtag(data.m_tag) : ""); (readorwrite == read_or_write::WRITE) ? entry.m_devbase.subtag(data.m_tag) : "");
break; break;
@ -847,7 +847,7 @@ void address_space_installer::populate_map_entry(const address_map_entry &entry,
memory_bank *bank = m_manager.bank_find(tag); memory_bank *bank = m_manager.bank_find(tag);
if (!bank) if (!bank)
bank = m_manager.bank_alloc(entry.m_devbase, tag); bank = m_manager.bank_alloc(entry.m_devbase, tag);
install_bank_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror, entry.m_flags, install_bank_generic(entry.m_addrstart, entry.m_addrend, entry.m_addrmirror,
(readorwrite == read_or_write::READ) ? bank : nullptr, (readorwrite == read_or_write::READ) ? bank : nullptr,
(readorwrite == read_or_write::WRITE) ? bank : nullptr); (readorwrite == read_or_write::WRITE) ? bank : nullptr);
} }

View File

@ -484,12 +484,12 @@ class handler_entry
template<int Level, int Width, int AddrShift, endianness_t Endian> friend class address_space_specific; template<int Level, int Width, int AddrShift, endianness_t Endian> friend class address_space_specific;
public: public:
// Typing flags (low 16 bits are for the user) // Typing flags
static constexpr u32 F_UNMAP = 0x00010000; // the unmapped memory accessed handler static constexpr u32 F_UNMAP = 0x00000001; // the unmapped memory accessed handler
static constexpr u32 F_DISPATCH = 0x00020000; // handler that forwards the access to other handlers static constexpr u32 F_DISPATCH = 0x00000002; // handler that forwards the access to other handlers
static constexpr u32 F_UNITS = 0x00040000; // handler that merges/splits an access among multiple handlers (unitmask support) static constexpr u32 F_UNITS = 0x00000004; // handler that merges/splits an access among multiple handlers (unitmask support)
static constexpr u32 F_PASSTHROUGH = 0x00080000; // handler that passes through the request to another handler static constexpr u32 F_PASSTHROUGH = 0x00000008; // handler that passes through the request to another handler
static constexpr u32 F_VIEW = 0x00100000; // handler for a view (kinda like dispatch except not entirely) static constexpr u32 F_VIEW = 0x00000010; // handler for a view (kinda like dispatch except not entirely)
// Start/end of range flags // Start/end of range flags
static constexpr u8 START = 1; static constexpr u8 START = 1;
@ -580,7 +580,6 @@ public:
~handler_entry_read() {} ~handler_entry_read() {}
virtual uX read(offs_t offset, uX mem_mask) const = 0; virtual uX read(offs_t offset, uX mem_mask) const = 0;
virtual std::pair<uX, u16> read_flags(offs_t offset, uX mem_mask) const = 0;
virtual void *get_ptr(offs_t offset) const; virtual void *get_ptr(offs_t offset) const;
virtual void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift> *&handler) const; virtual void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift> *&handler) const;
@ -655,7 +654,6 @@ public:
virtual ~handler_entry_write() {} virtual ~handler_entry_write() {}
virtual void write(offs_t offset, uX data, uX mem_mask) const = 0; virtual void write(offs_t offset, uX data, uX mem_mask) const = 0;
virtual u16 write_flags(offs_t offset, uX data, uX mem_mask) const = 0;
virtual void *get_ptr(offs_t offset) const; virtual void *get_ptr(offs_t offset) const;
virtual void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift> *&handler) const; virtual void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift> *&handler) const;
@ -995,274 +993,6 @@ template<int Width, int AddrShift, endianness_t Endian, int TargetWidth, bool Al
} }
} }
} }
// generic direct read with flags
template<int Width, int AddrShift, endianness_t Endian, int TargetWidth, bool Aligned, typename TF> std::pair<typename emu::detail::handler_entry_size<TargetWidth>::uX, u16> memory_read_generic_flags(TF ropf, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
{
using TargetType = typename emu::detail::handler_entry_size<TargetWidth>::uX;
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
constexpr u32 TARGET_BYTES = 1 << TargetWidth;
constexpr u32 TARGET_BITS = 8 * TARGET_BYTES;
constexpr u32 NATIVE_BYTES = 1 << Width;
constexpr u32 NATIVE_BITS = 8 * NATIVE_BYTES;
constexpr u32 NATIVE_STEP = AddrShift >= 0 ? NATIVE_BYTES << iabs(AddrShift) : NATIVE_BYTES >> iabs(AddrShift);
constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? make_bitmask<u32>(Width + AddrShift) : 0;
// equal to native size and aligned; simple pass-through to the native reader
if (NATIVE_BYTES == TARGET_BYTES && (Aligned || (address & NATIVE_MASK) == 0))
return ropf(address & ~NATIVE_MASK, mask);
// if native size is larger, see if we can do a single masked read (guaranteed if we're aligned)
if (NATIVE_BYTES > TARGET_BYTES)
{
u32 offsbits = 8 * (memory_offset_to_byte(address, AddrShift) & (NATIVE_BYTES - (Aligned ? TARGET_BYTES : 1)));
if (Aligned || (offsbits + TARGET_BITS <= NATIVE_BITS))
{
if (Endian != ENDIANNESS_LITTLE) offsbits = NATIVE_BITS - TARGET_BITS - offsbits;
auto pack = ropf(address & ~NATIVE_MASK, (NativeType)mask << offsbits);
pack.first >>= offsbits;
return pack;
}
}
// determine our alignment against the native boundaries, and mask the address
u32 offsbits = 8 * (memory_offset_to_byte(address, AddrShift) & (NATIVE_BYTES - 1));
address &= ~NATIVE_MASK;
// if we're here, and native size is larger or equal to the target, we need exactly 2 reads
if (NATIVE_BYTES >= TARGET_BYTES)
{
// little-endian case
if (Endian == ENDIANNESS_LITTLE)
{
// read lower bits from lower address
u16 flags = 0;
TargetType result = 0;
NativeType curmask = (NativeType)mask << offsbits;
if (curmask != 0) { auto pack = ropf(address, curmask); result = pack.first >> offsbits; flags = pack.second; }
// read upper bits from upper address
offsbits = NATIVE_BITS - offsbits;
curmask = mask >> offsbits;
if (curmask != 0) { auto pack = ropf(address + NATIVE_STEP, curmask); result |= pack.first << offsbits; flags |= pack.second; }
return std::pair<NativeType, u16>(result, flags);
}
// big-endian case
else
{
// left-justify the mask to the target type
constexpr u32 LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT = ((NATIVE_BITS >= TARGET_BITS) ? (NATIVE_BITS - TARGET_BITS) : 0);
u16 flags = 0;
NativeType result = 0;
NativeType ljmask = (NativeType)mask << LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT;
NativeType curmask = ljmask >> offsbits;
// read upper bits from lower address
if (curmask != 0) { auto pack = ropf(address, curmask); result = pack.first << offsbits; flags = pack.second; }
offsbits = NATIVE_BITS - offsbits;
// read lower bits from upper address
curmask = ljmask << offsbits;
if (curmask != 0) { auto pack = ropf(address + NATIVE_STEP, curmask); result |= pack.first >> offsbits; flags |= pack.second; }
// return the un-justified result
return std::pair<NativeType, u16>(result >> LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT, flags);
}
}
// if we're here, then we have 2 or more reads needed to get our final result
else
{
// compute the maximum number of loops; we do it this way so that there are
// a fixed number of loops for the compiler to unroll if it desires
constexpr u32 MAX_SPLITS_MINUS_ONE = TARGET_BYTES / NATIVE_BYTES - 1;
u16 flags = 0;
TargetType result = 0;
// little-endian case
if (Endian == ENDIANNESS_LITTLE)
{
// read lowest bits from first address
NativeType curmask = mask << offsbits;
if (curmask != 0) { auto pack = ropf(address, curmask); result = pack.first >> offsbits; flags = pack.second; }
// read middle bits from subsequent addresses
offsbits = NATIVE_BITS - offsbits;
for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++)
{
address += NATIVE_STEP;
curmask = mask >> offsbits;
if (curmask != 0) { auto pack = ropf(address, curmask); result |= (TargetType)pack.first << offsbits; flags |= pack.second; }
offsbits += NATIVE_BITS;
}
// if we're not aligned and we still have bits left, read uppermost bits from last address
if (!Aligned && offsbits < TARGET_BITS)
{
curmask = mask >> offsbits;
if (curmask != 0) { auto pack = ropf(address + NATIVE_STEP, curmask); result |= (TargetType)pack.first << offsbits; flags |= pack.second; }
}
}
// big-endian case
else
{
// read highest bits from first address
offsbits = TARGET_BITS - (NATIVE_BITS - offsbits);
NativeType curmask = mask >> offsbits;
if (curmask != 0) { auto pack = ropf(address, curmask); result = pack.first >> offsbits; flags = pack.second; }
// read middle bits from subsequent addresses
for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++)
{
offsbits -= NATIVE_BITS;
address += NATIVE_STEP;
curmask = mask >> offsbits;
if (curmask != 0) { auto pack = ropf(address, curmask); result |= (TargetType)pack.first >> offsbits; flags |= pack.second; }
}
// if we're not aligned and we still have bits left, read lowermost bits from the last address
if (!Aligned && offsbits != 0)
{
offsbits = NATIVE_BITS - offsbits;
curmask = mask << offsbits;
if (curmask != 0) { auto pack = ropf(address + NATIVE_STEP, curmask); result |= (TargetType)pack.first >> offsbits; flags |= pack.second; }
}
}
return std::pair<NativeType, u16>(result, flags);
}
}
// generic direct write with flags
template<int Width, int AddrShift, endianness_t Endian, int TargetWidth, bool Aligned, typename TF> u16 memory_write_generic_flags(TF wopf, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX data, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
{
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
constexpr u32 TARGET_BYTES = 1 << TargetWidth;
constexpr u32 TARGET_BITS = 8 * TARGET_BYTES;
constexpr u32 NATIVE_BYTES = 1 << Width;
constexpr u32 NATIVE_BITS = 8 * NATIVE_BYTES;
constexpr u32 NATIVE_STEP = AddrShift >= 0 ? NATIVE_BYTES << iabs(AddrShift) : NATIVE_BYTES >> iabs(AddrShift);
constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? (1 << (Width + AddrShift)) - 1 : 0;
// equal to native size and aligned; simple pass-through to the native writer
if (NATIVE_BYTES == TARGET_BYTES && (Aligned || (address & NATIVE_MASK) == 0))
return wopf(address & ~NATIVE_MASK, data, mask);
// if native size is larger, see if we can do a single masked write (guaranteed if we're aligned)
if (NATIVE_BYTES > TARGET_BYTES)
{
u32 offsbits = 8 * (memory_offset_to_byte(address, AddrShift) & (NATIVE_BYTES - (Aligned ? TARGET_BYTES : 1)));
if (Aligned || (offsbits + TARGET_BITS <= NATIVE_BITS))
{
if (Endian != ENDIANNESS_LITTLE) offsbits = NATIVE_BITS - TARGET_BITS - offsbits;
return wopf(address & ~NATIVE_MASK, (NativeType)data << offsbits, (NativeType)mask << offsbits);
}
}
// determine our alignment against the native boundaries, and mask the address
u32 offsbits = 8 * (memory_offset_to_byte(address, AddrShift) & (NATIVE_BYTES - 1));
address &= ~NATIVE_MASK;
// if we're here, and native size is larger or equal to the target, we need exactly 2 writes
if (NATIVE_BYTES >= TARGET_BYTES)
{
// little-endian case
if (Endian == ENDIANNESS_LITTLE)
{
// write lower bits to lower address
u16 flags = 0;
NativeType curmask = (NativeType)mask << offsbits;
if (curmask != 0) flags |= wopf(address, (NativeType)data << offsbits, curmask);
// write upper bits to upper address
offsbits = NATIVE_BITS - offsbits;
curmask = mask >> offsbits;
if (curmask != 0) flags |= wopf(address + NATIVE_STEP, data >> offsbits, curmask);
return flags;
}
// big-endian case
else
{
// left-justify the mask and data to the target type
u16 flags = 0;
constexpr u32 LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT = ((NATIVE_BITS >= TARGET_BITS) ? (NATIVE_BITS - TARGET_BITS) : 0);
NativeType ljdata = (NativeType)data << LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT;
NativeType ljmask = (NativeType)mask << LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT;
// write upper bits to lower address
NativeType curmask = ljmask >> offsbits;
if (curmask != 0) flags |= wopf(address, ljdata >> offsbits, curmask);
// write lower bits to upper address
offsbits = NATIVE_BITS - offsbits;
curmask = ljmask << offsbits;
if (curmask != 0) flags |= wopf(address + NATIVE_STEP, ljdata << offsbits, curmask);
return flags;
}
}
// if we're here, then we have 2 or more writes needed to get our final result
else
{
// compute the maximum number of loops; we do it this way so that there are
// a fixed number of loops for the compiler to unroll if it desires
constexpr u32 MAX_SPLITS_MINUS_ONE = TARGET_BYTES / NATIVE_BYTES - 1;
u16 flags = 0;
// little-endian case
if (Endian == ENDIANNESS_LITTLE)
{
// write lowest bits to first address
NativeType curmask = mask << offsbits;
if (curmask != 0) flags |= wopf(address, data << offsbits, curmask);
// write middle bits to subsequent addresses
offsbits = NATIVE_BITS - offsbits;
for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++)
{
address += NATIVE_STEP;
curmask = mask >> offsbits;
if (curmask != 0) flags |= wopf(address, data >> offsbits, curmask);
offsbits += NATIVE_BITS;
}
// if we're not aligned and we still have bits left, write uppermost bits to last address
if (!Aligned && offsbits < TARGET_BITS)
{
curmask = mask >> offsbits;
if (curmask != 0) flags |= wopf(address + NATIVE_STEP, data >> offsbits, curmask);
}
}
// big-endian case
else
{
// write highest bits to first address
offsbits = TARGET_BITS - (NATIVE_BITS - offsbits);
NativeType curmask = mask >> offsbits;
if (curmask != 0) flags |= wopf(address, data >> offsbits, curmask);
// write middle bits to subsequent addresses
for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++)
{
offsbits -= NATIVE_BITS;
address += NATIVE_STEP;
curmask = mask >> offsbits;
if (curmask != 0) flags |= wopf(address, data >> offsbits, curmask);
}
// if we're not aligned and we still have bits left, write lowermost bits to the last address
if (!Aligned && offsbits != 0)
{
offsbits = NATIVE_BITS - offsbits;
curmask = mask << offsbits;
if (curmask != 0) flags |= wopf(address + NATIVE_STEP, data << offsbits, curmask);
}
}
return flags;
}
}
// ======================> Direct dispatching // ======================> Direct dispatching
@ -1280,20 +1010,6 @@ template<int Level, int Width, int AddrShift> void dispatch_write(offs_t mask, o
} }
template<int Level, int Width, int AddrShift> std::pair<typename emu::detail::handler_entry_size<Width>::uX, u16> dispatch_read_flags(offs_t mask, offs_t offset, typename emu::detail::handler_entry_size<Width>::uX mem_mask, const handler_entry_read<Width, AddrShift> *const *dispatch)
{
static constexpr u32 LowBits = emu::detail::handler_entry_dispatch_level_to_lowbits(Level, Width, AddrShift);
return dispatch[(offset & mask) >> LowBits]->read_flags(offset, mem_mask);
}
template<int Level, int Width, int AddrShift> u16 dispatch_write_flags(offs_t mask, offs_t offset, typename emu::detail::handler_entry_size<Width>::uX data, typename emu::detail::handler_entry_size<Width>::uX mem_mask, const handler_entry_write<Width, AddrShift> *const *dispatch)
{
static constexpr u32 LowBits = emu::detail::handler_entry_dispatch_level_to_lowbits(Level, Width, AddrShift);
return dispatch[(offset & mask) >> LowBits]->write_flags(offset, data, mem_mask);
}
// ======================> memory_access_specific // ======================> memory_access_specific
// memory_access_specific does uncached but faster accesses by shortcutting the address_space virtual call // memory_access_specific does uncached but faster accesses by shortcutting the address_space virtual call
@ -1322,67 +1038,33 @@ public:
return *m_space; return *m_space;
} }
auto rop() { return [this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }; } u8 read_byte(offs_t address) { return Width == 0 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 0, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xff); }
auto ropf() { return [this](offs_t offset, NativeType mask) -> std::pair<NativeType, u16> { return read_native_flags(offset, mask); }; } u16 read_word(offs_t address) { return Width == 1 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffff); }
auto wop() { return [this](offs_t offset, NativeType data, NativeType mask) -> void { write_native(offset, data, mask); }; } u16 read_word(offs_t address, u16 mask) { return memory_read_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
auto wopf() { return [this](offs_t offset, NativeType data, NativeType mask) -> u16 { return write_native_flags(offset, data, mask); }; } u16 read_word_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffff); }
u16 read_word_unaligned(offs_t address, u16 mask) { return memory_read_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u32 read_dword(offs_t address) { return Width == 2 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffff); }
u32 read_dword(offs_t address, u32 mask) { return memory_read_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u32 read_dword_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffff); }
u32 read_dword_unaligned(offs_t address, u32 mask) { return memory_read_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u64 read_qword(offs_t address) { return Width == 3 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffffffffffffU); }
u64 read_qword(offs_t address, u64 mask) { return memory_read_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u64 read_qword_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffffffffffffU); }
u64 read_qword_unaligned(offs_t address, u64 mask) { return memory_read_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u8 read_byte(offs_t address) { if constexpr(Width == 0) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 0, true>(rop(), address, 0xff); } void write_byte(offs_t address, u8 data) { if (Width == 0) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 0, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xff); }
u16 read_word(offs_t address) { if constexpr(Width == 1) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 1, true>(rop(), address, 0xffff); } void write_word(offs_t address, u16 data) { if (Width == 1) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffff); }
u16 read_word(offs_t address, u16 mask) { return memory_read_generic<Width, AddrShift, Endian, 1, true>(rop(), address, mask); } void write_word(offs_t address, u16 data, u16 mask) { memory_write_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
u16 read_word_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 1, false>(rop(), address, 0xffff); } void write_word_unaligned(offs_t address, u16 data) { memory_write_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffff); }
u16 read_word_unaligned(offs_t address, u16 mask) { return memory_read_generic<Width, AddrShift, Endian, 1, false>(rop(), address, mask); } void write_word_unaligned(offs_t address, u16 data, u16 mask) { memory_write_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
u32 read_dword(offs_t address) { if constexpr(Width == 2) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 2, true>(rop(), address, 0xffffffff); } void write_dword(offs_t address, u32 data) { if (Width == 2) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffff); }
u32 read_dword(offs_t address, u32 mask) { return memory_read_generic<Width, AddrShift, Endian, 2, true>(rop(), address, mask); } void write_dword(offs_t address, u32 data, u32 mask) { memory_write_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
u32 read_dword_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 2, false>(rop(), address, 0xffffffff); } void write_dword_unaligned(offs_t address, u32 data) { memory_write_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffff); }
u32 read_dword_unaligned(offs_t address, u32 mask) { return memory_read_generic<Width, AddrShift, Endian, 2, false>(rop(), address, mask); } void write_dword_unaligned(offs_t address, u32 data, u32 mask) { memory_write_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
u64 read_qword(offs_t address) { if constexpr(Width == 3) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 3, true>(rop(), address, 0xffffffffffffffffU); } void write_qword(offs_t address, u64 data) { if (Width == 3) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffffffffffffU); }
u64 read_qword(offs_t address, u64 mask) { return memory_read_generic<Width, AddrShift, Endian, 3, true>(rop(), address, mask); } void write_qword(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
u64 read_qword_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 3, false>(rop(), address, 0xffffffffffffffffU); } void write_qword_unaligned(offs_t address, u64 data) { memory_write_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffffffffffffU); }
u64 read_qword_unaligned(offs_t address, u64 mask) { return memory_read_generic<Width, AddrShift, Endian, 3, false>(rop(), address, mask); } void write_qword_unaligned(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
void write_byte(offs_t address, u8 data) { if constexpr(Width == 0) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 0, true>(wop(), address, data, 0xff); }
void write_word(offs_t address, u16 data) { if constexpr(Width == 1) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 1, true>(wop(), address, data, 0xffff); }
void write_word(offs_t address, u16 data, u16 mask) { memory_write_generic<Width, AddrShift, Endian, 1, true>(wop(), address, data, mask); }
void write_word_unaligned(offs_t address, u16 data) { memory_write_generic<Width, AddrShift, Endian, 1, false>(wop(), address, data, 0xffff); }
void write_word_unaligned(offs_t address, u16 data, u16 mask) { memory_write_generic<Width, AddrShift, Endian, 1, false>(wop(), address, data, mask); }
void write_dword(offs_t address, u32 data) { if constexpr(Width == 2) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 2, true>(wop(), address, data, 0xffffffff); }
void write_dword(offs_t address, u32 data, u32 mask) { memory_write_generic<Width, AddrShift, Endian, 2, true>(wop(), address, data, mask); }
void write_dword_unaligned(offs_t address, u32 data) { memory_write_generic<Width, AddrShift, Endian, 2, false>(wop(), address, data, 0xffffffff); }
void write_dword_unaligned(offs_t address, u32 data, u32 mask) { memory_write_generic<Width, AddrShift, Endian, 2, false>(wop(), address, data, mask); }
void write_qword(offs_t address, u64 data) { if constexpr(Width == 3) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 3, true>(wop(), address, data, 0xffffffffffffffffU); }
void write_qword(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, true>(wop(), address, data, mask); }
void write_qword_unaligned(offs_t address, u64 data) { memory_write_generic<Width, AddrShift, Endian, 3, false>(wop(), address, data, 0xffffffffffffffffU); }
void write_qword_unaligned(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, false>(wop(), address, data, mask); }
std::pair<u8, u16> read_byte_flags(offs_t address) { if constexpr(Width == 0) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 0, true>(ropf(), address, 0xff); }
std::pair<u16, u16> read_word_flags(offs_t address) { if constexpr(Width == 1) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 1, true>(ropf(), address, 0xffff); }
std::pair<u16, u16> read_word_flags(offs_t address, u16 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 1, true>(ropf(), address, mask); }
std::pair<u16, u16> read_word_unaligned_flags(offs_t address) { return memory_read_generic_flags<Width, AddrShift, Endian, 1, false>(ropf(), address, 0xffff); }
std::pair<u16, u16> read_word_unaligned_flags(offs_t address, u16 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 1, false>(ropf(), address, mask); }
std::pair<u32, u16> read_dword_flags(offs_t address) { if constexpr(Width == 2) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 2, true>(ropf(), address, 0xffffffff); }
std::pair<u32, u16> read_dword_flags(offs_t address, u32 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 2, true>(ropf(), address, mask); }
std::pair<u32, u16> read_dword_unaligned_flags(offs_t address) { return memory_read_generic_flags<Width, AddrShift, Endian, 2, false>(ropf(), address, 0xffffffff); }
std::pair<u32, u16> read_dword_unaligned_flags(offs_t address, u32 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 2, false>(ropf(), address, mask); }
std::pair<u64, u16> read_qword_flags(offs_t address) { if constexpr(Width == 3) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 3, true>(ropf(), address, 0xffffffffffffffffU); }
std::pair<u64, u16> read_qword_flags(offs_t address, u64 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 3, true>(ropf(), address, mask); }
std::pair<u64, u16> read_qword_unaligned_flags(offs_t address) { return memory_read_generic_flags<Width, AddrShift, Endian, 3, false>(ropf(), address, 0xffffffffffffffffU); }
std::pair<u64, u16> read_qword_unaligned_flags(offs_t address, u64 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 3, false>(ropf(), address, mask); }
u16 write_byte_flags(offs_t address, u8 data) { if constexpr(Width == 0) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 0, true>(wopf(), address, data, 0xff); }
u16 write_word_flags(offs_t address, u16 data) { if constexpr(Width == 1) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 1, true>(wopf(), address, data, 0xffff); }
u16 write_word_flags(offs_t address, u16 data, u16 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 1, true>(wopf(), address, data, mask); }
u16 write_word_unaligned_flags(offs_t address, u16 data) { return memory_write_generic_flags<Width, AddrShift, Endian, 1, false>(wopf(), address, data, 0xffff); }
u16 write_word_unaligned_flags(offs_t address, u16 data, u16 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 1, false>(wopf(), address, data, mask); }
u16 write_dword_flags(offs_t address, u32 data) { if constexpr(Width == 2) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 2, true>(wopf(), address, data, 0xffffffff); }
u16 write_dword_flags(offs_t address, u32 data, u32 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 2, true>(wopf(), address, data, mask); }
u16 write_dword_unaligned_flags(offs_t address, u32 data) { return memory_write_generic_flags<Width, AddrShift, Endian, 2, false>(wopf(), address, data, 0xffffffff); }
u16 write_dword_unaligned_flags(offs_t address, u32 data, u32 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 2, false>(wopf(), address, data, mask); }
u16 write_qword_flags(offs_t address, u64 data) { if constexpr(Width == 3) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 3, true>(wopf(), address, data, 0xffffffffffffffffU); }
u16 write_qword_flags(offs_t address, u64 data, u64 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 3, true>(wop(), address, data, mask); }
u16 write_qword_unaligned_flags(offs_t address, u64 data) { return memory_write_generic_flags<Width, AddrShift, Endian, 3, false>(wopf(), address, data, 0xffffffffffffffffU); }
u16 write_qword_unaligned_flags(offs_t address, u64 data, u64 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 3, false>(wopf(), address, data, mask); }
private: private:
address_space * m_space; address_space * m_space;
@ -1400,14 +1082,6 @@ private:
dispatch_write<Level, Width, AddrShift>(offs_t(-1), address & m_addrmask, data, mask, m_dispatch_write); dispatch_write<Level, Width, AddrShift>(offs_t(-1), address & m_addrmask, data, mask, m_dispatch_write);
} }
std::pair<NativeType, u16> read_native_flags(offs_t address, NativeType mask = ~NativeType(0)) {
return dispatch_read_flags<Level, Width, AddrShift>(offs_t(-1), address & m_addrmask, mask, m_dispatch_read);
}
u16 write_native_flags(offs_t address, NativeType data, NativeType mask = ~NativeType(0)) {
return dispatch_write_flags<Level, Width, AddrShift>(offs_t(-1), address & m_addrmask, data, mask, m_dispatch_write);
}
void set(address_space *space, std::pair<const void *, const void *> rw); void set(address_space *space, std::pair<const void *, const void *> rw);
}; };
@ -1467,67 +1141,33 @@ public:
return m_cache_r->get_ptr(address); return m_cache_r->get_ptr(address);
} }
auto rop() { return [this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }; } u8 read_byte(offs_t address) { return Width == 0 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 0, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xff); }
auto ropf() { return [this](offs_t offset, NativeType mask) -> std::pair<NativeType, u16> { return read_native_flags(offset, mask); }; } u16 read_word(offs_t address) { return Width == 1 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffff); }
auto wop() { return [this](offs_t offset, NativeType data, NativeType mask) -> void { write_native(offset, data, mask); }; } u16 read_word(offs_t address, u16 mask) { return memory_read_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
auto wopf() { return [this](offs_t offset, NativeType data, NativeType mask) -> u16 { return write_native_flags(offset, data, mask); }; } u16 read_word_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffff); }
u16 read_word_unaligned(offs_t address, u16 mask) { return memory_read_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u32 read_dword(offs_t address) { return Width == 2 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffff); }
u32 read_dword(offs_t address, u32 mask) { return memory_read_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u32 read_dword_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffff); }
u32 read_dword_unaligned(offs_t address, u32 mask) { return memory_read_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u64 read_qword(offs_t address) { return Width == 3 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffffffffffffU); }
u64 read_qword(offs_t address, u64 mask) { return memory_read_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u64 read_qword_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffffffffffffU); }
u64 read_qword_unaligned(offs_t address, u64 mask) { return memory_read_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u8 read_byte(offs_t address) { if constexpr(Width == 0) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 0, true>(rop(), address, 0xff); } void write_byte(offs_t address, u8 data) { if (Width == 0) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 0, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xff); }
u16 read_word(offs_t address) { if constexpr(Width == 1) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 1, true>(rop(), address, 0xffff); } void write_word(offs_t address, u16 data) { if (Width == 1) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffff); }
u16 read_word(offs_t address, u16 mask) { return memory_read_generic<Width, AddrShift, Endian, 1, true>(rop(), address, mask); } void write_word(offs_t address, u16 data, u16 mask) { memory_write_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
u16 read_word_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 1, false>(rop(), address, 0xffff); } void write_word_unaligned(offs_t address, u16 data) { memory_write_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffff); }
u16 read_word_unaligned(offs_t address, u16 mask) { return memory_read_generic<Width, AddrShift, Endian, 1, false>(rop(), address, mask); } void write_word_unaligned(offs_t address, u16 data, u16 mask) { memory_write_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
u32 read_dword(offs_t address) { if constexpr(Width == 2) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 2, true>(rop(), address, 0xffffffff); } void write_dword(offs_t address, u32 data) { if (Width == 2) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffff); }
u32 read_dword(offs_t address, u32 mask) { return memory_read_generic<Width, AddrShift, Endian, 2, true>(rop(), address, mask); } void write_dword(offs_t address, u32 data, u32 mask) { memory_write_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
u32 read_dword_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 2, false>(rop(), address, 0xffffffff); } void write_dword_unaligned(offs_t address, u32 data) { memory_write_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffff); }
u32 read_dword_unaligned(offs_t address, u32 mask) { return memory_read_generic<Width, AddrShift, Endian, 2, false>(rop(), address, mask); } void write_dword_unaligned(offs_t address, u32 data, u32 mask) { memory_write_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
u64 read_qword(offs_t address) { if constexpr(Width == 3) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 3, true>(rop(), address, 0xffffffffffffffffU); } void write_qword(offs_t address, u64 data) { if (Width == 3) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffffffffffffU); }
u64 read_qword(offs_t address, u64 mask) { return memory_read_generic<Width, AddrShift, Endian, 3, true>(rop(), address, mask); } void write_qword(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
u64 read_qword_unaligned(offs_t address) { return memory_read_generic<Width, AddrShift, Endian, 3, false>(rop(), address, 0xffffffffffffffffU); } void write_qword_unaligned(offs_t address, u64 data) { memory_write_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffffffffffffU); }
u64 read_qword_unaligned(offs_t address, u64 mask) { return memory_read_generic<Width, AddrShift, Endian, 3, false>(rop(), address, mask); } void write_qword_unaligned(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
void write_byte(offs_t address, u8 data) { if constexpr(Width == 0) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 0, true>(wop(), address, data, 0xff); }
void write_word(offs_t address, u16 data) { if constexpr(Width == 1) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 1, true>(wop(), address, data, 0xffff); }
void write_word(offs_t address, u16 data, u16 mask) { memory_write_generic<Width, AddrShift, Endian, 1, true>(wop(), address, data, mask); }
void write_word_unaligned(offs_t address, u16 data) { memory_write_generic<Width, AddrShift, Endian, 1, false>(wop(), address, data, 0xffff); }
void write_word_unaligned(offs_t address, u16 data, u16 mask) { memory_write_generic<Width, AddrShift, Endian, 1, false>(wop(), address, data, mask); }
void write_dword(offs_t address, u32 data) { if constexpr(Width == 2) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 2, true>(wop(), address, data, 0xffffffff); }
void write_dword(offs_t address, u32 data, u32 mask) { memory_write_generic<Width, AddrShift, Endian, 2, true>(wop(), address, data, mask); }
void write_dword_unaligned(offs_t address, u32 data) { memory_write_generic<Width, AddrShift, Endian, 2, false>(wop(), address, data, 0xffffffff); }
void write_dword_unaligned(offs_t address, u32 data, u32 mask) { memory_write_generic<Width, AddrShift, Endian, 2, false>(wop(), address, data, mask); }
void write_qword(offs_t address, u64 data) { if constexpr(Width == 3) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 3, true>(wop(), address, data, 0xffffffffffffffffU); }
void write_qword(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, true>(wop(), address, data, mask); }
void write_qword_unaligned(offs_t address, u64 data) { memory_write_generic<Width, AddrShift, Endian, 3, false>(wop(), address, data, 0xffffffffffffffffU); }
void write_qword_unaligned(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, false>(wop(), address, data, mask); }
std::pair<u8, u16> read_byte_flags(offs_t address) { if constexpr(Width == 0) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 0, true>(ropf(), address, 0xff); }
std::pair<u16, u16> read_word_flags(offs_t address) { if constexpr(Width == 1) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 1, true>(ropf(), address, 0xffff); }
std::pair<u16, u16> read_word_flags(offs_t address, u16 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 1, true>(ropf(), address, mask); }
std::pair<u16, u16> read_word_unaligned_flags(offs_t address) { return memory_read_generic_flags<Width, AddrShift, Endian, 1, false>(ropf(), address, 0xffff); }
std::pair<u16, u16> read_word_unaligned_flags(offs_t address, u16 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 1, false>(ropf(), address, mask); }
std::pair<u32, u16> read_dword_flags(offs_t address) { if constexpr(Width == 2) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 2, true>(ropf(), address, 0xffffffff); }
std::pair<u32, u16> read_dword_flags(offs_t address, u32 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 2, true>(ropf(), address, mask); }
std::pair<u32, u16> read_dword_unaligned_flags(offs_t address) { return memory_read_generic_flags<Width, AddrShift, Endian, 2, false>(ropf(), address, 0xffffffff); }
std::pair<u32, u16> read_dword_unaligned_flags(offs_t address, u32 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 2, false>(ropf(), address, mask); }
std::pair<u64, u16> read_qword_flags(offs_t address) { if constexpr(Width == 3) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 3, true>(ropf(), address, 0xffffffffffffffffU); }
std::pair<u64, u16> read_qword_flags(offs_t address, u64 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 3, true>(ropf(), address, mask); }
std::pair<u64, u16> read_qword_unaligned_flags(offs_t address) { return memory_read_generic_flags<Width, AddrShift, Endian, 3, false>(ropf(), address, 0xffffffffffffffffU); }
std::pair<u64, u16> read_qword_unaligned_flags(offs_t address, u64 mask) { return memory_read_generic_flags<Width, AddrShift, Endian, 3, false>(ropf(), address, mask); }
u16 write_byte_flags(offs_t address, u8 data) { if constexpr(Width == 0) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 0, true>(wopf(), address, data, 0xff); }
u16 write_word_flags(offs_t address, u16 data) { if constexpr(Width == 1) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 1, true>(wopf(), address, data, 0xffff); }
u16 write_word_flags(offs_t address, u16 data, u16 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 1, true>(wopf(), address, data, mask); }
u16 write_word_unaligned_flags(offs_t address, u16 data) { return memory_write_generic_flags<Width, AddrShift, Endian, 1, false>(wopf(), address, data, 0xffff); }
u16 write_word_unaligned_flags(offs_t address, u16 data, u16 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 1, false>(wopf(), address, data, mask); }
u16 write_dword_flags(offs_t address, u32 data) { if constexpr(Width == 2) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 2, true>(wopf(), address, data, 0xffffffff); }
u16 write_dword_flags(offs_t address, u32 data, u32 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 2, true>(wopf(), address, data, mask); }
u16 write_dword_unaligned_flags(offs_t address, u32 data) { return memory_write_generic_flags<Width, AddrShift, Endian, 2, false>(wopf(), address, data, 0xffffffff); }
u16 write_dword_unaligned_flags(offs_t address, u32 data, u32 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 2, false>(wopf(), address, data, mask); }
u16 write_qword_flags(offs_t address, u64 data) { if constexpr(Width == 3) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 3, true>(wopf(), address, data, 0xffffffffffffffffU); }
u16 write_qword_flags(offs_t address, u64 data, u64 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 3, true>(wop(), address, data, mask); }
u16 write_qword_unaligned_flags(offs_t address, u64 data) { return memory_write_generic_flags<Width, AddrShift, Endian, 3, false>(wopf(), address, data, 0xffffffffffffffffU); }
u16 write_qword_unaligned_flags(offs_t address, u64 data, u64 mask) { return memory_write_generic_flags<Width, AddrShift, Endian, 3, false>(wopf(), address, data, mask); }
private: private:
address_space * m_space; address_space * m_space;
@ -1545,8 +1185,6 @@ private:
NativeType read_native(offs_t address, NativeType mask = ~NativeType(0)); NativeType read_native(offs_t address, NativeType mask = ~NativeType(0));
void write_native(offs_t address, NativeType data, NativeType mask = ~NativeType(0)); void write_native(offs_t address, NativeType data, NativeType mask = ~NativeType(0));
std::pair<NativeType, u16> read_native_flags(offs_t address, NativeType mask = ~NativeType(0));
u16 write_native_flags(offs_t address, NativeType data, NativeType mask = ~NativeType(0));
void set(address_space *space, std::pair<void *, void *> rw); void set(address_space *space, std::pair<void *, void *> rw);
}; };
@ -1638,53 +1276,42 @@ public:
u8 logaddrchars() const { return m_logaddrchars; } u8 logaddrchars() const { return m_logaddrchars; }
// unmap ranges (short form) // unmap ranges (short form)
void unmap_read(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0, u16 flags = 0) { unmap_generic(addrstart, addrend, addrmirror, flags, read_or_write::READ, false); } void unmap_read(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0) { unmap_generic(addrstart, addrend, addrmirror, read_or_write::READ, false); }
void unmap_write(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0, u16 flags = 0) { unmap_generic(addrstart, addrend, addrmirror, flags, read_or_write::WRITE, false); } void unmap_write(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0) { unmap_generic(addrstart, addrend, addrmirror, read_or_write::WRITE, false); }
void unmap_readwrite(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0, u16 flags = 0) { unmap_generic(addrstart, addrend, addrmirror, flags, read_or_write::READWRITE, false); } void unmap_readwrite(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0) { unmap_generic(addrstart, addrend, addrmirror, read_or_write::READWRITE, false); }
void nop_read(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0, u16 flags = 0) { unmap_generic(addrstart, addrend, addrmirror, flags, read_or_write::READ, true); } void nop_read(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0) { unmap_generic(addrstart, addrend, addrmirror, read_or_write::READ, true); }
void nop_write(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0, u16 flags = 0) { unmap_generic(addrstart, addrend, addrmirror, flags, read_or_write::WRITE, true); } void nop_write(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0) { unmap_generic(addrstart, addrend, addrmirror, read_or_write::WRITE, true); }
void nop_readwrite(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0, u16 flags = 0) { unmap_generic(addrstart, addrend, addrmirror, flags, read_or_write::READWRITE, true); } void nop_readwrite(offs_t addrstart, offs_t addrend, offs_t addrmirror = 0) { unmap_generic(addrstart, addrend, addrmirror, read_or_write::READWRITE, true); }
// install ports, banks, RAM (short form) // install ports, banks, RAM (short form)
void install_read_port(offs_t addrstart, offs_t addrend, const char *rtag) { install_read_port(addrstart, addrend, 0, 0, rtag); } void install_read_port(offs_t addrstart, offs_t addrend, const char *rtag) { install_read_port(addrstart, addrend, 0, rtag); }
void install_write_port(offs_t addrstart, offs_t addrend, const char *wtag) { install_write_port(addrstart, addrend, 0, 0, wtag); } void install_write_port(offs_t addrstart, offs_t addrend, const char *wtag) { install_write_port(addrstart, addrend, 0, wtag); }
void install_readwrite_port(offs_t addrstart, offs_t addrend, const char *rtag, const char *wtag) { install_readwrite_port(addrstart, addrend, 0, 0, rtag, wtag); } void install_readwrite_port(offs_t addrstart, offs_t addrend, const char *rtag, const char *wtag) { install_readwrite_port(addrstart, addrend, 0, rtag, wtag); }
void install_read_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_read_bank(addrstart, addrend, 0, 0, bank); } void install_read_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_read_bank(addrstart, addrend, 0, bank); }
void install_write_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_write_bank(addrstart, addrend, 0, 0, bank); } void install_write_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_write_bank(addrstart, addrend, 0, bank); }
void install_readwrite_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_readwrite_bank(addrstart, addrend, 0, 0, bank); } void install_readwrite_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_readwrite_bank(addrstart, addrend, 0, bank); }
void install_rom(offs_t addrstart, offs_t addrend, void *baseptr) { install_rom(addrstart, addrend, 0, 0, baseptr); } void install_rom(offs_t addrstart, offs_t addrend, void *baseptr) { install_rom(addrstart, addrend, 0, baseptr); }
void install_writeonly(offs_t addrstart, offs_t addrend, void *baseptr) { install_writeonly(addrstart, addrend, 0, 0, baseptr); } void install_writeonly(offs_t addrstart, offs_t addrend, void *baseptr) { install_writeonly(addrstart, addrend, 0, baseptr); }
void install_ram(offs_t addrstart, offs_t addrend, void *baseptr) { install_ram(addrstart, addrend, 0, 0, baseptr); } void install_ram(offs_t addrstart, offs_t addrend, void *baseptr) { install_ram(addrstart, addrend, 0, baseptr); }
// install ports, banks, RAM (with mirror/mask) // install ports, banks, RAM (with mirror/mask)
void install_read_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, const char *rtag) { install_readwrite_port(addrstart, addrend, addrmirror, 0, rtag, ""); } void install_read_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, const char *rtag) { install_readwrite_port(addrstart, addrend, addrmirror, rtag, ""); }
void install_write_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, const char *wtag) { install_readwrite_port(addrstart, addrend, addrmirror, 0, "", wtag); } void install_write_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, const char *wtag) { install_readwrite_port(addrstart, addrend, addrmirror, "", wtag); }
void install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag) { install_readwrite_port(addrstart, addrend, addrmirror, 0, rtag, wtag); } virtual void install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag) = 0;
void install_read_bank(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmirror, 0, bank, nullptr); } void install_read_bank(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmirror, bank, nullptr); }
void install_write_bank(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmirror, 0, nullptr, bank); } void install_write_bank(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmirror, nullptr, bank); }
void install_readwrite_bank(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmirror, 0, bank, bank); } void install_readwrite_bank(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmirror, bank, bank); }
void install_rom(offs_t addrstart, offs_t addrend, offs_t addrmirror, void *baseptr) { install_ram_generic(addrstart, addrend, addrmirror, 0, read_or_write::READ, baseptr); } void install_rom(offs_t addrstart, offs_t addrend, offs_t addrmirror, void *baseptr) { install_ram_generic(addrstart, addrend, addrmirror, read_or_write::READ, baseptr); }
void install_writeonly(offs_t addrstart, offs_t addrend, offs_t addrmirror, void *baseptr) { install_ram_generic(addrstart, addrend, addrmirror, 0, read_or_write::WRITE, baseptr); } void install_writeonly(offs_t addrstart, offs_t addrend, offs_t addrmirror, void *baseptr) { install_ram_generic(addrstart, addrend, addrmirror, read_or_write::WRITE, baseptr); }
void install_ram(offs_t addrstart, offs_t addrend, offs_t addrmirror, void *baseptr) { install_ram_generic(addrstart, addrend, addrmirror, 0, read_or_write::READWRITE, baseptr); } void install_ram(offs_t addrstart, offs_t addrend, offs_t addrmirror, void *baseptr) { install_ram_generic(addrstart, addrend, addrmirror, read_or_write::READWRITE, baseptr); }
// install ports, banks, RAM (with mirror/mask/flags)
void install_read_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, const char *rtag) { install_readwrite_port(addrstart, addrend, addrmirror, flags, rtag, ""); }
void install_write_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, const char *wtag) { install_readwrite_port(addrstart, addrend, addrmirror, flags, "", wtag); }
virtual void install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, std::string rtag, std::string wtag) = 0;
void install_read_bank(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmirror, flags, bank, nullptr); }
void install_write_bank(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmirror, flags, nullptr, bank); }
void install_readwrite_bank(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmirror, flags, bank, bank); }
void install_rom(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, void *baseptr) { install_ram_generic(addrstart, addrend, addrmirror, flags, read_or_write::READ, baseptr); }
void install_writeonly(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, void *baseptr) { install_ram_generic(addrstart, addrend, addrmirror, flags, read_or_write::WRITE, baseptr); }
void install_ram(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, void *baseptr) { install_ram_generic(addrstart, addrend, addrmirror, flags, read_or_write::READWRITE, baseptr); }
// install device memory maps // install device memory maps
template <typename T> void install_device(offs_t addrstart, offs_t addrend, T &device, void (T::*map)(address_map &map), u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { template <typename T> void install_device(offs_t addrstart, offs_t addrend, T &device, void (T::*map)(address_map &map), u64 unitmask = 0, int cswidth = 0) {
address_map_constructor delegate(map, "dynamic_device_install", &device); address_map_constructor delegate(map, "dynamic_device_install", &device);
install_device_delegate(addrstart, addrend, device, delegate, unitmask, cswidth, flags); install_device_delegate(addrstart, addrend, device, delegate, unitmask, cswidth);
} }
virtual void install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &map, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &map, u64 unitmask = 0, int cswidth = 0) = 0;
// install taps without mirroring // install taps without mirroring
memory_passthrough_handler *install_read_tap(offs_t addrstart, offs_t addrend, std::string name, std::function<void (offs_t offset, u8 &data, u8 mem_mask)> tap, memory_passthrough_handler *mph = nullptr) { return install_read_tap(addrstart, addrend, 0, name, tap, mph); } memory_passthrough_handler *install_read_tap(offs_t addrstart, offs_t addrend, std::string name, std::function<void (offs_t offset, u8 &data, u8 mem_mask)> tap, memory_passthrough_handler *mph = nullptr) { return install_read_tap(addrstart, addrend, 0, name, tap, mph); }
@ -1719,167 +1346,167 @@ public:
virtual void install_view(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_view &view) = 0; virtual void install_view(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_view &view) = 0;
// install new-style delegate handlers (short form) // install new-style delegate handlers (short form)
void install_read_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read8m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read8m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8m_delegate rhandler, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8m_delegate rhandler, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read16m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read16m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16m_delegate rhandler, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16m_delegate rhandler, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read32m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read32m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32m_delegate rhandler, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32m_delegate rhandler, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read64m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read64m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64m_delegate rhandler, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64m_delegate rhandler, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read8s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read8s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read16s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read16s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read32s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read32s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read64s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read64s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read8sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read8sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read16sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read16sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read32sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read32sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read64sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read64sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read8mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read8mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8mo_delegate rhandler, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8mo_delegate rhandler, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read16mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read16mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16mo_delegate rhandler, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16mo_delegate rhandler, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read32mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read32mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32mo_delegate rhandler, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32mo_delegate rhandler, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read64mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read64mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64mo_delegate rhandler, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64mo_delegate rhandler, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read8smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read8smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read16smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read16smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read32smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read32smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
void install_read_handler(offs_t addrstart, offs_t addrend, read64smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth, flags); } void install_read_handler(offs_t addrstart, offs_t addrend, read64smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask, cswidth); }
void install_write_handler(offs_t addrstart, offs_t addrend, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth, flags); } void install_write_handler(offs_t addrstart, offs_t addrend, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask, cswidth); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth, flags); } void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask, cswidth); }
// install new-style delegate handlers (with mirror/mask) // install new-style delegate handlers (with mirror/mask)
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) = 0; virtual void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) = 0;
protected: protected:
virtual void unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, read_or_write readorwrite, bool quiet) = 0; virtual void unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, bool quiet) = 0;
virtual void install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, read_or_write readorwrite, void *baseptr) = 0; virtual void install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, void *baseptr) = 0;
virtual void install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, memory_bank *rbank, memory_bank *wbank) = 0; virtual void install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank) = 0;
void populate_map_entry(const address_map_entry &entry, read_or_write readorwrite); void populate_map_entry(const address_map_entry &entry, read_or_write readorwrite);
void adjust_addresses(offs_t &start, offs_t &end, offs_t &mask, offs_t &mirror) { void adjust_addresses(offs_t &start, offs_t &end, offs_t &mask, offs_t &mirror) {
@ -2024,36 +1651,6 @@ public:
virtual void write_qword_unaligned(offs_t address, u64 data) = 0; virtual void write_qword_unaligned(offs_t address, u64 data) = 0;
virtual void write_qword_unaligned(offs_t address, u64 data, u64 mask) = 0; virtual void write_qword_unaligned(offs_t address, u64 data, u64 mask) = 0;
// read accessors with flags
virtual std::pair<u8, u16> read_byte_flags(offs_t address) = 0;
virtual std::pair<u16, u16> read_word_flags(offs_t address) = 0;
virtual std::pair<u16, u16> read_word_flags(offs_t address, u16 mask) = 0;
virtual std::pair<u16, u16> read_word_unaligned_flags(offs_t address) = 0;
virtual std::pair<u16, u16> read_word_unaligned_flags(offs_t address, u16 mask) = 0;
virtual std::pair<u32, u16> read_dword_flags(offs_t address) = 0;
virtual std::pair<u32, u16> read_dword_flags(offs_t address, u32 mask) = 0;
virtual std::pair<u32, u16> read_dword_unaligned_flags(offs_t address) = 0;
virtual std::pair<u32, u16> read_dword_unaligned_flags(offs_t address, u32 mask) = 0;
virtual std::pair<u64, u16> read_qword_flags(offs_t address) = 0;
virtual std::pair<u64, u16> read_qword_flags(offs_t address, u64 mask) = 0;
virtual std::pair<u64, u16> read_qword_unaligned_flags(offs_t address) = 0;
virtual std::pair<u64, u16> read_qword_unaligned_flags(offs_t address, u64 mask) = 0;
// write accessors with flags
virtual u16 write_byte_flags(offs_t address, u8 data) = 0;
virtual u16 write_word_flags(offs_t address, u16 data) = 0;
virtual u16 write_word_flags(offs_t address, u16 data, u16 mask) = 0;
virtual u16 write_word_unaligned_flags(offs_t address, u16 data) = 0;
virtual u16 write_word_unaligned_flags(offs_t address, u16 data, u16 mask) = 0;
virtual u16 write_dword_flags(offs_t address, u32 data) = 0;
virtual u16 write_dword_flags(offs_t address, u32 data, u32 mask) = 0;
virtual u16 write_dword_unaligned_flags(offs_t address, u32 data) = 0;
virtual u16 write_dword_unaligned_flags(offs_t address, u32 data, u32 mask) = 0;
virtual u16 write_qword_flags(offs_t address, u64 data) = 0;
virtual u16 write_qword_flags(offs_t address, u64 data, u64 mask) = 0;
virtual u16 write_qword_unaligned_flags(offs_t address, u64 data) = 0;
virtual u16 write_qword_unaligned_flags(offs_t address, u64 data, u64 mask) = 0;
// setup // setup
void prepare_map(); void prepare_map();
void prepare_device_map(address_map &map); void prepare_device_map(address_map &map);

View File

@ -131,162 +131,162 @@ public:
std::string get_handler_string(read_or_write readorwrite, offs_t byteaddress) const override; std::string get_handler_string(read_or_write readorwrite, offs_t byteaddress) const override;
void dump_maps(std::vector<memory_entry> &read_map, std::vector<memory_entry> &write_map) const override; void dump_maps(std::vector<memory_entry> &read_map, std::vector<memory_entry> &write_map) const override;
void unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, read_or_write readorwrite, bool quiet) override; void unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, bool quiet) override;
void install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, read_or_write readorwrite, void *baseptr) override; void install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, void *baseptr) override;
void install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, memory_bank *rbank, memory_bank *wbank) override; void install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank) override;
void install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, std::string rtag, std::string wtag) override; void install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag) override;
void install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &map, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override; void install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &map, u64 unitmask = 0, int cswidth = 0) override;
void install_view(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_view &view) override; void install_view(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_view &view) override;
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
using address_space::install_read_tap; using address_space::install_read_tap;
using address_space::install_write_tap; using address_space::install_write_tap;
@ -300,10 +300,10 @@ public:
address_space_specific(memory_manager &manager, device_memory_interface &memory, int spacenum, int address_width) address_space_specific(memory_manager &manager, device_memory_interface &memory, int spacenum, int address_width)
: address_space(manager, memory, spacenum) : address_space(manager, memory, spacenum)
{ {
m_unmap_r = new handler_entry_read_unmapped <Width, AddrShift>(this, 0); m_unmap_r = new handler_entry_read_unmapped <Width, AddrShift>(this);
m_unmap_w = new handler_entry_write_unmapped<Width, AddrShift>(this, 0); m_unmap_w = new handler_entry_write_unmapped<Width, AddrShift>(this);
m_nop_r = new handler_entry_read_nop <Width, AddrShift>(this, 0); m_nop_r = new handler_entry_read_nop <Width, AddrShift>(this);
m_nop_w = new handler_entry_write_nop<Width, AddrShift>(this, 0); m_nop_w = new handler_entry_write_nop<Width, AddrShift>(this);
handler_entry::range r{ 0, 0xffffffff >> (32 - address_width) }; handler_entry::range r{ 0, 0xffffffff >> (32 - address_width) };
@ -347,11 +347,6 @@ public:
m_dispatch_write = m_root_write->get_dispatch(); m_dispatch_write = m_root_write->get_dispatch();
} }
virtual ~address_space_specific() {
m_root_read ->unref();
m_root_write->unref();
}
std::pair<void *, void *> get_cache_info() override { std::pair<void *, void *> get_cache_info() override {
std::pair<void *, void *> rw; std::pair<void *, void *> rw;
rw.first = m_root_read; rw.first = m_root_read;
@ -433,106 +428,52 @@ public:
return dispatch_read<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, mask, m_dispatch_read); return dispatch_read<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, mask, m_dispatch_read);
} }
std::pair<NativeType, u16> read_native_flags(offs_t offset, NativeType mask)
{
return dispatch_read_flags<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, mask, m_dispatch_read);
}
// mask-less native read // mask-less native read
NativeType read_native(offs_t offset) NativeType read_native(offs_t offset)
{ {
return dispatch_read<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, uX(0xffffffffffffffffU), m_dispatch_read); return dispatch_read<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, uX(0xffffffffffffffffU), m_dispatch_read);
} }
std::pair<NativeType, u16> read_native_flags(offs_t offset)
{
return dispatch_read_flags<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, uX(0xffffffffffffffffU), m_dispatch_read);
}
// native write // native write
void write_native(offs_t offset, NativeType data, NativeType mask) void write_native(offs_t offset, NativeType data, NativeType mask)
{ {
dispatch_write<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, data, mask, m_dispatch_write); dispatch_write<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, data, mask, m_dispatch_write);
} }
u16 write_native_flags(offs_t offset, NativeType data, NativeType mask)
{
return dispatch_write_flags<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, data, mask, m_dispatch_write);
}
// mask-less native write // mask-less native write
void write_native(offs_t offset, NativeType data) void write_native(offs_t offset, NativeType data)
{ {
dispatch_write<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, data, uX(0xffffffffffffffffU), m_dispatch_write); dispatch_write<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, data, uX(0xffffffffffffffffU), m_dispatch_write);
} }
u16 write_native_flags(offs_t offset, NativeType data)
{
return dispatch_write_flags<Level, Width, AddrShift>(offs_t(-1), offset & m_addrmask, data, uX(0xffffffffffffffffU), m_dispatch_write);
}
auto rop() { return [this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }; }
auto ropf() { return [this](offs_t offset, NativeType mask) -> std::pair<NativeType, u16> { return read_native_flags(offset, mask); }; }
auto wop() { return [this](offs_t offset, NativeType data, NativeType mask) -> void { write_native(offset, data, mask); }; }
auto wopf() { return [this](offs_t offset, NativeType data, NativeType mask) -> u16 { return write_native_flags(offset, data, mask); }; }
// virtual access to these functions // virtual access to these functions
u8 read_byte(offs_t address) override { if constexpr(Width == 0) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 0, true>(rop(), address, 0xff); } u8 read_byte(offs_t address) override { return Width == 0 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 0, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xff); }
u16 read_word(offs_t address) override { if constexpr(Width == 1) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 1, true>(rop(), address, 0xffff); } u16 read_word(offs_t address) override { return Width == 1 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffff); }
u16 read_word(offs_t address, u16 mask) override { return memory_read_generic<Width, AddrShift, Endian, 1, true>(rop(), address, mask); } u16 read_word(offs_t address, u16 mask) override { return memory_read_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u16 read_word_unaligned(offs_t address) override { return memory_read_generic<Width, AddrShift, Endian, 1, false>(rop(), address, 0xffff); } u16 read_word_unaligned(offs_t address) override { return memory_read_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffff); }
u16 read_word_unaligned(offs_t address, u16 mask) override { return memory_read_generic<Width, AddrShift, Endian, 1, false>(rop(), address, mask); } u16 read_word_unaligned(offs_t address, u16 mask) override { return memory_read_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u32 read_dword(offs_t address) override { if constexpr(Width == 2) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 2, true>(rop(), address, 0xffffffff); } u32 read_dword(offs_t address) override { return Width == 2 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffff); }
u32 read_dword(offs_t address, u32 mask) override { return memory_read_generic<Width, AddrShift, Endian, 2, true>(rop(), address, mask); } u32 read_dword(offs_t address, u32 mask) override { return memory_read_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u32 read_dword_unaligned(offs_t address) override { return memory_read_generic<Width, AddrShift, Endian, 2, false>(rop(), address, 0xffffffff); } u32 read_dword_unaligned(offs_t address) override { return memory_read_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffff); }
u32 read_dword_unaligned(offs_t address, u32 mask) override { return memory_read_generic<Width, AddrShift, Endian, 2, false>(rop(), address, mask); } u32 read_dword_unaligned(offs_t address, u32 mask) override { return memory_read_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u64 read_qword(offs_t address) override { if constexpr(Width == 3) return read_native(address & ~NATIVE_MASK); else return memory_read_generic<Width, AddrShift, Endian, 3, true>(rop(), address, 0xffffffffffffffffU); } u64 read_qword(offs_t address) override { return Width == 3 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffffffffffffU); }
u64 read_qword(offs_t address, u64 mask) override { return memory_read_generic<Width, AddrShift, Endian, 3, true>(rop(), address, mask); } u64 read_qword(offs_t address, u64 mask) override { return memory_read_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
u64 read_qword_unaligned(offs_t address) override { return memory_read_generic<Width, AddrShift, Endian, 3, false>(rop(), address, 0xffffffffffffffffU); } u64 read_qword_unaligned(offs_t address) override { return memory_read_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffffffffffffffffU); }
u64 read_qword_unaligned(offs_t address, u64 mask) override { return memory_read_generic<Width, AddrShift, Endian, 3, false>(rop(), address, mask); } u64 read_qword_unaligned(offs_t address, u64 mask) override { return memory_read_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, mask); }
void write_byte(offs_t address, u8 data) override { if constexpr(Width == 0) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 0, true>(wop(), address, data, 0xff); }
void write_word(offs_t address, u16 data) override { if constexpr(Width == 1) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 1, true>(wop(), address, data, 0xffff); }
void write_word(offs_t address, u16 data, u16 mask) override { memory_write_generic<Width, AddrShift, Endian, 1, true>(wop(), address, data, mask); }
void write_word_unaligned(offs_t address, u16 data) override { memory_write_generic<Width, AddrShift, Endian, 1, false>(wop(), address, data, 0xffff); }
void write_word_unaligned(offs_t address, u16 data, u16 mask) override { memory_write_generic<Width, AddrShift, Endian, 1, false>(wop(), address, data, mask); }
void write_dword(offs_t address, u32 data) override { if constexpr(Width == 2) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 2, true>(wop(), address, data, 0xffffffff); }
void write_dword(offs_t address, u32 data, u32 mask) override { memory_write_generic<Width, AddrShift, Endian, 2, true>(wop(), address, data, mask); }
void write_dword_unaligned(offs_t address, u32 data) override { memory_write_generic<Width, AddrShift, Endian, 2, false>(wop(), address, data, 0xffffffff); }
void write_dword_unaligned(offs_t address, u32 data, u32 mask) override { memory_write_generic<Width, AddrShift, Endian, 2, false>(wop(), address, data, mask); }
void write_qword(offs_t address, u64 data) override { if constexpr(Width == 3) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 3, true>(wop(), address, data, 0xffffffffffffffffU); }
void write_qword(offs_t address, u64 data, u64 mask) override { memory_write_generic<Width, AddrShift, Endian, 3, true>(wop(), address, data, mask); }
void write_qword_unaligned(offs_t address, u64 data) override { memory_write_generic<Width, AddrShift, Endian, 3, false>(wop(), address, data, 0xffffffffffffffffU); }
void write_qword_unaligned(offs_t address, u64 data, u64 mask) override { memory_write_generic<Width, AddrShift, Endian, 3, false>(wop(), address, data, mask); }
std::pair<u8, u16> read_byte_flags(offs_t address) override { if constexpr(Width == 0) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 0, true>(ropf(), address, 0xff); }
std::pair<u16, u16> read_word_flags(offs_t address) override { if constexpr(Width == 1) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 1, true>(ropf(), address, 0xffff); }
std::pair<u16, u16> read_word_flags(offs_t address, u16 mask) override { return memory_read_generic_flags<Width, AddrShift, Endian, 1, true>(ropf(), address, mask); }
std::pair<u16, u16> read_word_unaligned_flags(offs_t address) override { return memory_read_generic_flags<Width, AddrShift, Endian, 1, false>(ropf(), address, 0xffff); }
std::pair<u16, u16> read_word_unaligned_flags(offs_t address, u16 mask) override { return memory_read_generic_flags<Width, AddrShift, Endian, 1, false>(ropf(), address, mask); }
std::pair<u32, u16> read_dword_flags(offs_t address) override { if constexpr(Width == 2) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 2, true>(ropf(), address, 0xffffffff); }
std::pair<u32, u16> read_dword_flags(offs_t address, u32 mask) override { return memory_read_generic_flags<Width, AddrShift, Endian, 2, true>(ropf(), address, mask); }
std::pair<u32, u16> read_dword_unaligned_flags(offs_t address) override { return memory_read_generic_flags<Width, AddrShift, Endian, 2, false>(ropf(), address, 0xffffffff); }
std::pair<u32, u16> read_dword_unaligned_flags(offs_t address, u32 mask) override { return memory_read_generic_flags<Width, AddrShift, Endian, 2, false>(ropf(), address, mask); }
std::pair<u64, u16> read_qword_flags(offs_t address) override { if constexpr(Width == 3) return read_native_flags(address & ~NATIVE_MASK); else return memory_read_generic_flags<Width, AddrShift, Endian, 3, true>(ropf(), address, 0xffffffffffffffffU); }
std::pair<u64, u16> read_qword_flags(offs_t address, u64 mask) override { return memory_read_generic_flags<Width, AddrShift, Endian, 3, true>(ropf(), address, mask); }
std::pair<u64, u16> read_qword_unaligned_flags(offs_t address) override { return memory_read_generic_flags<Width, AddrShift, Endian, 3, false>(ropf(), address, 0xffffffffffffffffU); }
std::pair<u64, u16> read_qword_unaligned_flags(offs_t address, u64 mask) override { return memory_read_generic_flags<Width, AddrShift, Endian, 3, false>(ropf(), address, mask); }
u16 write_byte_flags(offs_t address, u8 data) override { if constexpr(Width == 0) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 0, true>(wopf(), address, data, 0xff); }
u16 write_word_flags(offs_t address, u16 data) override { if constexpr(Width == 1) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 1, true>(wopf(), address, data, 0xffff); }
u16 write_word_flags(offs_t address, u16 data, u16 mask) override { return memory_write_generic_flags<Width, AddrShift, Endian, 1, true>(wopf(), address, data, mask); }
u16 write_word_unaligned_flags(offs_t address, u16 data) override { return memory_write_generic_flags<Width, AddrShift, Endian, 1, false>(wopf(), address, data, 0xffff); }
u16 write_word_unaligned_flags(offs_t address, u16 data, u16 mask) override { return memory_write_generic_flags<Width, AddrShift, Endian, 1, false>(wopf(), address, data, mask); }
u16 write_dword_flags(offs_t address, u32 data) override { if constexpr(Width == 2) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 2, true>(wopf(), address, data, 0xffffffff); }
u16 write_dword_flags(offs_t address, u32 data, u32 mask) override { return memory_write_generic_flags<Width, AddrShift, Endian, 2, true>(wopf(), address, data, mask); }
u16 write_dword_unaligned_flags(offs_t address, u32 data) override { return memory_write_generic_flags<Width, AddrShift, Endian, 2, false>(wopf(), address, data, 0xffffffff); }
u16 write_dword_unaligned_flags(offs_t address, u32 data, u32 mask) override { return memory_write_generic_flags<Width, AddrShift, Endian, 2, false>(wopf(), address, data, mask); }
u16 write_qword_flags(offs_t address, u64 data) override { if constexpr(Width == 3) return write_native_flags(address & ~NATIVE_MASK, data); else return memory_write_generic_flags<Width, AddrShift, Endian, 3, true>(wopf(), address, data, 0xffffffffffffffffU); }
u16 write_qword_flags(offs_t address, u64 data, u64 mask) override { return memory_write_generic_flags<Width, AddrShift, Endian, 3, true>(wopf(), address, data, mask); }
u16 write_qword_unaligned_flags(offs_t address, u64 data) override { return memory_write_generic_flags<Width, AddrShift, Endian, 3, false>(wopf(), address, data, 0xffffffffffffffffU); }
u16 write_qword_unaligned_flags(offs_t address, u64 data, u64 mask) override { return memory_write_generic_flags<Width, AddrShift, Endian, 3, false>(wopf(), address, data, mask); }
void write_byte(offs_t address, u8 data) override { if (Width == 0) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 0, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xff); }
void write_word(offs_t address, u16 data) override { if (Width == 1) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffff); }
void write_word(offs_t address, u16 data, u16 mask) override { memory_write_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
void write_word_unaligned(offs_t address, u16 data) override { memory_write_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffff); }
void write_word_unaligned(offs_t address, u16 data, u16 mask) override { memory_write_generic<Width, AddrShift, Endian, 1, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
void write_dword(offs_t address, u32 data) override { if (Width == 2) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffff); }
void write_dword(offs_t address, u32 data, u32 mask) override { memory_write_generic<Width, AddrShift, Endian, 2, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
void write_dword_unaligned(offs_t address, u32 data) override { memory_write_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffff); }
void write_dword_unaligned(offs_t address, u32 data, u32 mask) override { memory_write_generic<Width, AddrShift, Endian, 2, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
void write_qword(offs_t address, u64 data) override { if (Width == 3) write_native(address & ~NATIVE_MASK, data); else memory_write_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffffffffffffU); }
void write_qword(offs_t address, u64 data, u64 mask) override { memory_write_generic<Width, AddrShift, Endian, 3, true>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
void write_qword_unaligned(offs_t address, u64 data) override { memory_write_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, 0xffffffffffffffffU); }
void write_qword_unaligned(offs_t address, u64 data, u64 mask) override { memory_write_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
// static access to these functions // static access to these functions
static u8 read_byte_static(this_type &space, offs_t address) { return Width == 0 ? space.read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 0, true>([&space](offs_t offset, NativeType mask) -> NativeType { return space.read_native(offset, mask); }, address, 0xff); } static u8 read_byte_static(this_type &space, offs_t address) { return Width == 0 ? space.read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 0, true>([&space](offs_t offset, NativeType mask) -> NativeType { return space.read_native(offset, mask); }, address, 0xff); }
@ -557,29 +498,29 @@ public:
private: private:
template<typename READ> template<typename READ>
void install_read_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, READ &handler_r) void install_read_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, READ &handler_r)
{ {
try { handler_r.resolve(); } try { handler_r.resolve(); }
catch (const binding_type_exception &) { catch (const binding_type_exception &) {
osd_printf_error("Binding error while installing read handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_r.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask); osd_printf_error("Binding error while installing read handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_r.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask);
throw; throw;
} }
install_read_handler_helper<handler_width<READ>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, handler_r); install_read_handler_helper<handler_width<READ>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler_r);
} }
template<typename WRITE> template<typename WRITE>
void install_write_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, WRITE &handler_w) void install_write_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, WRITE &handler_w)
{ {
try { handler_w.resolve(); } try { handler_w.resolve(); }
catch (const binding_type_exception &) { catch (const binding_type_exception &) {
osd_printf_error("Binding error while installing write handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_w.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask); osd_printf_error("Binding error while installing write handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_w.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask);
throw; throw;
} }
install_write_handler_helper<handler_width<WRITE>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, handler_w); install_write_handler_helper<handler_width<WRITE>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler_w);
} }
template<typename READ, typename WRITE> template<typename READ, typename WRITE>
void install_readwrite_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, READ &handler_r, WRITE &handler_w) void install_readwrite_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, READ &handler_r, WRITE &handler_w)
{ {
static_assert(handler_width<READ>::value == handler_width<WRITE>::value, "handler widths do not match"); static_assert(handler_width<READ>::value == handler_width<WRITE>::value, "handler widths do not match");
try { handler_r.resolve(); } try { handler_r.resolve(); }
@ -592,11 +533,11 @@ private:
osd_printf_error("Binding error while installing write handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_w.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask); osd_printf_error("Binding error while installing write handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_w.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask);
throw; throw;
} }
install_readwrite_handler_helper<handler_width<READ>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, handler_r, handler_w); install_readwrite_handler_helper<handler_width<READ>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler_r, handler_w);
} }
template<int AccessWidth, typename READ> template<int AccessWidth, typename READ>
void install_read_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, const READ &handler_r) void install_read_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, const READ &handler_r)
{ {
if constexpr (Width < AccessWidth) { if constexpr (Width < AccessWidth) {
fatalerror("install_read_handler: cannot install a %d-wide handler in a %d-wide bus", 8 << AccessWidth, 8 << Width); fatalerror("install_read_handler: cannot install a %d-wide handler in a %d-wide bus", 8 << AccessWidth, 8 << Width);
@ -613,11 +554,11 @@ private:
check_optimize_all("install_read_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); check_optimize_all("install_read_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth);
if constexpr (Width == AccessWidth) { if constexpr (Width == AccessWidth) {
auto hand_r = new handler_entry_read_delegate<Width, AddrShift, READ>(this, flags, handler_r); auto hand_r = new handler_entry_read_delegate<Width, AddrShift, READ>(this, handler_r);
hand_r->set_address_info(nstart, nmask); hand_r->set_address_info(nstart, nmask);
m_root_read->populate(nstart, nend, nmirror, hand_r); m_root_read->populate(nstart, nend, nmirror, hand_r);
} else { } else {
auto hand_r = new handler_entry_read_delegate<AccessWidth, -AccessWidth, READ>(this, flags, handler_r); auto hand_r = new handler_entry_read_delegate<AccessWidth, -AccessWidth, READ>(this, handler_r);
memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, Endian, hand_r, nstart, nend, nmask, nunitmask, ncswidth); memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, Endian, hand_r, nstart, nend, nmask, nunitmask, ncswidth);
hand_r->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); hand_r->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask());
m_root_read->populate_mismatched(nstart, nend, nmirror, descriptor); m_root_read->populate_mismatched(nstart, nend, nmirror, descriptor);
@ -628,7 +569,7 @@ private:
} }
template<int AccessWidth, typename WRITE> template<int AccessWidth, typename WRITE>
void install_write_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, void install_write_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth,
const WRITE &handler_w) const WRITE &handler_w)
{ {
if constexpr (Width < AccessWidth) { if constexpr (Width < AccessWidth) {
@ -646,11 +587,11 @@ private:
check_optimize_all("install_write_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); check_optimize_all("install_write_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth);
if constexpr (Width == AccessWidth) { if constexpr (Width == AccessWidth) {
auto hand_w = new handler_entry_write_delegate<Width, AddrShift, WRITE>(this, flags, handler_w); auto hand_w = new handler_entry_write_delegate<Width, AddrShift, WRITE>(this, handler_w);
hand_w->set_address_info(nstart, nmask); hand_w->set_address_info(nstart, nmask);
m_root_write->populate(nstart, nend, nmirror, hand_w); m_root_write->populate(nstart, nend, nmirror, hand_w);
} else { } else {
auto hand_w = new handler_entry_write_delegate<AccessWidth, -AccessWidth, WRITE>(this, flags, handler_w); auto hand_w = new handler_entry_write_delegate<AccessWidth, -AccessWidth, WRITE>(this, handler_w);
memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, Endian, hand_w, nstart, nend, nmask, nunitmask, ncswidth); memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, Endian, hand_w, nstart, nend, nmask, nunitmask, ncswidth);
hand_w->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); hand_w->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask());
m_root_write->populate_mismatched(nstart, nend, nmirror, descriptor); m_root_write->populate_mismatched(nstart, nend, nmirror, descriptor);
@ -661,7 +602,7 @@ private:
} }
template<int AccessWidth, typename READ, typename WRITE> template<int AccessWidth, typename READ, typename WRITE>
void install_readwrite_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, void install_readwrite_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth,
const READ &handler_r, const READ &handler_r,
const WRITE &handler_w) const WRITE &handler_w)
{ {
@ -680,21 +621,21 @@ private:
check_optimize_all("install_readwrite_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); check_optimize_all("install_readwrite_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth);
if constexpr (Width == AccessWidth) { if constexpr (Width == AccessWidth) {
auto hand_r = new handler_entry_read_delegate <Width, AddrShift, READ>(this, flags, handler_r); auto hand_r = new handler_entry_read_delegate <Width, AddrShift, READ>(this, handler_r);
hand_r->set_address_info(nstart, nmask); hand_r->set_address_info(nstart, nmask);
m_root_read ->populate(nstart, nend, nmirror, hand_r); m_root_read ->populate(nstart, nend, nmirror, hand_r);
auto hand_w = new handler_entry_write_delegate<Width, AddrShift, WRITE>(this, flags, handler_w); auto hand_w = new handler_entry_write_delegate<Width, AddrShift, WRITE>(this, handler_w);
hand_w->set_address_info(nstart, nmask); hand_w->set_address_info(nstart, nmask);
m_root_write->populate(nstart, nend, nmirror, hand_w); m_root_write->populate(nstart, nend, nmirror, hand_w);
} else { } else {
auto hand_r = new handler_entry_read_delegate <AccessWidth, -AccessWidth, READ>(this, flags, handler_r); auto hand_r = new handler_entry_read_delegate <AccessWidth, -AccessWidth, READ>(this, handler_r);
memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, Endian, hand_r, nstart, nend, nmask, nunitmask, ncswidth); memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, Endian, hand_r, nstart, nend, nmask, nunitmask, ncswidth);
hand_r->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); hand_r->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask());
m_root_read ->populate_mismatched(nstart, nend, nmirror, descriptor); m_root_read ->populate_mismatched(nstart, nend, nmirror, descriptor);
hand_r->unref(); hand_r->unref();
auto hand_w = new handler_entry_write_delegate<AccessWidth, -AccessWidth, WRITE>(this, flags, handler_w); auto hand_w = new handler_entry_write_delegate<AccessWidth, -AccessWidth, WRITE>(this, handler_w);
descriptor.set_subunit_handler(hand_w); descriptor.set_subunit_handler(hand_w);
hand_w->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); hand_w->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask());
m_root_write->populate_mismatched(nstart, nend, nmirror, descriptor); m_root_write->populate_mismatched(nstart, nend, nmirror, descriptor);
@ -1034,7 +975,7 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> void address_
// unmap - unmap a section of address space // unmap - unmap a section of address space
//------------------------------------------------- //-------------------------------------------------
template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, read_or_write readorwrite, bool quiet) template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, bool quiet)
{ {
VPRINTF("address_space::unmap(%*x-%*x mirror=%*x, %s, %s)\n", VPRINTF("address_space::unmap(%*x-%*x mirror=%*x, %s, %s)\n",
m_addrchars, addrstart, m_addrchars, addrend, m_addrchars, addrstart, m_addrchars, addrend,
@ -1047,22 +988,14 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> void address_
// read space // read space
if (readorwrite == read_or_write::READ || readorwrite == read_or_write::READWRITE) { if (readorwrite == read_or_write::READ || readorwrite == read_or_write::READWRITE) {
auto handler = flags ? (quiet ? auto handler = static_cast<handler_entry_read<Width, AddrShift> *>(quiet ? m_nop_r : m_unmap_r);
static_cast<handler_entry_read<Width, AddrShift> *>(new handler_entry_read_nop<Width, AddrShift>(this, flags)) :
static_cast<handler_entry_read<Width, AddrShift> *>(new handler_entry_read_unmapped<Width, AddrShift>(this, flags)))
: (quiet ? static_cast<handler_entry_read<Width, AddrShift> *>(m_nop_r) :
static_cast<handler_entry_read<Width, AddrShift> *>(m_unmap_r));
handler->ref(); handler->ref();
m_root_read->populate(nstart, nend, nmirror, handler); m_root_read->populate(nstart, nend, nmirror, handler);
} }
// write space // write space
if (readorwrite == read_or_write::WRITE || readorwrite == read_or_write::READWRITE) { if (readorwrite == read_or_write::WRITE || readorwrite == read_or_write::READWRITE) {
auto handler = flags ? (quiet ? auto handler = static_cast<handler_entry_write<Width, AddrShift> *>(quiet ? m_nop_w : m_unmap_w);
static_cast<handler_entry_write<Width, AddrShift> *>(new handler_entry_write_nop<Width, AddrShift>(this, flags)) :
static_cast<handler_entry_write<Width, AddrShift> *>(new handler_entry_write_unmapped<Width, AddrShift>(this, flags)))
: (quiet ? static_cast<handler_entry_write<Width, AddrShift> *>(m_nop_w) :
static_cast<handler_entry_write<Width, AddrShift> *>(m_unmap_w));
handler->ref(); handler->ref();
m_root_write->populate(nstart, nend, nmirror, handler); m_root_write->populate(nstart, nend, nmirror, handler);
} }
@ -1162,10 +1095,10 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> memory_passth
// of a live device into this address space // of a live device into this address space
//------------------------------------------------- //-------------------------------------------------
template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &delegate, u64 unitmask, int cswidth, u16 flags) template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &delegate, u64 unitmask, int cswidth)
{ {
check_address("install_device_delegate", addrstart, addrend); check_address("install_device_delegate", addrstart, addrend);
address_map map(*this, addrstart, addrend, unitmask, cswidth, flags, m_device, delegate); address_map map(*this, addrstart, addrend, unitmask, cswidth, m_device, delegate);
map.import_submaps(m_manager.machine(), device, data_width(), endianness(), addr_shift()); map.import_submaps(m_manager.machine(), device, data_width(), endianness(), addr_shift());
prepare_device_map(map); prepare_device_map(map);
populate_from_map(&map); populate_from_map(&map);
@ -1178,7 +1111,7 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> memory_passth
// handler into this address space // handler into this address space
//------------------------------------------------- //-------------------------------------------------
template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, std::string rtag, std::string wtag) template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag)
{ {
VPRINTF("address_space::install_readwrite_port(%*x-%*x mirror=%*x, read=\"%s\" / write=\"%s\")\n", VPRINTF("address_space::install_readwrite_port(%*x-%*x mirror=%*x, read=\"%s\" / write=\"%s\")\n",
m_addrchars, addrstart, m_addrchars, addrend, m_addrchars, addrstart, m_addrchars, addrend,
@ -1197,7 +1130,7 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> memory_passth
throw emu_fatalerror("Attempted to map non-existent port '%s' for read in space %s of device '%s'\n", rtag, m_name, m_device.tag()); throw emu_fatalerror("Attempted to map non-existent port '%s' for read in space %s of device '%s'\n", rtag, m_name, m_device.tag());
// map the range and set the ioport // map the range and set the ioport
auto hand_r = new handler_entry_read_ioport<Width, AddrShift>(this, flags, port); auto hand_r = new handler_entry_read_ioport<Width, AddrShift>(this, port);
m_root_read->populate(nstart, nend, nmirror, hand_r); m_root_read->populate(nstart, nend, nmirror, hand_r);
} }
@ -1209,7 +1142,7 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> memory_passth
fatalerror("Attempted to map non-existent port '%s' for write in space %s of device '%s'\n", wtag, m_name, m_device.tag()); fatalerror("Attempted to map non-existent port '%s' for write in space %s of device '%s'\n", wtag, m_name, m_device.tag());
// map the range and set the ioport // map the range and set the ioport
auto hand_w = new handler_entry_write_ioport<Width, AddrShift>(this, flags, port); auto hand_w = new handler_entry_write_ioport<Width, AddrShift>(this, port);
m_root_write->populate(nstart, nend, nmirror, hand_w); m_root_write->populate(nstart, nend, nmirror, hand_w);
} }
@ -1222,7 +1155,7 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> memory_passth
// mapping to a particular bank // mapping to a particular bank
//------------------------------------------------- //-------------------------------------------------
template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, memory_bank *rbank, memory_bank *wbank) template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank)
{ {
VPRINTF("address_space::install_readwrite_bank(%*x-%*x mirror=%*x, read=\"%s\" / write=\"%s\")\n", VPRINTF("address_space::install_readwrite_bank(%*x-%*x mirror=%*x, read=\"%s\" / write=\"%s\")\n",
m_addrchars, addrstart, m_addrchars, addrend, m_addrchars, addrstart, m_addrchars, addrend,
@ -1235,7 +1168,7 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> void address_
// map the read bank // map the read bank
if (rbank != nullptr) if (rbank != nullptr)
{ {
auto hand_r = new handler_entry_read_memory_bank<Width, AddrShift>(this, flags, *rbank); auto hand_r = new handler_entry_read_memory_bank<Width, AddrShift>(this, *rbank);
hand_r->set_address_info(nstart, nmask); hand_r->set_address_info(nstart, nmask);
m_root_read->populate(nstart, nend, nmirror, hand_r); m_root_read->populate(nstart, nend, nmirror, hand_r);
} }
@ -1243,7 +1176,7 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> void address_
// map the write bank // map the write bank
if (wbank != nullptr) if (wbank != nullptr)
{ {
auto hand_w = new handler_entry_write_memory_bank<Width, AddrShift>(this, flags, *wbank); auto hand_w = new handler_entry_write_memory_bank<Width, AddrShift>(this, *wbank);
hand_w->set_address_info(nstart, nmask); hand_w->set_address_info(nstart, nmask);
m_root_write->populate(nstart, nend, nmirror, hand_w); m_root_write->populate(nstart, nend, nmirror, hand_w);
} }
@ -1257,7 +1190,7 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> void address_
// RAM region into the given address space // RAM region into the given address space
//------------------------------------------------- //-------------------------------------------------
template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, read_or_write readorwrite, void *baseptr) template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, void *baseptr)
{ {
VPRINTF("address_space::install_ram_generic(%s-%s mirror=%s, %s, %p)\n", VPRINTF("address_space::install_ram_generic(%s-%s mirror=%s, %s, %p)\n",
m_addrchars, addrstart, m_addrchars, addrend, m_addrchars, addrstart, m_addrchars, addrend,
@ -1271,7 +1204,7 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> void address_
// map for read // map for read
if (readorwrite == read_or_write::READ || readorwrite == read_or_write::READWRITE) if (readorwrite == read_or_write::READ || readorwrite == read_or_write::READWRITE)
{ {
auto hand_r = new handler_entry_read_memory<Width, AddrShift>(this, flags, baseptr); auto hand_r = new handler_entry_read_memory<Width, AddrShift>(this, baseptr);
hand_r->set_address_info(nstart, nmask); hand_r->set_address_info(nstart, nmask);
m_root_read->populate(nstart, nend, nmirror, hand_r); m_root_read->populate(nstart, nend, nmirror, hand_r);
} }
@ -1279,7 +1212,7 @@ template<int Level, int Width, int AddrShift, endianness_t Endian> void address_
// map for write // map for write
if (readorwrite == read_or_write::WRITE || readorwrite == read_or_write::READWRITE) if (readorwrite == read_or_write::WRITE || readorwrite == read_or_write::READWRITE)
{ {
auto hand_w = new handler_entry_write_memory<Width, AddrShift>(this, flags, baseptr); auto hand_w = new handler_entry_write_memory<Width, AddrShift>(this, baseptr);
hand_w->set_address_info(nstart, nmask); hand_w->set_address_info(nstart, nmask);
m_root_write->populate(nstart, nend, nmirror, hand_w); m_root_write->populate(nstart, nend, nmirror, hand_w);
} }

View File

@ -70,11 +70,6 @@ template<int Width, int AddrShift, typename READ> typename emu::detail::handler_
return read_impl<READ>(offset, mem_mask); return read_impl<READ>(offset, mem_mask);
} }
template<int Width, int AddrShift, typename READ> std::pair<typename emu::detail::handler_entry_size<Width>::uX, u16> handler_entry_read_delegate<Width, AddrShift, READ>::read_flags(offs_t offset, uX mem_mask) const
{
return std::pair<uX, u16>(read_impl<READ>(offset, mem_mask), this->m_flags);
}
template<int Width, int AddrShift, typename READ> std::string handler_entry_read_delegate<Width, AddrShift, READ>::name() const template<int Width, int AddrShift, typename READ> std::string handler_entry_read_delegate<Width, AddrShift, READ>::name() const
{ {
return m_delegate.name(); return m_delegate.name();
@ -145,12 +140,6 @@ template<int Width, int AddrShift, typename WRITE> void handler_entry_write_dele
write_impl<WRITE>(offset, data, mem_mask); write_impl<WRITE>(offset, data, mem_mask);
} }
template<int Width, int AddrShift, typename WRITE> u16 handler_entry_write_delegate<Width, AddrShift, WRITE>::write_flags(offs_t offset, uX data, uX mem_mask) const
{
write_impl<WRITE>(offset, data, mem_mask);
return this->m_flags;
}
template<int Width, int AddrShift, typename WRITE> std::string handler_entry_write_delegate<Width, AddrShift, WRITE>::name() const template<int Width, int AddrShift, typename WRITE> std::string handler_entry_write_delegate<Width, AddrShift, WRITE>::name() const
{ {
return m_delegate.name(); return m_delegate.name();
@ -164,11 +153,6 @@ template<int Width, int AddrShift> typename emu::detail::handler_entry_size<Widt
return m_port->read(); return m_port->read();
} }
template<int Width, int AddrShift> std::pair<typename emu::detail::handler_entry_size<Width>::uX, u16> handler_entry_read_ioport<Width, AddrShift>::read_flags(offs_t offset, uX mem_mask) const
{
return std::pair<uX, u16>(m_port->read(), this->m_flags);
}
template<int Width, int AddrShift> std::string handler_entry_read_ioport<Width, AddrShift>::name() const template<int Width, int AddrShift> std::string handler_entry_read_ioport<Width, AddrShift>::name() const
{ {
return m_port->tag(); return m_port->tag();
@ -179,12 +163,6 @@ template<int Width, int AddrShift> void handler_entry_write_ioport<Width, AddrSh
m_port->write(data, mem_mask); m_port->write(data, mem_mask);
} }
template<int Width, int AddrShift> u16 handler_entry_write_ioport<Width, AddrShift>::write_flags(offs_t offset, uX data, uX mem_mask) const
{
m_port->write(data, mem_mask);
return this->m_flags;
}
template<int Width, int AddrShift> std::string handler_entry_write_ioport<Width, AddrShift>::name() const template<int Width, int AddrShift> std::string handler_entry_write_ioport<Width, AddrShift>::name() const
{ {
return m_port->tag(); return m_port->tag();

View File

@ -7,18 +7,17 @@
// handler_entry_read_delegate/handler_entry_write_delegate // handler_entry_read_delegate/handler_entry_write_delegate
// Executes an access through a delegate, usually containing a handler or a lambda // Executes an access through called a delegate, usually containing a handler or a lambda
template<int Width, int AddrShift, typename READ> class handler_entry_read_delegate : public handler_entry_read_address<Width, AddrShift> template<int Width, int AddrShift, typename READ> class handler_entry_read_delegate : public handler_entry_read_address<Width, AddrShift>
{ {
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_read_delegate(address_space *space, u16 flags, const READ &delegate) : handler_entry_read_address<Width, AddrShift>(space, flags), m_delegate(delegate) {} handler_entry_read_delegate(address_space *space, const READ &delegate) : handler_entry_read_address<Width, AddrShift>(space, 0), m_delegate(delegate) {}
~handler_entry_read_delegate() = default; ~handler_entry_read_delegate() = default;
uX read(offs_t offset, uX mem_mask) const override; uX read(offs_t offset, uX mem_mask) const override;
std::pair<uX, u16> read_flags(offs_t offset, uX mem_mask) const override;
std::string name() const override; std::string name() const override;
@ -73,11 +72,10 @@ template<int Width, int AddrShift, typename WRITE> class handler_entry_write_del
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_write_delegate(address_space *space, u16 flags, const WRITE &delegate) : handler_entry_write_address<Width, AddrShift>(space, flags), m_delegate(delegate) {} handler_entry_write_delegate(address_space *space, const WRITE &delegate) : handler_entry_write_address<Width, AddrShift>(space, 0), m_delegate(delegate) {}
~handler_entry_write_delegate() = default; ~handler_entry_write_delegate() = default;
void write(offs_t offset, uX data, uX mem_mask) const override; void write(offs_t offset, uX data, uX mem_mask) const override;
u16 write_flags(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override; std::string name() const override;
@ -137,11 +135,10 @@ template<int Width, int AddrShift> class handler_entry_read_ioport : public hand
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_read_ioport(address_space *space, u16 flags, ioport_port *port) : handler_entry_read<Width, AddrShift>(space, flags), m_port(port) {} handler_entry_read_ioport(address_space *space, ioport_port *port) : handler_entry_read<Width, AddrShift>(space, 0), m_port(port) {}
~handler_entry_read_ioport() = default; ~handler_entry_read_ioport() = default;
uX read(offs_t offset, uX mem_mask) const override; uX read(offs_t offset, uX mem_mask) const override;
std::pair<uX, u16> read_flags(offs_t offset, uX mem_mask) const override;
std::string name() const override; std::string name() const override;
@ -154,11 +151,10 @@ template<int Width, int AddrShift> class handler_entry_write_ioport : public han
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_write_ioport(address_space *space, u16 flags, ioport_port *port) : handler_entry_write<Width, AddrShift>(space, flags), m_port(port) {} handler_entry_write_ioport(address_space *space, ioport_port *port) : handler_entry_write<Width, AddrShift>(space, 0), m_port(port) {}
~handler_entry_write_ioport() = default; ~handler_entry_write_ioport() = default;
void write(offs_t offset, uX data, uX mem_mask) const override; void write(offs_t offset, uX data, uX mem_mask) const override;
u16 write_flags(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override; std::string name() const override;

View File

@ -22,7 +22,6 @@ public:
~handler_entry_read_dispatch(); ~handler_entry_read_dispatch();
uX read(offs_t offset, uX mem_mask) const override; uX read(offs_t offset, uX mem_mask) const override;
std::pair<uX, u16> read_flags(offs_t offset, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override; void *get_ptr(offs_t offset) const override;
void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift> *&handler) const override; void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift> *&handler) const override;

View File

@ -132,11 +132,6 @@ template<int HighBits, int Width, int AddrShift> typename emu::detail::handler_e
return dispatch_read<Level, Width, AddrShift>(HIGHMASK, offset, mem_mask, m_a_dispatch); return dispatch_read<Level, Width, AddrShift>(HIGHMASK, offset, mem_mask, m_a_dispatch);
} }
template<int HighBits, int Width, int AddrShift> std::pair<typename emu::detail::handler_entry_size<Width>::uX, u16> handler_entry_read_dispatch<HighBits, Width, AddrShift>::read_flags(offs_t offset, uX mem_mask) const
{
return dispatch_read_flags<Level, Width, AddrShift>(HIGHMASK, offset, mem_mask, m_a_dispatch);
}
template<int HighBits, int Width, int AddrShift> void *handler_entry_read_dispatch<HighBits, Width, AddrShift>::get_ptr(offs_t offset) const template<int HighBits, int Width, int AddrShift> void *handler_entry_read_dispatch<HighBits, Width, AddrShift>::get_ptr(offs_t offset) const
{ {
return m_a_dispatch[(offset & HIGHMASK) >> LowBits]->get_ptr(offset); return m_a_dispatch[(offset & HIGHMASK) >> LowBits]->get_ptr(offset);

View File

@ -22,7 +22,6 @@ public:
~handler_entry_write_dispatch(); ~handler_entry_write_dispatch();
void write(offs_t offset, uX data, uX mem_mask) const override; void write(offs_t offset, uX data, uX mem_mask) const override;
u16 write_flags(offs_t offset, uX data, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override; void *get_ptr(offs_t offset) const override;
void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift> *&handler) const override; void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift> *&handler) const override;

View File

@ -131,11 +131,6 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_write_dispat
dispatch_write<Level, Width, AddrShift>(HIGHMASK, offset, data, mem_mask, m_a_dispatch); dispatch_write<Level, Width, AddrShift>(HIGHMASK, offset, data, mem_mask, m_a_dispatch);
} }
template<int HighBits, int Width, int AddrShift> u16 handler_entry_write_dispatch<HighBits, Width, AddrShift>::write_flags(offs_t offset, uX data, uX mem_mask) const
{
return dispatch_write_flags<Level, Width, AddrShift>(HIGHMASK, offset, data, mem_mask, m_a_dispatch);
}
template<int HighBits, int Width, int AddrShift> void *handler_entry_write_dispatch<HighBits, Width, AddrShift>::get_ptr(offs_t offset) const template<int HighBits, int Width, int AddrShift> void *handler_entry_write_dispatch<HighBits, Width, AddrShift>::get_ptr(offs_t offset) const
{ {
return m_a_dispatch[(offset & HIGHMASK) >> LowBits]->get_ptr(offset); return m_a_dispatch[(offset & HIGHMASK) >> LowBits]->get_ptr(offset);

View File

@ -10,11 +10,6 @@ template<int Width, int AddrShift> typename emu::detail::handler_entry_size<Widt
return m_base[((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift)]; return m_base[((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift)];
} }
template<int Width, int AddrShift> std::pair<typename emu::detail::handler_entry_size<Width>::uX, u16> handler_entry_read_memory<Width, AddrShift>::read_flags(offs_t offset, uX mem_mask) const
{
return std::pair<uX, u16>(m_base[((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift)], this->m_flags);
}
template<int Width, int AddrShift> void *handler_entry_read_memory<Width, AddrShift>::get_ptr(offs_t offset) const template<int Width, int AddrShift> void *handler_entry_read_memory<Width, AddrShift>::get_ptr(offs_t offset) const
{ {
return m_base + (((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift)); return m_base + (((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift));
@ -32,24 +27,11 @@ template<int Width, int AddrShift> void handler_entry_write_memory<Width, AddrSh
m_base[off] = (m_base[off] & ~mem_mask) | (data & mem_mask); m_base[off] = (m_base[off] & ~mem_mask) | (data & mem_mask);
} }
template<int Width, int AddrShift> u16 handler_entry_write_memory<Width, AddrShift>::write_flags(offs_t offset, uX data, uX mem_mask) const
{
offs_t off = ((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift);
m_base[off] = (m_base[off] & ~mem_mask) | (data & mem_mask);
return this->m_flags;
}
template<> void handler_entry_write_memory<0, 0>::write(offs_t offset, u8 data, u8 mem_mask) const template<> void handler_entry_write_memory<0, 0>::write(offs_t offset, u8 data, u8 mem_mask) const
{ {
m_base[(offset - this->m_address_base) & this->m_address_mask] = data; m_base[(offset - this->m_address_base) & this->m_address_mask] = data;
} }
template<> u16 handler_entry_write_memory<0, 0>::write_flags(offs_t offset, u8 data, u8 mem_mask) const
{
m_base[(offset - this->m_address_base) & this->m_address_mask] = data;
return this->m_flags;
}
template<int Width, int AddrShift> void *handler_entry_write_memory<Width, AddrShift>::get_ptr(offs_t offset) const template<int Width, int AddrShift> void *handler_entry_write_memory<Width, AddrShift>::get_ptr(offs_t offset) const
{ {
return m_base + (((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift)); return m_base + (((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift));
@ -69,11 +51,6 @@ template<int Width, int AddrShift> typename emu::detail::handler_entry_size<Widt
return static_cast<uX *>(m_bank.base())[((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift)]; return static_cast<uX *>(m_bank.base())[((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift)];
} }
template<int Width, int AddrShift> std::pair<typename emu::detail::handler_entry_size<Width>::uX, u16> handler_entry_read_memory_bank<Width, AddrShift>::read_flags(offs_t offset, uX mem_mask) const
{
return std::pair<uX, u16>(static_cast<uX *>(m_bank.base())[((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift)], this->m_flags);
}
template<int Width, int AddrShift> void *handler_entry_read_memory_bank<Width, AddrShift>::get_ptr(offs_t offset) const template<int Width, int AddrShift> void *handler_entry_read_memory_bank<Width, AddrShift>::get_ptr(offs_t offset) const
{ {
return static_cast<uX *>(m_bank.base()) + (((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift)); return static_cast<uX *>(m_bank.base()) + (((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift));
@ -91,24 +68,11 @@ template<int Width, int AddrShift> void handler_entry_write_memory_bank<Width, A
static_cast<uX *>(m_bank.base())[off] = (static_cast<uX *>(m_bank.base())[off] & ~mem_mask) | (data & mem_mask); static_cast<uX *>(m_bank.base())[off] = (static_cast<uX *>(m_bank.base())[off] & ~mem_mask) | (data & mem_mask);
} }
template<int Width, int AddrShift> u16 handler_entry_write_memory_bank<Width, AddrShift>::write_flags(offs_t offset, uX data, uX mem_mask) const
{
offs_t off = ((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift);
static_cast<uX *>(m_bank.base())[off] = (static_cast<uX *>(m_bank.base())[off] & ~mem_mask) | (data & mem_mask);
return this->m_flags;
}
template<> void handler_entry_write_memory_bank<0, 0>::write(offs_t offset, u8 data, u8 mem_mask) const template<> void handler_entry_write_memory_bank<0, 0>::write(offs_t offset, u8 data, u8 mem_mask) const
{ {
static_cast<uX *>(m_bank.base())[(offset - this->m_address_base) & this->m_address_mask] = data; static_cast<uX *>(m_bank.base())[(offset - this->m_address_base) & this->m_address_mask] = data;
} }
template<> u16 handler_entry_write_memory_bank<0, 0>::write_flags(offs_t offset, u8 data, u8 mem_mask) const
{
static_cast<uX *>(m_bank.base())[(offset - this->m_address_base) & this->m_address_mask] = data;
return this->m_flags;
}
template<int Width, int AddrShift> void *handler_entry_write_memory_bank<Width, AddrShift>::get_ptr(offs_t offset) const template<int Width, int AddrShift> void *handler_entry_write_memory_bank<Width, AddrShift>::get_ptr(offs_t offset) const
{ {
return static_cast<uX *>(m_bank.base()) + (((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift)); return static_cast<uX *>(m_bank.base()) + (((offset - this->m_address_base) & this->m_address_mask) >> (Width + AddrShift));

View File

@ -14,11 +14,10 @@ template<int Width, int AddrShift> class handler_entry_read_memory : public hand
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_read_memory(address_space *space, u16 flags, void *base) : handler_entry_read_address<Width, AddrShift>(space, flags), m_base(reinterpret_cast<uX *>(base)) {} handler_entry_read_memory(address_space *space, void *base) : handler_entry_read_address<Width, AddrShift>(space, 0), m_base(reinterpret_cast<uX *>(base)) {}
~handler_entry_read_memory() = default; ~handler_entry_read_memory() = default;
uX read(offs_t offset, uX mem_mask) const override; uX read(offs_t offset, uX mem_mask) const override;
std::pair<uX, u16> read_flags(offs_t offset, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override; void *get_ptr(offs_t offset) const override;
std::string name() const override; std::string name() const override;
@ -32,11 +31,10 @@ template<int Width, int AddrShift> class handler_entry_write_memory : public han
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_write_memory(address_space *space, u16 flags, void *base) : handler_entry_write_address<Width, AddrShift>(space, flags), m_base(reinterpret_cast<uX *>(base)) {} handler_entry_write_memory(address_space *space, void *base) : handler_entry_write_address<Width, AddrShift>(space, 0), m_base(reinterpret_cast<uX *>(base)) {}
~handler_entry_write_memory() = default; ~handler_entry_write_memory() = default;
void write(offs_t offset, uX data, uX mem_mask) const override; void write(offs_t offset, uX data, uX mem_mask) const override;
u16 write_flags(offs_t offset, uX data, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override; void *get_ptr(offs_t offset) const override;
std::string name() const override; std::string name() const override;
@ -55,11 +53,10 @@ template<int Width, int AddrShift> class handler_entry_read_memory_bank : public
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_read_memory_bank(address_space *space, u16 flags, memory_bank &bank) : handler_entry_read_address<Width, AddrShift>(space, flags), m_bank(bank) {} handler_entry_read_memory_bank(address_space *space, memory_bank &bank) : handler_entry_read_address<Width, AddrShift>(space, 0), m_bank(bank) {}
~handler_entry_read_memory_bank() = default; ~handler_entry_read_memory_bank() = default;
uX read(offs_t offset, uX mem_mask) const override; uX read(offs_t offset, uX mem_mask) const override;
std::pair<uX, u16> read_flags(offs_t offset, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override; void *get_ptr(offs_t offset) const override;
std::string name() const override; std::string name() const override;
@ -73,11 +70,10 @@ template<int Width, int AddrShift> class handler_entry_write_memory_bank : publi
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_write_memory_bank(address_space *space, u16 flags, memory_bank &bank) : handler_entry_write_address<Width, AddrShift>(space, flags), m_bank(bank) {} handler_entry_write_memory_bank(address_space *space, memory_bank &bank) : handler_entry_write_address<Width, AddrShift>(space, 0), m_bank(bank) {}
~handler_entry_write_memory_bank() = default; ~handler_entry_write_memory_bank() = default;
void write(offs_t offset, uX data, uX mem_mask) const override; void write(offs_t offset, uX data, uX mem_mask) const override;
u16 write_flags(offs_t offset, uX data, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override; void *get_ptr(offs_t offset) const override;
std::string name() const override; std::string name() const override;

View File

@ -16,17 +16,6 @@ template<int Width, int AddrShift> typename emu::detail::handler_entry_size<Widt
return data; return data;
} }
template<int Width, int AddrShift> std::pair<typename emu::detail::handler_entry_size<Width>::uX, u16> handler_entry_read_tap<Width, AddrShift>::read_flags(offs_t offset, uX mem_mask) const
{
this->ref();
auto pack = this->m_next->read_flags(offset, mem_mask);
m_tap(offset, pack.first, mem_mask);
this->unref();
return pack;
}
template<int Width, int AddrShift> std::string handler_entry_read_tap<Width, AddrShift>::name() const template<int Width, int AddrShift> std::string handler_entry_read_tap<Width, AddrShift>::name() const
{ {
return '(' + m_name + ") " + this->m_next->name(); return '(' + m_name + ") " + this->m_next->name();
@ -48,17 +37,6 @@ template<int Width, int AddrShift> void handler_entry_write_tap<Width, AddrShift
this->unref(); this->unref();
} }
template<int Width, int AddrShift> u16 handler_entry_write_tap<Width, AddrShift>::write_flags(offs_t offset, uX data, uX mem_mask) const
{
this->ref();
m_tap(offset, data, mem_mask);
u16 flags = this->m_next->write_flags(offset, data, mem_mask);
this->unref();
return flags;
}
template<int Width, int AddrShift> std::string handler_entry_write_tap<Width, AddrShift>::name() const template<int Width, int AddrShift> std::string handler_entry_write_tap<Width, AddrShift>::name() const
{ {
return '(' + m_name + ") " + this->m_next->name(); return '(' + m_name + ") " + this->m_next->name();

View File

@ -18,7 +18,6 @@ public:
~handler_entry_read_tap() = default; ~handler_entry_read_tap() = default;
uX read(offs_t offset, uX mem_mask) const override; uX read(offs_t offset, uX mem_mask) const override;
std::pair<uX, u16> read_flags(offs_t offset, uX mem_mask) const override;
std::string name() const override; std::string name() const override;
@ -40,7 +39,6 @@ public:
~handler_entry_write_tap() = default; ~handler_entry_write_tap() = default;
void write(offs_t offset, uX data, uX mem_mask) const override; void write(offs_t offset, uX data, uX mem_mask) const override;
u16 write_flags(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override; std::string name() const override;

View File

@ -104,39 +104,6 @@ template<int Width, int AddrShift> typename emu::detail::handler_entry_size<Widt
return result; return result;
} }
template<int Width, int AddrShift> std::pair<typename emu::detail::handler_entry_size<Width>::uX, u16> handler_entry_read_units<Width, AddrShift>::read_flags(offs_t offset, uX mem_mask) const
{
this->ref();
uX result = m_unmap;
u16 flags = 0;
for (int index = 0; index < m_subunits; index++) {
const subunit_info &si = m_subunit_infos[index];
if (mem_mask & si.m_amask) {
offs_t aoffset = (si.m_ashift >= 0 ? offset >> si.m_ashift : offset << si.m_ashift) + si.m_offset;
std::pair<uX, u16> pack;
switch(si.m_width) {
case 0:
pack = static_cast<handler_entry_read<0, 0> *>(si.m_handler)->read_flags(aoffset, mem_mask >> si.m_dshift);
break;
case 1:
pack = static_cast<handler_entry_read<1, -1> *>(si.m_handler)->read_flags(aoffset, mem_mask >> si.m_dshift);
break;
case 2:
pack = static_cast<handler_entry_read<2, -2> *>(si.m_handler)->read_flags(aoffset, mem_mask >> si.m_dshift);
break;
default:
abort();
}
result |= uX(pack.first) << si.m_dshift;
flags |= pack.second;
}
}
this->unref();
return std::make_pair(result, flags);
}
template<int Width, int AddrShift> std::string handler_entry_read_units<Width, AddrShift>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask) template<int Width, int AddrShift> std::string handler_entry_read_units<Width, AddrShift>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
{ {
constexpr u32 mbits = 8*sizeof(uX); constexpr u32 mbits = 8*sizeof(uX);
@ -256,35 +223,6 @@ template<int Width, int AddrShift> void handler_entry_write_units<Width, AddrShi
this->unref(); this->unref();
} }
template<int Width, int AddrShift> u16 handler_entry_write_units<Width, AddrShift>::write_flags(offs_t offset, uX data, uX mem_mask) const
{
this->ref();
u16 flags = 0;
for (int index = 0; index < m_subunits; index++) {
const subunit_info &si = m_subunit_infos[index];
if (mem_mask & si.m_amask) {
offs_t aoffset = (si.m_ashift >= 0 ? offset >> si.m_ashift : offset << si.m_ashift) + si.m_offset;
switch(si.m_width) {
case 0:
flags |= static_cast<handler_entry_write<0, 0> *>(si.m_handler)->write_flags(aoffset, data >> si.m_dshift, mem_mask >> si.m_dshift);
break;
case 1:
flags |= static_cast<handler_entry_write<1, -1> *>(si.m_handler)->write_flags(aoffset, data >> si.m_dshift, mem_mask >> si.m_dshift);
break;
case 2:
flags |= static_cast<handler_entry_write<2, -2> *>(si.m_handler)->write_flags(aoffset, data >> si.m_dshift, mem_mask >> si.m_dshift);
break;
default:
abort();
}
}
}
this->unref();
return flags;
}
template<int Width, int AddrShift> std::string handler_entry_write_units<Width, AddrShift>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask) template<int Width, int AddrShift> std::string handler_entry_write_units<Width, AddrShift>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
{ {

View File

@ -20,7 +20,6 @@ public:
~handler_entry_read_units(); ~handler_entry_read_units();
uX read(offs_t offset, uX mem_mask) const override; uX read(offs_t offset, uX mem_mask) const override;
std::pair<uX, u16> read_flags(offs_t offset, uX mem_mask) const override;
std::string name() const override; std::string name() const override;
@ -62,7 +61,6 @@ public:
~handler_entry_write_units(); ~handler_entry_write_units();
void write(offs_t offset, uX data, uX mem_mask) const override; void write(offs_t offset, uX data, uX mem_mask) const override;
u16 write_flags(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override; std::string name() const override;

View File

@ -17,18 +17,6 @@ template<int Width, int AddrShift> typename emu::detail::handler_entry_size<Widt
return this->m_space->unmap(); return this->m_space->unmap();
} }
template<int Width, int AddrShift> std::pair<typename emu::detail::handler_entry_size<Width>::uX, u16> handler_entry_read_unmapped<Width, AddrShift>::read_flags(offs_t offset, uX mem_mask) const
{
if (this->m_space->log_unmap() && !this->m_space->m_manager.machine().side_effects_disabled())
this->m_space->device().logerror(this->m_space->is_octal()
? "%s: unmapped %s memory read from %0*o & %0*o\n"
: "%s: unmapped %s memory read from %0*X & %0*X\n",
this->m_space->m_manager.machine().describe_context(), this->m_space->name(),
this->m_space->addrchars(), offset,
2 << Width, mem_mask);
return std::pair<uX, u16>(this->m_space->unmap(), this->m_flags);
}
template<int Width, int AddrShift> std::string handler_entry_read_unmapped<Width, AddrShift>::name() const template<int Width, int AddrShift> std::string handler_entry_read_unmapped<Width, AddrShift>::name() const
{ {
return "unmapped"; return "unmapped";
@ -47,19 +35,6 @@ template<int Width, int AddrShift> void handler_entry_write_unmapped<Width, Addr
2 << Width, mem_mask); 2 << Width, mem_mask);
} }
template<int Width, int AddrShift> u16 handler_entry_write_unmapped<Width, AddrShift>::write_flags(offs_t offset, uX data, uX mem_mask)const
{
if (this->m_space->log_unmap() && !this->m_space->m_manager.machine().side_effects_disabled())
this->m_space->device().logerror(this->m_space->is_octal()
? "%s: unmapped %s memory write to %0*o = %0*o & %0*o\n"
: "%s: unmapped %s memory write to %0*X = %0*X & %0*X\n",
this->m_space->m_manager.machine().describe_context(), this->m_space->name(),
this->m_space->addrchars(), offset,
2 << Width, data,
2 << Width, mem_mask);
return this->m_flags;
}
template<int Width, int AddrShift> std::string handler_entry_write_unmapped<Width, AddrShift>::name() const template<int Width, int AddrShift> std::string handler_entry_write_unmapped<Width, AddrShift>::name() const
{ {
return "unmapped"; return "unmapped";
@ -73,11 +48,6 @@ template<int Width, int AddrShift> typename emu::detail::handler_entry_size<Widt
return this->m_space->unmap(); return this->m_space->unmap();
} }
template<int Width, int AddrShift> std::pair<typename emu::detail::handler_entry_size<Width>::uX, u16> handler_entry_read_nop<Width, AddrShift>::read_flags(offs_t offset, uX mem_mask) const
{
return std::pair<uX, u16>(this->m_space->unmap(), this->m_flags);
}
template<int Width, int AddrShift> std::string handler_entry_read_nop<Width, AddrShift>::name() const template<int Width, int AddrShift> std::string handler_entry_read_nop<Width, AddrShift>::name() const
{ {
return "nop"; return "nop";
@ -88,11 +58,6 @@ template<int Width, int AddrShift> void handler_entry_write_nop<Width, AddrShift
{ {
} }
template<int Width, int AddrShift> u16 handler_entry_write_nop<Width, AddrShift>::write_flags(offs_t offset, uX data, uX mem_mask) const
{
return this->m_flags;
}
template<int Width, int AddrShift> std::string handler_entry_write_nop<Width, AddrShift>::name() const template<int Width, int AddrShift> std::string handler_entry_write_nop<Width, AddrShift>::name() const
{ {
return "nop"; return "nop";

View File

@ -14,11 +14,10 @@ template<int Width, int AddrShift> class handler_entry_read_unmapped : public ha
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_read_unmapped(address_space *space, u16 flags) : handler_entry_read<Width, AddrShift>(space, handler_entry::F_UNMAP | flags) {} handler_entry_read_unmapped(address_space *space) : handler_entry_read<Width, AddrShift>(space, handler_entry::F_UNMAP) {}
~handler_entry_read_unmapped() = default; ~handler_entry_read_unmapped() = default;
uX read(offs_t offset, uX mem_mask) const override; uX read(offs_t offset, uX mem_mask) const override;
std::pair<uX, u16> read_flags(offs_t offset, uX mem_mask) const override;
std::string name() const override; std::string name() const override;
}; };
@ -28,11 +27,10 @@ template<int Width, int AddrShift> class handler_entry_write_unmapped : public h
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_write_unmapped(address_space *space, u16 flags) : handler_entry_write<Width, AddrShift>(space, handler_entry::F_UNMAP | flags) {} handler_entry_write_unmapped(address_space *space) : handler_entry_write<Width, AddrShift>(space, handler_entry::F_UNMAP) {}
~handler_entry_write_unmapped() = default; ~handler_entry_write_unmapped() = default;
void write(offs_t offset, uX data, uX mem_mask) const override; void write(offs_t offset, uX data, uX mem_mask) const override;
u16 write_flags(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override; std::string name() const override;
}; };
@ -48,11 +46,10 @@ template<int Width, int AddrShift> class handler_entry_read_nop : public handler
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_read_nop(address_space *space, u16 flags) : handler_entry_read<Width, AddrShift>(space, flags) {} handler_entry_read_nop(address_space *space) : handler_entry_read<Width, AddrShift>(space, 0) {}
~handler_entry_read_nop() = default; ~handler_entry_read_nop() = default;
uX read(offs_t offset, uX mem_mask) const override; uX read(offs_t offset, uX mem_mask) const override;
std::pair<uX, u16> read_flags(offs_t offset, uX mem_mask) const override;
std::string name() const override; std::string name() const override;
}; };
@ -62,11 +59,10 @@ template<int Width, int AddrShift> class handler_entry_write_nop : public handle
public: public:
using uX = typename emu::detail::handler_entry_size<Width>::uX; using uX = typename emu::detail::handler_entry_size<Width>::uX;
handler_entry_write_nop(address_space *space, u16 flags) : handler_entry_write<Width, AddrShift>(space, flags) {} handler_entry_write_nop(address_space *space) : handler_entry_write<Width, AddrShift>(space, 0) {}
~handler_entry_write_nop() = default; ~handler_entry_write_nop() = default;
void write(offs_t offset, uX data, uX mem_mask) const override; void write(offs_t offset, uX data, uX mem_mask) const override;
u16 write_flags(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override; std::string name() const override;
}; };

View File

@ -130,188 +130,188 @@ public:
virtual memory_passthrough_handler *install_write_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap, memory_passthrough_handler *mph) override; virtual memory_passthrough_handler *install_write_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap, memory_passthrough_handler *mph) override;
virtual memory_passthrough_handler *install_readwrite_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapr, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapw, memory_passthrough_handler *mph) override; virtual memory_passthrough_handler *install_readwrite_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapr, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapw, memory_passthrough_handler *mph) override;
virtual void unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, read_or_write readorwrite, bool quiet) override; virtual void unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, bool quiet) override;
virtual void install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, read_or_write readorwrite, void *baseptr) override; virtual void install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, void *baseptr) override;
virtual void install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, memory_bank *rbank, memory_bank *wbank) override; virtual void install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank) override;
virtual void install_view(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_view &view) override; virtual void install_view(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_view &view) override;
virtual void install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, std::string rtag, std::string wtag) override; virtual void install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag) override;
virtual void install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &map, u64 unitmask, int cswidth, u16 flags) override; virtual void install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &map, u64 unitmask, int cswidth) override;
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, write8_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, write16_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, write32_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8m_delegate rhandler, write8m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16m_delegate rhandler, write16m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32m_delegate rhandler, write32m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64m_delegate rhandler, write64m_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8s_delegate rhandler, write8s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16s_delegate rhandler, write16s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32s_delegate rhandler, write32s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64s_delegate rhandler, write64s_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8sm_delegate rhandler, write8sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16sm_delegate rhandler, write16sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32sm_delegate rhandler, write32sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64sm_delegate rhandler, write64sm_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8mo_delegate rhandler, write8mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16mo_delegate rhandler, write16mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32mo_delegate rhandler, write32mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64mo_delegate rhandler, write64mo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8smo_delegate rhandler, write8smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16smo_delegate rhandler, write16smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32smo_delegate rhandler, write32smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, u64 unitmask = 0, int cswidth = 0) override
{ install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler); } { install_read_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler); }
void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, whandler); } { install_write_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, whandler); }
void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0, u16 flags = 0) override void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64smo_delegate rhandler, write64smo_delegate whandler, u64 unitmask = 0, int cswidth = 0) override
{ install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, rhandler, whandler); } { install_readwrite_handler_impl(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, rhandler, whandler); }
template<typename READ> template<typename READ>
void install_read_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, READ &handler_r) void install_read_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, READ &handler_r)
{ {
try { handler_r.resolve(); } try { handler_r.resolve(); }
catch (const binding_type_exception &) { catch (const binding_type_exception &) {
osd_printf_error("Binding error while installing read handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_r.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask); osd_printf_error("Binding error while installing read handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_r.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask);
throw; throw;
} }
install_read_handler_helper<handler_width<READ>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, handler_r); install_read_handler_helper<handler_width<READ>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler_r);
} }
template<typename WRITE> template<typename WRITE>
void install_write_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, WRITE &handler_w) void install_write_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, WRITE &handler_w)
{ {
try { handler_w.resolve(); } try { handler_w.resolve(); }
catch (const binding_type_exception &) { catch (const binding_type_exception &) {
osd_printf_error("Binding error while installing write handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_w.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask); osd_printf_error("Binding error while installing write handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_w.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask);
throw; throw;
} }
install_write_handler_helper<handler_width<WRITE>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, handler_w); install_write_handler_helper<handler_width<WRITE>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler_w);
} }
template<typename READ, typename WRITE> template<typename READ, typename WRITE>
void install_readwrite_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, READ &handler_r, WRITE &handler_w) void install_readwrite_handler_impl(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, READ &handler_r, WRITE &handler_w)
{ {
static_assert(handler_width<READ>::value == handler_width<WRITE>::value, "handler widths do not match"); static_assert(handler_width<READ>::value == handler_width<WRITE>::value, "handler widths do not match");
try { handler_r.resolve(); } try { handler_r.resolve(); }
@ -324,11 +324,11 @@ public:
osd_printf_error("Binding error while installing write handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_w.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask); osd_printf_error("Binding error while installing write handler %s for range 0x%X-0x%X mask 0x%X mirror 0x%X select 0x%X umask 0x%X\n", handler_w.name(), addrstart, addrend, addrmask, addrmirror, addrselect, unitmask);
throw; throw;
} }
install_readwrite_handler_helper<handler_width<READ>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, flags, handler_r, handler_w); install_readwrite_handler_helper<handler_width<READ>::value>(addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, handler_r, handler_w);
} }
template<int AccessWidth, typename READ> template<int AccessWidth, typename READ>
void install_read_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, const READ &handler_r) void install_read_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, const READ &handler_r)
{ {
if constexpr (Width < AccessWidth) { if constexpr (Width < AccessWidth) {
fatalerror("install_read_handler: cannot install a %d-wide handler in a %d-wide bus", 8 << AccessWidth, 8 << Width); fatalerror("install_read_handler: cannot install a %d-wide handler in a %d-wide bus", 8 << AccessWidth, 8 << Width);
@ -345,11 +345,11 @@ public:
check_optimize_all("install_read_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); check_optimize_all("install_read_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth);
if constexpr (Width == AccessWidth) { if constexpr (Width == AccessWidth) {
auto hand_r = new handler_entry_read_delegate<Width, AddrShift, READ>(m_view.m_space, flags, handler_r); auto hand_r = new handler_entry_read_delegate<Width, AddrShift, READ>(m_view.m_space, handler_r);
hand_r->set_address_info(nstart, nmask); hand_r->set_address_info(nstart, nmask);
r()->populate(nstart, nend, nmirror, hand_r); r()->populate(nstart, nend, nmirror, hand_r);
} else { } else {
auto hand_r = new handler_entry_read_delegate<AccessWidth, -AccessWidth, READ>(m_view.m_space, flags, handler_r); auto hand_r = new handler_entry_read_delegate<AccessWidth, -AccessWidth, READ>(m_view.m_space, handler_r);
memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, endianness(), hand_r, nstart, nend, nmask, nunitmask, ncswidth); memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, endianness(), hand_r, nstart, nend, nmask, nunitmask, ncswidth);
hand_r->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); hand_r->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask());
r()->populate_mismatched(nstart, nend, nmirror, descriptor); r()->populate_mismatched(nstart, nend, nmirror, descriptor);
@ -360,7 +360,7 @@ public:
} }
template<int AccessWidth, typename WRITE> template<int AccessWidth, typename WRITE>
void install_write_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, void install_write_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth,
const WRITE &handler_w) const WRITE &handler_w)
{ {
if constexpr (Width < AccessWidth) { if constexpr (Width < AccessWidth) {
@ -378,11 +378,11 @@ public:
check_optimize_all("install_write_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); check_optimize_all("install_write_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth);
if constexpr (Width == AccessWidth) { if constexpr (Width == AccessWidth) {
auto hand_w = new handler_entry_write_delegate<Width, AddrShift, WRITE>(m_view.m_space, flags, handler_w); auto hand_w = new handler_entry_write_delegate<Width, AddrShift, WRITE>(m_view.m_space, handler_w);
hand_w->set_address_info(nstart, nmask); hand_w->set_address_info(nstart, nmask);
w()->populate(nstart, nend, nmirror, hand_w); w()->populate(nstart, nend, nmirror, hand_w);
} else { } else {
auto hand_w = new handler_entry_write_delegate<AccessWidth, -AccessWidth, WRITE>(m_view.m_space, flags, handler_w); auto hand_w = new handler_entry_write_delegate<AccessWidth, -AccessWidth, WRITE>(m_view.m_space, handler_w);
memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, endianness(), hand_w, nstart, nend, nmask, nunitmask, ncswidth); memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, endianness(), hand_w, nstart, nend, nmask, nunitmask, ncswidth);
hand_w->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); hand_w->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask());
w()->populate_mismatched(nstart, nend, nmirror, descriptor); w()->populate_mismatched(nstart, nend, nmirror, descriptor);
@ -393,7 +393,7 @@ public:
} }
template<int AccessWidth, typename READ, typename WRITE> template<int AccessWidth, typename READ, typename WRITE>
void install_readwrite_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth, u16 flags, void install_readwrite_handler_helper(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, u64 unitmask, int cswidth,
const READ &handler_r, const READ &handler_r,
const WRITE &handler_w) const WRITE &handler_w)
{ {
@ -412,21 +412,21 @@ public:
check_optimize_all("install_readwrite_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth); check_optimize_all("install_readwrite_handler", 8 << AccessWidth, addrstart, addrend, addrmask, addrmirror, addrselect, unitmask, cswidth, nstart, nend, nmask, nmirror, nunitmask, ncswidth);
if constexpr (Width == AccessWidth) { if constexpr (Width == AccessWidth) {
auto hand_r = new handler_entry_read_delegate <Width, AddrShift, READ>(m_view.m_space, flags, handler_r); auto hand_r = new handler_entry_read_delegate <Width, AddrShift, READ>(m_view.m_space, handler_r);
hand_r->set_address_info(nstart, nmask); hand_r->set_address_info(nstart, nmask);
r() ->populate(nstart, nend, nmirror, hand_r); r() ->populate(nstart, nend, nmirror, hand_r);
auto hand_w = new handler_entry_write_delegate<Width, AddrShift, WRITE>(m_view.m_space, flags, handler_w); auto hand_w = new handler_entry_write_delegate<Width, AddrShift, WRITE>(m_view.m_space, handler_w);
hand_w->set_address_info(nstart, nmask); hand_w->set_address_info(nstart, nmask);
w()->populate(nstart, nend, nmirror, hand_w); w()->populate(nstart, nend, nmirror, hand_w);
} else { } else {
auto hand_r = new handler_entry_read_delegate <AccessWidth, -AccessWidth, READ>(m_view.m_space, flags, handler_r); auto hand_r = new handler_entry_read_delegate <AccessWidth, -AccessWidth, READ>(m_view.m_space, handler_r);
memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, endianness(), hand_r, nstart, nend, nmask, nunitmask, ncswidth); memory_units_descriptor<Width, AddrShift> descriptor(AccessWidth, endianness(), hand_r, nstart, nend, nmask, nunitmask, ncswidth);
hand_r->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); hand_r->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask());
r() ->populate_mismatched(nstart, nend, nmirror, descriptor); r() ->populate_mismatched(nstart, nend, nmirror, descriptor);
hand_r->unref(); hand_r->unref();
auto hand_w = new handler_entry_write_delegate<AccessWidth, -AccessWidth, WRITE>(m_view.m_space, flags, handler_w); auto hand_w = new handler_entry_write_delegate<AccessWidth, -AccessWidth, WRITE>(m_view.m_space, handler_w);
descriptor.set_subunit_handler(hand_w); descriptor.set_subunit_handler(hand_w);
hand_w->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask()); hand_w->set_address_info(descriptor.get_handler_start(), descriptor.get_handler_mask());
w()->populate_mismatched(nstart, nend, nmirror, descriptor); w()->populate_mismatched(nstart, nend, nmirror, descriptor);
@ -810,7 +810,7 @@ void memory_view::memory_view_entry::check_range_address(const char *function, o
fatalerror("%s: The range %x-%x exceeds the view window boundaries %x-%x.\n", function, addrstart, addrend, m_view.m_addrstart, m_view.m_addrend); fatalerror("%s: The range %x-%x exceeds the view window boundaries %x-%x.\n", function, addrstart, addrend, m_view.m_addrstart, m_view.m_addrend);
} }
template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Level, Width, AddrShift>::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, read_or_write readorwrite, void *baseptr) template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Level, Width, AddrShift>::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, void *baseptr)
{ {
VPRINTF("memory_view::install_ram_generic(%s-%s mirror=%s, %s, %p)\n", VPRINTF("memory_view::install_ram_generic(%s-%s mirror=%s, %s, %p)\n",
m_addrchars, addrstart, m_addrchars, addrend, m_addrchars, addrstart, m_addrchars, addrend,
@ -827,7 +827,7 @@ template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Le
// map for read // map for read
if (readorwrite == read_or_write::READ || readorwrite == read_or_write::READWRITE) if (readorwrite == read_or_write::READ || readorwrite == read_or_write::READWRITE)
{ {
auto hand_r = new handler_entry_read_memory<Width, AddrShift>(m_view.m_space, flags, baseptr); auto hand_r = new handler_entry_read_memory<Width, AddrShift>(m_view.m_space, baseptr);
hand_r->set_address_info(nstart, nmask); hand_r->set_address_info(nstart, nmask);
r()->populate(nstart, nend, nmirror, hand_r); r()->populate(nstart, nend, nmirror, hand_r);
} }
@ -835,7 +835,7 @@ template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Le
// map for write // map for write
if (readorwrite == read_or_write::WRITE || readorwrite == read_or_write::READWRITE) if (readorwrite == read_or_write::WRITE || readorwrite == read_or_write::READWRITE)
{ {
auto hand_w = new handler_entry_write_memory<Width, AddrShift>(m_view.m_space, flags, baseptr); auto hand_w = new handler_entry_write_memory<Width, AddrShift>(m_view.m_space, baseptr);
hand_w->set_address_info(nstart, nmask); hand_w->set_address_info(nstart, nmask);
w()->populate(nstart, nend, nmirror, hand_w); w()->populate(nstart, nend, nmirror, hand_w);
} }
@ -843,7 +843,7 @@ template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Le
invalidate_caches(readorwrite); invalidate_caches(readorwrite);
} }
template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Level, Width, AddrShift>::unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, read_or_write readorwrite, bool quiet) template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Level, Width, AddrShift>::unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, bool quiet)
{ {
VPRINTF("memory_view::unmap(%*x-%*x mirror=%*x, %s, %s)\n", VPRINTF("memory_view::unmap(%*x-%*x mirror=%*x, %s, %s)\n",
m_addrchars, addrstart, m_addrchars, addrend, m_addrchars, addrstart, m_addrchars, addrend,
@ -859,24 +859,14 @@ template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Le
// read space // read space
if (readorwrite == read_or_write::READ || readorwrite == read_or_write::READWRITE) { if (readorwrite == read_or_write::READ || readorwrite == read_or_write::READWRITE) {
auto handler = flags ? (quiet ? auto handler = static_cast<handler_entry_read<Width, AddrShift> *>(quiet ? m_view.m_space->nop_r() : m_view.m_space->unmap_r());
static_cast<handler_entry_read<Width, AddrShift> *>(new handler_entry_read_nop<Width, AddrShift>(m_view.m_space, flags)) :
static_cast<handler_entry_read<Width, AddrShift> *>(new handler_entry_read_unmapped<Width, AddrShift>(m_view.m_space, flags)))
: (quiet ?
static_cast<handler_entry_read<Width, AddrShift> *>(m_view.m_space->nop_r()) :
static_cast<handler_entry_read<Width, AddrShift> *>(m_view.m_space->unmap_r()));
handler->ref(); handler->ref();
r()->populate(nstart, nend, nmirror, handler); r()->populate(nstart, nend, nmirror, handler);
} }
// write space // write space
if (readorwrite == read_or_write::WRITE || readorwrite == read_or_write::READWRITE) { if (readorwrite == read_or_write::WRITE || readorwrite == read_or_write::READWRITE) {
auto handler = flags ? (quiet ? auto handler = static_cast<handler_entry_write<Width, AddrShift> *>(quiet ? m_view.m_space->nop_w() : m_view.m_space->unmap_w());
static_cast<handler_entry_write<Width, AddrShift> *>(new handler_entry_write_nop<Width, AddrShift>(m_view.m_space, flags)) :
static_cast<handler_entry_write<Width, AddrShift> *>(new handler_entry_write_unmapped<Width, AddrShift>(m_view.m_space, flags)))
: (quiet ?
static_cast<handler_entry_write<Width, AddrShift> *>(m_view.m_space->nop_w()) :
static_cast<handler_entry_write<Width, AddrShift> *>(m_view.m_space->unmap_w()));
handler->ref(); handler->ref();
w()->populate(nstart, nend, nmirror, handler); w()->populate(nstart, nend, nmirror, handler);
} }
@ -959,16 +949,16 @@ template<int Level, int Width, int AddrShift> memory_passthrough_handler *memory
return mph; return mph;
} }
template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Level, Width, AddrShift>::install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &delegate, u64 unitmask, int cswidth, u16 flags) template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Level, Width, AddrShift>::install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &delegate, u64 unitmask, int cswidth)
{ {
check_range_address("install_device_delegate", addrstart, addrend); check_range_address("install_device_delegate", addrstart, addrend);
address_map map(*m_view.m_space, addrstart, addrend, unitmask, cswidth, flags, m_view.m_device, delegate); address_map map(*m_view.m_space, addrstart, addrend, unitmask, cswidth, m_view.m_device, delegate);
map.import_submaps(m_manager.machine(), device, data_width(), endianness(), addr_shift()); map.import_submaps(m_manager.machine(), device, data_width(), endianness(), addr_shift());
prepare_device_map(map); prepare_device_map(map);
populate_from_map(&map); populate_from_map(&map);
} }
template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Level, Width, AddrShift>::install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, std::string rtag, std::string wtag) template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Level, Width, AddrShift>::install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag)
{ {
VPRINTF("memory_view::install_readwrite_port(%*x-%*x mirror=%*x, read=\"%s\" / write=\"%s\")\n", VPRINTF("memory_view::install_readwrite_port(%*x-%*x mirror=%*x, read=\"%s\" / write=\"%s\")\n",
m_addrchars, addrstart, m_addrchars, addrend, m_addrchars, addrstart, m_addrchars, addrend,
@ -990,7 +980,7 @@ template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Le
throw emu_fatalerror("Attempted to map non-existent port '%s' for read in space %s of device '%s'\n", rtag, m_view.m_name, m_view.m_device.tag()); throw emu_fatalerror("Attempted to map non-existent port '%s' for read in space %s of device '%s'\n", rtag, m_view.m_name, m_view.m_device.tag());
// map the range and set the ioport // map the range and set the ioport
auto hand_r = new handler_entry_read_ioport<Width, AddrShift>(m_view.m_space, flags, port); auto hand_r = new handler_entry_read_ioport<Width, AddrShift>(m_view.m_space, port);
r()->populate(nstart, nend, nmirror, hand_r); r()->populate(nstart, nend, nmirror, hand_r);
} }
@ -1002,13 +992,13 @@ template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Le
fatalerror("Attempted to map non-existent port '%s' for write in space %s of device '%s'\n", wtag, m_view.m_name, m_view.m_device.tag()); fatalerror("Attempted to map non-existent port '%s' for write in space %s of device '%s'\n", wtag, m_view.m_name, m_view.m_device.tag());
// map the range and set the ioport // map the range and set the ioport
auto hand_w = new handler_entry_write_ioport<Width, AddrShift>(m_view.m_space, flags, port); auto hand_w = new handler_entry_write_ioport<Width, AddrShift>(m_view.m_space, port);
w()->populate(nstart, nend, nmirror, hand_w); w()->populate(nstart, nend, nmirror, hand_w);
} }
invalidate_caches(rtag != "" ? wtag != "" ? read_or_write::READWRITE : read_or_write::READ : read_or_write::WRITE); invalidate_caches(rtag != "" ? wtag != "" ? read_or_write::READWRITE : read_or_write::READ : read_or_write::WRITE);
} }
template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Level, Width, AddrShift>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, u16 flags, memory_bank *rbank, memory_bank *wbank) template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Level, Width, AddrShift>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank)
{ {
VPRINTF("memory_view::install_readwrite_bank(%*x-%*x mirror=%*x, read=\"%s\" / write=\"%s\")\n", VPRINTF("memory_view::install_readwrite_bank(%*x-%*x mirror=%*x, read=\"%s\" / write=\"%s\")\n",
m_addrchars, addrstart, m_addrchars, addrend, m_addrchars, addrstart, m_addrchars, addrend,
@ -1024,7 +1014,7 @@ template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Le
// map the read bank // map the read bank
if (rbank != nullptr) if (rbank != nullptr)
{ {
auto hand_r = new handler_entry_read_memory_bank<Width, AddrShift>(m_view.m_space, flags, *rbank); auto hand_r = new handler_entry_read_memory_bank<Width, AddrShift>(m_view.m_space, *rbank);
hand_r->set_address_info(nstart, nmask); hand_r->set_address_info(nstart, nmask);
r()->populate(nstart, nend, nmirror, hand_r); r()->populate(nstart, nend, nmirror, hand_r);
} }
@ -1032,7 +1022,7 @@ template<int Level, int Width, int AddrShift> void memory_view_entry_specific<Le
// map the write bank // map the write bank
if (wbank != nullptr) if (wbank != nullptr)
{ {
auto hand_w = new handler_entry_write_memory_bank<Width, AddrShift>(m_view.m_space, flags, *wbank); auto hand_w = new handler_entry_write_memory_bank<Width, AddrShift>(m_view.m_space, *wbank);
hand_w->set_address_info(nstart, nmask); hand_w->set_address_info(nstart, nmask);
w()->populate(nstart, nend, nmirror, hand_w); w()->populate(nstart, nend, nmirror, hand_w);
} }

View File

@ -19,83 +19,83 @@ namespace {
#define CORE_INPUT_TYPES_P1 \ #define CORE_INPUT_TYPES_P1 \
CORE_INPUT_TYPES_BEGIN(p1) \ CORE_INPUT_TYPES_BEGIN(p1) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICK_UP, N_p("input-name", "P1 Up"), input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICK_DOWN, N_p("input-name", "%p Down"), input_seq(KEYCODE_DOWN, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICK_DOWN, N_p("input-name", "P1 Down"), input_seq(KEYCODE_DOWN, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICK_LEFT, N_p("input-name", "%p Left"), input_seq(KEYCODE_LEFT, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICK_LEFT, N_p("input-name", "P1 Left"), input_seq(KEYCODE_LEFT, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICK_RIGHT, N_p("input-name", "%p Right"), input_seq(KEYCODE_RIGHT, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICK_RIGHT, N_p("input-name", "P1 Right"), input_seq(KEYCODE_RIGHT, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKRIGHT_UP, N_p("input-name", "%p Right Stick/Up"), input_seq(KEYCODE_I, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKRIGHT_UP, N_p("input-name", "P1 Right Stick/Up"), input_seq(KEYCODE_I, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKRIGHT_DOWN, N_p("input-name", "%p Right Stick/Down"), input_seq(KEYCODE_K, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKRIGHT_DOWN, N_p("input-name", "P1 Right Stick/Down"), input_seq(KEYCODE_K, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKRIGHT_LEFT, N_p("input-name", "%p Right Stick/Left"), input_seq(KEYCODE_J, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKRIGHT_LEFT, N_p("input-name", "P1 Right Stick/Left"), input_seq(KEYCODE_J, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKRIGHT_RIGHT, N_p("input-name", "%p Right Stick/Right"), input_seq(KEYCODE_L, input_seq::or_code, JOYCODE_BUTTON4_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKRIGHT_RIGHT, N_p("input-name", "P1 Right Stick/Right"), input_seq(KEYCODE_L, input_seq::or_code, JOYCODE_BUTTON4_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKLEFT_UP, N_p("input-name", "%p Left Stick/Up"), input_seq(KEYCODE_E, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKLEFT_UP, N_p("input-name", "P1 Left Stick/Up"), input_seq(KEYCODE_E, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKLEFT_DOWN, N_p("input-name", "%p Left Stick/Down"), input_seq(KEYCODE_D, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKLEFT_DOWN, N_p("input-name", "P1 Left Stick/Down"), input_seq(KEYCODE_D, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKLEFT_LEFT, N_p("input-name", "%p Left Stick/Left"), input_seq(KEYCODE_S, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKLEFT_LEFT, N_p("input-name", "P1 Left Stick/Left"), input_seq(KEYCODE_S, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKLEFT_RIGHT, N_p("input-name", "%p Left Stick/Right"), input_seq(KEYCODE_F, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, JOYSTICKLEFT_RIGHT, N_p("input-name", "P1 Left Stick/Right"), input_seq(KEYCODE_F, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON1, N_p("input-name", "%p Button 1"), input_seq(KEYCODE_LCONTROL, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(0), input_seq::or_code, MOUSECODE_BUTTON1_INDEXED(0), input_seq::or_code, GUNCODE_BUTTON1_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON1, N_p("input-name", "P1 Button 1"), input_seq(KEYCODE_LCONTROL, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(0), input_seq::or_code, MOUSECODE_BUTTON1_INDEXED(0), input_seq::or_code, GUNCODE_BUTTON1_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON2, N_p("input-name", "%p Button 2"), input_seq(KEYCODE_LALT, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(0), input_seq::or_code, MOUSECODE_BUTTON3_INDEXED(0), input_seq::or_code, GUNCODE_BUTTON2_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON2, N_p("input-name", "P1 Button 2"), input_seq(KEYCODE_LALT, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(0), input_seq::or_code, MOUSECODE_BUTTON3_INDEXED(0), input_seq::or_code, GUNCODE_BUTTON2_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON3, N_p("input-name", "%p Button 3"), input_seq(KEYCODE_SPACE, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(0), input_seq::or_code, MOUSECODE_BUTTON2_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON3, N_p("input-name", "P1 Button 3"), input_seq(KEYCODE_SPACE, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(0), input_seq::or_code, MOUSECODE_BUTTON2_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON4, N_p("input-name", "%p Button 4"), input_seq(KEYCODE_LSHIFT, input_seq::or_code, JOYCODE_BUTTON4_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON4, N_p("input-name", "P1 Button 4"), input_seq(KEYCODE_LSHIFT, input_seq::or_code, JOYCODE_BUTTON4_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON5, N_p("input-name", "%p Button 5"), input_seq(KEYCODE_Z, input_seq::or_code, JOYCODE_BUTTON5_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON5, N_p("input-name", "P1 Button 5"), input_seq(KEYCODE_Z, input_seq::or_code, JOYCODE_BUTTON5_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON6, N_p("input-name", "%p Button 6"), input_seq(KEYCODE_X, input_seq::or_code, JOYCODE_BUTTON6_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON6, N_p("input-name", "P1 Button 6"), input_seq(KEYCODE_X, input_seq::or_code, JOYCODE_BUTTON6_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON7, N_p("input-name", "%p Button 7"), input_seq(KEYCODE_C, input_seq::or_code, JOYCODE_BUTTON7_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON7, N_p("input-name", "P1 Button 7"), input_seq(KEYCODE_C, input_seq::or_code, JOYCODE_BUTTON7_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON8, N_p("input-name", "%p Button 8"), input_seq(KEYCODE_V, input_seq::or_code, JOYCODE_BUTTON8_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON8, N_p("input-name", "P1 Button 8"), input_seq(KEYCODE_V, input_seq::or_code, JOYCODE_BUTTON8_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON9, N_p("input-name", "%p Button 9"), input_seq(KEYCODE_B, input_seq::or_code, JOYCODE_BUTTON9_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON9, N_p("input-name", "P1 Button 9"), input_seq(KEYCODE_B, input_seq::or_code, JOYCODE_BUTTON9_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON10, N_p("input-name", "%p Button 10"), input_seq(KEYCODE_N, input_seq::or_code, JOYCODE_BUTTON10_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON10, N_p("input-name", "P1 Button 10"), input_seq(KEYCODE_N, input_seq::or_code, JOYCODE_BUTTON10_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON11, N_p("input-name", "%p Button 11"), input_seq(KEYCODE_M, input_seq::or_code, JOYCODE_BUTTON11_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON11, N_p("input-name", "P1 Button 11"), input_seq(KEYCODE_M, input_seq::or_code, JOYCODE_BUTTON11_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON12, N_p("input-name", "%p Button 12"), input_seq(KEYCODE_COMMA, input_seq::or_code, JOYCODE_BUTTON12_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON12, N_p("input-name", "P1 Button 12"), input_seq(KEYCODE_COMMA, input_seq::or_code, JOYCODE_BUTTON12_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON13, N_p("input-name", "%p Button 13"), input_seq(KEYCODE_STOP, input_seq::or_code, JOYCODE_BUTTON13_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON13, N_p("input-name", "P1 Button 13"), input_seq(KEYCODE_STOP, input_seq::or_code, JOYCODE_BUTTON13_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(KEYCODE_SLASH, input_seq::or_code, JOYCODE_BUTTON14_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON14, N_p("input-name", "P1 Button 14"), input_seq(KEYCODE_SLASH, input_seq::or_code, JOYCODE_BUTTON14_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(KEYCODE_RSHIFT, input_seq::or_code, JOYCODE_BUTTON15_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON15, N_p("input-name", "P1 Button 15"), input_seq(KEYCODE_RSHIFT, input_seq::or_code, JOYCODE_BUTTON15_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, BUTTON16, N_p("input-name", "P1 Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, START, N_p("input-name", "%p Start"), input_seq(KEYCODE_1, input_seq::or_code, JOYCODE_START_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, START, N_p("input-name", "P1 Start"), input_seq(KEYCODE_1, input_seq::or_code, JOYCODE_START_INDEXED(0)) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, SELECT, N_p("input-name", "%p Select"), input_seq(KEYCODE_5, input_seq::or_code, JOYCODE_SELECT_INDEXED(0)) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, SELECT, N_p("input-name", "P1 Select"), input_seq(KEYCODE_5, input_seq::or_code, JOYCODE_SELECT_INDEXED(0)) ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P1_MAHJONG \ #define CORE_INPUT_TYPES_P1_MAHJONG \
CORE_INPUT_TYPES_BEGIN(p1_mahjong) \ CORE_INPUT_TYPES_BEGIN(p1_mahjong) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_A, N_p("input-name", "%p Mahjong A"), input_seq(KEYCODE_A) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_A, N_p("input-name", "P1 Mahjong A"), input_seq(KEYCODE_A) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_B, N_p("input-name", "%p Mahjong B"), input_seq(KEYCODE_B) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_B, N_p("input-name", "P1 Mahjong B"), input_seq(KEYCODE_B) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_C, N_p("input-name", "%p Mahjong C"), input_seq(KEYCODE_C) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_C, N_p("input-name", "P1 Mahjong C"), input_seq(KEYCODE_C) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_D, N_p("input-name", "%p Mahjong D"), input_seq(KEYCODE_D) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_D, N_p("input-name", "P1 Mahjong D"), input_seq(KEYCODE_D) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_E, N_p("input-name", "%p Mahjong E"), input_seq(KEYCODE_E) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_E, N_p("input-name", "P1 Mahjong E"), input_seq(KEYCODE_E) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_F, N_p("input-name", "%p Mahjong F"), input_seq(KEYCODE_F) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_F, N_p("input-name", "P1 Mahjong F"), input_seq(KEYCODE_F) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_G, N_p("input-name", "%p Mahjong G"), input_seq(KEYCODE_G) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_G, N_p("input-name", "P1 Mahjong G"), input_seq(KEYCODE_G) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_H, N_p("input-name", "%p Mahjong H"), input_seq(KEYCODE_H) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_H, N_p("input-name", "P1 Mahjong H"), input_seq(KEYCODE_H) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_I, N_p("input-name", "%p Mahjong I"), input_seq(KEYCODE_I) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_I, N_p("input-name", "P1 Mahjong I"), input_seq(KEYCODE_I) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_J, N_p("input-name", "%p Mahjong J"), input_seq(KEYCODE_J) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_J, N_p("input-name", "P1 Mahjong J"), input_seq(KEYCODE_J) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_K, N_p("input-name", "%p Mahjong K"), input_seq(KEYCODE_K) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_K, N_p("input-name", "P1 Mahjong K"), input_seq(KEYCODE_K) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_L, N_p("input-name", "%p Mahjong L"), input_seq(KEYCODE_L) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_L, N_p("input-name", "P1 Mahjong L"), input_seq(KEYCODE_L) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_M, N_p("input-name", "%p Mahjong M"), input_seq(KEYCODE_M) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_M, N_p("input-name", "P1 Mahjong M"), input_seq(KEYCODE_M) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_N, N_p("input-name", "%p Mahjong N"), input_seq(KEYCODE_N) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_N, N_p("input-name", "P1 Mahjong N"), input_seq(KEYCODE_N) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_O, N_p("input-name", "%p Mahjong O"), input_seq(KEYCODE_O) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_O, N_p("input-name", "P1 Mahjong O"), input_seq(KEYCODE_O) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_P, N_p("input-name", "%p Mahjong P"), input_seq(KEYCODE_COLON) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_P, N_p("input-name", "P1 Mahjong P"), input_seq(KEYCODE_COLON) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_Q, N_p("input-name", "%p Mahjong Q"), input_seq(KEYCODE_Q) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_Q, N_p("input-name", "P1 Mahjong Q"), input_seq(KEYCODE_Q) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_KAN, N_p("input-name", "%p Mahjong Kan"), input_seq(KEYCODE_LCONTROL) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_KAN, N_p("input-name", "P1 Mahjong Kan"), input_seq(KEYCODE_LCONTROL) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_PON, N_p("input-name", "%p Mahjong Pon"), input_seq(KEYCODE_LALT) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_PON, N_p("input-name", "P1 Mahjong Pon"), input_seq(KEYCODE_LALT) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_CHI, N_p("input-name", "%p Mahjong Chi"), input_seq(KEYCODE_SPACE) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_CHI, N_p("input-name", "P1 Mahjong Chi"), input_seq(KEYCODE_SPACE) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_REACH, N_p("input-name", "%p Mahjong Reach"), input_seq(KEYCODE_LSHIFT) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_REACH, N_p("input-name", "P1 Mahjong Reach"), input_seq(KEYCODE_LSHIFT) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_RON, N_p("input-name", "%p Mahjong Ron"), input_seq(KEYCODE_Z) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_RON, N_p("input-name", "P1 Mahjong Ron"), input_seq(KEYCODE_Z) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_FLIP_FLOP, N_p("input-name", "%p Mahjong Flip Flop"), input_seq(KEYCODE_Y) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_FLIP_FLOP, N_p("input-name", "P1 Mahjong Flip Flop"), input_seq(KEYCODE_Y) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_BET, N_p("input-name", "%p Mahjong Bet"), input_seq(KEYCODE_3) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_BET, N_p("input-name", "P1 Mahjong Bet"), input_seq(KEYCODE_3) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_SCORE, N_p("input-name", "%p Mahjong Take Score"), input_seq(KEYCODE_RCONTROL) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_SCORE, N_p("input-name", "P1 Mahjong Take Score"), input_seq(KEYCODE_RCONTROL) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_DOUBLE_UP, N_p("input-name", "%p Mahjong Double Up"), input_seq(KEYCODE_RSHIFT) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_DOUBLE_UP, N_p("input-name", "P1 Mahjong Double Up"), input_seq(KEYCODE_RSHIFT) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_BIG, N_p("input-name", "%p Mahjong Big"), input_seq(KEYCODE_ENTER) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_BIG, N_p("input-name", "P1 Mahjong Big"), input_seq(KEYCODE_ENTER) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_SMALL, N_p("input-name", "%p Mahjong Small"), input_seq(KEYCODE_BACKSPACE) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_SMALL, N_p("input-name", "P1 Mahjong Small"), input_seq(KEYCODE_BACKSPACE) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_LAST_CHANCE, N_p("input-name", "%p Mahjong Last Chance"), input_seq(KEYCODE_RALT) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, MAHJONG_LAST_CHANCE, N_p("input-name", "P1 Mahjong Last Chance"), input_seq(KEYCODE_RALT) ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P1_HANAFUDA \ #define CORE_INPUT_TYPES_P1_HANAFUDA \
CORE_INPUT_TYPES_BEGIN(p1_hanafuda) \ CORE_INPUT_TYPES_BEGIN(p1_hanafuda) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_A, N_p("input-name", "%p Hanafuda A/1"), input_seq(KEYCODE_A) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_A, N_p("input-name", "P1 Hanafuda A/1"), input_seq(KEYCODE_A) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_B, N_p("input-name", "%p Hanafuda B/2"), input_seq(KEYCODE_B) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_B, N_p("input-name", "P1 Hanafuda B/2"), input_seq(KEYCODE_B) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_C, N_p("input-name", "%p Hanafuda C/3"), input_seq(KEYCODE_C) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_C, N_p("input-name", "P1 Hanafuda C/3"), input_seq(KEYCODE_C) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_D, N_p("input-name", "%p Hanafuda D/4"), input_seq(KEYCODE_D) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_D, N_p("input-name", "P1 Hanafuda D/4"), input_seq(KEYCODE_D) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_E, N_p("input-name", "%p Hanafuda E/5"), input_seq(KEYCODE_E) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_E, N_p("input-name", "P1 Hanafuda E/5"), input_seq(KEYCODE_E) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_F, N_p("input-name", "%p Hanafuda F/6"), input_seq(KEYCODE_F) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_F, N_p("input-name", "P1 Hanafuda F/6"), input_seq(KEYCODE_F) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_G, N_p("input-name", "%p Hanafuda G/7"), input_seq(KEYCODE_G) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_G, N_p("input-name", "P1 Hanafuda G/7"), input_seq(KEYCODE_G) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_H, N_p("input-name", "%p Hanafuda H/8"), input_seq(KEYCODE_H) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_H, N_p("input-name", "P1 Hanafuda H/8"), input_seq(KEYCODE_H) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_YES, N_p("input-name", "%p Hanafuda Yes"), input_seq(KEYCODE_M) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_YES, N_p("input-name", "P1 Hanafuda Yes"), input_seq(KEYCODE_M) ) \
INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_NO, N_p("input-name", "%p Hanafuda No"), input_seq(KEYCODE_N) ) \ INPUT_PORT_DIGITAL_TYPE( 1, PLAYER1, HANAFUDA_NO, N_p("input-name", "P1 Hanafuda No"), input_seq(KEYCODE_N) ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_GAMBLE \ #define CORE_INPUT_TYPES_GAMBLE \
@ -137,355 +137,355 @@ namespace {
#define CORE_INPUT_TYPES_P2 \ #define CORE_INPUT_TYPES_P2 \
CORE_INPUT_TYPES_BEGIN(p2) \ CORE_INPUT_TYPES_BEGIN(p2) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(KEYCODE_R, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICK_UP, N_p("input-name", "P2 Up"), input_seq(KEYCODE_R, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICK_DOWN, N_p("input-name", "%p Down"), input_seq(KEYCODE_F, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICK_DOWN, N_p("input-name", "P2 Down"), input_seq(KEYCODE_F, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICK_LEFT, N_p("input-name", "%p Left"), input_seq(KEYCODE_D, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICK_LEFT, N_p("input-name", "P2 Left"), input_seq(KEYCODE_D, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICK_RIGHT, N_p("input-name", "%p Right"), input_seq(KEYCODE_G, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICK_RIGHT, N_p("input-name", "P2 Right"), input_seq(KEYCODE_G, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKRIGHT_UP, N_p("input-name", "%p Right Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKRIGHT_UP, N_p("input-name", "P2 Right Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKRIGHT_DOWN, N_p("input-name", "%p Right Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKRIGHT_DOWN, N_p("input-name", "P2 Right Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKRIGHT_LEFT, N_p("input-name", "%p Right Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKRIGHT_LEFT, N_p("input-name", "P2 Right Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKRIGHT_RIGHT, N_p("input-name", "%p Right Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKRIGHT_RIGHT, N_p("input-name", "P2 Right Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKLEFT_UP, N_p("input-name", "%p Left Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKLEFT_UP, N_p("input-name", "P2 Left Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKLEFT_DOWN, N_p("input-name", "%p Left Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKLEFT_DOWN, N_p("input-name", "P2 Left Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKLEFT_LEFT, N_p("input-name", "%p Left Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKLEFT_LEFT, N_p("input-name", "P2 Left Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKLEFT_RIGHT, N_p("input-name", "%p Left Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, JOYSTICKLEFT_RIGHT, N_p("input-name", "P2 Left Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON1, N_p("input-name", "%p Button 1"), input_seq(KEYCODE_A, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(1), input_seq::or_code, MOUSECODE_BUTTON1_INDEXED(1), input_seq::or_code, GUNCODE_BUTTON1_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON1, N_p("input-name", "P2 Button 1"), input_seq(KEYCODE_A, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(1), input_seq::or_code, MOUSECODE_BUTTON1_INDEXED(1), input_seq::or_code, GUNCODE_BUTTON1_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON2, N_p("input-name", "%p Button 2"), input_seq(KEYCODE_S, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(1), input_seq::or_code, MOUSECODE_BUTTON3_INDEXED(1), input_seq::or_code, GUNCODE_BUTTON2_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON2, N_p("input-name", "P2 Button 2"), input_seq(KEYCODE_S, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(1), input_seq::or_code, MOUSECODE_BUTTON3_INDEXED(1), input_seq::or_code, GUNCODE_BUTTON2_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON3, N_p("input-name", "%p Button 3"), input_seq(KEYCODE_Q, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(1), input_seq::or_code, MOUSECODE_BUTTON2_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON3, N_p("input-name", "P2 Button 3"), input_seq(KEYCODE_Q, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(1), input_seq::or_code, MOUSECODE_BUTTON2_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON4, N_p("input-name", "%p Button 4"), input_seq(KEYCODE_W, input_seq::or_code, JOYCODE_BUTTON4_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON4, N_p("input-name", "P2 Button 4"), input_seq(KEYCODE_W, input_seq::or_code, JOYCODE_BUTTON4_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON5, N_p("input-name", "%p Button 5"), input_seq(KEYCODE_E, input_seq::or_code, JOYCODE_BUTTON5_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON5, N_p("input-name", "P2 Button 5"), input_seq(KEYCODE_E, input_seq::or_code, JOYCODE_BUTTON5_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON6, N_p("input-name", "%p Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON6, N_p("input-name", "P2 Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON7, N_p("input-name", "%p Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON7, N_p("input-name", "P2 Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON8, N_p("input-name", "%p Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON8, N_p("input-name", "P2 Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON9, N_p("input-name", "%p Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON9, N_p("input-name", "P2 Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON10, N_p("input-name", "%p Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON10, N_p("input-name", "P2 Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON11, N_p("input-name", "%p Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON11, N_p("input-name", "P2 Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON12, N_p("input-name", "%p Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON12, N_p("input-name", "P2 Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON13, N_p("input-name", "%p Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON13, N_p("input-name", "P2 Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON14, N_p("input-name", "P2 Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON15, N_p("input-name", "P2 Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, BUTTON16, N_p("input-name", "P2 Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, START, N_p("input-name", "%p Start"), input_seq(KEYCODE_2, input_seq::or_code, JOYCODE_START_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, START, N_p("input-name", "P2 Start"), input_seq(KEYCODE_2, input_seq::or_code, JOYCODE_START_INDEXED(1)) ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, SELECT, N_p("input-name", "%p Select"), input_seq(KEYCODE_6, input_seq::or_code, JOYCODE_SELECT_INDEXED(1)) ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, SELECT, N_p("input-name", "P2 Select"), input_seq(KEYCODE_6, input_seq::or_code, JOYCODE_SELECT_INDEXED(1)) ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P2_MAHJONG \ #define CORE_INPUT_TYPES_P2_MAHJONG \
CORE_INPUT_TYPES_BEGIN(p2_mahjong) \ CORE_INPUT_TYPES_BEGIN(p2_mahjong) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_A, N_p("input-name", "%p Mahjong A"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_A, N_p("input-name", "P2 Mahjong A"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_B, N_p("input-name", "%p Mahjong B"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_B, N_p("input-name", "P2 Mahjong B"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_C, N_p("input-name", "%p Mahjong C"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_C, N_p("input-name", "P2 Mahjong C"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_D, N_p("input-name", "%p Mahjong D"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_D, N_p("input-name", "P2 Mahjong D"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_E, N_p("input-name", "%p Mahjong E"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_E, N_p("input-name", "P2 Mahjong E"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_F, N_p("input-name", "%p Mahjong F"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_F, N_p("input-name", "P2 Mahjong F"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_G, N_p("input-name", "%p Mahjong G"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_G, N_p("input-name", "P2 Mahjong G"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_H, N_p("input-name", "%p Mahjong H"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_H, N_p("input-name", "P2 Mahjong H"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_I, N_p("input-name", "%p Mahjong I"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_I, N_p("input-name", "P2 Mahjong I"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_J, N_p("input-name", "%p Mahjong J"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_J, N_p("input-name", "P2 Mahjong J"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_K, N_p("input-name", "%p Mahjong K"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_K, N_p("input-name", "P2 Mahjong K"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_L, N_p("input-name", "%p Mahjong L"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_L, N_p("input-name", "P2 Mahjong L"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_M, N_p("input-name", "%p Mahjong M"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_M, N_p("input-name", "P2 Mahjong M"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_N, N_p("input-name", "%p Mahjong N"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_N, N_p("input-name", "P2 Mahjong N"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_O, N_p("input-name", "%p Mahjong O"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_O, N_p("input-name", "P2 Mahjong O"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_P, N_p("input-name", "%p Mahjong P"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_P, N_p("input-name", "P2 Mahjong P"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_Q, N_p("input-name", "%p Mahjong Q"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_Q, N_p("input-name", "P2 Mahjong Q"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_KAN, N_p("input-name", "%p Mahjong Kan"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_KAN, N_p("input-name", "P2 Mahjong Kan"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_PON, N_p("input-name", "%p Mahjong Pon"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_PON, N_p("input-name", "P2 Mahjong Pon"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_CHI, N_p("input-name", "%p Mahjong Chi"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_CHI, N_p("input-name", "P2 Mahjong Chi"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_REACH, N_p("input-name", "%p Mahjong Reach"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_REACH, N_p("input-name", "P2 Mahjong Reach"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_RON, N_p("input-name", "%p Mahjong Ron"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_RON, N_p("input-name", "P2 Mahjong Ron"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_FLIP_FLOP, N_p("input-name", "%p Mahjong Flip Flop"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_BET, N_p("input-name", "P2 Mahjong Bet"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_BET, N_p("input-name", "%p Mahjong Bet"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_LAST_CHANCE, N_p("input-name", "P2 Mahjong Last Chance"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_SCORE, N_p("input-name", "%p Mahjong Take Score"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_SCORE, N_p("input-name", "P2 Mahjong Take Score"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_DOUBLE_UP, N_p("input-name", "%p Mahjong Double Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_DOUBLE_UP, N_p("input-name", "P2 Mahjong Double Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_BIG, N_p("input-name", "%p Mahjong Big"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_FLIP_FLOP, N_p("input-name", "P2 Mahjong Flip Flop"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_SMALL, N_p("input-name", "%p Mahjong Small"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_BIG, N_p("input-name", "P2 Mahjong Big"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_LAST_CHANCE, N_p("input-name", "%p Mahjong Last Chance"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, MAHJONG_SMALL, N_p("input-name", "P2 Mahjong Small"), input_seq() ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P2_HANAFUDA \ #define CORE_INPUT_TYPES_P2_HANAFUDA \
CORE_INPUT_TYPES_BEGIN(p2_hanafuda) \ CORE_INPUT_TYPES_BEGIN(p2_hanafuda) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_A, N_p("input-name", "%p Hanafuda A/1"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_A, N_p("input-name", "P2 Hanafuda A/1"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_B, N_p("input-name", "%p Hanafuda B/2"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_B, N_p("input-name", "P2 Hanafuda B/2"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_C, N_p("input-name", "%p Hanafuda C/3"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_C, N_p("input-name", "P2 Hanafuda C/3"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_D, N_p("input-name", "%p Hanafuda D/4"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_D, N_p("input-name", "P2 Hanafuda D/4"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_E, N_p("input-name", "%p Hanafuda E/5"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_E, N_p("input-name", "P2 Hanafuda E/5"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_F, N_p("input-name", "%p Hanafuda F/6"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_F, N_p("input-name", "P2 Hanafuda F/6"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_G, N_p("input-name", "%p Hanafuda G/7"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_G, N_p("input-name", "P2 Hanafuda G/7"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_H, N_p("input-name", "%p Hanafuda H/8"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_H, N_p("input-name", "P2 Hanafuda H/8"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_YES, N_p("input-name", "%p Hanafuda Yes"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_YES, N_p("input-name", "P2 Hanafuda Yes"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_NO, N_p("input-name", "%p Hanafuda No"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 2, PLAYER2, HANAFUDA_NO, N_p("input-name", "P2 Hanafuda No"), input_seq() ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P3 \ #define CORE_INPUT_TYPES_P3 \
CORE_INPUT_TYPES_BEGIN(p3) \ CORE_INPUT_TYPES_BEGIN(p3) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(KEYCODE_I, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICK_UP, N_p("input-name", "P3 Up"), input_seq(KEYCODE_I, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICK_DOWN, N_p("input-name", "%p Down"), input_seq(KEYCODE_K, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICK_DOWN, N_p("input-name", "P3 Down"), input_seq(KEYCODE_K, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICK_LEFT, N_p("input-name", "%p Left"), input_seq(KEYCODE_J, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICK_LEFT, N_p("input-name", "P3 Left"), input_seq(KEYCODE_J, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICK_RIGHT, N_p("input-name", "%p Right"), input_seq(KEYCODE_L, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICK_RIGHT, N_p("input-name", "P3 Right"), input_seq(KEYCODE_L, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKRIGHT_UP, N_p("input-name", "%p Right Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKRIGHT_UP, N_p("input-name", "P3 Right Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKRIGHT_DOWN, N_p("input-name", "%p Right Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKRIGHT_DOWN, N_p("input-name", "P3 Right Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKRIGHT_LEFT, N_p("input-name", "%p Right Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKRIGHT_LEFT, N_p("input-name", "P3 Right Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKRIGHT_RIGHT, N_p("input-name", "%p Right Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKRIGHT_RIGHT, N_p("input-name", "P3 Right Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKLEFT_UP, N_p("input-name", "%p Left Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKLEFT_UP, N_p("input-name", "P3 Left Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKLEFT_DOWN, N_p("input-name", "%p Left Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKLEFT_DOWN, N_p("input-name", "P3 Left Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKLEFT_LEFT, N_p("input-name", "%p Left Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKLEFT_LEFT, N_p("input-name", "P3 Left Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKLEFT_RIGHT, N_p("input-name", "%p Left Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, JOYSTICKLEFT_RIGHT, N_p("input-name", "P3 Left Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON1, N_p("input-name", "%p Button 1"), input_seq(KEYCODE_RCONTROL, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(2), input_seq::or_code, GUNCODE_BUTTON1_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON1, N_p("input-name", "P3 Button 1"), input_seq(KEYCODE_RCONTROL, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(2), input_seq::or_code, GUNCODE_BUTTON1_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON2, N_p("input-name", "%p Button 2"), input_seq(KEYCODE_RSHIFT, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(2), input_seq::or_code, GUNCODE_BUTTON2_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON2, N_p("input-name", "P3 Button 2"), input_seq(KEYCODE_RSHIFT, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(2), input_seq::or_code, GUNCODE_BUTTON2_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON3, N_p("input-name", "%p Button 3"), input_seq(KEYCODE_ENTER, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON3, N_p("input-name", "P3 Button 3"), input_seq(KEYCODE_ENTER, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON4, N_p("input-name", "%p Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON4, N_p("input-name", "P3 Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON5, N_p("input-name", "%p Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON5, N_p("input-name", "P3 Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON6, N_p("input-name", "%p Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON6, N_p("input-name", "P3 Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON7, N_p("input-name", "%p Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON7, N_p("input-name", "P3 Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON8, N_p("input-name", "%p Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON8, N_p("input-name", "P3 Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON9, N_p("input-name", "%p Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON9, N_p("input-name", "P3 Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON10, N_p("input-name", "%p Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON10, N_p("input-name", "P3 Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON11, N_p("input-name", "%p Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON11, N_p("input-name", "P3 Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON12, N_p("input-name", "%p Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON12, N_p("input-name", "P3 Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON13, N_p("input-name", "%p Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON13, N_p("input-name", "P3 Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON14, N_p("input-name", "P3 Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON15, N_p("input-name", "P3 Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, BUTTON16, N_p("input-name", "P3 Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, START, N_p("input-name", "%p Start"), input_seq(KEYCODE_3, input_seq::or_code, JOYCODE_START_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, START, N_p("input-name", "P3 Start"), input_seq(KEYCODE_3, input_seq::or_code, JOYCODE_START_INDEXED(2)) ) \
INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, SELECT, N_p("input-name", "%p Select"), input_seq(KEYCODE_7, input_seq::or_code, JOYCODE_SELECT_INDEXED(2)) ) \ INPUT_PORT_DIGITAL_TYPE( 3, PLAYER3, SELECT, N_p("input-name", "P3 Select"), input_seq(KEYCODE_7, input_seq::or_code, JOYCODE_SELECT_INDEXED(2)) ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P4 \ #define CORE_INPUT_TYPES_P4 \
CORE_INPUT_TYPES_BEGIN(p4) \ CORE_INPUT_TYPES_BEGIN(p4) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(KEYCODE_8_PAD, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICK_UP, N_p("input-name", "P4 Up"), input_seq(KEYCODE_8_PAD, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICK_DOWN, N_p("input-name", "%p Down"), input_seq(KEYCODE_2_PAD, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICK_DOWN, N_p("input-name", "P4 Down"), input_seq(KEYCODE_2_PAD, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICK_LEFT, N_p("input-name", "%p Left"), input_seq(KEYCODE_4_PAD, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICK_LEFT, N_p("input-name", "P4 Left"), input_seq(KEYCODE_4_PAD, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICK_RIGHT, N_p("input-name", "%p Right"), input_seq(KEYCODE_6_PAD, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICK_RIGHT, N_p("input-name", "P4 Right"), input_seq(KEYCODE_6_PAD, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKRIGHT_UP, N_p("input-name", "%p Right Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKRIGHT_UP, N_p("input-name", "P4 Right Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKRIGHT_DOWN, N_p("input-name", "%p Right Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKRIGHT_DOWN, N_p("input-name", "P4 Right Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKRIGHT_LEFT, N_p("input-name", "%p Right Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKRIGHT_LEFT, N_p("input-name", "P4 Right Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKRIGHT_RIGHT, N_p("input-name", "%p Right Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKRIGHT_RIGHT, N_p("input-name", "P4 Right Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKLEFT_UP, N_p("input-name", "%p Left Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKLEFT_UP, N_p("input-name", "P4 Left Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKLEFT_DOWN, N_p("input-name", "%p Left Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKLEFT_DOWN, N_p("input-name", "P4 Left Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKLEFT_LEFT, N_p("input-name", "%p Left Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKLEFT_LEFT, N_p("input-name", "P4 Left Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKLEFT_RIGHT, N_p("input-name", "%p Left Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, JOYSTICKLEFT_RIGHT, N_p("input-name", "P4 Left Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON1, N_p("input-name", "%p Button 1"), input_seq(KEYCODE_0_PAD, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON1, N_p("input-name", "P4 Button 1"), input_seq(KEYCODE_0_PAD, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON2, N_p("input-name", "%p Button 2"), input_seq(KEYCODE_DEL_PAD, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON2, N_p("input-name", "P4 Button 2"), input_seq(KEYCODE_DEL_PAD, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON3, N_p("input-name", "%p Button 3"), input_seq(KEYCODE_ENTER_PAD, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON3, N_p("input-name", "P4 Button 3"), input_seq(KEYCODE_ENTER_PAD, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON4, N_p("input-name", "%p Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON4, N_p("input-name", "P4 Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON5, N_p("input-name", "%p Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON5, N_p("input-name", "P4 Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON6, N_p("input-name", "%p Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON6, N_p("input-name", "P4 Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON7, N_p("input-name", "%p Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON7, N_p("input-name", "P4 Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON8, N_p("input-name", "%p Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON8, N_p("input-name", "P4 Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON9, N_p("input-name", "%p Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON9, N_p("input-name", "P4 Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON10, N_p("input-name", "%p Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON10, N_p("input-name", "P4 Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON11, N_p("input-name", "%p Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON11, N_p("input-name", "P4 Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON12, N_p("input-name", "%p Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON12, N_p("input-name", "P4 Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON13, N_p("input-name", "%p Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON13, N_p("input-name", "P4 Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON14, N_p("input-name", "P4 Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON15, N_p("input-name", "P4 Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, BUTTON16, N_p("input-name", "P4 Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, START, N_p("input-name", "%p Start"), input_seq(KEYCODE_4, input_seq::or_code, JOYCODE_START_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, START, N_p("input-name", "P4 Start"), input_seq(KEYCODE_4, input_seq::or_code, JOYCODE_START_INDEXED(3)) ) \
INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, SELECT, N_p("input-name", "%p Select"), input_seq(KEYCODE_8, input_seq::or_code, JOYCODE_SELECT_INDEXED(3)) ) \ INPUT_PORT_DIGITAL_TYPE( 4, PLAYER4, SELECT, N_p("input-name", "P4 Select"), input_seq(KEYCODE_8, input_seq::or_code, JOYCODE_SELECT_INDEXED(3)) ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P5 \ #define CORE_INPUT_TYPES_P5 \
CORE_INPUT_TYPES_BEGIN(p5) \ CORE_INPUT_TYPES_BEGIN(p5) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICK_UP, N_p("input-name", "P5 Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICK_DOWN, N_p("input-name", "%p Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICK_DOWN, N_p("input-name", "P5 Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICK_LEFT, N_p("input-name", "%p Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICK_LEFT, N_p("input-name", "P5 Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICK_RIGHT, N_p("input-name", "%p Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICK_RIGHT, N_p("input-name", "P5 Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKRIGHT_UP, N_p("input-name", "%p Right Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKRIGHT_UP, N_p("input-name", "P5 Right Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKRIGHT_DOWN, N_p("input-name", "%p Right Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKRIGHT_DOWN, N_p("input-name", "P5 Right Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKRIGHT_LEFT, N_p("input-name", "%p Right Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKRIGHT_LEFT, N_p("input-name", "P5 Right Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKRIGHT_RIGHT, N_p("input-name", "%p Right Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKRIGHT_RIGHT, N_p("input-name", "P5 Right Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKLEFT_UP, N_p("input-name", "%p Left Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKLEFT_UP, N_p("input-name", "P5 Left Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKLEFT_DOWN, N_p("input-name", "%p Left Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKLEFT_DOWN, N_p("input-name", "P5 Left Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKLEFT_LEFT, N_p("input-name", "%p Left Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKLEFT_LEFT, N_p("input-name", "P5 Left Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKLEFT_RIGHT, N_p("input-name", "%p Left Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, JOYSTICKLEFT_RIGHT, N_p("input-name", "P5 Left Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON1, N_p("input-name", "%p Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON1, N_p("input-name", "P5 Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON2, N_p("input-name", "%p Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON2, N_p("input-name", "P5 Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON3, N_p("input-name", "%p Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON3, N_p("input-name", "P5 Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON4, N_p("input-name", "%p Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON4, N_p("input-name", "P5 Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON5, N_p("input-name", "%p Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON5, N_p("input-name", "P5 Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON6, N_p("input-name", "%p Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON6, N_p("input-name", "P5 Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON7, N_p("input-name", "%p Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON7, N_p("input-name", "P5 Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON8, N_p("input-name", "%p Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON8, N_p("input-name", "P5 Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON9, N_p("input-name", "%p Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON9, N_p("input-name", "P5 Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON10, N_p("input-name", "%p Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON10, N_p("input-name", "P5 Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON11, N_p("input-name", "%p Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON11, N_p("input-name", "P5 Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON12, N_p("input-name", "%p Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON12, N_p("input-name", "P5 Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON13, N_p("input-name", "%p Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON13, N_p("input-name", "P5 Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON14, N_p("input-name", "P5 Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON15, N_p("input-name", "P5 Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(4)) ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, BUTTON16, N_p("input-name", "P5 Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(4)) ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, START, N_p("input-name", "%p Start"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, START, N_p("input-name", "P5 Start"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 5, PLAYER5, SELECT, N_p("input-name", "P5 Select"), input_seq() ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P6 \ #define CORE_INPUT_TYPES_P6 \
CORE_INPUT_TYPES_BEGIN(p6) \ CORE_INPUT_TYPES_BEGIN(p6) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICK_UP, N_p("input-name", "P6 Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICK_DOWN, N_p("input-name", "%p Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICK_DOWN, N_p("input-name", "P6 Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICK_LEFT, N_p("input-name", "%p Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICK_LEFT, N_p("input-name", "P6 Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICK_RIGHT, N_p("input-name", "%p Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICK_RIGHT, N_p("input-name", "P6 Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKRIGHT_UP, N_p("input-name", "%p Right Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKRIGHT_UP, N_p("input-name", "P6 Right Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKRIGHT_DOWN, N_p("input-name", "%p Right Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKRIGHT_DOWN, N_p("input-name", "P6 Right Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKRIGHT_LEFT, N_p("input-name", "%p Right Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKRIGHT_LEFT, N_p("input-name", "P6 Right Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKRIGHT_RIGHT, N_p("input-name", "%p Right Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKRIGHT_RIGHT, N_p("input-name", "P6 Right Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKLEFT_UP, N_p("input-name", "%p Left Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKLEFT_UP, N_p("input-name", "P6 Left Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKLEFT_DOWN, N_p("input-name", "%p Left Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKLEFT_DOWN, N_p("input-name", "P6 Left Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKLEFT_LEFT, N_p("input-name", "%p Left Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKLEFT_LEFT, N_p("input-name", "P6 Left Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKLEFT_RIGHT, N_p("input-name", "%p Left Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, JOYSTICKLEFT_RIGHT, N_p("input-name", "P6 Left Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON1, N_p("input-name", "%p Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON1, N_p("input-name", "P6 Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON2, N_p("input-name", "%p Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON2, N_p("input-name", "P6 Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON3, N_p("input-name", "%p Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON3, N_p("input-name", "P6 Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON4, N_p("input-name", "%p Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON4, N_p("input-name", "P6 Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON5, N_p("input-name", "%p Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON5, N_p("input-name", "P6 Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON6, N_p("input-name", "%p Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON6, N_p("input-name", "P6 Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON7, N_p("input-name", "%p Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON7, N_p("input-name", "P6 Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON8, N_p("input-name", "%p Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON8, N_p("input-name", "P6 Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON9, N_p("input-name", "%p Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON9, N_p("input-name", "P6 Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON10, N_p("input-name", "%p Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON10, N_p("input-name", "P6 Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON11, N_p("input-name", "%p Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON11, N_p("input-name", "P6 Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON12, N_p("input-name", "%p Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON12, N_p("input-name", "P6 Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON13, N_p("input-name", "%p Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON13, N_p("input-name", "P6 Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON14, N_p("input-name", "P6 Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON15, N_p("input-name", "P6 Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(5)) ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, BUTTON16, N_p("input-name", "P6 Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(5)) ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, START, N_p("input-name", "%p Start"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, START, N_p("input-name", "P6 Start"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 6, PLAYER6, SELECT, N_p("input-name", "P6 Select"), input_seq() ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P7 \ #define CORE_INPUT_TYPES_P7 \
CORE_INPUT_TYPES_BEGIN(p7) \ CORE_INPUT_TYPES_BEGIN(p7) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICK_UP, N_p("input-name", "P7 Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICK_DOWN, N_p("input-name", "%p Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICK_DOWN, N_p("input-name", "P7 Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICK_LEFT, N_p("input-name", "%p Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICK_LEFT, N_p("input-name", "P7 Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICK_RIGHT, N_p("input-name", "%p Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICK_RIGHT, N_p("input-name", "P7 Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKRIGHT_UP, N_p("input-name", "%p Right Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKRIGHT_UP, N_p("input-name", "P7 Right Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKRIGHT_DOWN, N_p("input-name", "%p Right Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKRIGHT_DOWN, N_p("input-name", "P7 Right Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKRIGHT_LEFT, N_p("input-name", "%p Right Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKRIGHT_LEFT, N_p("input-name", "P7 Right Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKRIGHT_RIGHT, N_p("input-name", "%p Right Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKRIGHT_RIGHT, N_p("input-name", "P7 Right Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKLEFT_UP, N_p("input-name", "%p Left Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKLEFT_UP, N_p("input-name", "P7 Left Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKLEFT_DOWN, N_p("input-name", "%p Left Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKLEFT_DOWN, N_p("input-name", "P7 Left Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKLEFT_LEFT, N_p("input-name", "%p Left Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKLEFT_LEFT, N_p("input-name", "P7 Left Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKLEFT_RIGHT, N_p("input-name", "%p Left Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, JOYSTICKLEFT_RIGHT, N_p("input-name", "P7 Left Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON1, N_p("input-name", "%p Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON1, N_p("input-name", "P7 Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON2, N_p("input-name", "%p Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON2, N_p("input-name", "P7 Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON3, N_p("input-name", "%p Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON3, N_p("input-name", "P7 Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON4, N_p("input-name", "%p Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON4, N_p("input-name", "P7 Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON5, N_p("input-name", "%p Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON5, N_p("input-name", "P7 Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON6, N_p("input-name", "%p Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON6, N_p("input-name", "P7 Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON7, N_p("input-name", "%p Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON7, N_p("input-name", "P7 Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON8, N_p("input-name", "%p Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON8, N_p("input-name", "P7 Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON9, N_p("input-name", "%p Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON9, N_p("input-name", "P7 Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON10, N_p("input-name", "%p Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON10, N_p("input-name", "P7 Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON11, N_p("input-name", "%p Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON11, N_p("input-name", "P7 Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON12, N_p("input-name", "%p Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON12, N_p("input-name", "P7 Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON13, N_p("input-name", "%p Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON13, N_p("input-name", "P7 Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON14, N_p("input-name", "P7 Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON15, N_p("input-name", "P7 Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(6)) ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, BUTTON16, N_p("input-name", "P7 Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(6)) ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, START, N_p("input-name", "%p Start"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, START, N_p("input-name", "P7 Start"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 7, PLAYER7, SELECT, N_p("input-name", "P7 Select"), input_seq() ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P8 \ #define CORE_INPUT_TYPES_P8 \
CORE_INPUT_TYPES_BEGIN(p8) \ CORE_INPUT_TYPES_BEGIN(p8) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICK_UP, N_p("input-name", "P8 Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICK_DOWN, N_p("input-name", "%p Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICK_DOWN, N_p("input-name", "P8 Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICK_LEFT, N_p("input-name", "%p Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICK_LEFT, N_p("input-name", "P8 Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICK_RIGHT, N_p("input-name", "%p Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICK_RIGHT, N_p("input-name", "P8 Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKRIGHT_UP, N_p("input-name", "%p Right Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKRIGHT_UP, N_p("input-name", "P8 Right Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKRIGHT_DOWN, N_p("input-name", "%p Right Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKRIGHT_DOWN, N_p("input-name", "P8 Right Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKRIGHT_LEFT, N_p("input-name", "%p Right Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKRIGHT_LEFT, N_p("input-name", "P8 Right Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKRIGHT_RIGHT, N_p("input-name", "%p Right Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKRIGHT_RIGHT, N_p("input-name", "P8 Right Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKLEFT_UP, N_p("input-name", "%p Left Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKLEFT_UP, N_p("input-name", "P8 Left Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKLEFT_DOWN, N_p("input-name", "%p Left Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKLEFT_DOWN, N_p("input-name", "P8 Left Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKLEFT_LEFT, N_p("input-name", "%p Left Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKLEFT_LEFT, N_p("input-name", "P8 Left Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKLEFT_RIGHT, N_p("input-name", "%p Left Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, JOYSTICKLEFT_RIGHT, N_p("input-name", "P8 Left Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON1, N_p("input-name", "%p Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON1, N_p("input-name", "P8 Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON2, N_p("input-name", "%p Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON2, N_p("input-name", "P8 Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON3, N_p("input-name", "%p Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON3, N_p("input-name", "P8 Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON4, N_p("input-name", "%p Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON4, N_p("input-name", "P8 Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON5, N_p("input-name", "%p Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON5, N_p("input-name", "P8 Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON6, N_p("input-name", "%p Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON6, N_p("input-name", "P8 Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON7, N_p("input-name", "%p Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON7, N_p("input-name", "P8 Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON8, N_p("input-name", "%p Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON8, N_p("input-name", "P8 Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON9, N_p("input-name", "%p Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON9, N_p("input-name", "P8 Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON10, N_p("input-name", "%p Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON10, N_p("input-name", "P8 Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON11, N_p("input-name", "%p Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON11, N_p("input-name", "P8 Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON12, N_p("input-name", "%p Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON12, N_p("input-name", "P8 Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON13, N_p("input-name", "%p Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON13, N_p("input-name", "P8 Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON14, N_p("input-name", "P8 Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON15, N_p("input-name", "P8 Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(7)) ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, BUTTON16, N_p("input-name", "P8 Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(7)) ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, START, N_p("input-name", "%p Start"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, START, N_p("input-name", "P8 Start"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 8, PLAYER8, SELECT, N_p("input-name", "P8 Select"), input_seq() ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P9 \ #define CORE_INPUT_TYPES_P9 \
CORE_INPUT_TYPES_BEGIN(p9) \ CORE_INPUT_TYPES_BEGIN(p9) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICK_UP, N_p("input-name", "P9 Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICK_DOWN, N_p("input-name", "%p Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICK_DOWN, N_p("input-name", "P9 Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICK_LEFT, N_p("input-name", "%p Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICK_LEFT, N_p("input-name", "P9 Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICK_RIGHT, N_p("input-name", "%p Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICK_RIGHT, N_p("input-name", "P9 Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKRIGHT_UP, N_p("input-name", "%p Right Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKRIGHT_UP, N_p("input-name", "P9 Right Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKRIGHT_DOWN, N_p("input-name", "%p Right Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKRIGHT_DOWN, N_p("input-name", "P9 Right Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKRIGHT_LEFT, N_p("input-name", "%p Right Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKRIGHT_LEFT, N_p("input-name", "P9 Right Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKRIGHT_RIGHT, N_p("input-name", "%p Right Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKRIGHT_RIGHT, N_p("input-name", "P9 Right Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKLEFT_UP, N_p("input-name", "%p Left Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKLEFT_UP, N_p("input-name", "P9 Left Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKLEFT_DOWN, N_p("input-name", "%p Left Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKLEFT_DOWN, N_p("input-name", "P9 Left Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKLEFT_LEFT, N_p("input-name", "%p Left Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKLEFT_LEFT, N_p("input-name", "P9 Left Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKLEFT_RIGHT, N_p("input-name", "%p Left Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, JOYSTICKLEFT_RIGHT, N_p("input-name", "P9 Left Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON1, N_p("input-name", "%p Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON1, N_p("input-name", "P9 Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON2, N_p("input-name", "%p Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON2, N_p("input-name", "P9 Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON3, N_p("input-name", "%p Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON3, N_p("input-name", "P9 Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON4, N_p("input-name", "%p Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON4, N_p("input-name", "P9 Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON5, N_p("input-name", "%p Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON5, N_p("input-name", "P9 Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON6, N_p("input-name", "%p Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON6, N_p("input-name", "P9 Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON7, N_p("input-name", "%p Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON7, N_p("input-name", "P9 Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON8, N_p("input-name", "%p Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON8, N_p("input-name", "P9 Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON9, N_p("input-name", "%p Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON9, N_p("input-name", "P9 Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON10, N_p("input-name", "%p Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON10, N_p("input-name", "P9 Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON11, N_p("input-name", "%p Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON11, N_p("input-name", "P9 Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON12, N_p("input-name", "%p Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON12, N_p("input-name", "P9 Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON13, N_p("input-name", "%p Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON13, N_p("input-name", "P9 Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON14, N_p("input-name", "P9 Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON15, N_p("input-name", "P9 Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(8)) ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, BUTTON16, N_p("input-name", "P9 Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(8)) ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, START, N_p("input-name", "%p Start"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, START, N_p("input-name", "P9 Start"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 9, PLAYER9, SELECT, N_p("input-name", "P9 Select"), input_seq() ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_P10 \ #define CORE_INPUT_TYPES_P10 \
CORE_INPUT_TYPES_BEGIN(p10) \ CORE_INPUT_TYPES_BEGIN(p10) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICK_UP, N_p("input-name", "%p Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICK_UP, N_p("input-name", "P10 Up"), input_seq(JOYCODE_Y_UP_SWITCH_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICK_DOWN, N_p("input-name", "%p Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICK_DOWN, N_p("input-name", "P10 Down"), input_seq(JOYCODE_Y_DOWN_SWITCH_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICK_LEFT, N_p("input-name", "%p Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICK_LEFT, N_p("input-name", "P10 Left"), input_seq(JOYCODE_X_LEFT_SWITCH_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICK_RIGHT, N_p("input-name", "%p Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICK_RIGHT, N_p("input-name", "P10 Right"), input_seq(JOYCODE_X_RIGHT_SWITCH_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKRIGHT_UP, N_p("input-name", "%p Right Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKRIGHT_UP, N_p("input-name", "P10 Right Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKRIGHT_DOWN, N_p("input-name", "%p Right Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKRIGHT_DOWN, N_p("input-name", "P10 Right Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKRIGHT_LEFT, N_p("input-name", "%p Right Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKRIGHT_LEFT, N_p("input-name", "P10 Right Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKRIGHT_RIGHT, N_p("input-name", "%p Right Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKRIGHT_RIGHT, N_p("input-name", "P10 Right Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKLEFT_UP, N_p("input-name", "%p Left Stick/Up"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKLEFT_UP, N_p("input-name", "P10 Left Stick/Up"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKLEFT_DOWN, N_p("input-name", "%p Left Stick/Down"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKLEFT_DOWN, N_p("input-name", "P10 Left Stick/Down"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKLEFT_LEFT, N_p("input-name", "%p Left Stick/Left"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKLEFT_LEFT, N_p("input-name", "P10 Left Stick/Left"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKLEFT_RIGHT, N_p("input-name", "%p Left Stick/Right"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, JOYSTICKLEFT_RIGHT, N_p("input-name", "P10 Left Stick/Right"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON1, N_p("input-name", "%p Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON1, N_p("input-name", "P10 Button 1"), input_seq(JOYCODE_BUTTON1_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON2, N_p("input-name", "%p Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON2, N_p("input-name", "P10 Button 2"), input_seq(JOYCODE_BUTTON2_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON3, N_p("input-name", "%p Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON3, N_p("input-name", "P10 Button 3"), input_seq(JOYCODE_BUTTON3_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON4, N_p("input-name", "%p Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON4, N_p("input-name", "P10 Button 4"), input_seq(JOYCODE_BUTTON4_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON5, N_p("input-name", "%p Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON5, N_p("input-name", "P10 Button 5"), input_seq(JOYCODE_BUTTON5_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON6, N_p("input-name", "%p Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON6, N_p("input-name", "P10 Button 6"), input_seq(JOYCODE_BUTTON6_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON7, N_p("input-name", "%p Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON7, N_p("input-name", "P10 Button 7"), input_seq(JOYCODE_BUTTON7_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON8, N_p("input-name", "%p Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON8, N_p("input-name", "P10 Button 8"), input_seq(JOYCODE_BUTTON8_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON9, N_p("input-name", "%p Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON9, N_p("input-name", "P10 Button 9"), input_seq(JOYCODE_BUTTON9_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON10, N_p("input-name", "%p Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON10, N_p("input-name", "P10 Button 10"), input_seq(JOYCODE_BUTTON10_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON11, N_p("input-name", "%p Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON11, N_p("input-name", "P10 Button 11"), input_seq(JOYCODE_BUTTON11_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON12, N_p("input-name", "%p Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON12, N_p("input-name", "P10 Button 12"), input_seq(JOYCODE_BUTTON12_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON13, N_p("input-name", "%p Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON13, N_p("input-name", "P10 Button 13"), input_seq(JOYCODE_BUTTON13_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON14, N_p("input-name", "%p Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON14, N_p("input-name", "P10 Button 14"), input_seq(JOYCODE_BUTTON14_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON15, N_p("input-name", "%p Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON15, N_p("input-name", "P10 Button 15"), input_seq(JOYCODE_BUTTON15_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON16, N_p("input-name", "%p Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(9)) ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, BUTTON16, N_p("input-name", "P10 Button 16"), input_seq(JOYCODE_BUTTON16_INDEXED(9)) ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, START, N_p("input-name", "%p Start"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, START, N_p("input-name", "P10 Start"), input_seq() ) \
INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, SELECT, N_p("input-name", "%p Select"), input_seq() ) \ INPUT_PORT_DIGITAL_TYPE( 10, PLAYER10, SELECT, N_p("input-name", "P10 Select"), input_seq() ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_START \ #define CORE_INPUT_TYPES_START \
@ -547,44 +547,44 @@ namespace {
#define CORE_INPUT_TYPES_PEDAL \ #define CORE_INPUT_TYPES_PEDAL \
CORE_INPUT_TYPES_BEGIN(pedal) \ CORE_INPUT_TYPES_BEGIN(pedal) \
INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, PEDAL, N_p("input-name", "%p Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(0)), input_seq(), input_seq(KEYCODE_LCONTROL, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(0)) ) \ INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, PEDAL, N_p("input-name", "P1 Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(0)), input_seq(), input_seq(KEYCODE_LCONTROL, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(0)) ) \
INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, PEDAL, N_p("input-name", "%p Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(1)), input_seq(), input_seq(KEYCODE_A, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(1)) ) \ INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, PEDAL, N_p("input-name", "P2 Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(1)), input_seq(), input_seq(KEYCODE_A, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(1)) ) \
INPUT_PORT_ANALOG_TYPE( 3, PLAYER3, PEDAL, N_p("input-name", "%p Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(2)), input_seq(), input_seq(KEYCODE_RCONTROL, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(2)) ) \ INPUT_PORT_ANALOG_TYPE( 3, PLAYER3, PEDAL, N_p("input-name", "P3 Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(2)), input_seq(), input_seq(KEYCODE_RCONTROL, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(2)) ) \
INPUT_PORT_ANALOG_TYPE( 4, PLAYER4, PEDAL, N_p("input-name", "%p Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(3)), input_seq(), input_seq(KEYCODE_0_PAD, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(3)) ) \ INPUT_PORT_ANALOG_TYPE( 4, PLAYER4, PEDAL, N_p("input-name", "P4 Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(3)), input_seq(), input_seq(KEYCODE_0_PAD, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(3)) ) \
INPUT_PORT_ANALOG_TYPE( 5, PLAYER5, PEDAL, N_p("input-name", "%p Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(4)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(4)) ) \ INPUT_PORT_ANALOG_TYPE( 5, PLAYER5, PEDAL, N_p("input-name", "P5 Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(4)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(4)) ) \
INPUT_PORT_ANALOG_TYPE( 6, PLAYER6, PEDAL, N_p("input-name", "%p Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(5)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(5)) ) \ INPUT_PORT_ANALOG_TYPE( 6, PLAYER6, PEDAL, N_p("input-name", "P6 Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(5)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(5)) ) \
INPUT_PORT_ANALOG_TYPE( 7, PLAYER7, PEDAL, N_p("input-name", "%p Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(6)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(6)) ) \ INPUT_PORT_ANALOG_TYPE( 7, PLAYER7, PEDAL, N_p("input-name", "P7 Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(6)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(6)) ) \
INPUT_PORT_ANALOG_TYPE( 8, PLAYER8, PEDAL, N_p("input-name", "%p Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(7)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(7)) ) \ INPUT_PORT_ANALOG_TYPE( 8, PLAYER8, PEDAL, N_p("input-name", "P8 Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(7)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(7)) ) \
INPUT_PORT_ANALOG_TYPE( 9, PLAYER9, PEDAL, N_p("input-name", "%p Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(8)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(8)) ) \ INPUT_PORT_ANALOG_TYPE( 9, PLAYER9, PEDAL, N_p("input-name", "P9 Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(8)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(8)) ) \
INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, PEDAL, N_p("input-name", "%p Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(9)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(9)) ) \ INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, PEDAL, N_p("input-name", "P10 Pedal 1"), input_seq(JOYCODE_Z_NEG_ABSOLUTE_INDEXED(9)), input_seq(), input_seq(JOYCODE_BUTTON1_INDEXED(9)) ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_PEDAL2 \ #define CORE_INPUT_TYPES_PEDAL2 \
CORE_INPUT_TYPES_BEGIN(pedal2) \ CORE_INPUT_TYPES_BEGIN(pedal2) \
INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, PEDAL2, N_p("input-name", "%p Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(0)), input_seq(), input_seq(KEYCODE_LALT, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(0)) ) \ INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, PEDAL2, N_p("input-name", "P1 Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(0)), input_seq(), input_seq(KEYCODE_LALT, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(0)) ) \
INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, PEDAL2, N_p("input-name", "%p Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(1)), input_seq(), input_seq(KEYCODE_S, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(1)) ) \ INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, PEDAL2, N_p("input-name", "P2 Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(1)), input_seq(), input_seq(KEYCODE_S, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(1)) ) \
INPUT_PORT_ANALOG_TYPE( 3, PLAYER3, PEDAL2, N_p("input-name", "%p Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(2)), input_seq(), input_seq(KEYCODE_RSHIFT, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(2)) ) \ INPUT_PORT_ANALOG_TYPE( 3, PLAYER3, PEDAL2, N_p("input-name", "P3 Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(2)), input_seq(), input_seq(KEYCODE_RSHIFT, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(2)) ) \
INPUT_PORT_ANALOG_TYPE( 4, PLAYER4, PEDAL2, N_p("input-name", "%p Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(3)), input_seq(), input_seq(KEYCODE_DEL_PAD, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(3)) ) \ INPUT_PORT_ANALOG_TYPE( 4, PLAYER4, PEDAL2, N_p("input-name", "P4 Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(3)), input_seq(), input_seq(KEYCODE_DEL_PAD, input_seq::or_code, JOYCODE_BUTTON2_INDEXED(3)) ) \
INPUT_PORT_ANALOG_TYPE( 5, PLAYER5, PEDAL2, N_p("input-name", "%p Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(4)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(4)) ) \ INPUT_PORT_ANALOG_TYPE( 5, PLAYER5, PEDAL2, N_p("input-name", "P5 Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(4)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(4)) ) \
INPUT_PORT_ANALOG_TYPE( 6, PLAYER6, PEDAL2, N_p("input-name", "%p Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(5)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(5)) ) \ INPUT_PORT_ANALOG_TYPE( 6, PLAYER6, PEDAL2, N_p("input-name", "P6 Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(5)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(5)) ) \
INPUT_PORT_ANALOG_TYPE( 7, PLAYER7, PEDAL2, N_p("input-name", "%p Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(6)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(6)) ) \ INPUT_PORT_ANALOG_TYPE( 7, PLAYER7, PEDAL2, N_p("input-name", "P7 Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(6)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(6)) ) \
INPUT_PORT_ANALOG_TYPE( 8, PLAYER8, PEDAL2, N_p("input-name", "%p Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(7)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(7)) ) \ INPUT_PORT_ANALOG_TYPE( 8, PLAYER8, PEDAL2, N_p("input-name", "P8 Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(7)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(7)) ) \
INPUT_PORT_ANALOG_TYPE( 9, PLAYER9, PEDAL2, N_p("input-name", "%p Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(8)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(8)) ) \ INPUT_PORT_ANALOG_TYPE( 9, PLAYER9, PEDAL2, N_p("input-name", "P9 Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(8)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(8)) ) \
INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, PEDAL2, N_p("input-name", "%p Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(9)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(9)) ) \ INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, PEDAL2, N_p("input-name", "P10 Pedal 2"), input_seq(JOYCODE_W_NEG_ABSOLUTE_INDEXED(9)), input_seq(), input_seq(JOYCODE_BUTTON2_INDEXED(9)) ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_PEDAL3 \ #define CORE_INPUT_TYPES_PEDAL3 \
CORE_INPUT_TYPES_BEGIN(pedal3) \ CORE_INPUT_TYPES_BEGIN(pedal3) \
INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, PEDAL3, N_p("input-name", "%p Pedal 3"), input_seq(), input_seq(), input_seq(KEYCODE_SPACE, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(0)) ) \ INPUT_PORT_ANALOG_TYPE( 1, PLAYER1, PEDAL3, N_p("input-name", "P1 Pedal 3"), input_seq(), input_seq(), input_seq(KEYCODE_SPACE, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(0)) ) \
INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, PEDAL3, N_p("input-name", "%p Pedal 3"), input_seq(), input_seq(), input_seq(KEYCODE_Q, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(1)) ) \ INPUT_PORT_ANALOG_TYPE( 2, PLAYER2, PEDAL3, N_p("input-name", "P2 Pedal 3"), input_seq(), input_seq(), input_seq(KEYCODE_Q, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(1)) ) \
INPUT_PORT_ANALOG_TYPE( 3, PLAYER3, PEDAL3, N_p("input-name", "%p Pedal 3"), input_seq(), input_seq(), input_seq(KEYCODE_ENTER, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(2)) ) \ INPUT_PORT_ANALOG_TYPE( 3, PLAYER3, PEDAL3, N_p("input-name", "P3 Pedal 3"), input_seq(), input_seq(), input_seq(KEYCODE_ENTER, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(2)) ) \
INPUT_PORT_ANALOG_TYPE( 4, PLAYER4, PEDAL3, N_p("input-name", "%p Pedal 3"), input_seq(), input_seq(), input_seq(KEYCODE_ENTER_PAD, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(3)) ) \ INPUT_PORT_ANALOG_TYPE( 4, PLAYER4, PEDAL3, N_p("input-name", "P4 Pedal 3"), input_seq(), input_seq(), input_seq(KEYCODE_ENTER_PAD, input_seq::or_code, JOYCODE_BUTTON3_INDEXED(3)) ) \
INPUT_PORT_ANALOG_TYPE( 5, PLAYER5, PEDAL3, N_p("input-name", "%p Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(4)) ) \ INPUT_PORT_ANALOG_TYPE( 5, PLAYER5, PEDAL3, N_p("input-name", "P5 Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(4)) ) \
INPUT_PORT_ANALOG_TYPE( 6, PLAYER6, PEDAL3, N_p("input-name", "%p Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(5)) ) \ INPUT_PORT_ANALOG_TYPE( 6, PLAYER6, PEDAL3, N_p("input-name", "P6 Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(5)) ) \
INPUT_PORT_ANALOG_TYPE( 7, PLAYER7, PEDAL3, N_p("input-name", "%p Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(6)) ) \ INPUT_PORT_ANALOG_TYPE( 7, PLAYER7, PEDAL3, N_p("input-name", "P7 Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(6)) ) \
INPUT_PORT_ANALOG_TYPE( 8, PLAYER8, PEDAL3, N_p("input-name", "%p Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(7)) ) \ INPUT_PORT_ANALOG_TYPE( 8, PLAYER8, PEDAL3, N_p("input-name", "P8 Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(7)) ) \
INPUT_PORT_ANALOG_TYPE( 9, PLAYER9, PEDAL3, N_p("input-name", "%p Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(8)) ) \ INPUT_PORT_ANALOG_TYPE( 9, PLAYER9, PEDAL3, N_p("input-name", "P9 Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(8)) ) \
INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, PEDAL3, N_p("input-name", "%p Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(9)) ) \ INPUT_PORT_ANALOG_TYPE( 10, PLAYER10, PEDAL3, N_p("input-name", "P10 Pedal 3"), input_seq(), input_seq(), input_seq(JOYCODE_BUTTON3_INDEXED(9)) ) \
CORE_INPUT_TYPES_END() CORE_INPUT_TYPES_END()
#define CORE_INPUT_TYPES_PADDLE \ #define CORE_INPUT_TYPES_PADDLE \

View File

@ -101,7 +101,6 @@
#include "util/corestr.h" #include "util/corestr.h"
#include "util/ioprocsfilter.h" #include "util/ioprocsfilter.h"
#include "util/language.h"
#include "util/unicode.h" #include "util/unicode.h"
#include "osdepend.h" #include "osdepend.h"
@ -308,37 +307,6 @@ inline bool input_seq_good(running_machine &machine, input_seq const &seq)
return input_seq::end_code != machine.input().seq_clean(seq)[0]; return input_seq::end_code != machine.input().seq_clean(seq)[0];
} }
std::string substitute_player(std::string_view name, u8 player)
{
using util::lang_translate;
std::string result;
while (!name.empty())
{
auto const found = name.find('%');
if ((std::string_view::npos == found) || (name.length() == found + 1))
{
result.append(name);
break;
}
switch (name[found + 1])
{
case '%':
result.append(name.substr(0, found + 1));
break;
case 'p':
result.append(name.substr(0, found));
result.append(util::string_format(_("input-name", "P%1$u"), player + 1));
break;
default:
result.append(name.substr(0, found + 2));
}
name.remove_prefix(found + 2);
}
return result;
}
} // anonymous namespace } // anonymous namespace
@ -422,24 +390,6 @@ input_type_entry::input_type_entry(ioport_type type, ioport_group group, int pla
} }
//-------------------------------------------------
// name - gets the display name for the input
// type
//-------------------------------------------------
std::string input_type_entry::name() const
{
using util::lang_translate;
if (!m_name)
return std::string();
else if ((group() < IPG_PLAYER1) || (group() > IPG_PLAYER10))
return _("input-name", m_name);
else
return substitute_player(_("input-name", m_name), player());
}
//------------------------------------------------- //-------------------------------------------------
// replace_code - replace all instances of // replace_code - replace all instances of
// oldcodewith newcode in all sequences // oldcodewith newcode in all sequences
@ -735,25 +685,16 @@ ioport_field::~ioport_field()
// field (this must never return nullptr) // field (this must never return nullptr)
//------------------------------------------------- //-------------------------------------------------
std::string ioport_field::name() const const char *ioport_field::name() const
{ {
using util::lang_translate; // if we have a non-default name, use that
if (m_live != nullptr && !m_live->name.empty())
// if we have an overridden name, use that return m_live->name.c_str();
if (m_live && !m_live->name.empty()) if (m_name != nullptr)
return m_live->name;
// if no specific name, use the generic name for the type
if (!m_name)
return manager().type_name(m_type, m_player);
// return name for non-controller fields as-is
ioport_group const group = manager().type_group(m_type, m_player);
if ((group < IPG_PLAYER1) || (group > IPG_PLAYER10))
return m_name; return m_name;
// substitute the player number in if necessary // otherwise, return the name associated with the type
return substitute_player(m_name, m_player); return manager().type_name(m_type, m_player);
} }
@ -809,8 +750,8 @@ void ioport_field::set_defseq(input_seq_type seqtype, const input_seq &newseq)
ioport_type_class ioport_field::type_class() const noexcept ioport_type_class ioport_field::type_class() const noexcept
{ {
// inputs associated with specific players // inputs associated with specific players
ioport_group const group = manager().type_group(m_type, m_player); ioport_group group = manager().type_group(m_type, m_player);
if ((group >= IPG_PLAYER1) && (group <= IPG_PLAYER10)) if (group >= IPG_PLAYER1 && group <= IPG_PLAYER10)
return INPUT_CLASS_CONTROLLER; return INPUT_CLASS_CONTROLLER;
// keys (names derived from character codes) // keys (names derived from character codes)
@ -1761,14 +1702,12 @@ time_t ioport_manager::initialize()
if (&port.second->device() == &device) if (&port.second->device() == &device)
{ {
for (ioport_field &field : port.second->fields()) for (ioport_field &field : port.second->fields())
{
if (field.type_class() == INPUT_CLASS_CONTROLLER) if (field.type_class() == INPUT_CLASS_CONTROLLER)
{ {
if (players < field.player() + 1) if (players < field.player() + 1)
players = field.player() + 1; players = field.player() + 1;
field.set_player(field.player() + player_offset); field.set_player(field.player() + player_offset);
} }
}
} }
} }
player_offset += players; player_offset += players;
@ -1907,21 +1846,15 @@ ioport_manager::~ioport_manager()
// type/player // type/player
//------------------------------------------------- //-------------------------------------------------
std::string ioport_manager::type_name(ioport_type type, u8 player) const const char *ioport_manager::type_name(ioport_type type, u8 player) const noexcept
{ {
using util::lang_translate;
// if we have a machine, use the live state and quick lookup // if we have a machine, use the live state and quick lookup
input_type_entry const *const entry = m_type_to_entry[type][player]; input_type_entry *entry = m_type_to_entry[type][player];
if (entry) if (entry != nullptr && entry->name() != nullptr)
{ return entry->name();
std::string name = entry->name();
if (!name.empty())
return name;
}
// if we find nothing, return a default string (not a null pointer) // if we find nothing, return a default string (not a null pointer)
return _("input-name", "???"); return "???";
} }
@ -2380,10 +2313,7 @@ bool ioport_manager::load_controller_config(
for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype) for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype)
{ {
if (input_seq_good(machine(), newseq[seqtype].first)) if (input_seq_good(machine(), newseq[seqtype].first))
{
field.live().seq[seqtype] = newseq[seqtype].first;
field.set_defseq(seqtype, newseq[seqtype].first); field.set_defseq(seqtype, newseq[seqtype].first);
}
} }
// fetch configurable attributes // fetch configurable attributes

View File

@ -798,7 +798,7 @@ public:
ioport_group group() const noexcept { return m_group; } ioport_group group() const noexcept { return m_group; }
u8 player() const noexcept { return m_player; } u8 player() const noexcept { return m_player; }
const char *token() const noexcept { return m_token; } const char *token() const noexcept { return m_token; }
std::string name() const; const char *name() const noexcept { return m_name; }
input_seq &defseq(input_seq_type seqtype = SEQ_TYPE_STANDARD) noexcept { return m_defseq[seqtype]; } input_seq &defseq(input_seq_type seqtype = SEQ_TYPE_STANDARD) noexcept { return m_defseq[seqtype]; }
const input_seq &defseq(input_seq_type seqtype = SEQ_TYPE_STANDARD) const noexcept { return m_defseq[seqtype]; } const input_seq &defseq(input_seq_type seqtype = SEQ_TYPE_STANDARD) const noexcept { return m_defseq[seqtype]; }
const input_seq &seq(input_seq_type seqtype = SEQ_TYPE_STANDARD) const noexcept { return m_seq[seqtype]; } const input_seq &seq(input_seq_type seqtype = SEQ_TYPE_STANDARD) const noexcept { return m_seq[seqtype]; }
@ -914,7 +914,6 @@ public:
{ {
m_condition = condition; m_condition = condition;
m_tag = tag; m_tag = tag;
m_port = nullptr;
m_mask = mask; m_mask = mask;
m_value = value; m_value = value;
} }
@ -1037,7 +1036,7 @@ public:
bool analog_invert() const { return ((m_flags & ANALOG_FLAG_INVERT) != 0); } bool analog_invert() const { return ((m_flags & ANALOG_FLAG_INVERT) != 0); }
u8 impulse() const noexcept { return m_impulse; } u8 impulse() const noexcept { return m_impulse; }
std::string name() const; const char *name() const;
const char *specific_name() const noexcept { return m_name; } const char *specific_name() const noexcept { return m_name; }
const input_seq &seq(input_seq_type seqtype = SEQ_TYPE_STANDARD) const noexcept; const input_seq &seq(input_seq_type seqtype = SEQ_TYPE_STANDARD) const noexcept;
const input_seq &defseq(input_seq_type seqtype = SEQ_TYPE_STANDARD) const noexcept; const input_seq &defseq(input_seq_type seqtype = SEQ_TYPE_STANDARD) const noexcept;
@ -1382,7 +1381,7 @@ public:
// type helpers // type helpers
const std::vector<input_type_entry> &types() const noexcept { return m_typelist; } const std::vector<input_type_entry> &types() const noexcept { return m_typelist; }
bool type_pressed(ioport_type type, int player = 0); bool type_pressed(ioport_type type, int player = 0);
std::string type_name(ioport_type type, u8 player) const; const char *type_name(ioport_type type, u8 player) const noexcept;
ioport_group type_group(ioport_type type, int player) const noexcept; ioport_group type_group(ioport_type type, int player) const noexcept;
const input_seq &type_seq(ioport_type type, int player = 0, input_seq_type seqtype = SEQ_TYPE_STANDARD) const noexcept; const input_seq &type_seq(ioport_type type, int player = 0, input_seq_type seqtype = SEQ_TYPE_STANDARD) const noexcept;
void set_type_seq(ioport_type type, int player, input_seq_type seqtype, const input_seq &newseq) noexcept; void set_type_seq(ioport_type type, int player, input_seq_type seqtype, const input_seq &newseq) noexcept;
@ -1489,7 +1488,6 @@ public:
ioport_configurer& field_set_toggle() { m_curfield->m_flags |= ioport_field::FIELD_FLAG_TOGGLE; return *this; } ioport_configurer& field_set_toggle() { m_curfield->m_flags |= ioport_field::FIELD_FLAG_TOGGLE; return *this; }
ioport_configurer& field_set_impulse(u8 impulse) { m_curfield->m_impulse = impulse; return *this; } ioport_configurer& field_set_impulse(u8 impulse) { m_curfield->m_impulse = impulse; return *this; }
ioport_configurer& field_set_analog_reverse() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_REVERSE; return *this; } ioport_configurer& field_set_analog_reverse() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_REVERSE; return *this; }
[[deprecated("PORT_RESET is deprecated; manage counter state explicitly")]]
ioport_configurer& field_set_analog_reset() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_RESET; return *this; } ioport_configurer& field_set_analog_reset() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_RESET; return *this; }
ioport_configurer& field_set_optional() { m_curfield->m_flags |= ioport_field::FIELD_FLAG_OPTIONAL; return *this; } ioport_configurer& field_set_optional() { m_curfield->m_flags |= ioport_field::FIELD_FLAG_OPTIONAL; return *this; }
ioport_configurer& field_set_min_max(ioport_value minval, ioport_value maxval) { m_curfield->m_min = minval; m_curfield->m_max = maxval; return *this; } ioport_configurer& field_set_min_max(ioport_value minval, ioport_value maxval) { m_curfield->m_min = minval; m_curfield->m_max = maxval; return *this; }

View File

@ -6,10 +6,69 @@
Controls execution of the core MAME system. Controls execution of the core MAME system.
****************************************************************************
Since there has been confusion in the past over the order of
initialization and other such things, here it is, all spelled out
as of January, 2008:
main()
- does platform-specific init
- calls mame_execute() [mame.c]
mame_execute() [mame.c]
- calls mame_validitychecks() [validity.c] to perform validity checks on all compiled drivers
- begins resource tracking (level 1)
- calls create_machine [mame.c] to initialize the running_machine structure
- calls init_machine() [mame.c]
init_machine() [mame.c]
- calls fileio_init() [fileio.c] to initialize file I/O info
- calls config_init() [config.c] to initialize configuration system
- calls input_init() [input.c] to initialize the input system
- calls output_init() [output.c] to initialize the output system
- calls state_init() [state.c] to initialize save state system
- calls state_save_allow_registration() [state.c] to allow registrations
- calls palette_init() [palette.c] to initialize palette system
- calls render_init() [render.c] to initialize the rendering system
- calls ui_init() [ui.c] to initialize the user interface
- calls generic_machine_init() [machine/generic.c] to initialize generic machine structures
- calls timer_init() [timer.c] to reset the timer system
- calls osd_init() [osdepend.h] to do platform-specific initialization
- calls input_port_init() [inptport.c] to set up the input ports
- calls rom_init() [romload.c] to load the game's ROMs
- calls memory_init() [memory.c] to process the game's memory maps
- calls the driver's DRIVER_INIT callback
- calls device_list_start() [devintrf.c] to start any devices
- calls video_init() [video.c] to start the video system
- calls tilemap_init() [tilemap.c] to start the tilemap system
- calls crosshair_init() [crsshair.c] to configure the crosshairs
- calls sound_init() [sound.c] to start the audio system
- calls debugger_init() [debugger.c] to set up the debugger
- calls the driver's MACHINE_START, SOUND_START, and VIDEO_START callbacks
- calls cheat_init() [cheat.c] to initialize the cheat system
- calls image_init() [image.c] to initialize the image system
- calls config_load_settings() [config.c] to load the configuration file
- calls nvram_load [machine/generic.c] to load NVRAM
- calls ui_display_startup_screens() [ui.c] to display the startup screens
- begins resource tracking (level 2)
- calls soft_reset() [mame.c] to reset all systems
-------------------( at this point, we're up and running )----------------------
- calls scheduler->timeslice() [schedule.c] over and over until we exit
- ends resource tracking (level 2), freeing all auto_mallocs and timers
- calls the nvram_save() [machine/generic.c] to save NVRAM
- calls config_save_settings() [config.c] to save the game's configuration
- calls all registered exit routines [mame.c]
- ends resource tracking (level 1), freeing all auto_mallocs and timers
- exits the program
***************************************************************************/ ***************************************************************************/
#include "emu.h" #include "emu.h"
#include "emuopts.h" #include "emuopts.h"
#include "osdepend.h" #include "osdepend.h"
#include "config.h" #include "config.h"
@ -17,6 +76,7 @@
#include "render.h" #include "render.h"
#include "uiinput.h" #include "uiinput.h"
#include "crsshair.h" #include "crsshair.h"
#include "unzip.h"
#include "debug/debugvw.h" #include "debug/debugvw.h"
#include "debug/debugcpu.h" #include "debug/debugcpu.h"
#include "dirtc.h" #include "dirtc.h"
@ -26,15 +86,11 @@
#include "tilemap.h" #include "tilemap.h"
#include "natkeyboard.h" #include "natkeyboard.h"
#include "ui/uimain.h" #include "ui/uimain.h"
#include "corestr.h" #include "corestr.h"
#include "unzip.h" #include <ctime>
#include <rapidjson/writer.h> #include <rapidjson/writer.h>
#include <rapidjson/stringbuffer.h> #include <rapidjson/stringbuffer.h>
#include <ctime>
#if defined(__EMSCRIPTEN__) #if defined(__EMSCRIPTEN__)
#include <emscripten.h> #include <emscripten.h>
#endif #endif
@ -441,7 +497,7 @@ void running_machine::schedule_soft_reset()
//------------------------------------------------- //-------------------------------------------------
// get_statename - allow to specify a subfolder of // get_statename - allow to specify a subfolder of
// the state directory for state loading/saving, // the state directory for state loading/saving,
// very useful for consoles or computers // very useful for MESS and consoles or computers
// where you can have separate folders for diff // where you can have separate folders for diff
// software // software
//------------------------------------------------- //-------------------------------------------------

View File

@ -257,23 +257,24 @@ std::pair<const char *, device_t *> machine_config::resolve_owner(const char *ta
device_t *owner(m_current_device); device_t *owner(m_current_device);
// if the device path is absolute, start from the root // if the device path is absolute, start from the root
if (!*tag || (':' == *tag) || ('^' == *tag)) if (tag[0] == ':')
throw emu_fatalerror("Attempting to add device with tag containing parent references '%s'\n", orig_tag); {
tag++;
owner = m_root_device.get();
}
// go down the path until we're done with it // go down the path until we're done with it
char const *next; while (strchr(tag, ':'))
while ((next = strchr(tag, ':')) != nullptr)
{ {
const char *next = strchr(tag, ':');
assert(next != tag); assert(next != tag);
std::string_view part(tag, next - tag); std::string_view part(tag, next - tag);
owner = owner->subdevices().find(part); owner = owner->subdevices().find(part);
if (!owner) if (!owner)
throw emu_fatalerror("Could not find '%s' when looking up path for device '%s'\n", part, orig_tag); throw emu_fatalerror("Could not find %s when looking up path for device %s\n", part, orig_tag);
tag = next + 1; tag = next+1;
if ('^' == *tag)
throw emu_fatalerror("Attempting to add device with tag containing parent references '%s'\n", orig_tag);
} }
assert(*tag != '\0'); assert(tag[0] != '\0');
return std::make_pair(tag, owner); return std::make_pair(tag, owner);
} }
@ -295,7 +296,7 @@ std::tuple<const char *, device_t *, device_t *> machine_config::prepare_replace
if (old_device) if (old_device)
remove_references(*old_device); remove_references(*old_device);
else else
throw emu_fatalerror("Attempting to replace non-existent device '%s'\n", tag); osd_printf_warning("Warning: attempting to replace non-existent device '%s'\n", tag);
return std::make_tuple(owner.first, owner.second, old_device); return std::make_tuple(owner.first, owner.second, old_device);
} }

View File

@ -536,7 +536,8 @@ const rgb_t *render_texture::get_adjusted_palette(render_container &container, u
//------------------------------------------------- //-------------------------------------------------
render_container::render_container(render_manager &manager, screen_device *screen) render_container::render_container(render_manager &manager, screen_device *screen)
: m_manager(manager) : m_next(nullptr)
, m_manager(manager)
, m_screen(screen) , m_screen(screen)
, m_overlaybitmap(nullptr) , m_overlaybitmap(nullptr)
, m_overlaytexture(nullptr) , m_overlaytexture(nullptr)
@ -893,6 +894,7 @@ render_target::render_target(render_manager &manager, util::xml::data_node const
template <typename T> render_target::render_target(render_manager &manager, T &&layout, u32 flags, constructor_impl_t) template <typename T> render_target::render_target(render_manager &manager, T &&layout, u32 flags, constructor_impl_t)
: m_next(nullptr) : m_next(nullptr)
, m_manager(manager) , m_manager(manager)
, m_filelist(std::make_unique<std::list<layout_file>>())
, m_curview(0U) , m_curview(0U)
, m_flags(flags) , m_flags(flags)
, m_listindex(0) , m_listindex(0)
@ -958,7 +960,7 @@ template <typename T> render_target::render_target(render_manager &manager, T &&
// load the layout files // load the layout files
load_layout_files(std::forward<T>(layout), flags & RENDER_CREATE_SINGLE_FILE); load_layout_files(std::forward<T>(layout), flags & RENDER_CREATE_SINGLE_FILE);
for (layout_file &file : m_filelist) for (layout_file &file : *m_filelist)
for (layout_view &view : file.views()) for (layout_view &view : file.views())
if (!(m_flags & RENDER_CREATE_NO_ART) || !view.has_art()) if (!(m_flags & RENDER_CREATE_NO_ART) || !view.has_art())
m_views.emplace_back(view, view.default_visibility_mask()); m_views.emplace_back(view, view.default_visibility_mask());
@ -1415,6 +1417,23 @@ render_primitive_list &render_target::get_primitives()
} }
} }
// process the debug containers
for (render_container &debug : m_debug_containers)
{
object_transform ui_xform;
ui_xform.xoffs = 0;
ui_xform.yoffs = 0;
ui_xform.xscale = (float)m_width;
ui_xform.yscale = (float)m_height;
ui_xform.color.r = ui_xform.color.g = ui_xform.color.b = 1.0f;
ui_xform.color.a = 0.9f;
ui_xform.orientation = m_orientation;
ui_xform.no_center = true;
// add UI elements
add_container_primitives(list, root_xform, ui_xform, debug, BLENDMODE_ALPHA);
}
// process the UI if we are the UI target // process the UI if we are the UI target
if (is_ui_target()) if (is_ui_target())
{ {
@ -1584,13 +1603,45 @@ void render_target::invalidate_all(void *refptr)
} }
//-------------------------------------------------
// debug_alloc - allocate a container for a debug
// view
//-------------------------------------------------
render_container *render_target::debug_alloc()
{
return &m_debug_containers.append(*m_manager.container_alloc());
}
//-------------------------------------------------
// debug_free - free a container for a debug view
//-------------------------------------------------
void render_target::debug_free(render_container &container)
{
m_debug_containers.remove(container);
}
//-------------------------------------------------
// debug_append - move a debug view container to
// the end of the list
//-------------------------------------------------
void render_target::debug_append(render_container &container)
{
m_debug_containers.append(m_debug_containers.detach(container));
}
//------------------------------------------------- //-------------------------------------------------
// resolve_tags - resolve tag lookups // resolve_tags - resolve tag lookups
//------------------------------------------------- //-------------------------------------------------
void render_target::resolve_tags() void render_target::resolve_tags()
{ {
for (layout_file &file : m_filelist) for (layout_file &file : *m_filelist)
file.resolve_tags(); file.resolve_tags();
current_view().recompute(visibility_mask(), m_layerconfig.zoom_to_screen()); current_view().recompute(visibility_mask(), m_layerconfig.zoom_to_screen());
@ -1757,7 +1808,7 @@ void render_target::load_additional_layout_files(const char *basename, bool have
auto const nth_view = auto const nth_view =
[this] (unsigned n) -> layout_view * [this] (unsigned n) -> layout_view *
{ {
for (layout_file &file : m_filelist) for (layout_file &file : *m_filelist)
for (layout_view &view : file.views()) for (layout_view &view : file.views())
if (!(m_flags & RENDER_CREATE_NO_ART) || !view.has_art()) if (!(m_flags & RENDER_CREATE_NO_ART) || !view.has_art())
if (n-- == 0) if (n-- == 0)
@ -1770,7 +1821,7 @@ void render_target::load_additional_layout_files(const char *basename, bool have
if (!nth_view(0)) if (!nth_view(0))
{ {
load_layout_file(nullptr, layout_noscreens); load_layout_file(nullptr, layout_noscreens);
if (m_filelist.empty()) if (m_filelist->empty())
throw emu_fatalerror("Couldn't parse default layout??"); throw emu_fatalerror("Couldn't parse default layout??");
} }
} }
@ -2175,7 +2226,7 @@ bool render_target::load_layout_file(device_t &device, util::xml::data_node cons
// parse and catch any errors // parse and catch any errors
try try
{ {
m_filelist.emplace_back(device, rootnode, searchpath, dirname); m_filelist->emplace_back(device, rootnode, searchpath, dirname);
} }
catch (emu_fatalerror &err) catch (emu_fatalerror &err)
{ {
@ -3056,7 +3107,7 @@ render_manager::render_manager(running_machine &machine)
, m_ui_target(nullptr) , m_ui_target(nullptr)
, m_live_textures(0) , m_live_textures(0)
, m_texture_id(0) , m_texture_id(0)
, m_ui_container(std::make_unique<render_container>(*this)) , m_ui_container(new render_container(*this))
{ {
// register callbacks // register callbacks
machine.configuration().config_register( machine.configuration().config_register(
@ -3066,7 +3117,7 @@ render_manager::render_manager(running_machine &machine)
// create one container per screen // create one container per screen
for (screen_device &screen : screen_device_enumerator(machine.root_device())) for (screen_device &screen : screen_device_enumerator(machine.root_device()))
screen.set_container(m_screen_container_list.emplace_back(*this, &screen)); screen.set_container(*container_alloc(&screen));
} }
@ -3077,8 +3128,8 @@ render_manager::render_manager(running_machine &machine)
render_manager::~render_manager() render_manager::~render_manager()
{ {
// free all the containers since they may own textures // free all the containers since they may own textures
m_ui_container.reset(); container_free(m_ui_container);
m_screen_container_list.clear(); m_screen_container_list.reset();
// better not be any outstanding textures when we die // better not be any outstanding textures when we die
assert(m_live_textures == 0); assert(m_live_textures == 0);
@ -3178,7 +3229,7 @@ float render_manager::ui_aspect(render_container *rc)
int orient; int orient;
float aspect; float aspect;
if (rc == m_ui_container.get() || rc == nullptr) { if (rc == m_ui_container || rc == nullptr) {
// ui container, aggregated multi-screen target // ui container, aggregated multi-screen target
orient = orientation_add(m_ui_target->orientation(), m_ui_container->orientation()); orient = orientation_add(m_ui_target->orientation(), m_ui_container->orientation());
@ -3289,6 +3340,29 @@ void render_manager::resolve_tags()
} }
//-------------------------------------------------
// container_alloc - allocate a new container
//-------------------------------------------------
render_container *render_manager::container_alloc(screen_device *screen)
{
auto container = new render_container(*this, screen);
if (screen != nullptr)
m_screen_container_list.append(*container);
return container;
}
//-------------------------------------------------
// container_free - release a container
//-------------------------------------------------
void render_manager::container_free(render_container *container)
{
m_screen_container_list.remove(*container);
}
//------------------------------------------------- //-------------------------------------------------
// config_load - read and apply data from the // config_load - read and apply data from the
// configuration file // configuration file
@ -3321,29 +3395,24 @@ void render_manager::config_load(config_type cfg_type, config_level cfg_level, u
for (util::xml::data_node const *screennode = parentnode->get_child("screen"); screennode; screennode = screennode->get_next_sibling("screen")) for (util::xml::data_node const *screennode = parentnode->get_child("screen"); screennode; screennode = screennode->get_next_sibling("screen"))
{ {
int const index = screennode->get_attribute_int("index", -1); int const index = screennode->get_attribute_int("index", -1);
render_container *container = nullptr; render_container *container = m_screen_container_list.find(index);
if (index >= 0 && index < m_screen_container_list.size())
container = &*std::next(m_screen_container_list.begin(), index);
if (container != nullptr) // fetch current settings
{ render_container::user_settings settings = container->get_user_settings();
// fetch current settings
render_container::user_settings settings = container->get_user_settings();
// fetch color controls // fetch color controls
settings.m_brightness = screennode->get_attribute_float("brightness", settings.m_brightness); settings.m_brightness = screennode->get_attribute_float("brightness", settings.m_brightness);
settings.m_contrast = screennode->get_attribute_float("contrast", settings.m_contrast); settings.m_contrast = screennode->get_attribute_float("contrast", settings.m_contrast);
settings.m_gamma = screennode->get_attribute_float("gamma", settings.m_gamma); settings.m_gamma = screennode->get_attribute_float("gamma", settings.m_gamma);
// fetch positioning controls // fetch positioning controls
settings.m_xoffset = screennode->get_attribute_float("hoffset", settings.m_xoffset); settings.m_xoffset = screennode->get_attribute_float("hoffset", settings.m_xoffset);
settings.m_xscale = screennode->get_attribute_float("hstretch", settings.m_xscale); settings.m_xscale = screennode->get_attribute_float("hstretch", settings.m_xscale);
settings.m_yoffset = screennode->get_attribute_float("voffset", settings.m_yoffset); settings.m_yoffset = screennode->get_attribute_float("voffset", settings.m_yoffset);
settings.m_yscale = screennode->get_attribute_float("vstretch", settings.m_yscale); settings.m_yscale = screennode->get_attribute_float("vstretch", settings.m_yscale);
// set the new values // set the new values
container->set_user_settings(settings); container->set_user_settings(settings);
}
} }
} }
@ -3388,7 +3457,7 @@ void render_manager::config_save(config_type cfg_type, util::xml::data_node *par
// iterate over screen containers // iterate over screen containers
int scrnum = 0; int scrnum = 0;
for (render_container &container : m_screen_container_list) for (render_container *container = m_screen_container_list.first(); container != nullptr; container = container->next(), scrnum++)
{ {
// create a node // create a node
util::xml::data_node *const screennode = parentnode->add_child("screen", nullptr); util::xml::data_node *const screennode = parentnode->add_child("screen", nullptr);
@ -3399,7 +3468,7 @@ void render_manager::config_save(config_type cfg_type, util::xml::data_node *par
// output the basics // output the basics
screennode->set_attribute_int("index", scrnum); screennode->set_attribute_int("index", scrnum);
render_container::user_settings const settings = container.get_user_settings(); render_container::user_settings settings = container->get_user_settings();
// output the color controls // output the color controls
if (settings.m_brightness != machine().options().brightness()) if (settings.m_brightness != machine().options().brightness())
@ -3449,7 +3518,5 @@ void render_manager::config_save(config_type cfg_type, util::xml::data_node *par
if (!changed) if (!changed)
screennode->delete_node(); screennode->delete_node();
} }
scrnum++;
} }
} }

View File

@ -377,14 +377,15 @@ private:
// a render_container holds a list of items and an orientation for the entire collection // a render_container holds a list of items and an orientation for the entire collection
class render_container class render_container
{ {
friend class simple_list<render_container>;
friend class render_manager; friend class render_manager;
friend class render_target; friend class render_target;
public:
// construction/destruction // construction/destruction
render_container(render_manager &manager, screen_device *screen = nullptr); render_container(render_manager &manager, screen_device *screen = nullptr);
~render_container(); ~render_container();
public:
// user settings describes the collected user-controllable settings // user settings describes the collected user-controllable settings
struct user_settings struct user_settings
{ {
@ -403,6 +404,7 @@ public:
}; };
// getters // getters
render_container *next() const { return m_next; }
screen_device *screen() const { return m_screen; } screen_device *screen() const { return m_screen; }
render_manager &manager() const { return m_manager; } render_manager &manager() const { return m_manager; }
render_texture *overlay() const { return m_overlaytexture; } render_texture *overlay() const { return m_overlaytexture; }
@ -476,6 +478,7 @@ private:
void update_palette(); void update_palette();
// internal state // internal state
render_container * m_next; // the next container in the list
render_manager & m_manager; // reference back to the owning manager render_manager & m_manager; // reference back to the owning manager
simple_list<item> m_itemlist; // head of the item list simple_list<item> m_itemlist; // head of the item list
fixed_allocator<item> m_item_allocator; // free container items fixed_allocator<item> m_item_allocator; // free container items
@ -561,6 +564,11 @@ public:
// reference tracking // reference tracking
void invalidate_all(void *refptr); void invalidate_all(void *refptr);
// debug containers
render_container *debug_alloc();
void debug_free(render_container &container);
void debug_append(render_container &container);
// resolve tag lookups // resolve tag lookups
void resolve_tags(); void resolve_tags();
@ -606,7 +614,7 @@ private:
// internal state // internal state
render_target * m_next; // link to next target render_target * m_next; // link to next target
render_manager & m_manager; // reference to our owning manager render_manager & m_manager; // reference to our owning manager
std::list<layout_file> m_filelist; // list of layout files std::unique_ptr<std::list<layout_file>> m_filelist; // list of layout files
view_mask_vector m_views; // views we consider view_mask_vector m_views; // views we consider
unsigned m_curview; // current view index unsigned m_curview; // current view index
u32 m_flags; // creation flags u32 m_flags; // creation flags
@ -630,6 +638,7 @@ private:
render_layer_config m_base_layerconfig; // the layer configuration at the time of first frame render_layer_config m_base_layerconfig; // the layer configuration at the time of first frame
int m_maxtexwidth; // maximum width of a texture int m_maxtexwidth; // maximum width of a texture
int m_maxtexheight; // maximum height of a texture int m_maxtexheight; // maximum height of a texture
simple_list<render_container> m_debug_containers; // list of debug containers
s32 m_clear_extent_count; // number of clear extents s32 m_clear_extent_count; // number of clear extents
s32 m_clear_extents[MAX_CLEAR_EXTENTS]; // array of clear extents s32 m_clear_extents[MAX_CLEAR_EXTENTS]; // array of clear extents
bool m_transform_container; // determines whether the screen container is transformed by the core renderer, bool m_transform_container; // determines whether the screen container is transformed by the core renderer,
@ -662,7 +671,7 @@ public:
render_target *target_alloc(util::xml::data_node const &layout, u32 flags = 0); render_target *target_alloc(util::xml::data_node const &layout, u32 flags = 0);
void target_free(render_target *target); void target_free(render_target *target);
const simple_list<render_target> &targets() const { return m_targetlist; } const simple_list<render_target> &targets() const { return m_targetlist; }
render_target *first_target() { return m_targetlist.first(); } render_target *first_target() const { return m_targetlist.first(); }
render_target *target_by_index(int index) const; render_target *target_by_index(int index) const;
// UI targets // UI targets
@ -687,6 +696,10 @@ public:
void resolve_tags(); void resolve_tags();
private: private:
// containers
render_container *container_alloc(screen_device *screen = nullptr);
void container_free(render_container *container);
// config callbacks // config callbacks
void config_load(config_type cfg_type, config_level cfg_lvl, util::xml::data_node const *parentnode); void config_load(config_type cfg_type, config_level cfg_lvl, util::xml::data_node const *parentnode);
void config_save(config_type cfg_type, util::xml::data_node *parentnode); void config_save(config_type cfg_type, util::xml::data_node *parentnode);
@ -704,8 +717,8 @@ private:
fixed_allocator<render_texture> m_texture_allocator;// texture allocator fixed_allocator<render_texture> m_texture_allocator;// texture allocator
// containers for the UI and for screens // containers for the UI and for screens
std::unique_ptr<render_container> m_ui_container; // UI container render_container * m_ui_container; // UI container
std::list<render_container> m_screen_container_list; // list of containers for the screen simple_list<render_container> m_screen_container_list; // list of containers for the screen
}; };
#endif // MAME_EMU_RENDER_H #endif // MAME_EMU_RENDER_H

View File

@ -130,7 +130,7 @@ private:
static inline u32 get_texel_palette16(const render_texinfo &texture, s32 curu, s32 curv) static inline u32 get_texel_palette16(const render_texinfo &texture, s32 curu, s32 curv)
{ {
rgb_t const *const palbase = texture.palette; const rgb_t *palbase = texture.palette;
if constexpr (BilinearFilter) if constexpr (BilinearFilter)
{ {
s32 u0 = curu >> 16; s32 u0 = curu >> 16;
@ -142,7 +142,7 @@ private:
if (v0 < 0) v0 = v1 = 0; if (v0 < 0) v0 = v1 = 0;
else if (v0 + 1 >= texture.height) v0 = texture.height - 1, v1 = 0; else if (v0 + 1 >= texture.height) v0 = texture.height - 1, v1 = 0;
u16 const *texbase = reinterpret_cast<u16 const *>(texture.base); const u16 *texbase = reinterpret_cast<const u16 *>(texture.base);
texbase += v0 * texture.rowpixels + u0; texbase += v0 * texture.rowpixels + u0;
u32 pix00 = palbase[texbase[0]]; u32 pix00 = palbase[texbase[0]];
@ -153,7 +153,7 @@ private:
} }
else else
{ {
u16 const *const texbase = reinterpret_cast<u16 const *>(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16); const u16 *texbase = reinterpret_cast<const u16 *>(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16);
return palbase[texbase[0]]; return palbase[texbase[0]];
} }
} }
@ -166,7 +166,7 @@ private:
static inline u32 get_texel_palette16a(const render_texinfo &texture, s32 curu, s32 curv) static inline u32 get_texel_palette16a(const render_texinfo &texture, s32 curu, s32 curv)
{ {
rgb_t const *const palbase = texture.palette; const rgb_t *palbase = texture.palette;
if constexpr (BilinearFilter) if constexpr (BilinearFilter)
{ {
s32 u0 = curu >> 16; s32 u0 = curu >> 16;
@ -178,14 +178,14 @@ private:
if (v0 < 0) v0 = v1 = 0; if (v0 < 0) v0 = v1 = 0;
else if (v0 + 1 >= texture.height) v0 = texture.height - 1, v1 = 0; else if (v0 + 1 >= texture.height) v0 = texture.height - 1, v1 = 0;
u16 const *texbase = reinterpret_cast<u16 const *>(texture.base); const u16 *texbase = reinterpret_cast<const u16 *>(texture.base);
texbase += v0 * texture.rowpixels + u0; texbase += v0 * texture.rowpixels + u0;
return rgbaint_t::bilinear_filter(palbase[texbase[0]], palbase[texbase[u1]], palbase[texbase[v1]], palbase[texbase[u1 + v1]], curu >> 8, curv >> 8); return rgbaint_t::bilinear_filter(palbase[texbase[0]], palbase[texbase[u1]], palbase[texbase[v1]], palbase[texbase[u1 + v1]], curu >> 8, curv >> 8);
} }
else else
{ {
u16 const *const texbase = reinterpret_cast<u16 const *>(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16); const u16 *texbase = reinterpret_cast<const u16 *>(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16);
return palbase[texbase[0]]; return palbase[texbase[0]];
} }
} }
@ -415,7 +415,7 @@ private:
// draw_line - draw a line or point // draw_line - draw a line or point
//------------------------------------------------- //-------------------------------------------------
static void draw_line(render_primitive const &prim, PixelType *dstdata, s32 width, s32 height, u32 pitch) static void draw_line(const render_primitive &prim, PixelType *dstdata, s32 width, s32 height, u32 pitch)
{ {
// internal tables // internal tables
static u32 s_cosine_table[2049]; static u32 s_cosine_table[2049];
@ -576,35 +576,49 @@ private:
// draw_rect - draw a solid rectangle // draw_rect - draw a solid rectangle
//------------------------------------------------- //-------------------------------------------------
static void draw_rect(render_primitive const &prim, PixelType *dstdata, s32 width, s32 height, u32 pitch) static void draw_rect(const render_primitive &prim, PixelType *dstdata, s32 width, s32 height, u32 pitch)
{ {
render_bounds const fpos = prim.bounds; render_bounds fpos = prim.bounds;
assert(fpos.x0 <= fpos.x1); assert(fpos.x0 <= fpos.x1);
assert(fpos.y0 <= fpos.y1); assert(fpos.y0 <= fpos.y1);
// clamp to integers and ensure we fit // clamp to integers
s32 const startx = std::clamp<s32>(round_nearest(fpos.x0), 0, width); s32 startx = round_nearest(fpos.x0);
s32 const starty = std::clamp<s32>(round_nearest(fpos.y0), 0, height); s32 starty = round_nearest(fpos.y0);
s32 const endx = std::clamp<s32>(round_nearest(fpos.x1), 0, width); s32 endx = round_nearest(fpos.x1);
s32 const endy = std::clamp<s32>(round_nearest(fpos.y1), 0, height); s32 endy = round_nearest(fpos.y1);
// ensure we fit
if (startx < 0) startx = 0;
if (startx >= width) startx = width;
if (endx < 0) endx = 0;
if (endx >= width) endx = width;
if (starty < 0) starty = 0;
if (starty >= height) starty = height;
if (endy < 0) endy = 0;
if (endy >= height) endy = height;
// bail if nothing left // bail if nothing left
if ((startx > endx) || (starty > endy)) if (fpos.x0 > fpos.x1 || fpos.y0 > fpos.y1)
return; return;
// only support alpha and "none" blendmodes // only support alpha and "none" blendmodes
assert(PRIMFLAG_GET_BLENDMODE(prim.flags) == BLENDMODE_NONE || assert(PRIMFLAG_GET_BLENDMODE(prim.flags) == BLENDMODE_NONE ||
PRIMFLAG_GET_BLENDMODE(prim.flags) == BLENDMODE_ALPHA); PRIMFLAG_GET_BLENDMODE(prim.flags) == BLENDMODE_ALPHA);
if ((PRIMFLAG_GET_BLENDMODE(prim.flags) == BLENDMODE_NONE) || is_opaque(prim.color.a)) // fast case: no alpha
if (PRIMFLAG_GET_BLENDMODE(prim.flags) == BLENDMODE_NONE || is_opaque(prim.color.a))
{ {
// fast case: no alpha u32 r = u32(256.0f * prim.color.r);
u32 g = u32(256.0f * prim.color.g);
u32 b = u32(256.0f * prim.color.b);
u32 pix;
// clamp R,G,B to 0-256 range // clamp R,G,B to 0-256 range
u32 const r = u32(std::clamp(256.0f * prim.color.r, 0.0f, 255.0f)); if (r > 0xff) { if (s32(r) < 0) r = 0; else r = 0xff; }
u32 const g = u32(std::clamp(256.0f * prim.color.g, 0.0f, 255.0f)); if (g > 0xff) { if (s32(g) < 0) g = 0; else g = 0xff; }
u32 const b = u32(std::clamp(256.0f * prim.color.b, 0.0f, 255.0f)); if (b > 0xff) { if (s32(b) < 0) b = 0; else b = 0xff; }
u32 const pix = dest_rgb_to_pixel(r, g, b); pix = dest_rgb_to_pixel(r, g, b);
// loop over rows // loop over rows
for (s32 y = starty; y < endy; y++) for (s32 y = starty; y < endy; y++)
@ -616,18 +630,23 @@ private:
*dest++ = pix; *dest++ = pix;
} }
} }
// alpha and/or coloring case
else if (!is_transparent(prim.color.a)) else if (!is_transparent(prim.color.a))
{ {
// alpha and/or coloring case u32 rmask = dest_rgb_to_pixel(0xff,0x00,0x00);
u32 const rmask = dest_rgb_to_pixel(0xff,0x00,0x00); u32 gmask = dest_rgb_to_pixel(0x00,0xff,0x00);
u32 const gmask = dest_rgb_to_pixel(0x00,0xff,0x00); u32 bmask = dest_rgb_to_pixel(0x00,0x00,0xff);
u32 const bmask = dest_rgb_to_pixel(0x00,0x00,0xff); u32 r = u32(256.0f * prim.color.r * prim.color.a);
u32 g = u32(256.0f * prim.color.g * prim.color.a);
u32 b = u32(256.0f * prim.color.b * prim.color.a);
u32 inva = u32(256.0f * (1.0f - prim.color.a));
// clamp R,G,B and inverse A to 0-256 range // clamp R,G,B and inverse A to 0-256 range
u32 r = u32(std::clamp(256.0f * prim.color.r * prim.color.a, 0.0f, 255.0f)); if (r > 0xff) { if (s32(r) < 0) r = 0; else r = 0xff; }
u32 g = u32(std::clamp(256.0f * prim.color.g * prim.color.a, 0.0f, 255.0f)); if (g > 0xff) { if (s32(g) < 0) g = 0; else g = 0xff; }
u32 b = u32(std::clamp(256.0f * prim.color.b * prim.color.a, 0.0f, 255.0f)); if (b > 0xff) { if (s32(b) < 0) b = 0; else b = 0xff; }
u32 const inva = u32(std::clamp(256.0f * (1.0f - prim.color.a), 0.0f, 256.0f)); if (inva > 0x100) { if (s32(inva) < 0) inva = 0; else inva = 0x100; }
// pre-shift the RGBA pieces // pre-shift the RGBA pieces
r = dest_rgb_to_pixel(r, 0, 0) << 8; r = dest_rgb_to_pixel(r, 0, 0) << 8;
@ -662,15 +681,14 @@ private:
// rasterization of a 16bpp palettized texture // rasterization of a 16bpp palettized texture
//------------------------------------------------- //-------------------------------------------------
static void draw_quad_palette16_none(render_primitive const &prim, PixelType *dstdata, u32 pitch, quad_setup_data const &setup) static void draw_quad_palette16_none(const render_primitive &prim, PixelType *dstdata, u32 pitch, const quad_setup_data &setup)
{ {
// ensure all parameters are valid // ensure all parameters are valid
assert(prim.texture.palette != nullptr); assert(prim.texture.palette != nullptr);
// fast case: no coloring, no alpha
if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a))
{ {
// fast case: no coloring, no alpha
// loop over rows // loop over rows
for (s32 y = setup.starty; y < setup.endy; y++) for (s32 y = setup.starty; y < setup.endy; y++)
{ {
@ -681,21 +699,25 @@ private:
// loop over cols // loop over cols
for (s32 x = setup.startx; x < setup.endx; x++) for (s32 x = setup.startx; x < setup.endx; x++)
{ {
u32 const pix = get_texel_palette16(prim.texture, curu, curv); const u32 pix = get_texel_palette16(prim.texture, curu, curv);
*dest++ = source32_to_dest(pix); *dest++ = source32_to_dest(pix);
curu += setup.dudx; curu += setup.dudx;
curv += setup.dvdx; curv += setup.dvdx;
} }
} }
} }
// coloring-only case
else if (is_opaque(prim.color.a)) else if (is_opaque(prim.color.a))
{ {
// coloring-only case u32 sr = u32(256.0f * prim.color.r);
u32 sg = u32(256.0f * prim.color.g);
u32 sb = u32(256.0f * prim.color.b);
// clamp R,G,B to 0-256 range // clamp R,G,B to 0-256 range
u32 const sr = u32(std::clamp(256.0f * prim.color.r, 0.0f, 256.0f)); if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; }
u32 const sg = u32(std::clamp(256.0f * prim.color.g, 0.0f, 256.0f)); if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; }
u32 const sb = u32(std::clamp(256.0f * prim.color.b, 0.0f, 256.0f)); if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; }
// loop over rows // loop over rows
for (s32 y = setup.starty; y < setup.endy; y++) for (s32 y = setup.starty; y < setup.endy; y++)
@ -707,10 +729,10 @@ private:
// loop over cols // loop over cols
for (s32 x = setup.startx; x < setup.endx; x++) for (s32 x = setup.startx; x < setup.endx; x++)
{ {
u32 const pix = get_texel_palette16(prim.texture, curu, curv); const u32 pix = get_texel_palette16(prim.texture, curu, curv);
u32 const r = (source32_r(pix) * sr) >> 8; const u32 r = (source32_r(pix) * sr) >> 8;
u32 const g = (source32_g(pix) * sg) >> 8; const u32 g = (source32_g(pix) * sg) >> 8;
u32 const b = (source32_b(pix) * sb) >> 8; const u32 b = (source32_b(pix) * sb) >> 8;
*dest++ = dest_assemble_rgb(r, g, b); *dest++ = dest_assemble_rgb(r, g, b);
curu += setup.dudx; curu += setup.dudx;
@ -718,15 +740,20 @@ private:
} }
} }
} }
// alpha and/or coloring case
else if (!is_transparent(prim.color.a)) else if (!is_transparent(prim.color.a))
{ {
// alpha and/or coloring case u32 sr = u32(256.0f * prim.color.r * prim.color.a);
u32 sg = u32(256.0f * prim.color.g * prim.color.a);
u32 sb = u32(256.0f * prim.color.b * prim.color.a);
u32 invsa = u32(256.0f * (1.0f - prim.color.a));
// clamp R,G,B and inverse A to 0-256 range // clamp R,G,B and inverse A to 0-256 range
u32 const sr = u32(std::clamp(256.0f * prim.color.r * prim.color.a, 0.0f, 256.0f)); if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; }
u32 const sg = u32(std::clamp(256.0f * prim.color.g * prim.color.a, 0.0f, 256.0f)); if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; }
u32 const sb = u32(std::clamp(256.0f * prim.color.b * prim.color.a, 0.0f, 256.0f)); if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; }
u32 const invsa = u32(std::clamp(256.0f * (1.0f - prim.color.a), 0.0f, 256.0f)); if (invsa > 0x100) { if (s32(invsa) < 0) invsa = 0; else invsa = 0x100; }
// loop over rows // loop over rows
for (s32 y = setup.starty; y < setup.endy; y++) for (s32 y = setup.starty; y < setup.endy; y++)
@ -738,11 +765,11 @@ private:
// loop over cols // loop over cols
for (s32 x = setup.startx; x < setup.endx; x++) for (s32 x = setup.startx; x < setup.endx; x++)
{ {
u32 const pix = get_texel_palette16(prim.texture, curu, curv); const u32 pix = get_texel_palette16(prim.texture, curu, curv);
u32 const dpix = NoDestRead ? 0 : *dest; const u32 dpix = NoDestRead ? 0 : *dest;
u32 const r = (source32_r(pix) * sr + dest_r(dpix) * invsa) >> 8; const u32 r = (source32_r(pix) * sr + dest_r(dpix) * invsa) >> 8;
u32 const g = (source32_g(pix) * sg + dest_g(dpix) * invsa) >> 8; const u32 g = (source32_g(pix) * sg + dest_g(dpix) * invsa) >> 8;
u32 const b = (source32_b(pix) * sb + dest_b(dpix) * invsa) >> 8; const u32 b = (source32_b(pix) * sb + dest_b(dpix) * invsa) >> 8;
*dest++ = dest_assemble_rgb(r, g, b); *dest++ = dest_assemble_rgb(r, g, b);
curu += setup.dudx; curu += setup.dudx;
@ -758,15 +785,14 @@ private:
// rasterization of a 16bpp palettized texture // rasterization of a 16bpp palettized texture
//------------------------------------------------- //-------------------------------------------------
static void draw_quad_palette16_add(render_primitive const &prim, PixelType *dstdata, u32 pitch, quad_setup_data const &setup) static void draw_quad_palette16_add(const render_primitive &prim, PixelType *dstdata, u32 pitch, const quad_setup_data&setup)
{ {
// ensure all parameters are valid // ensure all parameters are valid
assert(prim.texture.palette != nullptr); assert(prim.texture.palette != nullptr);
// fast case: no coloring, no alpha
if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a))
{ {
// fast case: no coloring, no alpha
// loop over rows // loop over rows
for (s32 y = setup.starty; y < setup.endy; y++) for (s32 y = setup.starty; y < setup.endy; y++)
{ {
@ -780,7 +806,7 @@ private:
const u32 pix = get_texel_palette16(prim.texture, curu, curv); const u32 pix = get_texel_palette16(prim.texture, curu, curv);
if ((pix & 0xffffff) != 0) if ((pix & 0xffffff) != 0)
{ {
u32 const dpix = NoDestRead ? 0 : *dest; const u32 dpix = NoDestRead ? 0 : *dest;
u32 r = source32_r(pix) + dest_r(dpix); u32 r = source32_r(pix) + dest_r(dpix);
u32 g = source32_g(pix) + dest_g(dpix); u32 g = source32_g(pix) + dest_g(dpix);
u32 b = source32_b(pix) + dest_b(dpix); u32 b = source32_b(pix) + dest_b(dpix);
@ -795,14 +821,18 @@ private:
} }
} }
} }
// alpha and/or coloring case
else else
{ {
// alpha and/or coloring case u32 sr = u32(256.0f * prim.color.r * prim.color.a);
u32 sg = u32(256.0f * prim.color.g * prim.color.a);
u32 sb = u32(256.0f * prim.color.b * prim.color.a);
// clamp R,G,B and inverse A to 0-256 range // clamp R,G,B and inverse A to 0-256 range
u32 const sr = u32(std::clamp(256.0f * prim.color.r * prim.color.a, 0.0f, 256.0f)); if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; }
u32 const sg = u32(std::clamp(256.0f * prim.color.g * prim.color.a, 0.0f, 256.0f)); if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; }
u32 const sb = u32(std::clamp(256.0f * prim.color.b * prim.color.a, 0.0f, 256.0f)); if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; }
// loop over rows // loop over rows
for (s32 y = setup.starty; y < setup.endy; y++) for (s32 y = setup.starty; y < setup.endy; y++)
@ -814,10 +844,10 @@ private:
// loop over cols // loop over cols
for (s32 x = setup.startx; x < setup.endx; x++) for (s32 x = setup.startx; x < setup.endx; x++)
{ {
u32 const pix = get_texel_palette16(prim.texture, curu, curv); const u32 pix = get_texel_palette16(prim.texture, curu, curv);
if ((pix & 0xffffff) != 0) if ((pix & 0xffffff) != 0)
{ {
u32 const dpix = NoDestRead ? 0 : *dest; const u32 dpix = NoDestRead ? 0 : *dest;
u32 r = ((source32_r(pix) * sr) >> 8) + dest_r(dpix); u32 r = ((source32_r(pix) * sr) >> 8) + dest_r(dpix);
u32 g = ((source32_g(pix) * sg) >> 8) + dest_g(dpix); u32 g = ((source32_g(pix) * sg) >> 8) + dest_g(dpix);
u32 b = ((source32_b(pix) * sb) >> 8) + dest_b(dpix); u32 b = ((source32_b(pix) * sb) >> 8) + dest_b(dpix);
@ -844,12 +874,11 @@ private:
// rasterization of a 16bpp YUY image // rasterization of a 16bpp YUY image
//------------------------------------------------- //-------------------------------------------------
static void draw_quad_yuy16_none(render_primitive const &prim, PixelType *dstdata, u32 pitch, quad_setup_data const &setup) static void draw_quad_yuy16_none(const render_primitive &prim, PixelType *dstdata, u32 pitch, const quad_setup_data&setup)
{ {
// fast case: no coloring, no alpha
if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a))
{ {
// fast case: no coloring, no alpha
// loop over rows // loop over rows
for (s32 y = setup.starty; y < setup.endy; y++) for (s32 y = setup.starty; y < setup.endy; y++)
{ {
@ -860,21 +889,25 @@ private:
// loop over cols // loop over cols
for (s32 x = setup.startx; x < setup.endx; x++) for (s32 x = setup.startx; x < setup.endx; x++)
{ {
u32 const pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); const u32 pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv));
*dest++ = source32_to_dest(pix); *dest++ = source32_to_dest(pix);
curu += setup.dudx; curu += setup.dudx;
curv += setup.dvdx; curv += setup.dvdx;
} }
} }
} }
// coloring-only case
else if (is_opaque(prim.color.a)) else if (is_opaque(prim.color.a))
{ {
// coloring-only case u32 sr = u32(256.0f * prim.color.r);
u32 sg = u32(256.0f * prim.color.g);
u32 sb = u32(256.0f * prim.color.b);
// clamp R,G,B to 0-256 range // clamp R,G,B to 0-256 range
u32 const sr = u32(std::clamp(256.0f * prim.color.r, 0.0f, 256.0f)); if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; }
u32 const sg = u32(std::clamp(256.0f * prim.color.g, 0.0f, 256.0f)); if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; }
u32 const sb = u32(std::clamp(256.0f * prim.color.b, 0.0f, 256.0f)); if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; }
// loop over rows // loop over rows
for (s32 y = setup.starty; y < setup.endy; y++) for (s32 y = setup.starty; y < setup.endy; y++)
@ -886,10 +919,10 @@ private:
// loop over cols // loop over cols
for (s32 x = setup.startx; x < setup.endx; x++) for (s32 x = setup.startx; x < setup.endx; x++)
{ {
u32 const pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); const u32 pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv));
u32 const r = (source32_r(pix) * sr) >> 8; const u32 r = (source32_r(pix) * sr) >> 8;
u32 const g = (source32_g(pix) * sg) >> 8; const u32 g = (source32_g(pix) * sg) >> 8;
u32 const b = (source32_b(pix) * sb) >> 8; const u32 b = (source32_b(pix) * sb) >> 8;
*dest++ = dest_assemble_rgb(r, g, b); *dest++ = dest_assemble_rgb(r, g, b);
curu += setup.dudx; curu += setup.dudx;
@ -897,15 +930,20 @@ private:
} }
} }
} }
// alpha and/or coloring case
else if (!is_transparent(prim.color.a)) else if (!is_transparent(prim.color.a))
{ {
// alpha and/or coloring case u32 sr = u32(256.0f * prim.color.r * prim.color.a);
u32 sg = u32(256.0f * prim.color.g * prim.color.a);
u32 sb = u32(256.0f * prim.color.b * prim.color.a);
u32 invsa = u32(256.0f * (1.0f - prim.color.a));
// clamp R,G,B and inverse A to 0-256 range // clamp R,G,B and inverse A to 0-256 range
u32 const sr = u32(std::clamp(256.0f * prim.color.r * prim.color.a, 0.0f, 256.0f)); if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; }
u32 const sg = u32(std::clamp(256.0f * prim.color.g * prim.color.a, 0.0f, 256.0f)); if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; }
u32 const sb = u32(std::clamp(256.0f * prim.color.b * prim.color.a, 0.0f, 256.0f)); if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; }
u32 const invsa = u32(std::clamp(256.0f * (1.0f - prim.color.a), 0.0f, 256.0f)); if (invsa > 0x100) { if (s32(invsa) < 0) invsa = 0; else invsa = 0x100; }
// loop over rows // loop over rows
for (s32 y = setup.starty; y < setup.endy; y++) for (s32 y = setup.starty; y < setup.endy; y++)
@ -917,11 +955,11 @@ private:
// loop over cols // loop over cols
for (s32 x = setup.startx; x < setup.endx; x++) for (s32 x = setup.startx; x < setup.endx; x++)
{ {
u32 const pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); const u32 pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv));
u32 const dpix = NoDestRead ? 0 : *dest; const u32 dpix = NoDestRead ? 0 : *dest;
u32 const r = (source32_r(pix) * sr + dest_r(dpix) * invsa) >> 8; const u32 r = (source32_r(pix) * sr + dest_r(dpix) * invsa) >> 8;
u32 const g = (source32_g(pix) * sg + dest_g(dpix) * invsa) >> 8; const u32 g = (source32_g(pix) * sg + dest_g(dpix) * invsa) >> 8;
u32 const b = (source32_b(pix) * sb + dest_b(dpix) * invsa) >> 8; const u32 b = (source32_b(pix) * sb + dest_b(dpix) * invsa) >> 8;
*dest++ = dest_assemble_rgb(r, g, b); *dest++ = dest_assemble_rgb(r, g, b);
curu += setup.dudx; curu += setup.dudx;
@ -938,16 +976,15 @@ private:
// conversion // conversion
//------------------------------------------------- //-------------------------------------------------
static void draw_quad_yuy16_add(render_primitive const &prim, PixelType *dstdata, u32 pitch, quad_setup_data const &setup) static void draw_quad_yuy16_add(const render_primitive &prim, PixelType *dstdata, u32 pitch, const quad_setup_data&setup)
{ {
// simply can't do this without reading from the dest // simply can't do this without reading from the dest
if constexpr (NoDestRead) if constexpr (NoDestRead)
return; return;
// fast case: no coloring, no alpha
if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a))
{ {
// fast case: no coloring, no alpha
// loop over rows // loop over rows
for (s32 y = setup.starty; y < setup.endy; y++) for (s32 y = setup.starty; y < setup.endy; y++)
{ {
@ -958,8 +995,8 @@ private:
// loop over cols // loop over cols
for (s32 x = setup.startx; x < setup.endx; x++) for (s32 x = setup.startx; x < setup.endx; x++)
{ {
u32 const pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); const u32 pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv));
u32 const dpix = NoDestRead ? 0 : *dest; const u32 dpix = NoDestRead ? 0 : *dest;
u32 r = source32_r(pix) + dest_r(dpix); u32 r = source32_r(pix) + dest_r(dpix);
u32 g = source32_g(pix) + dest_g(dpix); u32 g = source32_g(pix) + dest_g(dpix);
u32 b = source32_b(pix) + dest_b(dpix); u32 b = source32_b(pix) + dest_b(dpix);
@ -972,15 +1009,20 @@ private:
} }
} }
} }
// alpha and/or coloring case
else else
{ {
// alpha and/or coloring case u32 sr = u32(256.0f * prim.color.r);
u32 sg = u32(256.0f * prim.color.g);
u32 sb = u32(256.0f * prim.color.b);
u32 sa = u32(256.0f * prim.color.a);
// clamp R,G,B and inverse A to 0-256 range // clamp R,G,B and inverse A to 0-256 range
u32 const sr = u32(std::clamp(256.0f * prim.color.r, 0.0f, 256.0f)); if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; }
u32 const sg = u32(std::clamp(256.0f * prim.color.g, 0.0f, 256.0f)); if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; }
u32 const sb = u32(std::clamp(256.0f * prim.color.b, 0.0f, 256.0f)); if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; }
u32 const sa = u32(std::clamp(256.0f * prim.color.a, 0.0f, 256.0f)); if (sa > 0x100) { if (s32(sa) < 0) sa = 0; else sa = 0x100; }
// loop over rows // loop over rows
for (s32 y = setup.starty; y < setup.endy; y++) for (s32 y = setup.starty; y < setup.endy; y++)
@ -1122,10 +1164,10 @@ private:
// alpha and/or coloring case // alpha and/or coloring case
// clamp R,G,B and inverse A to 0-256 range // clamp R,G,B and inverse A to 0-256 range
u32 const sr = u32(std::clamp(256.0f * prim.color.r * prim.color.a, 0.0f, 256.0f)); u32 sr = u32(std::clamp(256.0f * prim.color.r * prim.color.a, 0.0f, 256.0f));
u32 const sg = u32(std::clamp(256.0f * prim.color.g * prim.color.a, 0.0f, 256.0f)); u32 sg = u32(std::clamp(256.0f * prim.color.g * prim.color.a, 0.0f, 256.0f));
u32 const sb = u32(std::clamp(256.0f * prim.color.b * prim.color.a, 0.0f, 256.0f)); u32 sb = u32(std::clamp(256.0f * prim.color.b * prim.color.a, 0.0f, 256.0f));
u32 const invsa = u32(std::clamp(256.0f * (1.0f - prim.color.a), 0.0f, 256.0f)); u32 invsa = u32(std::clamp(256.0f * (1.0f - prim.color.a), 0.0f, 256.0f));
// loop over rows // loop over rows
for (s32 y = setup.starty; y < setup.endy; y++) for (s32 y = setup.starty; y < setup.endy; y++)
@ -1727,16 +1769,16 @@ private:
// drawing routine // drawing routine
//------------------------------------------------- //-------------------------------------------------
static void setup_and_draw_textured_quad(render_primitive const &prim, PixelType *dstdata, s32 width, s32 height, u32 pitch) static void setup_and_draw_textured_quad(const render_primitive &prim, PixelType *dstdata, s32 width, s32 height, u32 pitch)
{ {
assert(prim.bounds.x0 <= prim.bounds.x1); assert(prim.bounds.x0 <= prim.bounds.x1);
assert(prim.bounds.y0 <= prim.bounds.y1); assert(prim.bounds.y0 <= prim.bounds.y1);
// determine U/V deltas // determine U/V deltas
float const fdudx = (prim.texcoords.tr.u - prim.texcoords.tl.u) / (prim.bounds.x1 - prim.bounds.x0); float fdudx = (prim.texcoords.tr.u - prim.texcoords.tl.u) / (prim.bounds.x1 - prim.bounds.x0);
float const fdvdx = (prim.texcoords.tr.v - prim.texcoords.tl.v) / (prim.bounds.x1 - prim.bounds.x0); float fdvdx = (prim.texcoords.tr.v - prim.texcoords.tl.v) / (prim.bounds.x1 - prim.bounds.x0);
float const fdudy = (prim.texcoords.bl.u - prim.texcoords.tl.u) / (prim.bounds.y1 - prim.bounds.y0); float fdudy = (prim.texcoords.bl.u - prim.texcoords.tl.u) / (prim.bounds.y1 - prim.bounds.y0);
float const fdvdy = (prim.texcoords.bl.v - prim.texcoords.tl.v) / (prim.bounds.y1 - prim.bounds.y0); float fdvdy = (prim.texcoords.bl.v - prim.texcoords.tl.v) / (prim.bounds.y1 - prim.bounds.y0);
// clamp to integers // clamp to integers
quad_setup_data setup; quad_setup_data setup;
@ -1850,10 +1892,10 @@ private:
//------------------------------------------------- //-------------------------------------------------
public: public:
static void draw_primitives(render_primitive_list const &primlist, void *dstdata, u32 width, u32 height, u32 pitch) static void draw_primitives(const render_primitive_list &primlist, void *dstdata, u32 width, u32 height, u32 pitch)
{ {
// loop over the list and render each element // loop over the list and render each element
for (render_primitive const *prim = primlist.first(); prim != nullptr; prim = prim->next()) for (const render_primitive *prim = primlist.first(); prim != nullptr; prim = prim->next())
switch (prim->type) switch (prim->type)
{ {
case render_primitive::LINE: case render_primitive::LINE:

View File

@ -1246,6 +1246,9 @@ int get_blend_mode(emu::render::detail::view_environment &env, util::xml::data_n
layout_element::make_component_map const layout_element::s_make_component{ layout_element::make_component_map const layout_element::s_make_component{
{ "image", &make_component<image_component> }, { "image", &make_component<image_component> },
{ "text", &make_component<text_component> }, { "text", &make_component<text_component> },
{ "dotmatrix", &make_dotmatrix_component<8> },
{ "dotmatrix5dot", &make_dotmatrix_component<5> },
{ "dotmatrixdot", &make_dotmatrix_component<1> },
{ "simplecounter", &make_component<simplecounter_component> }, { "simplecounter", &make_component<simplecounter_component> },
{ "reel", &make_component<reel_component> }, { "reel", &make_component<reel_component> },
{ "led7seg", &make_component<led7seg_component> }, { "led7seg", &make_component<led7seg_component> },
@ -3076,6 +3079,47 @@ protected:
}; };
// row of dots for a dotmatrix
class layout_element::dotmatrix_component : public component
{
public:
// construction/destruction
dotmatrix_component(int dots, environment &env, util::xml::data_node const &compnode)
: component(env, compnode)
, m_dots(dots)
{
}
protected:
// overrides
virtual int maxstate() const override { return (1 << m_dots) - 1; }
virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override
{
const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff);
const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20);
// sizes for computation
int bmheight = 300;
int dotwidth = 250;
// allocate a temporary bitmap for drawing
bitmap_argb32 tempbitmap(dotwidth*m_dots, bmheight);
tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00));
for (int i = 0; i < m_dots; i++)
draw_segment_decimal(tempbitmap, ((dotwidth / 2) + (i * dotwidth)), bmheight / 2, dotwidth, BIT(state, i) ? onpen : offpen);
// resample to the target size
render_resample_argb_bitmap_hq(dest, tempbitmap, color(state));
}
private:
// internal state
int m_dots;
};
// simple counter // simple counter
class layout_element::simplecounter_component : public component class layout_element::simplecounter_component : public component
{ {
@ -3119,8 +3163,6 @@ public:
, m_searchpath(env.search_path() ? env.search_path() : "") , m_searchpath(env.search_path() ? env.search_path() : "")
, m_dirname(env.directory_name() ? env.directory_name() : "") , m_dirname(env.directory_name() ? env.directory_name() : "")
{ {
osd_printf_warning("Warning: layout file contains deprecated reel component\n");
std::string_view symbollist = env.get_attribute_string(compnode, "symbollist", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15"); std::string_view symbollist = env.get_attribute_string(compnode, "symbollist", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15");
// split out position names from string and figure out our number of symbols // split out position names from string and figure out our number of symbols
@ -3516,6 +3558,18 @@ layout_element::component::ptr layout_element::make_component(environment &env,
} }
//-------------------------------------------------
// make_component - create dotmatrix component
// with given vertical resolution
//-------------------------------------------------
template <int D>
layout_element::component::ptr layout_element::make_dotmatrix_component(environment &env, util::xml::data_node const &compnode)
{
return std::make_unique<dotmatrix_component>(D, env, compnode);
}
//************************************************************************** //**************************************************************************
// LAYOUT ELEMENT TEXTURE // LAYOUT ELEMENT TEXTURE

View File

@ -146,6 +146,7 @@ private:
class led16seg_component; class led16seg_component;
class led14segsc_component; class led14segsc_component;
class led16segsc_component; class led16segsc_component;
class dotmatrix_component;
class simplecounter_component; class simplecounter_component;
class reel_component; class reel_component;

View File

@ -1200,7 +1200,7 @@ void rom_load_manager::normalize_flags_for_device(std::string_view rgntag, u8 &w
/*------------------------------------------------- /*-------------------------------------------------
load_software_part_region - load a software part load_software_part_region - load a software part
This is used by MAME when loading a piece of This is used by MESS when loading a piece of
software. The code should be merged with software. The code should be merged with
process_region_list or updated to use a slight process_region_list or updated to use a slight
more general process_region_list. more general process_region_list.

View File

@ -683,9 +683,9 @@ void screen_device::device_validity_check(validity_checker &valid) const
osd_printf_error("Non-raster display cannot have a variable width\n"); osd_printf_error("Non-raster display cannot have a variable width\n");
} }
// check for invalid frame rate // check for zero frame rate
if (m_refresh == 0 || m_refresh > ATTOSECONDS_PER_SECOND) if (m_refresh == 0)
osd_printf_error("Invalid (under 1Hz) refresh rate\n"); osd_printf_error("Invalid (zero) refresh rate\n");
texture_format texformat = !m_screen_update_ind16.isnull() ? TEXFORMAT_PALETTE16 : TEXFORMAT_RGB32; texture_format texformat = !m_screen_update_ind16.isnull() ? TEXFORMAT_PALETTE16 : TEXFORMAT_RGB32;
if (m_palette.finder_tag() != finder_base::DUMMY_TAG) if (m_palette.finder_tag() != finder_base::DUMMY_TAG)
@ -1108,7 +1108,7 @@ void screen_device::realloc_screen_bitmaps()
s32 effwidth = std::max(per_scanline ? m_max_width : m_width, m_visarea.right() + 1); s32 effwidth = std::max(per_scanline ? m_max_width : m_width, m_visarea.right() + 1);
s32 effheight = std::max(m_height, m_visarea.bottom() + 1); s32 effheight = std::max(m_height, m_visarea.bottom() + 1);
// resize all registered screen bitmaps // reize all registered screen bitmaps
for (auto &item : m_auto_bitmap_list) for (auto &item : m_auto_bitmap_list)
item->m_bitmap.resize(effwidth, effheight); item->m_bitmap.resize(effwidth, effheight);
@ -1870,7 +1870,7 @@ void screen_device::finalize_burnin()
m_visarea.top() * m_burnin.height() / m_height, m_visarea.top() * m_burnin.height() / m_height,
m_visarea.bottom() * m_burnin.height() / m_height); m_visarea.bottom() * m_burnin.height() / m_height);
// wrap a bitmap around the subregion we care about // wrap a bitmap around the memregion we care about
bitmap_argb32 finalmap(scaledvis.width(), scaledvis.height()); bitmap_argb32 finalmap(scaledvis.width(), scaledvis.height());
int srcwidth = m_burnin.width(); int srcwidth = m_burnin.width();
int srcheight = m_burnin.height(); int srcheight = m_burnin.height();

View File

@ -2292,9 +2292,8 @@ void validity_checker::validate_analog_input_field(const ioport_field &field)
void validity_checker::validate_dip_settings(const ioport_field &field) void validity_checker::validate_dip_settings(const ioport_field &field)
{ {
char const *const demo_sounds = ioport_string_from_index(INPUT_STRING_Demo_Sounds); const char *demo_sounds = ioport_string_from_index(INPUT_STRING_Demo_Sounds);
char const *const flipscreen = ioport_string_from_index(INPUT_STRING_Flip_Screen); const char *flipscreen = ioport_string_from_index(INPUT_STRING_Flip_Screen);
char const *const name = field.specific_name();
u8 coin_list[__input_string_coinage_end + 1 - __input_string_coinage_start] = { 0 }; u8 coin_list[__input_string_coinage_end + 1 - __input_string_coinage_start] = { 0 };
bool coin_error = false; bool coin_error = false;
@ -2307,15 +2306,15 @@ void validity_checker::validate_dip_settings(const ioport_field &field)
coin_list[strindex - __input_string_coinage_start] = 1; coin_list[strindex - __input_string_coinage_start] = 1;
// make sure demo sounds default to on // make sure demo sounds default to on
if (name == demo_sounds && strindex == INPUT_STRING_On && field.defvalue() != setting->value()) if (field.name() == demo_sounds && strindex == INPUT_STRING_On && field.defvalue() != setting->value())
osd_printf_error("Demo Sounds must default to On\n"); osd_printf_error("Demo Sounds must default to On\n");
// check for bad demo sounds options // check for bad demo sounds options
if (name == demo_sounds && (strindex == INPUT_STRING_Yes || strindex == INPUT_STRING_No)) if (field.name() == demo_sounds && (strindex == INPUT_STRING_Yes || strindex == INPUT_STRING_No))
osd_printf_error("Demo Sounds option must be Off/On, not %s\n", setting->name()); osd_printf_error("Demo Sounds option must be Off/On, not %s\n", setting->name());
// check for bad flip screen options // check for bad flip screen options
if (name == flipscreen && (strindex == INPUT_STRING_Yes || strindex == INPUT_STRING_No)) if (field.name() == flipscreen && (strindex == INPUT_STRING_Yes || strindex == INPUT_STRING_No))
osd_printf_error("Flip Screen option must be Off/On, not %s\n", setting->name()); osd_printf_error("Flip Screen option must be Off/On, not %s\n", setting->name());
// if we have a neighbor, compare ourselves to him // if we have a neighbor, compare ourselves to him
@ -2325,21 +2324,21 @@ void validity_checker::validate_dip_settings(const ioport_field &field)
// check for inverted off/on DIP switch order // check for inverted off/on DIP switch order
int next_strindex = get_defstr_index(nextsetting->name(), true); int next_strindex = get_defstr_index(nextsetting->name(), true);
if (strindex == INPUT_STRING_On && next_strindex == INPUT_STRING_Off) if (strindex == INPUT_STRING_On && next_strindex == INPUT_STRING_Off)
osd_printf_error("%s option must have Off/On options in the order: Off, On\n", name); osd_printf_error("%s option must have Off/On options in the order: Off, On\n", field.name());
// check for inverted yes/no DIP switch order // check for inverted yes/no DIP switch order
else if (strindex == INPUT_STRING_Yes && next_strindex == INPUT_STRING_No) else if (strindex == INPUT_STRING_Yes && next_strindex == INPUT_STRING_No)
osd_printf_error("%s option must have Yes/No options in the order: No, Yes\n", name); osd_printf_error("%s option must have Yes/No options in the order: No, Yes\n", field.name());
// check for inverted upright/cocktail DIP switch order // check for inverted upright/cocktail DIP switch order
else if (strindex == INPUT_STRING_Cocktail && next_strindex == INPUT_STRING_Upright) else if (strindex == INPUT_STRING_Cocktail && next_strindex == INPUT_STRING_Upright)
osd_printf_error("%s option must have Upright/Cocktail options in the order: Upright, Cocktail\n", name); osd_printf_error("%s option must have Upright/Cocktail options in the order: Upright, Cocktail\n", field.name());
// check for proper coin ordering // check for proper coin ordering
else if (strindex >= __input_string_coinage_start && strindex <= __input_string_coinage_end && next_strindex >= __input_string_coinage_start && next_strindex <= __input_string_coinage_end && else if (strindex >= __input_string_coinage_start && strindex <= __input_string_coinage_end && next_strindex >= __input_string_coinage_start && next_strindex <= __input_string_coinage_end &&
strindex >= next_strindex && setting->condition() == nextsetting->condition()) strindex >= next_strindex && setting->condition() == nextsetting->condition())
{ {
osd_printf_error("%s option has unsorted coinage %s > %s\n", name, setting->name(), nextsetting->name()); osd_printf_error("%s option has unsorted coinage %s > %s\n", field.name(), setting->name(), nextsetting->name());
coin_error = true; coin_error = true;
} }
} }
@ -2468,6 +2467,9 @@ void validity_checker::validate_inputs(device_t &root)
// check for invalid UTF-8 // check for invalid UTF-8
if (!utf8_is_valid_string(name)) if (!utf8_is_valid_string(name))
osd_printf_error("Field '%s' has invalid characters\n", name); osd_printf_error("Field '%s' has invalid characters\n", name);
// look up the string and print an error if default strings are not used
/*strindex =get_defstr_index(defstr_map, name, driver, &error);*/
} }
// verify conditions on the field // verify conditions on the field

View File

@ -327,7 +327,6 @@ const double XTAL::known_xtals[] = {
22'464'000, /* 22.464_MHz_XTAL CIT-101 132-column display clock */ 22'464'000, /* 22.464_MHz_XTAL CIT-101 132-column display clock */
22'579'000, /* 22.579_MHz_XTAL Sega System H1 SCSP clock */ 22'579'000, /* 22.579_MHz_XTAL Sega System H1 SCSP clock */
22'656'000, /* 22.656_MHz_XTAL Super Pinball Action (~1440x NTSC line rate) */ 22'656'000, /* 22.656_MHz_XTAL Super Pinball Action (~1440x NTSC line rate) */
22'680'000, /* 22.680_MHz_XTAL HDS200 80-columns display clock */
22'896'000, /* 22.896_MHz_XTAL DEC VT220 132-column display clock */ 22'896'000, /* 22.896_MHz_XTAL DEC VT220 132-column display clock */
23'200'000, /* 23.2_MHz_XTAL Roland JV-80 & JV-880 PCM clock */ 23'200'000, /* 23.2_MHz_XTAL Roland JV-80 & JV-880 PCM clock */
23'814'000, /* 23.814_MHz_XTAL TeleVideo TVI-912, 920 & 950 */ 23'814'000, /* 23.814_MHz_XTAL TeleVideo TVI-912, 920 & 950 */
@ -403,7 +402,6 @@ const double XTAL::known_xtals[] = {
34'000'000, /* 34_MHz_XTAL Gaelco PCBs */ 34'000'000, /* 34_MHz_XTAL Gaelco PCBs */
34'291'712, /* 34.291712_MHz_XTAL Fairlight CMI master card */ 34'291'712, /* 34.291712_MHz_XTAL Fairlight CMI master card */
34'846'000, /* 34.846_MHz_XTAL Visual 550 */ 34'846'000, /* 34.846_MHz_XTAL Visual 550 */
35'640'000, /* 35.640_MHz_XTAL HDS200 132-column display clock */
35'834'400, /* 35.8344_MHz_XTAL Tab Products E-22 132-column display clock */ 35'834'400, /* 35.8344_MHz_XTAL Tab Products E-22 132-column display clock */
35'840'000, /* 35.84_MHz_XTAL Akai MPC 60 voice PCB */ 35'840'000, /* 35.84_MHz_XTAL Akai MPC 60 voice PCB */
35'904'000, /* 35.904_MHz_XTAL Used on HP98543 graphics board */ 35'904'000, /* 35.904_MHz_XTAL Used on HP98543 graphics board */

View File

@ -418,10 +418,6 @@ cheat_script::script_entry::script_entry(
if (!expression || !expression[0]) if (!expression || !expression[0])
throw emu_fatalerror("%s.xml(%d): missing expression in action tag\n", filename, entrynode.line); throw emu_fatalerror("%s.xml(%d): missing expression in action tag\n", filename, entrynode.line);
m_expression.parse(expression); m_expression.parse(expression);
// initialise these to defautlt values
m_line = 0;
m_justify = ui::text_layout::text_justify::LEFT;
} }
else else
{ {
@ -1060,9 +1056,6 @@ constexpr int cheat_manager::CHEAT_VERSION;
cheat_manager::cheat_manager(running_machine &machine) cheat_manager::cheat_manager(running_machine &machine)
: m_machine(machine) : m_machine(machine)
, m_framecount(0)
, m_numlines(0)
, m_lastline(0)
, m_disabled(true) , m_disabled(true)
, m_symtable(machine) , m_symtable(machine)
{ {

View File

@ -110,7 +110,7 @@ void output_footer(std::ostream &out);
void output_one(std::ostream &out, driver_enumerator &drivlist, const game_driver &driver, device_type_set *devtypes); void output_one(std::ostream &out, driver_enumerator &drivlist, const game_driver &driver, device_type_set *devtypes);
void output_sampleof(std::ostream &out, device_t &device); void output_sampleof(std::ostream &out, device_t &device);
void output_bios(std::ostream &out, device_t const &device); void output_bios(std::ostream &out, device_t const &device);
void output_rom(std::ostream &out, machine_config &config, driver_list const *drivlist, const game_driver *driver, device_t &device); void output_rom(std::ostream &out, machine_config &config, driver_enumerator *drivlist, const game_driver *driver, device_t &device);
void output_device_refs(std::ostream &out, device_t &root); void output_device_refs(std::ostream &out, device_t &root);
void output_sample(std::ostream &out, device_t &device); void output_sample(std::ostream &out, device_t &device);
void output_chips(std::ostream &out, device_t &device, const char *root_tag); void output_chips(std::ostream &out, device_t &device, const char *root_tag);
@ -131,7 +131,7 @@ void output_ramoptions(std::ostream &out, device_t &root);
void output_one_device(std::ostream &out, machine_config &config, device_t &device, const char *devtag); void output_one_device(std::ostream &out, machine_config &config, device_t &device, const char *devtag);
void output_devices(std::ostream &out, emu_options &lookup_options, device_type_set const *filter); void output_devices(std::ostream &out, emu_options &lookup_options, device_type_set const *filter);
char const *get_merge_name(driver_list const &drivlist, game_driver const &driver, util::hash_collection const &romhashes); char const *get_merge_name(driver_enumerator &drivlist, game_driver const &driver, util::hash_collection const &romhashes);
char const *get_merge_name(machine_config &config, device_t const &device, util::hash_collection const &romhashes); char const *get_merge_name(machine_config &config, device_t const &device, util::hash_collection const &romhashes);
char const *get_merge_name(tiny_rom_entry const *roms, util::hash_collection const &romhashes); char const *get_merge_name(tiny_rom_entry const *roms, util::hash_collection const &romhashes);
@ -982,7 +982,7 @@ void output_bios(std::ostream &out, device_t const &device)
// the XML output // the XML output
//------------------------------------------------- //-------------------------------------------------
void output_rom(std::ostream &out, machine_config &config, driver_list const *drivlist, const game_driver *driver, device_t &device) void output_rom(std::ostream &out, machine_config &config, driver_enumerator *drivlist, const game_driver *driver, device_t &device)
{ {
enum class type { BIOS, NORMAL, DISK }; enum class type { BIOS, NORMAL, DISK };
std::map<u32, char const *> biosnames; std::map<u32, char const *> biosnames;
@ -1053,7 +1053,7 @@ void output_rom(std::ostream &out, machine_config &config, driver_list const *dr
if ((type::DISK == pass) != is_disk) if ((type::DISK == pass) != is_disk)
continue; continue;
// BIOS ROMs only apply to BIOSes // BIOS ROMs only apply to bioses
// FIXME: disk images associated with a system BIOS will never be listed // FIXME: disk images associated with a system BIOS will never be listed
u32 const biosno(ROM_GETBIOSFLAGS(rom)); u32 const biosno(ROM_GETBIOSFLAGS(rom));
if ((type::BIOS == pass) != bool(biosno)) if ((type::BIOS == pass) != bool(biosno))
@ -1824,7 +1824,7 @@ void output_switches(std::ostream &out, const ioport_list &portlist, const char
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length()); newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
// output the switch name information // output the switch name information
std::string const normalized_field_name(normalize_string(field.specific_name())); std::string const normalized_field_name(normalize_string(field.name()));
std::string const normalized_newtag(normalize_string(newtag)); std::string const normalized_newtag(normalize_string(newtag));
util::stream_format(out, "\t\t<%s name=\"%s\" tag=\"%s\" mask=\"%u\">\n", outertag, normalized_field_name, normalized_newtag, field.mask()); util::stream_format(out, "\t\t<%s name=\"%s\" tag=\"%s\" mask=\"%u\">\n", outertag, normalized_field_name, normalized_newtag, field.mask());
if (!field.condition().none()) if (!field.condition().none())
@ -1894,7 +1894,7 @@ void output_adjusters(std::ostream &out, const ioport_list &portlist)
for (ioport_field const &field : port.second->fields()) for (ioport_field const &field : port.second->fields())
if (field.type() == IPT_ADJUSTER) if (field.type() == IPT_ADJUSTER)
{ {
util::stream_format(out, "\t\t<adjuster name=\"%s\" default=\"%d\"/>\n", normalize_string(field.specific_name()), field.defvalue()); util::stream_format(out, "\t\t<adjuster name=\"%s\" default=\"%d\"/>\n", normalize_string(field.name()), field.defvalue());
} }
} }
@ -2169,7 +2169,7 @@ void output_ramoptions(std::ostream &out, device_t &root)
// parent set // parent set
//------------------------------------------------- //-------------------------------------------------
char const *get_merge_name(driver_list const &drivlist, game_driver const &driver, util::hash_collection const &romhashes) char const *get_merge_name(driver_enumerator &drivlist, game_driver const &driver, util::hash_collection const &romhashes)
{ {
char const *result = nullptr; char const *result = nullptr;

View File

@ -100,7 +100,7 @@ void lua_engine::initialize_debug(sol::table &emu)
debugger_type["consolelog"] = sol::property([] (debugger_manager &debug) { return wrap_textbuf(debug.console().get_console_textbuf()); }); debugger_type["consolelog"] = sol::property([] (debugger_manager &debug) { return wrap_textbuf(debug.console().get_console_textbuf()); });
debugger_type["errorlog"] = sol::property([](debugger_manager &debug) { return wrap_textbuf(debug.console().get_errorlog_textbuf()); }); debugger_type["errorlog"] = sol::property([](debugger_manager &debug) { return wrap_textbuf(debug.console().get_errorlog_textbuf()); });
debugger_type["visible_cpu"] = sol::property( debugger_type["visible_cpu"] = sol::property(
[](debugger_manager &debug) { return debug.console().get_visible_cpu(); }, [](debugger_manager &debug) { debug.console().get_visible_cpu(); },
[](debugger_manager &debug, device_t &dev) { debug.console().set_visible_cpu(&dev); }); [](debugger_manager &debug, device_t &dev) { debug.console().set_visible_cpu(&dev); });
debugger_type["execution_state"] = sol::property( debugger_type["execution_state"] = sol::property(
[] (debugger_manager &debug) { return debug.cpu().is_stopped() ? "stop" : "run"; }, [] (debugger_manager &debug) { return debug.cpu().is_stopped() ? "stop" : "run"; },

View File

@ -95,7 +95,7 @@ void menu_audit::custom_render(void *selectedref, float top, float bottom, float
std::size_t const total(m_fast ? m_unavailable : m_availablesorted.size()); std::size_t const total(m_fast ? m_unavailable : m_availablesorted.size());
std::ostringstream text; std::ostringstream text;
util::stream_format(text, util::stream_format(text,
_("Auditing media for machine %2$u of %3$u...\n%1$s"), _("Auditing ROMs for machine %2$u of %3$u...\n%1$s"),
system ? std::string_view(system->description) : std::string_view(), system ? std::string_view(system->description) : std::string_view(),
(std::min)(audited + 1, total), (std::min)(audited + 1, total),
total); total);
@ -133,8 +133,8 @@ bool menu_audit::custom_ui_cancel()
void menu_audit::populate(float &customtop, float &custombottom) void menu_audit::populate(float &customtop, float &custombottom)
{ {
if (m_unavailable && (m_availablesorted.size() != m_unavailable)) if (m_unavailable && (m_availablesorted.size() != m_unavailable))
item_append(util::string_format(_("Audit media for %1$u machines marked unavailable"), m_unavailable), 0, ITEMREF_START_FAST); item_append(util::string_format(_("Audit ROMs for %1$u machines marked unavailable"), m_unavailable), 0, ITEMREF_START_FAST);
item_append(util::string_format(_("Audit media for all %1$u machines"), m_availablesorted.size()), 0, ITEMREF_START_FULL); item_append(util::string_format(_("Audit ROMs for all %1$u machines"), m_availablesorted.size()), 0, ITEMREF_START_FULL);
item_append(menu_item_type::SEPARATOR, 0); item_append(menu_item_type::SEPARATOR, 0);
custombottom = (ui().get_line_height() * 1.0f) + (ui().box_tb_border() * 3.0f); custombottom = (ui().get_line_height() * 1.0f) + (ui().box_tb_border() * 3.0f);
} }

View File

@ -83,10 +83,10 @@ menu_custom_ui::menu_custom_ui(mame_ui_manager &mui, render_container &container
} }
//------------------------------------------------- //-------------------------------------------------
// menu dismissed // dtor
//------------------------------------------------- //-------------------------------------------------
void menu_custom_ui::menu_dismissed() menu_custom_ui::~menu_custom_ui()
{ {
ui().options().set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE); ui().options().set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE);
@ -375,10 +375,10 @@ void menu_font_ui::list()
} }
//------------------------------------------------- //-------------------------------------------------
// menu dismissed // dtor
//------------------------------------------------- //-------------------------------------------------
void menu_font_ui::menu_dismissed() menu_font_ui::~menu_font_ui()
{ {
if (m_changed) if (m_changed)
{ {
@ -580,10 +580,10 @@ menu_colors_ui::menu_colors_ui(mame_ui_manager &mui, render_container &container
} }
//------------------------------------------------- //-------------------------------------------------
// menu dismissed // dtor
//------------------------------------------------- //-------------------------------------------------
void menu_colors_ui::menu_dismissed() menu_colors_ui::~menu_colors_ui()
{ {
std::string dec_color; std::string dec_color;
for (int index = 1; index < MUI_RESTORE; index++) for (int index = 1; index < MUI_RESTORE; index++)
@ -607,7 +607,7 @@ void menu_colors_ui::handle(event const *ev)
{ {
if ((uintptr_t)ev->itemref != MUI_RESTORE) if ((uintptr_t)ev->itemref != MUI_RESTORE)
{ {
menu::stack_push<menu_rgb_ui>(ui(), container(), &m_color_table[(uintptr_t)ev->itemref].color, std::string(selected_item().text())); menu::stack_push<menu_rgb_ui>(ui(), container(), &m_color_table[(uintptr_t)ev->itemref].color, selected_item().text());
} }
else else
{ {
@ -803,17 +803,25 @@ void menu_colors_ui::restore_colors()
// ctor // ctor
//------------------------------------------------- //-------------------------------------------------
menu_rgb_ui::menu_rgb_ui(mame_ui_manager &mui, render_container &container, rgb_t *color, std::string &&title) menu_rgb_ui::menu_rgb_ui(mame_ui_manager &mui, render_container &container, rgb_t *_color, std::string _title)
: menu(mui, container) : menu(mui, container),
, m_color(color) m_color(_color),
, m_search() m_search(),
, m_key_active(false) m_key_active(false),
, m_lock_ref(0) m_lock_ref(0),
, m_title(std::move(title)) m_title(_title)
{ {
set_process_flags(PROCESS_LR_REPEAT); set_process_flags(PROCESS_LR_REPEAT);
} }
//-------------------------------------------------
// dtor
//-------------------------------------------------
menu_rgb_ui::~menu_rgb_ui()
{
}
//------------------------------------------------- //-------------------------------------------------
// handle // handle
//------------------------------------------------- //-------------------------------------------------
@ -1103,6 +1111,14 @@ menu_palette_sel::menu_palette_sel(mame_ui_manager &mui, render_container &conta
{ {
} }
//-------------------------------------------------
// dtor
//-------------------------------------------------
menu_palette_sel::~menu_palette_sel()
{
}
//------------------------------------------------- //-------------------------------------------------
// handle // handle
//------------------------------------------------- //-------------------------------------------------

View File

@ -28,10 +28,10 @@ class menu_custom_ui : public menu
{ {
public: public:
menu_custom_ui(mame_ui_manager &mui, render_container &container, std::function<void ()> &&handler); menu_custom_ui(mame_ui_manager &mui, render_container &container, std::function<void ()> &&handler);
virtual ~menu_custom_ui() override;
protected: protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void menu_dismissed() override;
private: private:
virtual void populate(float &customtop, float &custombottom) override; virtual void populate(float &customtop, float &custombottom) override;
@ -55,10 +55,10 @@ class menu_font_ui : public menu
{ {
public: public:
menu_font_ui(mame_ui_manager &mui, render_container &container, std::function<void (bool)> &&handler); menu_font_ui(mame_ui_manager &mui, render_container &container, std::function<void (bool)> &&handler);
virtual ~menu_font_ui() override;
protected: protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void menu_dismissed() override;
private: private:
virtual void populate(float &customtop, float &custombottom) override; virtual void populate(float &customtop, float &custombottom) override;
@ -89,10 +89,10 @@ class menu_colors_ui : public menu
{ {
public: public:
menu_colors_ui(mame_ui_manager &mui, render_container &container); menu_colors_ui(mame_ui_manager &mui, render_container &container);
virtual ~menu_colors_ui() override;
protected: protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void menu_dismissed() override;
private: private:
enum enum
@ -136,7 +136,8 @@ private:
class menu_rgb_ui : public menu class menu_rgb_ui : public menu
{ {
public: public:
menu_rgb_ui(mame_ui_manager &mui, render_container &container, rgb_t *color, std::string &&title); menu_rgb_ui(mame_ui_manager &mui, render_container &container, rgb_t *_color, std::string _title);
virtual ~menu_rgb_ui() override;
protected: protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
@ -171,6 +172,7 @@ class menu_palette_sel : public menu
{ {
public: public:
menu_palette_sel(mame_ui_manager &mui, render_container &container, rgb_t &_color); menu_palette_sel(mame_ui_manager &mui, render_container &container, rgb_t &_color);
virtual ~menu_palette_sel() override;
private: private:
virtual void populate(float &customtop, float &custombottom) override; virtual void populate(float &customtop, float &custombottom) override;

View File

@ -120,16 +120,10 @@ void menu_device_config::populate_text(std::optional<text_layout> &layout, float
} }
else else
{ {
const u32 rate = u32(screen.frame_period().as_hz() * 1'000'000 + 0.5); std::string hz(std::to_string(float(screen.frame_period().as_hz())));
const bool valid = rate >= 1'000'000; size_t last = hz.find_last_not_of('0');
std::string hz(valid ? std::to_string(rate) : "?"); size_t dpos = hz.find_last_of('.');
if (valid) hz = hz.substr(0, last + (last != dpos ? 1 : 0));
{
size_t dpos = hz.length() - 6;
hz.insert(dpos, ".");
size_t last = hz.find_last_not_of('0');
hz = hz.substr(0, last + (last != dpos ? 1 : 0));
}
const rectangle &visarea = screen.visible_area(); const rectangle &visarea = screen.visible_area();
layout->add_text( layout->add_text(

View File

@ -61,11 +61,10 @@ private:
struct file_selector_entry struct file_selector_entry
{ {
file_selector_entry() = default; file_selector_entry() { }
file_selector_entry(file_selector_entry &&) = default; file_selector_entry(file_selector_entry &&) = default;
file_selector_entry &operator=(file_selector_entry &&) = default; file_selector_entry &operator=(file_selector_entry &&) = default;
file_selector_entry_type type;
file_selector_entry_type type = SELECTOR_ENTRY_TYPE_EMPTY;
std::string basename; std::string basename;
std::string fullpath; std::string fullpath;
}; };

View File

@ -464,16 +464,10 @@ std::string machine_info::game_info_string() const
detail = _("Vector"); detail = _("Vector");
else else
{ {
const u32 rate = u32(screen.frame_period().as_hz() * 1'000'000 + 0.5); std::string hz(std::to_string(float(screen.frame_period().as_hz())));
const bool valid = rate >= 1'000'000; size_t last = hz.find_last_not_of('0');
std::string hz(valid ? std::to_string(rate) : "?"); size_t dpos = hz.find_last_of('.');
if (valid) hz = hz.substr(0, last + (last != dpos ? 1 : 0));
{
size_t dpos = hz.length() - 6;
hz.insert(dpos, ".");
size_t last = hz.find_last_not_of('0');
hz = hz.substr(0, last + (last != dpos ? 1 : 0));
}
const rectangle &visarea = screen.visible_area(); const rectangle &visarea = screen.visible_area();
detail = string_format("%d " UTF8_MULTIPLY " %d (%s) %s" UTF8_NBSP "Hz", detail = string_format("%d " UTF8_MULTIPLY " %d (%s) %s" UTF8_NBSP "Hz",

View File

@ -78,30 +78,26 @@ void menu_input_general::populate(float &customtop, float &custombottom)
for (const input_type_entry &entry : machine().ioport().types()) for (const input_type_entry &entry : machine().ioport().types())
{ {
// add if we match the group and we have a valid name // add if we match the group and we have a valid name
if (entry.group() == group) if ((entry.group() == group) && entry.name() && entry.name()[0])
{ {
std::string name = entry.name(); // loop over all sequence types
if (!name.empty()) for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype)
{ {
// loop over all sequence types // build an entry for the standard sequence
for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype) input_item_data &item(data.emplace_back());
{ item.ref = &entry;
// build an entry for the standard sequence item.seqtype = seqtype;
input_item_data &item(data.emplace_back()); item.seq = machine().ioport().type_seq(entry.type(), entry.player(), seqtype);
item.ref = &entry; item.defseq = &entry.defseq(seqtype);
item.seqtype = seqtype; item.group = entry.group();
item.seq = machine().ioport().type_seq(entry.type(), entry.player(), seqtype); item.type = ioport_manager::type_is_analog(entry.type()) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
item.defseq = &entry.defseq(seqtype); item.is_optional = false;
item.group = entry.group(); item.name = _("input-name", entry.name());
item.type = ioport_manager::type_is_analog(entry.type()) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; item.owner = nullptr;
item.is_optional = false;
item.name = name;
item.owner = nullptr;
// stop after one, unless we're analog // stop after one, unless we're analog
if (item.type == INPUT_TYPE_DIGITAL) if (item.type == INPUT_TYPE_DIGITAL)
break; break;
}
} }
} }
} }
@ -169,7 +165,7 @@ void menu_input_specific::populate(float &customtop, float &custombottom)
item.group = machine().ioport().type_group(field.type(), field.player()); item.group = machine().ioport().type_group(field.type(), field.player());
item.type = field.is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; item.type = field.is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
item.is_optional = field.optional(); item.is_optional = field.optional();
item.name = field.name(); item.name = _("input-name", field.name());
item.owner = &field.device(); item.owner = &field.device();
// stop after one, unless we're analog // stop after one, unless we're analog
@ -207,7 +203,7 @@ void menu_input_specific::populate(float &customtop, float &custombottom)
return true; return true;
if (!codes2.empty() && (codes1.empty() || codes1[0] > codes2[0])) if (!codes2.empty() && (codes1.empty() || codes1[0] > codes2[0]))
return false; return false;
cmp = i1.name.compare(i2.name); cmp = strcmp(i1.name, i2.name);
if (cmp < 0) if (cmp < 0)
return true; return true;
if (cmp > 0) if (cmp > 0)

View File

@ -54,7 +54,7 @@ protected:
input_seq_type seqtype = SEQ_TYPE_INVALID; // sequence type input_seq_type seqtype = SEQ_TYPE_INVALID; // sequence type
input_seq seq; // copy of the live sequence input_seq seq; // copy of the live sequence
const input_seq * defseq = nullptr; // pointer to the default sequence const input_seq * defseq = nullptr; // pointer to the default sequence
std::string name; // base name of the item const char * name = nullptr; // pointer to the base name of the item
const device_t * owner = nullptr; // pointer to the owner of the item const device_t * owner = nullptr; // pointer to the owner of the item
ioport_group group = IPG_INVALID; // group type ioport_group group = IPG_INVALID; // group type
uint8_t type = 0U; // type of port uint8_t type = 0U; // type of port

View File

@ -120,7 +120,7 @@ void menu_main::populate(float &customtop, float &custombottom)
item_append(_("Input (general)"), 0, (void *)INPUT_GROUPS); item_append(_("Input (general)"), 0, (void *)INPUT_GROUPS);
item_append(_("Input (this machine)"), 0, (void *)INPUT_SPECIFIC); item_append(_("Input (this Machine)"), 0, (void *)INPUT_SPECIFIC);
if (ui().machine_info().has_analog()) if (ui().machine_info().has_analog())
item_append(_("Analog Controls"), 0, (void *)ANALOG); item_append(_("Analog Controls"), 0, (void *)ANALOG);
@ -152,7 +152,7 @@ void menu_main::populate(float &customtop, float &custombottom)
item_append(_("Tape Control"), 0, (void *)TAPE_CONTROL); item_append(_("Tape Control"), 0, (void *)TAPE_CONTROL);
if (pty_interface_enumerator(machine().root_device()).first() != nullptr) if (pty_interface_enumerator(machine().root_device()).first() != nullptr)
item_append(_("Pseudo Terminals"), 0, (void *)PTY_INFO); item_append(_("Pseudo terminals"), 0, (void *)PTY_INFO);
if (ui().machine_info().has_bioses()) if (ui().machine_info().has_bioses())
item_append(_("BIOS Selection"), 0, (void *)BIOS_SELECTION); item_append(_("BIOS Selection"), 0, (void *)BIOS_SELECTION);
@ -197,7 +197,7 @@ void menu_main::populate(float &customtop, float &custombottom)
item_append(menu_item_type::SEPARATOR); item_append(menu_item_type::SEPARATOR);
item_append(string_format(_("About %1$s"), emulator_info::get_appname()), 0, (void *)ABOUT); item_append(string_format(_("About %s"), emulator_info::get_appname()), 0, (void *)ABOUT);
item_append(menu_item_type::SEPARATOR); item_append(menu_item_type::SEPARATOR);

View File

@ -480,8 +480,6 @@ void menu::draw(uint32_t flags)
// add in width of right hand side // add in width of right hand side
if (!pitem.subtext().empty()) if (!pitem.subtext().empty())
total_width += 2.0f * gutter_width + ui().get_string_width(pitem.subtext()); total_width += 2.0f * gutter_width + ui().get_string_width(pitem.subtext());
else if (pitem.flags() & FLAG_UI_HEADING)
total_width += 4.0f * ud_arrow_width;
// track the maximum // track the maximum
if (total_width > visible_width) if (total_width > visible_width)

View File

@ -2768,7 +2768,7 @@ void menu_select_launch::infos_render(float origx1, float origy1, float origx2,
} }
else else
{ {
m_info_buffer.clear(); m_info_buffer = "";
mame_machine_manager::instance()->lua()->call_plugin("data", m_info_view - 1, m_info_buffer); mame_machine_manager::instance()->lua()->call_plugin("data", m_info_view - 1, m_info_buffer);
} }
} }
@ -3057,9 +3057,9 @@ void menu_select_launch::general_info(ui_system_info const *system, game_driver
// if everything looks good, schedule the new driver // if everything looks good, schedule the new driver
if (audit_passed(summary)) if (audit_passed(summary))
str << _("Media Audit Result\tOK\n"); str << _("ROM Audit Result\tOK\n");
else else
str << _("Media Audit Result\tBAD\n"); str << _("ROM Audit Result\tBAD\n");
if (summary_samples == media_auditor::NONE_NEEDED) if (summary_samples == media_auditor::NONE_NEEDED)
str << _("Samples Audit Result\tNone Needed\n"); str << _("Samples Audit Result\tNone Needed\n");
@ -3070,10 +3070,10 @@ void menu_select_launch::general_info(ui_system_info const *system, game_driver
} }
else else
{ {
str << _("Media Audit\tDisabled\nSamples Audit\tDisabled\n"); str << _("ROM Audit \tDisabled\nSamples Audit \tDisabled\n");
} }
buffer = std::move(str).str(); buffer = str.str();
} }
} // namespace ui } // namespace ui

View File

@ -45,25 +45,29 @@ menu_sound_options::menu_sound_options(mame_ui_manager &mui, render_container &c
} }
//------------------------------------------------- //-------------------------------------------------
// menu_dismissed // dtor
//------------------------------------------------- //-------------------------------------------------
void menu_sound_options::menu_dismissed() menu_sound_options::~menu_sound_options()
{ {
emu_options &moptions = machine().options(); emu_options &moptions = machine().options();
if (strcmp(moptions.value(OSDOPTION_SOUND), m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE)) if (strcmp(moptions.value(OSDOPTION_SOUND), m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE) != 0)
{
moptions.set_value(OSDOPTION_SOUND, m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE, OPTION_PRIORITY_CMDLINE); moptions.set_value(OSDOPTION_SOUND, m_sound ? OSDOPTVAL_AUTO : OSDOPTVAL_NONE, OPTION_PRIORITY_CMDLINE);
}
if (moptions.bool_value(OPTION_COMPRESSOR) != m_compressor) if (moptions.bool_value(OPTION_COMPRESSOR) != m_compressor)
{
moptions.set_value(OPTION_COMPRESSOR, m_compressor, OPTION_PRIORITY_CMDLINE); moptions.set_value(OPTION_COMPRESSOR, m_compressor, OPTION_PRIORITY_CMDLINE);
}
if (moptions.int_value(OPTION_SAMPLERATE) != m_sound_rate[m_cur_rates]) if (moptions.int_value(OPTION_SAMPLERATE) != m_sound_rate[m_cur_rates])
{
moptions.set_value(OPTION_SAMPLERATE, m_sound_rate[m_cur_rates], OPTION_PRIORITY_CMDLINE); moptions.set_value(OPTION_SAMPLERATE, m_sound_rate[m_cur_rates], OPTION_PRIORITY_CMDLINE);
}
if (moptions.bool_value(OPTION_SAMPLES) != m_samples) if (moptions.bool_value(OPTION_SAMPLES) != m_samples)
{
moptions.set_value(OPTION_SAMPLES, m_samples, OPTION_PRIORITY_CMDLINE); moptions.set_value(OPTION_SAMPLES, m_samples, OPTION_PRIORITY_CMDLINE);
}
} }
//------------------------------------------------- //-------------------------------------------------

View File

@ -25,10 +25,10 @@ class menu_sound_options : public menu
{ {
public: public:
menu_sound_options(mame_ui_manager &mui, render_container &container); menu_sound_options(mame_ui_manager &mui, render_container &container);
virtual ~menu_sound_options() override;
protected: protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void menu_dismissed() override;
private: private:
enum enum

View File

@ -36,12 +36,12 @@ std::vector<submenu::option> submenu::misc_options()
{ option_type::UI, N_("Enlarge images in the right panel"), OPTION_ENLARGE_SNAPS }, { option_type::UI, N_("Enlarge images in the right panel"), OPTION_ENLARGE_SNAPS },
{ option_type::EMU, N_("Cheats"), OPTION_CHEAT }, { option_type::EMU, N_("Cheats"), OPTION_CHEAT },
{ option_type::EMU, N_("Show mouse pointer"), OPTION_UI_MOUSE }, { option_type::EMU, N_("Show mouse pointer"), OPTION_UI_MOUSE },
{ option_type::EMU, N_("Confirm quit from emulation"), OPTION_CONFIRM_QUIT }, { option_type::EMU, N_("Confirm quit from machines"), OPTION_CONFIRM_QUIT },
{ option_type::EMU, N_("Skip system information screen"), OPTION_SKIP_GAMEINFO }, { option_type::EMU, N_("Skip information screen at startup"), OPTION_SKIP_GAMEINFO },
{ option_type::UI, N_("Force 4:3 aspect for snapshot display"), OPTION_FORCED4X3 }, { option_type::UI, N_("Force 4:3 aspect for snapshot display"), OPTION_FORCED4X3 },
{ option_type::UI, N_("Use image as background"), OPTION_USE_BACKGROUND }, { option_type::UI, N_("Use image as background"), OPTION_USE_BACKGROUND },
{ option_type::UI, N_("Skip BIOS selection menu"), OPTION_SKIP_BIOS_MENU }, { option_type::UI, N_("Skip BIOS selection menu"), OPTION_SKIP_BIOS_MENU },
{ option_type::UI, N_("Skip software part selection menu"), OPTION_SKIP_PARTS_MENU }, { option_type::UI, N_("Skip software parts selection menu"), OPTION_SKIP_PARTS_MENU },
{ option_type::UI, N_("Info auto audit"), OPTION_INFO_AUTO_AUDIT }, { option_type::UI, N_("Info auto audit"), OPTION_INFO_AUTO_AUDIT },
{ option_type::UI, N_("Hide romless machine from available list"),OPTION_HIDE_ROMLESS } }; { option_type::UI, N_("Hide romless machine from available list"),OPTION_HIDE_ROMLESS } };
} }
@ -88,11 +88,11 @@ std::vector<submenu::option> submenu::advanced_options()
{ option_type::EMU, N_("Multi-mouse"), OPTION_MULTIMOUSE }, { option_type::EMU, N_("Multi-mouse"), OPTION_MULTIMOUSE },
{ option_type::EMU, N_("Steadykey"), OPTION_STEADYKEY }, { option_type::EMU, N_("Steadykey"), OPTION_STEADYKEY },
{ option_type::EMU, N_("UI active"), OPTION_UI_ACTIVE }, { option_type::EMU, N_("UI active"), OPTION_UI_ACTIVE },
{ option_type::EMU, N_("Off-screen reload"), OPTION_OFFSCREEN_RELOAD }, { option_type::EMU, N_("Offscreen reload"), OPTION_OFFSCREEN_RELOAD },
{ option_type::EMU, N_("Joystick deadzone"), OPTION_JOYSTICK_DEADZONE }, { option_type::EMU, N_("Joystick deadzone"), OPTION_JOYSTICK_DEADZONE },
{ option_type::EMU, N_("Joystick saturation"), OPTION_JOYSTICK_SATURATION }, { option_type::EMU, N_("Joystick saturation"), OPTION_JOYSTICK_SATURATION },
{ option_type::EMU, N_("Natural keyboard"), OPTION_NATURAL_KEYBOARD }, { option_type::EMU, N_("Natural keyboard"), OPTION_NATURAL_KEYBOARD },
{ option_type::EMU, N_("Allow contradictory joystick inputs"), OPTION_JOYSTICK_CONTRADICTORY }, { option_type::EMU, N_("Simultaneous contradictory"), OPTION_JOYSTICK_CONTRADICTORY },
{ option_type::EMU, N_("Coin impulse"), OPTION_COIN_IMPULSE } }; { option_type::EMU, N_("Coin impulse"), OPTION_COIN_IMPULSE } };
} }
@ -103,7 +103,7 @@ std::vector<submenu::option> submenu::control_options()
{ option_type::EMU, N_("Lightgun Device Assignment"), OPTION_LIGHTGUN_DEVICE }, { option_type::EMU, N_("Lightgun Device Assignment"), OPTION_LIGHTGUN_DEVICE },
{ option_type::EMU, N_("Trackball Device Assignment"), OPTION_TRACKBALL_DEVICE }, { option_type::EMU, N_("Trackball Device Assignment"), OPTION_TRACKBALL_DEVICE },
{ option_type::EMU, N_("Pedal Device Assignment"), OPTION_PEDAL_DEVICE }, { option_type::EMU, N_("Pedal Device Assignment"), OPTION_PEDAL_DEVICE },
{ option_type::EMU, N_("AD Stick Device Assignment"), OPTION_ADSTICK_DEVICE }, { option_type::EMU, N_("Adstick Device Assignment"), OPTION_ADSTICK_DEVICE },
{ option_type::EMU, N_("Paddle Device Assignment"), OPTION_PADDLE_DEVICE }, { option_type::EMU, N_("Paddle Device Assignment"), OPTION_PADDLE_DEVICE },
{ option_type::EMU, N_("Dial Device Assignment"), OPTION_DIAL_DEVICE }, { option_type::EMU, N_("Dial Device Assignment"), OPTION_DIAL_DEVICE },
{ option_type::EMU, N_("Positional Device Assignment"), OPTION_POSITIONAL_DEVICE }, { option_type::EMU, N_("Positional Device Assignment"), OPTION_POSITIONAL_DEVICE },

View File

@ -29,7 +29,6 @@ menu_textbox::menu_textbox(mame_ui_manager &mui, render_container &container)
, m_layout_width(-1.0f) , m_layout_width(-1.0f)
, m_desired_width(-1.0f) , m_desired_width(-1.0f)
, m_desired_lines(-1) , m_desired_lines(-1)
, m_window_lines(0)
, m_top_line(0) , m_top_line(0)
{ {
} }

View File

@ -351,7 +351,7 @@ void mame_ui_manager::initialize(running_machine &machine)
const char *const service_mode_dipname = ioport_configurer::string_from_token(DEF_STR(Service_Mode)); const char *const service_mode_dipname = ioport_configurer::string_from_token(DEF_STR(Service_Mode));
for (auto &port : machine.ioport().ports()) for (auto &port : machine.ioport().ports())
for (ioport_field &field : port.second->fields()) for (ioport_field &field : port.second->fields())
if ((field.type() == IPT_DIPSWITCH) && (field.name() == service_mode_dipname)) // FIXME: probably breaks with localisation, also issues with multiple devices if (field.type() == IPT_DIPSWITCH && strcmp(field.name(), service_mode_dipname) == 0)
field.set_defseq(machine.ioport().type_seq(IPT_SERVICE)); field.set_defseq(machine.ioport().type_seq(IPT_SERVICE));
} }

View File

@ -136,7 +136,7 @@ static int len;
/* This in fact gives the number of samples for half of the pulse */ /* This in fact gives the number of samples for half of the pulse */
static inline int tap_data_to_samplecount(int data, int frequency) static inline int tap_data_to_samplecount(int data, int frequency)
{ {
// return (int) (0.5 * (0.5 + (((double)CBM_WAV_FREQUENCY / frequency) * (double)data))); // MAME TZX formula // return (int) (0.5 * (0.5 + (((double)CBM_WAV_FREQUENCY / frequency) * (double)data))); // MESS TZX formula
return (int) (0.5 * (((double)CBM_WAV_FREQUENCY / frequency) * (double)((data) + 0.5))); // tap2wav formula return (int) (0.5 * (((double)CBM_WAV_FREQUENCY / frequency) * (double)((data) + 0.5))); // tap2wav formula
} }

View File

@ -73,7 +73,7 @@ bool dfi_format::load(util::random_read &io, uint32_t form_factor, const std::ve
char sign[4]; char sign[4];
io.read_at(0, sign, 4, actual); io.read_at(0, sign, 4, actual);
if(memcmp(sign, "DFER", 4) == 0) { if(memcmp(sign, "DFER", 4) == 0) {
osd_printf_error("dfi_dsk: Old type Discferret image detected; the MAME Discferret decoder will not handle this properly, bailing out!\n"); osd_printf_error("dfi_dsk: Old type Discferret image detected; the mess Discferret decoder will not handle this properly, bailing out!\n");
return false; return false;
} }

View File

@ -48,22 +48,22 @@ public:
/*! @brief Load an image. /*! @brief Load an image.
The load function opens an image file and converts it to the The load function opens an image file and converts it to the
internal MAME floppy representation. internal MESS floppy representation.
@param io source buffer containing the image data. @param io source buffer containing the image data.
@param form_factor Physical form factor of disk, from the enum @param form_factor Physical form factor of disk, from the enum
in floppy_image in floppy_image
@param variants the variants from floppy_image the drive can handle @param variants the variants from floppy_image the drive can handle
@param image output buffer for data in MAME internal format. @param image output buffer for data in MESS internal format.
@return true on success, false otherwise. @return true on success, false otherwise.
*/ */
virtual bool load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) = 0; virtual bool load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) = 0;
/*! @brief Save an image. /*! @brief Save an image.
The save function writes back an image from the MAME internal The save function writes back an image from the MESS internal
floppy representation to the appropriate format on disk. floppy representation to the appropriate format on disk.
@param io output buffer for the data in the on-disk format. @param io output buffer for the data in the on-disk format.
@param variants the variants from floppy_image the drive can handle @param variants the variants from floppy_image the drive can handle
@param image source buffer containing data in MAME internal format. @param image source buffer containing data in MESS internal format.
@return true on success, false otherwise. @return true on success, false otherwise.
*/ */
virtual bool save(util::random_read_write &io, const std::vector<uint32_t> &variants, floppy_image *image); virtual bool save(util::random_read_write &io, const std::vector<uint32_t> &variants, floppy_image *image);

View File

@ -31,20 +31,22 @@ static int sorc_get_tracks_per_disk(floppy_image_legacy *floppy)
static uint64_t sorc_translate_offset(floppy_image_legacy *floppy, int track, int head, int sector) static uint64_t sorc_translate_offset(floppy_image_legacy *floppy, int track, int head, int sector)
{ {
return 270 * ((16 * uint64_t(track)) + sector); return 270*(16*track+sector);
} }
static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, bool sector_is_index, uint64_t *offset) static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, bool sector_is_index, uint64_t *offset)
{ {
uint64_t offs;
/* translate the sector to a raw sector */ /* translate the sector to a raw sector */
if (!sector_is_index) if (!sector_is_index)
{
sector -= 1; sector -= 1;
}
/* check to see if we are out of range */ /* check to see if we are out of range */
if ((head != 0) || (track < 0) || (track >= 77) || (sector < 0) || (sector >= 16)) if ((head != 0) || (track < 0) || (track >= 77) || (sector < 0) || (sector >= 16))
return FLOPPY_ERROR_SEEKERROR; return FLOPPY_ERROR_SEEKERROR;
uint64_t offs = sorc_translate_offset(floppy, track, head, sector); offs = sorc_translate_offset(floppy, track, head, sector);
if (offset) if (offset)
*offset = offs; *offset = offs;
return FLOPPY_ERROR_SUCCESS; return FLOPPY_ERROR_SUCCESS;

View File

@ -570,7 +570,7 @@ static int tzx_cas_do_work( int16_t **buffer )
if (pause_time == 0) if (pause_time == 0)
{ {
/* pause = 0 is used to let an emulator automagically stop the tape /* pause = 0 is used to let an emulator automagically stop the tape
in MAME we do not do that, so we insert a 5 second pause. */ in MESS we do not do that, so we insert a 5 second pause. */
pause_time = 5000; pause_time = 5000;
} }
size += tzx_cas_handle_block(buffer, cur_block, pause_time, 0, 0, 0, 0, 0, 0, 0, 0); size += tzx_cas_handle_block(buffer, cur_block, pause_time, 0, 0, 0, 0, 0, 0, 0, 0);

View File

@ -252,36 +252,41 @@ const cassette_image::Format cassette_image::wavfile_format =
This code has already identified some rounding errors This code has already identified some rounding errors
*********************************************************************/ *********************************************************************/
[[maybe_unused]] void wavfile_testload(const char *fname) #ifdef UNUSED_FUNCTION
void wavfile_testload(const char *fname)
{ {
FILE *f = fopen(fname, "rb"); cassette_image *cassette;
FILE *f;
long offset;
int freq, samples, i;
int32_t cassamp;
int16_t wavsamp;
f = fopen(fname, "rb");
if (!f) if (!f)
return; return;
cassette_image::ptr cassette; if (cassette_open(f, &stdio_ioprocs, &wavfile_format, cassette_image::FLAG_READONLY, &cassette))
if (cassette_image::open(util::stdio_read_write_noclose(f, 0x00), &cassette_image::wavfile_format, cassette_image::FLAG_READONLY, cassette) != cassette_image::error::SUCCESS)
{ {
fclose(f); fclose(f);
return; return;
} }
constexpr long offset = 44; offset = 44;
constexpr int freq = 44100; freq = 44100;
constexpr int samples = 5667062; samples = 5667062;
for (int i = 0; i < samples; i++) for (i = 0; i < samples; i++)
{ {
int32_t cassamp; cassette_get_sample(cassette, 0, i / (double) freq, 0.0, &cassamp);
cassette->get_sample(0, i / double(freq), 0.0, &cassamp);
int16_t wavsamp;
fseek(f, offset + i * 2, SEEK_SET); fseek(f, offset + i * 2, SEEK_SET);
fread(&wavsamp, 1, 2, f); fread(&wavsamp, 1, 2, f);
assert(cassamp == (((uint32_t) wavsamp) << 16));
assert(cassamp == (uint32_t(wavsamp) << 16));
} }
cassette.reset(); cassette_close(cassette);
fclose(f); fclose(f);
} }
#endif

View File

@ -161,33 +161,35 @@ glsl_shader_info *glsl_shader_init(osd_gl_context *gl_ctx)
#endif #endif
} }
if (err) return nullptr; if (err) return nullptr;
return new glsl_shader_info{ 0 }; return (glsl_shader_info *) malloc(sizeof(glsl_shader_info *));
} }
int glsl_shader_free(glsl_shader_info *shinfo) int glsl_shader_free(glsl_shader_info *shinfo)
{ {
int i,j;
pfn_glUseProgramObjectARB(0); // back to fixed function pipeline pfn_glUseProgramObjectARB(0); // back to fixed function pipeline
glFinish(); glFinish();
for (int i=0; i<GLSL_VERTEX_SHADER_MAX_NUMBER+9; i++) for (i=0; i<GLSL_VERTEX_SHADER_MAX_NUMBER+9; i++)
{ {
if ( glsl_mamebm_vsh_shader[i] ) if ( glsl_mamebm_vsh_shader[i] )
(void) gl_delete_shader(nullptr, &glsl_mamebm_vsh_shader[i], nullptr); (void) gl_delete_shader(nullptr, &glsl_mamebm_vsh_shader[i], nullptr);
} }
for (int j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++) for (j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++)
{ {
if ( glsl_mamebm_fsh_shader[j] ) if ( glsl_mamebm_fsh_shader[j] )
(void) gl_delete_shader(nullptr, nullptr, &glsl_mamebm_fsh_shader[j]); (void) gl_delete_shader(nullptr, nullptr, &glsl_mamebm_fsh_shader[j]);
} }
for (int j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++) for (j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++)
{ {
if ( glsl_mamebm_programs[j] ) if ( glsl_mamebm_programs[j] )
(void) gl_delete_shader( &glsl_mamebm_programs[j], nullptr, nullptr); (void) gl_delete_shader( &glsl_mamebm_programs[j], nullptr, nullptr);
} }
for (int i=0; i<10; i++) for (i=0; i<10; i++)
{ {
if ( glsl_scrn_vsh_shader[i] ) if ( glsl_scrn_vsh_shader[i] )
(void) gl_delete_shader(nullptr, &glsl_scrn_vsh_shader[i], nullptr); (void) gl_delete_shader(nullptr, &glsl_scrn_vsh_shader[i], nullptr);
@ -197,7 +199,7 @@ int glsl_shader_free(glsl_shader_info *shinfo)
(void) gl_delete_shader( &glsl_scrn_programs[i], nullptr, nullptr); (void) gl_delete_shader( &glsl_scrn_programs[i], nullptr, nullptr);
} }
delete shinfo; free(shinfo);
return 0; return 0;
} }

View File

@ -335,6 +335,7 @@ int sound_sdl::init(const osd_options &options)
int n_channels = 2; int n_channels = 2;
int audio_latency; int audio_latency;
SDL_AudioSpec aspec, obtained; SDL_AudioSpec aspec, obtained;
char audio_driver[16] = "";
if (LOG_SOUND) if (LOG_SOUND)
sound_log = std::make_unique<std::ofstream>(SDLMAME_SOUND_LOG); sound_log = std::make_unique<std::ofstream>(SDLMAME_SOUND_LOG);
@ -349,8 +350,8 @@ int sound_sdl::init(const osd_options &options)
} }
osd_printf_verbose("Audio: Start initialization\n"); osd_printf_verbose("Audio: Start initialization\n");
char const *const audio_driver = SDL_GetCurrentAudioDriver(); strncpy(audio_driver, SDL_GetCurrentAudioDriver(), sizeof(audio_driver));
osd_printf_verbose("Audio: Driver is %s\n", audio_driver ? audio_driver : "not initialized"); osd_printf_verbose("Audio: Driver is %s\n", audio_driver);
sdl_xfer_samples = SDL_XFER_SAMPLES; sdl_xfer_samples = SDL_XFER_SAMPLES;
stream_in_initialized = 0; stream_in_initialized = 0;

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>AUEffectUtil</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>aueffect</string>
</array>
<key>CFBundleTypeName</key>
<string>AUEffect</string>
<key>CFBundleTypeOSTypes</key>
<array/>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>NSDocumentClass</key>
<string>AUEffectDocument</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>aupreset</string>
</array>
<key>CFBundleTypeName</key>
<string>AudioUnit Preset</string>
<key>CFBundleTypeOSTypes</key>
<array/>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>NSDocumentClass</key>
<string>AUEffectDocument</string>
</dict>
</array>
<key>CFBundleIdentifier</key>
<string>org.mamedev.aueffectutil</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AUEffectUtil</string>
</dict>
</plist>

1076
src/tools/aueffectutil.mm Normal file

File diff suppressed because it is too large Load Diff

227
src/tools/castool.cpp Normal file
View File

@ -0,0 +1,227 @@
// license:BSD-3-Clause
// copyright-holders:Miodrag Milanovic
/***************************************************************************
main.c
Castool command line front end
27/03/2009 Initial version by Miodrag Milanovic
***************************************************************************/
#include "formats/a26_cas.h"
#include "formats/ace_tap.h"
#include "formats/adam_cas.h"
#include "formats/apf_apt.h"
#include "formats/atom_tap.h"
#include "formats/cbm_tap.h"
#include "formats/cgen_cas.h"
#include "formats/coco_cas.h"
#include "formats/csw_cas.h"
#include "formats/fm7_cas.h"
#include "formats/fmsx_cas.h"
#include "formats/gtp_cas.h"
#include "formats/hect_tap.h"
#include "formats/kc_cas.h"
#include "formats/kim1_cas.h"
#include "formats/lviv_lvt.h"
#include "formats/mz_cas.h"
#include "formats/orao_cas.h"
#include "formats/oric_tap.h"
#include "formats/p2000t_cas.h"
#include "formats/p6001_cas.h"
#include "formats/phc25_cas.h"
#include "formats/pmd_cas.h"
#include "formats/primoptp.h"
#include "formats/rk_cas.h"
#include "formats/sc3000_bit.h"
#include "formats/sol_cas.h"
#include "formats/sorc_cas.h"
#include "formats/sord_cas.h"
#include "formats/spc1000_cas.h"
#include "formats/svi_cas.h"
#include "formats/thom_cas.h"
#include "formats/trs_cas.h"
#include "formats/tvc_cas.h"
#include "formats/tzx_cas.h"
#include "formats/uef_cas.h"
#include "formats/vg5k_cas.h"
#include "formats/vt_cas.h"
#include "formats/x07_cas.h"
#include "formats/x1_tap.h"
#include "formats/zx81_p.h"
#include "corestr.h"
#include "ioprocs.h"
#include "osdcomm.h"
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
struct SupportedCassetteFormats
{
const char *name;
const cassette_image::Format * const *formats;
const char *desc;
};
const struct SupportedCassetteFormats formats[] = {
{"a26", a26_cassette_formats ,"Atari 2600 SuperCharger"},
{"apf", apf_cassette_formats ,"APF Imagination Machine"},
{"atom", atom_cassette_formats ,"Acorn Atom"},
{"bbc", bbc_cassette_formats ,"Acorn BBC & Electron"},
{"cbm", cbm_cassette_formats ,"Commodore 8-bit series"},
{"cdt", cdt_cassette_formats ,"Amstrad CPC"},
{"cgenie", cgenie_cassette_formats ,"EACA Colour Genie"},
{"coco", coco_cassette_formats ,"Tandy Radio Shack Color Computer"},
{"csw", csw_cassette_formats ,"Compressed Square Wave"},
{"ddp", coleco_adam_cassette_formats ,"Coleco ADAM"},
{"fm7", fm7_cassette_formats ,"Fujitsu FM-7"},
{"fmsx", fmsx_cassette_formats ,"MSX"},
{"gtp", gtp_cassette_formats ,"Elektronika inzenjering Galaksija"},
{"hector", hector_cassette_formats ,"Micronique Hector & Interact Family Computer"},
{"jupiter", ace_cassette_formats ,"Jupiter Cantab Jupiter Ace"},
{"kc85", kc_cassette_formats ,"VEB Mikroelektronik KC 85"},
{"kim1", kim1_cassette_formats ,"MOS KIM-1"},
{"lviv", lviv_lvt_format ,"PK-01 Lviv"},
{"mo5", mo5_cassette_formats ,"Thomson MO-series"},
{"mz", mz700_cassette_formats ,"Sharp MZ-700"},
{"orao", orao_cassette_formats ,"PEL Varazdin Orao"},
{"oric", oric_cassette_formats ,"Tangerine Oric"},
{"p2000t", p2000t_cassette_formats ,"Philips P2000T"},
{"pc6001", pc6001_cassette_formats ,"NEC PC-6001"},
{"phc25", phc25_cassette_formats ,"Sanyo PHC-25"},
{"pmd85", pmd85_cassette_formats ,"Tesla PMD-85"},
{"primo", primo_ptp_format ,"Microkey Primo"},
{"rku", rku_cassette_formats ,"UT-88"},
{"rk8", rk8_cassette_formats ,"Mikro-80"},
{"rks", rks_cassette_formats ,"Specialist"},
{"rko", rko_cassette_formats ,"Orion"},
{"rkr", rkr_cassette_formats ,"Radio-86RK"},
{"rka", rka_cassette_formats ,"Zavod BRA Apogee BK-01"},
{"rkm", rkm_cassette_formats ,"Mikrosha"},
{"rkp", rkp_cassette_formats ,"SAM SKB VM Partner-01.01"},
{"sc3000", sc3000_cassette_formats ,"Sega SC-3000"},
{"sol20", sol20_cassette_formats ,"PTC SOL-20"},
{"sorcerer", sorcerer_cassette_formats ,"Exidy Sorcerer"},
{"sordm5", sordm5_cassette_formats ,"Sord M5"},
{"spc1000", spc1000_cassette_formats ,"Samsung SPC-1000"},
{"svi", svi_cassette_formats ,"Spectravideo SVI-318 & SVI-328"},
{"to7", to7_cassette_formats ,"Thomson TO-series"},
{"trs80l2", trs80l2_cassette_formats ,"TRS-80 Level 2"},
{"tvc64", tvc64_cassette_formats ,"Videoton TVC 64"},
{"tzx", tzx_cassette_formats ,"Sinclair ZX Spectrum"},
{"vg5k", vg5k_cassette_formats ,"Philips VG 5000"},
{"vtech1", vtech1_cassette_formats ,"Video Technology Laser 110-310"},
{"vtech2", vtech2_cassette_formats ,"Video Technology Laser 350-700"},
{"x07", x07_cassette_formats ,"Canon X-07"},
{"x1", x1_cassette_formats ,"Sharp X1"},
{"zx80_o", zx80_o_format ,"Sinclair ZX80"},
{"zx81_p", zx81_p_format ,"Sinclair ZX81"},
{nullptr,nullptr,nullptr}
};
static std::string get_extension(const char *name)
{
const char *s;
s = name;
if (s != nullptr)
s = strrchr(s, '.');
return s ? std::string(s+1) : "";
}
static void display_usage(const char *argv0)
{
fprintf(stderr, "Usage: \n");
fprintf(stderr, " %s convert <format> <inputfile> <outputfile.wav>\n", argv0);
}
static void display_formats(void)
{
int i,j;
fprintf(stderr, "Supported formats:\n\n");
for (i = 0; formats[i].name; i++) {
fprintf(stderr, "%10s - %s\n",formats[i].name,formats[i].desc);
for (j = 1; formats[i].formats[j]; j++) {
fprintf(stderr, "%15s %s\n","",formats[i].formats[j]->extensions);
}
}
}
int CLIB_DECL main(int argc, char *argv[])
{
int i;
int found =0;
const cassette_image::Format * const *selected_formats = nullptr;
cassette_image::ptr cassette;
if (argc > 1)
{
if (!core_stricmp("convert", argv[1]))
{
// convert command
if (argc!=5) {
fprintf(stderr, "Wrong parameter number.\n\n");
display_usage(argv[0]);
return -1;
} else {
for (i = 0; formats[i].name; i++) {
if (core_stricmp(formats[i].name,argv[2])==0) {
selected_formats = formats[i].formats;
found = 1;
}
}
if (found==0) {
fprintf(stderr, "Wrong format name.\n\n");
display_usage(argv[0]);
fprintf(stderr, "\n");
display_formats();
return -1;
}
FILE *f = fopen(argv[3], "rb");
if (!f) {
fprintf(stderr, "File %s not found.\n",argv[3]);
return -1;
}
auto io = util::stdio_read_write(f, 0x00);
f = nullptr;
if (!io) {
fprintf(stderr, "Out of memory.\n");
return -1;
}
if (cassette_image::open_choices(std::move(io), get_extension(argv[3]), selected_formats, cassette_image::FLAG_READONLY, cassette) != cassette_image::error::SUCCESS) {
fprintf(stderr, "Invalid format of input file.\n");
return -1;
}
cassette->dump(argv[4]);
cassette.reset();
goto theend;
}
}
}
/* Usage */
fprintf(stderr, "castool - Generic cassette manipulation tool for use with MAME\n\n");
display_usage(argv[0]);
fprintf(stderr, "\n");
display_formats();
fprintf(stderr, "\nExample usage:\n");
fprintf(stderr, " %s convert tzx game.tzx game.wav\n\n", argv[0]);
theend :
return 0;
}

View File

@ -2955,7 +2955,7 @@ static void do_dump_metadata(parameters_map &params)
//------------------------------------------------- //-------------------------------------------------
// do_list_templates - list hard drive templates // do_dump_metadata - dump metadata from a CHD
//------------------------------------------------- //-------------------------------------------------
static void do_list_templates(parameters_map &params) static void do_list_templates(parameters_map &params)

82
src/tools/discrepancy-fixer.py Executable file
View File

@ -0,0 +1,82 @@
#!/usr/bin/python
##
## license:BSD-3-Clause
## copyright-holders:Zoe Blade
# Fix discrepancies in arcade ROM dump names, by Zoe Blade
# For Python 2 and 3
import sys
import xml.etree.ElementTree
def fixPair(parentMachine, childMachine):
changes = { }
for childRom in childMachine.iter('rom'):
for parentRom in parentMachine.iter('rom'):
if parentRom.get('sha1') == childRom.get('sha1'):
# ROM pair found
if parentRom.get('name') != childRom.get('name'):
# The names don't match
changes[childRom.get('name')] = parentRom.get('name')
if changes:
sourceFilename = childMachine.get('sourcefile')
try:
input = open(sourceFilename, 'r')
source = input.read()
input.close()
except Exception as e:
sys.stderr.write('%s: error reading %s: %s\n' % (sys.argv[0], sourceFilename, e))
return False
for oldRomFilename in changes:
newRomFilename = '"%s"' % (changes[oldRomFilename])
oldRomFilename = '"%s"' % (oldRomFilename)
paddedLen = max(len(oldRomFilename), len(newRomFilename))
oldRomFilenamePadded = oldRomFilename.ljust(paddedLen, ' ')
newRomFilenamePadded = newRomFilename.ljust(paddedLen, ' ')
source = source.replace(oldRomFilenamePadded, newRomFilenamePadded) # Try to preserve fancy spacing where possible
source = source.replace(oldRomFilename, newRomFilename) # Fallback on just replacing the filename
sys.stdout.write('%s: %s -> %s\n' % (sourceFilename, oldRomFilename, newRomFilename))
output = open(sourceFilename, 'w')
output.write(source)
output.close()
return True
if __name__ == '__main__':
if len(sys.argv) > 2:
sys.stderr.write('Usage:\n%s [arcade.xml]\n' % sys.argv[0])
sys.exit(1)
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
filename = 'arcade.xml'
sys.stderr.write('Loading XML file...')
sys.stderr.flush()
try:
root = xml.etree.ElementTree.parse(filename).getroot()
except Exception as e:
sys.stderr.write('\n%s: error parsing %s: %s\n' % (sys.argv[0], filename, e))
sys.exit(2)
sys.stderr.write('done.\n')
errors = 0
for childMachine in root.iter('machine'):
if childMachine.get('cloneof'):
for parentMachine in root.iter('machine'):
if parentMachine.get('name') == childMachine.get('cloneof'):
# Machine pair found
if not fixPair(parentMachine, childMachine):
errors += 1
sys.exit(0 if errors == 0 else 3)

View File

@ -0,0 +1,51 @@
#!/usr/bin/python
##
## license:BSD-3-Clause
## copyright-holders:Zoe Blade
# Find discrepancies in arcade ROM dump names, by Zoe Blade
# For Python 2 and 3
import sys
import xml.etree.ElementTree
def checkPair(parentMachine, childMachine):
for childRom in childMachine.iter('rom'):
for parentRom in parentMachine.iter('rom'):
if parentRom.get('sha1') == childRom.get('sha1'):
# ROM pair found
if parentRom.get('name') != childRom.get('name'):
# The names don't match
sys.stdout.write('%s %s: %s -> %s\n' % (childMachine.get('sourcefile'), childMachine.get('name'), childRom.get('name'), parentRom.get('name')))
else:
break
if __name__ == '__main__':
if len(sys.argv) > 2:
sys.stderr.write('Usage:\n%s [arcade.xml]\n' % sys.argv[0])
sys.exit(1)
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
filename = 'arcade.xml'
sys.stderr.write('Loading XML file...')
sys.stderr.flush()
try:
root = xml.etree.ElementTree.parse(filename).getroot()
except Exception as e:
sys.stderr.write('\n%s: error parsing %s: %s\n' % (sys.argv[0], filename, e))
sys.exit(2)
sys.stderr.write('done.\n')
for childMachine in root.iter('machine'):
if childMachine.get('cloneof'):
for parentMachine in root.iter('machine'):
if parentMachine.get('name') == childMachine.get('cloneof'):
# Machine pair found
checkPair(parentMachine, childMachine)
sys.exit(0)

711
src/tools/floptool.cpp Normal file
View File

@ -0,0 +1,711 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
/***************************************************************************
(Floppy) image command-line manager
***************************************************************************/
#include "image_handler.h"
#include "corestr.h"
#include "ioprocs.h"
#include <cassert>
#include <cctype>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
static formats_table formats;
static void display_usage()
{
fprintf(stderr, "Usage: \n");
fprintf(stderr, " floptool.exe identify <inputfile> [<inputfile> ...] -- Identify an image format\n");
fprintf(stderr, " floptool.exe flopconvert [input_format|auto] output_format <inputfile> <outputfile> -- Convert a floppy image\n");
fprintf(stderr, " floptool.exe flopcreate output_format filesystem <outputfile> -- Create a preformatted floppy image\n");
fprintf(stderr, " floptool.exe flopdir input_format filesystem <image> -- List the contents of a floppy image\n");
fprintf(stderr, " floptool.exe flopread input_format filesystem <image> <path> <outputfile> -- Extract a file from a floppy image\n");
fprintf(stderr, " floptool.exe flopwrite input_format filesystem <image> <inputfile> <path> -- Write a file into a floppy image\n");
}
static void display_formats()
{
int sk = 0;
for(const auto &e : formats.floppy_format_info_by_key) {
int sz = e.first.size();
if(sz > sk)
sk = sz;
}
for(const auto &e : formats.filesystem_format_by_key) {
int sz = e.first.size();
if(sz > sk)
sk = sz;
}
for(const auto &e : formats.floppy_create_info_by_key) {
int sz = e.first.size();
if(sz > sk)
sk = sz;
}
fprintf(stderr, "Supported floppy formats:\n\n");
for(const auto &e : formats.floppy_format_info_by_category)
if(!e.second.empty()) {
fprintf(stderr, "%s:\n", e.first.c_str());
for(auto *fif : e.second)
fprintf(stderr, " %-*s r%c - %s [%s]\n", sk, fif->m_format->name(), fif->m_format->supports_save() ? 'w' : '-', fif->m_format->description(), fif->m_format->extensions());
}
fprintf(stderr, "\n\n");
fprintf(stderr, "Supported filesystems (with floppy formatting names):\n\n");
for(const auto &e : formats.filesystem_format_by_category)
if(!e.second.empty()) {
fprintf(stderr, "%s:\n", e.first.c_str());
for(const auto &f : e.second) {
fprintf(stderr, " %-*s %c%c%c %c%c%c - %s\n",
sk,
f->m_manager->name(),
f->m_floppy || f->m_floppy_raw ? 'F' : '-',
f->m_hd ? 'H' : '-',
f->m_cd ? 'C' : '-',
f->m_manager->can_format() || f->m_floppy_raw ? 'f' : '-',
f->m_manager->can_read() ? 'r' : '-',
f->m_manager->can_write() ? 'w' : '-',
f->m_manager->description());
for(auto &f2 : f->m_floppy_create)
fprintf(stderr, " %-*s - %s\n",
sk,
f2->m_name,
f2->m_description);
}
}
}
static void display_full_usage()
{
/* Usage */
fprintf(stderr, "floptool - Generic floppy image manipulation tool for use with MAME\n\n");
display_usage();
fprintf(stderr, "\n");
display_formats();
}
static int identify(int argc, char *argv[])
{
// Need to detect CHDs too
if(argc<3) {
fprintf(stderr, "Missing name of file to identify.\n\n");
display_usage();
return 1;
}
int sz = 0;
for(int i=2; i<argc; i++) {
int len = strlen(argv[i]);
if(len > sz)
sz = len;
}
for(int i=2; i<argc; i++) {
image_handler ih;
ih.set_on_disk_path(argv[i]);
auto scores = ih.identify(formats);
if(scores.empty())
printf("%-*s : Unknown format\n", sz, argv[i]);
int sz2 = 0;
for(const auto &e : scores) {
int len = strlen(e.second->m_format->name());
if(len > sz2)
sz2 = len;
}
bool first = true;
for(const auto &e : scores) {
printf("%-*s %c %3d - %-*s %s\n", sz, first ? argv[i] : "", first ? ':' : ' ', e.first, sz2, e.second->m_format->name(), e.second->m_format->description());
first = false;
}
}
return 0;
}
static const floppy_format_info *find_floppy_source_format(const char *name, image_handler &ih)
{
const floppy_format_info *source_format;
if(!core_stricmp(name, "auto")) {
auto scores = ih.identify(formats);
if(scores.empty()) {
fprintf(stderr, "Error: Could not identify the format of file %s\n", ih.get_on_disk_path().c_str());
return nullptr;
}
if(scores.size() >= 2 && scores[0].first == scores[1].first) {
fprintf(stderr, "Ambiguous source format. Possible formats:\n");
int sz = 0;
for(const auto &e : scores) {
int len = strlen(e.second->m_format->name());
if(len > sz)
sz = len;
}
for(const auto &e : scores)
printf(" %3d - %-*s %s\n", e.first, sz, e.second->m_format->name(), e.second->m_format->description());
return nullptr;
}
source_format = scores[0].second;
} else {
source_format = formats.find_floppy_format_info_by_key(name);
if(!source_format) {
fprintf(stderr, "Error: Format '%s' unknown\n", name);
return nullptr;
}
}
return source_format;
}
static int flopconvert(int argc, char *argv[])
{
if(argc!=6) {
fprintf(stderr, "Incorrect number of arguments.\n\n");
display_usage();
return 1;
}
image_handler ih;
ih.set_on_disk_path(argv[4]);
const floppy_format_info *source_format = find_floppy_source_format(argv[2], ih);
if(!source_format)
return 1;
const floppy_format_info *dest_format = formats.find_floppy_format_info_by_key(argv[3]);
if(!dest_format) {
fprintf(stderr, "Error: Format '%s' unknown\n", argv[3]);
return 1;
}
if(!dest_format->m_format->supports_save()) {
fprintf(stderr, "Error: Aaving to format '%s' unsupported\n", argv[3]);
return 1;
}
if(ih.floppy_load(source_format)) {
fprintf(stderr, "Error: Loading as format '%s' failed\n", source_format->m_format->name());
return 1;
}
ih.set_on_disk_path(argv[5]);
if(ih.floppy_save(dest_format)) {
fprintf(stderr, "Error: Saving as format '%s' failed\n", dest_format->m_format->name());
return 1;
}
return 0;
}
static int flopcreate(int argc, char *argv[])
{
if(argc!=5) {
fprintf(stderr, "Incorrect number of arguments.\n\n");
display_usage();
return 1;
}
auto dest_format = formats.find_floppy_format_info_by_key(argv[2]);
if(!dest_format) {
fprintf(stderr, "Error: Floppy format '%s' unknown\n", argv[3]);
return 1;
}
if(!dest_format->m_format->supports_save()) {
fprintf(stderr, "Error: Saving to format '%s' unsupported\n", argv[3]);
return 1;
}
auto create_fs = formats.find_floppy_create_info_by_key(argv[3]);
if(!create_fs) {
fprintf(stderr, "Error: Floppy creation format '%s' unknown\n", argv[3]);
return 1;
}
if(!create_fs->m_manager->can_format()) {
fprintf(stderr, "Error: Floppy creation format '%s' does not support creating new images\n", argv[3]);
return 1;
}
fs_meta_data meta;
image_handler ih;
ih.set_on_disk_path(argv[4]);
ih.floppy_create(create_fs, meta);
return ih.floppy_save(dest_format);
}
static void dir_scan(u32 depth, filesystem_t::dir_t dir, std::vector<std::vector<std::string>> &entries, const std::unordered_map<fs_meta_name, size_t> &nmap, size_t nc, const std::vector<fs_meta_description> &dmetad, const std::vector<fs_meta_description> &fmetad)
{
std::string head;
for(u32 i = 0; i != depth; i++)
head += " ";
auto contents = dir.contents();
for(const auto &c : contents) {
size_t id = entries.size();
entries.resize(id+1);
entries[id].resize(nc);
switch(c.m_type) {
case fs_dir_entry_type::dir: {
auto subdir = dir.dir_get(c.m_key);
auto meta = subdir.metadata();
for(const auto &m : dmetad) {
if(!meta.has(m.m_name))
continue;
size_t slot = nmap.find(m.m_name)->second;
std::string val = fs_meta::to_string(m.m_type, meta.get(m.m_name));
if(slot == 0)
val = head + "dir " + val;
entries[id][slot] = val;
}
dir_scan(depth+1, subdir, entries, nmap, nc, dmetad, fmetad);
break;
}
case fs_dir_entry_type::file:
case fs_dir_entry_type::system_file: {
auto file = dir.file_get(c.m_key);
auto meta = file.metadata();
for(const auto &m : fmetad) {
if(!meta.has(m.m_name))
continue;
size_t slot = nmap.find(m.m_name)->second;
std::string val = fs_meta::to_string(m.m_type, meta.get(m.m_name));
if(slot == 0)
val = head + (c.m_type == fs_dir_entry_type::system_file ? "sys " : "file ") + val;
entries[id][slot] = val;
}
break;
}
}
}
}
static int generic_dir(image_handler &ih)
{
auto [fsm, fs] = ih.get_fs();
auto vmetad = fsm->volume_meta_description();
auto fmetad = fsm->file_meta_description();
auto dmetad = fsm->directory_meta_description();
auto vmeta = fs->metadata();
if(!vmeta.empty()) {
std::string vinf = "Volume:";
for(const auto &e : vmetad)
vinf += util::string_format(" %s=%s", fs_meta_data::entry_name(e.m_name), fs_meta::to_string(e.m_type, vmeta.get(e.m_name)));
printf("%s\n\n", vinf.c_str());
}
std::vector<fs_meta_name> names;
names.push_back(fs_meta_name::name);
for(const auto &e : fmetad)
if(e.m_name != fs_meta_name::name)
names.push_back(e.m_name);
for(const auto &e : dmetad)
if(std::find(names.begin(), names.end(), e.m_name) == names.end())
names.push_back(e.m_name);
std::unordered_map<fs_meta_name, size_t> nmap;
for(size_t i = 0; i != names.size(); i++)
nmap[names[i]] = i;
auto root = fs->root();
std::vector<std::vector<std::string>> entries;
entries.resize(1);
for(fs_meta_name n : names)
entries[0].push_back(fs_meta_data::entry_name(n));
dir_scan(0, root, entries, nmap, names.size(), dmetad, fmetad);
std::vector<u32> sizes(names.size());
for(const auto &e : entries)
for(unsigned int i=0; i != names.size(); i++)
sizes[i] = std::max<u32>(sizes[i], e[i].size());
for(const auto &e : entries) {
std::string l;
for(unsigned int i=0; i != names.size(); i++) {
if(i)
l += ' ';
l += util::string_format("%-*s", sizes[i], e[i]);
}
printf("%s\n", l.c_str());
}
return 0;
}
static int flopdir(int argc, char *argv[])
{
if(argc!=5) {
fprintf(stderr, "Incorrect number of arguments.\n\n");
display_usage();
return 1;
}
image_handler ih;
ih.set_on_disk_path(argv[4]);
const floppy_format_info *source_format = find_floppy_source_format(argv[2], ih);
if(!source_format)
return 1;
auto fs = formats.find_filesystem_format_by_key(argv[3]);
if(!fs) {
fprintf(stderr, "Error: Filesystem '%s' unknown\n", argv[3]);
return 1;
}
if(!fs->m_manager || !fs->m_manager->can_read()) {
fprintf(stderr, "Error: Filesystem '%s' does not implement reading\n", argv[3]);
return 1;
}
if(ih.floppy_load(source_format)) {
fprintf(stderr, "Error: Loading as format '%s' failed\n", source_format->m_format->name());
return 1;
}
if(ih.floppy_mount_fs(fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}
return generic_dir(ih);
}
static int hddir(int argc, char *argv[])
{
if(argc!=4) {
fprintf(stderr, "Incorrect number of arguments.\n\n");
display_usage();
return 1;
}
image_handler ih;
ih.set_on_disk_path(argv[3]);
auto fs = formats.find_filesystem_format_by_key(argv[2]);
if(!fs) {
fprintf(stderr, "Error: Filesystem '%s' unknown\n", argv[2]);
return 1;
}
if(!fs->m_manager || !fs->m_manager->can_read()) {
fprintf(stderr, "Error: Filesystem '%s' does not implement reading\n", argv[2]);
return 1;
}
if(ih.hd_mount_fs(fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}
return generic_dir(ih);
}
static int generic_read(image_handler &ih, const char *srcpath, const char *dstpath)
{
auto [fsm, fs] = ih.get_fs();
std::vector<std::string> path = ih.path_split(srcpath);
auto dir = fs->root();
std::string apath;
for(unsigned int i = 0; i < path.size() - 1; i++) {
auto c = dir.contents();
unsigned int j;
for(j = 0; j != c.size(); j++)
if(c[j].m_name == path[i])
break;
if(j == c.size()) {
fprintf(stderr, "Error: directory %s%c%s not found\n", apath.c_str(), fsm->directory_separator(), path[i].c_str());
return 1;
}
if(c[j].m_type != fs_dir_entry_type::dir) {
fprintf(stderr, "Error: %s%c%s is not a directory\n", apath.c_str(), fsm->directory_separator(), path[i].c_str());
return 1;
}
dir = dir.dir_get(c[j].m_key);
apath += fsm->directory_separator() + path[i];
}
auto c = dir.contents();
unsigned int j;
for(j = 0; j != c.size(); j++)
if(c[j].m_name == path.back())
break;
if(j == c.size()) {
fprintf(stderr, "Error: file %s%c%s not found\n", apath.c_str(), fsm->directory_separator(), path.back().c_str());
return 1;
}
auto file = dir.file_get(c[j].m_key);
auto meta = file.metadata();
if(!meta.has(fs_meta_name::length)) {
fprintf(stderr, "Error: %s%c%s is not a readable file\n", apath.c_str(), fsm->directory_separator(), path.back().c_str());
return 1;
}
image_handler::fsave(dstpath, file.read_all());
bool has_rsrc = fsm->has_rsrc() && meta.has(fs_meta_name::rsrc_length);
if(has_rsrc)
image_handler::fsave_rsrc(image_handler::path_make_rsrc(dstpath), file.rsrc_read_all());
return 0;
}
static int flopread(int argc, char *argv[])
{
if(argc!=7) {
fprintf(stderr, "Incorrect number of arguments.\n\n");
display_usage();
return 1;
}
image_handler ih;
ih.set_on_disk_path(argv[4]);
const floppy_format_info *source_format = find_floppy_source_format(argv[2], ih);
if(!source_format)
return 1;
auto fs = formats.find_filesystem_format_by_key(argv[3]);
if(!fs) {
fprintf(stderr, "Error: Filesystem '%s' unknown\n", argv[3]);
return 1;
}
if(!fs->m_manager || !fs->m_manager->can_read()) {
fprintf(stderr, "Error: Filesystem '%s' does not implement reading\n", argv[3]);
return 1;
}
if(ih.floppy_load(source_format)) {
fprintf(stderr, "Error: Loading as format '%s' failed\n", source_format->m_format->name());
return 1;
}
if(ih.floppy_mount_fs(fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}
return generic_read(ih, argv[5], argv[6]);
}
static int hdread(int argc, char *argv[])
{
if(argc!=6) {
fprintf(stderr, "Incorrect number of arguments.\n\n");
display_usage();
return 1;
}
image_handler ih;
ih.set_on_disk_path(argv[3]);
auto fs = formats.find_filesystem_format_by_key(argv[2]);
if(!fs) {
fprintf(stderr, "Error: Filesystem '%s' unknown\n", argv[2]);
return 1;
}
if(!fs->m_manager || !fs->m_manager->can_read()) {
fprintf(stderr, "Error: Filesystem '%s' does not implement reading\n", argv[2]);
return 1;
}
if(ih.hd_mount_fs(fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}
return generic_read(ih, argv[4], argv[5]);
}
static int generic_write(image_handler &ih, const char *srcpath, const char *dstpath)
{
auto [fsm, fs] = ih.get_fs();
std::vector<std::string> path = ih.path_split(dstpath);
auto dir = fs->root();
std::string apath;
for(unsigned int i = 0; i < path.size() - 1; i++) {
auto c = dir.contents();
unsigned int j;
for(j = 0; j != c.size(); j++)
if(c[j].m_name == path[i])
break;
if(j == c.size()) {
fprintf(stderr, "Error: directory %s%c%s not found\n", apath.c_str(), fsm->directory_separator(), path[i].c_str());
return 1;
}
if(c[j].m_type != fs_dir_entry_type::dir) {
fprintf(stderr, "Error: %s%c%s is not a directory\n", apath.c_str(), fsm->directory_separator(), path[i].c_str());
return 1;
}
dir = dir.dir_get(c[j].m_key);
apath += fsm->directory_separator() + path[i];
}
fs_meta_data meta;
meta.set(fs_meta_name::name, path.back());
auto file = dir.file_create(meta);
auto filedata = image_handler::fload(srcpath);
file.replace(filedata);
bool has_rsrc = fsm->has_rsrc();
if(has_rsrc) {
std::string rpath = image_handler::path_make_rsrc(dstpath);
if(image_handler::fexists(rpath)) {
filedata = image_handler::fload_rsrc(rpath);
if(!filedata.empty())
file.rsrc_replace(filedata);
}
}
return 0;
}
static int flopwrite(int argc, char *argv[])
{
if(argc!=7) {
fprintf(stderr, "Incorrect number of arguments.\n\n");
display_usage();
return 1;
}
image_handler ih;
ih.set_on_disk_path(argv[4]);
const floppy_format_info *source_format = find_floppy_source_format(argv[2], ih);
if(!source_format)
return 1;
auto fs = formats.find_filesystem_format_by_key(argv[3]);
if(!fs) {
fprintf(stderr, "Error: Filesystem '%s' unknown\n", argv[3]);
return 1;
}
if(!fs->m_manager || !fs->m_manager->can_read()) {
fprintf(stderr, "Error: Filesystem '%s' does not implement reading\n", argv[3]);
return 1;
}
if(ih.floppy_load(source_format)) {
fprintf(stderr, "Error: Loading as format '%s' failed\n", source_format->m_format->name());
return 1;
}
if(ih.floppy_mount_fs(fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}
int err = generic_write(ih, argv[5], argv[6]);
if(err)
return err;
ih.fs_to_floppy();
if(ih.floppy_save(source_format))
return 1;
return 0;
}
static int hdwrite(int argc, char *argv[])
{
if(argc!=6) {
fprintf(stderr, "Incorrect number of arguments.\n\n");
display_usage();
return 1;
}
image_handler ih;
ih.set_on_disk_path(argv[3]);
auto fs = formats.find_filesystem_format_by_key(argv[2]);
if(!fs) {
fprintf(stderr, "Error: Filesystem '%s' unknown\n", argv[2]);
return 1;
}
if(!fs->m_manager || !fs->m_manager->can_read()) {
fprintf(stderr, "Error: Filesystem '%s' does not implement reading\n", argv[2]);
return 1;
}
if(ih.hd_mount_fs(fs)) {
fprintf(stderr, "Error: Parsing as filesystem '%s' failed\n", fs->m_manager->name());
return 1;
}
return generic_write(ih, argv[4], argv[5]);
}
int CLIB_DECL main(int argc, char *argv[])
{
formats.init();
if(argc == 1) {
display_full_usage();
return 0;
}
try {
if(!core_stricmp("identify", argv[1]))
return identify(argc, argv);
else if(!core_stricmp("flopconvert", argv[1]))
return flopconvert(argc, argv);
else if(!core_stricmp("flopcreate", argv[1]))
return flopcreate(argc, argv);
else if(!core_stricmp("flopdir", argv[1]))
return flopdir(argc, argv);
else if(!core_stricmp("flopread", argv[1]))
return flopread(argc, argv);
else if(!core_stricmp("flopwrite", argv[1]))
return flopwrite(argc, argv);
else if(!core_stricmp("hddir", argv[1]))
return hddir(argc, argv);
else if(!core_stricmp("hdread", argv[1]))
return hdread(argc, argv);
else if(!core_stricmp("hdwrite", argv[1]))
return hdwrite(argc, argv);
else {
fprintf(stderr, "Unknown command '%s'\n\n", argv[1]);
display_usage();
return 1;
}
} catch(const emu_fatalerror &err) {
fprintf(stderr, "Error: %s", err.what());
return 1;
}
}

409
src/tools/image_handler.cpp Normal file
View File

@ -0,0 +1,409 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
// Image generic handler class and helpers
#include "image_handler.h"
#include "formats/all.h"
#include "formats/fsblk_vec.h"
#include "formats/fs_unformatted.h"
#include "ioprocs.h"
#include "ioprocsfill.h"
#include "ioprocsvec.h"
// Fatalerror implementation
emu_fatalerror::emu_fatalerror(util::format_argument_pack<std::ostream> const &args)
: emu_fatalerror(0, args)
{
}
emu_fatalerror::emu_fatalerror(int _exitcode, util::format_argument_pack<std::ostream> const &args)
: m_text(util::string_format(args))
, m_code(_exitcode)
{
}
// Format enumeration
namespace {
struct enumerator : public mame_formats_enumerator {
formats_table *m_table;
std::string m_category;
enumerator(formats_table *table) : mame_formats_enumerator(), m_table(table), m_category("None") {}
virtual ~enumerator() = default;
virtual void add(const cassette_image::Format *const *formats) {}
virtual void category(const char *name) {
m_category = name;
}
virtual void add(floppy_format_type format) {
m_table->floppy_format_infos.emplace_back(std::make_unique<floppy_format_info>(format(), m_category));
}
virtual void add(const filesystem_manager_t &fs) {
m_table->filesystem_formats.emplace_back(std::make_unique<filesystem_format>(&fs, m_category));
}
};
struct fs_enum : public filesystem_manager_t::floppy_enumerator {
filesystem_format *m_format;
fs_enum(filesystem_format *format) : m_format(format) {}
virtual void add(floppy_format_type type, u32 image_size, const char *name, const char *description) override {
m_format->m_floppy = true;
m_format->m_floppy_create.emplace_back(std::make_unique<floppy_create_info>(m_format->m_manager, type, image_size, name, description));
}
virtual void add_raw(const char *name, u32 key, const char *description) override {
m_format->m_floppy_raw = true;
m_format->m_floppy_create.emplace_back(std::make_unique<floppy_create_info>(name, key, description));
}
};
}
void formats_table::init()
{
std::vector<uint32_t> variants;
enumerator en(this);
mame_formats_full_list(en);
for(auto &f : filesystem_formats) {
fs_enum fen(f.get());
f->m_manager->enumerate_f(fen, floppy_image::FF_UNKNOWN, variants);
}
for(auto &f : floppy_format_infos) {
auto *ff = f.get();
std::string key = ff->m_format->name();
auto i = floppy_format_info_by_key.find(key);
if(i != floppy_format_info_by_key.end()) {
fprintf(stderr, "Collision on floppy format name %s between \"%s\" and \"%s\".\n",
ff->m_format->name(),
ff->m_format->description(),
i->second->m_format->description());
exit(1);
}
floppy_format_info_by_key[key] = ff;
floppy_format_info_by_category[ff->m_category].push_back(ff);
}
for(auto &f : filesystem_formats) {
auto *ff = f.get();
std::string key = ff->m_manager->name();
auto i = filesystem_format_by_key.find(key);
if(i != filesystem_format_by_key.end()) {
fprintf(stderr, "Collision on filesystem name %s between \"%s\" and \"%s\".\n",
ff->m_manager->name(),
ff->m_manager->description(),
i->second->m_manager->description());
exit(1);
}
filesystem_format_by_key[key] = ff;
filesystem_format_by_category[ff->m_category].push_back(ff);
for(auto &f2 : ff->m_floppy_create) {
auto *ff2 = f2.get();
key = ff2->m_name;
auto i = floppy_create_info_by_key.find(key);
if(i != floppy_create_info_by_key.end()) {
fprintf(stderr, "Collision on floppy create name %s between \"%s\" and \"%s\".\n",
ff2->m_name,
ff2->m_description,
i->second->m_description);
exit(1);
}
floppy_create_info_by_key[key] = ff2;
}
}
}
const floppy_format_info *formats_table::find_floppy_format_info_by_key(const std::string &key) const
{
auto i = floppy_format_info_by_key.find(key);
return i == floppy_format_info_by_key.end() ? nullptr : i->second;
}
const filesystem_format *formats_table::find_filesystem_format_by_key(const std::string &key) const
{
auto i = filesystem_format_by_key.find(key);
return i == filesystem_format_by_key.end() ? nullptr : i->second;
}
const floppy_create_info *formats_table::find_floppy_create_info_by_key(const std::string &key) const
{
auto i = floppy_create_info_by_key.find(key);
return i == floppy_create_info_by_key.end() ? nullptr : i->second;
}
// Image handling
std::vector<u8> image_handler::fload(std::string path)
{
char msg[4096];
sprintf(msg, "Error opening %s for reading", path.c_str());
auto fi = fopen(path.c_str(), "rb");
if(!fi) {
perror(msg);
exit(1);
}
fseek(fi, 0, SEEK_END);
long size = ftell(fi);
std::vector<u8> filedata(size);
fseek(fi, 0, SEEK_SET);
fread(filedata.data(), filedata.size(), 1, fi);
fclose(fi);
return filedata;
}
std::vector<u8> image_handler::fload_rsrc(std::string path)
{
auto filedata = fload(path);
const u8 *head = filedata.data();
if(filesystem_t::r32b(head+0x00) == 0x00051607 &&
filesystem_t::r32b(head+0x04) == 0x00020000) {
u16 nent = filesystem_t::r16b(head+0x18);
for(u16 i=0; i != nent; i++) {
const u8 *e = head + 12*i;
if(filesystem_t::r32b(e+0) == 2) {
u32 start = filesystem_t::r32b(e+4);
u32 len = filesystem_t::r32b(e+8);
filedata.erase(filedata.begin(), filedata.begin() + start);
filedata.erase(filedata.begin() + len, filedata.end());
return filedata;
}
}
}
filedata.clear();
return filedata;
}
void image_handler::fsave(std::string path, const std::vector<u8> &data)
{
char msg[4096];
sprintf(msg, "Error opening %s for writing", path.c_str());
auto fo = fopen(path.c_str(), "wb");
if(!fo) {
perror(msg);
exit(1);
}
fwrite(data.data(), data.size(), 1, fo);
fclose(fo);
}
void image_handler::fsave_rsrc(std::string path, const std::vector<u8> &data)
{
u8 head[0x2a];
filesystem_t::w32b(head+0x00, 0x00051607); // Magic
filesystem_t::w32b(head+0x04, 0x00020000); // Version
filesystem_t::fill(head+0x08, 0, 16); // Filler
filesystem_t::w16b(head+0x18, 1); // Number of entries
filesystem_t::w32b(head+0x1a, 2); // Resource fork
filesystem_t::w32b(head+0x22, 0x2a); // Offset in the file
filesystem_t::w32b(head+0x26, data.size()); // Length
char msg[4096];
sprintf(msg, "Error opening %s for writing", path.c_str());
auto fo = fopen(path.c_str(), "wb");
if(!fo) {
perror(msg);
exit(1);
}
fwrite(head, sizeof(head), 1, fo);
fwrite(data.data(), data.size(), 1, fo);
fclose(fo);
}
image_handler::image_handler() : m_floppy_image(84, 2, floppy_image::FF_UNKNOWN)
{
}
void image_handler::set_on_disk_path(std::string path)
{
m_on_disk_path = path;
}
std::vector<std::pair<u8, const floppy_format_info *>> image_handler::identify(const formats_table &formats)
{
std::vector<std::pair<u8, const floppy_format_info *>> res;
std::vector<uint32_t> variants;
FILE *f = fopen(m_on_disk_path.c_str(), "rb");
if (!f) {
std::string msg = util::string_format("Error opening %s for reading", m_on_disk_path);
perror(msg.c_str());
return res;
}
auto io = util::stdio_read(f, 0xff);
for(const auto &e : formats.floppy_format_info_by_key) {
u8 score = e.second->m_format->identify(*io, floppy_image::FF_UNKNOWN, variants);
if(score)
res.emplace_back(std::make_pair(score, e.second));
}
return res;
}
bool image_handler::floppy_load(const floppy_format_info *format)
{
std::vector<uint32_t> variants;
FILE *f = fopen(m_on_disk_path.c_str(), "rb");
if (!f) {
std::string msg = util::string_format("Error opening %s for reading", m_on_disk_path);
perror(msg.c_str());
return true;
}
auto io = util::stdio_read(f, 0xff);
return !format->m_format->load(*io, floppy_image::FF_UNKNOWN, variants, &m_floppy_image);
}
bool image_handler::floppy_save(const floppy_format_info *format)
{
std::vector<uint32_t> variants;
std::string msg = util::string_format("Error opening %s for writing", m_on_disk_path);
FILE *f = fopen(m_on_disk_path.c_str(), "wb");
if (!f) {
perror(msg.c_str());
return true;
}
auto io = util::stdio_read_write(f, 0xff);
return !format->m_format->save(*io, variants, &m_floppy_image);
}
void image_handler::floppy_create(const floppy_create_info *format, fs_meta_data meta)
{
if(format->m_type) {
std::vector<uint32_t> variants;
std::vector<u8> img(format->m_image_size);
fsblk_vec_t blockdev(img);
auto fs = format->m_manager->mount(blockdev);
fs->format(meta);
auto source_format = format->m_type();
auto io = util::ram_read(img.data(), img.size(), 0xff);
source_format->load(*io, floppy_image::FF_UNKNOWN, variants, &m_floppy_image);
delete source_format;
} else {
fs_unformatted::format(format->m_key, &m_floppy_image);
}
}
bool image_handler::floppy_mount_fs(const filesystem_format *format)
{
m_floppy_fs_converter = nullptr;
for(const auto &ci : format->m_floppy_create) {
if(ci->m_type != m_floppy_fs_converter) {
std::vector<uint32_t> variants;
m_floppy_fs_converter = ci->m_type;
m_sector_image.clear();
auto load_format = m_floppy_fs_converter();
util::random_read_write_fill_wrapper<util::vector_read_write_adapter<u8>, 0xff> io(m_sector_image);
load_format->save(io, variants, &m_floppy_image);
delete load_format;
}
if(ci->m_image_size == m_sector_image.size())
goto success;
}
m_floppy_fs_converter = nullptr;
m_sector_image.clear();
return true;
success:
m_fsblk.reset(new fsblk_vec_t(m_sector_image));
m_fsm = format->m_manager;
m_fs = m_fsm->mount(*m_fsblk);
return false;
}
bool image_handler::hd_mount_fs(const filesystem_format *format)
{
// Should use the chd mechanisms, one thing at a time...
m_sector_image = fload(m_on_disk_path);
m_fsblk.reset(new fsblk_vec_t(m_sector_image));
m_fsm = format->m_manager;
m_fs = m_fsm->mount(*m_fsblk);
return false;
}
void image_handler::fs_to_floppy()
{
std::vector<uint32_t> variants;
auto io = util::ram_read(m_sector_image.data(), m_sector_image.size(), 0xff);
auto format = m_floppy_fs_converter();
format->load(*io, floppy_image::FF_UNKNOWN, variants, &m_floppy_image);
delete format;
}
std::vector<std::string> image_handler::path_split(std::string path) const
{
std::string opath = path;
std::vector<std::string> rpath;
if(m_fsm->has_subdirectories()) {
std::string element;
char sep = m_fsm->directory_separator();
for(char c : opath) {
if(c == sep) {
if(!element.empty()) {
rpath.push_back(element);
element.clear();
}
} else
element += c;
}
if(!element.empty())
rpath.push_back(element);
} else
rpath.push_back(opath);
return rpath;
}
bool image_handler::fexists(std::string path)
{
auto f = fopen(path.c_str(), "rb");
if(f != nullptr) {
fclose(f);
return true;
}
return false;
}
std::string image_handler::path_make_rsrc(std::string path)
{
auto p = path.end();
while(p != path.begin() && p[-1] != '/')
p--;
std::string rpath(path.begin(), p);
rpath += "._";
rpath += std::string(p, path.end());
return rpath;
}

119
src/tools/image_handler.h Normal file
View File

@ -0,0 +1,119 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
// Image generic handler class and helpers
#ifndef MAME_TOOLS_IMAGE_HANDLER_H
#define MAME_TOOLS_IMAGE_HANDLER_H
#pragma once
#include "../emu/emucore.h"
#include "formats/fsmgr.h"
#include <cstdint>
#include <map>
#include <memory>
#include <string>
#include <vector>
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
struct floppy_format_info {
floppy_image_format_t *m_format;
std::string m_category;
floppy_format_info(floppy_image_format_t *format, std::string category) : m_format(format), m_category(category) {}
};
struct floppy_create_info {
const filesystem_manager_t *m_manager;
floppy_format_type m_type;
u32 m_image_size;
u32 m_key;
const char *m_name;
const char *m_description;
floppy_create_info(const filesystem_manager_t *manager, floppy_format_type type, u32 image_size, const char *name, const char *description) :
m_manager(manager), m_type(type), m_image_size(image_size), m_key(0), m_name(name), m_description(description)
{ }
floppy_create_info(const char *name, u32 key, const char *description) :
m_manager(nullptr), m_type(nullptr), m_image_size(0), m_key(key), m_name(name), m_description(description)
{ }
};
struct filesystem_format {
const filesystem_manager_t *m_manager;
std::vector<std::unique_ptr<floppy_create_info>> m_floppy_create;
std::string m_category;
bool m_floppy, m_floppy_raw, m_hd, m_cd;
filesystem_format(const filesystem_manager_t *manager, std::string category) : m_manager(manager), m_category(category), m_floppy(false), m_floppy_raw(false), m_hd(false), m_cd(false) {}
};
struct formats_table {
std::vector<std::unique_ptr<floppy_format_info>> floppy_format_infos;
std::vector<std::unique_ptr<filesystem_format>> filesystem_formats;
std::map<std::string, const floppy_format_info *> floppy_format_info_by_key;
std::map<std::string, const filesystem_format *> filesystem_format_by_key;
std::map<std::string, const floppy_create_info *> floppy_create_info_by_key;
std::map<std::string, std::vector<const floppy_format_info *>> floppy_format_info_by_category;
std::map<std::string, std::vector<const filesystem_format *>> filesystem_format_by_category;
void init();
const floppy_format_info *find_floppy_format_info_by_key(const std::string &key) const;
const filesystem_format *find_filesystem_format_by_key(const std::string &key) const;
const floppy_create_info *find_floppy_create_info_by_key(const std::string &key) const;
};
class image_handler {
public:
image_handler();
void set_on_disk_path(std::string path);
const std::string &get_on_disk_path() const { return m_on_disk_path; }
std::vector<std::pair<u8, const floppy_format_info *>> identify(const formats_table &formats);
bool floppy_load(const floppy_format_info *format);
bool floppy_save(const floppy_format_info *format);
void floppy_create(const floppy_create_info *format, fs_meta_data meta);
bool floppy_mount_fs(const filesystem_format *format);
bool hd_mount_fs(const filesystem_format *format);
void fs_to_floppy();
std::pair<const filesystem_manager_t *, filesystem_t *> get_fs() const { return std::make_pair(m_fsm, m_fs.get()); }
std::vector<std::string> path_split(std::string path) const;
static std::vector<u8> fload(std::string path);
static std::vector<u8> fload_rsrc(std::string path);
static void fsave(std::string path, const std::vector<u8> &data);
static void fsave_rsrc(std::string path, const std::vector<u8> &data);
static bool fexists(std::string path);
static std::string path_make_rsrc(std::string path);
private:
std::string m_on_disk_path;
floppy_image m_floppy_image;
floppy_format_type m_floppy_fs_converter;
std::vector<u8> m_sector_image;
std::unique_ptr<fsblk_t> m_fsblk;
const filesystem_manager_t *m_fsm;
std::unique_ptr<filesystem_t> m_fs;
};
#endif // MAME_TOOLS_IMAGE_HANDLER_H

View File

@ -0,0 +1,107 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
charconv.cpp
Imgtool character set conversion routines.
***************************************************************************/
#include "charconv.h"
#include "corestr.h"
#include <algorithm>
imgtool::simple_charconverter imgtool::charconverter_iso_8859_1(nullptr, nullptr);
//-------------------------------------------------
// simple_charconverter::simple_charconverter
//-------------------------------------------------
imgtool::simple_charconverter::simple_charconverter(const char32_t lowpage[0x80], const char32_t highpage[0x80], unicode_normalization_form norm)
: m_norm(norm), m_lowpage(lowpage), m_highpage(highpage)
{
// build the reverse lookup table
for (int i = 0; i < 256; i++)
{
const char32_t *page = i >= 128 ? m_highpage : m_lowpage;
char32_t unicode_char = page ? page[i % 128] : i;
m_reverse_lookup.emplace_back(unicode_char, (char)i);
}
// and sort it
std::sort(m_reverse_lookup.begin(), m_reverse_lookup.end(), [](const std::pair<char32_t, char> &a, const std::pair<char32_t, char> &b)
{
return b.first > a.first;
});
}
//-------------------------------------------------
// from_utf8
//-------------------------------------------------
void imgtool::simple_charconverter::from_utf8(std::ostream &dest, std::string_view src) const
{
// normalize the incoming unicode
std::string const normalized_src = normalize_unicode(src, m_norm);
auto nsrc = std::string_view(normalized_src);
while (!nsrc.empty())
{
// get the next character
char32_t ch;
int rc = uchar_from_utf8(&ch, nsrc);
if (rc < 0)
{
ch = 0xFFFD;
rc = 1;
}
nsrc.remove_prefix(rc);
// do the reverse lookup
auto lookup = std::lower_bound(m_reverse_lookup.begin(), m_reverse_lookup.end(), ch, [](const std::pair<char32_t, char> &a, const char32_t &b)
{
return a.first < b;
});
if (lookup == m_reverse_lookup.end())
throw charconverter_exception();
// and output the results
dest << lookup->second;
}
}
//-------------------------------------------------
// to_utf8
//-------------------------------------------------
void imgtool::simple_charconverter::to_utf8(std::ostream &dest, std::string_view src) const
{
for (uint8_t c : src)
{
// which page is this in?
const char32_t *page = ((c & 0x80) == 0) ? m_lowpage : m_highpage;
// is this page present?
if ((c & 0x80) == 0)
{
// no - pass it on
dest << c;
}
else
{
// yes - we need to do a lookup
size_t base = ((c & 0x80) == 0) ? 0x00 : 0x80;
char32_t ch = page[((unsigned char)(c)) - base];
if (ch == 0)
throw charconverter_exception();
dest << utf8_from_uchar(ch);
}
}
}

View File

@ -0,0 +1,82 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
charconv.h
Imgtool character set conversion routines.
***************************************************************************/
#ifndef IMGTOOL_CHARCONV_H
#define IMGTOOL_CHARCONV_H
#include "unicode.h"
#include <sstream>
#include <utility>
#include <vector>
namespace imgtool
{
// ======================> charconverter
// abstract base class for character conversions
class charconverter
{
public:
virtual void from_utf8(std::ostream &dest, std::string_view src) const = 0;
virtual void to_utf8(std::ostream &dest, std::string_view src) const = 0;
std::string from_utf8(const std::string &src) const
{
// inlining so that the return value can potentially be removed by return value optimization
std::ostringstream stream;
from_utf8(stream, src);
return stream.str();
}
std::string to_utf8(const std::string &src) const
{
// inlining so that the return value can potentially be removed by return value optimization
std::ostringstream stream;
to_utf8(stream, src);
return stream.str();
}
};
// ======================> simple_charconverter
// a simple implementation of charconverter that simply defines a code page for 0x80-0xFF
class simple_charconverter : public charconverter
{
public:
simple_charconverter(const char32_t highpage[0x80], unicode_normalization_form norm = unicode_normalization_form::C)
: simple_charconverter(nullptr, highpage, norm)
{
}
simple_charconverter(const char32_t lowpage[0x80], const char32_t highpage[0x80], unicode_normalization_form norm = unicode_normalization_form::C);
virtual void from_utf8(std::ostream &dest, std::string_view src) const override;
virtual void to_utf8(std::ostream &dest, std::string_view src) const override;
private:
std::vector<std::pair<char32_t, char> > m_reverse_lookup;
unicode_normalization_form m_norm;
const char32_t *m_lowpage;
const char32_t *m_highpage;
};
// exception that can be thrown from charconverter::from_utf8() if a character is illegal (charconverter::to_utf8() should never throw this)
class charconverter_exception
{
};
extern simple_charconverter charconverter_iso_8859_1;
};
#endif // IMGTOOL_CHARCONV_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,108 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/****************************************************************************
filteoln.c
Native end-of-line filter
*****************************************************************************/
#include "imgtool.h"
#include "filter.h"
#include <cstring>
#define EOLN (CRLF == 1 ? "\r" : (CRLF == 2 ? "\n" : (CRLF == 3 ? "\r\n" : NULL)))
static imgtoolerr_t convert_stream_eolns(imgtool::stream &source, imgtool::stream &dest, const char *eoln)
{
size_t len, i, pos;
char buffer[2000];
int hit_cr = false;
while((len = source.read(buffer, sizeof(buffer))) > 0)
{
pos = 0;
for (i = 0; i < len; i++)
{
switch(buffer[i])
{
case '\r':
case '\n':
if (!hit_cr || (buffer[i] != '\n'))
{
if (i > pos)
dest.write(buffer + pos, i - pos);
dest.write(eoln, strlen(eoln));
}
pos = i + 1;
break;
}
hit_cr = (buffer[i] == '\r');
}
if (i > pos)
dest.write(buffer + pos, i - pos);
}
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t ascii_readfile(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf)
{
imgtoolerr_t err;
imgtool::stream::ptr mem_stream;
mem_stream = imgtool::stream::open_mem(nullptr, 0);
if (!mem_stream)
return IMGTOOLERR_OUTOFMEMORY;
err = partition.read_file(filename, fork, *mem_stream, nullptr);
if (err)
return err;
mem_stream->seek(SEEK_SET, 0);
return convert_stream_eolns(*mem_stream, destf, EOLN);
}
static imgtoolerr_t ascii_writefile(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &sourcef, util::option_resolution *opts)
{
imgtoolerr_t err;
imgtool::stream::ptr mem_stream;
const char *eoln;
/* create a stream */
mem_stream = imgtool::stream::open_mem(nullptr, 0);
if (!mem_stream)
return IMGTOOLERR_OUTOFMEMORY;
eoln = partition.get_info_string(IMGTOOLINFO_STR_EOLN);
err = convert_stream_eolns(sourcef, *mem_stream, eoln);
if (err)
return err;
mem_stream->seek(SEEK_SET, 0);
return partition.write_file(filename, fork, *mem_stream, opts, nullptr);
}
void filter_eoln_getinfo(uint32_t state, union filterinfo *info)
{
switch(state)
{
case FILTINFO_STR_NAME: info->s = "ascii"; break;
case FILTINFO_STR_HUMANNAME: info->s = "Ascii"; break;
case FILTINFO_PTR_READFILE: info->read_file = ascii_readfile; break;
case FILTINFO_PTR_WRITEFILE: info->write_file = ascii_writefile; break;
}
}

View File

@ -0,0 +1,83 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
filter.c
Imgtool filters
***************************************************************************/
#include "filter.h"
#include <cstring>
/* ----------------------------------------------------------------------- */
int64_t filter_get_info_int(filter_getinfoproc get_info, uint32_t state)
{
union filterinfo info;
info.i = 0;
get_info(state, &info);
return info.i;
}
void *filter_get_info_ptr(filter_getinfoproc get_info, uint32_t state)
{
union filterinfo info;
info.p = nullptr;
get_info(state, &info);
return info.p;
}
void *filter_get_info_fct(filter_getinfoproc get_info, uint32_t state)
{
union filterinfo info;
info.f = nullptr;
get_info(state, &info);
return info.f;
}
const char *filter_get_info_string(filter_getinfoproc get_info, uint32_t state)
{
union filterinfo info;
info.s = nullptr;
get_info(state, &info);
return info.s;
}
/* ----------------------------------------------------------------------- */
const filter_getinfoproc filters[] =
{
filter_eoln_getinfo,
filter_cocobas_getinfo,
filter_dragonbas_getinfo,
filter_macbinary_getinfo,
filter_vzsnapshot_getinfo,
filter_vzbas_getinfo,
filter_thombas5_getinfo,
filter_thombas7_getinfo,
filter_thombas128_getinfo,
filter_thomcrypt_getinfo,
filter_bml3bas_getinfo,
filter_hp9845data_getinfo,
nullptr
};
filter_getinfoproc filter_lookup(const char *name)
{
int i;
const char *filter_name;
for (i = 0; filters[i]; i++)
{
filter_name = filter_get_info_string(filters[i], FILTINFO_STR_NAME);
if (!strcmp(name, filter_name))
return filters[i];
}
return nullptr;
}

View File

@ -0,0 +1,63 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
filter.h
Imgtool filters
***************************************************************************/
#ifndef FILTER_H
#define FILTER_H
#include "library.h"
struct imgtool_filter;
enum
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
FILTINFO_INT_FIRST = 0x00000,
FILTINFO_INT_STATESIZE,
/* --- the following bits of info are returned as pointers to data or functions --- */
FILTINFO_PTR_FIRST = 0x10000,
FILTINFO_PTR_READFILE,
FILTINFO_PTR_WRITEFILE,
FILTINFO_PTR_CHECKSTREAM,
/* --- the following bits of info are returned as NULL-terminated strings --- */
FILTINFO_STR_FIRST = 0x20000,
FILTINFO_STR_NAME,
FILTINFO_STR_HUMANNAME,
FILTINFO_STR_EXTENSION
};
extern const filter_getinfoproc filters[];
filter_getinfoproc filter_lookup(const char *name);
/* ----------------------------------------------------------------------- */
int64_t filter_get_info_int(filter_getinfoproc get_info, uint32_t state);
void *filter_get_info_ptr(filter_getinfoproc get_info, uint32_t state);
void *filter_get_info_fct(filter_getinfoproc get_info, uint32_t state);
const char *filter_get_info_string(filter_getinfoproc get_info, uint32_t state);
/* ----------------------------------------------------------------------- */
extern void filter_eoln_getinfo(uint32_t state, union filterinfo *info);
extern void filter_cocobas_getinfo(uint32_t state, union filterinfo *info);
extern void filter_dragonbas_getinfo(uint32_t state, union filterinfo *info);
extern void filter_macbinary_getinfo(uint32_t state, union filterinfo *info);
extern void filter_vzsnapshot_getinfo(uint32_t state, union filterinfo *info);
extern void filter_vzbas_getinfo(uint32_t state, union filterinfo *info);
extern void filter_thombas5_getinfo(uint32_t state, union filterinfo *info);
extern void filter_thombas7_getinfo(uint32_t state, union filterinfo *info);
extern void filter_thombas128_getinfo(uint32_t state, union filterinfo *info);
extern void filter_thomcrypt_getinfo(uint32_t state, union filterinfo *info);
extern void filter_bml3bas_getinfo(uint32_t state, union filterinfo *info);
extern void filter_hp9845data_getinfo(uint32_t state, union filterinfo *info);
#endif /* FILTER_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/*********************************************************************
formats/coco_dsk.h
Tandy Color Computer / Dragon disk images
*********************************************************************/
#ifndef COCO_DSK_H
#define COCO_DSK_H
#include "formats/flopimg_legacy.h"
/**************************************************************************/
LEGACY_FLOPPY_OPTIONS_EXTERN(coco);
FLOPPY_IDENTIFY(coco_dmk_identify);
FLOPPY_CONSTRUCT(coco_dmk_construct);
#endif /* COCO_DSK_H */

View File

@ -0,0 +1,140 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/*********************************************************************
formats/pc_dsk_legacy.cpp
PC disk images (legacy support for imgtool)
*********************************************************************/
#include "formats/pc_dsk_legacy.h"
#include "formats/basicdsk.h"
#include "opresolv.h"
struct pc_disk_sizes
{
uint32_t image_size;
int sectors;
int heads;
};
static const struct pc_disk_sizes disk_sizes[] =
{
{ 8*1*40*512, 8, 1}, /* 5 1/4 inch double density single sided */
{ 8*2*40*512, 8, 2}, /* 5 1/4 inch double density */
{ 9*1*40*512, 9, 1}, /* 5 1/4 inch double density single sided */
{ 9*2*40*512, 9, 2}, /* 5 1/4 inch double density */
{10*2*40*512, 10, 2}, /* 5 1/4 inch double density single sided */
{ 9*2*80*512, 9, 2}, /* 80 tracks 5 1/4 inch drives rare in PCs */
{ 9*2*80*512, 9, 2}, /* 3 1/2 inch double density */
{15*2*80*512, 15, 2}, /* 5 1/4 inch high density (or japanese 3 1/2 inch high density) */
{18*2*80*512, 18, 2}, /* 3 1/2 inch high density */
{21*2*80*512, 21, 2}, /* 3 1/2 inch high density DMF */
{36*2*80*512, 36, 2} /* 3 1/2 inch enhanced density */
};
static floperr_t pc_dsk_compute_geometry(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry)
{
int i;
uint64_t size;
memset(geometry, 0, sizeof(*geometry));
size = floppy_image_size(floppy);
for (i = 0; i < std::size(disk_sizes); i++)
{
if (disk_sizes[i].image_size == size)
{
geometry->sectors = disk_sizes[i].sectors;
geometry->heads = disk_sizes[i].heads;
geometry->sector_length = 512;
geometry->first_sector_id = 1;
geometry->tracks = (int) (size / disk_sizes[i].sectors / disk_sizes[i].heads / geometry->sector_length);
return FLOPPY_ERROR_SUCCESS;
}
}
if (size >= 0x1a)
{
/*
* get info from boot sector.
* not correct on all disks
*/
uint8_t scl, spt, heads;
floppy_image_read(floppy, &scl, 0x0c, 1);
floppy_image_read(floppy, &spt, 0x18, 1);
floppy_image_read(floppy, &heads, 0x1A, 1);
if (size == ((uint64_t) scl) * spt * heads * 0x200)
{
geometry->sectors = spt;
geometry->heads = heads;
geometry->sector_length = 512;
geometry->first_sector_id = 1;
geometry->tracks = scl;
return FLOPPY_ERROR_SUCCESS;
}
}
return FLOPPY_ERROR_SUCCESS;
}
static FLOPPY_IDENTIFY(pc_dsk_identify)
{
floperr_t err;
struct basicdsk_geometry geometry;
err = pc_dsk_compute_geometry(floppy, &geometry);
if (err)
return err;
*vote = geometry.heads ? 100 : 0;
return FLOPPY_ERROR_SUCCESS;
}
static FLOPPY_CONSTRUCT(pc_dsk_construct)
{
floperr_t err;
struct basicdsk_geometry geometry;
if (params)
{
/* create */
memset(&geometry, 0, sizeof(geometry));
geometry.heads = params->lookup_int(PARAM_HEADS);
geometry.tracks = params->lookup_int(PARAM_TRACKS);
geometry.sectors = params->lookup_int(PARAM_SECTORS);
geometry.first_sector_id = 1;
geometry.sector_length = 512;
}
else
{
/* open */
err = pc_dsk_compute_geometry(floppy, &geometry);
if (err)
return err;
}
return basicdsk_construct(floppy, &geometry);
}
/* ----------------------------------------------------------------------- */
LEGACY_FLOPPY_OPTIONS_START( pc )
LEGACY_FLOPPY_OPTION( pc_dsk, "dsk,ima,img,ufi,360", "PC floppy disk image", pc_dsk_identify, pc_dsk_construct, nullptr,
HEADS([1]-2)
TRACKS(40/[80])
SECTORS(8/[9]/10/15/18/36))
LEGACY_FLOPPY_OPTIONS_END

View File

@ -0,0 +1,21 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/*********************************************************************
formats/pc_dsk_legacy.h
PC disk images (legacy support for imgtool)
*********************************************************************/
#ifndef PC_DSK_LEGACY_H
#define PC_DSK_LEGACY_H
#include "formats/flopimg_legacy.h"
/**************************************************************************/
LEGACY_FLOPPY_OPTIONS_EXTERN(pc);
#endif /* PC_DSK_LEGACY_H */

View File

@ -0,0 +1,58 @@
// license:GPL-2.0+
// copyright-holders:Juergen Buchmueller
/*********************************************************************
formats/vt_dsk_legacy.cpp
VTech Laser/VZ disk images (legacy support)
*********************************************************************/
#include "formats/vt_dsk_legacy.h"
#include "formats/basicdsk.h"
#include "opresolv.h"
#include <cstring>
static FLOPPY_IDENTIFY(vz_identify)
{
uint64_t size = floppy_image_size(floppy);
*vote = ((size == 98560) || (size == 99200) || (size == 99184)) ? 100 : 0;
return FLOPPY_ERROR_SUCCESS;
}
static FLOPPY_CONSTRUCT(vz_construct)
{
struct basicdsk_geometry geometry;
memset(&geometry, 0, sizeof(geometry));
if (params)
{
geometry.heads = params->lookup_int(PARAM_HEADS);
geometry.tracks = params->lookup_int(PARAM_TRACKS);
geometry.sectors = params->lookup_int(PARAM_SECTORS);
geometry.first_sector_id = params->lookup_int(PARAM_FIRST_SECTOR_ID);
geometry.sector_length = params->lookup_int(PARAM_SECTOR_LENGTH);
}
else
{
geometry.heads = 1;
geometry.tracks = 40;
geometry.sectors = 16;
geometry.first_sector_id = 0;
geometry.sector_length = floppy_image_size(floppy)/geometry.tracks/geometry.sectors;
}
return basicdsk_construct(floppy, &geometry);
}
LEGACY_FLOPPY_OPTIONS_START(vz)
LEGACY_FLOPPY_OPTION(vtech1, "dsk", "Laser/VZ disk image", vz_identify, vz_construct, NULL,
HEADS([1])
TRACKS([40])
SECTORS([16])
SECTOR_LENGTH([154])
FIRST_SECTOR_ID([0]))
LEGACY_FLOPPY_OPTIONS_END

View File

@ -0,0 +1,18 @@
// license:GPL-2.0+
// copyright-holders:Juergen Buchmueller
/*********************************************************************
formats/vt_dsk_legacy.h
VTech Laser/VZ disk images (legacy support)
*********************************************************************/
#ifndef VT_DSK_LEGACY_H
#define VT_DSK_LEGACY_H
#include "formats/flopimg_legacy.h"
LEGACY_FLOPPY_OPTIONS_EXTERN(vz);
#endif /* VT_DSK_LEGACY_H */

View File

@ -0,0 +1,324 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/*********************************************************************
iflopimg.c
Bridge code for Imgtool into the standard floppy code
*********************************************************************/
#include "iflopimg.h"
#include "imgtool.h"
#include "library.h"
#include "ioprocs.h"
#include <cstdio>
imgtoolerr_t imgtool_floppy_error(floperr_t err)
{
switch(err)
{
case FLOPPY_ERROR_SUCCESS:
return IMGTOOLERR_SUCCESS;
case FLOPPY_ERROR_OUTOFMEMORY:
return IMGTOOLERR_OUTOFMEMORY;
case FLOPPY_ERROR_INVALIDIMAGE:
return IMGTOOLERR_CORRUPTIMAGE;
case FLOPPY_ERROR_SEEKERROR:
return IMGTOOLERR_SEEKERROR;
case FLOPPY_ERROR_UNSUPPORTED:
return IMGTOOLERR_UNIMPLEMENTED;
default:
return IMGTOOLERR_UNEXPECTED;
}
}
/*********************************************************************
Imgtool handlers
*********************************************************************/
struct imgtool_floppy_image
{
floppy_image_legacy *floppy;
};
static imgtoolerr_t imgtool_floppy_open_internal(imgtool::image &image, imgtool::stream::ptr &&stream)
{
floperr_t ferr;
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
struct imgtool_floppy_image *fimg;
const imgtool_class *imgclass;
const struct FloppyFormat *format;
imgtoolerr_t (*open)(imgtool::image &image, imgtool::stream *f);
fimg = (struct imgtool_floppy_image *) image.extra_bytes();
imgclass = &image.module().imgclass;
format = (const struct FloppyFormat *) imgclass->derived_param;
open = (imgtoolerr_t (*)(imgtool::image &, imgtool::stream *)) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_OPEN);
// open up the floppy
ferr = floppy_open(imgtool::stream_read_write(std::move(stream), 0xff), "", format, FLOPPY_FLAGS_READWRITE, &fimg->floppy);
if (ferr)
{
err = imgtool_floppy_error(ferr);
goto done;
}
if (open)
{
err = open(image, nullptr);
if (err)
goto done;
}
done:
if (err && fimg->floppy)
{
floppy_close(fimg->floppy);
fimg->floppy = nullptr;
}
return err;
}
static imgtoolerr_t imgtool_floppy_open(imgtool::image &image, imgtool::stream::ptr &&stream)
{
return imgtool_floppy_open_internal(image, std::move(stream));
}
static imgtoolerr_t imgtool_floppy_create(imgtool::image &image, imgtool::stream::ptr &&stream, util::option_resolution *opts)
{
floperr_t ferr;
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
struct imgtool_floppy_image *fimg;
const imgtool_class *imgclass;
const struct FloppyFormat *format;
imgtoolerr_t (*create)(imgtool::image &, imgtool::stream *, util::option_resolution *);
imgtoolerr_t (*open)(imgtool::image &, imgtool::stream *f);
fimg = (struct imgtool_floppy_image *) image.extra_bytes();
imgclass = &image.module().imgclass;
format = (const struct FloppyFormat *) imgclass->derived_param;
create = (imgtoolerr_t (*)(imgtool::image &, imgtool::stream *, util::option_resolution *)) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_CREATE);
open = (imgtoolerr_t (*)(imgtool::image &, imgtool::stream *)) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_OPEN);
// open up the floppy
ferr = floppy_create(imgtool::stream_read_write(std::move(stream), 0xff), format, opts, &fimg->floppy);
if (ferr)
{
err = imgtool_floppy_error(ferr);
goto done;
}
// do we have to do extra stuff when creating the image?
if (create)
{
err = create(image, nullptr, opts);
if (err)
goto done;
}
// do we have to do extra stuff when opening the image?
if (open)
{
err = open(image, nullptr);
if (err)
goto done;
}
done:
if (err && fimg->floppy)
{
floppy_close(fimg->floppy);
fimg->floppy = nullptr;
}
return err;
}
static void imgtool_floppy_close(imgtool::image &img)
{
floppy_close(imgtool_floppy(img));
}
static imgtoolerr_t imgtool_floppy_read_sector(imgtool::image &image, uint32_t track, uint32_t head, uint32_t sector, std::vector<uint8_t> &buffer)
{
floperr_t ferr;
uint32_t sector_size;
// get the sector length
ferr = floppy_get_sector_length(imgtool_floppy(image), head, track, sector, &sector_size);
if (ferr)
return imgtool_floppy_error(ferr);
// resize the buffer accordingly
try { buffer.resize(sector_size); }
catch (std::bad_alloc const &) { return IMGTOOLERR_OUTOFMEMORY; }
// and read the sector
ferr = floppy_read_sector(imgtool_floppy(image), head, track, sector, 0, &buffer[0], sector_size);
if (ferr)
return imgtool_floppy_error(ferr);
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t imgtool_floppy_write_sector(imgtool::image &image, uint32_t track, uint32_t head, uint32_t sector, const void *buffer, size_t len, int ddam)
{
floperr_t ferr;
ferr = floppy_write_sector(imgtool_floppy(image), head, track, sector, 0, buffer, len, ddam);
if (ferr)
return imgtool_floppy_error(ferr);
return IMGTOOLERR_SUCCESS;
}
static void imgtool_floppy_get_info(const imgtool_class *imgclass, uint32_t state, union imgtoolinfo *info)
{
const struct FloppyFormat *format;
imgtool_class derived_class;
format = (const struct FloppyFormat *) imgclass->derived_param;
memset(&derived_class, 0, sizeof(derived_class));
derived_class.get_info = imgclass->derived_get_info;
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES:
info->i = sizeof(struct imgtool_floppy_image) +
imgtool_get_info_int(&derived_class, IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES);
break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case IMGTOOLINFO_STR_NAME:
sprintf(info->s = imgtool_temp_str(), "%s_%s", format->name,
imgtool_get_info_string(&derived_class, IMGTOOLINFO_STR_NAME));
break;
case IMGTOOLINFO_STR_DESCRIPTION:
sprintf(info->s = imgtool_temp_str(), "%s (%s)", format->description,
imgtool_get_info_string(&derived_class, IMGTOOLINFO_STR_DESCRIPTION));
break;
case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), format->extensions); break;
case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: info->p = (void*)format->param_guidelines; break;
/* --- the following bits of info are returned as pointers to data or functions --- */
case IMGTOOLINFO_PTR_OPEN: info->open = imgtool_floppy_open; break;
case IMGTOOLINFO_PTR_CREATE: info->create = imgtool_floppy_create; break;
case IMGTOOLINFO_PTR_CLOSE: info->close = imgtool_floppy_close; break;
case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = format->param_guidelines ? &floppy_option_guide() : nullptr; break;
case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = imgtool_floppy_read_sector; break;
case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = imgtool_floppy_write_sector; break;
default: imgclass->derived_get_info(imgclass, state, info); break;
}
}
int imgtool_floppy_make_class(int index, imgtool_class *imgclass)
{
const struct FloppyFormat *format;
/* get the format */
format = (const struct FloppyFormat *)
imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_FLOPPY_FORMAT);
assert(format);
if (!format[index].construct)
return false;
imgclass->derived_get_info = imgclass->get_info;
imgclass->get_info = imgtool_floppy_get_info;
imgclass->derived_param = (void *) &format[index];
return true;
}
floppy_image_legacy *imgtool_floppy(imgtool::image &img)
{
struct imgtool_floppy_image *fimg;
fimg = (struct imgtool_floppy_image *) img.extra_bytes();
return fimg->floppy;
}
static imgtoolerr_t imgtool_floppy_transfer_sector_tofrom_stream(imgtool::image &img, int head, int track, int sector, int offset, size_t length, imgtool::stream &f, int direction)
{
floperr_t err;
floppy_image_legacy *floppy;
std::vector<uint8_t> buffer;
floppy = imgtool_floppy(img);
buffer.resize(length);
if (direction)
{
err = floppy_read_sector(floppy, head, track, sector, offset, &buffer[0], length);
if (err)
goto done;
f.write(&buffer[0], length);
}
else
{
f.read(&buffer[0], length);
err = floppy_write_sector(floppy, head, track, sector, offset, &buffer[0], length, 0); /* TODO: pass ddam argument from imgtool */
if (err)
goto done;
}
err = FLOPPY_ERROR_SUCCESS;
done:
return imgtool_floppy_error(err);
}
imgtoolerr_t imgtool_floppy_read_sector_to_stream(imgtool::image &img, int head, int track, int sector, int offset, size_t length, imgtool::stream &f)
{
return imgtool_floppy_transfer_sector_tofrom_stream(img, head, track, sector, offset, length, f, 1);
}
imgtoolerr_t imgtool_floppy_write_sector_from_stream(imgtool::image &img, int head, int track, int sector, int offset, size_t length, imgtool::stream &f)
{
return imgtool_floppy_transfer_sector_tofrom_stream(img, head, track, sector, offset, length, f, 0);
}
void *imgtool_floppy_extrabytes(imgtool::image &img)
{
struct imgtool_floppy_image *fimg;
fimg = (struct imgtool_floppy_image *) img.extra_bytes();
return fimg + 1;
}

View File

@ -0,0 +1,44 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/*********************************************************************
iflopimg.h
Bridge code for Imgtool into the standard floppy code
*********************************************************************/
#ifndef MAME_TOOLS_IMGTOOL_IFLOPIMG_H
#define MAME_TOOLS_IMGTOOL_IFLOPIMG_H
#pragma once
#include "library.h"
#include "formats/flopimg_legacy.h"
/***************************************************************************
Prototypes
***************************************************************************/
enum
{
IMGTOOLINFO_PTR_FLOPPY_FORMAT = IMGTOOLINFO_PTR_CLASS_SPECIFIC,
IMGTOOLINFO_PTR_FLOPPY_OPEN,
IMGTOOLINFO_PTR_FLOPPY_CREATE
};
int imgtool_floppy_make_class(int index, imgtool_class *imgclass);
floppy_image_legacy *imgtool_floppy(imgtool::image &img);
imgtoolerr_t imgtool_floppy_error(floperr_t err);
imgtoolerr_t imgtool_floppy_read_sector_to_stream(imgtool::image &img, int head, int track, int sector, int offset, size_t length, imgtool::stream &f);
imgtoolerr_t imgtool_floppy_write_sector_from_stream(imgtool::image &img, int head, int track, int sector, int offset, size_t length, imgtool::stream &f);
void *imgtool_floppy_extrabytes(imgtool::image &img);
#endif // MAME_TOOLS_IMGTOOL_IFLOPIMG_H

250
src/tools/imgtool/imghd.cpp Normal file
View File

@ -0,0 +1,250 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods, Raphael Nabet
/*
Code to interface the MESS image code with MAME's harddisk core.
We do not support diff files as it will involve some changes in the MESS
image code.
Raphael Nabet 2003
*/
#include "imghd.h"
#include "library.h"
#include "stream.h"
#include "harddisk.h"
#include "opresolv.h"
static imgtoolerr_t map_chd_error(std::error_condition chderr)
{
if (!chderr)
return IMGTOOLERR_SUCCESS;
else if (std::errc::not_enough_memory == chderr)
return IMGTOOLERR_OUTOFMEMORY;
else if (chd_file::error::FILE_NOT_WRITEABLE == chderr)
return IMGTOOLERR_READONLY;
else
return IMGTOOLERR_UNEXPECTED;
}
/*
imghd_create()
Create a MAME HD image
*/
imgtoolerr_t imghd_create(imgtool::stream &stream, uint32_t hunksize, uint32_t cylinders, uint32_t heads, uint32_t sectors, uint32_t seclen)
{
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
chd_file chd;
std::error_condition rc;
chd_codec_type compression[4] = { CHD_CODEC_NONE };
/* sanity check args -- see parse_hunk_size() in src/lib/util/chd.cpp */
if (hunksize > (1024 * 1024))
{
err = IMGTOOLERR_PARAMCORRUPT;
return err;
}
if (hunksize <= 0)
hunksize = 4096; /* default value */
/* bail if we are read only */
if (stream.is_read_only())
{
err = IMGTOOLERR_READONLY;
return err;
}
/* calculations */
const uint64_t logicalbytes = (uint64_t)cylinders * heads * sectors * seclen;
/* create the new hard drive */
rc = chd.create(stream_read_write(stream, 0), logicalbytes, hunksize, seclen, compression);
if (rc)
{
err = map_chd_error(rc);
return err;
}
/* write the metadata */
const std::string metadata = util::string_format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, seclen);
rc = chd.write_metadata(HARD_DISK_METADATA_TAG, 0, metadata);
if (rc)
{
err = map_chd_error(rc);
return err;
}
/* alloc and zero buffer */
std::vector<uint8_t> cache;
cache.resize(hunksize);
memset(&cache[0], 0, hunksize);
/* zero out every hunk */
const int totalhunks = (logicalbytes + hunksize - 1) / hunksize;
for (int hunknum = 0; hunknum < totalhunks; hunknum++)
{
rc = chd.write_units(hunknum, &cache[0]);
if (rc)
{
err = IMGTOOLERR_WRITEERROR;
return err;
}
}
return err;
}
/*
imghd_open()
Open stream as a MAME HD image
*/
imgtoolerr_t imghd_open(imgtool::stream &stream, struct mess_hard_disk_file *hard_disk)
{
std::error_condition chderr;
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
hard_disk->hard_disk = nullptr;
chderr = hard_disk->chd.open(stream_read_write(stream, 0), !stream.is_read_only());
if (chderr)
{
err = map_chd_error(chderr);
goto done;
}
hard_disk->hard_disk = hard_disk_open(&hard_disk->chd);
if (!hard_disk->hard_disk)
{
err = IMGTOOLERR_UNEXPECTED;
goto done;
}
hard_disk->stream = &stream;
done:
if (err)
imghd_close(hard_disk);
return err;
}
/*
imghd_close()
Close MAME HD image
*/
void imghd_close(struct mess_hard_disk_file *disk)
{
if (disk->hard_disk)
{
hard_disk_close(disk->hard_disk);
disk->hard_disk = nullptr;
}
if (disk->stream)
{
delete disk->stream;
disk->stream = nullptr;
}
}
/*
imghd_read()
Read sector(s) from MAME HD image
*/
imgtoolerr_t imghd_read(struct mess_hard_disk_file *disk, uint32_t lbasector, void *buffer)
{
uint32_t reply = hard_disk_read(disk->hard_disk, lbasector, buffer);
return reply ? IMGTOOLERR_SUCCESS : IMGTOOLERR_READERROR;
}
/*
imghd_write()
Write sector(s) from MAME HD image
*/
imgtoolerr_t imghd_write(struct mess_hard_disk_file *disk, uint32_t lbasector, const void *buffer)
{
uint32_t reply = hard_disk_write(disk->hard_disk, lbasector, buffer);
return reply ? IMGTOOLERR_SUCCESS : IMGTOOLERR_WRITEERROR;
}
/*
imghd_get_header()
Return pointer to the header of MAME HD image
*/
const hard_disk_info *imghd_get_header(struct mess_hard_disk_file *disk)
{
const hard_disk_info *reply;
reply = hard_disk_get_info(disk->hard_disk);
return reply;
}
static imgtoolerr_t mess_hd_image_create(imgtool::image &image, imgtool::stream::ptr &&stream, util::option_resolution *createoptions);
enum
{
mess_hd_createopts_blocksize = 'B',
mess_hd_createopts_cylinders = 'C',
mess_hd_createopts_heads = 'D',
mess_hd_createopts_sectors = 'E',
mess_hd_createopts_seclen = 'F'
};
OPTION_GUIDE_START( mess_hd_create_optionguide )
OPTION_INT(mess_hd_createopts_blocksize, "blocksize", "Sectors Per Block" )
OPTION_INT(mess_hd_createopts_cylinders, "cylinders", "Cylinders" )
OPTION_INT(mess_hd_createopts_heads, "heads", "Heads" )
OPTION_INT(mess_hd_createopts_sectors, "sectors", "Total Sectors" )
OPTION_INT(mess_hd_createopts_seclen, "seclen", "Sector Bytes" )
OPTION_GUIDE_END
#define mess_hd_create_optionspecs "B1-[4]-2048;C1-[32]-65536;D1-[8]-64;E1-[128]-4096;F128/256/[512]/1024/2048/4096/8192/16384/32768/65536"
void hd_get_info(const imgtool_class *imgclass, uint32_t state, union imgtoolinfo *info)
{
switch(state)
{
case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mess_hd"); break;
case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "MESS hard disk image"); break;
case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break;
case IMGTOOLINFO_PTR_CREATE: info->create = mess_hd_image_create; break;
case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = &mess_hd_create_optionguide; break;
case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), mess_hd_create_optionspecs); break;
}
}
static imgtoolerr_t mess_hd_image_create(imgtool::image &image, imgtool::stream::ptr &&stream, util::option_resolution *createoptions)
{
uint32_t blocksize, cylinders, heads, sectors, seclen;
/* read options */
blocksize = createoptions->lookup_int(mess_hd_createopts_blocksize);
cylinders = createoptions->lookup_int(mess_hd_createopts_cylinders);
heads = createoptions->lookup_int(mess_hd_createopts_heads);
sectors = createoptions->lookup_int(mess_hd_createopts_sectors);
seclen = createoptions->lookup_int(mess_hd_createopts_seclen);
return imghd_create(*stream.get(), blocksize * seclen, cylinders, heads, sectors, seclen);
}

50
src/tools/imgtool/imghd.h Normal file
View File

@ -0,0 +1,50 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/****************************************************************************
imghd.h
Bridge between Imgtool and CHD hard disk images
****************************************************************************/
#ifndef IMGHD_H
#define IMGHD_H
#include "imgterrs.h"
#include "harddisk.h"
namespace imgtool
{
class stream;
}
struct mess_hard_disk_file
{
imgtool::stream *stream;
hard_disk_file *hard_disk;
chd_file chd;
};
/* create a new hard disk */
imgtoolerr_t imghd_create(imgtool::stream &stream, uint32_t blocksize, uint32_t cylinders, uint32_t heads, uint32_t sectors, uint32_t seclen);
/* opens a hard disk given an Imgtool stream */
imgtoolerr_t imghd_open(imgtool::stream &stream, mess_hard_disk_file *hard_disk);
/* close a hard disk */
void imghd_close(struct mess_hard_disk_file *disk);
/* reads data from a hard disk */
imgtoolerr_t imghd_read(struct mess_hard_disk_file *disk, uint32_t lbasector, void *buffer);
/* writes data to a hard disk */
imgtoolerr_t imghd_write(struct mess_hard_disk_file *disk, uint32_t lbasector, const void *buffer);
/* gets the header from a hard disk */
const hard_disk_info *imghd_get_header(struct mess_hard_disk_file *disk);
#endif /* IMGHD_H */

View File

@ -0,0 +1,56 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
imgterrs.c
Imgtool errors
***************************************************************************/
#include "imgterrs.h"
#include <cassert>
#include <iterator>
static const char *const msgs[] =
{
"Out of memory",
"Unexpected error",
"Argument too long",
"Read error",
"Write error",
"Image is read only",
"Corrupt image",
"Corrupt file",
"Corrupt directory",
"File not found",
"Unrecognized format",
"Not implemented",
"Parameter too small",
"Parameter too large",
"Missing parameter not found",
"Inappropriate parameter",
"Invalid parameter",
"Bad file name",
"Out of space on image",
"Input past end of file",
"Cannot specify path",
"Invalid path",
"Path not found",
"Directory not empty",
"Seek error",
"File system does not support forks",
"Fork not found",
"Invalid partition"
};
const char *imgtool_error(imgtoolerr_t err)
{
err = (imgtoolerr_t)(ERRORCODE(err) - 1);
assert(err >= 0);
assert(err < std::size(msgs));
return msgs[err];
}

View File

@ -0,0 +1,70 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
imgterrs.h
Imgtool errors
***************************************************************************/
#ifndef IMGTERRS_H
#define IMGTERRS_H
/* Error codes */
enum imgtoolerr_t
{
IMGTOOLERR_SUCCESS,
IMGTOOLERR_OUTOFMEMORY,
IMGTOOLERR_UNEXPECTED,
IMGTOOLERR_BUFFERTOOSMALL,
IMGTOOLERR_READERROR,
IMGTOOLERR_WRITEERROR,
IMGTOOLERR_READONLY,
IMGTOOLERR_CORRUPTIMAGE,
IMGTOOLERR_CORRUPTFILE,
IMGTOOLERR_CORRUPTDIR,
IMGTOOLERR_FILENOTFOUND,
IMGTOOLERR_MODULENOTFOUND,
IMGTOOLERR_UNIMPLEMENTED,
IMGTOOLERR_PARAMTOOSMALL,
IMGTOOLERR_PARAMTOOLARGE,
IMGTOOLERR_PARAMNEEDED,
IMGTOOLERR_PARAMNOTNEEDED,
IMGTOOLERR_PARAMCORRUPT,
IMGTOOLERR_BADFILENAME,
IMGTOOLERR_NOSPACE,
IMGTOOLERR_INPUTPASTEND,
IMGTOOLERR_CANNOTUSEPATH,
IMGTOOLERR_INVALIDPATH,
IMGTOOLERR_PATHNOTFOUND,
IMGTOOLERR_DIRNOTEMPTY,
IMGTOOLERR_SEEKERROR,
IMGTOOLERR_NOFORKS,
IMGTOOLERR_FORKNOTFOUND,
IMGTOOLERR_INVALIDPARTITION
};
/* These error codes are actually modifiers that make it easier to distinguish
* the cause of an error
*
* Note - drivers should not use these modifiers
*/
#define IMGTOOLERR_SRC_MODULE 0x1000
#define IMGTOOLERR_SRC_FUNCTIONALITY 0x2000
#define IMGTOOLERR_SRC_IMAGEFILE 0x3000
#define IMGTOOLERR_SRC_FILEONIMAGE 0x4000
#define IMGTOOLERR_SRC_NATIVEFILE 0x5000
#define ERRORCODE(err) ((err) & 0x0fff)
#define ERRORSOURCE(err) ((err) & 0xf000)
#define ERRORPARAM(err) (((err) & 0xf0000) / 0x10000)
#define PARAM_TO_ERROR(errcode, param) ((errcode) | ((param) * 0x10000))
const char *imgtool_error(imgtoolerr_t err);
#endif /* IMGTERRS_H */

File diff suppressed because it is too large Load Diff

265
src/tools/imgtool/imgtool.h Normal file
View File

@ -0,0 +1,265 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
imgtool.h
Main headers for Imgtool core
***************************************************************************/
#ifndef IMGTOOL_H
#define IMGTOOL_H
#include "library.h"
#include "stream.h"
#include "osdcomm.h"
#include <cassert>
#include <cstdlib>
#include <functional>
/* ----------------------------------------------------------------------- */
#define EOLN_CR "\x0d"
#define EOLN_LF "\x0a"
#define EOLN_CRLF "\x0d\x0a"
#define FILENAME_BOOTBLOCK ((const char *) 1)
enum
{
OSD_FOPEN_READ,
OSD_FOPEN_WRITE,
OSD_FOPEN_RW,
OSD_FOPEN_RW_CREATE
};
/* ---------------------------------------------------------------------------
* Image calls
*
* These are the calls that front ends should use for manipulating images. You
* should never call the module functions directly because they may not be
* implemented (i.e. - the function pointers are NULL). The img_* functions are
* aware of these issues and will make the appropriate checks as well as
* marking up return codes with the source. In addition, some of the img_*
* calls are high level calls that simply image manipulation
*
* Calls that return 'int' that are not explicitly noted otherwise return
* imgtool error codes
* ---------------------------------------------------------------------------
*/
struct imgtool_module_features
{
unsigned int supports_create : 1;
unsigned int supports_open : 1;
unsigned int supports_readsector : 1;
unsigned int supports_writesector : 1;
unsigned int is_read_only : 1;
};
struct imgtool_partition_features
{
unsigned int supports_reading : 1;
unsigned int supports_writing : 1;
unsigned int supports_deletefile : 1;
unsigned int supports_directories : 1;
unsigned int supports_freespace : 1;
unsigned int supports_createdir : 1;
unsigned int supports_deletedir : 1;
unsigned int supports_creation_time : 1;
unsigned int supports_lastmodified_time : 1;
unsigned int supports_forks : 1;
unsigned int supports_geticoninfo : 1;
unsigned int is_read_only : 1;
};
/* ----- initialization and basics ----- */
void imgtool_init(bool omit_untested, void (*warning)(const char *message));
void imgtool_exit(void);
const imgtool_module *imgtool_find_module(const std::string &modulename);
const imgtool::library::modulelist &imgtool_get_modules();
imgtool_module_features imgtool_get_module_features(const imgtool_module *module);
void imgtool_warn(const char *format, ...) ATTR_PRINTF(1,2);
// ----- image management -----
namespace imgtool
{
class image
{
public:
typedef std::unique_ptr<image> ptr;
image(const imgtool_module &module);
~image();
static imgtoolerr_t identify_file(const char *filename, imgtool_module **modules, size_t count);
static imgtoolerr_t open(const imgtool_module *module, const std::string &filename, int read_or_write, ptr &outimg);
static imgtoolerr_t open(const std::string &modulename, const std::string &filename, int read_or_write, ptr &outimg);
static imgtoolerr_t create(const imgtool_module *module, const std::string &filename, util::option_resolution *opts, ptr &image);
static imgtoolerr_t create(const std::string &modulename, const std::string &filename, util::option_resolution *opts, ptr &image);
static imgtoolerr_t create(const imgtool_module *module, const std::string &filename, util::option_resolution *opts);
static imgtoolerr_t create(const std::string &modulename, const std::string &filename, util::option_resolution *opts);
std::string info();
imgtoolerr_t get_geometry(uint32_t *tracks, uint32_t *heads, uint32_t *sectors);
imgtoolerr_t read_sector(uint32_t track, uint32_t head, uint32_t sector, std::vector<uint8_t> &buffer);
imgtoolerr_t write_sector(uint32_t track, uint32_t head, uint32_t sector, const void *buffer, size_t len);
imgtoolerr_t get_block_size(uint32_t &length);
imgtoolerr_t read_block(uint64_t block, void *buffer);
imgtoolerr_t write_block(uint64_t block, const void *buffer);
imgtoolerr_t clear_block(uint64_t block, uint8_t data);
imgtoolerr_t list_partitions(std::vector<imgtool::partition_info> &partitions);
const imgtool_module &module() { return m_module; }
void *extra_bytes() { return m_extra_bytes.get(); }
private:
const imgtool_module &m_module;
std::unique_ptr<uint8_t[]> m_extra_bytes;
// because of an idiosyncrasy of how imgtool::image::internal_open() works, we are only "okay to close"
// by invoking the module's close function once internal_open() succeeds. the long term solution is
// better C++ adoption (e.g. - std::unique_ptr<>, std:move() etc)
bool m_okay_to_close;
static imgtoolerr_t internal_open(const imgtool_module *module, const std::string &filename,
int read_or_write, util::option_resolution *createopts, imgtool::image::ptr &outimg);
};
}
namespace imgtool
{
// ----- partition management -----
class partition
{
friend class directory;
public:
typedef std::unique_ptr<partition> ptr;
// ctor/dtor
partition(imgtool::image &image, const imgtool_class &imgclass, int partition_index, uint64_t base_block, uint64_t block_count);
~partition();
static imgtoolerr_t open(imgtool::image &image, int partition_index, ptr &partition);
imgtool::image &image() { return m_image; }
// ----- partition operations -----
imgtoolerr_t get_directory_entry(const char *path, int index, imgtool_dirent &ent);
imgtoolerr_t get_file_size(const char *filename, uint64_t &filesize);
imgtoolerr_t get_free_space(uint64_t &sz);
imgtoolerr_t read_file(const char *filename, const char *fork, imgtool::stream &destf, filter_getinfoproc filter);
imgtoolerr_t write_file(const char *filename, const char *fork, imgtool::stream &sourcef, util::option_resolution *resolution, filter_getinfoproc filter);
imgtoolerr_t get_file(const char *filename, const char *fork, const char *dest, filter_getinfoproc filter);
imgtoolerr_t put_file(const char *newfname, const char *fork, const char *source, util::option_resolution *opts, filter_getinfoproc filter);
imgtoolerr_t delete_file(const char *fname);
imgtoolerr_t list_file_forks(const char *path, std::vector<imgtool::fork_entry> &forks);
imgtoolerr_t create_directory(const char *path);
imgtoolerr_t delete_directory(const char *path);
imgtoolerr_t list_file_attributes(const char *path, uint32_t *attrs, size_t len);
imgtoolerr_t get_file_attributes(const char *path, const uint32_t *attrs, imgtool_attribute *values);
imgtoolerr_t put_file_attributes(const char *path, const uint32_t *attrs, const imgtool_attribute *values);
imgtoolerr_t get_file_attribute(const char *path, uint32_t attr, imgtool_attribute &value);
imgtoolerr_t put_file_attribute(const char *path, uint32_t attr, const imgtool_attribute &value);
void get_attribute_name(uint32_t attribute, const imgtool_attribute *attr_value, char *buffer, size_t buffer_len);
imgtoolerr_t get_icon_info(const char *path, imgtool_iconinfo *iconinfo);
imgtoolerr_t suggest_file_filters(const char *path, imgtool::stream *stream, imgtool_transfer_suggestion *suggestions, size_t suggestions_length);
imgtoolerr_t get_block_size(uint32_t &length);
imgtoolerr_t read_block(uint64_t block, void *buffer);
imgtoolerr_t write_block(uint64_t block, const void *buffer);
imgtoolerr_t get_chain(const char *path, imgtool_chainent *chain, size_t chain_size);
imgtoolerr_t get_chain_string(const char *path, char *buffer, size_t buffer_len);
imgtool_partition_features get_features() const;
void * get_info_ptr(uint32_t state);
const char * get_info_string(uint32_t state);
uint64_t get_info_int(uint32_t state);
void * extra_bytes();
// ----- path management -----
const char * get_root_path();
const char * path_concatenate(const char *path1, const char *path2);
const char * get_base_name(const char *path);
private:
imgtool::image &m_image;
//int m_partition_index;
uint64_t m_base_block;
uint64_t m_block_count;
imgtool_class m_imgclass;
size_t m_directory_extra_bytes;
char m_path_separator;
char m_alternate_path_separator;
unsigned int m_prefer_ucase : 1;
unsigned int m_supports_creation_time : 1;
unsigned int m_supports_lastmodified_time : 1;
unsigned int m_supports_bootblock : 1; /* this module supports loading/storing the boot block */
std::function<imgtoolerr_t(imgtool::directory &enumeration, const char *path)> m_begin_enum;
std::function<imgtoolerr_t(imgtool::directory &enumeration, imgtool_dirent &ent)> m_next_enum;
std::function<void(imgtool::directory &enumeration)> m_close_enum;
std::function<imgtoolerr_t(imgtool::partition &partition, uint64_t *size)> m_free_space;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf)> m_read_file;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &sourcef, util::option_resolution *opts)> m_write_file;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *filename)> m_delete_file;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *path, std::vector<imgtool::fork_entry> &forks)> m_list_forks;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *path)> m_create_dir;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *path)> m_delete_dir;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *path, uint32_t *attrs, size_t len)> m_list_attrs;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *path, const uint32_t *attrs, imgtool_attribute *values)> m_get_attrs;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *path, const uint32_t *attrs, const imgtool_attribute *values)> m_set_attrs;
std::function<imgtoolerr_t(uint32_t attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len)> m_attr_name;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *path, imgtool_iconinfo *iconinfo)> m_get_iconinfo;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)> m_suggest_transfer;
std::function<imgtoolerr_t(imgtool::partition &partition, const char *path, imgtool_chainent *chain, size_t chain_size)> m_get_chain;
const util::option_guide *m_writefile_optguide;
std::string m_writefile_optspec;
std::unique_ptr<uint8_t[]> m_extra_bytes;
// methods
imgtoolerr_t canonicalize_path(uint32_t flags, const char *path, std::string &result);
imgtoolerr_t canonicalize_fork(const char **fork);
imgtoolerr_t map_block_to_image_block(uint64_t partition_block, uint64_t &image_block) const;
};
// ----- directory management -----
class directory
{
public:
typedef std::unique_ptr<directory> ptr;
// ctor/dtor
directory(imgtool::partition &partition);
~directory();
// methods
static imgtoolerr_t open(imgtool::partition &partition, const std::string &path, ptr &outenum);
imgtoolerr_t get_next(imgtool_dirent &ent);
// accessors
imgtool::partition &partition() { return m_partition; }
imgtool::image &image() { return partition().image(); }
const imgtool_module &module() { return partition().image().module(); }
void *extra_bytes() { assert(m_extra_bytes); return m_extra_bytes.get(); }
private:
imgtool::partition &m_partition;
std::unique_ptr<uint8_t[]> m_extra_bytes;
bool m_okay_to_close; // similar wart as what is on imgtool::image
};
};
/* ----- special ----- */
bool imgtool_validitychecks(void);
void unknown_partition_get_info(const imgtool_class *imgclass, uint32_t state, union imgtoolinfo *info);
char *strncpyz(char *dest, const char *source, size_t len);
void rtrim(char *buf);
std::string extract_padded_filename(const char *source, size_t filename_length, size_t extension_length, char pad = ' ');
#endif /* IMGTOOL_H */

View File

@ -0,0 +1,314 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/****************************************************************************
library.cpp
Code relevant to the Imgtool library; analogous to the MESS/MAME driver
list.
****************************************************************************/
#include "library.h"
#include "corestr.h"
#include <algorithm>
#include <cstring>
namespace imgtool {
datetime::imgtool_clock::duration datetime::s_gmt_offset = datetime::calculate_gmt_offset();
//-------------------------------------------------
// datetime ctor
//-------------------------------------------------
datetime::datetime(datetime_type type, std::chrono::time_point<std::chrono::system_clock> tp)
: m_type(type)
, m_time_point(imgtool_clock::from_system_clock(tp))
{
}
//-------------------------------------------------
// datetime ctor
//-------------------------------------------------
datetime::datetime(datetime_type type, time_t t)
: datetime(type, std::chrono::system_clock::from_time_t(t))
{
}
//-------------------------------------------------
// datetime ctor
//-------------------------------------------------
datetime::datetime(datetime_type type, const util::arbitrary_datetime &dt, bool clamp)
: m_type(type)
, m_time_point(imgtool_clock::from_arbitrary_datetime(dt, clamp))
{
}
//-------------------------------------------------
// datetime::now
//-------------------------------------------------
datetime datetime::now(datetime_type type)
{
return imgtool::datetime(
type,
std::chrono::system_clock::now());
}
//-------------------------------------------------
// datetime::localtime
//-------------------------------------------------
std::tm datetime::localtime() const
{
imgtool_clock::time_point tp;
switch (type())
{
case datetime_type::LOCAL:
tp = time_point();
break;
case datetime_type::GMT:
tp = time_point() + s_gmt_offset;
break;
default:
tp = imgtool_clock::time_point();
break;
}
return imgtool_clock::to_tm(tp);
}
//-------------------------------------------------
// datetime::gmtime
//-------------------------------------------------
std::tm datetime::gmtime() const
{
imgtool_clock::time_point tp;
switch (type())
{
case datetime_type::GMT:
tp = time_point();
break;
case datetime_type::LOCAL:
tp = time_point() - s_gmt_offset;
break;
default:
tp = imgtool_clock::time_point();
break;
}
return imgtool_clock::to_tm(tp);
}
//-------------------------------------------------
// datetime::calculate_gmt_offset
//-------------------------------------------------
datetime::imgtool_clock::duration datetime::calculate_gmt_offset()
{
time_t t = time(nullptr);
std::tm utc_tm = *std::gmtime(&t);
time_t utc = mktime(&utc_tm);
std::tm local_tm = *std::localtime(&t);
time_t local = mktime(&local_tm);
double d = difftime(local, utc) * imgtool_clock::period::den / imgtool_clock::period::num;
return imgtool_clock::duration((std::int64_t) d);
}
//-------------------------------------------------
// datetime::to_time_t
//-------------------------------------------------
time_t datetime::to_time_t() const
{
auto system_clock_tp = imgtool_clock::to_system_clock(time_point());
return std::chrono::system_clock::to_time_t(system_clock_tp);
}
//-------------------------------------------------
// ctor
//-------------------------------------------------
library::library()
{
}
//-------------------------------------------------
// dtor
//-------------------------------------------------
library::~library()
{
}
//-------------------------------------------------
// add_class
//-------------------------------------------------
void library::add_class(const imgtool_class *imgclass)
{
char const *temp;
// allocate the module and place it in the chain
m_modules.emplace_back(std::make_unique<imgtool_module>());
imgtool_module *module = m_modules.back().get();
module->imgclass = *imgclass;
module->name = imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_NAME);
module->description = imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_DESCRIPTION);
module->extensions = imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_FILE_EXTENSIONS);
temp = imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_EOLN);
module->eoln = (temp != nullptr) ? temp : "";
module->initial_path_separator = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR) ? true : false;
module->open_is_strict = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_OPEN_IS_STRICT) ? true : false;
module->tracks_are_called_cylinders = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS) ? true : false;
module->writing_untested = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_WRITING_UNTESTED) ? true : false;
module->creation_untested = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_CREATION_UNTESTED) ? true : false;
module->open = (imgtoolerr_t (*)(imgtool::image &, std::unique_ptr<imgtool::stream> &&)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_OPEN);
module->create = (imgtoolerr_t (*)(imgtool::image &, std::unique_ptr<imgtool::stream> &&, util::option_resolution *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_CREATE);
module->close = (void (*)(imgtool::image &)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_CLOSE);
module->info = (void (*)(imgtool::image &, std::ostream &)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_INFO);
module->read_sector = (imgtoolerr_t (*)(imgtool::image &, uint32_t, uint32_t, uint32_t, std::vector<uint8_t> &)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_READ_SECTOR);
module->write_sector = (imgtoolerr_t (*)(imgtool::image &, uint32_t, uint32_t, uint32_t, const void *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_WRITE_SECTOR);
module->get_geometry = (imgtoolerr_t (*)(imgtool::image &, uint32_t *, uint32_t *, uint32_t *))imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_GET_GEOMETRY);
module->read_block = (imgtoolerr_t (*)(imgtool::image &, void *, uint64_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_READ_BLOCK);
module->write_block = (imgtoolerr_t (*)(imgtool::image &, const void *, uint64_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_WRITE_BLOCK);
module->list_partitions = (imgtoolerr_t (*)(imgtool::image &, std::vector<imgtool::partition_info> &)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_LIST_PARTITIONS);
module->block_size = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_BLOCK_SIZE);
module->createimage_optguide = (const util::option_guide *) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE);
temp = (char const *)imgtool_get_info_ptr(imgclass, IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC);
module->createimage_optspec = (temp != nullptr) ? temp : "";
module->image_extra_bytes += imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES);
}
//-------------------------------------------------
// add
//-------------------------------------------------
void library::add(imgtool_get_info get_info)
{
int (*make_class)(int index, imgtool_class *imgclass);
imgtool_class imgclass;
int i, result;
// try this class
memset(&imgclass, 0, sizeof(imgclass));
imgclass.get_info = get_info;
// do we have derived getinfo functions?
make_class = (int (*)(int index, imgtool_class *imgclass))
imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_MAKE_CLASS);
if (make_class)
{
i = 0;
do
{
// clear out the class
memset(&imgclass, 0, sizeof(imgclass));
imgclass.get_info = get_info;
// make the class
result = make_class(i++, &imgclass);
if (result)
add_class(&imgclass);
}
while(result);
}
else
{
add_class(&imgclass);
}
}
//-------------------------------------------------
// unlink
//-------------------------------------------------
void library::unlink(const std::string &module_name)
{
const modulelist::iterator iter = find(module_name);
if (iter != m_modules.end())
m_modules.erase(iter);
}
//-------------------------------------------------
// module_compare
//-------------------------------------------------
int library::module_compare(const imgtool_module *m1, const imgtool_module *m2, sort_type sort)
{
int rc = 0;
switch(sort)
{
case sort_type::NAME:
rc = strcmp(m1->name.c_str(), m2->name.c_str());
break;
case sort_type::DESCRIPTION:
rc = core_stricmp(m1->description.c_str(), m2->description.c_str());
break;
}
return rc;
}
//-------------------------------------------------
// sort
//-------------------------------------------------
void library::sort(sort_type sort)
{
auto compare = [this, sort](const std::unique_ptr<imgtool_module> &a, const std::unique_ptr<imgtool_module> &b)
{
return module_compare(a.get(), b.get(), sort) < 0;
};
m_modules.sort(compare);
}
//-------------------------------------------------
// find
//-------------------------------------------------
library::modulelist::iterator library::find(const std::string &module_name)
{
return std::find_if(
m_modules.begin(),
m_modules.end(),
[module_name](std::unique_ptr<imgtool_module> &module) { return !module_name.compare(module->name); });
}
//-------------------------------------------------
// findmodule
//-------------------------------------------------
const imgtool_module *library::findmodule(const std::string &module_name)
{
modulelist::iterator iter = find(module_name);
return iter != m_modules.end()
? iter->get()
: nullptr;
}
} // namespace imgtool

551
src/tools/imgtool/library.h Normal file
View File

@ -0,0 +1,551 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/****************************************************************************
library.h
Code relevant to the Imgtool library; analogous to the MAME driver list.
Unlike MAME which has a static driver lists, Imgtool has a concept of a
library and this library is built at startup time.
dynamic for which modules are added to. This makes "dynamic" modules
much easier
****************************************************************************/
#ifndef MAME_TOOLS_IMGTOOL_LIBRARY_H
#define MAME_TOOLS_IMGTOOL_LIBRARY_H
#pragma once
#include "imgterrs.h"
#include "timeconv.h"
#include "utilfwd.h"
#include <chrono>
#include <cstdint>
#include <ctime>
#include <iosfwd>
#include <list>
#include <memory>
#include <string>
#include <vector>
namespace imgtool
{
class image;
class partition;
class directory;
class charconverter;
class stream;
};
enum imgtool_suggestion_viability_t
{
SUGGESTION_END,
SUGGESTION_POSSIBLE,
SUGGESTION_RECOMMENDED
};
union filterinfo
{
int64_t i; /* generic integers */
void * p; /* generic pointers */
void * f; /* generic function pointers */
const char *s; /* generic strings */
imgtoolerr_t (*read_file)(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf);
imgtoolerr_t (*write_file)(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &sourcef, util::option_resolution *opts);
imgtoolerr_t (*check_stream)(imgtool::stream &stream, imgtool_suggestion_viability_t *viability);
};
typedef void (*filter_getinfoproc)(uint32_t state, union filterinfo *info);
namespace imgtool
{
class datetime
{
public:
typedef util::arbitrary_clock<std::int64_t, 1600, 1, 1, 0, 0, 0, std::ratio<1, 10000000> > imgtool_clock;
enum datetime_type
{
NONE,
LOCAL,
GMT
};
datetime()
: m_type(datetime_type::NONE)
{
}
template<typename Rep, int Y, int M, int D, int H, int N, int S, typename Ratio>
datetime(datetime_type type, std::chrono::time_point<util::arbitrary_clock<Rep, Y, M, D, H, N, S, Ratio> > tp)
: m_type(type)
, m_time_point(imgtool_clock::from_arbitrary_time_point(tp))
{
}
datetime(datetime_type type, std::chrono::time_point<std::chrono::system_clock> tp);
datetime(datetime_type type, time_t t);
datetime(datetime_type type, const util::arbitrary_datetime &dt, bool clamp = true);
datetime(const datetime &that) = default;
datetime(datetime &&that) = default;
// accessors
datetime_type type() const { return m_type; }
bool empty() const { return type() == datetime_type::NONE; }
std::chrono::time_point<imgtool_clock> time_point() const { return m_time_point; }
// operators
datetime &operator =(const datetime &that)
{
m_type = that.m_type;
m_time_point = that.m_time_point;
return *this;
}
// returns the current time
static datetime now(datetime_type type);
// returns time structures
std::tm localtime() const;
std::tm gmtime() const;
time_t to_time_t() const;
private:
static imgtool_clock::duration s_gmt_offset;
datetime_type m_type;
std::chrono::time_point<imgtool_clock> m_time_point;
static imgtool_clock::duration calculate_gmt_offset();
};
};
struct imgtool_dirent
{
char filename[1024];
char attr[64];
uint64_t filesize;
imgtool::datetime creation_time;
imgtool::datetime lastmodified_time;
imgtool::datetime lastaccess_time;
char softlink[1024];
char comment[256];
/* flags */
unsigned int eof : 1;
unsigned int corrupt : 1;
unsigned int directory : 1;
unsigned int hardlink : 1;
};
struct imgtool_chainent
{
uint8_t level;
uint64_t block;
};
namespace imgtool
{
class fork_entry
{
public:
enum class type_t
{
DATA,
RESOURCE,
ALT
};
fork_entry(uint64_t size, type_t type = type_t::DATA)
: m_size(size)
, m_type(type)
, m_name(default_name(type))
{
}
fork_entry(uint64_t size, std::string &&name)
: m_size(size)
, m_type(fork_entry::type_t::ALT)
, m_name(std::move(name))
{
}
fork_entry(const fork_entry &that) = default;
fork_entry(fork_entry &&that) = default;
uint64_t size() const { return m_size; }
type_t type() const { return m_type; }
const std::string &name() const { return m_name; }
private:
static std::string default_name(type_t type)
{
switch (type)
{
case type_t::DATA:
return std::string("");
case type_t::RESOURCE:
return std::string("RESOURCE_FORK");
default:
throw false;
}
}
uint64_t m_size;
type_t m_type;
std::string m_name;
};
}
struct imgtool_transfer_suggestion
{
imgtool_suggestion_viability_t viability;
filter_getinfoproc filter;
const char *fork;
const char *description;
};
enum
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
IMGTOOLATTR_INT_FIRST = 0x00000,
IMGTOOLATTR_INT_MAC_TYPE,
IMGTOOLATTR_INT_MAC_CREATOR,
IMGTOOLATTR_INT_MAC_FINDERFLAGS,
IMGTOOLATTR_INT_MAC_COORDX,
IMGTOOLATTR_INT_MAC_COORDY,
IMGTOOLATTR_INT_MAC_FINDERFOLDER,
IMGTOOLATTR_INT_MAC_ICONID,
IMGTOOLATTR_INT_MAC_SCRIPTCODE,
IMGTOOLATTR_INT_MAC_EXTENDEDFLAGS,
IMGTOOLATTR_INT_MAC_COMMENTID,
IMGTOOLATTR_INT_MAC_PUTAWAYDIRECTORY,
/* --- the following bits of info are returned as pointers to data or functions --- */
IMGTOOLATTR_PTR_FIRST = 0x10000,
/* --- the following bits of info are returned as NULL-terminated strings --- */
IMGTOOLATTR_STR_FIRST = 0x20000,
/* --- the following bits of info are returned as time_t values --- */
IMGTOOLATTR_TIME_FIRST = 0x30000,
IMGTOOLATTR_TIME_CREATED,
IMGTOOLATTR_TIME_LASTMODIFIED
};
union imgtool_attribute
{
int64_t i;
time_t t;
};
struct imgtool_iconinfo
{
unsigned icon16x16_specified : 1;
unsigned icon32x32_specified : 1;
uint32_t icon16x16[16][16];
uint32_t icon32x32[32][32];
};
enum
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
IMGTOOLINFO_INT_FIRST = 0x00000,
IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES,
IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES,
IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES,
IMGTOOLINFO_INT_PATH_SEPARATOR,
IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR,
IMGTOOLINFO_INT_PREFER_UCASE,
IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR,
IMGTOOLINFO_INT_OPEN_IS_STRICT,
IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME,
IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME,
IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS,
IMGTOOLINFO_INT_WRITING_UNTESTED,
IMGTOOLINFO_INT_CREATION_UNTESTED,
IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK,
IMGTOOLINFO_INT_BLOCK_SIZE,
IMGTOOLINFO_INT_CLASS_SPECIFIC = 0x08000,
/* --- the following bits of info are returned as pointers to data or functions --- */
IMGTOOLINFO_PTR_FIRST = 0x10000,
IMGTOOLINFO_PTR_OPEN,
IMGTOOLINFO_PTR_CREATE,
IMGTOOLINFO_PTR_CLOSE,
IMGTOOLINFO_PTR_OPEN_PARTITION,
IMGTOOLINFO_PTR_CREATE_PARTITION,
IMGTOOLINFO_PTR_INFO,
IMGTOOLINFO_PTR_BEGIN_ENUM,
IMGTOOLINFO_PTR_NEXT_ENUM,
IMGTOOLINFO_PTR_CLOSE_ENUM,
IMGTOOLINFO_PTR_FREE_SPACE,
IMGTOOLINFO_PTR_READ_FILE,
IMGTOOLINFO_PTR_WRITE_FILE,
IMGTOOLINFO_PTR_DELETE_FILE,
IMGTOOLINFO_PTR_LIST_FORKS,
IMGTOOLINFO_PTR_CREATE_DIR,
IMGTOOLINFO_PTR_DELETE_DIR,
IMGTOOLINFO_PTR_LIST_ATTRS,
IMGTOOLINFO_PTR_GET_ATTRS,
IMGTOOLINFO_PTR_SET_ATTRS,
IMGTOOLINFO_PTR_ATTR_NAME,
IMGTOOLINFO_PTR_GET_ICON_INFO,
IMGTOOLINFO_PTR_SUGGEST_TRANSFER,
IMGTOOLINFO_PTR_GET_CHAIN,
IMGTOOLINFO_PTR_GET_GEOMETRY,
IMGTOOLINFO_PTR_READ_SECTOR,
IMGTOOLINFO_PTR_WRITE_SECTOR,
IMGTOOLINFO_PTR_READ_BLOCK,
IMGTOOLINFO_PTR_WRITE_BLOCK,
IMGTOOLINFO_PTR_APPROVE_FILENAME_CHAR,
IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE,
IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE,
IMGTOOLINFO_PTR_MAKE_CLASS,
IMGTOOLINFO_PTR_LIST_PARTITIONS,
IMGTOOLINFO_PTR_CHARCONVERTER,
IMGTOOLINFO_PTR_CLASS_SPECIFIC = 0x18000,
/* --- the following bits of info are returned as NULL-terminated strings --- */
IMGTOOLINFO_STR_FIRST = 0x20000,
IMGTOOLINFO_STR_NAME,
IMGTOOLINFO_STR_DESCRIPTION,
IMGTOOLINFO_STR_FILE,
IMGTOOLINFO_STR_FILE_EXTENSIONS,
IMGTOOLINFO_STR_EOLN,
IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC,
IMGTOOLINFO_STR_WRITEFILE_OPTSPEC,
IMGTOOLINFO_STR_CLASS_SPECIFIC = 0x28000
};
union imgtoolinfo;
struct imgtool_class;
typedef void (*imgtool_get_info)(const imgtool_class *, uint32_t, union imgtoolinfo *);
struct imgtool_class
{
imgtool_get_info get_info;
imgtool_get_info derived_get_info;
void *derived_param;
};
namespace imgtool
{
class partition_info
{
public:
partition_info(imgtool_get_info get_info, uint64_t base_block, uint64_t block_count)
: m_base_block(base_block)
, m_block_count(block_count)
{
memset(&m_imgclass, 0, sizeof(m_imgclass));
m_imgclass.get_info = get_info;
}
partition_info(imgtool_class imgclass, uint64_t base_block, uint64_t block_count)
: m_imgclass(imgclass)
, m_base_block(base_block)
, m_block_count(block_count)
{
}
const imgtool_class &imgclass() const { return m_imgclass; }
uint64_t base_block() const { return m_base_block; }
uint64_t block_count() const { return m_block_count; }
private:
imgtool_class m_imgclass;
uint64_t m_base_block;
uint64_t m_block_count;
};
};
union imgtoolinfo
{
int64_t i; /* generic integers */
void * p; /* generic pointers */
void * f; /* generic function pointers */
char * s; /* generic strings */
imgtoolerr_t (*open) (imgtool::image &image, std::unique_ptr<imgtool::stream> &&stream);
void (*close) (imgtool::image &image);
imgtoolerr_t (*create) (imgtool::image &image, std::unique_ptr<imgtool::stream> &&stream, util::option_resolution *opts);
imgtoolerr_t (*create_partition) (imgtool::image &image, uint64_t first_block, uint64_t block_count);
void (*info) (imgtool::image &image, std::ostream &stream);
imgtoolerr_t (*begin_enum) (imgtool::directory &enumeration, const char *path);
imgtoolerr_t (*next_enum) (imgtool::directory &enumeration, imgtool_dirent &ent);
void (*close_enum) (imgtool::directory &enumeration);
imgtoolerr_t (*open_partition) (imgtool::partition &partition, uint64_t first_block, uint64_t block_count);
imgtoolerr_t (*free_space) (imgtool::partition &partition, uint64_t *size);
imgtoolerr_t (*read_file) (imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf);
imgtoolerr_t (*write_file) (imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &sourcef, util::option_resolution *opts);
imgtoolerr_t (*delete_file) (imgtool::partition &partition, const char *filename);
imgtoolerr_t (*list_forks) (imgtool::partition &partition, const char *path, std::vector<imgtool::fork_entry> &forks);
imgtoolerr_t (*create_dir) (imgtool::partition &partition, const char *path);
imgtoolerr_t (*delete_dir) (imgtool::partition &partition, const char *path);
imgtoolerr_t (*list_attrs) (imgtool::partition &partition, const char *path, uint32_t *attrs, size_t len);
imgtoolerr_t (*get_attrs) (imgtool::partition &partition, const char *path, const uint32_t *attrs, imgtool_attribute *values);
imgtoolerr_t (*set_attrs) (imgtool::partition &partition, const char *path, const uint32_t *attrs, const imgtool_attribute *values);
imgtoolerr_t (*attr_name) (uint32_t attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len);
imgtoolerr_t (*get_iconinfo) (imgtool::partition &partition, const char *path, imgtool_iconinfo *iconinfo);
imgtoolerr_t (*suggest_transfer) (imgtool::partition &partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length);
imgtoolerr_t (*get_chain) (imgtool::partition &partition, const char *path, imgtool_chainent *chain, size_t chain_size);
imgtoolerr_t (*get_geometry) (imgtool::image &image, uint32_t *tracks, uint32_t *heads, uint32_t *sectors);
imgtoolerr_t (*read_sector) (imgtool::image &image, uint32_t track, uint32_t head, uint32_t sector, std::vector<uint8_t> &buffer);
imgtoolerr_t (*write_sector) (imgtool::image &image, uint32_t track, uint32_t head, uint32_t sector, const void *buffer, size_t len, int ddam);
imgtoolerr_t (*read_block) (imgtool::image &image, void *buffer, uint64_t block);
imgtoolerr_t (*write_block) (imgtool::image &image, const void *buffer, uint64_t block);
imgtoolerr_t (*list_partitions) (imgtool::image &image, std::vector<imgtool::partition_info> &partitions);
int (*approve_filename_char)(char32_t ch);
int (*make_class)(int index, imgtool_class *imgclass);
const util::option_guide *createimage_optguide;
const util::option_guide *writefile_optguide;
const imgtool::charconverter *charconverter;
};
static inline int64_t imgtool_get_info_int(const imgtool_class *imgclass, uint32_t state)
{
union imgtoolinfo info;
info.i = 0;
imgclass->get_info(imgclass, state, &info);
return info.i;
}
static inline void *imgtool_get_info_ptr(const imgtool_class *imgclass, uint32_t state)
{
union imgtoolinfo info;
info.p = nullptr;
imgclass->get_info(imgclass, state, &info);
return info.p;
}
static inline void *imgtool_get_info_fct(const imgtool_class *imgclass, uint32_t state)
{
union imgtoolinfo info;
info.f = nullptr;
imgclass->get_info(imgclass, state, &info);
return info.f;
}
static inline char *imgtool_get_info_string(const imgtool_class *imgclass, uint32_t state)
{
union imgtoolinfo info;
info.s = nullptr;
imgclass->get_info(imgclass, state, &info);
return info.s;
}
/* circular string buffer */
char *imgtool_temp_str(void);
struct imgtool_module
{
imgtool_class imgclass = { 0 };
std::string name;
std::string description;
std::string extensions;
std::string eoln;
size_t image_extra_bytes = 0;
/* flags */
bool initial_path_separator = false;
bool open_is_strict = false;
bool tracks_are_called_cylinders = false; /* used for hard drivers */
bool writing_untested = false; /* used when we support writing, but not in main build */
bool creation_untested = false; /* used when we support creation, but not in main build */
imgtoolerr_t (*open) (imgtool::image &image, std::unique_ptr<imgtool::stream> &&stream) = nullptr;
void (*close) (imgtool::image &image) = nullptr;
void (*info) (imgtool::image &image, std::ostream &stream) = nullptr;
imgtoolerr_t (*create) (imgtool::image &image, std::unique_ptr<imgtool::stream> &&stream, util::option_resolution *opts) = nullptr;
imgtoolerr_t (*get_geometry) (imgtool::image &image, uint32_t *track, uint32_t *heads, uint32_t *sectors) = nullptr;
imgtoolerr_t (*read_sector) (imgtool::image &image, uint32_t track, uint32_t head, uint32_t sector, std::vector<uint8_t> &buffer) = nullptr;
imgtoolerr_t (*write_sector) (imgtool::image &image, uint32_t track, uint32_t head, uint32_t sector, const void *buffer, size_t len) = nullptr;
imgtoolerr_t (*read_block) (imgtool::image &image, void *buffer, uint64_t block) = nullptr;
imgtoolerr_t (*write_block) (imgtool::image &image, const void *buffer, uint64_t block) = nullptr;
imgtoolerr_t (*list_partitions)(imgtool::image &image, std::vector<imgtool::partition_info> &partitions) = nullptr;
uint32_t block_size = 0;
const util::option_guide *createimage_optguide = nullptr;
std::string createimage_optspec;
const void *extra = nullptr;
};
namespace imgtool {
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// imgtool "library" - equivalent to the MAME driver list
class library
{
public:
typedef std::list<std::unique_ptr<imgtool_module> > modulelist;
enum class sort_type
{
NAME,
DESCRIPTION
};
library();
~library();
// adds a module to an imgtool library
void add(imgtool_get_info get_info);
// seeks out and removes a module from an imgtool library
void unlink(const std::string &module_name);
// sorts an imgtool library
void sort(sort_type sort);
// finds a module
const imgtool_module *findmodule(const std::string &module_name);
// module iteration
const modulelist &modules() { return m_modules; }
private:
modulelist m_modules;
// internal lookup and iteration
modulelist::iterator find(const std::string &module_name);
// helpers
void add_class(const imgtool_class *imgclass);
int module_compare(const imgtool_module *m1, const imgtool_module *m2, sort_type sort);
};
} // namespace imgtool
#endif // MAME_TOOLS_IMGTOOL_LIBRARY_H

966
src/tools/imgtool/main.cpp Normal file
View File

@ -0,0 +1,966 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
main.cpp
Imgtool command line front end
***************************************************************************/
#include "imgtool.h"
#include "filter.h"
#include "main.h"
#include "modules.h"
#include "corefile.h"
#include "corestr.h"
#include "opresolv.h"
#include "strformat.h"
#include "unicode.h"
#include "osdcore.h" // osd_get_command_line
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <ctime>
#include <iostream>
#ifdef _WIN32
#include <io.h>
#include <fcntl.h>
#endif
// ----------------------------------------------------------------------
static void writeusage(std::wostream &output, bool write_word_usage, const struct command *c, char *argv[])
{
std::string cmdname(core_filename_extract_base(argv[0]));
util::stream_format(output,
L"%s %s %s %s\n",
(write_word_usage ? L"Usage:" : L" "),
wstring_from_utf8(cmdname),
wstring_from_utf8(c->name),
c->usage ? wstring_from_utf8(c->usage) : std::wstring());
}
// ----------------------------------------------------------------------
static int parse_options(int argc, char *argv[], int minunnamed, int maxunnamed,
util::option_resolution *resolution, filter_getinfoproc *filter, const char **fork)
{
int i;
int lastunnamed = 0;
char *s;
char *name = nullptr;
char *value = nullptr;
static char buf[256];
if (filter)
*filter = nullptr;
if (fork)
*fork = nullptr;
for (i = 0; i < argc; i++)
{
/* Named or unamed arg */
if ((argv[i][0] != '-') || (argv[i][1] != '-'))
{
/* Unnamed */
if (i >= maxunnamed)
goto error; /* Too many unnamed */
lastunnamed = i + 1;
}
else
{
/* Named */
name = argv[i] + 2;
s = strchr(name, '=');
if (!s)
goto error;
*s = 0;
value = s + 1;
if (!strcmp(name, "filter"))
{
/* filter option */
if (!filter)
goto error; /* this command doesn't use filters */
if (*filter)
goto optionalreadyspecified;
*filter = filter_lookup(value);
if (!(*filter))
goto filternotfound;
}
else if (!strcmp(name, "fork"))
{
/* fork option */
if (!fork)
goto error; /* this command doesn't use filters */
if (*fork)
goto optionalreadyspecified;
snprintf(buf, std::size(buf), "%s", value);
*fork = buf;
}
else
{
/* Other named option */
if (i < minunnamed)
goto error; /* Too few unnamed */
util::option_resolution::entry *entry = resolution->find(name);
if (entry->option_type() == util::option_guide::entry::option_type::ENUM_BEGIN)
{
const util::option_guide::entry *enum_value;
for (enum_value = entry->enum_value_begin(); enum_value != entry->enum_value_end(); enum_value++)
{
if (!strcmp (enum_value->identifier(), value))
{
entry->set_value(enum_value->parameter());
break;
}
}
if (enum_value == entry->enum_value_end())
goto error;
}
else
entry->set_value(value);
}
}
}
return lastunnamed;
filternotfound:
util::stream_format(std::wcerr, L"%s: Unknown filter type\n", wstring_from_utf8(value));
return -1;
optionalreadyspecified:
util::stream_format(std::wcerr, L"Cannot specify multiple %ss\n", wstring_from_utf8(name));
return -1;
error:
util::stream_format(std::wcerr, L"%s: Unrecognized option\n", wstring_from_utf8(argv[i]));
return -1;
}
void reporterror(imgtoolerr_t err, const struct command *c, const char *format, const char *imagename,
const char *filename, const char *newname, util::option_resolution *opts)
{
const char *src = "imgtool";
const char *err_name;
err_name = imgtool_error(err);
switch(ERRORSOURCE(err)) {
case IMGTOOLERR_SRC_MODULE:
src = format;
break;
case IMGTOOLERR_SRC_FUNCTIONALITY:
src = c->name;
break;
case IMGTOOLERR_SRC_IMAGEFILE:
src = imagename;
break;
case IMGTOOLERR_SRC_FILEONIMAGE:
src = filename;
break;
case IMGTOOLERR_SRC_NATIVEFILE:
src = newname ? newname : filename;
break;
}
fflush(stdout);
fflush(stderr);
if (!src)
src = c->name;
util::stream_format(std::wcerr, L"%s: %s\n", wstring_from_utf8(src), wstring_from_utf8(err_name));
}
static const char *interpret_filename(const char *filename)
{
if (!strcmp(filename, "??BOOT??")
|| !strcmp(filename, "\'??BOOT??\'")
|| !strcmp(filename, "\"??BOOT??\""))
filename = FILENAME_BOOTBLOCK;
return filename;
}
// ----------------------------------------------------------------------
static int cmd_dir(const struct command *c, int argc, char *argv[])
{
imgtoolerr_t err;
int total_count, total_size, freespace_err;
uint64_t freespace;
imgtool::image::ptr image;
imgtool::partition::ptr partition;
imgtool::directory::ptr imgenum;
imgtool_dirent ent;
char last_modified[19];
std::string path;
int partition_index = 0;
std::string info;
// build the separator
const int columnwidth_filename = 30;
const int columnwidth_filesize = 8;
const int columnwidth_attributes = 15;
const int columnwidth_lastmodified = 18;
std::string separator = std::string(columnwidth_filename, '-') + " "
+ std::string(columnwidth_filesize, '-') + " "
+ std::string(columnwidth_attributes, '-') + " "
+ std::string(columnwidth_lastmodified, '-');
// attempt to open image
err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_READ, image);
if (err)
goto done;
/* attempt to open partition */
err = imgtool::partition::open(*image, partition_index, partition);
if (err)
goto done;
path = argc > 2 ? argv[2] : "";
err = imgtool::directory::open(*partition, path, imgenum);
if (err)
goto done;
memset(&ent, 0, sizeof(ent));
last_modified[0] = '\0';
total_count = 0;
total_size = 0;
util::stream_format(std::wcout, L"Contents of %s:%s\n", wstring_from_utf8(argv[1]), wstring_from_utf8(path));
info = image->info();
if (!info.empty())
util::stream_format(std::wcout, L"%s\n", wstring_from_utf8(info));
util::stream_format(std::wcout, L"%s\n", wstring_from_utf8(separator));
while (((err = imgenum->get_next(ent)) == 0) && !ent.eof)
{
std::string filesize_string = ent.directory
? "<DIR>"
: util::string_format("%u", (unsigned int) ent.filesize);
if (!ent.lastmodified_time.empty())
{
std::tm t = ent.lastmodified_time.localtime();
strftime(last_modified, sizeof(last_modified), "%d-%b-%y %H:%M:%S", &t);
}
if (ent.hardlink)
strcat(ent.filename, " <hl>");
util::stream_format(std::wcout,
L"%*s %*s %*s %*s\n",
-columnwidth_filename, wstring_from_utf8(ent.filename),
columnwidth_filesize, wstring_from_utf8(filesize_string),
columnwidth_attributes, wstring_from_utf8(ent.attr),
columnwidth_lastmodified, wstring_from_utf8(last_modified));
if (ent.softlink[0] != '\0')
util::stream_format(std::wcout, L"-> %s\n", wstring_from_utf8(ent.softlink));
if (ent.comment[0] != '\0')
util::stream_format(std::wcout, L": %s\n", wstring_from_utf8(ent.comment));
total_count++;
total_size += ent.filesize;
memset(&ent, 0, sizeof(ent));
}
freespace_err = partition->get_free_space(freespace);
if (err)
goto done;
util::stream_format(std::wcout, L"%s\n", wstring_from_utf8(separator));
util::stream_format(std::wcout, L"%8i File(s) %8i bytes", total_count, total_size);
if (!freespace_err)
util::stream_format(std::wcout, L" %8u bytes free\n", (unsigned int)freespace);
else
util::stream_format(std::wcout, L"\n");
done:
if (err)
reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr);
return err ? -1 : 0;
}
static int cmd_get(const struct command *c, int argc, char *argv[])
{
imgtoolerr_t err;
imgtool::image::ptr image;
imgtool::partition::ptr partition;
const char *filename;
char *new_filename;
int unnamedargs = 0;
filter_getinfoproc filter;
const char *fork;
int partition_index = 0;
err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_READ, image);
if (err)
goto done;
err = imgtool::partition::open(*image, partition_index, partition);
if (err)
goto done;
filename = interpret_filename(argv[2]);
unnamedargs = parse_options(argc, argv, 3, 4, nullptr, &filter, &fork);
if (unnamedargs < 0)
goto done;
new_filename = (unnamedargs == 4) ? argv[3] : nullptr;
err = partition->get_file(filename, fork, new_filename, filter);
if (err)
goto done;
err = IMGTOOLERR_SUCCESS;
done:
if (err)
reporterror(err, c, argv[0], argv[1], argv[2], argv[3], nullptr);
return (err || (unnamedargs < 0)) ? -1 : 0;
}
static int cmd_put(const struct command *c, int argc, char *argv[])
{
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
int i;
imgtool::image::ptr image;
imgtool::partition::ptr partition;
const char *filename = nullptr;
int unnamedargs;
filter_getinfoproc filter;
const imgtool_module *module;
std::unique_ptr<util::option_resolution> resolution;
const char *fork;
const char *new_filename;
char **filename_list;
int filename_count;
int partition_index = 0;
const util::option_guide *writefile_optguide;
const char *writefile_optspec;
module = imgtool_find_module(argv[0]);
if (!module)
{
err = (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_MODULE);
goto done;
}
/* ugh I hate the way this function is set up, this is because the
* arguments depend on the partition; something that requires some
* rudimentary parsing */
if (argc >= 2)
{
/* open up the image */
err = imgtool::image::open(module, argv[1], OSD_FOPEN_RW, image);
if (err)
goto done;
/* open up the partition */
err = imgtool::partition::open(*image, partition_index, partition);
if (err)
goto done;
writefile_optguide = (const util::option_guide *) partition->get_info_ptr(IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE);
writefile_optspec = (const char *)partition->get_info_ptr(IMGTOOLINFO_STR_WRITEFILE_OPTSPEC);
if (writefile_optguide && writefile_optspec)
{
try { resolution.reset(new util::option_resolution(*writefile_optguide)); }
catch (...)
{
err = IMGTOOLERR_OUTOFMEMORY;
goto done;
}
resolution->set_specification(writefile_optspec);
}
}
unnamedargs = parse_options(argc, argv, 4, 0xffff, resolution.get(), &filter, &fork);
if (unnamedargs < 0)
return -1;
/* pick out which args are filenames, and which one is the destination */
new_filename = interpret_filename(argv[unnamedargs - 1]);
filename_list = &argv[2];
filename_count = unnamedargs - 3;
/* loop through the filenames, and put them */
for (i = 0; i < filename_count; i++)
{
filename = filename_list[i];
util::stream_format(std::wcout, L"Putting file '%s'...\n", wstring_from_utf8(filename));
err = partition->put_file(new_filename, fork, filename, resolution.get(), filter);
if (err)
goto done;
}
done:
if (err)
reporterror(err, c, argv[0], argv[1], filename, nullptr, resolution.get());
return err ? -1 : 0;
}
static int cmd_getall(const struct command *c, int argc, char *argv[])
{
imgtoolerr_t err;
imgtool::image::ptr image;
imgtool::partition::ptr partition;
imgtool::directory::ptr imgenum;
imgtool_dirent ent;
filter_getinfoproc filter;
int unnamedargs;
const char *path = "";
int arg;
int partition_index = 0;
err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_READ, image);
if (err)
goto done;
err = imgtool::partition::open(*image, partition_index, partition);
if (err)
goto done;
arg = 2;
if ((argc > 2) && (argv[2][0] != '-'))
{
path = argv[arg++];
}
unnamedargs = parse_options(argc, argv, arg, arg, nullptr, &filter, nullptr);
if (unnamedargs < 0)
goto done;
err = imgtool::directory::open(*partition, path, imgenum);
if (err)
goto done;
memset(&ent, 0, sizeof(ent));
while (((err = imgenum->get_next(ent)) == 0) && !ent.eof)
{
util::stream_format(std::wcout, L"Retrieving %s (%u bytes)\n", wstring_from_utf8(ent.filename), (unsigned int)ent.filesize);
err = partition->get_file(ent.filename, nullptr, nullptr, filter);
if (err)
goto done;
}
done:
if (err)
reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr);
return err ? -1 : 0;
}
static int cmd_del(const struct command *c, int argc, char *argv[])
{
imgtoolerr_t err;
imgtool::image::ptr image;
imgtool::partition::ptr partition;
int partition_index = 0;
err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_RW, image);
if (err)
goto done;
err = imgtool::partition::open(*image, partition_index, partition);
if (err)
goto done;
err = partition->delete_file(argv[2]);
if (err)
goto done;
done:
if (err)
reporterror(err, c, argv[0], argv[1], argv[2], nullptr, nullptr);
return err ? -1 : 0;
}
static int cmd_mkdir(const struct command *c, int argc, char *argv[])
{
imgtoolerr_t err;
imgtool::image::ptr image;
imgtool::partition::ptr partition;
int partition_index = 0;
err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_RW, image);
if (err)
goto done;
err = imgtool::partition::open(*image, partition_index, partition);
if (err)
goto done;
err = partition->create_directory(argv[2]);
if (err)
goto done;
done:
if (err)
reporterror(err, c, argv[0], argv[1], argv[2], nullptr, nullptr);
return err ? -1 : 0;
}
static int cmd_rmdir(const struct command *c, int argc, char *argv[])
{
imgtoolerr_t err;
imgtool::image::ptr image;
imgtool::partition::ptr partition;
int partition_index = 0;
err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_RW, image);
if (err)
goto done;
err = imgtool::partition::open(*image, partition_index, partition);
if (err)
goto done;
err = partition->delete_directory(argv[2]);
if (err)
goto done;
done:
if (err)
reporterror(err, c, argv[0], argv[1], argv[2], nullptr, nullptr);
return err ? -1 : 0;
}
static int cmd_identify(const struct command *c, int argc, char *argv[])
{
imgtool_module *modules[128];
imgtoolerr_t err;
int i;
err = imgtool::image::identify_file(argv[0], modules, std::size(modules));
if (err)
{
reporterror(err, c, nullptr, argv[0], nullptr, nullptr, nullptr);
return -1;
}
else
{
for (i = 0; modules[i]; i++)
{
util::stream_format(std::wcout, L"%.16s %s\n", wstring_from_utf8(modules[i]->name), wstring_from_utf8(modules[i]->description));
}
return 0;
}
}
static int cmd_create(const struct command *c, int argc, char *argv[])
{
imgtoolerr_t err;
int unnamedargs;
const imgtool_module *module;
std::unique_ptr<util::option_resolution> resolution;
module = imgtool_find_module(argv[0]);
if (!module)
{
err = (imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND | IMGTOOLERR_SRC_MODULE);
goto error;
}
if (module->createimage_optguide && !module->createimage_optspec.empty())
{
try { resolution.reset(new util::option_resolution(*module->createimage_optguide)); }
catch (...)
{
err = IMGTOOLERR_OUTOFMEMORY;
goto error;
}
resolution->set_specification(module->createimage_optspec.c_str());
}
unnamedargs = parse_options(argc, argv, 2, 3, resolution.get(), nullptr, nullptr);
if (unnamedargs < 0)
return -1;
err = imgtool::image::create(module, argv[1], resolution.get());
if (err)
goto error;
return 0;
error:
reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr);
return -1;
}
static int cmd_readsector(const struct command *c, int argc, char *argv[])
{
imgtoolerr_t err;
std::unique_ptr<imgtool::image> img;
imgtool::stream::ptr stream;
std::vector<uint8_t> buffer;
uint32_t track, head, sector;
/* attempt to open image */
err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_READ, img);
if (err)
goto done;
track = atoi(argv[2]);
head = atoi(argv[3]);
sector = atoi(argv[4]);
err = img->read_sector(track, head, sector, buffer);
if (err)
goto done;
stream = imgtool::stream::open(argv[5], OSD_FOPEN_WRITE);
if (!stream)
{
err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_NATIVEFILE);
goto done;
}
stream->write(&buffer[0], buffer.size());
done:
if (err)
reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr);
return err ? -1 : 0;
}
static int cmd_writesector(const struct command *c, int argc, char *argv[])
{
imgtoolerr_t err;
std::unique_ptr<imgtool::image> img;
imgtool::stream::ptr stream;
std::vector<uint8_t> buffer;
uint32_t size, track, head, sector;
// attempt to open image
err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_RW, img);
if (err)
goto done;
track = atoi(argv[2]);
head = atoi(argv[3]);
sector = atoi(argv[4]);
stream = imgtool::stream::open(argv[5], OSD_FOPEN_READ);
if (!stream)
{
err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_NATIVEFILE);
goto done;
}
size = (uint32_t) stream->size();
buffer.resize(size);
stream->read(&buffer[0], size);
err = img->write_sector(track, head, sector, &buffer[0], size);
if (err)
goto done;
done:
if (err)
reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr);
return err ? -1 : 0;
}
static int cmd_listformats(const struct command *c, int argc, char *argv[])
{
util::stream_format(std::wcout, L"Image formats supported by imgtool:\n\n");
for (const auto &module : imgtool_get_modules())
{
util::stream_format(std::wcout, L" %-25s%s\n", wstring_from_utf8(module->name), wstring_from_utf8(module->description));
}
return 0;
}
static int cmd_listfilters(const struct command *c, int argc, char *argv[])
{
int i;
util::stream_format(std::wcout, L"Filters supported by imgtool:\n\n");
for (i = 0; filters[i]; i++)
{
util::stream_format(std::wcout, L" %-11s%s\n",
wstring_from_utf8(filter_get_info_string(filters[i], FILTINFO_STR_NAME)),
wstring_from_utf8(filter_get_info_string(filters[i], FILTINFO_STR_HUMANNAME)));
}
return 0;
}
static void listoptions(const util::option_guide &opt_guide, const char *opt_spec)
{
util::option_resolution resolution(opt_guide);
resolution.set_specification(opt_spec);
util::stream_format(std::wcout, L"Option Allowed values Description\n");
util::stream_format(std::wcout, L"---------------- ------------------------------ -----------\n");
for (auto iter = resolution.entries_begin(); iter != resolution.entries_end(); iter++)
{
const util::option_resolution::entry &entry = *iter;
std::stringstream description_buffer;
std::string opt_name = util::string_format("--%s", entry.identifier());
const char *opt_desc = entry.display_name();
// is this option relevant?
if (!strchr(opt_spec, entry.parameter()))
continue;
switch (entry.option_type())
{
case util::option_guide::entry::option_type::INT:
for (const auto &range : entry.ranges())
{
if (!description_buffer.str().empty())
description_buffer << "/";
if (range.min == range.max)
util::stream_format(description_buffer, "%d", range.min);
else
util::stream_format(description_buffer, "%d-%d", range.min, range.max);
}
break;
case util::option_guide::entry::option_type::ENUM_BEGIN:
for (auto enum_value = entry.enum_value_begin(); enum_value != entry.enum_value_end(); enum_value++)
{
if (!description_buffer.str().empty())
description_buffer << '/';
description_buffer << enum_value->identifier();
}
break;
case util::option_guide::entry::option_type::STRING:
description_buffer << "(string)";
break;
default:
assert(0);
break;
}
util::stream_format(std::wcout, L"%16s %-30s %s\n",
wstring_from_utf8(opt_name),
wstring_from_utf8(description_buffer.str()),
wstring_from_utf8(opt_desc));
}
}
static int cmd_listdriveroptions(const struct command *c, int argc, char *argv[])
{
const imgtool_module *mod;
const util::option_guide *opt_guide;
const char *opt_spec;
mod = imgtool_find_module(argv[0]);
if (!mod)
{
reporterror((imgtoolerr_t)(IMGTOOLERR_MODULENOTFOUND|IMGTOOLERR_SRC_MODULE), c, argv[0], nullptr, nullptr, nullptr, nullptr);
return -1;
}
util::stream_format(std::wcout, L"Driver specific options for module '%s':\n\n", wstring_from_utf8(argv[0]));
/* list write options */
opt_guide = (const util::option_guide *) imgtool_get_info_ptr(&mod->imgclass, IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE);
opt_spec = imgtool_get_info_string(&mod->imgclass, IMGTOOLINFO_STR_WRITEFILE_OPTSPEC);
if (opt_guide)
{
util::stream_format(std::wcout, L"Image specific file options (usable on the 'put' command):\n\n");
listoptions(*opt_guide, opt_spec);
util::stream_format(std::wcout, L"\n");
}
else
{
util::stream_format(std::wcout, L"No image specific file options\n\n");
}
/* list create options */
opt_guide = mod->createimage_optguide;
if (opt_guide)
{
util::stream_format(std::wcout, L"Image specific creation options (usable on the 'create' command):\n\n");
listoptions(*opt_guide, mod->createimage_optspec.c_str());
util::stream_format(std::wcout, L"\n");
}
else
{
util::stream_format(std::wcout, L"No image specific creation options\n\n");
}
return 0;
}
/* ----------------------------------------------------------------------- */
static const struct command cmds[] =
{
{ "create", cmd_create, "<format> <imagename> [--(createoption)=value]", 2, 8, 0},
{ "dir", cmd_dir, "<format> <imagename> [path]", 2, 3, 0 },
{ "get", cmd_get, "<format> <imagename> <filename> [newname] [--filter=filter] [--fork=fork]", 3, 6, 0 },
{ "put", cmd_put, "<format> <imagename> <filename>... <destname> [--(fileoption)==value] [--filter=filter] [--fork=fork]", 3, 0xffff, 0 },
{ "getall", cmd_getall, "<format> <imagename> [path] [--filter=filter]", 2, 3, 0 },
{ "del", cmd_del, "<format> <imagename> <filename>...", 3, 3, 1 },
{ "mkdir", cmd_mkdir, "<format> <imagename> <dirname>", 3, 3, 0 },
{ "rmdir", cmd_rmdir, "<format> <imagename> <dirname>...", 3, 3, 1 },
{ "readsector", cmd_readsector, "<format> <imagename> <track> <head> <sector> <filename>", 6, 6, 0 },
{ "writesector", cmd_writesector, "<format> <imagename> <track> <head> <sector> <filename>", 6, 6, 0 },
{ "identify", cmd_identify, "<imagename>", 1, 1 },
{ "listformats", cmd_listformats, nullptr, 0, 0, 0 },
{ "listfilters", cmd_listfilters, nullptr, 0, 0, 0 },
{ "listdriveroptions", cmd_listdriveroptions, "<format>", 1, 1, 0 }
};
// ----------------------------------------------------------------------
int main(int argc, char *argv[])
{
int i;
int result;
const struct command *c;
const char *sample_format = "coco_jvc_rsdos";
std::string cmdname(core_filename_extract_base(argv[0]));
#ifdef _WIN32
_setmode(_fileno(stdout), _O_U8TEXT);
#endif // _WIN32
#ifdef MAME_DEBUG
if (imgtool_validitychecks())
return -1;
#endif // MAME_DEBUG
// convert arguments to UTF-8
std::vector<std::string> args = osd_get_command_line(argc, argv);
argv = (char **)alloca(sizeof(char *) * args.size());
for (i = 0; i < args.size(); i++)
argv[i] = (char *)args[i].c_str();
util::stream_format(std::wcout, L"\n");
if (argc > 1)
{
/* figure out what command they are running, and run it */
for (i = 0; i < std::size(cmds); i++)
{
c = &cmds[i];
if (!core_stricmp(c->name, argv[1]))
{
/* check argument count */
if (c->minargs > (argc - 2))
goto cmderror;
/* initialize the imgtool core */
imgtool_init(true, nullptr);
if (c->lastargrepeats && (argc > c->maxargs))
{
for (i = c->maxargs+1; i < argc; i++)
{
argv[c->maxargs+1] = argv[i];
result = c->cmdproc(c, c->maxargs, argv + 2);
if (result)
goto done;
}
result = 0;
goto done;
}
else
{
if ((c->maxargs > 0) && (c->maxargs < (argc - 2)))
goto cmderror;
result = c->cmdproc(c, argc - 2, argv + 2);
goto done;
}
}
}
}
// Usage
util::stream_format(std::wcerr, L"imgtool - Generic image manipulation tool for use with MAME\n\n");
for (i = 0; i < std::size(cmds); i++)
{
writeusage(std::wcerr, (i == 0), &cmds[i], argv);
}
util::stream_format(std::wcerr, L"\n<format> is the image format, e.g. %s\n", wstring_from_utf8(sample_format));
util::stream_format(std::wcerr, L"<imagename> is the image filename; can specify a ZIP file for image name\n");
util::stream_format(std::wcerr, L"\nExample usage:\n");
util::stream_format(std::wcerr, L"\t%s dir %s myimageinazip.zip\n", wstring_from_utf8(cmdname), wstring_from_utf8(sample_format));
util::stream_format(std::wcerr, L"\t%s get %s myimage.dsk myfile.bin mynewfile.txt\n", wstring_from_utf8(cmdname), wstring_from_utf8(sample_format));
util::stream_format(std::wcerr, L"\t%s getall %s myimage.dsk\n", wstring_from_utf8(cmdname), wstring_from_utf8(sample_format));
result = 0;
goto done;
cmderror:
writeusage(std::wcout, 1, &cmds[i], argv);
result = -1;
done:
imgtool_exit();
return result;
}

20
src/tools/imgtool/main.h Normal file
View File

@ -0,0 +1,20 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
#include "imgtool.h"
struct command
{
const char *name;
int (*cmdproc)(const struct command *c, int argc, char *argv[]);
const char *usage;
int minargs;
int maxargs;
int lastargrepeats;
};
void reporterror(imgtoolerr_t err, const struct command *c, const char *format, const char *imagename,
const char *filename, const char *newname, util::option_resolution *opts);
#ifdef MAME_DEBUG
int cmd_testsuite(struct command *c, int argc, char *argv[]);
#endif

View File

@ -0,0 +1,104 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
modules.c
List of Imgtool modules
***************************************************************************/
#include "modules.h"
#ifndef MODULES_RECURSIVE
#define MODULES_RECURSIVE
/* step 1: declare all external references */
#define MODULE(name) extern void name##_get_info(const imgtool_class *imgclass, uint32_t state, union imgtoolinfo *info);
#include "modules.cpp"
#undef MODULE
/* step 2: define the modules[] array */
#define MODULE(name) name##_get_info,
static void (*const modules[])(const imgtool_class *imgclass, uint32_t state, union imgtoolinfo *info) =
{
#include "modules.cpp"
};
/* step 3: declare imgtool_create_canonical_library() */
imgtoolerr_t imgtool_create_canonical_library(bool omit_untested, std::unique_ptr<imgtool::library> &library)
{
/* list of modules that we drop */
static const char *const irrelevant_modules[] =
{
"coco_os9_rsdos"
};
library.reset(new imgtool::library());
if (!library)
return IMGTOOLERR_OUTOFMEMORY;
// create all modules
for (auto &module : modules)
library->add(module);
// remove irrelevant modules
for (auto &module : irrelevant_modules)
library->unlink(module);
// if we are omitting untested, go through and block out the functionality in question
if (omit_untested)
{
for (auto &module : library->modules())
{
if (module->writing_untested)
{
module->write_sector = nullptr;
}
if (module->creation_untested)
{
module->create = nullptr;
module->createimage_optguide = nullptr;
module->createimage_optspec.clear();
}
}
}
return IMGTOOLERR_SUCCESS;
}
#else /* MODULES_RECURSIVE */
MODULE(amiga_floppy)
MODULE(concept)
MODULE(mac_mfs)
MODULE(mac_hfs)
MODULE(hd)
MODULE(rsdos)
MODULE(dgndos)
MODULE(vzdos)
MODULE(os9)
MODULE(ti99_old)
MODULE(ti99_v9t9)
MODULE(ti99_pc99fm)
MODULE(ti99_pc99mfm)
MODULE(ti99_ti99hd)
MODULE(ti990)
MODULE(pc_floppy)
MODULE(pc_chd)
MODULE(prodos_525)
MODULE(prodos_35)
MODULE(thom_fd_basic)
MODULE(thom_qd_basic)
MODULE(thom_sap_basic)
MODULE(cybiko)
MODULE(cybikoxt)
MODULE(psion)
MODULE(bml3)
MODULE(hp48)
MODULE(hp9845_tape)
MODULE(hp85_tape)
MODULE(rt11)
#endif /* MODULES_RECURSIVE */

View File

@ -0,0 +1,18 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/****************************************************************************
modules.h
Code that creates the "canonical" Imgtool library
****************************************************************************/
#ifndef MODULES_H
#define MODULES_H
#include "library.h"
imgtoolerr_t imgtool_create_canonical_library(bool omit_untested, std::unique_ptr<imgtool::library> &library);
#endif /* MODULES_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,932 @@
// license:GPL-2.0+
// copyright-holders:Jonathan Edwards
/****************************************************************************
bml3.c
Hitachi bml3 disk images
By Jonathan Edwards, based on rsdos.c (both use Microsoft BASIC)
****************************************************************************/
/* Supported Hitachi floppy formats are:
- 3" or 5"1/4 single density, single-sided: 40 tracks, 16 sectors/track, 128 bytes/sector
- (used with MP-1805 floppy disk controller card)
- 5"1/4 double density, double-sided: 40 tracks, 16 sectors/track, 256 bytes/sector
- (first track on first head may be single density)
- (used with MP-1802 floppy disk controller card)
*/
#include "imgtool.h"
#include "filter.h"
#include "iflopimg.h"
#include "corestr.h"
#include "opresolv.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define MAX_SECTOR_SIZE 256
struct bml3_diskinfo
{
uint16_t sector_size; /* 128 or 256 */
uint8_t heads; /* 1 or 2 */
uint8_t fat_start_sector; /* in cylinder 20, start sector of FAT */
uint8_t fat_start_offset; /* start byte of FAT in sector */
uint8_t fat_sectors; /* the number of sectors in the FAT */
uint8_t dirent_start_sector; /* in cylinder 20, start sector of directory entries */
uint8_t granule_sectors; /* how many sectors per granule */
uint8_t first_granule_cylinder; /* the number of the first cylinder with granule numbers assigned */
uint8_t variant; /* 0 - older version, uses EOF to terminate files, 1 - newer version, stores file length */
};
/* this structure mirrors the structure of a directory entry on disk */
struct bml3_dirent
{
char fname[8];
char fext[3];
uint8_t ftype;
uint8_t asciiflag;
uint8_t first_granule;
uint16_t lastsectorbytes;
// TODO there are some 'unused' bytes here that are sometimes used to store a timestamp, maybe support this?
};
struct bml3_direnum
{
int index;
int eof;
};
#define MAX_GRANULEMAP_SIZE 256
struct granule_list_t {
uint8_t granules[MAX_GRANULEMAP_SIZE];
uint8_t granule_count;
uint8_t last_granule_sectors;
};
#define BML3_OPTIONS_FTYPE 'T'
#define BML3_OPTIONS_ASCII 'M'
static imgtoolerr_t bml3_diskimage_deletefile(imgtool::partition &partition, const char *fname);
/*********************************************************************
Imgtool module code
*********************************************************************/
static bml3_diskinfo *bml3_get_diskinfo(imgtool::image &image)
{
return (bml3_diskinfo *) imgtool_floppy_extrabytes(image);
}
static int max_dirents(imgtool::image &image)
{
bml3_diskinfo *info = bml3_get_diskinfo(image);
return (16 * info->heads + 1 - info->dirent_start_sector)*(info->sector_size/32);
}
static void dirent_location(imgtool::image &image, int index_loc, uint8_t *head, uint8_t *track, uint8_t *sector, uint8_t *offset)
{
bml3_diskinfo *info = bml3_get_diskinfo(image);
*track = 20;
*sector = info->dirent_start_sector + index_loc / (info->sector_size / 32);
*head = 0;
if (*sector > 16) {
// wrap to second head
*sector -= 16;
(*head)++;
}
*offset = index_loc % (info->sector_size/32) * 32;
}
static floperr_t get_bml3_dirent(imgtool::image &f, int index_loc, struct bml3_dirent *ent)
{
floperr_t err;
uint8_t head, track, sector, offset;
uint8_t buf[32];
bml3_diskinfo *info = bml3_get_diskinfo(f);
dirent_location(f, index_loc, &head, &track, &sector, &offset);
err = floppy_read_sector(imgtool_floppy(f), head, track, sector, offset, (void *) buf, sizeof(buf));
memset(ent, 0, sizeof(*ent));
switch (info->variant) {
case 0:
memcpy(&ent->fname, &buf[0], 8);
ent->ftype = buf[11];
ent->asciiflag = buf[12];
ent->first_granule = buf[14];
break;
case 1:
memcpy(&ent->fname, &buf[0], 8);
memcpy(&ent->fext, &buf[8], 3);
ent->ftype = buf[11];
ent->asciiflag = buf[12];
ent->first_granule = buf[13];
ent->lastsectorbytes = (buf[14] << 8) | buf[15];
break;
default:
return FLOPPY_ERROR_INVALIDIMAGE;
}
return err;
}
static floperr_t put_bml3_dirent(imgtool::image &f, int index_loc, const struct bml3_dirent *ent)
{
floperr_t err;
uint8_t head, track, sector, offset;
uint8_t buf[32];
bml3_diskinfo *info = bml3_get_diskinfo(f);
if (index_loc >= max_dirents(f))
return (floperr_t)IMGTOOLERR_FILENOTFOUND;
dirent_location(f, index_loc, &head, &track, &sector, &offset);
memset(buf, 0, sizeof(buf));
switch (info->variant) {
case 0:
memcpy(&buf[0], &ent->fname, 8);
buf[11] = ent->ftype;
buf[12] = ent->asciiflag;
buf[14] = ent->first_granule;
break;
case 1:
memcpy(&buf[0], &ent->fname, 8);
memcpy(&buf[8], &ent->fext, 3);
buf[11] = ent->ftype;
buf[12] = ent->asciiflag;
buf[13] = ent->first_granule;
buf[14] = ent->lastsectorbytes >> 8;
buf[15] = ent->lastsectorbytes & 0xff;
break;
default:
return FLOPPY_ERROR_INVALIDIMAGE;
}
err = floppy_write_sector(imgtool_floppy(f), head, track, sector, offset, (void *) buf, sizeof(buf), 0); /* TODO: pass ddam argument from imgtool */
return err;
}
/* fnamebuf must have at least 13 bytes */
static void get_dirent_fname(char *fnamebuf, const struct bml3_dirent *ent)
{
char *s;
memset(fnamebuf, 0, 13);
memcpy(fnamebuf, ent->fname, sizeof(ent->fname));
rtrim(fnamebuf);
s = fnamebuf + strlen(fnamebuf);
*(s++) = '.';
memcpy(s, ent->fext, sizeof(ent->fext));
rtrim(s);
/* If no extension, remove period */
if (*s == '\0')
s[-1] = '\0';
}
static imgtoolerr_t lookup_bml3_file(imgtool::image &f, const char *fname, struct bml3_dirent *ent, int *position)
{
int i;
floperr_t ferr;
char fnamebuf[13];
i = 0;
fnamebuf[0] = '\0';
do
{
do
{
ferr = get_bml3_dirent(f, i++, ent);
if (ferr)
return imgtool_floppy_error(ferr);
}
while(ent->fname[0] == '\0');
if (ent->fname[0] != -1)
get_dirent_fname(fnamebuf, ent);
}
while((ent->fname[0] != -1) && core_stricmp(fnamebuf, fname));
if (ent->fname[0] == -1)
return IMGTOOLERR_FILENOTFOUND;
if (position)
*position = i - 1;
return (imgtoolerr_t)0;
}
static uint8_t get_granule_count(imgtool::image &img)
{
// uint16_t tracks;
uint16_t disk_granules;
bml3_diskinfo *info = bml3_get_diskinfo(img);
// This always returns 82 for D88, so not quite right
// tracks = floppy_get_tracks_per_disk(imgtool_floppy(img));
// The number of granules is primarily constrained by the disk capacity.
disk_granules = (40 - 1 - info->first_granule_cylinder) * info->heads * (16 / info->granule_sectors);
// Also, granule numbers from 0xC0 upwards are reserved for terminating a granule chain
return (uint8_t)((disk_granules < 0xC0) ? disk_granules : 0xC0);
}
/* granule_map must be an array of MAX_GRANULEMAP_SIZE bytes */
static floperr_t get_granule_map(imgtool::image &img, uint8_t *granule_map, uint8_t *granule_count)
{
bml3_diskinfo *info = bml3_get_diskinfo(img);
uint8_t count;
count = get_granule_count(img);
if (granule_count)
*granule_count = count;
// The first byte of the granule map sector is ignored (and expected to be 0)
return floppy_read_sector(imgtool_floppy(img), 0, 20, info->fat_start_sector, info->fat_start_offset, granule_map, count);
}
static floperr_t put_granule_map(imgtool::image &img, const uint8_t *granule_map, uint8_t granule_count)
{
bml3_diskinfo *info = bml3_get_diskinfo(img);
return floppy_write_sector(imgtool_floppy(img), 0, 20, info->fat_start_sector, info->fat_start_offset, granule_map, granule_count, 0); /* TODO: pass ddam argument from imgtool */
}
static void granule_location(imgtool::image &image, uint8_t granule, uint8_t *head, uint8_t *track, uint8_t *sector)
{
bml3_diskinfo *info = bml3_get_diskinfo(image);
uint16_t abs_track = granule * info->granule_sectors / 16;
*head = abs_track % info->heads;
*track = abs_track / info->heads + info->first_granule_cylinder;
// skip filesystem cylinder
if (*track >= 20)
(*track)++;
*sector = granule * info->granule_sectors % 16 + 1;
}
static imgtoolerr_t transfer_granule(imgtool::image &img, uint8_t granule, int length, imgtool::stream &f, imgtoolerr_t (*proc)(imgtool::image &, int, int, int, int, size_t, imgtool::stream &))
{
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
uint8_t head, track, sector;
granule_location(img, granule, &head, &track, &sector);
if (length > 0)
err = proc(img, head, track, sector, 0, length, f);
return err;
}
static imgtoolerr_t transfer_from_granule(imgtool::image &img, uint8_t granule, int length, imgtool::stream &destf)
{
return transfer_granule(img, granule, length, destf, imgtool_floppy_read_sector_to_stream);
}
static imgtoolerr_t transfer_to_granule(imgtool::image &img, uint8_t granule, int length, imgtool::stream &sourcef)
{
return transfer_granule(img, granule, length, sourcef, imgtool_floppy_write_sector_from_stream);
}
static floperr_t read_granule(imgtool::image &img, uint8_t granule, int offset, int length, uint8_t *buf)
{
uint8_t head, track, sector;
granule_location(img, granule, &head, &track, &sector);
return floppy_read_sector(imgtool_floppy(img), head, track, sector, offset, buf, length);
}
static floperr_t write_granule(imgtool::image &img, uint8_t granule, int offset, int length, const uint8_t *buf)
{
uint8_t head, track, sector;
granule_location(img, granule, &head, &track, &sector);
return floppy_write_sector(imgtool_floppy(img), head, track, sector, offset, buf, length, 0); /* TODO: pass ddam argument from imgtool */
}
static imgtoolerr_t list_granules(struct bml3_dirent *ent, imgtool::image &img, struct granule_list_t *granule_list)
{
floperr_t ferr;
uint8_t max_granules;
uint8_t granule;
uint8_t usedmap[MAX_GRANULEMAP_SIZE]; /* Used to detect infinite loops */
uint8_t granule_map[MAX_GRANULEMAP_SIZE];
bml3_diskinfo *info = bml3_get_diskinfo(img);
ferr = get_granule_map(img, granule_map, &max_granules);
if (ferr)
return imgtool_floppy_error(ferr);
memset(usedmap, 0, max_granules);
granule = ent->first_granule;
granule_list->granule_count = 0;
while(!usedmap[granule] && granule < max_granules)
{
usedmap[granule] = 1;
granule_list->granules[granule_list->granule_count++] = granule;
granule = granule_map[granule];
}
granule_list->last_granule_sectors = granule - 0xc0;
if (info->variant == 0) {
// add final incomplete sector
granule_list->last_granule_sectors++;
}
// A value of zero (variant 1) and max (variant 0) seem to indicate a file open for writing.
// Strictly speaking this means the image is corrupt, although a real system will happily read
// garbage from the file.
if (granule_list->last_granule_sectors > info->granule_sectors)
return IMGTOOLERR_CORRUPTIMAGE;
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t get_file_size(struct bml3_dirent *ent, imgtool::image &img, const struct granule_list_t *granule_list, size_t *size)
{
floperr_t ferr;
size_t last_sector_bytes = 0;
bml3_diskinfo *info = bml3_get_diskinfo(img);
// TODO are these special cases valid, or maybe indicate a corrupt image?
if (granule_list->granule_count == 0) {
*size = 0;
return IMGTOOLERR_SUCCESS;
}
else if (granule_list->last_granule_sectors == 0) {
*size = info->sector_size * ((granule_list->granule_count - 1) * info->granule_sectors);
return IMGTOOLERR_SUCCESS;
}
// determine size excluding final sector
*size = info->sector_size * ((granule_list->granule_count - 1) * info->granule_sectors + granule_list->last_granule_sectors - 1);
// determine bytes used in final sector
switch (info->variant) {
case 0:
// look for EOF (ASCII SUB) and trailing NULs in final sector
{
uint8_t buf[MAX_SECTOR_SIZE];
ferr = read_granule(img, granule_list->granules[granule_list->granule_count-1], info->sector_size * (granule_list->last_granule_sectors - 1), info->sector_size, buf);
if (ferr)
return imgtool_floppy_error(ferr);
for (last_sector_bytes = info->sector_size - 1; ; last_sector_bytes--) {
if (buf[last_sector_bytes] != 0)
break;
if (last_sector_bytes == 0)
break;
}
if (buf[last_sector_bytes] != 0x1a) {
last_sector_bytes++;
}
}
break;
case 1:
last_sector_bytes = ent->lastsectorbytes;
break;
}
// TODO is it valid for last_sector_bytes == 0?
if (last_sector_bytes > info->sector_size) {
return IMGTOOLERR_CORRUPTIMAGE;
}
*size += last_sector_bytes;
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t process_bml3_file(struct bml3_dirent *ent, imgtool::image &img, imgtool::stream *destf, size_t *size)
{
imgtoolerr_t err;
size_t remaining_size, granule_size;
bml3_diskinfo *info = bml3_get_diskinfo(img);
struct granule_list_t granule_list;
granule_list.granule_count = 0;
err = list_granules(ent, img, &granule_list);
if (err)
return err;
err = get_file_size(ent, img, &granule_list, size);
if (err)
return err;
if (destf) {
remaining_size = *size;
granule_size = info->granule_sectors * info->sector_size;
for (int c = 0; c < granule_list.granule_count; c++) {
if (granule_size >= remaining_size)
granule_size = remaining_size;
transfer_from_granule(img, granule_list.granules[c], granule_size, *destf);
remaining_size -= granule_size;
}
}
return IMGTOOLERR_SUCCESS;
}
/* create a new directory entry with a specified name */
static imgtoolerr_t prepare_dirent(uint8_t variant, struct bml3_dirent *ent, const char *fname)
{
const char *fname_end;
const char *fname_ext;
int fname_ext_len;
memset(ent, '\0', sizeof(*ent));
memset(ent->fname, ' ', sizeof(ent->fname));
memset(ent->fext, ' ', sizeof(ent->fext));
fname_end = strchr(fname, '.');
if (fname_end)
fname_ext = fname_end + 1;
else
fname_end = fname_ext = fname + strlen(fname);
fname_ext_len = strlen(fname_ext);
switch (variant) {
case 0:
/* 8-character max filename */
if (((fname_end - fname) > 8) || (fname_ext_len > 0))
return IMGTOOLERR_BADFILENAME;
break;
case 1:
/*8.3 filename */
if (((fname_end - fname) > 8) || (fname_ext_len > 3))
return IMGTOOLERR_BADFILENAME;
break;
default:
return IMGTOOLERR_CORRUPTIMAGE;
}
memcpy(ent->fname, fname, fname_end - fname);
memcpy(ent->fext, fname_ext, fname_ext_len);
/* By default, set as a type 2 binary file */
ent->ftype = 2;
ent->asciiflag = 0;
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t bml3_diskimage_open(imgtool::image &image, imgtool::stream::ptr &&dummy)
{
// imgtoolerr_t err;
floperr_t ferr;
bml3_diskinfo *info = bml3_get_diskinfo(image);
floppy_image_legacy *floppy = imgtool_floppy(image);
const struct FloppyCallbacks *callbacks = floppy_callbacks(floppy);
// probe disk geometry to guess format
int heads_per_disk = callbacks->get_heads_per_disk(floppy);
uint32_t sector_length;
ferr = callbacks->get_sector_length(floppy, 0, 20, 1, &sector_length);
if (ferr)
return imgtool_floppy_error(ferr);
int sectors_per_track = callbacks->get_sectors_per_track(floppy, 0, 20);
if (heads_per_disk == 2 && sector_length == 128 && sectors_per_track == 16) {
// single-sided, single-density
info->sector_size = 128;
info->heads = 1;
info->fat_start_sector = 1;
info->fat_start_offset = 5;
info->fat_sectors = 2;
info->dirent_start_sector = 7;
info->granule_sectors = 4;
info->first_granule_cylinder = 0;
info->variant = 0;
}
else if (heads_per_disk == 2 && sector_length == 256 && sectors_per_track == 16) {
// double-sided, double-density
info->sector_size = 256;
info->heads = 2;
info->fat_start_sector = 2;
info->fat_start_offset = 1;
info->fat_sectors = 1;
info->dirent_start_sector = 5;
info->granule_sectors = 8;
info->first_granule_cylinder = 1;
info->variant = 1;
}
else {
// invalid or unsupported format
return IMGTOOLERR_CORRUPTIMAGE;
}
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t bml3_diskimage_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
{
floperr_t ferr;
imgtoolerr_t err;
size_t filesize;
struct bml3_direnum *rsenum;
struct bml3_dirent rsent;
char fname[13];
imgtool::image &image(enumeration.image());
rsenum = (struct bml3_direnum *) enumeration.extra_bytes();
/* Did we hit the end of file before? */
if (rsenum->eof)
goto eof;
do
{
if (rsenum->index >= max_dirents(image))
goto eof;
ferr = get_bml3_dirent(image, rsenum->index++, &rsent);
if (ferr)
return imgtool_floppy_error(ferr);
}
while(rsent.fname[0] == '\0');
/* Now are we at the eof point? */
if (rsent.fname[0] == -1)
{
rsenum->eof = 1;
eof:
ent.eof = 1;
}
else
{
/* Not the end of file */
err = process_bml3_file(&rsent, image, nullptr, &filesize);
if (err)
return err;
if (filesize == ((size_t) -1))
{
/* corrupt! */
ent.filesize = 0;
ent.corrupt = 1;
}
else
{
ent.filesize = filesize;
ent.corrupt = 0;
}
ent.eof = 0;
get_dirent_fname(fname, &rsent);
snprintf(ent.filename, std::size(ent.filename), "%s", fname);
snprintf(ent.attr, std::size(ent.attr), "%d %c", (int) rsent.ftype, (char) (rsent.asciiflag + 'B'));
}
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t bml3_diskimage_freespace(imgtool::partition &partition, uint64_t *size)
{
floperr_t ferr;
uint8_t i;
size_t s = 0;
uint8_t granule_count;
uint8_t granule_map[MAX_GRANULEMAP_SIZE];
imgtool::image &image(partition.image());
bml3_diskinfo *info = bml3_get_diskinfo(image);
ferr = get_granule_map(image, granule_map, &granule_count);
if (ferr)
return imgtool_floppy_error(ferr);
for (i = 0; i < granule_count; i++)
{
if (granule_map[i] == 0xff)
s += (info->granule_sectors * info->sector_size);
}
*size = s;
return (imgtoolerr_t)FLOPPY_ERROR_SUCCESS;
}
static imgtoolerr_t delete_entry(imgtool::image &img, struct bml3_dirent *ent, int pos)
{
floperr_t ferr;
unsigned char g, i;
uint8_t granule_count;
uint8_t granule_map[MAX_GRANULEMAP_SIZE];
/* Write a NUL in the filename, marking it deleted */
ent->fname[0] = 0;
ferr = put_bml3_dirent(img, pos, ent);
if (ferr)
return imgtool_floppy_error(ferr);
ferr = get_granule_map(img, granule_map, &granule_count);
if (ferr)
return imgtool_floppy_error(ferr);
/* Now free up the granules */
g = ent->first_granule;
while (g < granule_count)
{
i = granule_map[g];
granule_map[g] = 0xff;
g = i;
}
ferr = put_granule_map(img, granule_map, granule_count);
if (ferr)
return imgtool_floppy_error(ferr);
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t bml3_diskimage_readfile(imgtool::partition &partition, const char *fname, const char *fork, imgtool::stream &destf)
{
imgtoolerr_t err;
struct bml3_dirent ent;
size_t size;
imgtool::image &img(partition.image());
err = lookup_bml3_file(img, fname, &ent, nullptr);
if (err)
return err;
err = process_bml3_file(&ent, img, &destf, &size);
if (err)
return err;
if (size == (size_t) -1)
return IMGTOOLERR_CORRUPTIMAGE;
return (imgtoolerr_t)0;
}
static imgtoolerr_t bml3_diskimage_writefile(imgtool::partition &partition, const char *fname, const char *fork, imgtool::stream &sourcef, util::option_resolution *writeoptions)
{
floperr_t ferr;
imgtoolerr_t err;
imgtool::image &img(partition.image());
bml3_diskinfo *info = bml3_get_diskinfo(img);
struct bml3_dirent ent, ent2;
size_t i;
uint64_t sz, read_sz;
uint64_t freespace = 0;
unsigned char *gptr;
uint8_t granule_count;
uint8_t granule_map[MAX_GRANULEMAP_SIZE];
uint8_t eof_buf[MAX_SECTOR_SIZE];
// one-time setup of eof_buf
memset(eof_buf, 0, sizeof(eof_buf));
eof_buf[0] = 0x1A;
/* can we write to this image? */
if (floppy_is_read_only(imgtool_floppy(img)))
return IMGTOOLERR_READONLY;
err = bml3_diskimage_freespace(partition, &freespace);
if (err)
return err;
/* is there enough space? */
sz = read_sz = sourcef.size();
if (info->variant == 0) {
// also need to write EOF
sz++;
}
if (sz > freespace)
return IMGTOOLERR_NOSPACE;
/* setup our directory entry */
err = prepare_dirent(info->variant, &ent, fname);
if (err)
return err;
ent.ftype = writeoptions->lookup_int(BML3_OPTIONS_FTYPE);
ent.asciiflag = uint8_t(writeoptions->lookup_int(BML3_OPTIONS_ASCII)) - 1;
gptr = &ent.first_granule;
ferr = get_granule_map(img, granule_map, &granule_count);
if (ferr)
return imgtool_floppy_error(ferr);
unsigned char g = 0x00;
uint32_t granule_bytes = info->granule_sectors * info->sector_size;
do
{
while (granule_map[g] != 0xff)
{
g++;
if ((g >= granule_count) || (g == 0))
return IMGTOOLERR_UNEXPECTED; /* We should have already verified that there is enough space */
}
*gptr = g;
gptr = &granule_map[g];
i = std::min(read_sz, uint64_t(granule_bytes));
if (i > 0) {
err = transfer_to_granule(img, g, i, sourcef);
if (err)
return err;
read_sz -= i;
sz -= i;
}
if (i < info->granule_sectors * info->sector_size && sz > 0) {
// write EOF and trailing NULs in the final sector
ferr = write_granule(img, g, i, (info->granule_sectors * info->sector_size - i - 1) % info->sector_size + 1, eof_buf);
if (ferr)
return imgtool_floppy_error(ferr);
sz--;
i++;
}
/* Go to next granule */
g++;
}
while(sz > 0);
/* Now that we are done with the file, we need to specify the final entry
* in the file allocation table
*/
*gptr = 0xc0 + ((i + info->sector_size-1) / info->sector_size) - (info->variant == 0 ? 1 : 0);
ent.lastsectorbytes = (i - 1) % info->sector_size + 1;
/* delete file if it already exists */
err = bml3_diskimage_deletefile(partition, fname);
if (err && err != IMGTOOLERR_FILENOTFOUND)
return err;
/* Now we need to find an empty directory entry */
i = -1;
do
{
ferr = get_bml3_dirent(img, ++i, &ent2);
if (ferr)
return imgtool_floppy_error(ferr);
}
while(ent2.fname[0] != '\0' && ent2.fname[0] != -1);
ferr = put_bml3_dirent(img, i, &ent);
if (ferr)
return imgtool_floppy_error(ferr);
/* write the granule map back out */
ferr = put_granule_map(img, granule_map, granule_count);
if (ferr)
return imgtool_floppy_error(ferr);
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t bml3_diskimage_deletefile(imgtool::partition &partition, const char *fname)
{
imgtoolerr_t err;
imgtool::image &image(partition.image());
int pos = 0;
struct bml3_dirent ent;
err = lookup_bml3_file(image, fname, &ent, &pos);
if (err)
return err;
return delete_entry(image, &ent, pos);
}
static imgtoolerr_t bml3_diskimage_suggesttransfer(imgtool::partition &partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
{
imgtoolerr_t err;
imgtool::image &image(partition.image());
struct bml3_dirent ent;
int pos;
if (fname)
{
err = lookup_bml3_file(image, fname, &ent, &pos);
if (err)
return err;
if (ent.asciiflag == 0xFF)
{
/* ASCII file */
suggestions[0].viability = SUGGESTION_RECOMMENDED;
suggestions[0].filter = filter_eoln_getinfo;
suggestions[1].viability = SUGGESTION_POSSIBLE;
suggestions[1].filter = NULL;
}
else if (ent.ftype == 0)
{
/* tokenized BASIC file */
suggestions[0].viability = SUGGESTION_RECOMMENDED;
suggestions[0].filter = NULL;
suggestions[1].viability = SUGGESTION_POSSIBLE;
suggestions[1].filter = filter_bml3bas_getinfo;
}
}
else
{
suggestions[0].viability = SUGGESTION_RECOMMENDED;
suggestions[0].filter = NULL;
suggestions[1].viability = SUGGESTION_POSSIBLE;
suggestions[1].filter = filter_eoln_getinfo;
suggestions[2].viability = SUGGESTION_POSSIBLE;
suggestions[2].filter = filter_bml3bas_getinfo;
}
return IMGTOOLERR_SUCCESS;
}
/*********************************************************************
Imgtool module declaration
*********************************************************************/
OPTION_GUIDE_START( bml3_writefile_optionguide )
OPTION_ENUM_START( BML3_OPTIONS_FTYPE, "ftype", "File type" )
OPTION_ENUM( 0, "basic", "Basic" )
OPTION_ENUM( 1, "data", "Data" )
OPTION_ENUM( 2, "binary", "Binary" )
OPTION_ENUM( 3, "assembler", "Assembler Source" )
OPTION_ENUM_END
OPTION_ENUM_START( BML3_OPTIONS_ASCII, "ascii", "Ascii flag" )
OPTION_ENUM( 0, "ascii", "Ascii" )
OPTION_ENUM( 1, "binary", "Binary" )
OPTION_ENUM_END
OPTION_GUIDE_END
void bml3_get_info(const imgtool_class *imgclass, uint32_t state, union imgtoolinfo *info)
{
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
case IMGTOOLINFO_INT_PREFER_UCASE: info->i = 1; break;
case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(bml3_diskinfo); break;
case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct bml3_direnum); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "bml3"); break;
case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Basic Master Level 3 format"); break;
case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "T0-[2]-3;M0-[1]"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = bml3_diskimage_open; break;
case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = bml3_diskimage_nextenum; break;
case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = bml3_diskimage_freespace; break;
case IMGTOOLINFO_PTR_READ_FILE: info->read_file = bml3_diskimage_readfile; break;
case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = bml3_diskimage_writefile; break;
case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = bml3_diskimage_deletefile; break;
case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = bml3_diskimage_suggesttransfer; break;
case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: info->writefile_optguide = &bml3_writefile_optionguide; break;
case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_default; break;
}
}

View File

@ -0,0 +1,499 @@
// license:BSD-3-Clause
// copyright-holders:Raphael Nabet
/*
Handlers for concept floppy images
Disk images are in MESS format.
Raphael Nabet, 2003
*/
#include "imgtool.h"
#include "opresolv.h"
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
struct UINT16xE
{
uint8_t bytes[2];
};
/*
get_UINT16xE
Read a 16-bit word, whether it is little-endian or big-endian
little_endian (I): non-zero if word is little-endian, zero if word is
big-endian
word (I): pointer to word to read
Returns value of word in native format
*/
static inline uint16_t get_UINT16xE(int little_endian, UINT16xE word)
{
return little_endian ? (word.bytes[0] | (word.bytes[1] << 8)) : ((word.bytes[0] << 8) | word.bytes[1]);
}
#if 0
/*
set_UINT16xE
Write a 16-bit word, whether it is little-endian or big-endian
little_endian (I): non-zero if word is little-endian, zero if word is
big-endian
word (O): pointer to word to write
data (I): value to write in word, in native format
*/
static inline void set_UINT16xE(int little_endian, UINT16xE *word, uint16_t data)
{
if (little_endian)
{
word->bytes[0] = data & 0xff;
word->bytes[1] = (data >> 8) & 0xff;
}
else
{
word->bytes[0] = (data >> 8) & 0xff;
word->bytes[1] = data & 0xff;
}
}
#endif
/*
Disk structure:
Track 0 Sector 0 & 1: bootstrap loader
Track 0 Sector 2 through 5: disk directory
Remaining sectors are used for data.
*/
/*
device directory record (Disk sector 2-5)
*/
struct concept_vol_hdr_entry
{
UINT16xE first_block;
UINT16xE next_block;
UINT16xE ftype;
unsigned char volname[8];
UINT16xE last_block;
UINT16xE num_files;
UINT16xE last_boot;
UINT16xE last_access;
char mem_flipped;
char disk_flipped;
UINT16xE unused;
};
struct concept_file_dir_entry
{
UINT16xE first_block;
UINT16xE next_block;
UINT16xE ftype;
unsigned char filename[16];
UINT16xE last_byte;
UINT16xE last_access;
};
struct concept_dev_dir
{
concept_vol_hdr_entry vol_hdr;
concept_file_dir_entry file_dir[77];
char unused[20];
};
/*
concept disk image descriptor
*/
struct concept_image
{
imgtool::stream *file_handle; /* imgtool file handle */
concept_dev_dir dev_dir; /* cached copy of device directory */
};
/*
concept catalog iterator, used when imgtool reads the catalog
*/
struct concept_iterator
{
concept_image *image;
int index; /* current index */
};
static imgtoolerr_t concept_image_init(imgtool::image &img, imgtool::stream::ptr &&stream);
static void concept_image_exit(imgtool::image &img);
static void concept_image_info(imgtool::image &img, std::ostream &stream);
static imgtoolerr_t concept_image_beginenum(imgtool::directory &enumeration, const char *path);
static imgtoolerr_t concept_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent);
static void concept_image_closeenum(imgtool::directory &enumeration);
static imgtoolerr_t concept_image_freespace(imgtool::partition &partition, uint64_t *size);
static imgtoolerr_t concept_image_readfile(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf);
#if 0
static imgtoolerr_t concept_image_writefile(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream *sourcef, util::option_resolution *writeoptions);
static imgtoolerr_t concept_image_deletefile(imgtool::partition &partition, const char *filename);
static imgtoolerr_t concept_image_create(const imgtool_module *mod, imgtool::stream *f, util::option_resolution *createoptions);
#endif
void concept_get_info(const imgtool_class *imgclass, uint32_t state, union imgtoolinfo *info)
{
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(concept_image); break;
case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(concept_iterator); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "concept"); break;
case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Concept floppy disk image"); break;
case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "img"); break;
case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
case IMGTOOLINFO_PTR_OPEN: info->open = concept_image_init; break;
case IMGTOOLINFO_PTR_CLOSE: info->close = concept_image_exit; break;
case IMGTOOLINFO_PTR_INFO: info->info = concept_image_info; break;
case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = concept_image_beginenum; break;
case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = concept_image_nextenum; break;
case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = concept_image_closeenum; break;
case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = concept_image_freespace; break;
case IMGTOOLINFO_PTR_READ_FILE: info->read_file = concept_image_readfile; break;
case IMGTOOLINFO_PTR_WRITE_FILE: /* info->write_file = concept_image_writefile */; break;
case IMGTOOLINFO_PTR_DELETE_FILE: /* info->delete_file = concept_image_deletefile */; break;
case IMGTOOLINFO_PTR_CREATE: /* info->create = concept_image_create */; break;
}
}
static concept_image *get_concept_image(imgtool::image &image)
{
return (concept_image *)image.extra_bytes();
}
/*
read_physical_record
Read one 512-byte physical record from a disk image
file_handle: imgtool file handle
secnum: physical record address
dest: pointer to destination buffer
Return non-zero on error
*/
static int read_physical_record(imgtool::stream &file_handle, int secnum, void *dest)
{
int reply;
/* seek to sector */
reply = file_handle.seek(secnum*512, SEEK_SET);
if (reply)
return 1;
/* read it */
reply = file_handle.read(dest, 512);
if (reply != 512)
return 1;
return 0;
}
#ifdef UNUSED_FUNCTION
/*
write_physical_record
Write one 512-byte physical record to a disk image
file_handle: imgtool file handle
secnum: logical sector address
src: pointer to source buffer
Return non-zero on error
*/
static int write_physical_record(imgtool::stream *file_handle, int secnum, const void *src)
{
int reply;
/* seek to sector */
reply = file_handle->seek(secnum*512, SEEK_SET);
if (reply)
return 1;
/* read it */
reply = file_handle->write(src, 512);
if (reply != 512)
return 1;
return 0;
}
#endif
/*
Search for a file name on a concept_image
image (I): image reference
filename (I): name of the file to search
entry_index (O): index of file in disk catalog
Return non-zero on error
*/
static int get_catalog_entry(concept_image *image, const unsigned char *filename, int *entry_index)
{
int filename_len = filename[0];
int i;
if (filename_len > 15)
/* file name is bad */
return 1;
for (i = 0; i < 77; i++)
{
if (!memcmp(filename, image->dev_dir.file_dir[i].filename, filename_len+1))
{
/* file found */
*entry_index = i;
return 0;
}
}
/* file not found */
return 1;
}
/*
Open a file as a concept_image.
*/
static imgtoolerr_t concept_image_init(imgtool::image &img, imgtool::stream::ptr &&stream)
{
concept_image *image = get_concept_image(img);
int reply;
int i;
unsigned totphysrecs;
/* read device directory */
for (i=0; i<4; i++)
{
reply = read_physical_record(*stream, i+2, ((char *) & image->dev_dir)+i*512);
if (reply)
return IMGTOOLERR_READERROR;
}
/* do primitive checks */
totphysrecs = get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.last_block)
- get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.first_block);
if ((get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.first_block) != 0)
|| (get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.next_block) != 6)
|| (totphysrecs < 6) /*|| (f->size() != totphysrecs*512)*/
|| (image->dev_dir.vol_hdr.volname[0] > 7))
{
return IMGTOOLERR_CORRUPTIMAGE;
}
image->file_handle = stream.release();
return IMGTOOLERR_SUCCESS;
}
/*
close a concept_image
*/
static void concept_image_exit(imgtool::image &img)
{
/*concept_image *image = get_concept_image(img);*/
}
/*
get basic information on a concept_image
Currently returns the volume name
*/
static void concept_image_info(imgtool::image &img, std::ostream &stream)
{
concept_image *image = get_concept_image(img);
char vol_name[8];
memcpy(vol_name, image->dev_dir.vol_hdr.volname + 1, image->dev_dir.vol_hdr.volname[0]);
vol_name[image->dev_dir.vol_hdr.volname[0]] = 0;
stream << vol_name;
}
/*
Open the disk catalog for enumeration
*/
static imgtoolerr_t concept_image_beginenum(imgtool::directory &enumeration, const char *path)
{
concept_iterator *iter;
iter = (concept_iterator *) enumeration.extra_bytes();
iter->image = (concept_image *) enumeration.image().extra_bytes();
iter->index = 0;
return IMGTOOLERR_SUCCESS;
}
/*
Enumerate disk catalog next entry
*/
static imgtoolerr_t concept_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent)
{
concept_iterator *iter = (concept_iterator *) enumeration.extra_bytes();
ent.corrupt = 0;
ent.eof = 0;
if ((iter->image->dev_dir.file_dir[iter->index].filename[0] == 0) || (iter->index > 77))
{
ent.eof = 1;
}
else if (iter->image->dev_dir.file_dir[iter->index].filename[0] > 15)
{
ent.corrupt = 1;
}
else
{
int len = iter->image->dev_dir.file_dir[iter->index].filename[0];
const char *type;
if (len > std::size(ent.filename))
len = std::size(ent.filename);
memcpy(ent.filename, iter->image->dev_dir.file_dir[iter->index].filename + 1, len);
ent.filename[len] = 0;
/* parse flags */
switch (get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].ftype) & 0xf)
{
case 0:
case 8:
type = "DIRHDR";
break;
case 2:
type = "CODE";
break;
case 3:
type = "TEXT";
break;
case 5:
type = "DATA";
break;
default:
type = "???";
break;
}
snprintf(ent.attr, std::size(ent.attr), "%s", type);
/* len in physrecs */
ent.filesize = get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].next_block)
- get_UINT16xE(iter->image->dev_dir.vol_hdr.disk_flipped, iter->image->dev_dir.file_dir[iter->index].first_block);
iter->index++;
}
return (imgtoolerr_t)0;
}
/*
Free enumerator
*/
static void concept_image_closeenum(imgtool::directory &enumeration)
{
}
/*
Compute free space on disk image
*/
static imgtoolerr_t concept_image_freespace(imgtool::partition &partition, uint64_t *size)
{
imgtool::image &img(partition.image());
concept_image *image = get_concept_image(img);
int free_blocks;
int i;
/* first get number of data blocks */
free_blocks = get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.last_block)
- get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.vol_hdr.next_block);
/* next substract length of each file */
for (i=0; (image->dev_dir.file_dir[i].filename[0] != 0) && (i <= 77); i++)
{
free_blocks -= get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[i].next_block)
- get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[i].first_block);
}
*size = free_blocks;
return IMGTOOLERR_SUCCESS;
}
/*
Extract a file from a concept_image.
*/
static imgtoolerr_t concept_image_readfile(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf)
{
imgtool::image &img(partition.image());
concept_image *image = get_concept_image(img);
size_t filename_len = strlen(filename);
unsigned char concept_fname[16];
int catalog_index;
int i;
uint8_t buf[512];
if (filename_len > 15)
return IMGTOOLERR_BADFILENAME;
concept_fname[0] = filename_len;
memcpy(concept_fname+1, filename, filename_len);
if (get_catalog_entry(image, concept_fname, &catalog_index))
return IMGTOOLERR_FILENOTFOUND;
for (i = get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[catalog_index].first_block);
i < get_UINT16xE(image->dev_dir.vol_hdr.disk_flipped, image->dev_dir.file_dir[catalog_index].next_block);
i++)
{
if (read_physical_record(*image->file_handle, i, buf))
return IMGTOOLERR_READERROR;
if (destf.write(buf, 512) != 512)
return IMGTOOLERR_WRITEERROR;
}
return (imgtoolerr_t)0;
}
#if 0
/*
Add a file to a concept_image.
*/
static imgtoolerr_t concept_image_writefile(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream *sourcef, util::option_resolution *writeoptions)
{
/* ... */
return 0;
}
/*
Delete a file from a concept_image.
*/
static imgtoolerr_t concept_image_deletefile(imgtool::partition &partition, const char *filename)
{
/* ... */
return 0;
}
/*
Create a blank concept_image.
*/
static imgtoolerr_t concept_image_create(const imgtool_module *mod, imgtool::stream *f, util::option_resolution *createoptions)
{
/* ... */
return 0;
}
#endif

View File

@ -0,0 +1,583 @@
// license:BSD-3-Clause
// copyright-holders:Tim Schuerewegen
/*
Cybiko Classic File System
(c) 2007 Tim Schuerewegen
*/
#include "imgtool.h"
#include "opresolv.h"
#include <zlib.h>
struct cybiko_file_system
{
imgtool::stream *stream;
uint32_t page_count, page_size, block_count_boot, block_count_file;
uint16_t write_count;
};
struct cybiko_iter
{
uint16_t block;
};
struct cfs_file
{
char name[64]; // name of the file
uint32_t date; // date/time of the file (seconds since 1900/01/01)
uint32_t size; // size of the file
uint32_t blocks; // number of blocks occupied by the file
};
enum
{
BLOCK_TYPE_INVALID,
BLOCK_TYPE_BOOT,
BLOCK_TYPE_FILE
};
#define MAX_PAGE_SIZE (264 * 2)
#define INVALID_FILE_ID 0xFFFF
enum
{
FLASH_TYPE_INVALID,
FLASH_TYPE_AT45DB041,
FLASH_TYPE_AT45DB081,
FLASH_TYPE_AT45DB161
};
#define BLOCK_USED(x) (x[0] & 0x80)
#define BLOCK_FILE_ID(x) buffer_read_16_be( x + 2)
#define BLOCK_PART_ID(x) buffer_read_16_be( x + 4)
#define BLOCK_FILENAME(x) (char*)(x + 7)
#define FILE_HEADER_SIZE 0x48
static cybiko_file_system *get_cfs(imgtool::image &image)
{
return (cybiko_file_system*)image.extra_bytes();
}
// 2208988800 is the number of seconds between 1900/01/01 and 1970/01/01
typedef util::arbitrary_clock<std::uint32_t, 1900, 1, 1, 0, 0, 0, std::ratio<1, 1> > cybiko_clock;
imgtool::datetime cybiko_time_crack(uint32_t cfs_time)
{
cybiko_clock::duration d(cfs_time);
std::chrono::time_point<cybiko_clock> tp(d);
return imgtool::datetime(imgtool::datetime::datetime_type::LOCAL, tp);
}
uint32_t cybiko_time_setup(const imgtool::datetime &t)
{
auto cybiko_time_point = cybiko_clock::from_arbitrary_time_point(t.time_point());
return cybiko_time_point.time_since_epoch().count();
}
static uint32_t buffer_read_32_be( uint8_t *buffer)
{
return (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | (buffer[3] << 0);
}
static uint16_t buffer_read_16_be( uint8_t *buffer)
{
return (buffer[0] << 8) | (buffer[1] << 0);
}
static void buffer_write_32_be( uint8_t *buffer, uint32_t data)
{
buffer[0] = (data >> 24) & 0xFF;
buffer[1] = (data >> 16) & 0xFF;
buffer[2] = (data >> 8) & 0xFF;
buffer[3] = (data >> 0) & 0xFF;
}
static void buffer_write_16_be( uint8_t *buffer, uint16_t data)
{
buffer[0] = (data >> 8) & 0xFF;
buffer[1] = (data >> 0) & 0xFF;
}
// page = crc1 (4) + wcnt (2) + crc2 (2) + data (x) + unk (2)
static uint32_t page_buffer_calc_checksum_1( uint8_t *buffer, uint32_t size, int block_type)
{
return crc32( 0, buffer + 8, (block_type == BLOCK_TYPE_BOOT) ? 250 : size - 10);
}
static uint16_t page_buffer_calc_checksum_2( uint8_t *buffer)
{
uint16_t val = 0xAF17;
val ^= buffer_read_16_be( buffer + 0);
val ^= buffer_read_16_be( buffer + 2);
val ^= buffer_read_16_be( buffer + 4);
return swapendian_int16(val);
}
static int page_buffer_verify( uint8_t *buffer, uint32_t size, int block_type)
{
uint32_t checksum_page, checksum_calc;
// checksum 1
checksum_calc = page_buffer_calc_checksum_1( buffer, size, block_type);
checksum_page = buffer_read_32_be( buffer + 0);
if (checksum_calc != checksum_page) return false;
// checksum 2
checksum_calc = page_buffer_calc_checksum_2( buffer);
checksum_page = buffer_read_16_be( buffer + 6);
if (checksum_calc != checksum_page) return false;
// ok
return true;
}
static int cfs_block_to_page( cybiko_file_system *cfs, int block_type, uint32_t block, uint32_t *page)
{
switch (block_type)
{
case BLOCK_TYPE_BOOT : if (page) *page = block; return true;
case BLOCK_TYPE_FILE : if (page) *page = block + cfs->block_count_boot; return true;
default : return false;
}
}
static int cfs_page_to_block( cybiko_file_system *cfs, uint32_t page, int *block_type, uint32_t *block)
{
uint32_t tmp = page;
// boot block
if (tmp < cfs->block_count_boot)
{
if (block_type) *block_type = BLOCK_TYPE_BOOT;
if (block) *block = tmp;
return true;
}
tmp -= cfs->block_count_boot;
// file block
if (tmp < cfs->block_count_file)
{
if (block_type) *block_type = BLOCK_TYPE_FILE;
if (block) *block = tmp;
return true;
}
tmp -= cfs->block_count_file;
// error
return false;
}
static int cfs_page_read( cybiko_file_system *cfs, uint8_t *buffer, uint32_t page)
{
if (page >= cfs->page_count) return false;
cfs->stream->seek(page * cfs->page_size, SEEK_SET);
cfs->stream->read(buffer, cfs->page_size);
return true;
}
static int cfs_page_write( cybiko_file_system *cfs, uint8_t *buffer, uint32_t page)
{
if (page >= cfs->page_count) return false;
cfs->stream->seek(page * cfs->page_size, SEEK_SET);
cfs->stream->write(buffer, cfs->page_size);
return true;
}
static int cfs_block_read( cybiko_file_system *cfs, uint8_t *buffer, int block_type, uint32_t block)
{
uint8_t buffer_page[MAX_PAGE_SIZE];
uint32_t page;
if (!cfs_block_to_page( cfs, block_type, block, &page)) return false;
if (!cfs_page_read( cfs, buffer_page, page)) return false;
memcpy( buffer, buffer_page + 8, cfs->page_size - 10);
return true;
}
static int cfs_block_write( cybiko_file_system *cfs, uint8_t *buffer, int block_type, uint32_t block)
{
uint8_t buffer_page[MAX_PAGE_SIZE];
uint32_t page;
memcpy( buffer_page + 8, buffer, cfs->page_size - 10);
buffer_write_32_be( buffer_page + 0, page_buffer_calc_checksum_1( buffer_page, cfs->page_size, block_type));
buffer_write_16_be( buffer_page + 4, cfs->write_count++);
buffer_write_16_be( buffer_page + 6, page_buffer_calc_checksum_2( buffer_page));
buffer_write_16_be( buffer_page + cfs->page_size - 2, 0xFFFF);
if (!cfs_block_to_page( cfs, block_type, block, &page)) return false;
if (!cfs_page_write( cfs, buffer_page, page)) return false;
return true;
}
static int cfs_file_delete( cybiko_file_system *cfs, uint16_t file_id)
{
uint8_t buffer[MAX_PAGE_SIZE];
int i;
for (i=0;i<cfs->block_count_file;i++)
{
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id))
{
buffer[0] &= ~0x80;
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
}
}
return true;
}
static int cfs_file_info( cybiko_file_system *cfs, uint16_t file_id, cfs_file *file)
{
uint8_t buffer[MAX_PAGE_SIZE];
int i;
file->blocks = file->size = 0;
for (i=0;i<cfs->block_count_file;i++)
{
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id))
{
if (BLOCK_PART_ID(buffer) == 0)
{
strcpy( file->name, BLOCK_FILENAME(buffer));
file->date = buffer_read_32_be( buffer + 6 + FILE_HEADER_SIZE - 4);
}
file->size += buffer[1];
file->blocks++;
}
}
return (file->blocks > 0) ? true : false;
}
static int cfs_file_find( cybiko_file_system *cfs, const char *filename, uint16_t *file_id)
{
uint8_t buffer[MAX_PAGE_SIZE];
int i;
for (i=0;i<cfs->block_count_file;i++)
{
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
if (BLOCK_USED(buffer) && (strncmp( filename, BLOCK_FILENAME(buffer), 40) == 0))
{
*file_id = i;
return true;
}
}
return false;
}
static int cfs_verify(cybiko_file_system &cfs)
{
uint8_t buffer[MAX_PAGE_SIZE];
int i, block_type;
for (i = 0; i < cfs.page_count; i++)
{
if (!cfs_page_read(&cfs, buffer, i)) return false;
if (!cfs_page_to_block(&cfs, i, &block_type, NULL)) return false;
if (!page_buffer_verify(buffer, cfs.page_size, block_type)) return false;
}
return true;
}
static int cfs_init(cybiko_file_system &cfs, imgtool::stream::ptr &&stream, int flash_type)
{
cfs.stream = stream.release();
switch (flash_type)
{
case FLASH_TYPE_AT45DB041 : cfs.page_count = 2048; cfs.page_size = 264; break;
case FLASH_TYPE_AT45DB081 : cfs.page_count = 4096; cfs.page_size = 264; break;
case FLASH_TYPE_AT45DB161 : cfs.page_count = 4096; cfs.page_size = 528; break;
default : return false;
}
cfs.block_count_boot = 5;
cfs.block_count_file = cfs.page_count - cfs.block_count_boot;
cfs.write_count = 0;
return true;
}
static int cfs_format( cybiko_file_system *cfs)
{
uint8_t buffer[MAX_PAGE_SIZE];
int i;
// boot blocks
memset( buffer, 0xFF, sizeof( buffer));
for (i=0;i<cfs->block_count_boot;i++)
{
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_BOOT, i)) return false;
}
// file blocks
memset( buffer, 0xFF, sizeof( buffer));
buffer[0] &= ~0x80;
for (i=0;i<cfs->block_count_file;i++)
{
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return false;
}
// ok
return true;
}
static uint16_t cfs_calc_free_blocks( cybiko_file_system *cfs)
{
uint8_t buffer[MAX_PAGE_SIZE];
int i;
uint16_t blocks = 0;
for (i=0;i<cfs->block_count_file;i++)
{
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return 0;
if (!BLOCK_USED(buffer)) blocks++;
}
return blocks;
}
static uint32_t cfs_calc_free_space( cybiko_file_system *cfs, uint16_t blocks)
{
uint32_t free_space;
free_space = blocks * (cfs->page_size - 0x10);
if (free_space > 0) free_space -= FILE_HEADER_SIZE;
return free_space;
}
static int flash_size_to_flash_type( size_t size)
{
switch (size)
{
case 0x084000 : return FLASH_TYPE_AT45DB041;
case 0x108000 : return FLASH_TYPE_AT45DB081;
case 0x210000 : return FLASH_TYPE_AT45DB161;
default : return FLASH_TYPE_INVALID;
}
}
static int flash_option_to_flash_type( int option)
{
switch (option)
{
case 0 : return FLASH_TYPE_AT45DB041;
case 1 : return FLASH_TYPE_AT45DB081;
case 2 : return FLASH_TYPE_AT45DB161;
default : return FLASH_TYPE_INVALID;
}
}
static imgtoolerr_t cybiko_image_open(imgtool::image &image, imgtool::stream::ptr &&stream)
{
cybiko_file_system *cfs = get_cfs(image);
int flash_type;
// init
flash_type = flash_size_to_flash_type(stream->size());
if (!cfs_init(*cfs, std::move(stream), flash_type)) return IMGTOOLERR_CORRUPTIMAGE;
// verify
if (!cfs_verify(*cfs)) return IMGTOOLERR_CORRUPTIMAGE;
// ok
return IMGTOOLERR_SUCCESS;
}
static void cybiko_image_close(imgtool::image &image)
{
cybiko_file_system *cfs = get_cfs(image);
delete cfs->stream;
}
static imgtoolerr_t cybiko_image_create(imgtool::image &image, imgtool::stream::ptr &&stream, util::option_resolution *opts)
{
cybiko_file_system *cfs = get_cfs(image);
int flash_type;
// init
flash_type = flash_option_to_flash_type(opts->lookup_int('F'));
if (!cfs_init(*cfs, std::move(stream), flash_type)) return IMGTOOLERR_CORRUPTIMAGE;
// format
if (!cfs_format(cfs)) return IMGTOOLERR_CORRUPTIMAGE;
// ok
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t cybiko_image_begin_enum(imgtool::directory &enumeration, const char *path)
{
cybiko_iter *iter = (cybiko_iter*)enumeration.extra_bytes();
iter->block = 0;
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t cybiko_image_next_enum(imgtool::directory &enumeration, imgtool_dirent &ent)
{
imgtool::image &image(enumeration.image());
cybiko_file_system *cfs = get_cfs(image);
cybiko_iter *iter = (cybiko_iter*)enumeration.extra_bytes();
uint8_t buffer[MAX_PAGE_SIZE];
uint16_t file_id = INVALID_FILE_ID;
cfs_file file;
// find next file
while (iter->block < cfs->block_count_file)
{
if (!cfs_block_read(cfs, buffer, BLOCK_TYPE_FILE, iter->block++)) return IMGTOOLERR_READERROR;
if (BLOCK_USED(buffer) && (BLOCK_PART_ID(buffer) == 0))
{
file_id = BLOCK_FILE_ID(buffer);
break;
}
}
// get file information
if ((file_id != INVALID_FILE_ID) && cfs_file_info(cfs, file_id, &file))
{
strcpy(ent.filename, file.name);
ent.filesize = file.size;
ent.lastmodified_time = cybiko_time_crack(file.date);
ent.filesize = file.size;
}
else
{
ent.eof = 1;
}
// ok
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t cybiko_image_free_space(imgtool::partition &partition, uint64_t *size)
{
imgtool::image &image(partition.image());
cybiko_file_system *cfs = get_cfs(image);
if (size) *size = cfs_calc_free_space( cfs, cfs_calc_free_blocks( cfs));
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t cybiko_image_read_file(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf)
{
imgtool::image &image(partition.image());
cybiko_file_system *cfs = get_cfs(image);
uint8_t buffer[MAX_PAGE_SIZE];
uint16_t file_id, part_id = 0, old_part_id;
int i;
// find file
if (!cfs_file_find( cfs, filename, &file_id)) return IMGTOOLERR_FILENOTFOUND;
// read file
do
{
old_part_id = part_id;
for (i=0;i<cfs->block_count_file;i++)
{
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_READERROR;
if (BLOCK_USED(buffer) && (BLOCK_FILE_ID(buffer) == file_id) && (BLOCK_PART_ID(buffer) == part_id))
{
destf.write(buffer + 6 + ((part_id == 0) ? FILE_HEADER_SIZE : 0), buffer[1]);
part_id++;
}
}
} while (old_part_id != part_id);
// ok
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t cybiko_image_write_file(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &sourcef, util::option_resolution *opts)
{
imgtool::image &image(partition.image());
cybiko_file_system *cfs = get_cfs(image);
uint8_t buffer[MAX_PAGE_SIZE];
uint16_t file_id, part_id = 0, free_blocks;
uint64_t bytes_left;
cfs_file file;
int i;
// find file
if (!cfs_file_find(cfs, filename, &file_id)) file_id = INVALID_FILE_ID;
// check free space
free_blocks = cfs_calc_free_blocks( cfs);
if (file_id != INVALID_FILE_ID)
{
if (!cfs_file_info(cfs, file_id, &file)) return IMGTOOLERR_UNEXPECTED;
free_blocks += file.blocks;
}
if (cfs_calc_free_space(cfs, free_blocks) < sourcef.size()) return IMGTOOLERR_NOSPACE;
// delete file
if (file_id != INVALID_FILE_ID)
{
if (!cfs_file_delete( cfs, file_id)) return IMGTOOLERR_UNEXPECTED;
}
// create/write destination file
bytes_left = sourcef.size();
i = 0;
while ((bytes_left > 0) && (i < cfs->block_count_file))
{
if (!cfs_block_read( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_READERROR;
if (!BLOCK_USED(buffer))
{
if (part_id == 0) file_id = i;
memset( buffer, 0xFF, cfs->page_size - 0x10);
buffer[0] = 0x80;
buffer[1] = cfs->page_size - 0x10 - ((part_id == 0) ? FILE_HEADER_SIZE : 0);
if (bytes_left < buffer[1]) buffer[1] = bytes_left;
buffer_write_16_be( buffer + 2, file_id);
buffer_write_16_be( buffer + 4, part_id);
if (part_id == 0)
{
buffer[6] = 0;
strcpy(BLOCK_FILENAME(buffer), filename);
buffer_write_32_be(buffer + 6 + FILE_HEADER_SIZE - 4, cybiko_time_setup(imgtool::datetime::now(imgtool::datetime::datetime_type::LOCAL)));
sourcef.read(buffer + 6 + FILE_HEADER_SIZE, buffer[1]);
}
else
{
sourcef.read(buffer + 6, buffer[1]);
}
if (!cfs_block_write( cfs, buffer, BLOCK_TYPE_FILE, i)) return IMGTOOLERR_WRITEERROR;
bytes_left -= buffer[1];
part_id++;
}
i++;
}
// ok
return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t cybiko_image_delete_file(imgtool::partition &partition, const char *filename)
{
imgtool::image &image(partition.image());
cybiko_file_system *cfs = get_cfs(image);
uint16_t file_id;
// find file
if (!cfs_file_find( cfs, filename, &file_id)) return IMGTOOLERR_FILENOTFOUND;
// delete file
if (!cfs_file_delete( cfs, file_id)) return IMGTOOLERR_UNEXPECTED;
// ok
return IMGTOOLERR_SUCCESS;
}
OPTION_GUIDE_START( cybiko_image_createimage_optguide )
OPTION_ENUM_START( 'F', "flash", "Flash Type" )
OPTION_ENUM( 0, "AT45DB041", "AT45DB041 (528 KByte)" )
OPTION_ENUM( 1, "AT45DB081", "AT45DB081 (1056 KByte)" )
OPTION_ENUM( 2, "AT45DB161", "AT45DB161 (2112 KByte)" )
OPTION_ENUM_END
OPTION_GUIDE_END
//OPTION_GUIDE_START( cybiko_image_writefile_optguide )
// OPTION_INT( 'B', "boot", "Boot Flag" )
//OPTION_GUIDE_END
void cybiko_get_info( const imgtool_class *imgclass, uint32_t state, union imgtoolinfo *info)
{
switch (state)
{
// --- the following bits of info are returned as 64-bit signed integers ---
case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES : info->i = sizeof( cybiko_file_system); break;
case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES : info->i = sizeof( cybiko_iter); break;
// case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME : info->i = 1; break;
case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME : info->i = 1; break;
// case IMGTOOLINFO_INT_BLOCK_SIZE : info->i = 264; break;
// --- the following bits of info are returned as pointers to data or functions ---
case IMGTOOLINFO_PTR_OPEN : info->open = cybiko_image_open; break;
case IMGTOOLINFO_PTR_CREATE : info->create = cybiko_image_create; break;
case IMGTOOLINFO_PTR_CLOSE : info->close = cybiko_image_close; break;
case IMGTOOLINFO_PTR_BEGIN_ENUM : info->begin_enum = cybiko_image_begin_enum; break;
case IMGTOOLINFO_PTR_NEXT_ENUM : info->next_enum = cybiko_image_next_enum; break;
case IMGTOOLINFO_PTR_FREE_SPACE : info->free_space = cybiko_image_free_space; break;
case IMGTOOLINFO_PTR_READ_FILE : info->read_file = cybiko_image_read_file; break;
case IMGTOOLINFO_PTR_WRITE_FILE : info->write_file = cybiko_image_write_file; break;
case IMGTOOLINFO_PTR_DELETE_FILE : info->delete_file = cybiko_image_delete_file; break;
case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE : info->createimage_optguide = &cybiko_image_createimage_optguide; break;
// case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE : info->writefile_optguide = cybiko_image_writefile_optguide; break;
// --- the following bits of info are returned as NULL-terminated strings ---
case IMGTOOLINFO_STR_NAME : strcpy( info->s = imgtool_temp_str(), "cybiko"); break;
case IMGTOOLINFO_STR_DESCRIPTION : strcpy( info->s = imgtool_temp_str(), "Cybiko Classic File System"); break;
case IMGTOOLINFO_STR_FILE : strcpy( info->s = imgtool_temp_str(), __FILE__); break;
case IMGTOOLINFO_STR_FILE_EXTENSIONS : strcpy( info->s = imgtool_temp_str(), "bin,nv"); break;
case IMGTOOLINFO_STR_EOLN : strcpy( info->s = imgtool_temp_str(), "\r\n"); break;
case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "F[0]-2"); break;
// case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "B[0]-1"); break;
}
}

Some files were not shown because too many files have changed in this diff Show More