From 19a5dcbffcab99c791780f070171736a723f90d1 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 29 Dec 2020 15:25:44 +0400 Subject: [PATCH] Make OpenAL debugging easier --- Telegram/SourceFiles/core/launcher.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp index 4f9eb8ed83..3ab874538e 100644 --- a/Telegram/SourceFiles/core/launcher.cpp +++ b/Telegram/SourceFiles/core/launcher.cpp @@ -324,6 +324,23 @@ int Launcher::exec() { // Must be started before Platform is started. Logs::start(this); + if (Logs::DebugEnabled()) { + const auto openalLogPath = QDir::toNativeSeparators( + cWorkingDir() + qsl("DebugLogs/last_openal_log.txt")); + + qputenv("ALSOFT_LOGLEVEL", "3"); + +#ifdef Q_OS_WIN + _wputenv_s( + L"ALSOFT_LOGFILE", + openalLogPath.toStdWString().c_str()); +#else // Q_OS_WIN + qputenv( + "ALSOFT_LOGFILE", + QFile::encodeName(openalLogPath)); +#endif // !Q_OS_WIN + } + // Must be started before Sandbox is created. Platform::start(); Ui::DisableCustomScaling();