Merge pull request #7942 from Robyt3/Client-SoundInit-Warning

Use generic client warning for failed sound init
This commit is contained in:
Dennis Felsing 2024-02-08 14:00:16 +00:00 committed by GitHub
commit 7dc446e086
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 14 deletions

View file

@ -242,8 +242,6 @@ public:
virtual const char *LatestVersion() const = 0;
virtual bool ConnectionProblems() const = 0;
virtual bool SoundInitFailed() const = 0;
virtual IGraphics::CTextureHandle GetDebugFont() const = 0; // TODO: remove this function
//DDRace

View file

@ -2727,7 +2727,7 @@ void CClient::Run()
Graphics()->Swap();
// init sound, allowed to fail
m_SoundInitFailed = Sound()->Init() != 0;
const bool SoundInitFailed = Sound()->Init() != 0;
#if defined(CONF_VIDEORECORDER)
// init video recorder aka ffmpeg
@ -2805,6 +2805,13 @@ void CClient::Run()
else
RequestDDNetInfo();
if(SoundInitFailed)
{
SWarning Warning(Localize("Sound error"), Localize("The audio device couldn't be initialised."));
Warning.m_AutoHide = false;
m_vWarnings.emplace_back(Warning);
}
bool LastD = false;
bool LastE = false;
bool LastG = false;

View file

@ -109,7 +109,6 @@ class CClient : public IClient, public CDemoPlayer::IListener
bool m_AutoStatScreenshotRecycle = false;
bool m_AutoCSVRecycle = false;
bool m_EditorActive = false;
bool m_SoundInitFailed = false;
int m_aAckGameTick[NUM_DUMMIES] = {-1, -1};
int m_aCurrentRecvTick[NUM_DUMMIES] = {0, 0};
@ -287,8 +286,6 @@ public:
bool ConnectionProblems() const override;
bool SoundInitFailed() const override { return m_SoundInitFailed; }
IGraphics::CTextureHandle GetDebugFont() const override { return m_DebugFont; }
void DirectInput(int *pInput, int Size);

View file

@ -1045,14 +1045,6 @@ void CMenus::Render()
ms_ColorTabbarHover = ms_ColorTabbarHoverOutgame;
}
static bool s_SoundCheck = false;
if(!s_SoundCheck && m_Popup == POPUP_NONE)
{
if(Client()->SoundInitFailed())
PopupMessage(Localize("Sound error"), Localize("The audio device couldn't be initialised."), Localize("Ok"));
s_SoundCheck = true;
}
if(m_Popup == POPUP_NONE)
{
if(m_JoinTutorial && ServerBrowser()->DDNetInfoAvailable() && !ServerBrowser()->IsGettingServerlist())