コード例 #1
0
static void applyRelations(int id)
{
	if (!bEnforceDep || !hasAssist || id < 0) {
		return;
	}

	int checked = _TreeView_GetCheckState(hIpsList, hPatchHandlesIndex[id]);
	string _datName = WtoA(szDataNames[id]);
	lowerString(_datName);
	itemStateTable[_datName] = checked ? 0 : 1;

	// validate relation
	validateConf(_datName);
	validateDep(_datName);

	// reset checkbox state
	string datName;
	for (int i = 0; i < nNumPatches; i++) {
		datName = WtoA(szDataNames[i]);
		lowerString(datName);
		checked = itemStateTable[datName];
		_TreeView_SetCheckState(hIpsList, hPatchHandlesIndex[i], checked ? TRUE : FALSE);
	}

	// set reverse state to current checkbox
	checked = itemStateTable[_datName];
	_TreeView_SetCheckState(hIpsList, hPatchHandlesIndex[id], checked ? FALSE : TRUE);
}
コード例 #2
0
static void clearPatches()
{
	int nChecked = 0;
	for (int i = 0; i < nNumPatches; i++) {
		nChecked = _TreeView_GetCheckState(hIpsList, hPatchHandlesIndex[i]);
		if (nChecked) {
			_TreeView_SetCheckState(hIpsList, hPatchHandlesIndex[i], FALSE);
		}
	}

	// clear ips relation
	itemStateTable.clear();
}
コード例 #3
0
static void initRelations()
{
	// clear state
	itemStateTable.clear();

	// reset checkbox state
	string datName;
	int nChecked = 0;

	for (int i = 0; i < nNumPatches; i++) {
		nChecked = _TreeView_GetCheckState(hIpsList, hPatchHandlesIndex[i]);
		datName = WtoA(szDataNames[i]);
		lowerString(datName);
		itemStateTable.insert(make_pair(datName, nChecked));
	}
}
コード例 #4
0
static void savePatches()
{
	// clear active patch index
	for (int i = 0; i < MAX_ACTIVE_PATCHES; i++) {
		_stprintf(szActivePatches[i], _T(""));
	}

	int nChecked = 0;
	int nActivePatches = 0;
	for (int i = 0; i < nNumPatches; i++) {
		nChecked = _TreeView_GetCheckState(hIpsList, hPatchHandlesIndex[i]);
		if (nChecked) {
			_tcscpy(szActivePatches[nActivePatches], szPatchFileNames[i]);
			nActivePatches++;
			if (nActivePatches >= MAX_ACTIVE_PATCHES) {
				break;
			}
		}
	}

	FILE* fp = _tfopen(gameIpsConfigName(), _T("wt"));
	if (fp) {
		_ftprintf(fp, _T("// ") _T(APP_TITLE) _T(" v%s --- IPS Config File for %s (%hs)\n\n"),
			szAppBurnVer, BurnDrvGetText(DRV_NAME), BurnDrvGetTextA(DRV_FULLNAME));

		TCHAR szPatchName[MAX_PATH];
		TCHAR szFileName[MAX_PATH];
		TCHAR* Tokens = NULL;
		for (int i = 0; i < nActivePatches; i++) {
			_tcscpy(szPatchName, szActivePatches[i]); // make a copy, modified by regret
			Tokens = _tcstok(szPatchName, _T("\\"));
			while (Tokens != NULL) {
				szFileName[0] = _T('\0');
				_tcscpy(szFileName, Tokens);
				Tokens = _tcstok(NULL, _T("\\"));
			}

			_ftprintf(fp, _T("%s\n"), szFileName);
		}
		fclose(fp);
	}

	// if no active patch, delete config file
	if (nActivePatches == 0) {
		_tremove(gameIpsConfigName());
	}
}
コード例 #5
0
ファイル: ips_manager.cpp プロジェクト: tigerking/FB-Alpha
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);
	}
}