示例#1
0
文件: bzip.cpp 项目: meesokim/fba
// Find rom number i from the pBzipDriver game
static int FindRom(int i)
{
	struct BurnRomInfo ri;
	int nRet;

	memset(&ri, 0, sizeof(ri));

	nRet = BurnDrvGetRomInfo(&ri, i);
	if (nRet != 0) {											// Failure: no such rom
		return -2;
	}

	if (ri.nCrc) {												// Search by crc first
		nRet = FindRomByCrc(ri.nCrc);
		if (nRet >= 0) {
			return nRet;
		}
	}

	for (int nAka = 0; nAka < 0x10000; nAka++) {				// Failing that, search for possible names
		char *szPossibleName = NULL;

		nRet = BurnDrvGetRomName(&szPossibleName, i, nAka);
		if (nRet) {												// No more rom names
			break;
		}
		nRet = FindRomByName(ANSIToTCHAR(szPossibleName, NULL, 0));
		if (nRet >= 0) {
			return nRet;
		}
	}

	return -1;													// Couldn't find the rom
}
示例#2
0
// Make a list view of the DIPswitches
static int InpDIPSWListMake()
{
	if (hInpDIPSWList == NULL) {
		return 1;
	}
	SendMessage(hInpDIPSWList, LVM_DELETEALLITEMS, 0, 0);

	BurnDIPInfo bdi;
	unsigned int i = 0, j = 0, k = 0;
	char* pDIPGroup = NULL;
	while (BurnDrvGetDIPInfo(&bdi, i) == 0) {
		if ((bdi.nFlags & 0xF0) == 0xF0) {
		   	if (bdi.nFlags == 0xFE || bdi.nFlags == 0xFD) {
				pDIPGroup = bdi.szText;
				k = i;
			}
			i++;
		} else {
			if (CheckSetting(i)) {
				LVITEM LvItem;
				memset(&LvItem, 0, sizeof(LvItem));
				LvItem.mask = LVIF_TEXT | LVIF_PARAM;
				LvItem.iItem = j;
				LvItem.iSubItem = 0;
				LvItem.pszText = ANSIToTCHAR(pDIPGroup, NULL, 0);
				LvItem.lParam = (LPARAM)k;
				SendMessage(hInpDIPSWList, LVM_INSERTITEM, 0, (LPARAM)&LvItem);
				LvItem.mask = LVIF_TEXT;
				LvItem.iSubItem = 1;
				LvItem.pszText = ANSIToTCHAR(bdi.szText, NULL, 0);
				SendMessage(hInpDIPSWList, LVM_SETITEM, 0, (LPARAM)&LvItem);
				j++;
			}
			i += (bdi.nFlags & 0x0F);
		}
	}

	return 0;
}
示例#3
0
文件: bzip.cpp 项目: meesokim/fba
static int FindRomByName(TCHAR* szName)
{
	struct ZipEntry* pl;
	int i;

	// Find the rom named szName in the List
	for (i = 0, pl = List; i < nListCount; i++, pl++) {
		TCHAR szCurrentName[MAX_PATH];
		if (_tcsicmp(szName, GetFilenameW(ANSIToTCHAR(pl->szName, szCurrentName, MAX_PATH))) == 0) {
			return i;
		}
	}
	return -1;													// couldn't find the rom
}
示例#4
0
文件: cong.cpp 项目: madnessw/thesnow
// Write out the config file for the game-specific inputs
int ConfigGameSave(bool bSave)
{
	FILE* h;

	if (!bSave) {
		GameInpBlank(0);
		ConfigGameLoad(false);
	}

	h = _tfopen(GameConfigName(), _T("wt"));
	if (h == NULL) {
		return 1;
	}

	// Write title
	_ftprintf(h, _T("// ") _T(APP_TITLE) _T(" v%s --- Config File for %s (%s)\n\n"), szAppBurnVer, BurnDrvGetText(DRV_NAME), ANSIToTCHAR(BurnDrvGetTextA(DRV_FULLNAME), NULL, 0));

	_ftprintf(h, _T("// --- Miscellaneous ----------------------------------------------------------\n\n"));
	// Write version number
	_ftprintf(h, _T("version 0x%06X\n\n"), nBurnVer);
	// Write speed for relative analog controls
	_ftprintf(h, _T("analog  0x%04X\n"), nAnalogSpeed);
	// Write CPU speed adjustment
	_ftprintf(h, _T("cpu     0x%04X\n"), nBurnCPUSpeedAdjust);

	_ftprintf(h, _T("\n\n\n"));
	_ftprintf(h, _T("// --- Inputs -----------------------------------------------------------------\n\n"));

	GameInpWrite(h);

	fclose(h);
	return 0;
}
示例#5
0
static void SavePatches()
{
	int nActivePatches = 0;
	
	for (int i = 0; i < MAX_ACTIVE_PATCHES; i++) {
		_stprintf(szIpsActivePatches[i], _T(""));
	}
	
	for (int i = 0; i < nNumPatches; i++) {
		int nChecked = _TreeView_GetCheckState(hIpsList, hPatchHandlesIndex[i]);
		
		if (nChecked) {
			_tcscpy(szIpsActivePatches[nActivePatches], szPatchFileNames[i]);
			nActivePatches++;
		}
	}
	
	FILE* fp = _tfopen(GameIpsConfigName(), _T("wt"));
	
	if (fp) {
		_ftprintf(fp, _T("// ") _T(APP_TITLE) _T(" v%s --- IPS Config File for %s (%s)\n\n"), szAppBurnVer, BurnDrvGetText(DRV_NAME), ANSIToTCHAR(BurnDrvGetTextA(DRV_FULLNAME), NULL, 0));
		for (int i = 0; i < nActivePatches; i++) {
			TCHAR *Tokens;
			TCHAR szFileName[MAX_PATH];
			Tokens = _tcstok(szIpsActivePatches[i], _T("\\"));
			while (Tokens != NULL) {
				szFileName[0] = _T('\0');
				_tcscpy(szFileName, Tokens);
				Tokens = _tcstok(NULL, _T("\\"));
			}		
			
			_ftprintf(fp, _T("%s\n"), szFileName);
		}
		fclose(fp);
	}
}