about summary refs log tree commit diff
path: root/src/engine/client/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/client/client.cpp')
-rw-r--r--src/engine/client/client.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp
index b7244db4..5067f8b2 100644
--- a/src/engine/client/client.cpp
+++ b/src/engine/client/client.cpp
@@ -1690,11 +1690,24 @@ void CClient::InitInterfaces()
 	m_Friends.Init();
 }
 
+#include "SDL.h"
+
 void CClient::Run()
 {
 	m_LocalStartTime = time_get();
 	m_SnapshotParts = 0;
 
+	// init SDL
+	{
+		if(SDL_Init(0) < 0)
+		{
+			dbg_msg("client", "unable to init SDL base: %s", SDL_GetError());
+			return;
+		}
+
+		atexit(SDL_Quit); // ignore_convention
+	}
+
 	// init graphics
 	{
 		if(g_Config.m_GfxThreaded)
@@ -1713,6 +1726,9 @@ void CClient::Run()
 		}
 	}
 
+	// init sound, allowed to fail
+	m_SoundInitFailed = Sound()->Init() != 0;
+
 	// open socket
 	{
 		NETADDR BindAddr;
@@ -1737,8 +1753,6 @@ void CClient::Run()
 	// init the editor
 	//m_pEditor->Init();
 
-	// init sound, allowed to fail
-	m_SoundInitFailed = Sound()->Init() != 0;
 
 	// load data
 	if(!LoadData())
@@ -1937,6 +1951,11 @@ void CClient::Run()
 
 	m_pGraphics->Shutdown();
 	m_pSound->Shutdown();
+
+	// shutdown SDL
+	{
+		SDL_Quit();
+	}
 }