| 
									
										
										
										
											2009-07-28 21:32:10 +00:00
										 |  |  | // Copyright (C) 2003 Dolphin Project.
 | 
					
						
							| 
									
										
										
										
											2008-12-08 05:25:12 +00: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 08:21:35 +00:00
										 |  |  | #include <cmath>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 |  |  | #include "Common.h"
 | 
					
						
							|  |  |  | #include "IniFile.h"
 | 
					
						
							| 
									
										
										
										
											2009-09-13 09:23:30 +00:00
										 |  |  | #include "VideoConfig.h"
 | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 |  |  | #include "VideoCommon.h"
 | 
					
						
							| 
									
										
										
										
											2010-02-02 21:56:29 +00:00
										 |  |  | #include "FileUtil.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-13 10:18:01 +00:00
										 |  |  | VideoConfig g_Config; | 
					
						
							|  |  |  | VideoConfig g_ActiveConfig; | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | void UpdateActiveConfig() | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	g_ActiveConfig = g_Config; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-13 10:18:01 +00:00
										 |  |  | VideoConfig::VideoConfig() | 
					
						
							| 
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-09-06 15:11:21 +00:00
										 |  |  | 	bRunning = false; | 
					
						
							| 
									
										
										
										
											2010-11-21 14:47:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-04 22:52:27 +00:00
										 |  |  | 	// Needed for the first frame, I think
 | 
					
						
							|  |  |  | 	fAspectRatioHackW = 1; | 
					
						
							|  |  |  | 	fAspectRatioHackH = 1; | 
					
						
							| 
									
										
										
										
											2010-11-21 14:47:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// disable all features by default
 | 
					
						
							|  |  |  | 	backend_info.APIType = API_NONE; | 
					
						
							|  |  |  | 	backend_info.bUseRGBATextures = false; | 
					
						
							| 
									
										
										
										
											2010-11-24 17:13:12 +00:00
										 |  |  | 	backend_info.bSupports3DVision = false; | 
					
						
							| 
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | void VideoConfig::Load(const char *ini_file) | 
					
						
							| 
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	std::string temp; | 
					
						
							|  |  |  | 	IniFile iniFile; | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	iniFile.Load(ini_file); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
 | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "Crop", &bCrop, false); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "UseXFB", &bUseXFB, 0); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "UseRealXFB", &bUseRealXFB, 0); | 
					
						
							| 
									
										
										
										
											2011-12-26 22:04:59 +01:00
										 |  |  | 	iniFile.Get("Settings", "UseNativeMips", &bUseNativeMips, false);	 | 
					
						
							| 
									
										
										
										
											2011-04-30 14:27:35 +00:00
										 |  |  | 	iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,128); | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings
 | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "ShowInputDisplay", &bShowInputDisplay, false); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "FreeLook", &bFreeLook, 0); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "UseFFV1", &bUseFFV1, 0); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "AnaglyphStereo", &bAnaglyphStereo, false); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation, 200); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "EnablePixelLighting", &bEnablePixelLighting, 0); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth, 0); | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0); | 
					
						
							| 
									
										
										
										
											2011-04-30 14:27:35 +00:00
										 |  |  | 	iniFile.Get("Settings", "EFBScale", &iEFBScale, 2); // native
 | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00: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); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "DisableFog", &bDisableFog, 0); | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "EnableOpenCL", &bEnableOpenCL, false); | 
					
						
							|  |  |  | 	iniFile.Get("Settings", "OMPDecoder", &bOMPDecoder, false); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-09 21:34:46 +02:00
										 |  |  | 	iniFile.Get("Settings", "EnableShaderDebugging", &bEnableShaderDebugging, false); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0); | 
					
						
							|  |  |  | 	iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 0);  // NOTE - this is x in (1 << x)
 | 
					
						
							|  |  |  | 	iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, ""); | 
					
						
							|  |  |  | 	iniFile.Get("Enhancements", "Enable3dVision", &b3DVision, false); | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true); | 
					
						
							|  |  |  | 	iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false); | 
					
						
							|  |  |  | 	iniFile.Get("Hacks", "EFBCopyEnable", &bEFBCopyEnable, true); | 
					
						
							|  |  |  | 	iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0); | 
					
						
							| 
									
										
										
										
											2011-04-30 14:27:35 +00:00
										 |  |  | 	iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, true); | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true); | 
					
						
							|  |  |  | 	iniFile.Get("Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable, false); | 
					
						
							| 
									
										
										
										
											2011-04-30 14:27:35 +00:00
										 |  |  | 	iniFile.Get("Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false); | 
					
						
							| 
									
										
										
										
											2010-06-03 18:05:08 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	iniFile.Get("Hardware", "Adapter", &iAdapter, 0); | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-04 21:21:07 +00:00
										 |  |  | 	// Load common settings
 | 
					
						
							| 
									
										
										
										
											2010-02-02 21:56:29 +00:00
										 |  |  | 	iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); | 
					
						
							| 
									
										
										
										
											2009-06-04 21:21:07 +00:00
										 |  |  | 	bool bTmp; | 
					
						
							| 
									
										
										
										
											2010-06-03 18:05:08 +00:00
										 |  |  | 	iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true); | 
					
						
							| 
									
										
										
										
											2009-06-04 21:21:07 +00:00
										 |  |  | 	SetEnableAlert(bTmp); | 
					
						
							| 
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-13 10:18:01 +00:00
										 |  |  | void VideoConfig::GameIniLoad(const char *ini_file) | 
					
						
							| 
									
										
										
										
											2009-06-28 16:47:14 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	IniFile iniFile; | 
					
						
							|  |  |  | 	iniFile.Load(ini_file); | 
					
						
							| 
									
										
										
										
											2011-02-13 22:36:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	iniFile.GetIfExists("Video_Hardware", "VSync", &bVSync); | 
					
						
							| 
									
										
										
											
												- Do not parse numerous video options from the game inis, like:
Show FPS, Input Display, Statistics, Projection Statistics, EFB Copy Regions, Dump Textures, Dump EFB target, Dump Frames, Free Look, Use FFV1, Show Shader Errors, Texture Format Overlay, WireFrame, Hotkeys and Adapter
- Also removed various game ini config values which were still parsed from the Video section.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7489 8ced0084-cf51-0410-be5f-012b33b47a6e
											
										 
											2011-04-29 23:43:37 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	iniFile.GetIfExists("Video_Settings", "wideScreenHack", &bWidescreenHack); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "AspectRatio", &iAspectRatio); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "Crop", &bCrop); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "UseXFB", &bUseXFB); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "UseRealXFB", &bUseRealXFB); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "UseNativeMips", &bUseNativeMips); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "DLOptimize", &iCompileDLsLevel); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "HiresTextures", &bHiresTextures); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "AnaglyphStereo", &bAnaglyphStereo); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "EnablePixelLighting", &bEnablePixelLighting); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "EFBScale", &iEFBScale); // integral
 | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "DstAlphaPass", &bDstAlphaPass); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "DisableLighting", &bDisableLighting); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "DisableTexturing", &bDisableTexturing); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "DisableFog", &bDisableFog); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "EnableOpenCL", &bEnableOpenCL); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Settings", "OMPDecoder", &bOMPDecoder); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Enhancements", "ForceFiltering", &bForceFiltering); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Enhancements", "MaxAnisotropy", &iMaxAnisotropy);  // NOTE - this is x in (1 << x)
 | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Enhancements", "PostProcessingShader", &sPostProcessingShader); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Enhancements", "Enable3dVision", &b3DVision); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Hacks", "EFBAccessEnable", &bEFBAccessEnable); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Hacks", "DlistCachingEnable", &bDlistCachingEnable); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Hacks", "EFBCopyEnable", &bEFBCopyEnable); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Hacks", "EFBToTextureEnable", &bCopyEFBToTexture); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Hacks", "EFBScaledCopy", &bCopyEFBScaled); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video_Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-13 22:36:12 +00:00
										 |  |  | 	iniFile.GetIfExists("Video", "ProjectionHack", &iPhackvalue[0]); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video", "PH_SZNear", &iPhackvalue[1]); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video", "PH_SZFar", &iPhackvalue[2]); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video", "PH_ExtraParam", &iPhackvalue[3]); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video", "PH_ZNear", &sPhackvalue[0]); | 
					
						
							|  |  |  | 	iniFile.GetIfExists("Video", "PH_ZFar", &sPhackvalue[1]); | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	iniFile.GetIfExists("Video", "ZTPSpeedupHack", &bZTPSpeedHack); | 
					
						
							| 
									
										
										
										
											2011-10-26 01:19:10 +01:00
										 |  |  | 	iniFile.GetIfExists("Video", "UseBBox", &bUseBBox); | 
					
						
							| 
									
										
										
										
											2011-02-13 13:42:59 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void VideoConfig::VerifyValidity() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	// TODO: Check iMaxAnisotropy value
 | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	if (iAdapter < 0 || iAdapter > ((int)backend_info.Adapters.size() - 1)) iAdapter = 0; | 
					
						
							| 
									
										
										
										
											2011-02-13 22:36:12 +00:00
										 |  |  | 	if (iMultisampleMode < 0 || iMultisampleMode >= (int)backend_info.AAModes.size()) iMultisampleMode = 0; | 
					
						
							| 
									
										
										
										
											2011-02-13 13:42:59 +00:00
										 |  |  | 	if (!backend_info.bSupports3DVision) b3DVision = false; | 
					
						
							|  |  |  | 	if (!backend_info.bSupportsFormatReinterpretation) bEFBEmulateFormatChanges = false; | 
					
						
							| 
									
										
										
										
											2011-03-19 00:50:34 +00:00
										 |  |  | 	if (!backend_info.bSupportsPixelLighting) bEnablePixelLighting = false; | 
					
						
							| 
									
										
										
										
											2009-03-20 11:51:22 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-13 10:18:01 +00:00
										 |  |  | void VideoConfig::Save(const char *ini_file) | 
					
						
							| 
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	IniFile iniFile; | 
					
						
							|  |  |  | 	iniFile.Load(ini_file); | 
					
						
							|  |  |  | 	iniFile.Set("Hardware", "VSync", bVSync); | 
					
						
							| 
									
										
										
										
											2010-06-03 18:05:08 +00:00
										 |  |  | 	iniFile.Set("Settings", "AspectRatio", iAspectRatio); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "Crop", bCrop); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "wideScreenHack", bWidescreenHack); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	iniFile.Set("Settings", "UseXFB", bUseXFB); | 
					
						
							| 
									
										
										
										
											2010-06-03 18:05:08 +00:00
										 |  |  | 	iniFile.Set("Settings", "UseRealXFB", bUseRealXFB); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "UseNativeMips", bUseNativeMips); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	iniFile.Set("Settings", "ShowFPS", bShowFPS); | 
					
						
							| 
									
										
										
										
											2011-02-17 09:12:36 +00:00
										 |  |  | 	iniFile.Set("Settings", "ShowInputDisplay", bShowInputDisplay); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	iniFile.Set("Settings", "OverlayStats", bOverlayStats); | 
					
						
							| 
									
										
										
										
											2010-06-03 18:05:08 +00:00
										 |  |  | 	iniFile.Set("Settings", "OverlayProjStats", bOverlayProjStats); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel); | 
					
						
							| 
									
										
										
										
											2010-06-03 18:05:08 +00:00
										 |  |  | 	iniFile.Set("Settings", "Show", iCompileDLsLevel); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	iniFile.Set("Settings", "DumpTextures", bDumpTextures); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "HiresTextures", bHiresTextures); | 
					
						
							| 
									
										
										
										
											2010-06-03 18:05:08 +00:00
										 |  |  | 	iniFile.Set("Settings", "DumpEFBTarget", bDumpEFBTarget); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "DumpFrames", bDumpFrames); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	iniFile.Set("Settings", "FreeLook", bFreeLook); | 
					
						
							| 
									
										
										
										
											2011-02-11 22:09:20 +00:00
										 |  |  | 	iniFile.Set("Settings", "UseFFV1", bUseFFV1); | 
					
						
							| 
									
										
										
										
											2010-09-23 02:17:48 +00:00
										 |  |  | 	iniFile.Set("Settings", "AnaglyphStereo", bAnaglyphStereo); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle); | 
					
						
							| 
									
										
										
										
											2011-03-23 02:06:40 +00:00
										 |  |  | 	iniFile.Set("Settings", "EnablePixelLighting", bEnablePixelLighting); | 
					
						
							| 
									
										
										
										
											2010-12-19 22:24:19 +00:00
										 |  |  | 	iniFile.Set("Settings", "EnablePerPixelDepth", bEnablePerPixelDepth); | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-09-23 02:17:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "MSAA", iMultisampleMode); | 
					
						
							| 
									
										
										
										
											2010-06-09 15:33:01 +00:00
										 |  |  | 	iniFile.Set("Settings", "EFBScale", iEFBScale); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter); | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	iniFile.Set("Settings", "Wireframe", bWireFrame); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	iniFile.Set("Settings", "DisableLighting", bDisableLighting); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "DisableTexturing", bDisableTexturing); | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass); | 
					
						
							| 
									
										
										
										
											2010-06-03 18:05:08 +00:00
										 |  |  | 	iniFile.Set("Settings", "DisableFog", bDisableFog); | 
					
						
							| 
									
										
										
										
											2010-11-24 17:30:04 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	iniFile.Set("Settings", "EnableOpenCL", bEnableOpenCL); | 
					
						
							| 
									
										
										
										
											2011-03-19 01:55:57 +00:00
										 |  |  | 	iniFile.Set("Settings", "OMPDecoder", bOMPDecoder); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2011-09-09 21:34:46 +02:00
										 |  |  | 	iniFile.Set("Settings", "EnableShaderDebugging", bEnableShaderDebugging); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering); | 
					
						
							|  |  |  | 	iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy); | 
					
						
							| 
									
										
										
										
											2010-06-03 18:05:08 +00:00
										 |  |  | 	iniFile.Set("Enhancements", "PostProcessingShader", sPostProcessingShader); | 
					
						
							| 
									
										
										
										
											2010-11-08 22:17:51 +00:00
										 |  |  | 	iniFile.Set("Enhancements", "Enable3dVision", b3DVision); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable); | 
					
						
							| 
									
										
										
										
											2010-08-30 15:33:37 +00:00
										 |  |  | 	iniFile.Set("Hacks", "DlistCachingEnable", bDlistCachingEnable); | 
					
						
							| 
									
										
										
										
											2010-11-18 03:50:50 +00:00
										 |  |  | 	iniFile.Set("Hacks", "EFBCopyEnable", bEFBCopyEnable); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey); | 
					
						
							| 
									
										
										
										
											2010-07-18 00:18:31 +00:00
										 |  |  | 	iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture);	 | 
					
						
							| 
									
										
										
										
											2010-06-03 18:05:08 +00:00
										 |  |  | 	iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled); | 
					
						
							| 
									
										
										
										
											2010-12-20 14:48:46 +00:00
										 |  |  | 	iniFile.Set("Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable); | 
					
						
							| 
									
										
										
										
											2010-12-27 21:56:20 +00:00
										 |  |  | 	iniFile.Set("Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges); | 
					
						
							| 
									
										
										
										
											2010-12-20 14:48:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-03 18:05:08 +00:00
										 |  |  | 	iniFile.Set("Hardware", "Adapter", iAdapter); | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	iniFile.Save(ini_file); | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-21 19:57:31 +00:00
										 |  |  | void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini) | 
					
						
							| 
									
										
										
										
											2011-02-13 22:36:12 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	// wxWidgets doesn't provide us with a nice way to change 3-state checkboxes into 2-state ones
 | 
					
						
							|  |  |  | 	// This would allow us to make the "default config" dialog layout to be 2-state based, but the
 | 
					
						
							|  |  |  | 	// "game config" layout to be 3-state based (with the 3rd state being "use default")
 | 
					
						
							|  |  |  | 	// Since we can't do that, we instead just save anything which differs from the default config
 | 
					
						
							|  |  |  | 	// TODO: Make this less ugly
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	VideoConfig defCfg; | 
					
						
							|  |  |  | 	defCfg.Load(default_ini); | 
					
						
							| 
									
										
										
										
											2011-02-13 22:36:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-21 19:57:31 +00:00
										 |  |  | 	IniFile iniFile; | 
					
						
							|  |  |  | 	iniFile.Load(game_ini); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	#define SET_IF_DIFFERS(section, key, member) { if ((member) != (defCfg.member)) iniFile.Set((section), (key), (member)); else iniFile.DeleteKey((section), (key)); }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Hardware", "VSync", bVSync); | 
					
						
							| 
									
										
										
											
												- Do not parse numerous video options from the game inis, like:
Show FPS, Input Display, Statistics, Projection Statistics, EFB Copy Regions, Dump Textures, Dump EFB target, Dump Frames, Free Look, Use FFV1, Show Shader Errors, Texture Format Overlay, WireFrame, Hotkeys and Adapter
- Also removed various game ini config values which were still parsed from the Video section.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7489 8ced0084-cf51-0410-be5f-012b33b47a6e
											
										 
											2011-04-29 23:43:37 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-25 20:06:45 +00:00
										 |  |  | 	SET_IF_DIFFERS("Video_Settings", "wideScreenHack", bWidescreenHack); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "AspectRatio", iAspectRatio); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "Crop", bCrop); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "UseXFB", bUseXFB); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "UseRealXFB", bUseRealXFB); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "UseNativeMips", bUseNativeMips); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "DLOptimize", iCompileDLsLevel); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "HiresTextures", bHiresTextures); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "AnaglyphStereo", bAnaglyphStereo); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "EnablePixelLighting", bEnablePixelLighting); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "EnablePerPixelDepth", bEnablePerPixelDepth); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "MSAA", iMultisampleMode); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "EFBScale", iEFBScale); // integral
 | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "DstAlphaPass", bDstAlphaPass); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "DisableLighting", bDisableLighting); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "DisableTexturing", bDisableTexturing); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "DisableFog", bDisableFog); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "EnableOpenCL", bEnableOpenCL); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Settings", "OMPDecoder", bOMPDecoder); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Enhancements", "ForceFiltering", bForceFiltering); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy);  // NOTE - this is x in (1 << x)
 | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Enhancements", "PostProcessingShader", sPostProcessingShader); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Enhancements", "Enable3dVision", b3DVision); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Hacks", "DlistCachingEnable", bDlistCachingEnable); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Hacks", "EFBCopyEnable", bEFBCopyEnable); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Hacks", "EFBToTextureEnable", bCopyEFBToTexture); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable); | 
					
						
							|  |  |  | 	SET_IF_DIFFERS("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-21 19:57:31 +00:00
										 |  |  | 	iniFile.Save(game_ini); | 
					
						
							| 
									
										
										
										
											2011-02-13 22:36:12 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-31 01:28:32 +00:00
										 |  |  | // TODO: remove
 | 
					
						
							|  |  |  | extern bool g_aspect_wide; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00: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-05 01:38:22 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 |  |  | 	// The rendering window size
 | 
					
						
							|  |  |  | 	const float WinWidth = FloatGLWidth; | 
					
						
							|  |  |  | 	const float WinHeight = FloatGLHeight; | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 |  |  | 	// Handle aspect ratio.
 | 
					
						
							| 
									
										
										
										
											2010-01-13 21:11:02 +00:00
										 |  |  | 	// Default to auto.
 | 
					
						
							| 
									
										
										
										
											2011-01-31 01:28:32 +00:00
										 |  |  | 	bool use16_9 = g_aspect_wide; | 
					
						
							| 
									
										
										
										
											2010-06-05 01:38:22 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-04-04 22:52:27 +00: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-05 01:38:22 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2010-04-04 22:52:27 +00: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-05 01:38:22 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2010-04-04 22:52:27 +00: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 21:11:02 +00: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-05 01:38:22 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-01-13 21:11:02 +00:00
										 |  |  | 	if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH) | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		// The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio
 | 
					
						
							| 
									
										
										
										
											2010-01-13 21:11:02 +00:00
										 |  |  | 		float Ratio = (WinWidth / WinHeight) / (!use16_9 ? (4.0f / 3.0f) : (16.0f / 9.0f)); | 
					
						
							| 
									
										
										
										
											2009-09-13 17:46:33 +00: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 08:21:35 +00: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-05 01:38:22 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00: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 21:11:02 +00:00
										 |  |  | 	if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH && g_ActiveConfig.bCrop) | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2010-01-13 21:11:02 +00:00
										 |  |  | 		float Ratio = !use16_9 ? ((4.0f / 3.0f) / (5.0f / 4.0f)) : (((16.0f / 9.0f) / (16.0f / 10.0f))); | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00: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-05 01:38:22 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 |  |  | 	int XOffset = (int)(FloatXOffset + 0.5f); | 
					
						
							|  |  |  | 	int YOffset = (int)(FloatYOffset + 0.5f); | 
					
						
							| 
									
										
										
										
											2010-02-03 03:52:50 +00:00
										 |  |  | 	int iWhidth = (int)ceil(FloatGLWidth); | 
					
						
							|  |  |  | 	int iHeight = (int)ceil(FloatGLHeight); | 
					
						
							| 
									
										
										
										
											2010-02-03 14:13:03 +00:00
										 |  |  | 	iWhidth -= iWhidth % 4; // ensure divisibility by 4 to make it compatible with all the video encoders
 | 
					
						
							| 
									
										
										
										
											2010-02-03 03:52:50 +00:00
										 |  |  | 	iHeight -= iHeight % 4; | 
					
						
							| 
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 |  |  | 	rc->left = XOffset; | 
					
						
							| 
									
										
										
										
											2010-02-03 03:52:50 +00:00
										 |  |  | 	rc->top = flip ? (int)(YOffset + iHeight) : YOffset; | 
					
						
							|  |  |  | 	rc->right = XOffset + iWhidth; | 
					
						
							|  |  |  | 	rc->bottom = flip ? YOffset : (int)(YOffset + iHeight); | 
					
						
							| 
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 |  |  | } |