• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ device_image_interface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中device_image_interface的典型用法代码示例。如果您正苦于以下问题:C++ device_image_interface类的具体用法?C++ device_image_interface怎么用?C++ device_image_interface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了device_image_interface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
	}
}
开发者ID:coinhelper,项目名称:jsmess,代码行数:60,代码来源:c64.c


示例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;
}
开发者ID:Tauwasser,项目名称:mame,代码行数:31,代码来源:aim65.cpp


示例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);
}
开发者ID:coinhelper,项目名称:jsmess,代码行数:28,代码来源:c64.c


示例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;
}
开发者ID:hstampfl,项目名称:mame,代码行数:35,代码来源:pegasus.c


示例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;
}
开发者ID:andysarcade,项目名称:mame,代码行数:31,代码来源:aim65.c


示例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;
}
开发者ID:qwijibo,项目名称:mame,代码行数:7,代码来源:n64.cpp


示例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;
}
开发者ID:dinkc64,项目名称:mame,代码行数:7,代码来源:n64.c


示例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);
}
开发者ID:Tauwasser,项目名称:mame,代码行数:8,代码来源:hashfile.cpp


示例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);
}
开发者ID:coinhelper,项目名称:jsmess,代码行数:11,代码来源:c64.c


示例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;
}
开发者ID:ccmurray,项目名称:mame,代码行数:53,代码来源:ibmpcjr.cpp


示例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);
}
开发者ID:kleopatra999,项目名称:mess-svn,代码行数:7,代码来源:c1571.c


示例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);
}
开发者ID:coinhelper,项目名称:jsmess,代码行数:9,代码来源:c64.c


示例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;
}
开发者ID:GiuseppeGorgoglione,项目名称:mame,代码行数:18,代码来源:disksys.cpp


示例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);
}
开发者ID:coinhelper,项目名称:jsmess,代码行数:10,代码来源:c64.c


示例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);
}
开发者ID:coinhelper,项目名称:jsmess,代码行数:10,代码来源:c64.c


示例16: load_multiscreen_cartridge

static void load_multiscreen_cartridge(device_image_interface &image)
{
	load_cartridge_region(image, "roml", 0x0000, 0x4000);
	load_cartridge_region(image, "rom", 0x4000, 0x30000);

	map_cartridge_roml(image.device().machine(), 0x0000);
	map_cartridge_romh(image.device().machine(), 0x2000);

	install_write_handler(0xdfff, 0xdfff, multiscreen_bank_w);
}
开发者ID:coinhelper,项目名称:jsmess,代码行数:10,代码来源:c64.c


示例17: svi318_load_proc

static void svi318_load_proc(device_image_interface &image)
{
	svi318_state *state = image.device().machine().driver_data<svi318_state>();
	int size;
	int id = floppy_get_drive(&image.device());

	size = image.length();
	switch (size)
	{
	case 172032:	/* SVI-328 SSDD */
		state->m_fdc.heads[id] = 1;
		break;
	case 346112:	/* SVI-328 DSDD */
		state->m_fdc.heads[id] = 2;
		break;
	case 348160:	/* SVI-728 DSDD CP/M */
		state->m_fdc.heads[id] = 2;
		break;
	}
}
开发者ID:rogerjowett,项目名称:ClientServerMAME,代码行数:20,代码来源:svi318.c


示例18: plus4_crt_load

static int plus4_crt_load( device_image_interface &image )
{
	UINT8 *mem = image.device().machine().root_device().memregion("maincpu")->base();
	int size = image.length(), test;
	const char *filetype;
	int address = 0;

	/* magic lowrom at offset 7: $43 $42 $4d */
	/* if at offset 6 stands 1 it will immediatly jumped to offset 0 (0x8000) */
	static const unsigned char magic[] = {0x43, 0x42, 0x4d};
	unsigned char buffer[sizeof (magic)];

	image.fseek(7, SEEK_SET);
	image.fread( buffer, sizeof (magic));
	image.fseek(0, SEEK_SET);

	/* Check if our cart has the magic string, and set its loading address */
	if (!memcmp(buffer, magic, sizeof (magic)))
		address = 0x20000;

	/* Give a loading address to non .bin / non .rom carts as well */
	filetype = image.filetype();

	/* We would support .hi and .lo files, but currently I'm not sure where to load them.
       We simply load them at 0x20000 at this stage, even if it's probably wrong!
       It could also well be that they both need to be loaded at the same time, but this
       is now impossible since I reduced to 1 the number of cart slots.
       More investigations are in order if any .hi, .lo dump would surface!              */
	if (!mame_stricmp(filetype, "hi"))
		address = 0x20000;	/* FIX ME! */

	else if (!mame_stricmp(filetype, "lo"))
		address = 0x20000;	/* FIX ME! */

	/* As a last try, give a reasonable loading address also to .bin/.rom without the magic string */
	else if (!address)
	{
		logerror("Cart %s does not contain the magic string: it may be loaded at the wrong memory address!\n", image.filename());
		address = 0x20000;
	}

	logerror("Loading cart %s at %.5x size:%.4x\n", image.filename(), address, size);

	/* Finally load the cart */
	test = image.fread( mem + address, size);

	if (test != size)
		return IMAGE_INIT_FAIL;

	return IMAGE_INIT_PASS;
}
开发者ID:risico,项目名称:jsmess,代码行数:51,代码来源:c16.c


示例19:

image_init_result nascom2_state::load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id)
{
	// loading directly from file
	if (image.software_entry() == nullptr)
	{
		if (slot->length() > 0x1000)
		{
			image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported file size");
			return image_init_result::FAIL;
		}

		slot->rom_alloc(slot->length(), GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
		slot->fread(slot->get_rom_base(), slot->length());

		// we just assume that socket1 should be loaded to 0xc000 and socket2 to 0xd000
		switch (slot_id)
		{
		case 1:
			m_maincpu->space(AS_PROGRAM).install_rom(0xc000, 0xc000 + slot->length() - 1, slot->get_rom_base());
			break;
		case 2:
			m_maincpu->space(AS_PROGRAM).install_rom(0xd000, 0xd000 + slot->length() - 1, slot->get_rom_base());
			break;
		}
	}

	// loading from software list. this supports multiple regions to load to
	else
	{
		UINT8 *region_b000 = image.get_software_region("b000");
		UINT8 *region_c000 = image.get_software_region("c000");
		UINT8 *region_d000 = image.get_software_region("d000");

		if (region_b000 != nullptr)
		{
			UINT32 size = image.get_software_region_length("b000");
			m_maincpu->space(AS_PROGRAM).install_rom(0xb000, 0xb000 + size - 1, region_b000);
		}

		if (region_c000 != nullptr)
		{
			UINT32 size = image.get_software_region_length("c000");
			m_maincpu->space(AS_PROGRAM).install_rom(0xc000, 0xc000 + size - 1, region_c000);
		}

		if (region_d000 != nullptr)
		{
			UINT32 size = image.get_software_region_length("d000");
			m_maincpu->space(AS_PROGRAM).install_rom(0xd000, 0xd000 + size - 1, region_d000);
		}
	}

	return image_init_result::PASS;
}
开发者ID:bmunger,项目名称:mame,代码行数:54,代码来源:nascom1.cpp


示例20: plus4_software_list_cartridge_load

static void plus4_software_list_cartridge_load(device_image_interface &image)
{
	UINT8 *mem = image.device().machine().root_device().memregion("maincpu")->base();

	size_t size = image.get_software_region_length("c1l");
	if (size)
		memcpy(mem + 0x20000, image.get_software_region("c1l"), size);

	size = image.get_software_region_length("c1h");
	if (size)
		memcpy(mem + 0x24000, image.get_software_region("c1h"), size);

	size = image.get_software_region_length("c2l");
	if (size)
		memcpy(mem + 0x28000, image.get_software_region("c2l"), size);

	size = image.get_software_region_length("c2h");
	if (size)
		memcpy(mem + 0x2c000, image.get_software_region("c2h"), size);
}
开发者ID:risico,项目名称:jsmess,代码行数:20,代码来源:c16.c



注:本文中的device_image_interface类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ device_memory类代码示例发布时间:2022-05-31
下一篇:
C++ device_addr_t类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap