本文整理汇总了C++中device_image_interface类的典型用法代码示例。如果您正苦于以下问题:C++ device_image_interface类的具体用法?C++ device_image_interface怎么用?C++ device_image_interface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了device_image_interface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: c64_software_list_cartridge_load
static void c64_software_list_cartridge_load(device_image_interface &image)
{
legacy_c64_state *state = image.device().machine().driver_data<legacy_c64_state>();
// initialize ROML and ROMH pointers
state->m_roml = state->m_c64_roml;
state->m_romh = state->m_c64_romh;
// clear ROML and ROMH areas
memset(state->m_roml, 0, 0x2000);
memset(state->m_romh, 0, 0x2000);
// set GAME and EXROM
state->m_game = atol(image.get_feature("game"));
state->m_exrom = atol(image.get_feature("exrom"));
// determine cartridge type
const char *cart_type = image.get_feature("cart_type");
if (cart_type == NULL)
{
load_standard_c64_cartridge(image);
}
else
{
if (!strcmp(cart_type, "vizawrite"))
load_vizawrite_cartridge(image);
else if (!strcmp(cart_type, "hugo"))
load_hugo_cartridge(image);
else if (!strcmp(cart_type, "easy_calc_result"))
load_easy_calc_result_cartridge(image);
else if (!strcmp(cart_type, "pagefox"))
load_pagefox_cartridge(image);
else if (!strcmp(cart_type, "multiscreen"))
/*
TODO: crashes on protection check after cartridge RAM test
805A: lda $01
805C: and #$FE
805E: sta $01
8060: m6502_brk#$00 <-- BOOM!
*/
load_multiscreen_cartridge(image);
else if (!strcmp(cart_type, "simons_basic"))
load_simons_basic_cartridge(image);
else if (!strcmp(cart_type, "super_explode"))
load_super_explode_cartridge(image);
else
load_standard_c64_cartridge(image);
}
}
示例2:
INPUT_PORTS_END
/***************************************************************************
MACHINE DRIVERS
***************************************************************************/
image_init_result aim65_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag)
{
uint32_t size = slot->common_get_size(slot_tag);
if (size > 0x1000)
{
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported ROM size");
return image_init_result::FAIL;
}
if (image.loaded_through_softlist() && image.get_software_region(slot_tag) == nullptr)
{
std::string errmsg = string_format(
"Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension",
slot_tag, slot_tag);
image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str());
return image_init_result::FAIL;
}
slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, slot_tag);
return image_init_result::PASS;
}
示例3: load_vizawrite_cartridge
static void load_vizawrite_cartridge(device_image_interface &image)
{
#define VW64_DECRYPT_ADDRESS(_offset) \
BITSWAP16(_offset,15,14,13,12,7,8,6,9,5,11,4,3,2,10,1,0)
#define VW64_DECRYPT_DATA(_data) \
BITSWAP8(_data,7,6,0,5,1,4,2,3)
UINT8 *roml = image.get_software_region("roml");
UINT8 *romh = image.get_software_region("romh");
UINT8 *decrypted = image.device().machine().root_device().memregion("user1")->base();
// decrypt ROMs
for (offs_t offset = 0; offset < 0x2000; offset++)
{
offs_t address = VW64_DECRYPT_ADDRESS(offset);
decrypted[address] = VW64_DECRYPT_DATA(roml[offset]);
decrypted[address + 0x2000] = VW64_DECRYPT_DATA(roml[offset + 0x2000]);
decrypted[address + 0x4000] = VW64_DECRYPT_DATA(romh[offset]);
}
// map cartridge ROMs
map_cartridge_roml(image.device().machine(), 0x0000);
map_cartridge_romh(image.device().machine(), 0x4000);
// allocate GAME changing timer
allocate_cartridge_timer(attotime::from_msec(1184), vizawrite_timer);
}
示例4: load_cart
int pegasus_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag)
{
UINT32 size = slot->common_get_size(reg_tag);
bool any_socket = false;
if (size > 0x1000)
{
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
return IMAGE_INIT_FAIL;
}
if (image.software_entry() != NULL && size == 0)
{
// we might be loading a cart compatible with all sockets!
// so try to get region "rom"
size = slot->common_get_size("rom");
any_socket = true;
if (size == 0)
{
astring errmsg;
errmsg.printf("Attempted to load a file that does not work in this socket.\nPlease check \"Usage\" field in the software list for the correct socket(s) to use.");
image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.cstr());
return IMAGE_INIT_FAIL;
}
}
slot->rom_alloc(0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // we alloc 0x1000 also for smaller roms!
slot->common_load_rom(slot->get_rom_base(), size, any_socket ? "rom" : reg_tag);
// raw images have to be decrypted (in particular the ones from softlist)
pegasus_decrypt_rom(slot->get_rom_base(), image.software_entry() != NULL);
return IMAGE_INIT_PASS;
}
示例5:
INPUT_PORTS_END
/***************************************************************************
MACHINE DRIVERS
***************************************************************************/
int aim65_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag)
{
UINT32 size = slot->common_get_size(slot_tag);
if (size > 0x1000)
{
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
return IMAGE_INIT_FAIL;
}
if (image.software_entry() != NULL && image.get_software_region(slot_tag) == NULL)
{
astring errmsg;
errmsg.printf("Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension",
slot_tag, slot_tag);
image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str());
return IMAGE_INIT_FAIL;
}
slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, slot_tag);
return IMAGE_INIT_PASS;
}
示例6:
image_init_result n64_mess_state::disk_load(device_image_interface &image)
{
image.fseek(0, SEEK_SET);
image.fread(memregion("disk")->base(), image.length());
machine().device<n64_periphs>("rcp")->disk_present = true;
return image_init_result::PASS;
}
示例7:
int n64_mess_state::quickload(device_image_interface &image, const char *file_type, int quickload_size)
{
image.fseek(0, SEEK_SET);
image.fread(memregion("disk")->base(), quickload_size);
machine().device<n64_periphs>("rcp")->disk_present = true;
return IMAGE_INIT_PASS;
}
示例8: hashfile_extrainfo
bool hashfile_extrainfo(device_image_interface &image, std::string &result)
{
return hashfile_extrainfo(
image.device().mconfig().options().hash_path(),
image.device().mconfig().gamedrv(),
image.hash(),
result);
}
示例9: load_super_explode_cartridge
static void load_super_explode_cartridge(device_image_interface &image)
{
load_cartridge_region(image, "roml", 0x0000, 0x4000);
map_cartridge_roml(image.device().machine(), 0x0000);
address_space &space = image.device().machine().firstcpu->space(AS_PROGRAM);
space.install_legacy_read_handler(0xdf00, 0xdfff, FUNC(super_explode_r));
install_io2_handler(super_explode_bank_w);
}
示例10: load_cart
int pcjr_state::load_cart(device_image_interface &image, generic_slot_device *slot)
{
UINT32 size = slot->common_get_size("rom");
bool imagic_hack = false;
if (image.software_entry() == nullptr)
{
int header_size = 0;
// Check for supported header sizes
switch (size & 0x3ff)
{
case 0x80:
header_size = 0x80;
break;
case 0x200:
header_size = 0x200;
break;
default:
image.seterror(IMAGE_ERROR_UNSUPPORTED, "Invalid header size" );
return IMAGE_INIT_FAIL;
}
if (size - header_size == 0xa000)
{
// alloc 64K for the imagic carts, so to handle the necessary mirroring
size += 0x6000;
imagic_hack = true;
}
size -= header_size;
image.fseek(header_size, SEEK_SET);
}
slot->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
slot->common_load_rom(slot->get_rom_base(), size, "rom");
if (imagic_hack)
{
// in this case the image consists of 2x8K chunks
// the first chunk is unique, the second is repeated 4 times up to 0xa000 size
// mirroring
UINT8 *ROM = slot->get_rom_base();
memcpy(ROM + 0xe000, ROM + 0x2000, 0x2000);
memcpy(ROM + 0xc000, ROM + 0x2000, 0x2000);
memcpy(ROM + 0xa000, ROM + 0x2000, 0x2000);
memcpy(ROM + 0x8000, ROM + 0x2000, 0x2000);
memcpy(ROM + 0x6000, ROM, 0x2000);
memcpy(ROM + 0x4000, ROM, 0x2000);
memcpy(ROM + 0x2000, ROM, 0x2000);
}
return IMAGE_INIT_PASS;
}
示例11:
void base_c1571_device::on_disk_change(device_image_interface &image)
{
base_c1571_device *c1571 = static_cast<base_c1571_device *>(image.device().owner());
int wp = floppy_wpt_r(image);
c1571->m_ga->on_disk_changed(wp);
}
示例12: load_pagefox_cartridge
static void load_pagefox_cartridge(device_image_interface &image)
{
load_cartridge_region(image, "rom", 0x0000, 0x10000);
map_cartridge_roml(image.device().machine(), 0x0000);
map_cartridge_romh(image.device().machine(), 0x2000);
install_write_handler(0xde80, 0xdeff, pagefox_bank_w);
}
示例13: load_disk
void nes_disksys_device::load_disk(device_image_interface &image)
{
int header = 0;
m_fds_sides = 0;
if (image.length() % 65500)
header = 0x10;
m_fds_sides = (image.length() - header) / 65500;
if (!m_fds_data)
m_fds_data = std::make_unique<UINT8[]>(m_fds_sides * 65500);
// if there is an header, skip it
image.fseek(header, SEEK_SET);
image.fread(m_fds_data.get(), 65500 * m_fds_sides);
return;
}
示例14: load_easy_calc_result_cartridge
static void load_easy_calc_result_cartridge(device_image_interface &image)
{
load_cartridge_region(image, "roml", 0x0000, 0x2000);
load_cartridge_region(image, "romh", 0x2000, 0x4000);
map_cartridge_roml(image.device().machine(), 0x0000);
map_cartridge_romh(image.device().machine(), 0x2000);
install_write_handler(0xde00, 0xde01, easy_calc_result_bank_w);
}
示例15: load_simons_basic_cartridge
static void load_simons_basic_cartridge(device_image_interface &image)
{
load_cartridge_region(image, "roml", 0x0000, 0x2000);
load_cartridge_region(image, "romh", 0x2000, 0x2000);
map_cartridge_roml(image.device().machine(), 0x0000);
map_cartridge_romh(image.device().machine(), 0x2000);
install_io1_handler(simons_basic_bank_w);
}