From fe20459138b71cf0440b0cf700c90300cf3a848b Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Sat, 27 May 2023 09:10:39 +0200 Subject: [PATCH 1/2] Clear Victim Team render info on skin changes --- src/game/client/components/killmessages.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/game/client/components/killmessages.cpp b/src/game/client/components/killmessages.cpp index 0fdbebc59..c3c1b296c 100644 --- a/src/game/client/components/killmessages.cpp +++ b/src/game/client/components/killmessages.cpp @@ -396,6 +396,10 @@ void CKillMessages::RefindSkins() if(m_aKillmsgs[r].m_VictimID >= 0) { + for(auto &VictimRenderInfo : m_aKillmsgs[r].m_VictimRenderInfo) + { + VictimRenderInfo = {}; + } const CGameClient::CClientData &Client = GameClient()->m_aClients[m_aKillmsgs[r].m_VictimID]; if(Client.m_aSkinName[0] != '\0') m_aKillmsgs[r].m_VictimRenderInfo[0] = Client.m_RenderInfo; From 70d48140f0142930e5be933e199d9bdec04f1b24 Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Sat, 27 May 2023 09:51:22 +0200 Subject: [PATCH 2/2] Show GPU info (if available) in assert --- src/engine/client.h | 1 + src/engine/client/client.cpp | 27 +++++++++++++++++++++++-- src/engine/client/client.h | 1 + src/engine/client/graphics_threaded.cpp | 5 +++++ src/engine/client/graphics_threaded.h | 1 + src/engine/graphics.h | 1 + 6 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/engine/client.h b/src/engine/client.h index 5ae3cac5b..5ee3e8608 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -293,6 +293,7 @@ public: MESSAGE_BOX_TYPE_INFO, }; virtual void ShowMessageBox(const char *pTitle, const char *pMessage, EMessageBoxType Type = MESSAGE_BOX_TYPE_ERROR) = 0; + virtual void GetGPUInfoString(char (&aGPUInfo)[256]) = 0; }; class IGameClient : public IInterface diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 240461cc9..470ee3d0a 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -4631,8 +4631,19 @@ int main(int argc, const char **argv) char aVersionStr[128]; if(!os_version_str(aVersionStr, sizeof(aVersionStr))) str_copy(aVersionStr, "unknown"); - char aMessage[512]; - str_format(aMessage, sizeof(aMessage), "An assertion error occured. Please write down or take a screenshot of the following information and report this error.\nPlease also share the assert log which you should find in the 'dumps' folder in your config directory.\n\n%s\n\nPlatform: %s\nGame version: %s %s\nOS version: %s", pMsg, CONF_PLATFORM_STRING, GAME_RELEASE_VERSION, GIT_SHORTREV_HASH != nullptr ? GIT_SHORTREV_HASH : "", aVersionStr); + char aGPUInfo[256]; + pClient->GetGPUInfoString(aGPUInfo); + char aMessage[768]; + str_format(aMessage, sizeof(aMessage), + "An assertion error occured. Please write down or take a screenshot of the following information and report this error.\n" + "Please also share the assert log which you should find in the 'dumps' folder in your config directory.\n\n" + "%s\n\n" + "Platform: %s\n" + "Game version: %s %s\n" + "OS version: %s\n\n" + "%s", // GPU info + pMsg, CONF_PLATFORM_STRING, GAME_RELEASE_VERSION, GIT_SHORTREV_HASH != nullptr ? GIT_SHORTREV_HASH : "", aVersionStr, + aGPUInfo); pClient->ShowMessageBox("Assertion Error", aMessage); // Client will crash due to assertion, don't call PerformAllCleanup in this inconsistent state }); @@ -5046,3 +5057,15 @@ void CClient::ShowMessageBox(const char *pTitle, const char *pMessage, EMessageB if(m_pGraphics == nullptr || !m_pGraphics->ShowMessageBox(GetSdlMessageBoxFlags(Type), pTitle, pMessage)) SDL_ShowSimpleMessageBox(GetSdlMessageBoxFlags(Type), pTitle, pMessage, nullptr); } + +void CClient::GetGPUInfoString(char (&aGPUInfo)[256]) +{ + if(m_pGraphics != nullptr && m_pGraphics->IsBackendInitialized()) + { + str_format(aGPUInfo, std::size(aGPUInfo), "GPU: %s - %s - %s", m_pGraphics->GetVendorString(), m_pGraphics->GetRendererString(), m_pGraphics->GetVersionString()); + } + else + { + str_copy(aGPUInfo, "Graphics backend was not yet initialized."); + } +} diff --git a/src/engine/client/client.h b/src/engine/client/client.h index be3f38e25..307ba3357 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -553,6 +553,7 @@ public: #endif void ShowMessageBox(const char *pTitle, const char *pMessage, EMessageBoxType Type = MESSAGE_BOX_TYPE_ERROR) override; + void GetGPUInfoString(char (&aGPUInfo)[256]) override; }; #endif diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index f1277c52a..5e1a003de 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -3286,6 +3286,11 @@ bool CGraphics_Threaded::ShowMessageBox(unsigned Type, const char *pTitle, const return m_pBackend->ShowMessageBox(Type, pTitle, pMsg); } +bool CGraphics_Threaded::IsBackendInitialized() +{ + return m_pBackend != nullptr; +} + const char *CGraphics_Threaded::GetVendorString() { return m_pBackend->GetVendorString(); diff --git a/src/engine/client/graphics_threaded.h b/src/engine/client/graphics_threaded.h index 03bc57ff9..18ed51120 100644 --- a/src/engine/client/graphics_threaded.h +++ b/src/engine/client/graphics_threaded.h @@ -1300,6 +1300,7 @@ public: SWarning *GetCurWarning() override; bool ShowMessageBox(unsigned Type, const char *pTitle, const char *pMsg) override; + bool IsBackendInitialized() override; bool GetDriverVersion(EGraphicsDriverAgeType DriverAgeType, int &Major, int &Minor, int &Patch, const char *&pName, EBackendType BackendType) override { return m_pBackend->GetDriverVersion(DriverAgeType, Major, Minor, Patch, pName, BackendType); } bool IsConfigModernAPI() override { return m_pBackend->IsConfigModernAPI(); } diff --git a/src/engine/graphics.h b/src/engine/graphics.h index 44f26ae00..4dae1cfce 100644 --- a/src/engine/graphics.h +++ b/src/engine/graphics.h @@ -523,6 +523,7 @@ public: // returns true if the error msg was shown virtual bool ShowMessageBox(unsigned Type, const char *pTitle, const char *pMsg) = 0; + virtual bool IsBackendInitialized() = 0; protected: inline CTextureHandle CreateTextureHandle(int Index)