diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2011-03-21 05:46:33 +0000 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2011-03-21 05:46:33 +0000 |
| commit | 068855bbd641efd0d941c2005fb4f33459e32b03 (patch) | |
| tree | eae52d160f4001a2bdf68a7d3cf70d6e9ec5fd91 /Source/Core/VideoCommon | |
| parent | 8eaed1c105d2ecd3c63cc728eee8bc1a493a27db (diff) | |
Moved per-game graphics configuration to the game-list right click menu. It will be too difficult to make the "profiles" drop-down thing work with 3-state vs 2-state checkboxes. The per-game settings now have "undetermined" states, except for the radio buttons(I'll fix that later). It's super hacky right now. Video config (probably all config stuff) could be redone.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7386 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/Src/TextureDecoder.cpp | 45 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexLoader.cpp | 11 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexLoader_Normal.cpp | 6 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexLoader_Normal.h | 6 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VideoConfig.cpp | 227 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VideoConfig.h | 32 |
6 files changed, 221 insertions, 106 deletions
diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.cpp b/Source/Core/VideoCommon/Src/TextureDecoder.cpp index 85872a8b0e..3399d5f429 100644 --- a/Source/Core/VideoCommon/Src/TextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/TextureDecoder.cpp @@ -685,17 +685,13 @@ PC_TexFormat GetPC_TexFormat(int texformat, int tlutfmt) return PC_TEX_FMT_NONE; } -//switch endianness, unswizzle -//TODO: to save memory, don't blindly convert everything to argb8888 -//also ARGB order needs to be swapped later, to accommodate modern hardware better -//need to add DXT support too -PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt) +inline void SetOpenMPThreadCount(int width, int height) { #ifdef _OPENMP - //Dont use multithreading in small Textures - if ((width > 127 && height > 127) && g_ActiveConfig.bOMPDecoder) + // Dont use multithreading in small Textures + if (g_ActiveConfig.bOMPDecoder && width > 127 && height > 127) { - //don't span to many threads they will kill the rest of the emu :) + // don't span to many threads they will kill the rest of the emu :) omp_set_num_threads((cpu_info.num_cores + 2) / 3); } else @@ -703,8 +699,19 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh omp_set_num_threads(1); } #endif - int Wsteps4 = (width + 3) / 4; - int Wsteps8 = (width + 7) / 8; +} + +//switch endianness, unswizzle +//TODO: to save memory, don't blindly convert everything to argb8888 +//also ARGB order needs to be swapped later, to accommodate modern hardware better +//need to add DXT support too +PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt) +{ + SetOpenMPThreadCount(width, height); + + const int Wsteps4 = (width + 3) / 4; + const int Wsteps8 = (width + 7) / 8; + switch (texformat) { case GX_TF_C4: @@ -967,19 +974,11 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int height, int texformat, int tlutaddr, int tlutfmt) { -#ifdef _OPENMP - if ((width > 127 && height > 127) && g_ActiveConfig.bOMPDecoder) - { - //don't span to many threads they will kill the rest of the emu :) - omp_set_num_threads((cpu_info.num_cores + 2) / 3); - } - else - { - omp_set_num_threads(1); - } -#endif - int Wsteps4 = (width + 3) / 4; - int Wsteps8 = (width + 7) / 8; + SetOpenMPThreadCount(width, height); + + const int Wsteps4 = (width + 3) / 4; + const int Wsteps8 = (width + 7) / 8; + switch (texformat) { case GX_TF_C4: diff --git a/Source/Core/VideoCommon/Src/VertexLoader.cpp b/Source/Core/VideoCommon/Src/VertexLoader.cpp index 969c3bb2ff..ce9e81219d 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader.cpp @@ -296,9 +296,14 @@ void VertexLoader::CompileVertexTranslator() // Normals vtx_decl.num_normals = 0; - if (m_VtxDesc.Normal != NOT_PRESENT) { - m_VertexSize += VertexLoader_Normal::GetSize(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3); - TPipelineFunction pFunc = VertexLoader_Normal::GetFunction(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3, g_Config.backend_info.bAllowSignedBytes); + if (m_VtxDesc.Normal != NOT_PRESENT) + { + m_VertexSize += VertexLoader_Normal::GetSize(m_VtxDesc.Normal, + m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3); + + TPipelineFunction pFunc = VertexLoader_Normal::GetFunction(m_VtxDesc.Normal, + m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3); + if (pFunc == 0) { char temp[256]; diff --git a/Source/Core/VideoCommon/Src/VertexLoader_Normal.cpp b/Source/Core/VideoCommon/Src/VertexLoader_Normal.cpp index c49a23031b..830bd3de13 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader_Normal.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader_Normal.cpp @@ -104,12 +104,14 @@ void VertexLoader_Normal::Init(void) m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_FLOAT] = Set(6, Normal_Index16_Float3_Indices3); } -unsigned int VertexLoader_Normal::GetSize(unsigned int _type, unsigned int _format, unsigned int _elements, unsigned int _index3) +unsigned int VertexLoader_Normal::GetSize(unsigned int _type, + unsigned int _format, unsigned int _elements, unsigned int _index3) { return m_Table[_type][_index3][_elements][_format].gc_size; } -TPipelineFunction VertexLoader_Normal::GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements, unsigned int _index3, bool allow_signed_bytes) +TPipelineFunction VertexLoader_Normal::GetFunction(unsigned int _type, + unsigned int _format, unsigned int _elements, unsigned int _index3) { TPipelineFunction pFunc = m_Table[_type][_index3][_elements][_format].function; return pFunc; diff --git a/Source/Core/VideoCommon/Src/VertexLoader_Normal.h b/Source/Core/VideoCommon/Src/VertexLoader_Normal.h index b74df88ee7..934cd1ec43 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader_Normal.h +++ b/Source/Core/VideoCommon/Src/VertexLoader_Normal.h @@ -29,10 +29,12 @@ public: static void Init(void); // GetSize - static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements, unsigned int _index3); + static unsigned int GetSize(unsigned int _type, unsigned int _format, + unsigned int _elements, unsigned int _index3); // GetFunction - static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements, unsigned int _index3, bool allow_signed_bytes); + static TPipelineFunction GetFunction(unsigned int _type, + unsigned int _format, unsigned int _elements, unsigned int _index3); private: enum ENormalType diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 71c90fb986..9e75a59fa9 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -41,7 +41,6 @@ VideoConfig::VideoConfig() // disable all features by default backend_info.APIType = API_NONE; - backend_info.bAllowSignedBytes = false; backend_info.bUseRGBATextures = false; backend_info.bSupports3DVision = false; } @@ -301,86 +300,168 @@ void VideoConfig::Save(const char *ini_file) iniFile.Save(ini_file); } -void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini) +// haxhaxhax +static void SetUndetermined(bool& val) { - // wxWidgets doesn't provide us with a nice way to change 3-state checkboxes into 2-state ones - // This would allow us to make the "default config" dialog layout to be 2-state based, but the - // "game config" layout to be 3-state based (with the 3rd state being "use default") - // Since we can't do that, we instead just save anything which differs from the default config - // TODO: Make this less ugly + // lul, storing a u8 inside a bool + *reinterpret_cast<u8*>(&val) = 2; +} - VideoConfig defCfg; - defCfg.Load(default_ini); +static void SetUndetermined(int& val) +{ + val = -1; +} - IniFile iniFile; - iniFile.Load(game_ini); - - #define SET_IF_DIFFERS(section, key, member) { if ((member) != (defCfg.member)) iniFile.Set((section), (key), (member)); else iniFile.DeleteKey((section), (key)); } - - SET_IF_DIFFERS("Video_Hardware", "VSync", bVSync); - SET_IF_DIFFERS("Video_Settings", "wideScreenHack", bWidescreenHack); - SET_IF_DIFFERS("Video_Settings", "AspectRatio", iAspectRatio); - SET_IF_DIFFERS("Video_Settings", "Crop", bCrop); - SET_IF_DIFFERS("Video_Settings", "UseXFB", bUseXFB); - SET_IF_DIFFERS("Video_Settings", "UseRealXFB", bUseRealXFB); - SET_IF_DIFFERS("Video_Settings", "UseNativeMips", bUseNativeMips); - - SET_IF_DIFFERS("Video_Settings", "SafeTextureCache", bSafeTextureCache); - SET_IF_DIFFERS("Video_Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples); - - SET_IF_DIFFERS("Video_Settings", "ShowFPS", bShowFPS); - SET_IF_DIFFERS("Video_Settings", "ShowInputDisplay", bShowInputDisplay); - SET_IF_DIFFERS("Video_Settings", "OverlayStats", bOverlayStats); - SET_IF_DIFFERS("Video_Settings", "OverlayProjStats", bOverlayProjStats); - SET_IF_DIFFERS("Video_Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions); - SET_IF_DIFFERS("Video_Settings", "DLOptimize", iCompileDLsLevel); - SET_IF_DIFFERS("Video_Settings", "DumpTextures", bDumpTextures); - SET_IF_DIFFERS("Video_Settings", "HiresTextures", bHiresTextures); - SET_IF_DIFFERS("Video_Settings", "DumpEFBTarget", bDumpEFBTarget); - SET_IF_DIFFERS("Video_Settings", "DumpFrames", bDumpFrames); - SET_IF_DIFFERS("Video_Settings", "FreeLook", bFreeLook); - SET_IF_DIFFERS("Video_Settings", "UseFFV1", bUseFFV1); - SET_IF_DIFFERS("Video_Settings", "AnaglyphStereo", bAnaglyphStereo); - SET_IF_DIFFERS("Video_Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation); - SET_IF_DIFFERS("Video_Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle); - SET_IF_DIFFERS("Video_Settings", "EnablePixelLighting", bEnablePixelLighting); - SET_IF_DIFFERS("Video_Settings", "EnablePerPixelDepth", bEnablePerPixelDepth); - - SET_IF_DIFFERS("Video_Settings", "ShowShaderErrors", bShowShaderErrors); - SET_IF_DIFFERS("Video_Settings", "MSAA", iMultisampleMode); - SET_IF_DIFFERS("Video_Settings", "EFBScale", iEFBScale); // integral - - SET_IF_DIFFERS("Video_Settings", "DstAlphaPass", bDstAlphaPass); - - SET_IF_DIFFERS("Video_Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable); - SET_IF_DIFFERS("Video_Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter); - SET_IF_DIFFERS("Video_Settings", "WireFrame", bWireFrame); - SET_IF_DIFFERS("Video_Settings", "DisableLighting", bDisableLighting); - SET_IF_DIFFERS("Video_Settings", "DisableTexturing", bDisableTexturing); - SET_IF_DIFFERS("Video_Settings", "DisableFog", bDisableFog); - - SET_IF_DIFFERS("Video_Settings", "EnableOpenCL", bEnableOpenCL); +void VideoConfig::SetAllUndetermined() +{ + // video hardware + SetUndetermined(bVSync); + SetUndetermined(iAdapter); + + // video settings + SetUndetermined(bWidescreenHack); + SetUndetermined(iAspectRatio); + SetUndetermined(bCrop); + SetUndetermined(bUseXFB); + SetUndetermined(bUseRealXFB); + SetUndetermined(bUseNativeMips); + + SetUndetermined(bSafeTextureCache); + SetUndetermined(iSafeTextureCache_ColorSamples); + + SetUndetermined(bShowFPS); + SetUndetermined(bShowInputDisplay); + SetUndetermined(bOverlayStats); + SetUndetermined(bOverlayProjStats); + SetUndetermined(bShowEFBCopyRegions); + SetUndetermined(iCompileDLsLevel); + SetUndetermined(bDumpTextures); + SetUndetermined(bHiresTextures); + SetUndetermined(bDumpEFBTarget); + SetUndetermined(bDumpFrames); + SetUndetermined(bFreeLook); + SetUndetermined(bUseFFV1); + SetUndetermined(bAnaglyphStereo); + SetUndetermined(iAnaglyphStereoSeparation); + SetUndetermined(iAnaglyphFocalAngle); + SetUndetermined(bEnablePixelLighting); + SetUndetermined(bEnablePerPixelDepth); + + SetUndetermined(bShowShaderErrors); + SetUndetermined(iMultisampleMode); + SetUndetermined(iEFBScale); + + SetUndetermined(bDstAlphaPass); + + SetUndetermined(bTexFmtOverlayEnable); + SetUndetermined(bTexFmtOverlayCenter); + SetUndetermined(bWireFrame); + SetUndetermined(bDisableLighting); + SetUndetermined(bDisableTexturing); + SetUndetermined(bDisableFog); + + SetUndetermined(bEnableOpenCL); #ifdef _OPENMP - SET_IF_DIFFERS("Video_Settings", "OMPDecoder", bOMPDecoder); + SetUndetermined(bOMPDecoder); #endif - SET_IF_DIFFERS("Video_Enhancements", "ForceFiltering", bForceFiltering); - SET_IF_DIFFERS("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy); // NOTE - this is x in (1 << x) - SET_IF_DIFFERS("Video_Enhancements", "PostProcessingShader", sPostProcessingShader); - SET_IF_DIFFERS("Video_Enhancements", "Enable3dVision", b3DVision); - - SET_IF_DIFFERS("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable); - SET_IF_DIFFERS("Video_Hacks", "DlistCachingEnable", bDlistCachingEnable); - SET_IF_DIFFERS("Video_Hacks", "EFBCopyEnable", bEFBCopyEnable); - SET_IF_DIFFERS("Video_Hacks", "EFBCopyDisableHotKey", bOSDHotKey); - SET_IF_DIFFERS("Video_Hacks", "EFBToTextureEnable", bCopyEFBToTexture); - SET_IF_DIFFERS("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled); - SET_IF_DIFFERS("Video_Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable); - SET_IF_DIFFERS("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges); + // video enhancements + SetUndetermined(bForceFiltering); + SetUndetermined(iMaxAnisotropy); + //SetUndetermined(sPostProcessingShader); + SetUndetermined(b3DVision); + + // video hacks + SetUndetermined(bEFBAccessEnable); + SetUndetermined(bDlistCachingEnable); + SetUndetermined(bEFBCopyEnable); + SetUndetermined(bOSDHotKey); + SetUndetermined(bCopyEFBToTexture); + SetUndetermined(bCopyEFBScaled); + SetUndetermined(bEFBCopyCacheEnable); + SetUndetermined(bEFBEmulateFormatChanges); + + // this doesn't belong here, o well + backend_info = BackendInfo(); +} - SET_IF_DIFFERS("Video_Hardware", "Adapter", iAdapter); +void VideoConfig::GameIniSave(const char* game_ini) +{ + IniFile ini_file; + ini_file.Load(game_ini); + + // video hardware + IniFile::Section& vid_hardware = *ini_file.GetOrCreateSection("Video_Hardware"); + SetIfDetermined(vid_hardware, "VSync", bVSync); + SetIfDetermined(vid_hardware, "Adapter", iAdapter); + + // video settings + IniFile::Section& vid_settings = *ini_file.GetOrCreateSection("Video_Settings"); + SetIfDetermined(vid_settings, "wideScreenHack", bWidescreenHack); + SetIfDetermined(vid_settings, "AspectRatio", iAspectRatio); + SetIfDetermined(vid_settings, "Crop", bCrop); + SetIfDetermined(vid_settings, "UseXFB", bUseXFB); + SetIfDetermined(vid_settings, "UseRealXFB", bUseRealXFB); + SetIfDetermined(vid_settings, "UseNativeMips", bUseNativeMips); + + SetIfDetermined(vid_settings, "SafeTextureCache", bSafeTextureCache); + SetIfDetermined(vid_settings, "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples); + + SetIfDetermined(vid_settings, "ShowFPS", bShowFPS); + SetIfDetermined(vid_settings, "ShowInputDisplay", bShowInputDisplay); + SetIfDetermined(vid_settings, "OverlayStats", bOverlayStats); + SetIfDetermined(vid_settings, "OverlayProjStats", bOverlayProjStats); + SetIfDetermined(vid_settings, "ShowEFBCopyRegions", bShowEFBCopyRegions); + SetIfDetermined(vid_settings, "DLOptimize", iCompileDLsLevel); + SetIfDetermined(vid_settings, "DumpTextures", bDumpTextures); + SetIfDetermined(vid_settings, "HiresTextures", bHiresTextures); + SetIfDetermined(vid_settings, "DumpEFBTarget", bDumpEFBTarget); + SetIfDetermined(vid_settings, "DumpFrames", bDumpFrames); + SetIfDetermined(vid_settings, "FreeLook", bFreeLook); + SetIfDetermined(vid_settings, "UseFFV1", bUseFFV1); + SetIfDetermined(vid_settings, "AnaglyphStereo", bAnaglyphStereo); + SetIfDetermined(vid_settings, "AnaglyphStereoSeparation", iAnaglyphStereoSeparation); + SetIfDetermined(vid_settings, "AnaglyphFocalAngle", iAnaglyphFocalAngle); + SetIfDetermined(vid_settings, "EnablePixelLighting", bEnablePixelLighting); + SetIfDetermined(vid_settings, "EnablePerPixelDepth", bEnablePerPixelDepth); + + SetIfDetermined(vid_settings, "ShowShaderErrors", bShowShaderErrors); + SetIfDetermined(vid_settings, "MSAA", iMultisampleMode); + SetIfDetermined(vid_settings, "EFBScale", iEFBScale); // integral + + SetIfDetermined(vid_settings, "DstAlphaPass", bDstAlphaPass); + + SetIfDetermined(vid_settings, "TexFmtOverlayEnable", bTexFmtOverlayEnable); + SetIfDetermined(vid_settings, "TexFmtOverlayCenter", bTexFmtOverlayCenter); + SetIfDetermined(vid_settings, "WireFrame", bWireFrame); + SetIfDetermined(vid_settings, "DisableLighting", bDisableLighting); + SetIfDetermined(vid_settings, "DisableTexturing", bDisableTexturing); + SetIfDetermined(vid_settings, "DisableFog", bDisableFog); + + SetIfDetermined(vid_settings, "EnableOpenCL", bEnableOpenCL); +#ifdef _OPENMP + SetIfDetermined(vid_settings, "OMPDecoder", bOMPDecoder); +#endif - iniFile.Save(game_ini); + // video enhancements + IniFile::Section& vid_enhancements = *ini_file.GetOrCreateSection("Video_Enhancements"); + SetIfDetermined(vid_enhancements, "ForceFiltering", bForceFiltering); + SetIfDetermined(vid_enhancements, "MaxAnisotropy", iMaxAnisotropy); // NOTE - this is x in (1 << x) + //SetIfDetermined(vid_enhancements, "PostProcessingShader", sPostProcessingShader); + SetIfDetermined(vid_enhancements, "Enable3dVision", b3DVision); + + // video hacks + IniFile::Section& vid_hacks = *ini_file.GetOrCreateSection("Video_Hacks"); + SetIfDetermined(vid_hacks, "EFBAccessEnable", bEFBAccessEnable); + SetIfDetermined(vid_hacks, "DlistCachingEnable", bDlistCachingEnable); + SetIfDetermined(vid_hacks, "EFBCopyEnable", bEFBCopyEnable); + SetIfDetermined(vid_hacks, "EFBCopyDisableHotKey", bOSDHotKey); + SetIfDetermined(vid_hacks, "EFBToTextureEnable", bCopyEFBToTexture); + SetIfDetermined(vid_hacks, "EFBScaledCopy", bCopyEFBScaled); + SetIfDetermined(vid_hacks, "EFBCopyCacheEnable", bEFBCopyCacheEnable); + SetIfDetermined(vid_hacks, "EFBEmulateFormatChanges", bEFBEmulateFormatChanges); + + ini_file.Save(game_ini); } diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 36c8f142cc..b66bc0b0aa 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -27,6 +27,7 @@ #include "Common.h" #include "VideoCommon.h" +#include "IniFile.h" #include <vector> #include <string> @@ -66,9 +67,12 @@ struct VideoConfig void GameIniLoad(const char *ini_file); void VerifyValidity(); void Save(const char *ini_file); - void GameIniSave(const char* default_ini, const char* game_ini); + void GameIniSave(const char* game_ini); void UpdateProjectionHack(); + // some hacks used for per-game config + void SetAllUndetermined(); + // General bool bVSync; @@ -149,7 +153,7 @@ struct VideoConfig int iAdapter; // Static config per API - struct + struct BackendInfo { API_TYPE APIType; @@ -159,11 +163,33 @@ struct VideoConfig bool bUseRGBATextures; // used for D3D11 in TextureCache bool bSupports3DVision; - bool bAllowSignedBytes; // D3D9 doesn't support signed bytes (?) bool bSupportsDualSourceBlend; // only supported by D3D11 and OpenGL bool bSupportsFormatReinterpretation; bool bSupportsPixelLighting; } backend_info; + + // haxhaxhax + static bool IsUndetermined(const bool& val) + { + // lul, storing a u8 inside a bool + return (*reinterpret_cast<const u8*>(&val) > 1); + } + + static bool IsUndetermined(int val) + { + return (val < 0); + } + +private: + + template <typename T> + void SetIfDetermined(IniFile::Section& sect, const char* key, const T& value) + { + if (IsUndetermined(value)) + sect.Delete(key); + else + sect.Set(key, value); + } }; extern VideoConfig g_Config; |
