Exemplo n.º 1
0
int setCloneRomInfo(GameInfo* info, ArcEntry& list)
{
	if (!info)
		return 1;

	RomInfo* romInfo = NULL;
	GameInfo* cloneInfo = NULL;
	map<unsigned int, RomInfo>::iterator clone_iter;
	set<string>::iterator it = info->clones.begin();

	for (; it != info->clones.end(); it++)
	{
		cloneInfo = allGameMap[*it];
		clone_iter = cloneInfo->roms.find(list.nCrc);
		if (clone_iter != cloneInfo->roms.end())
		{
			romInfo = &clone_iter->second;

			if (romInfo->size != list.nLen)
			{
				if (list.nLen < romInfo->size)
					romInfo->state = STAT_SMALL;
				else
					romInfo->state = STAT_LARGE;
			}
			else
				romInfo->state = STAT_OK;
		}
		else
		{
			// wrong CRC
			if (nLoadMenuShowX & DISABLECRC)
			{
				RomInfo* rom = getSetHasRom(cloneInfo, list.szName);
				if (rom)
					rom->state = STAT_OK;
			}
		}

		setCloneRomInfo(cloneInfo, list);
	}

	return 0;
}
Exemplo n.º 2
0
static int getArchiveInfo(const char* path, const char* name)
{
	if (!name || !path) {
		return 1;
	}

	// omit extension
	string _name = name;
	lowerString(_name); // case-insensitive
	size_t pos = _name.rfind(".");
	_name = _name.substr(0, pos);

//	if (_name == "sf2m13") {
//		int dummy = 0;
//	}

	// set progress
	//checkScanThread();
	//romsSetProgress();

	// find name
	map<string, GameInfo*>::iterator _it = allGameMap.find(_name);
	if (_it == allGameMap.end()) {
		return 1;
	}

	GameInfo* gameInfo = _it->second;
	if (!gameInfo) {
		return 1;
	}

	static char fileName[MAX_PATH];
	sprintf(fileName, "%s%s", path, name);

	if (archiveOpenA(fileName)) {
		return 1;
	}

	if (archiveGetList(&List, &listCount)) {
		freeArchiveList();
		return 1;
	}

	RomInfo* romInfo = NULL;
	map<unsigned int, RomInfo>::iterator iter;

	for (int i = 0; i < listCount; i++) {
		// check roms
		iter = gameInfo->roms.find(List[i].nCrc);
		if (iter != gameInfo->roms.end()) {
			romInfo = &iter->second;
			if (!romInfo) {
				continue;
			}

			if (romInfo->size != List[i].nLen) {
				if (List[i].nLen < romInfo->size) {
					romInfo->state = STAT_SMALL;
				} else {
					romInfo->state = STAT_LARGE;
				}
			} else {
				romInfo->state = STAT_OK;
			}
		} else {
			// wrong CRC
			if (nLoadMenuShowX & DISABLECRC) {
				RomInfo* rom = getSetHasRom(gameInfo, List[i].szName);
				if (rom) {
					rom->state = STAT_OK;
				}
			}
		}

		// check all clones
		setCloneRomInfo(gameInfo, List[i]);
	}

	archiveClose();

	freeArchiveList();

	return 0;
}