mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Try to fix Windows crash
This commit is contained in:
parent
f5edf53fd7
commit
6c21738d9d
|
@ -2674,7 +2674,7 @@ void CClient::InitInterfaces()
|
|||
// fetch interfaces
|
||||
m_pEngine = Kernel()->RequestInterface<IEngine>();
|
||||
m_pEditor = Kernel()->RequestInterface<IEditor>();
|
||||
m_pGraphics = Kernel()->RequestInterface<IEngineGraphics>();
|
||||
//m_pGraphics = Kernel()->RequestInterface<IEngineGraphics>();
|
||||
m_pSound = Kernel()->RequestInterface<IEngineSound>();
|
||||
m_pGameClient = Kernel()->RequestInterface<IGameClient>();
|
||||
m_pInput = Kernel()->RequestInterface<IEngineInput>();
|
||||
|
@ -2737,6 +2737,21 @@ void CClient::Run()
|
|||
atexit(SDL_Quit); // ignore_convention
|
||||
}
|
||||
|
||||
// init graphics
|
||||
{
|
||||
m_pGraphics = CreateEngineGraphicsThreaded();
|
||||
|
||||
bool RegisterFail = false;
|
||||
RegisterFail = RegisterFail || !Kernel()->RegisterInterface(static_cast<IEngineGraphics*>(m_pGraphics)); // register graphics as both
|
||||
RegisterFail = RegisterFail || !Kernel()->RegisterInterface(static_cast<IGraphics*>(m_pGraphics), false);
|
||||
|
||||
if(RegisterFail || m_pGraphics->Init() != 0)
|
||||
{
|
||||
dbg_msg("client", "couldn't init graphics");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// init sound, allowed to fail
|
||||
m_SoundInitFailed = Sound()->Init() != 0;
|
||||
|
||||
|
@ -3579,7 +3594,6 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
IConsole *pConsole = CreateConsole(CFGFLAG_CLIENT);
|
||||
IStorage *pStorage = CreateStorage("Teeworlds", IStorage::STORAGETYPE_CLIENT, argc, argv); // ignore_convention
|
||||
IConfig *pConfig = CreateConfig();
|
||||
IEngineGraphics *pGraphics = CreateEngineGraphicsThreaded();
|
||||
IEngineSound *pEngineSound = CreateEngineSound();
|
||||
IEngineInput *pEngineInput = CreateEngineInput();
|
||||
IEngineTextRender *pEngineTextRender = CreateEngineTextRender();
|
||||
|
@ -3608,9 +3622,6 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IEngineMasterServer*>(pEngineMasterServer)); // register as both
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IMasterServer*>(pEngineMasterServer), false);
|
||||
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IEngineGraphics*>(pGraphics)); // register as both
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IGraphics*>(pGraphics), false);
|
||||
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(CreateEditor());
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(CreateGameClient(), false);
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pStorage);
|
||||
|
@ -3686,15 +3697,6 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
// For XOpenIM in SDL2: https://bugzilla.libsdl.org/show_bug.cgi?id=3102
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
// init graphics
|
||||
{
|
||||
if(pGraphics->Init() != 0)
|
||||
{
|
||||
dbg_msg("client", "couldn't init graphics");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// run the client
|
||||
dbg_msg("client", "starting...");
|
||||
pClient->Run();
|
||||
|
|
Loading…
Reference in a new issue