Permalink
Browse files

Fix dedicated server for Windows

* the OpenAL function definitions mustn't include __declspec(dllimport)
  => fixed by pretending to compile OpenAL statically
* glimp.cpp shouldn't be used in dedicated-only mode (as it was already
  the case on Linux and OSX)
  => No special handling for ID_DEDICATED needed in glimp.cpp, as it's not
   used anyway
* add APIENTRY to every gl function in stub_gl.cpp for compatibility
  with windows headers and MSVC
* remove GL/gl.h #include from win_local.h as it's not needed
* in qgl.h, when building dedicated server for windows, redefine WINGDIAPI
  to nothing for SDL_opengl.h #include to get rid off __declspec(dllimport)
  by using #pragma push_macro and pop_macro, because our stub is no dll.

Fixes #39
  • Loading branch information...
1 parent 1f25568 commit 105fdb062496bb72c2204b7d8017dcd04305d195 @DanielGibson DanielGibson committed Aug 28, 2012
Showing with 361 additions and 343 deletions.
  1. +1 −1 neo/CMakeLists.txt
  2. +17 −0 neo/renderer/qgl.h
  3. +7 −0 neo/sound/snd_local.h
  4. +0 −4 neo/sys/glimp.cpp
  5. +336 −336 neo/sys/stub/stub_gl.cpp
  6. +0 −2 neo/sys/win32/win_local.h
View
@@ -693,7 +693,6 @@ elseif(WIN32)
set(src_sys_base
sys/cpu.cpp
sys/threads.cpp
- sys/glimp.cpp
sys/events.cpp
sys/sys_local.cpp
sys/win32/win_input.cpp
@@ -705,6 +704,7 @@ elseif(WIN32)
)
set(src_sys_core
+ sys/glimp.cpp
)
else()
set(src_sys_base
View
@@ -32,8 +32,25 @@ If you have questions concerning this license or the applicable additional terms
#ifndef __QGL_H__
#define __QGL_H__
+#if defined( ID_DEDICATED ) && defined( _WIN32 )
+// to allow stubbing gl on windows, define WINGDIAPI to nothing - it would otherwise be
+// extended to __declspec(dllimport) on MSVC (our stub is no dll.)
+ #ifdef WINGDIAPI
+ #pragma push_macro("WINGDIAPI")
+ #undef WINGDIAPI
+ #define WINGDIAPI
+ #endif
+#endif
+
#include <SDL_opengl.h>
+#if defined( ID_DEDICATED ) && defined( _WIN32 )
+// restore WINGDIAPI
+ #ifdef WINGDIAPI
+ #pragma pop_macro("WINGDIAPI")
+ #endif
+#endif
+
typedef void (*GLExtension_t)(void);
#ifdef __cplusplus
View
@@ -29,6 +29,13 @@ If you have questions concerning this license or the applicable additional terms
#ifndef __SND_LOCAL_H__
#define __SND_LOCAL_H__
+#ifdef ID_DEDICATED
+// stub-only mode: AL_API and ALC_API shouldn't refer to any dll-stuff
+// because the implemenations are in openal_stub.cpp
+// this is ensured by defining AL_LIBTYPE_STATIC before including the AL headers
+#define AL_LIBTYPE_STATIC
+#endif
+
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
View
@@ -287,9 +287,6 @@ GLExtension_t GLimp_ExtensionPointer(const char *name) {
}
void GLimp_GrabInput(int flags) {
-#if defined(ID_DEDICATED)
- return;
-#else
bool grab = flags & GRAB_ENABLE;
if (grab && (flags & GRAB_REENABLE))
@@ -314,5 +311,4 @@ void GLimp_GrabInput(int flags) {
SDL_ShowCursor(flags & GRAB_HIDECURSOR ? SDL_DISABLE : SDL_ENABLE);
SDL_WM_GrabInput(grab ? SDL_GRAB_ON : SDL_GRAB_OFF);
#endif
-#endif
}
Oops, something went wrong.

0 comments on commit 105fdb0

Please sign in to comment.