Esempio n. 1
0
void CUIManager::SaveProfile()
{
	IPlayerProfile* pProfile = GetCurrentProfile();
	if (!pProfile)
	{
		assert(false);
		return;
	}

	TUIEventSystems::const_iterator it = m_EventSystems.begin();
	TUIEventSystems::const_iterator end = m_EventSystems.end();
	for (;it != end; ++it)
	{
		it->second->SaveProfile(pProfile);
	}
}
Esempio n. 2
0
bool MainDialog::GetSaveProfileString(bool copySystemLib, wxString &retString) const
{
  wxStandardPaths stdPaths;

  // Get the current selected profile
  ConfigToken saveProfile;
  if(!GetCurrentProfile(saveProfile))
  {
    wxLogError("No GLIntercept profile selected");
    return false;
  }

  // Get the profile name (if any)
  string profileName = "*Unknown*";
  {
    // Get the profile name if it exists
    const ConfigToken * profileNameToken = saveProfile.GetChildToken("ProfileName");
    if(profileNameToken)
    {
      profileNameToken->Get(profileName);
    }

    // Remove the profile/description tokens
    saveProfile.RemoveChild("ProfileName");
    saveProfile.RemoveChild("ProfileDescription");
  }

  // If copying the OpenGL system library
  if(copySystemLib)
  {
    // Get the input files token (or create it)
    ConfigToken * sourceInputFilesToken = GetCreateChildToken(saveProfile, "InputFiles");
    if(sourceInputFilesToken)
    {
      // Get the system lib token (or create it)
      ConfigToken * syslibToken = GetCreateChildToken(*sourceInputFilesToken, "GLSystemLib");
      if(syslibToken)
      {
        // Set the new override system lib name
        vector<string> newSystemLibName;
        newSystemLibName.push_back("opengl32.orig.dll");

        // Override the existing library name
        syslibToken->SetValueArray(newSystemLibName);
      }
    }
  }
 

  // Replace any string that start with %InstallPath% with the current path
  UpdateTokenValues(saveProfile, "%InstallPath%", stdPaths.GetDataDir().c_str());

  // Generate the config string from the profile
  string stlConfigString;
  for(uint childNum =0;childNum < saveProfile.GetNumChildren(); childNum++)
  {
    //Convert each child back to raw config string data
    const ConfigToken * childData = saveProfile.GetChildToken(childNum);
    if(childData)
    {
      string retString;
      if(ConfigParser::GenerateConfigString(childData, retString))
      {
        stlConfigString += retString;
      }
      else
      {
        wxLogError("Unable to generate GLIntercept configuration file data");
        return false;
      }
    }
  }

  // Add a header comment
  retString.Printf("/*\n*  GLIntercept config file generated by GLIConfig.\n*  Configuration based on profile \"%s\".\n*/\n\n", profileName.c_str());
  retString += stlConfigString.c_str();

  return true;
}
Esempio n. 3
0
void MainDialog::OnButtonConfigOptions(wxCommandEvent& WXUNUSED(event))
{
  ConfigOptionsDialog configOptionsDialog(this);

  // Get the current profile data
  ConfigToken currProfile;
  if(!GetCurrentProfile(currProfile))
  {
    wxLogError("No GLIntercept profile selected");
    return;
  }

  // Parse the config file and set the current profile data
  if(configOptionsDialog.ParseConfigOptions(currProfile))
  {
    // Display the config dialog in modal format
    configOptionsDialog.ShowModal();

    // If a UI change needs to occur
    if(configOptionsDialog.IsConfigSaved() || 
       configOptionsDialog.IsCustomConfigSelected())
    {
      // Save the existing selected profile name
      wxString oldProfileName = profileListComboBox->GetValue();
      
      // Re-load the config list if a new config was saved
      if(configOptionsDialog.IsConfigSaved())
      {
        // Read in the profiles
        ReadDiskProfiles();
      }

      // If a change in the config was selected, make the current config a "custom" config
      if(configOptionsDialog.IsCustomConfigSelected())
      {
        customProfileUsed = false;

        // Read in the custom profile
        ConfigToken newConfigData;
        if(configOptionsDialog.GetDisplayConfigData(newConfigData))
        {
          // Assign the new custom profile
          customProfileUsed = true;
          customProfile = newConfigData;
        }
      }

      // Update the profile display
      UpdateProfileDisplay();

      // If the custom profile is selected, select the last entry
      if(configOptionsDialog.IsCustomConfigSelected() && profileListComboBox->GetCount() > 0)
      {
        // Re-select the existing profile (or the custom one)
        profileListComboBox->SetSelection(profileListComboBox->GetCount() - 1);
      }
      else
      {
        // Select the old profile name
        profileListComboBox->SetValue(oldProfileName);
      }

      // Update the description
      UpdateProfileDescription();
    }
  }
}