2009-04-03 17:35:49 +03:00
|
|
|
// Copyright (C) 2003-2009 Dolphin Project.
|
2008-12-08 07:25:12 +02:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
#include "Globals.h"
|
|
|
|
#include "Common.h"
|
|
|
|
#include "IniFile.h"
|
|
|
|
#include "Config.h"
|
2009-03-20 14:23:05 +02:00
|
|
|
#include "../../../Core/Core/Src/ConfigManager.h" // FIXME
|
2008-12-08 07:25:12 +02:00
|
|
|
|
|
|
|
Config g_Config;
|
|
|
|
|
|
|
|
Config::Config()
|
|
|
|
{
|
|
|
|
memset(this, 0, sizeof(Config));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Config::Load()
|
|
|
|
{
|
|
|
|
std::string temp;
|
|
|
|
IniFile iniFile;
|
|
|
|
iniFile.Load(FULL_CONFIG_DIR "gfx_opengl.ini");
|
|
|
|
|
|
|
|
// get resolution
|
2008-12-21 00:18:52 +02:00
|
|
|
iniFile.Get("Hardware", "WindowedRes", &temp, "640x480");
|
|
|
|
strncpy(iWindowedRes, temp.c_str(), 16);
|
2009-06-06 16:36:33 +03:00
|
|
|
// apply this to the fullscreen resolution too
|
2008-12-21 00:18:52 +02:00
|
|
|
strncpy(iFSResolution, temp.c_str(), 16);
|
|
|
|
|
2008-12-08 07:25:12 +02:00
|
|
|
iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0); // Hardware
|
2009-03-06 01:11:13 +02:00
|
|
|
iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
|
2009-06-07 16:50:57 +03:00
|
|
|
iniFile.Get("Hardware", "RenderToMainframe", &renderToMainframe, false);
|
2009-02-28 18:33:59 +02:00
|
|
|
iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true);
|
2009-02-24 21:16:08 +02:00
|
|
|
iniFile.Get("Settings", "KeepAR_4_3", &bKeepAR43, false);
|
|
|
|
iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false);
|
2009-02-25 07:54:36 +02:00
|
|
|
iniFile.Get("Settings", "Crop", &bCrop, false);
|
2008-12-21 00:18:52 +02:00
|
|
|
iniFile.Get("Settings", "HideCursor", &bHideCursor, false);
|
2009-02-28 18:33:59 +02:00
|
|
|
iniFile.Get("Settings", "UseXFB", &bUseXFB, 0);
|
|
|
|
iniFile.Get("Settings", "AutoScale", &bAutoScale, true);
|
2008-12-21 00:18:52 +02:00
|
|
|
|
2008-12-08 07:25:12 +02:00
|
|
|
iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings
|
|
|
|
iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings
|
2008-12-21 00:18:52 +02:00
|
|
|
iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false);
|
2009-02-15 22:49:59 +02:00
|
|
|
iniFile.Get("Settings", "OverlayBlendStats", &bOverlayBlendStats, false);
|
|
|
|
iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false);
|
2009-03-16 09:54:44 +02:00
|
|
|
iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false);
|
2008-12-08 07:25:12 +02:00
|
|
|
iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0);
|
|
|
|
iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
|
2009-05-07 10:43:56 +03:00
|
|
|
iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0);
|
2009-03-07 11:29:25 +02:00
|
|
|
iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0);
|
2009-03-28 23:07:16 +02:00
|
|
|
iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0);
|
2009-04-19 13:10:45 +03:00
|
|
|
iniFile.Get("Settings", "FreeLook", &bFreeLook, 0);
|
2008-12-08 07:25:12 +02:00
|
|
|
iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
|
2009-03-08 22:04:40 +02:00
|
|
|
iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
|
2009-03-16 07:04:59 +02:00
|
|
|
iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);
|
2008-12-21 00:18:52 +02:00
|
|
|
|
|
|
|
iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
|
|
|
|
iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);
|
|
|
|
iniFile.Get("Settings", "WireFrame", &bWireFrame, 0);
|
|
|
|
iniFile.Get("Settings", "DisableLighting", &bDisableLighting, 0);
|
|
|
|
iniFile.Get("Settings", "DisableTexturing", &bDisableTexturing, 0);
|
2009-04-01 15:31:18 +03:00
|
|
|
iniFile.Get("Settings", "DisableFog", &bDisableFog, 0);
|
2008-12-21 00:18:52 +02:00
|
|
|
|
2008-12-08 07:25:12 +02:00
|
|
|
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
|
|
|
|
iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 3); // NOTE - this is x in (1 << x)
|
2008-12-21 00:18:52 +02:00
|
|
|
|
2009-01-12 00:25:57 +02:00
|
|
|
iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, 0);
|
2009-03-11 00:51:17 +02:00
|
|
|
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0);
|
2009-01-12 17:00:00 +02:00
|
|
|
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToRAM, 0);
|
2009-06-04 02:38:31 +03:00
|
|
|
iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0);
|
2009-06-05 00:21:07 +03:00
|
|
|
|
|
|
|
// Load common settings
|
|
|
|
iniFile.Load(FULL_CONFIG_DIR "Dolphin.ini");
|
|
|
|
bool bTmp;
|
|
|
|
iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true);
|
|
|
|
SetEnableAlert(bTmp);
|
2008-12-08 07:25:12 +02:00
|
|
|
}
|
|
|
|
|
2009-03-20 13:51:22 +02:00
|
|
|
void Config::GameIniLoad() {
|
|
|
|
IniFile *iniFile = ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.gameIni;
|
2009-03-20 17:01:49 +02:00
|
|
|
if (! iniFile)
|
|
|
|
return;
|
|
|
|
|
2009-03-20 13:51:22 +02:00
|
|
|
if (iniFile->Exists("Video", "ForceFiltering"))
|
|
|
|
iniFile->Get("Video", "ForceFiltering", &bForceFiltering, 0);
|
|
|
|
|
|
|
|
if (iniFile->Exists("Video", "MaxAnisotropy"))
|
|
|
|
iniFile->Get("Video", "MaxAnisotropy", &iMaxAnisotropy, 3); // NOTE - this is x in (1 << x)
|
|
|
|
|
|
|
|
if (iniFile->Exists("Video", "EFBCopyDisable"))
|
|
|
|
iniFile->Get("Video", "EFBCopyDisable", &bEFBCopyDisable, 0);
|
|
|
|
|
|
|
|
if (iniFile->Exists("Video", "EFBCopyDisableHotKey"))
|
|
|
|
iniFile->Get("Video", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0);
|
|
|
|
|
|
|
|
if (iniFile->Exists("Video", "EFBToTextureEnable"))
|
|
|
|
iniFile->Get("Video", "EFBToTextureEnable", &bCopyEFBToRAM, 0);
|
2009-03-20 14:36:38 +02:00
|
|
|
|
|
|
|
if (iniFile->Exists("Video", "SafeTextureCache"))
|
|
|
|
iniFile->Get("Video", "SafeTextureCache", &bSafeTextureCache, false);
|
|
|
|
|
|
|
|
if (iniFile->Exists("Video", "MSAA"))
|
|
|
|
iniFile->Get("Video", "MSAA", &iMultisampleMode, 0);
|
|
|
|
|
|
|
|
if (iniFile->Exists("Video", "DstAlphaPass"))
|
|
|
|
iniFile->Get("Video", "DstAlphaPass", &bDstAlphaPass, false);
|
|
|
|
|
|
|
|
if (iniFile->Exists("Video", "UseXFB"))
|
2009-03-22 23:34:06 +02:00
|
|
|
iniFile->Get("Video", "UseXFB", &bUseXFB, 0);
|
2009-03-20 14:36:38 +02:00
|
|
|
|
2009-06-04 02:38:31 +03:00
|
|
|
if (iniFile->Exists("Video", "ProjectionHack"))
|
|
|
|
iniFile->Get("Video", "ProjectionHack", &iPhackvalue, 0);
|
2009-03-20 13:51:22 +02:00
|
|
|
}
|
|
|
|
|
2008-12-08 07:25:12 +02:00
|
|
|
void Config::Save()
|
|
|
|
{
|
|
|
|
IniFile iniFile;
|
|
|
|
iniFile.Load(FULL_CONFIG_DIR "gfx_opengl.ini");
|
|
|
|
iniFile.Set("Hardware", "WindowedRes", iWindowedRes);
|
|
|
|
iniFile.Set("Hardware", "FullscreenRes", iFSResolution);
|
|
|
|
iniFile.Set("Hardware", "Fullscreen", bFullscreen);
|
2009-03-06 01:11:13 +02:00
|
|
|
iniFile.Set("Hardware", "VSync", bVSync);
|
2008-12-21 00:18:52 +02:00
|
|
|
iniFile.Set("Hardware", "RenderToMainframe", renderToMainframe);
|
2009-02-28 18:33:59 +02:00
|
|
|
iniFile.Set("Settings", "StretchToFit", bNativeResolution);
|
2009-02-24 21:16:08 +02:00
|
|
|
iniFile.Set("Settings", "KeepAR_4_3", bKeepAR43);
|
|
|
|
iniFile.Set("Settings", "KeepAR_16_9", bKeepAR169);
|
2009-02-25 07:54:36 +02:00
|
|
|
iniFile.Set("Settings", "Crop", bCrop);
|
2008-12-21 00:18:52 +02:00
|
|
|
iniFile.Set("Settings", "HideCursor", bHideCursor);
|
2009-02-28 18:33:59 +02:00
|
|
|
iniFile.Set("Settings", "UseXFB", bUseXFB);
|
|
|
|
iniFile.Set("Settings", "AutoScale", bAutoScale);
|
2008-12-08 07:25:12 +02:00
|
|
|
|
|
|
|
iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache);
|
|
|
|
iniFile.Set("Settings", "ShowFPS", bShowFPS);
|
2008-12-21 00:18:52 +02:00
|
|
|
iniFile.Set("Settings", "OverlayStats", bOverlayStats);
|
2009-02-15 22:49:59 +02:00
|
|
|
iniFile.Set("Settings", "OverlayBlendStats", bOverlayBlendStats);
|
|
|
|
iniFile.Set("Settings", "OverlayProjStats", bOverlayProjStats);
|
2008-12-08 07:25:12 +02:00
|
|
|
iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel);
|
2009-03-16 09:54:44 +02:00
|
|
|
iniFile.Set("Settings", "Show", iCompileDLsLevel);
|
2008-12-08 07:25:12 +02:00
|
|
|
iniFile.Set("Settings", "DumpTextures", bDumpTextures);
|
2009-05-07 10:43:56 +03:00
|
|
|
iniFile.Set("Settings", "HiresTextures", bHiresTextures);
|
2009-03-07 11:29:25 +02:00
|
|
|
iniFile.Set("Settings", "DumpEFBTarget", bDumpEFBTarget);
|
2009-03-28 23:07:16 +02:00
|
|
|
iniFile.Set("Settings", "DumpFrames", bDumpFrames);
|
2009-04-19 13:10:45 +03:00
|
|
|
iniFile.Set("Settings", "FreeLook", bFreeLook);
|
2009-03-16 09:54:44 +02:00
|
|
|
iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions);
|
2009-03-16 09:56:59 +02:00
|
|
|
iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors);
|
2009-03-08 22:04:40 +02:00
|
|
|
iniFile.Set("Settings", "MSAA", iMultisampleMode);
|
2008-12-21 00:18:52 +02:00
|
|
|
iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable);
|
|
|
|
iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter);
|
|
|
|
iniFile.Set("Settings", "Wireframe", bWireFrame);
|
|
|
|
iniFile.Set("Settings", "DisableLighting", bDisableLighting);
|
|
|
|
iniFile.Set("Settings", "DisableTexturing", bDisableTexturing);
|
2009-03-16 07:04:59 +02:00
|
|
|
iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass);
|
2009-04-01 15:31:18 +03:00
|
|
|
iniFile.Set("Settings", "DisableFog", bDisableFog);
|
2008-12-21 00:18:52 +02:00
|
|
|
|
2008-12-08 07:25:12 +02:00
|
|
|
iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
|
|
|
|
iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy);
|
2008-12-21 00:18:52 +02:00
|
|
|
|
2009-01-12 00:25:57 +02:00
|
|
|
iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable);
|
|
|
|
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bEFBCopyDisableHotKey);
|
2009-01-12 17:00:00 +02:00
|
|
|
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToRAM);
|
2009-06-04 02:38:31 +03:00
|
|
|
iniFile.Set("Hacks", "ProjectionHack", iPhackvalue);
|
2009-02-19 04:58:29 +02:00
|
|
|
|
2008-12-08 07:25:12 +02:00
|
|
|
iniFile.Save(FULL_CONFIG_DIR "gfx_opengl.ini");
|
|
|
|
}
|
2009-03-20 13:51:22 +02:00
|
|
|
|