+inline boolean SetVideoMode(void)
+{
+#ifdef TARGET_SDL
+ return SDLSetVideoMode(&backbuffer);
+#else
+ boolean success = TRUE;
+
+ if (setup.fullscreen && fullscreen_available)
+ {
+ Error(ERR_WARN, "fullscreen not available in X11 version");
+
+ /* display error message only once */
+ fullscreen_available = FALSE;
+
+ success = FALSE;
+ }
+
+ return success;
+#endif
+}
+
+inline void ChangeVideoModeIfNeeded(void)
+{
+#ifdef TARGET_SDL
+ if ((setup.fullscreen && !fullscreen_enabled && fullscreen_available) ||
+ (!setup.fullscreen && fullscreen_enabled))
+ SetVideoMode();
+#endif
+}
+
+
+/* ========================================================================= */
+/* audio functions */
+/* ========================================================================= */
+
+inline boolean OpenAudio(struct AudioSystemInfo *audio)
+{
+ audio->sound_available = FALSE;
+ audio->loops_available = FALSE;
+ audio->soundserver_pipe[0] = audio->soundserver_pipe[1] = 0;
+ audio->soundserver_pid = 0;
+ audio->device_fd = 0;
+
+#if defined(TARGET_SDL)
+ if (SDLOpenAudio())
+ {
+ audio->sound_available = TRUE;
+ audio->loops_available = TRUE;
+ }
+#elif defined(PLATFORM_MSDOS)
+ if (MSDOSOpenAudio())
+ {
+ audio->sound_available = TRUE;
+ audio->loops_available = TRUE;
+ }
+#elif defined(PLATFORM_UNIX)
+ UnixOpenAudio(audio);
+#endif
+
+ return audio->sound_available;
+}
+
+inline void CloseAudio(struct AudioSystemInfo *audio)
+{
+#if defined(TARGET_SDL)
+ SDLCloseAudio();
+#elif defined(PLATFORM_MSDOS)
+ MSDOSCloseAudio();
+#elif defined(PLATFORM_UNIX)
+ UnixCloseAudio(audio);
+#endif
+
+ audio->sound_available = FALSE;
+ audio->loops_available = FALSE;
+}
+
+
+/* ========================================================================= */
+/* event functions */
+/* ========================================================================= */
+
+inline void InitEventFilter(EventFilter filter_function)
+{
+#ifdef TARGET_SDL
+ /* set event filter to filter out certain events */
+ SDL_SetEventFilter(filter_function);
+#endif
+}
+