mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 22:18:19 +00:00
Show error message popup when client fails to launch
This commit is contained in:
parent
ccfca141d4
commit
3981f7ffe0
|
@ -3007,6 +3007,7 @@ void CClient::Run()
|
||||||
if(RegisterFail || m_pGraphics->Init() != 0)
|
if(RegisterFail || m_pGraphics->Init() != 0)
|
||||||
{
|
{
|
||||||
dbg_msg("client", "couldn't init graphics");
|
dbg_msg("client", "couldn't init graphics");
|
||||||
|
ShowMessageBox("Graphics Error", "The graphics could not be initialized.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3024,8 +3025,13 @@ void CClient::Run()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONF_WEBASM
|
#ifndef CONF_WEBASM
|
||||||
if(!InitNetworkClient())
|
char aNetworkError[256];
|
||||||
|
if(!InitNetworkClient(aNetworkError, sizeof(aNetworkError)))
|
||||||
|
{
|
||||||
|
dbg_msg("client", "%s", aNetworkError);
|
||||||
|
ShowMessageBox("Network Error", aNetworkError);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// init font rendering
|
// init font rendering
|
||||||
|
@ -3383,7 +3389,7 @@ void CClient::Run()
|
||||||
delete m_pEditor;
|
delete m_pEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CClient::InitNetworkClient()
|
bool CClient::InitNetworkClient(char *pError, size_t ErrorSize)
|
||||||
{
|
{
|
||||||
NETADDR BindAddr;
|
NETADDR BindAddr;
|
||||||
if(g_Config.m_Bindaddr[0] == '\0')
|
if(g_Config.m_Bindaddr[0] == '\0')
|
||||||
|
@ -3392,7 +3398,7 @@ bool CClient::InitNetworkClient()
|
||||||
}
|
}
|
||||||
else if(net_host_lookup(g_Config.m_Bindaddr, &BindAddr, NETTYPE_ALL) != 0)
|
else if(net_host_lookup(g_Config.m_Bindaddr, &BindAddr, NETTYPE_ALL) != 0)
|
||||||
{
|
{
|
||||||
dbg_msg("client", "The configured bindaddr '%s' cannot be resolved", g_Config.m_Bindaddr);
|
str_format(pError, ErrorSize, "The configured bindaddr '%s' cannot be resolved.", g_Config.m_Bindaddr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BindAddr.type = NETTYPE_ALL;
|
BindAddr.type = NETTYPE_ALL;
|
||||||
|
@ -3413,9 +3419,9 @@ bool CClient::InitNetworkClient()
|
||||||
if(RemainingAttempts == 0)
|
if(RemainingAttempts == 0)
|
||||||
{
|
{
|
||||||
if(g_Config.m_Bindaddr[0])
|
if(g_Config.m_Bindaddr[0])
|
||||||
dbg_msg("client", "Could not open network client, try changing or unsetting the bindaddr '%s'", g_Config.m_Bindaddr);
|
str_format(pError, ErrorSize, "Could not open the network client, try changing or unsetting the bindaddr '%s'.", g_Config.m_Bindaddr);
|
||||||
else
|
else
|
||||||
dbg_msg("client", "Could not open network client");
|
str_format(pError, ErrorSize, "Could not open the network client.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4614,7 +4620,9 @@ int main(int argc, const char **argv)
|
||||||
|
|
||||||
if(RandInitFailed)
|
if(RandInitFailed)
|
||||||
{
|
{
|
||||||
dbg_msg("secure", "could not initialize secure RNG");
|
const char *pError = "Failed to initialize the secure RNG.";
|
||||||
|
dbg_msg("secure", "%s", pError);
|
||||||
|
pClient->ShowMessageBox("Secure RNG Error", pError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4646,6 +4654,9 @@ int main(int argc, const char **argv)
|
||||||
|
|
||||||
if(RegisterFail)
|
if(RegisterFail)
|
||||||
{
|
{
|
||||||
|
const char *pError = "Failed to register an interface.";
|
||||||
|
dbg_msg("client", "%s", pError);
|
||||||
|
pClient->ShowMessageBox("Kernel Error", pError);
|
||||||
delete pKernel;
|
delete pKernel;
|
||||||
pClient->~CClient();
|
pClient->~CClient();
|
||||||
free(pClient);
|
free(pClient);
|
||||||
|
@ -4729,7 +4740,10 @@ int main(int argc, const char **argv)
|
||||||
// init SDL
|
// init SDL
|
||||||
if(SDL_Init(0) < 0)
|
if(SDL_Init(0) < 0)
|
||||||
{
|
{
|
||||||
dbg_msg("client", "unable to init SDL base: %s", SDL_GetError());
|
char aError[256];
|
||||||
|
str_format(aError, sizeof(aError), "Unable to initialize SDL base: %s", SDL_GetError());
|
||||||
|
dbg_msg("client", "%s", aError);
|
||||||
|
pClient->ShowMessageBox("SDL Error", aError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -425,7 +425,7 @@ public:
|
||||||
|
|
||||||
void Run();
|
void Run();
|
||||||
|
|
||||||
bool InitNetworkClient();
|
bool InitNetworkClient(char *pError, size_t ErrorSize);
|
||||||
bool CtrlShiftKey(int Key, bool &Last);
|
bool CtrlShiftKey(int Key, bool &Last);
|
||||||
|
|
||||||
static void Con_Connect(IConsole::IResult *pResult, void *pUserData);
|
static void Con_Connect(IConsole::IResult *pResult, void *pUserData);
|
||||||
|
|
Loading…
Reference in a new issue