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;
|
2009-09-13 21:18:04 +00:00
|
|
|
bAllowSignedBytes = !IsD3D();
|
2010-06-05 01:38:22 +00:00
|
|
|
|
2010-04-04 22:52:27 +00:00
|
|
|
// Needed for the first frame, I think
|
|
|
|
fAspectRatioHackW = 1;
|
|
|
|
fAspectRatioHackH = 1;
|
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
|
|
|
{
|
2010-06-05 01:38:22 +00:00
|
|
|
std::string temp;
|
|
|
|
IniFile iniFile;
|
|
|
|
iniFile.Load(ini_file);
|
|
|
|
|
|
|
|
iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
|
|
|
|
iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Get("Settings", "2xResolution", &b2xResolution, false);
|
|
|
|
iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false);
|
|
|
|
iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO);
|
|
|
|
iniFile.Get("Settings", "Crop", &bCrop, false);
|
2010-06-05 01:38:22 +00:00
|
|
|
iniFile.Get("Settings", "UseXFB", &bUseXFB, 0);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Get("Settings", "UseRealXFB", &bUseRealXFB, 0);
|
2010-06-05 01:38:22 +00:00
|
|
|
iniFile.Get("Settings", "AutoScale", &bAutoScale, true);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Get("Settings", "UseNativeMips", &bUseNativeMips, true);
|
2010-06-05 01:38:22 +00:00
|
|
|
|
|
|
|
iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings
|
First a bugfix:
fixed a misbehavior in the clear code that causes depth clear problems in reference hardware (Intel as example).
add 6 parameters to optimize Safe Texture Cache:
SafeTextureCacheColorSamples, SafeTextureCacheIndexedSamples, SafeTextureCacheTlutSamples:
this 3 parameters gives the number of samples taken to calculate the final hash value, less samples = more speed, more samples = more accuracy
if 0 is specified the hash is calculated using all the data in the texture.
SafeTextureCacheColorMaxSize, SafeTextureCacheIndexedMaxSize, SafeTextureCacheTlutMaxSize:
this parameters limits the amount of data used for the hash calculation, it could appear as redundant but in some games is better to make a full hash of the first bytes instead of some samples of all the texture.
color, indexed, tlut : define the texture type, full color data, indexed, and the tlut memory.
the parameters are available in the config , no GUI at this time, if the test are OK will add it to the GUI.
if someone needs it will give more examples on how to configure the values for specific games.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5116 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-02-23 21:52:12 +00:00
|
|
|
//Safe texture cache params
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,512);
|
2010-06-05 01:38:22 +00:00
|
|
|
|
|
|
|
iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings
|
|
|
|
iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false);
|
|
|
|
iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false);
|
2010-06-05 01:38:22 +00:00
|
|
|
iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0);
|
|
|
|
iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
|
|
|
|
iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0);
|
|
|
|
iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0);
|
2010-06-05 01:38:22 +00:00
|
|
|
iniFile.Get("Settings", "FreeLook", &bFreeLook, 0);
|
|
|
|
iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
|
|
|
|
iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
|
2010-06-09 15:33:01 +00:00
|
|
|
iniFile.Get("Settings", "EFBScale", &iEFBScale, 0);
|
|
|
|
|
2010-06-05 01:38:22 +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);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Get("Settings", "DisableFog", &bDisableFog, 0);
|
2010-06-05 01:38:22 +00:00
|
|
|
|
|
|
|
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
|
|
|
|
iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 1); // NOTE - this is x in (1 << x)
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, "");
|
2010-06-05 01:38:22 +00:00
|
|
|
|
|
|
|
iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true);
|
|
|
|
iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, false);
|
|
|
|
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, false);
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
iniFile.Get("Hacks", "EFBVerifyTextureModificationsByCPU",&bVerifyTextureModificationsByCPU,false);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
|
|
|
|
iniFile.Get("Hacks", "FIFOBPHack", &bFIFOBPhack, false);
|
|
|
|
iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0);
|
|
|
|
|
|
|
|
iniFile.Get("Hardware", "Adapter", &iAdapter, 0);
|
2010-06-05 01:38:22 +00:00
|
|
|
if (iAdapter == -1)
|
2009-09-13 08:21:35 +00:00
|
|
|
iAdapter = 0;
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Get("Hardware", "SimpleFB", &bSimpleFB, false);
|
2010-06-05 01:38:22 +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);
|
2010-06-22 13:17:01 +00:00
|
|
|
iniFile.Get("Core", "EnableOpenCL", &bEnableOpenCL, false);
|
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);
|
|
|
|
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "ForceFiltering"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "ForceFiltering", &bForceFiltering);
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "MaxAnisotropy"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x)
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "EFBCopyDisable"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "EFBCopyDisable", &bEFBCopyDisable);
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "EFBCopyDisableHotKey"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "EFBCopyDisableHotKey", &bOSDHotKey);
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "EFBToTextureEnable"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "EFBToTextureEnable", &bCopyEFBToTexture);
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
if (iniFile.Exists("Video", "EFBVerifyTextureModificationsByCPU"))
|
|
|
|
iniFile.Get("Video", "EFBVerifyTextureModificationsByCPU", &bVerifyTextureModificationsByCPU);
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "EFBScaledCopy"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "EFBScaledCopy", &bCopyEFBScaled);
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "SafeTextureCache"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "SafeTextureCache", &bSafeTextureCache);
|
First a bugfix:
fixed a misbehavior in the clear code that causes depth clear problems in reference hardware (Intel as example).
add 6 parameters to optimize Safe Texture Cache:
SafeTextureCacheColorSamples, SafeTextureCacheIndexedSamples, SafeTextureCacheTlutSamples:
this 3 parameters gives the number of samples taken to calculate the final hash value, less samples = more speed, more samples = more accuracy
if 0 is specified the hash is calculated using all the data in the texture.
SafeTextureCacheColorMaxSize, SafeTextureCacheIndexedMaxSize, SafeTextureCacheTlutMaxSize:
this parameters limits the amount of data used for the hash calculation, it could appear as redundant but in some games is better to make a full hash of the first bytes instead of some samples of all the texture.
color, indexed, tlut : define the texture type, full color data, indexed, and the tlut memory.
the parameters are available in the config , no GUI at this time, if the test are OK will add it to the GUI.
if someone needs it will give more examples on how to configure the values for specific games.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5116 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-02-23 21:52:12 +00:00
|
|
|
//Safe texture cache params
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "SafeTextureCacheColorSamples"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples);
|
2010-06-03 18:05:08 +00:00
|
|
|
|
|
|
|
if (iniFile.Exists("Video", "MSAA"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "MSAA", &iMultisampleMode);
|
2010-06-09 15:33:01 +00:00
|
|
|
if (iniFile.Exists("Video", "EFBScale"))
|
|
|
|
iniFile.Get("Video", "EFBScale", &iEFBScale, 0);
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "DstAlphaPass"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "DstAlphaPass", &bDstAlphaPass);
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "UseXFB"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "UseXFB", &bUseXFB);
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "UseRealXFB"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "UseRealXFB", &bUseRealXFB);
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "FIFOBPHack"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "FIFOBPHack", &bFIFOBPhack);
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "ProjectionHack"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "ProjectionHack", &iPhackvalue);
|
2010-06-03 18:05:08 +00:00
|
|
|
if (iniFile.Exists("Video", "UseNativeMips"))
|
2010-06-04 20:03:03 +00:00
|
|
|
iniFile.Get("Video", "UseNativeMips", &bUseNativeMips);
|
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);
|
|
|
|
iniFile.Set("Settings", "StretchToFit", bNativeResolution);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Set("Settings", "2xResolution", b2xResolution);
|
|
|
|
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);
|
2010-06-05 01:38:22 +00:00
|
|
|
iniFile.Set("Settings", "AutoScale", bAutoScale);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Set("Settings", "UseNativeMips", bUseNativeMips);
|
|
|
|
|
2010-06-05 01:38:22 +00:00
|
|
|
iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache);
|
First a bugfix:
fixed a misbehavior in the clear code that causes depth clear problems in reference hardware (Intel as example).
add 6 parameters to optimize Safe Texture Cache:
SafeTextureCacheColorSamples, SafeTextureCacheIndexedSamples, SafeTextureCacheTlutSamples:
this 3 parameters gives the number of samples taken to calculate the final hash value, less samples = more speed, more samples = more accuracy
if 0 is specified the hash is calculated using all the data in the texture.
SafeTextureCacheColorMaxSize, SafeTextureCacheIndexedMaxSize, SafeTextureCacheTlutMaxSize:
this parameters limits the amount of data used for the hash calculation, it could appear as redundant but in some games is better to make a full hash of the first bytes instead of some samples of all the texture.
color, indexed, tlut : define the texture type, full color data, indexed, and the tlut memory.
the parameters are available in the config , no GUI at this time, if the test are OK will add it to the GUI.
if someone needs it will give more examples on how to configure the values for specific games.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5116 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-02-23 21:52:12 +00:00
|
|
|
//safe texture cache params
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Set("Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
|
|
|
|
|
2010-06-05 01:38:22 +00:00
|
|
|
iniFile.Set("Settings", "ShowFPS", bShowFPS);
|
|
|
|
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);
|
|
|
|
iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors);
|
2010-06-05 01:38:22 +00:00
|
|
|
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);
|
|
|
|
iniFile.Set("Settings", "Wireframe", bWireFrame);
|
|
|
|
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-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-06-05 01:38:22 +00:00
|
|
|
|
|
|
|
iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable);
|
|
|
|
iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable);
|
|
|
|
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture);
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
iniFile.Set("Hacks", "EFBVerifyTextureModificationsByCPU", bVerifyTextureModificationsByCPU);
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);
|
|
|
|
iniFile.Set("Hacks", "FIFOBPHack", bFIFOBPhack);
|
|
|
|
iniFile.Set("Hacks", "ProjectionHack", iPhackvalue);
|
2010-06-05 01:38:22 +00:00
|
|
|
|
2010-06-03 18:05:08 +00:00
|
|
|
iniFile.Set("Hardware", "Adapter", iAdapter);
|
|
|
|
iniFile.Set("Hardware", "SimpleFB", bSimpleFB);
|
2010-06-05 01:38:22 +00:00
|
|
|
|
|
|
|
iniFile.Save(ini_file);
|
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.
|
|
|
|
bool use16_9 = g_VideoInitialize.bAutoAspectIs16_9;
|
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
|
|
|
}
|