Skip to content

Commit

Permalink
New advancedsettings option 'autoHDR' to turn on display HDR when Kod…
Browse files Browse the repository at this point in the history
…i starts
  • Loading branch information
thexai committed Jan 10, 2020
1 parent 6a11e3d commit 5db8da7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions xbmc/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,13 @@ bool CApplication::Create(const CAppParamParser &params)
//! @todo - move to CPlatformXXX
#ifdef TARGET_WINDOWS
CWIN32Util::SetThreadLocalLocale(true); // enable independent locale for each thread, see https://connect.microsoft.com/VisualStudio/feedback/details/794122
if (CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_bAutoHDR &&
CWIN32Util::GetWindowsHDRStatus() == 1)
{
CLog::Log(LOGNOTICE, "Turning display HDR on due advancedsettings");
CWIN32Util::ToggleWindowsHDR();
Sleep(2000);
}
#endif // TARGET_WINDOWS

// application inbound service
Expand Down Expand Up @@ -2636,6 +2643,15 @@ void CApplication::Stop(int exitCode)

cleanup_emu_environ();

#if defined(TARGET_WINDOWS)
if (CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_bAutoHDR &&
exitCode == EXITCODE_QUIT && CWIN32Util::GetWindowsHDRStatus() == 2)
{
CWIN32Util::ToggleWindowsHDR();
Sleep(1800);
}
#endif

Sleep(200);
}

Expand Down
4 changes: 4 additions & 0 deletions xbmc/settings/AdvancedSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ void CAdvancedSettings::Initialize()
m_bVirtualShares = true;
m_bTry10bitOutput = false;

m_bAutoHDR = false;

m_cpuTempCmd = "";
m_gpuTempCmd = "";
#if defined(TARGET_DARWIN)
Expand Down Expand Up @@ -895,6 +897,8 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file)
XMLUtils::GetUInt(pRootElement, "packagefoldersize", m_addonPackageFolderSize);
XMLUtils::GetBoolean(pRootElement, "try10bitoutput", m_bTry10bitOutput);

XMLUtils::GetBoolean(pRootElement, "autoHDR", m_bAutoHDR);

// EPG
pElement = pRootElement->FirstChildElement("epg");
if (pElement)
Expand Down
2 changes: 2 additions & 0 deletions xbmc/settings/AdvancedSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler
bool m_bVirtualShares;
bool m_bTry10bitOutput;

bool m_bAutoHDR;

std::string m_cpuTempCmd;
std::string m_gpuTempCmd;

Expand Down

0 comments on commit 5db8da7

Please sign in to comment.