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"
							 | 
						
					
						
							
								
									
										
										
										
											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
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void UpdateActiveConfig() 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									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;
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 21:18:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bAllowSignedBytes = !IsD3D();
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 10:18:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void VideoConfig::Load(const char *ini_file)
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    std::string temp;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    IniFile iniFile;
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Load(ini_file);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// get resolution
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Hardware", "WindowedRes", &temp, "640x480");
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    strncpy(cInternalRes, temp.c_str(), 16);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-13 09:24:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Hardware", "FullscreenRes", &temp, "640x480");
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    strncpy(cFSResolution, temp.c_str(), 16);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0); // Hardware
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-05 23:11:13 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-06 13:36:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Hardware", "RenderToMainframe", &RenderToMainframe, false);
							 | 
						
					
						
							
								
									
										
										
										
											2009-02-28 16:33:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-05 05:42:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Settings", "2xResolution", &b2xResolution, false);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-02 21:30:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-23 05:48:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Settings", "KeepAR_4_3", &bKeepAR43, true);
							 | 
						
					
						
							
								
									
										
										
										
											2009-02-24 19:16:08 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false);
							 | 
						
					
						
							
								
									
										
										
										
											2009-02-25 05:54:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Settings", "Crop", &bCrop, false);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "HideCursor", &bHideCursor, false);
							 | 
						
					
						
							
								
									
										
										
										
											2009-02-28 16:33:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "UseXFB", &bUseXFB, 0);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "AutoScale", &bAutoScale, true);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false);
							 | 
						
					
						
							
								
									
										
										
										
											2009-02-15 20:49:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-16 07:54:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-05-07 07:43:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-07 09:29:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-28 21:07:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-04-19 10:10:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "FreeLook", &bFreeLook, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-08 20:04:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-16 05:04:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00: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 12:31:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Settings", "DisableFog", &bDisableFog, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-23 05:48:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 1);  // NOTE - this is x in (1 << x)
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-08 19:42:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, "");
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 19:54:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true);
							 | 
						
					
						
							
								
									
										
										
										
											2009-01-11 22:25:57 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-22 19:13:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-23 05:48:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToRAM, true);
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-15 01:40:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-03 23:38:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-04 21:21:07 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Hardware", "Adapter", &iAdapter, 0);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									if (iAdapter == -1) 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										iAdapter = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 17:46:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Hardware", "SimpleFB", &bSimpleFB, false);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-04 21:21:07 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// Load common settings
							 | 
						
					
						
							
								
									
										
										
										
											2009-07-28 08:27:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Load(CONFIG_FILE);
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-04 21:21:07 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool bTmp;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									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
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 08:54:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    IniFile iniFile;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    iniFile.Load(ini_file);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-15 08:13:45 +00: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"))
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-22 19:13:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										iniFile.Get("Video", "EFBCopyDisableHotKey", &bOSDHotKey, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-15 08:13:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if (iniFile.Exists("Video", "EFBToRAMEnable"))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										iniFile.Get("Video", "EFBToRAMEnable", &bCopyEFBToRAM, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-15 01:40:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if (iniFile.Exists("Video", "EFBScaledCopy"))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										iniFile.Get("Video", "EFBScaledCopy", &bCopyEFBScaled, 0);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-15 08:13:45 +00: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"))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										iniFile.Get("Video", "UseXFB", &bUseXFB, 0);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									if (iniFile.Exists("Video", "ProjectionHack"))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										iniFile.Get("Video", "ProjectionHack", &iPhackvalue, 0);
							 | 
						
					
						
							
								
									
										
										
										
											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
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    IniFile iniFile;
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Load(ini_file);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Hardware", "WindowedRes", cInternalRes);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Hardware", "FullscreenRes", cFSResolution);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Hardware", "Fullscreen", bFullscreen);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-05 23:11:13 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Hardware", "VSync", bVSync);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-06 13:36:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Hardware", "RenderToMainframe", RenderToMainframe);
							 | 
						
					
						
							
								
									
										
										
										
											2009-02-28 16:33:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "StretchToFit", bNativeResolution);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-05 05:42:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Settings", "2xResolution", b2xResolution);
							 | 
						
					
						
							
								
									
										
										
										
											2009-02-24 19:16:08 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "KeepAR_4_3", bKeepAR43);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Settings", "KeepAR_16_9", bKeepAR169);
							 | 
						
					
						
							
								
									
										
										
										
											2009-02-25 05:54:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Settings", "Crop", bCrop);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-02 21:30:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Settings", "wideScreenHack", bWidescreenHack);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "HideCursor", bHideCursor);
							 | 
						
					
						
							
								
									
										
										
										
											2009-02-28 16:33:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "UseXFB", bUseXFB);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "AutoScale", bAutoScale);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "ShowFPS", bShowFPS);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "OverlayStats", bOverlayStats);
							 | 
						
					
						
							
								
									
										
										
										
											2009-02-15 20:49:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Settings", "OverlayProjStats", bOverlayProjStats);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-16 07:54:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Settings", "Show", iCompileDLsLevel);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "DumpTextures", bDumpTextures);
							 | 
						
					
						
							
								
									
										
										
										
											2009-05-07 07:43:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "HiresTextures", bHiresTextures);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-07 09:29:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Settings", "DumpEFBTarget", bDumpEFBTarget);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-28 21:07:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Settings", "DumpFrames", bDumpFrames);
							 | 
						
					
						
							
								
									
										
										
										
											2009-04-19 10:10:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "FreeLook", bFreeLook);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-16 07:54:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-16 07:56:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors);
							 | 
						
					
						
							
								
									
										
										
										
											2009-03-08 20:04:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "MSAA", iMultisampleMode);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00: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 05:04:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass);
							 | 
						
					
						
							
								
									
										
										
										
											2009-04-01 12:31:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Settings", "DisableFog", bDisableFog);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy);
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-08 19:42:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Enhancements", "PostProcessingShader", sPostProcessingShader);
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-20 22:18:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-08 21:59:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable);
							 | 
						
					
						
							
								
									
										
										
										
											2009-01-11 22:25:57 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-22 19:13:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey);
							 | 
						
					
						
							
								
									
										
										
										
											2009-01-12 15:00:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToRAM);
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-15 01:40:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-03 23:38:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Hacks", "ProjectionHack", iPhackvalue);
							 | 
						
					
						
							
								
									
										
										
										
											2009-02-19 02:58:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Hardware", "Adapter", iAdapter);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 17:46:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									iniFile.Set("Hardware", "SimpleFB", bSimpleFB);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-13 08:21:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    iniFile.Save(ini_file);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// 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;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// The rendering window size
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const float WinWidth = FloatGLWidth;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const float WinHeight = FloatGLHeight;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// Handle aspect ratio.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									if (g_ActiveConfig.bKeepAR43 || g_ActiveConfig.bKeepAR169)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										// The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										float Ratio = (WinWidth / WinHeight) / (g_Config.bKeepAR43 ? (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;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// -----------------------------------------------------------------------
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// Crop the picture from 4:3 to 5:4 or from 16:9 to 16:10.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									//		Output: FloatGLWidth, FloatGLHeight, FloatXOffset, FloatYOffset
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// ------------------
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									if ((g_ActiveConfig.bKeepAR43 || g_ActiveConfig.bKeepAR169) && g_ActiveConfig.bCrop)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										float Ratio = g_Config.bKeepAR43 ? ((4.0f / 3.0f) / (5.0f / 4.0f)) : (((16.0f / 9.0f) / (16.0f / 10.0f)));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										// 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);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int XOffset = (int)(FloatXOffset + 0.5f);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int YOffset = (int)(FloatYOffset + 0.5f);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									rc->left = XOffset;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									rc->top = flip ? (int)(YOffset + ceil(FloatGLHeight)) : YOffset;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									rc->right = XOffset + (int)ceil(FloatGLWidth);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									rc->bottom = flip ? YOffset : (int)(YOffset + ceil(FloatGLHeight));
							 | 
						
					
						
							
								
									
										
										
										
											2008-12-08 05:25:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 |