only bring in as many sdl things as are strictly necessary
[tangerine.git] / arch / all-hosted / hidd / sdl / sdl_init.c
blobb14db48fe6178c88bb9208e16c2dce65944c7b95
1 /*
2 * sdl.hidd - SDL graphics/sound/keyboard for AROS hosted
3 * Copyright (c) 2007 Robert Norris. All rights reserved.
4 * Copyright (c) 2007-2009 The AROS Development Team
6 * This program is free software; you can redistribute it and/or modify it
7 * under the same terms as AROS itself.
8 */
10 #include <aros/symbolsets.h>
12 #include <exec/types.h>
13 #include <proto/hostlib.h>
14 #include <proto/exec.h>
16 #define DEBUG 0
17 #include <aros/debug.h>
19 #include "sdl_intern.h"
21 #include LC_LIBDEFS_FILE
23 static int sdl_hidd_init(LIBBASETYPEPTR LIBBASE) {
24 SDL_version cver, *rver;
25 int i, ret;
26 char *err;
28 D(bug("[sdl] hidd init\n"));
30 SDL_VERSION(&cver);
31 rver = S(SDL_Linked_Version);
33 kprintf("sdl.hidd: using SDL version %d.%d.%d\n", rver->major, rver->minor, rver->patch);
35 if (cver.major != rver->major || cver.minor != rver->minor || cver.patch != rver->patch) {
36 kprintf("WARNING: sdl.hidd was compiled against SDL version %d.%d.%d\n", cver.major, cver.minor, cver.patch);
37 kprintf(" You may experience problems\n");
40 InitSemaphore(&LIBBASE->lock);
42 /* start sdl. we don't catch any signals with a debug build as it plays
43 * havoc with the debugger */
44 #if DEBUG
45 ret = S(SDL_Init, SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
46 #else
47 ret = S(SDL_Init, SDL_INIT_VIDEO);
48 #endif
50 if (ret != 0) {
51 D(bug("[sdl] couldn't initialise SDL\n"));
52 return FALSE;
55 S(SDL_ShowCursor, SDL_DISABLE);
57 return TRUE;
60 static int sdl_hidd_expunge(LIBBASETYPEPTR LIBBASE) {
61 D(bug("[sdl] hidd expunge\n"));
63 if (LIBBASE->sdl_handle)
64 SV(SDL_Quit);
66 return TRUE;
69 ADD2INITLIB(sdl_hidd_init, 1)
70 ADD2EXPUNGELIB(sdl_hidd_expunge, 1)