diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index caf658884a..a023099ad1 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -63,12 +63,8 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings //Safe texture cache params - iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,37); - iniFile.Get("Settings", "SafeTextureCacheIndexedSamples", &iSafeTextureCache_IndexedSamples,0); - iniFile.Get("Settings", "SafeTextureCacheTlutSamples", &iSafeTextureCache_TlutSamples,0); - iniFile.Get("Settings", "SafeTextureCacheColorMaxSize", &iSafeTextureCache_ColorMaxSize,0); - iniFile.Get("Settings", "SafeTextureCacheIndexedMaxSize", &iSafeTextureCache_IndexedMaxSize,0); - iniFile.Get("Settings", "SafeTextureCacheTlutMaxSize", &iSafeTextureCache_TlutMaxSize,0); + iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,37); + iniFile.Get("Settings", "SafeTextureCacheTlutMaxSize", &iSafeTextureCache_TlutMaxSize,1024); iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false); @@ -137,16 +133,8 @@ void VideoConfig::GameIniLoad(const char *ini_file) //Safe texture cache params if (iniFile.Exists("Video", "SafeTextureCacheColorSamples")) iniFile.Get("Video", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,37); - if (iniFile.Exists("Video", "SafeTextureCacheIndexedSamples")) - iniFile.Get("Video", "SafeTextureCacheIndexedSamples", &iSafeTextureCache_IndexedSamples,0); - if (iniFile.Exists("Video", "SafeTextureCacheTlutSamples")) - iniFile.Get("Video", "SafeTextureCacheTlutSamples", &iSafeTextureCache_TlutSamples,0); - if (iniFile.Exists("Video", "SafeTextureCacheColorMaxSize")) - iniFile.Get("Video", "SafeTextureCacheColorMaxSize", &iSafeTextureCache_ColorMaxSize,0); - if (iniFile.Exists("Video", "SafeTextureCacheIndexedMaxSize")) - iniFile.Get("Video", "SafeTextureCacheIndexedMaxSize", &iSafeTextureCache_IndexedMaxSize,0); if (iniFile.Exists("Video", "SafeTextureCacheTlutMaxSize")) - iniFile.Get("Video", "SafeTextureCacheTlutMaxSize", &iSafeTextureCache_TlutMaxSize,0); + iniFile.Get("Video", "SafeTextureCacheTlutMaxSize", &iSafeTextureCache_TlutMaxSize,1024); if (iniFile.Exists("Video", "MSAA")) iniFile.Get("Video", "MSAA", &iMultisampleMode, 0); @@ -181,10 +169,6 @@ void VideoConfig::Save(const char *ini_file) iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache); //safe texture cache params iniFile.Set("Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples); - iniFile.Set("Settings", "SafeTextureCacheIndexedSamples", iSafeTextureCache_IndexedSamples); - iniFile.Set("Settings", "SafeTextureCacheTlutSamples", iSafeTextureCache_TlutSamples); - iniFile.Set("Settings", "SafeTextureCacheColorMaxSize", iSafeTextureCache_ColorMaxSize); - iniFile.Set("Settings", "SafeTextureCacheIndexedMaxSize", iSafeTextureCache_IndexedMaxSize); iniFile.Set("Settings", "SafeTextureCacheTlutMaxSize", iSafeTextureCache_TlutMaxSize); iniFile.Set("Settings", "ShowFPS", bShowFPS); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index b2f1af62b2..9cb08d4082 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -120,10 +120,6 @@ struct VideoConfig bool bCopyEFBScaled; bool bSafeTextureCache; int iSafeTextureCache_ColorSamples; - int iSafeTextureCache_IndexedSamples; - int iSafeTextureCache_TlutSamples; - int iSafeTextureCache_ColorMaxSize; - int iSafeTextureCache_IndexedMaxSize; int iSafeTextureCache_TlutMaxSize; bool bFIFOBPhack; int iPhackvalue; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp index 1b9285bd56..6c14fb07ff 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp @@ -95,6 +95,26 @@ struct TabDirect3D : public W32Util::Tab Button_SetCheck(GetDlgItem(hDlg, IDC_RENDER_TO_MAINWINDOW), g_Config.RenderToMainframe); Button_SetCheck(GetDlgItem(hDlg, IDC_WIDESCREEN_HACK), g_Config.bWidescreenHack); Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE), g_Config.bSafeTextureCache); + + if(g_Config.iSafeTextureCache_ColorSamples == 0 && g_Config.iSafeTextureCache_TlutMaxSize == 0) + { + Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_SAFE), true); + } + else + { + if(g_Config.iSafeTextureCache_ColorSamples > 36 && g_Config.iSafeTextureCache_TlutMaxSize > 4095) + { + Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_NORMAL), true); + } + else + { + Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_FAST), true); + } + } + Button_Enable(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_SAFE),g_Config.bSafeTextureCache); + Button_Enable(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_NORMAL),g_Config.bSafeTextureCache); + Button_Enable(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_FAST),g_Config.bSafeTextureCache); + Button_SetCheck(GetDlgItem(hDlg, IDC_EFB_ACCESS_ENABLE), g_Config.bEFBAccessEnable); Button_GetCheck(GetDlgItem(hDlg,IDC_RENDER_TO_MAINWINDOW)) ? Button_Enable(GetDlgItem(hDlg,IDC_FULLSCREENENABLE), false) : Button_Enable(GetDlgItem(hDlg,IDC_FULLSCREENENABLE), true); } @@ -111,6 +131,9 @@ struct TabDirect3D : public W32Util::Tab break; case IDC_SAFE_TEXTURE_CACHE: g_Config.bSafeTextureCache = Button_GetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE)) == 0 ? false : true; + Button_Enable(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_SAFE),g_Config.bSafeTextureCache); + Button_Enable(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_NORMAL),g_Config.bSafeTextureCache); + Button_Enable(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_FAST),g_Config.bSafeTextureCache); break; case IDC_EFB_ACCESS_ENABLE: g_Config.bEFBAccessEnable = Button_GetCheck(GetDlgItem(hDlg, IDC_EFB_ACCESS_ENABLE)) == 0 ? false : true; @@ -135,6 +158,36 @@ struct TabDirect3D : public W32Util::Tab g_Config.bFullscreen = Button_GetCheck(GetDlgItem(hDlg, IDC_FULLSCREENENABLE)) ? true : false; g_Config.bVSync = Button_GetCheck(GetDlgItem(hDlg, IDC_VSYNC)) ? true : false; g_Config.RenderToMainframe = Button_GetCheck(GetDlgItem(hDlg, IDC_RENDER_TO_MAINWINDOW)) ? true : false; + if(Button_GetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_SAFE))) + { + g_Config.iSafeTextureCache_ColorSamples = 0; + g_Config.iSafeTextureCache_TlutMaxSize = 0; + } + else + { + if(Button_GetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_NORMAL))) + { + if(g_Config.iSafeTextureCache_ColorSamples < 37) + { + g_Config.iSafeTextureCache_ColorSamples = 37; + } + if(g_Config.iSafeTextureCache_TlutMaxSize < 4096) + { + g_Config.iSafeTextureCache_TlutMaxSize = 4096; + } + } + else + { + if(g_Config.iSafeTextureCache_ColorSamples > 36 || g_Config.iSafeTextureCache_ColorSamples == 0) + { + g_Config.iSafeTextureCache_ColorSamples = 8; + } + if(g_Config.iSafeTextureCache_TlutMaxSize > 1024 || g_Config.iSafeTextureCache_TlutMaxSize == 0) + { + g_Config.iSafeTextureCache_TlutMaxSize = 1024; + } + } + } g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str()); } }; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp index 593f3acece..3508acfc8b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp @@ -167,12 +167,11 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, // visible or invisible. Thus, unless we want to recreate the textures for every drawn character, // we must make sure that texture with different tluts get different IDs. int tempsize = TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, tex_format); - tempsize = (g_ActiveConfig.iSafeTextureCache_IndexedMaxSize != 0 && g_ActiveConfig.iSafeTextureCache_IndexedMaxSize < tempsize)?g_ActiveConfig.iSafeTextureCache_IndexedMaxSize : tempsize; - texHash = TexDecoder_GetHash64(ptr,tempsize,g_ActiveConfig.iSafeTextureCache_IndexedSamples); + texHash = TexDecoder_GetHash64(ptr,tempsize,0); tempsize = TexDecoder_GetPaletteSize(tex_format); tempsize = (g_ActiveConfig.iSafeTextureCache_TlutMaxSize != 0 && g_ActiveConfig.iSafeTextureCache_TlutMaxSize < tempsize)?g_ActiveConfig.iSafeTextureCache_TlutMaxSize : tempsize; - u32 tlutHash = TexDecoder_GetHash32(&texMem[tlutaddr], tempsize,g_ActiveConfig.iSafeTextureCache_TlutSamples); + u32 tlutHash = TexDecoder_GetHash32(&texMem[tlutaddr], tempsize,0); texHash ^= tlutHash; if (g_ActiveConfig.bSafeTextureCache) { @@ -182,7 +181,6 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, else { int tempsize = TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, tex_format); - tempsize = (g_ActiveConfig.iSafeTextureCache_ColorMaxSize != 0 && g_ActiveConfig.iSafeTextureCache_ColorMaxSize < tempsize)?g_ActiveConfig.iSafeTextureCache_ColorMaxSize : tempsize; texHash = TexDecoder_GetHash64(ptr, tempsize,g_ActiveConfig.iSafeTextureCache_ColorSamples); } if (g_ActiveConfig.bSafeTextureCache) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/resource.h b/Source/Plugins/Plugin_VideoDX9/Src/resource.h index a42fbedc6e..9e0f268472 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/resource.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/resource.h @@ -35,9 +35,13 @@ #define IDC_FORCEANISOTROPY 1027 #define IDC_LOADHIRESTEXTURE 1028 #define IDC_EFBSCALEDCOPY 1029 -#define IDC_OSDHOTKEY 1030 +#define IDC_OSDHOTKEY 1030 #define IDC_COMBO2 1040 #define IDC_ASPECTRATIO 1040 +#define IDC_SAFE_TEXTURE_CACHE_SAFE 1041 +#define IDC_SAFE_TEXTURE_CACHE_NORMAL 1042 +#define IDC_RADIO3 1043 +#define IDC_SAFE_TEXTURE_CACHE_FAST 1043 #define IDC_CHECK1 1100 #define IDC_STATIC -1 @@ -47,7 +51,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 106 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1041 +#define _APS_NEXT_CONTROL_VALUE 1044 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/resource.rc b/Source/Plugins/Plugin_VideoDX9/Src/resource.rc index adcd7bdb55..de2f64fae3 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/resource.rc +++ b/Source/Plugins/Plugin_VideoDX9/Src/resource.rc @@ -40,23 +40,27 @@ IDD_SETTINGS DIALOGEX 0, 0, 244, 183 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_BORDER | WS_SYSMENU FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "&Graphics card:",IDC_STATIC,7,9,61,8 - COMBOBOX IDC_ADAPTER,68,7,169,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "&Fullscreen",IDC_FULLSCREENENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,25,56,8 - CONTROL "&V-Sync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,38,141,8 - CONTROL "&Render to main window",IDC_RENDER_TO_MAINWINDOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,50,141,8 - LTEXT "Full&screen resolution:",IDC_STATIC,7,86,69,8 - COMBOBOX IDC_RESOLUTION,87,85,150,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "&Windowed resolution:",IDC_STATIC,7,106,74,8 - COMBOBOX IDC_RESOLUTIONWINDOWED,87,104,150,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "&Anti-alias mode:",IDC_STATIC,7,127,56,8 - COMBOBOX IDC_ANTIALIASMODE,68,125,169,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "&Aspect Ratio:",IDC_STATIC,7,66,52,8 - CONTROL "&Widescreen Hack",IDC_WIDESCREEN_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,66,67,10 - CONTROL "&Safe Texture Cache",IDC_SAFE_TEXTURE_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,143,85,11 - CONTROL "&Enable CPU->EFB access (can cause slowdowns, enables pull stars in SMG and lens flare in Zeldas)",IDC_EFB_ACCESS_ENABLE, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,68,153,169,23 - COMBOBOX IDC_ASPECTRATIO,68,64,97,57,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "&Graphics card:",IDC_STATIC,9,9,49,8 + COMBOBOX IDC_ADAPTER,68,7,162,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "&Fullscreen",IDC_FULLSCREENENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,25,44,8 + CONTROL "&V-Sync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,25,36,8 + CONTROL "&Render to main window",IDC_RENDER_TO_MAINWINDOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,25,87,8 + LTEXT "&Windowed",IDC_STATIC,14,89,40,8 + COMBOBOX IDC_RESOLUTIONWINDOWED,68,87,162,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "&Anti-alias mode:",IDC_STATIC,9,113,51,8 + COMBOBOX IDC_ANTIALIASMODE,68,111,162,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "&Aspect Ratio:",IDC_STATIC,9,40,48,8 + CONTROL "&Widescreen Hack",IDC_WIDESCREEN_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,40,67,10 + CONTROL "&Safe Texture Cache",IDC_SAFE_TEXTURE_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,157,80,11 + CONTROL "&Enable CPU->EFB access ",IDC_EFB_ACCESS_ENABLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,136,94,11 + COMBOBOX IDC_ASPECTRATIO,68,39,89,57,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Safe Texture Cache Mode",IDC_STATIC,109,147,125,27 + GROUPBOX "Resolutions",IDC_STATIC,7,56,230,50 + LTEXT "Full&screen:",IDC_STATIC,14,68,36,8 + COMBOBOX IDC_RESOLUTION,68,67,162,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Safe",IDC_SAFE_TEXTURE_CACHE_SAFE,"Button",BS_AUTORADIOBUTTON,117,158,27,10 + CONTROL "Normal",IDC_SAFE_TEXTURE_CACHE_NORMAL,"Button",BS_AUTORADIOBUTTON,154,158,38,10 + CONTROL "Fast",IDC_SAFE_TEXTURE_CACHE_FAST,"Button",BS_AUTORADIOBUTTON,198,158,30,10 END IDD_ADVANCED DIALOGEX 0, 0, 244, 200 @@ -180,3 +184,16 @@ END #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp index 69d510cd69..a51a7619ed 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp @@ -275,12 +275,11 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width // visible or invisible. Thus, unless we want to recreate the textures for every drawn character, // we must make sure that texture with different tluts get different IDs. int tempsize = TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, tex_format); - tempsize = (g_ActiveConfig.iSafeTextureCache_IndexedMaxSize != 0 && g_ActiveConfig.iSafeTextureCache_IndexedMaxSize < tempsize)?g_ActiveConfig.iSafeTextureCache_IndexedMaxSize : tempsize; - texHash = TexDecoder_GetHash64(ptr,tempsize,g_ActiveConfig.iSafeTextureCache_IndexedSamples); + texHash = TexDecoder_GetHash64(ptr,tempsize,0); tempsize = TexDecoder_GetPaletteSize(tex_format); tempsize = (g_ActiveConfig.iSafeTextureCache_TlutMaxSize != 0 && g_ActiveConfig.iSafeTextureCache_TlutMaxSize < tempsize)?g_ActiveConfig.iSafeTextureCache_TlutMaxSize : tempsize; - u32 tlutHash = TexDecoder_GetHash32(&texMem[tlutaddr], tempsize,g_ActiveConfig.iSafeTextureCache_TlutSamples); + u32 tlutHash = TexDecoder_GetHash32(&texMem[tlutaddr], tempsize,0); texHash ^= tlutHash; if (g_ActiveConfig.bSafeTextureCache) { @@ -290,7 +289,6 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width else { int tempsize = TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, tex_format); - tempsize = (g_ActiveConfig.iSafeTextureCache_ColorMaxSize != 0 && g_ActiveConfig.iSafeTextureCache_ColorMaxSize < tempsize)?g_ActiveConfig.iSafeTextureCache_ColorMaxSize : tempsize; texHash = TexDecoder_GetHash64(ptr, tempsize,g_ActiveConfig.iSafeTextureCache_ColorSamples); } if (g_ActiveConfig.bSafeTextureCache)