6673: Clear Victim Team render info on skin changes r=Robyt3 a=Jupeyy

fixes #6662

This should fix the issue, I guess, by simply clearing the render info. I can't find an easy way to restore the original skins of the team members as we don't save their IDs.
I couldn't directly trigger the assert, but I could certainly see the skin getting invalid when killen the team and switch to "vanilla only skins". (Edit: When triggering it a few times I got the assert)

The code generally looks a bit hacky. Maybe the original author can refactor it a bit

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


6676: Show GPU info (if available) in assert r=Robyt3 a=Jupeyy

first part of #6672

![image](https://github.com/ddnet/ddnet/assets/6654924/0e9aec5a-528a-4e7a-a3fa-93108e55597e)



## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Jupeyy <jupjopjap@gmail.com>
This commit is contained in:
bors[bot] 2023-05-27 09:01:26 +00:00 committed by GitHub
commit ba7b82258e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 2 deletions

View file

@ -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

View file

@ -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.");
}
}

View file

@ -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

View file

@ -3287,6 +3287,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();

View file

@ -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(); }

View file

@ -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)

View file

@ -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;