Пример #1
0
std::string xegs_cart_slot_device::get_default_card_software()
{
	if (open_image_file(mconfig().options()))
	{
		const char *slot_string;
		std::vector<uint8_t> head(0x10);
		uint32_t len = m_file->size();
		int type = A800_8K;

		// check whether there is an header, to identify the cart type
		if ((len % 0x1000) == 0x10)
		{
			m_file->read(&head[0], 0x10);
			type = identify_cart_type(&head[0]);
		}
		if (type != A800_XEGS)
		{
			osd_printf_info("This game is not designed for XEGS. ");
			if (type >= A5200_4K)
				osd_printf_info("You might want to run it in A5200.\n");
			else
				osd_printf_info("You might want to run it in A800 or A800XL.\n");
		}

		slot_string = a800_get_slot(type);

		clear();

		return std::string(slot_string);
	}
	else
		return software_get_default_slot("xegs");
}
Пример #2
0
std::string a800_cart_slot_device::get_default_card_software()
{
	if (open_image_file(mconfig().options()))
	{
		const char *slot_string;
		std::vector<uint8_t> head(0x10);
		uint32_t len = m_file->size();
		int type = A800_8K;

		// check whether there is an header, to identify the cart type
		if ((len % 0x1000) == 0x10)
		{
			m_file->read(&head[0], 0x10);
			type = identify_cart_type(&head[0]);
		}
		else    // otherwise try to guess based on size
		{
			if (len == 0x4000)
				type = A800_16K;
			if (len == 0x2000)
				type = A800_8K;
		}

		if (type >= A5200_4K)
			osd_printf_info("This game is not designed for A800. You might want to run it in A5200.\n");

		slot_string = a800_get_slot(type);

		clear();

		return std::string(slot_string);
	}
	else
		return software_get_default_slot("a800_8k");
}
Пример #3
0
std::string a5200_cart_slot_device::get_default_card_software()
{
	if (open_image_file(mconfig().options()))
	{
		const char *slot_string;
		std::vector<uint8_t> head(0x10);
		uint32_t len = m_file->size();
		int type = A5200_8K;

		// check whether there is an header, to identify the cart type
		if ((len % 0x1000) == 0x10)
		{
			m_file->read(&head[0], 0x10);
			type = identify_cart_type(&head[0]);
		}
		else
		{
			std::string info;
			if (hashfile_extrainfo(*this, info) && info.compare("A13MIRRORING")==0)
				type = A5200_16K_2CHIPS;
		}
		if (type < A5200_4K)
			osd_printf_info("This game is not designed for A5200. You might want to run it in A800 or A800XL.\n");

		slot_string = a800_get_slot(type);

		clear();

		return std::string(slot_string);
	}
	else
		return software_get_default_slot("a5200");
}
Пример #4
0
void xegs_cart_slot_device::get_default_card_software(std::string &result)
{
	if (open_image_file(mconfig().options()))
	{
		const char *slot_string = "xegs";
		dynamic_buffer head(0x10);
		UINT32 len = core_fsize(m_file);
		int type = A800_8K;

		// check whether there is an header, to identify the cart type
		if ((len % 0x1000) == 0x10)
		{
			core_fread(m_file, &head[0], 0x10);
			type = identify_cart_type(&head[0]);
		}
		if (type != A800_XEGS)
		{
			osd_printf_info("This game is not designed for XEGS. ");
			if (type >= A5200_4K)
				osd_printf_info("You might want to run it in A5200.\n");
			else
				osd_printf_info("You might want to run it in A800 or A800XL.\n");
		}

		slot_string = a800_get_slot(type);

		clear();

		result.assign(slot_string);
	}
	else
		software_get_default_slot(result, "xegs");
}
Пример #5
0
void a5200_cart_slot_device::get_default_card_software(std::string &result)
{
	if (open_image_file(mconfig().options()))
	{
		const char *slot_string = "a5200";
		dynamic_buffer head(0x10);
		UINT32 len = core_fsize(m_file);
		int type = A5200_8K;

		// check whether there is an header, to identify the cart type
		if ((len % 0x1000) == 0x10)
		{
			core_fread(m_file, &head[0], 0x10);
			type = identify_cart_type(&head[0]);

			std::string info;
			if (hashfile_extrainfo(*this, info) && info.compare("A13MIRRORING")==0)
				type = A5200_16K_2CHIPS;
		}
		if (type < A5200_4K)
			osd_printf_info("This game is not designed for A5200. You might want to run it in A800 or A800XL.\n");

		slot_string = a800_get_slot(type);

		clear();

		result.assign(slot_string);
	}
	else
		software_get_default_slot(result, "a5200");
}
Пример #6
0
void a800_cart_slot_device::get_default_card_software(std::string &result)
{
	if (open_image_file(mconfig().options()))
	{
		const char *slot_string = "a800_8k";
		dynamic_buffer head(0x10);
		UINT32 len = core_fsize(m_file);
		int type = A800_8K;

		// check whether there is an header, to identify the cart type
		if ((len % 0x1000) == 0x10)
		{
			core_fread(m_file, &head[0], 0x10);
			type = identify_cart_type(&head[0]);
		}
		else    // otherwise try to guess based on size
		{
			if (len == 0x4000)
				type = A800_16K;
			if (len == 0x2000)
				type = A800_8K;
		}

		if (type >= A5200_4K)
			osd_printf_info("This game is not designed for A800. You might want to run it in A5200.\n");

		slot_string = a800_get_slot(type);

		clear();

		result.assign(slot_string);
	}
	else
		software_get_default_slot(result, "a800_8k");
}
Пример #7
0
image_init_result a800_cart_slot_device::call_load()
{
	if (m_cart)
	{
		uint32_t len;

		if (software_entry() != nullptr)
		{
			const char *pcb_name;
			len = get_software_region_length("rom");

			m_cart->rom_alloc(len, tag());
			memcpy(m_cart->get_rom_base(), get_software_region("rom"), len);

			if ((pcb_name = get_feature("slot")) != nullptr)
				m_type = a800_get_pcb_id(pcb_name);
			else
				m_type = A800_8K;
		}
		else
		{
			len = length();

			// check whether there is an header, to identify the cart type
			if ((len % 0x1000) == 0x10)
			{
				uint8_t header[16];
				fread(header, 0x10);
				m_type = identify_cart_type(header);
				len -= 0x10;    // in identify_cart_type the first 0x10 bytes are read, so we need to adjust here
			}
			else    // otherwise try to guess based on size
			{
				if (len == 0x8000)
					m_type = A5200_32K;
				if (len == 0x4000)
					m_type = A800_16K;
				if (len == 0x2000)
					m_type = A800_8K;
				if (len == 0x1000)
					m_type = A5200_4K;
				// also make a try with .hsi file (for .a52 files)
				std::string info;
				if (hashfile_extrainfo(*this, info) && info.compare("A13MIRRORING")==0)
					m_type = A5200_16K_2CHIPS;
			}

			m_cart->rom_alloc(len, tag());
			fread(m_cart->get_rom_base(), len);
		}
		if (m_type == A800_TELELINK2)
			m_cart->nvram_alloc(0x100);

		logerror("%s loaded cartridge '%s' size %dK\n", machine().system().name, filename(), len/1024);
	}
	return image_init_result::PASS;
}
Пример #8
0
bool a800_cart_slot_device::call_load()
{
	if (m_cart)
	{
		UINT32 len;

		if (software_entry() != nullptr)
		{
			const char *pcb_name;
			len = get_software_region_length("rom");

			m_cart->rom_alloc(len, tag());
			memcpy(m_cart->get_rom_base(), get_software_region("rom"), len);

			if ((pcb_name = get_feature("slot")) != nullptr)
				m_type = a800_get_pcb_id(pcb_name);
			else
				m_type = A800_8K;
		}
		else
		{
			len = length();

			// check whether there is an header, to identify the cart type
			if ((len % 0x1000) == 0x10)
			{
				UINT8 header[16];
				fread(header, 0x10);
				m_type = identify_cart_type(header);
				len -= 0x10;    // in identify_cart_type the first 0x10 bytes are read, so we need to adjust here
			}
			else    // otherwise try to guess based on size
			{
				if (len == 0x8000)
					m_type = A5200_32K;
				if (len == 0x4000)
					m_type = A800_16K;
				if (len == 0x2000)
					m_type = A800_8K;
				if (len == 0x1000)
					m_type = A5200_4K;
			}

			m_cart->rom_alloc(len, tag());
			fread(m_cart->get_rom_base(), len);
		}
		if (m_type == A800_TELELINK2)
			m_cart->nvram_alloc(0x100);

		printf("%s loaded cartridge '%s' size %dK\n", machine().system().name, filename(), len/1024);
	}
	return IMAGE_INIT_PASS;
}
Пример #9
0
std::string vcs_cart_slot_device::get_default_card_software(get_default_card_software_hook &hook) const
{
	if (hook.image_file())
	{
		const char *slot_string;
		uint32_t len = hook.image_file()->size();
		std::vector<uint8_t> rom(len);
		int type;

		hook.image_file()->read(&rom[0], len);

		type = identify_cart_type(&rom[0], len);
		slot_string = vcs_get_slot(type);

		return std::string(slot_string);
	}
	else
		return software_get_default_slot("a26_4k");
}
Пример #10
0
void vcs_cart_slot_device::get_default_card_software(astring &result)
{
	if (open_image_file(mconfig().options()))
	{
		const char *slot_string = "a26_4k";
		UINT32 len = core_fsize(m_file);
		dynamic_buffer rom(len);
		int type;
		
		core_fread(m_file, rom, len);
		
		type = identify_cart_type(rom, len);
		slot_string = vcs_get_slot(type);
		
		clear();
		
		result.cpy(slot_string);
	}
	else
		software_get_default_slot(result, "a26_4k");
}
Пример #11
0
std::string vcs_cart_slot_device::get_default_card_software()
{
	if (open_image_file(mconfig().options()))
	{
		const char *slot_string;
		UINT32 len = m_file->size();
		dynamic_buffer rom(len);
		int type;

		m_file->read(&rom[0], len);

		type = identify_cart_type(&rom[0], len);
		slot_string = vcs_get_slot(type);

		clear();

		return std::string(slot_string);
	}
	else
		return software_get_default_slot("a26_4k");
}
Пример #12
0
image_init_result vcs_cart_slot_device::call_load()
{
	if (m_cart)
	{
		uint8_t *ROM;
		uint32_t len;

		if (loaded_through_softlist())
			len = get_software_region_length("rom");
		else
			len = length();

		//printf("Size: 0x%X\n", len);

		// check that filesize is among the supported ones
		switch (len)
		{
			case 0x00800:
			case 0x01000:
			case 0x02000:
			case 0x028ff:
			case 0x02900:
			case 0x03000:
			case 0x04000:
			case 0x08000:
			case 0x10000:
			case 0x80000:
				break;

			default:
				seterror(IMAGE_ERROR_UNSUPPORTED, "Invalid rom file size" );
				return image_init_result::FAIL;
		}

		m_cart->rom_alloc(len, tag());
		ROM = m_cart->get_rom_base();

		if (loaded_through_softlist())
		{
			const char *pcb_name;
			bool has_ram = get_software_region("ram") ? true : false;
			memcpy(ROM, get_software_region("rom"), len);

			if ((pcb_name = get_feature("slot")) != nullptr)
				m_type = vcs_get_pcb_id(pcb_name);
			else
			{
				// identify type based on size
				switch (len)
				{
					case 0x800:
						m_type = A26_2K;
						break;
					case 0x1000:
						m_type = A26_4K;
						break;
					case 0x2000:
						m_type = A26_F8;
						break;
					case 0x28ff:
					case 0x2900:
						m_type = A26_DPC;
						break;
					case 0x3000:
						m_type = A26_FA;
						break;
					case 0x4000:
						m_type = A26_F6;
						break;
					case 0x8000:
						m_type = A26_F4;
						break;
					case 0x10000:
						m_type = A26_32IN1;
						break;
					case 0x80000:
						m_type = A26_3F;
						break;
					default:
						m_type = A26_4K;
						printf("Unrecognized cart type!\n");
						break;
				}
			}

			if (has_ram)
				m_cart->ram_alloc(get_software_region_length("ram"));
		}
		else
		{
			fread(ROM, len);
			m_type = identify_cart_type(ROM, len);

			// check for Special Chip (128bytes of RAM)
			if (len == 0x2000 || len == 0x4000 || len == 0x8000)
				if (detect_super_chip(ROM, len))
				{
					m_cart->ram_alloc(0x80);
					//printf("Super Chip detected!\n");
				}
			// Super chip games:
			// dig dig, crystal castles, millipede, stargate, defender ii, jr. Pac Man,
			// desert falcon, dark chambers, super football, sprintmaster, fatal run,
			// off the wall, shooting arcade, secret quest, radar lock, save mary, klax

			// add CBS RAM+ (256bytes of RAM)
			if (m_type == A26_FA)
				m_cart->ram_alloc(0x100);
			// add M Network RAM
			else if (m_type == A26_E7)
				m_cart->ram_alloc(0x800);
			// add Commavid RAM
			else if (m_type == A26_CV)
				m_cart->ram_alloc(0x400);
			// add Starpath Superchager RAM
			else if (m_type == A26_SS)
				m_cart->ram_alloc(0x1800);
			// add Boulder Dash RAM
			else if (m_type == A26_3E)
				m_cart->ram_alloc(0x8000);
		}

		//printf("Type: %s\n", vcs_get_slot(m_type));

		// pass a pointer to the now allocated ROM for the DPC chip
		if (m_type == A26_DPC)
			m_cart->setup_addon_ptr((uint8_t *)m_cart->get_rom_base() + 0x2000);

		return image_init_result::PASS;
	}

	return image_init_result::PASS;
}