2009-07-28 15:32:10 -06:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-07 22:25:12 -07: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/
|
|
|
|
|
2009-09-13 02:21:35 -06:00
|
|
|
#include <cmath>
|
|
|
|
|
2008-12-07 22:25:12 -07:00
|
|
|
#include "Common.h"
|
|
|
|
#include "IniFile.h"
|
2009-09-13 03:23:30 -06:00
|
|
|
#include "VideoConfig.h"
|
2009-09-13 02:21:35 -06:00
|
|
|
#include "VideoCommon.h"
|
2010-02-02 14:56:29 -07:00
|
|
|
#include "FileUtil.h"
|
2008-12-07 22:25:12 -07:00
|
|
|
|
2009-09-13 04:18:01 -06:00
|
|
|
VideoConfig g_Config;
|
|
|
|
VideoConfig g_ActiveConfig;
|
2009-09-13 02:21:35 -06:00
|
|
|
|
2010-06-04 19:38:22 -06:00
|
|
|
void UpdateActiveConfig()
|
2009-09-13 02:21:35 -06:00
|
|
|
{
|
|
|
|
g_ActiveConfig = g_Config;
|
|
|
|
}
|
2008-12-07 22:25:12 -07:00
|
|
|
|
2009-09-13 04:18:01 -06:00
|
|
|
VideoConfig::VideoConfig()
|
2008-12-07 22:25:12 -07:00
|
|
|
{
|
2009-09-06 09:11:21 -06:00
|
|
|
bRunning = false;
|
2010-11-21 07:47:28 -07:00
|
|
|
|
2010-04-04 16:52:27 -06:00
|
|
|
// Needed for the first frame, I think
|
|
|
|
fAspectRatioHackW = 1;
|
|
|
|
fAspectRatioHackH = 1;
|
2010-11-21 07:47:28 -07:00
|
|
|
|
|
|
|
// disable all features by default
|
|
|
|
backend_info.APIType = API_NONE;
|
|
|
|
backend_info.bAllowSignedBytes = false;
|
|
|
|
backend_info.bUseRGBATextures = false;
|
|
|
|
backend_info.bSupportsEFBToRAM = false;
|
|
|
|
backend_info.bSupportsRealXFB = false;
|
2010-11-24 10:13:12 -07:00
|
|
|
backend_info.bSupports3DVision = false;
|
2008-12-07 22:25:12 -07:00
|
|
|
}
|
|
|
|
|
2009-09-13 04:18:01 -06:00
|
|
|
void VideoConfig::Load(const char *ini_file)
|
2008-12-07 22:25:12 -07:00
|
|
|
{
|
2010-06-04 19:38:22 -06:00
|
|
|
std::string temp;
|
|
|
|
IniFile iniFile;
|
|
|
|
iniFile.Load(ini_file);
|
|
|
|
|
|
|
|
iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false);
|
|
|
|
iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO);
|
|
|
|
iniFile.Get("Settings", "Crop", &bCrop, false);
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Get("Settings", "UseXFB", &bUseXFB, 0);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Get("Settings", "UseRealXFB", &bUseRealXFB, 0);
|
|
|
|
iniFile.Get("Settings", "UseNativeMips", &bUseNativeMips, true);
|
2010-06-04 19:38:22 -06:00
|
|
|
|
|
|
|
iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings
|
First a bugfix:
fixed a misbehavior in the clear code that causes depth clear problems in reference hardware (Intel as example).
add 6 parameters to optimize Safe Texture Cache:
SafeTextureCacheColorSamples, SafeTextureCacheIndexedSamples, SafeTextureCacheTlutSamples:
this 3 parameters gives the number of samples taken to calculate the final hash value, less samples = more speed, more samples = more accuracy
if 0 is specified the hash is calculated using all the data in the texture.
SafeTextureCacheColorMaxSize, SafeTextureCacheIndexedMaxSize, SafeTextureCacheTlutMaxSize:
this parameters limits the amount of data used for the hash calculation, it could appear as redundant but in some games is better to make a full hash of the first bytes instead of some samples of all the texture.
color, indexed, tlut : define the texture type, full color data, indexed, and the tlut memory.
the parameters are available in the config , no GUI at this time, if the test are OK will add it to the GUI.
if someone needs it will give more examples on how to configure the values for specific games.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5116 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-02-23 14:52:12 -07:00
|
|
|
//Safe texture cache params
|
2010-12-20 07:48:46 -07:00
|
|
|
iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,512);
|
|
|
|
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings
|
|
|
|
iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false);
|
|
|
|
iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false);
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0);
|
|
|
|
iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
|
|
|
|
iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0);
|
|
|
|
iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0);
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Get("Settings", "FreeLook", &bFreeLook, 0);
|
2010-09-22 20:17:48 -06:00
|
|
|
iniFile.Get("Settings", "AnaglyphStereo", &bAnaglyphStereo, false);
|
|
|
|
iniFile.Get("Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation, 200);
|
|
|
|
iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0);
|
|
|
|
iniFile.Get("Settings", "EnablePixelLigting", &bEnablePixelLigting, 0);
|
2010-12-19 15:24:19 -07:00
|
|
|
iniFile.Get("Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth, 0);
|
2010-09-22 20:17:48 -06:00
|
|
|
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
|
|
|
|
iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
|
2010-12-22 23:00:17 -07:00
|
|
|
iniFile.Get("Settings", "EFBScale", &iEFBScale, 1); // integral
|
2010-06-09 09:33:01 -06:00
|
|
|
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);
|
|
|
|
|
|
|
|
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);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Get("Settings", "DisableFog", &bDisableFog, 0);
|
2010-06-04 19:38:22 -06:00
|
|
|
|
2010-11-24 10:30:04 -07:00
|
|
|
iniFile.Get("Settings", "EnableOpenCL", &bEnableOpenCL, false);
|
|
|
|
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
|
2010-12-22 23:00:17 -07:00
|
|
|
iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x)
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, "");
|
2010-11-08 15:17:51 -07:00
|
|
|
iniFile.Get("Enhancements", "Enable3dVision", &b3DVision, false);
|
2010-06-04 19:38:22 -06:00
|
|
|
|
2010-08-30 09:33:37 -06:00
|
|
|
iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true);
|
|
|
|
iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false);
|
2010-11-17 20:50:50 -07:00
|
|
|
iniFile.Get("Hacks", "EFBCopyEnable", &bEFBCopyEnable, true);
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, false);
|
|
|
|
iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
|
2010-12-20 07:48:46 -07:00
|
|
|
iniFile.Get("Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable, false);
|
2010-12-27 14:56:20 -07:00
|
|
|
iniFile.Get("Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, true);
|
2010-06-03 12:05:08 -06:00
|
|
|
|
|
|
|
iniFile.Get("Hardware", "Adapter", &iAdapter, 0);
|
2010-06-04 19:38:22 -06:00
|
|
|
if (iAdapter == -1)
|
2009-09-13 02:21:35 -06:00
|
|
|
iAdapter = 0;
|
2010-06-04 19:38:22 -06:00
|
|
|
|
2009-06-04 15:21:07 -06:00
|
|
|
// Load common settings
|
2010-02-02 14:56:29 -07:00
|
|
|
iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
2009-06-04 15:21:07 -06:00
|
|
|
bool bTmp;
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true);
|
2009-06-04 15:21:07 -06:00
|
|
|
SetEnableAlert(bTmp);
|
2008-12-07 22:25:12 -07:00
|
|
|
}
|
|
|
|
|
2009-09-13 04:18:01 -06:00
|
|
|
void VideoConfig::GameIniLoad(const char *ini_file)
|
2009-06-28 10:47:14 -06:00
|
|
|
{
|
2010-06-04 19:38:22 -06:00
|
|
|
IniFile iniFile;
|
|
|
|
iniFile.Load(ini_file);
|
|
|
|
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "ForceFiltering"))
|
2010-06-04 14:03:03 -06:00
|
|
|
iniFile.Get("Video", "ForceFiltering", &bForceFiltering);
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "MaxAnisotropy"))
|
2010-06-04 14:03:03 -06:00
|
|
|
iniFile.Get("Video", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x)
|
2010-11-24 19:19:06 -07:00
|
|
|
if (iniFile.Exists("Video", "EFBCopyEnable"))
|
2010-11-17 20:50:50 -07:00
|
|
|
iniFile.Get("Video", "EFBCopyEnable", &bEFBCopyEnable);
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "EFBCopyDisableHotKey"))
|
2010-06-04 14:03:03 -06:00
|
|
|
iniFile.Get("Video", "EFBCopyDisableHotKey", &bOSDHotKey);
|
2010-12-21 18:05:29 -07:00
|
|
|
if (iniFile.Exists("Video", "EFBAccessEnable"))
|
|
|
|
iniFile.Get("Video", "EFBAccessEnable", &bEFBAccessEnable);
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "EFBToTextureEnable"))
|
2010-07-17 18:18:31 -06:00
|
|
|
iniFile.Get("Video", "EFBToTextureEnable", &bCopyEFBToTexture);
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "EFBScaledCopy"))
|
2010-06-04 14:03:03 -06:00
|
|
|
iniFile.Get("Video", "EFBScaledCopy", &bCopyEFBScaled);
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "SafeTextureCache"))
|
2010-06-04 14:03:03 -06:00
|
|
|
iniFile.Get("Video", "SafeTextureCache", &bSafeTextureCache);
|
First a bugfix:
fixed a misbehavior in the clear code that causes depth clear problems in reference hardware (Intel as example).
add 6 parameters to optimize Safe Texture Cache:
SafeTextureCacheColorSamples, SafeTextureCacheIndexedSamples, SafeTextureCacheTlutSamples:
this 3 parameters gives the number of samples taken to calculate the final hash value, less samples = more speed, more samples = more accuracy
if 0 is specified the hash is calculated using all the data in the texture.
SafeTextureCacheColorMaxSize, SafeTextureCacheIndexedMaxSize, SafeTextureCacheTlutMaxSize:
this parameters limits the amount of data used for the hash calculation, it could appear as redundant but in some games is better to make a full hash of the first bytes instead of some samples of all the texture.
color, indexed, tlut : define the texture type, full color data, indexed, and the tlut memory.
the parameters are available in the config , no GUI at this time, if the test are OK will add it to the GUI.
if someone needs it will give more examples on how to configure the values for specific games.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5116 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-02-23 14:52:12 -07:00
|
|
|
//Safe texture cache params
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "SafeTextureCacheColorSamples"))
|
2010-06-04 14:03:03 -06:00
|
|
|
iniFile.Get("Video", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples);
|
2010-06-03 12:05:08 -06:00
|
|
|
|
|
|
|
if (iniFile.Exists("Video", "MSAA"))
|
2010-06-04 14:03:03 -06:00
|
|
|
iniFile.Get("Video", "MSAA", &iMultisampleMode);
|
2010-06-09 09:33:01 -06:00
|
|
|
if (iniFile.Exists("Video", "EFBScale"))
|
|
|
|
iniFile.Get("Video", "EFBScale", &iEFBScale, 0);
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "DstAlphaPass"))
|
2010-06-04 14:03:03 -06:00
|
|
|
iniFile.Get("Video", "DstAlphaPass", &bDstAlphaPass);
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "UseXFB"))
|
2010-06-04 14:03:03 -06:00
|
|
|
iniFile.Get("Video", "UseXFB", &bUseXFB);
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "UseRealXFB"))
|
2010-06-04 14:03:03 -06:00
|
|
|
iniFile.Get("Video", "UseRealXFB", &bUseRealXFB);
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "ProjectionHack"))
|
2011-01-29 14:13:56 -07:00
|
|
|
iniFile.Get("Video", "ProjectionHack", &iPhackvalue[0], 0);
|
|
|
|
if (iniFile.Exists("Video", "PH_SZNear"))
|
|
|
|
iniFile.Get("Video", "PH_SZNear", &iPhackvalue[1], 0);
|
|
|
|
if (iniFile.Exists("Video", "PH_SZFar"))
|
|
|
|
iniFile.Get("Video", "PH_SZFar", &iPhackvalue[2], 0);
|
|
|
|
if (iniFile.Exists("Video", "PH_ExtraParam"))
|
|
|
|
iniFile.Get("Video", "PH_ExtraParam", &iPhackvalue[3], 0);
|
|
|
|
if (iniFile.Exists("Video", "PH_ZNear"))
|
|
|
|
iniFile.Get("Video", "PH_ZNear", &sPhackvalue[0], "");
|
|
|
|
if (iniFile.Exists("Video", "PH_ZFar"))
|
|
|
|
iniFile.Get("Video", "PH_ZFar", &sPhackvalue[1], "");
|
2010-06-03 12:05:08 -06:00
|
|
|
if (iniFile.Exists("Video", "UseNativeMips"))
|
2010-06-04 14:03:03 -06:00
|
|
|
iniFile.Get("Video", "UseNativeMips", &bUseNativeMips);
|
2010-08-05 20:53:09 -06:00
|
|
|
if (iniFile.Exists("Video", "ZTPSpeedupHack"))
|
|
|
|
iniFile.Get("Video", "ZTPSpeedupHack", &bZTPSpeedHack);
|
2010-09-14 07:50:25 -06:00
|
|
|
if (iniFile.Exists("Video", "DlistCachingEnable"))
|
|
|
|
iniFile.Get("Video", "DlistCachingEnable", &bDlistCachingEnable);
|
2009-03-20 05:51:22 -06:00
|
|
|
}
|
|
|
|
|
2009-09-13 04:18:01 -06:00
|
|
|
void VideoConfig::Save(const char *ini_file)
|
2008-12-07 22:25:12 -07:00
|
|
|
{
|
2010-06-04 19:38:22 -06:00
|
|
|
IniFile iniFile;
|
|
|
|
iniFile.Load(ini_file);
|
|
|
|
iniFile.Set("Hardware", "VSync", bVSync);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Set("Settings", "AspectRatio", iAspectRatio);
|
|
|
|
iniFile.Set("Settings", "Crop", bCrop);
|
|
|
|
iniFile.Set("Settings", "wideScreenHack", bWidescreenHack);
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Set("Settings", "UseXFB", bUseXFB);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Set("Settings", "UseRealXFB", bUseRealXFB);
|
|
|
|
iniFile.Set("Settings", "UseNativeMips", bUseNativeMips);
|
|
|
|
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache);
|
First a bugfix:
fixed a misbehavior in the clear code that causes depth clear problems in reference hardware (Intel as example).
add 6 parameters to optimize Safe Texture Cache:
SafeTextureCacheColorSamples, SafeTextureCacheIndexedSamples, SafeTextureCacheTlutSamples:
this 3 parameters gives the number of samples taken to calculate the final hash value, less samples = more speed, more samples = more accuracy
if 0 is specified the hash is calculated using all the data in the texture.
SafeTextureCacheColorMaxSize, SafeTextureCacheIndexedMaxSize, SafeTextureCacheTlutMaxSize:
this parameters limits the amount of data used for the hash calculation, it could appear as redundant but in some games is better to make a full hash of the first bytes instead of some samples of all the texture.
color, indexed, tlut : define the texture type, full color data, indexed, and the tlut memory.
the parameters are available in the config , no GUI at this time, if the test are OK will add it to the GUI.
if someone needs it will give more examples on how to configure the values for specific games.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5116 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-02-23 14:52:12 -07:00
|
|
|
//safe texture cache params
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Set("Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
|
|
|
|
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Set("Settings", "ShowFPS", bShowFPS);
|
|
|
|
iniFile.Set("Settings", "OverlayStats", bOverlayStats);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Set("Settings", "OverlayProjStats", bOverlayProjStats);
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Set("Settings", "Show", iCompileDLsLevel);
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Set("Settings", "DumpTextures", bDumpTextures);
|
|
|
|
iniFile.Set("Settings", "HiresTextures", bHiresTextures);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Set("Settings", "DumpEFBTarget", bDumpEFBTarget);
|
|
|
|
iniFile.Set("Settings", "DumpFrames", bDumpFrames);
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Set("Settings", "FreeLook", bFreeLook);
|
2010-09-22 20:17:48 -06:00
|
|
|
iniFile.Set("Settings", "AnaglyphStereo", bAnaglyphStereo);
|
|
|
|
iniFile.Set("Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation);
|
|
|
|
iniFile.Set("Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle);
|
|
|
|
iniFile.Set("Settings", "EnablePixelLigting", bEnablePixelLigting);
|
2010-12-19 15:24:19 -07:00
|
|
|
iniFile.Set("Settings", "EnablePerPixelDepth", bEnablePerPixelDepth);
|
|
|
|
|
2010-09-22 20:17:48 -06:00
|
|
|
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors);
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Set("Settings", "MSAA", iMultisampleMode);
|
2010-06-09 09:33:01 -06:00
|
|
|
iniFile.Set("Settings", "EFBScale", iEFBScale);
|
2010-06-04 19:38:22 -06: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);
|
|
|
|
iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Set("Settings", "DisableFog", bDisableFog);
|
2010-11-24 10:30:04 -07:00
|
|
|
|
|
|
|
iniFile.Set("Settings", "EnableOpenCL", bEnableOpenCL);
|
2010-06-04 19:38:22 -06:00
|
|
|
|
|
|
|
iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
|
|
|
|
iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Set("Enhancements", "PostProcessingShader", sPostProcessingShader);
|
2010-11-08 15:17:51 -07:00
|
|
|
iniFile.Set("Enhancements", "Enable3dVision", b3DVision);
|
2010-06-04 19:38:22 -06:00
|
|
|
|
|
|
|
iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable);
|
2010-08-30 09:33:37 -06:00
|
|
|
iniFile.Set("Hacks", "DlistCachingEnable", bDlistCachingEnable);
|
2010-11-17 20:50:50 -07:00
|
|
|
iniFile.Set("Hacks", "EFBCopyEnable", bEFBCopyEnable);
|
2010-06-04 19:38:22 -06:00
|
|
|
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey);
|
2010-07-17 18:18:31 -06:00
|
|
|
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture);
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);
|
2010-12-20 07:48:46 -07:00
|
|
|
iniFile.Set("Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable);
|
2010-12-27 14:56:20 -07:00
|
|
|
iniFile.Set("Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
|
2010-12-20 07:48:46 -07:00
|
|
|
|
2010-06-03 12:05:08 -06:00
|
|
|
iniFile.Set("Hardware", "Adapter", iAdapter);
|
2010-06-04 19:38:22 -06:00
|
|
|
|
|
|
|
iniFile.Save(ini_file);
|
2009-09-13 02:21:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Figure out a better place for this function.
|
|
|
|
void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip, TargetRectangle *rc)
|
|
|
|
{
|
|
|
|
float FloatGLWidth = (float)backbuffer_width;
|
|
|
|
float FloatGLHeight = (float)backbuffer_height;
|
|
|
|
float FloatXOffset = 0;
|
|
|
|
float FloatYOffset = 0;
|
2010-06-04 19:38:22 -06:00
|
|
|
|
2009-09-13 02:21:35 -06:00
|
|
|
// The rendering window size
|
|
|
|
const float WinWidth = FloatGLWidth;
|
|
|
|
const float WinHeight = FloatGLHeight;
|
2010-06-04 19:38:22 -06:00
|
|
|
|
2009-09-13 02:21:35 -06:00
|
|
|
// Handle aspect ratio.
|
2010-01-13 14:11:02 -07:00
|
|
|
// Default to auto.
|
|
|
|
bool use16_9 = g_VideoInitialize.bAutoAspectIs16_9;
|
2010-06-04 19:38:22 -06:00
|
|
|
|
2010-04-04 16:52:27 -06:00
|
|
|
// Update aspect ratio hack values
|
|
|
|
// Won't take effect until next frame
|
|
|
|
// Don't know if there is a better place for this code so there isn't a 1 frame delay
|
|
|
|
if ( g_ActiveConfig.bWidescreenHack )
|
|
|
|
{
|
|
|
|
float source_aspect = use16_9 ? (16.0f / 9.0f) : (4.0f / 3.0f);
|
|
|
|
float target_aspect;
|
2010-06-04 19:38:22 -06:00
|
|
|
|
2010-04-04 16:52:27 -06:00
|
|
|
switch ( g_ActiveConfig.iAspectRatio )
|
|
|
|
{
|
|
|
|
case ASPECT_FORCE_16_9 :
|
|
|
|
target_aspect = 16.0f / 9.0f;
|
|
|
|
break;
|
|
|
|
case ASPECT_FORCE_4_3 :
|
|
|
|
target_aspect = 4.0f / 3.0f;
|
|
|
|
break;
|
|
|
|
case ASPECT_STRETCH :
|
|
|
|
target_aspect = WinWidth / WinHeight;
|
|
|
|
break;
|
|
|
|
default :
|
|
|
|
// ASPECT_AUTO == no hacking
|
|
|
|
target_aspect = source_aspect;
|
|
|
|
break;
|
|
|
|
}
|
2010-06-04 19:38:22 -06:00
|
|
|
|
2010-04-04 16:52:27 -06:00
|
|
|
float adjust = source_aspect / target_aspect;
|
|
|
|
if ( adjust > 1 )
|
|
|
|
{
|
|
|
|
// Vert+
|
|
|
|
g_Config.fAspectRatioHackW = 1;
|
|
|
|
g_Config.fAspectRatioHackH = 1/adjust;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Hor+
|
|
|
|
g_Config.fAspectRatioHackW = adjust;
|
|
|
|
g_Config.fAspectRatioHackH = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Hack is disabled
|
|
|
|
g_Config.fAspectRatioHackW = 1;
|
|
|
|
g_Config.fAspectRatioHackH = 1;
|
|
|
|
}
|
2010-01-13 14:11:02 -07:00
|
|
|
|
|
|
|
// Check for force-settings and override.
|
|
|
|
if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_16_9)
|
|
|
|
use16_9 = true;
|
|
|
|
else if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_4_3)
|
|
|
|
use16_9 = false;
|
2010-06-04 19:38:22 -06:00
|
|
|
|
2010-01-13 14:11:02 -07:00
|
|
|
if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH)
|
2009-09-13 02:21:35 -06:00
|
|
|
{
|
|
|
|
// The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio
|
2010-01-13 14:11:02 -07:00
|
|
|
float Ratio = (WinWidth / WinHeight) / (!use16_9 ? (4.0f / 3.0f) : (16.0f / 9.0f));
|
2009-09-13 11:46:33 -06:00
|
|
|
// Check if height or width is the limiting factor. If ratio > 1 the picture is too wide and have to limit the width.
|
|
|
|
if (Ratio > 1.0f)
|
2009-09-13 02:21:35 -06:00
|
|
|
{
|
|
|
|
// Scale down and center in the X direction.
|
|
|
|
FloatGLWidth /= Ratio;
|
|
|
|
FloatXOffset = (WinWidth - FloatGLWidth) / 2.0f;
|
|
|
|
}
|
|
|
|
// The window is too high, we have to limit the height
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Scale down and center in the Y direction.
|
|
|
|
FloatGLHeight *= Ratio;
|
|
|
|
FloatYOffset = FloatYOffset + (WinHeight - FloatGLHeight) / 2.0f;
|
|
|
|
}
|
|
|
|
}
|
2010-06-04 19:38:22 -06:00
|
|
|
|
2009-09-13 02:21:35 -06:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Crop the picture from 4:3 to 5:4 or from 16:9 to 16:10.
|
|
|
|
// Output: FloatGLWidth, FloatGLHeight, FloatXOffset, FloatYOffset
|
|
|
|
// ------------------
|
2010-01-13 14:11:02 -07:00
|
|
|
if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH && g_ActiveConfig.bCrop)
|
2009-09-13 02:21:35 -06:00
|
|
|
{
|
2010-01-13 14:11:02 -07:00
|
|
|
float Ratio = !use16_9 ? ((4.0f / 3.0f) / (5.0f / 4.0f)) : (((16.0f / 9.0f) / (16.0f / 10.0f)));
|
2009-09-13 02:21:35 -06:00
|
|
|
// The width and height we will add (calculate this before FloatGLWidth and FloatGLHeight is adjusted)
|
|
|
|
float IncreasedWidth = (Ratio - 1.0f) * FloatGLWidth;
|
|
|
|
float IncreasedHeight = (Ratio - 1.0f) * FloatGLHeight;
|
|
|
|
// The new width and height
|
|
|
|
FloatGLWidth = FloatGLWidth * Ratio;
|
|
|
|
FloatGLHeight = FloatGLHeight * Ratio;
|
|
|
|
// Adjust the X and Y offset
|
|
|
|
FloatXOffset = FloatXOffset - (IncreasedWidth * 0.5f);
|
|
|
|
FloatYOffset = FloatYOffset - (IncreasedHeight * 0.5f);
|
|
|
|
}
|
2010-06-04 19:38:22 -06:00
|
|
|
|
2009-09-13 02:21:35 -06:00
|
|
|
int XOffset = (int)(FloatXOffset + 0.5f);
|
|
|
|
int YOffset = (int)(FloatYOffset + 0.5f);
|
2010-02-02 20:52:50 -07:00
|
|
|
int iWhidth = (int)ceil(FloatGLWidth);
|
|
|
|
int iHeight = (int)ceil(FloatGLHeight);
|
2010-02-03 07:13:03 -07:00
|
|
|
iWhidth -= iWhidth % 4; // ensure divisibility by 4 to make it compatible with all the video encoders
|
2010-02-02 20:52:50 -07:00
|
|
|
iHeight -= iHeight % 4;
|
2009-09-13 02:21:35 -06:00
|
|
|
rc->left = XOffset;
|
2010-02-02 20:52:50 -07:00
|
|
|
rc->top = flip ? (int)(YOffset + iHeight) : YOffset;
|
|
|
|
rc->right = XOffset + iWhidth;
|
|
|
|
rc->bottom = flip ? YOffset : (int)(YOffset + iHeight);
|
2008-12-07 22:25:12 -07:00
|
|
|
}
|