コード例 #1
0
ファイル: Patch.cpp プロジェクト: AmbientMalice/pcsx2
static int LoadCheatsFiles(const wxDirName& folderName, wxString& fileSpec, const wxString& friendlyName, int& numberFoundCheatsFiles)
{
	numberFoundCheatsFiles = 0;

	if (!folderName.Exists()) {
		Console.WriteLn(Color_Red, L"The %s folder ('%s') is inaccessible. Skipping...", WX_STR(friendlyName), WX_STR(folderName.ToString()));
		return 0;
	}
	wxDir dir(folderName.ToString());

	int before = cheatnumber;
	wxString buffer;
	wxTextFile f;
	bool found = dir.GetFirst(&buffer, L"*", wxDIR_FILES);
	while (found) {
		if (buffer.Upper().Matches(fileSpec.Upper())) {
			PatchesCon->WriteLn(Color_Green, L"Found %s file: '%s'", WX_STR(friendlyName), WX_STR(buffer));
			int before = cheatnumber;
			f.Open(Path::Combine(dir.GetName(), buffer));
			inifile_process(f);
			f.Close();
			int loaded = cheatnumber - before;
			PatchesCon->WriteLn((loaded ? Color_Green : Color_Gray), L"Loaded %d %s from '%s' at '%s'",
			               loaded, WX_STR(friendlyName), WX_STR(buffer), WX_STR(folderName.ToString()));
			numberFoundCheatsFiles ++;
		}
		found = dir.GetNext(&buffer);
	}

	return cheatnumber - before;
}
コード例 #2
0
void IniSaver::Entry( const wxString& var, wxFileName& value, const wxFileName defvalue, bool isAllowRelative )
{
	if( !m_Config ) return;
	wxFileName res(value);

	if ( res.IsAbsolute() )
		res.Normalize();
	
	if (isAllowRelative)
		res = wxDirName::MakeAutoRelativeTo( res, g_fullBaseDirName.ToString() );
	
	m_Config->Write( var, res.GetFullPath() );
}
コード例 #3
0
ファイル: Patch.cpp プロジェクト: AmbientMalice/pcsx2
// This routine loads cheats from *.pnach files
// Returns number of cheats loaded
// Note: Should be called after InitPatches()
int LoadCheats(wxString name, const wxDirName& folderName, const wxString& friendlyName)
{
	int loaded = 0;
	int numberFoundCheatsFiles;

	wxString filespec = name + L"*.pnach";
	loaded += LoadCheatsFiles(folderName, filespec, friendlyName, numberFoundCheatsFiles);

	// This message _might_ be buggy. This function (LoadCheats) loads from an explicit folder.
	// This folder can be cheats or cheats_ws at either the default location or a custom one.
	// This check only tests the default cheats folder, so the message it produces is possibly misleading.
	if (folderName.ToString().IsSameAs(PathDefs::GetCheats().ToString()) && numberFoundCheatsFiles == 0) {
		wxString pathName = Path::Combine(folderName, name.MakeUpper() + L".pnach");
		PatchesCon->WriteLn(Color_Gray, L"Not found %s file: %s", WX_STR(friendlyName), WX_STR(pathName));
	}

	PatchesCon->WriteLn((loaded ? Color_Green : Color_Gray), L"Overall %d %s loaded", loaded, WX_STR(friendlyName));
	return loaded;
}