Index: trunk/nv/lib/detail/sdl_events_12.inc
===================================================================
--- trunk/nv/lib/detail/sdl_events_12.inc	(revision 170)
+++ trunk/nv/lib/detail/sdl_events_12.inc	(revision 170)
@@ -0,0 +1,171 @@
+typedef enum {
+       SDL_NOEVENT = 0,
+       SDL_ACTIVEEVENT,
+       SDL_KEYDOWN,
+       SDL_KEYUP,
+       SDL_MOUSEMOTION,
+       SDL_MOUSEBUTTONDOWN,
+       SDL_MOUSEBUTTONUP,
+       SDL_JOYAXISMOTION,
+       SDL_JOYBALLMOTION,
+       SDL_JOYHATMOTION,
+       SDL_JOYBUTTONDOWN,
+       SDL_JOYBUTTONUP,
+       SDL_QUIT,
+       SDL_SYSWMEVENT,
+       SDL_EVENT_RESERVEDA,
+       SDL_EVENT_RESERVEDB,
+       SDL_VIDEORESIZE,
+       SDL_VIDEOEXPOSE,
+       SDL_EVENT_RESERVED2,
+       SDL_EVENT_RESERVED3,
+       SDL_EVENT_RESERVED4,
+       SDL_EVENT_RESERVED5,
+       SDL_EVENT_RESERVED6,
+       SDL_EVENT_RESERVED7,
+       SDL_USEREVENT = 24,
+       SDL_NUMEVENTS = 32
+} SDL_EventType;
+
+#define SDL_EVENTMASK(X)	(1<<(X))
+typedef enum {
+	SDL_ACTIVEEVENTMASK	= SDL_EVENTMASK(SDL_ACTIVEEVENT),
+	SDL_KEYDOWNMASK		= SDL_EVENTMASK(SDL_KEYDOWN),
+	SDL_KEYUPMASK		= SDL_EVENTMASK(SDL_KEYUP),
+	SDL_KEYEVENTMASK	= SDL_EVENTMASK(SDL_KEYDOWN)|
+	                          SDL_EVENTMASK(SDL_KEYUP),
+	SDL_MOUSEMOTIONMASK	= SDL_EVENTMASK(SDL_MOUSEMOTION),
+	SDL_MOUSEBUTTONDOWNMASK	= SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
+	SDL_MOUSEBUTTONUPMASK	= SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
+	SDL_MOUSEEVENTMASK	= SDL_EVENTMASK(SDL_MOUSEMOTION)|
+	                          SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
+	                          SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
+	SDL_JOYAXISMOTIONMASK	= SDL_EVENTMASK(SDL_JOYAXISMOTION),
+	SDL_JOYBALLMOTIONMASK	= SDL_EVENTMASK(SDL_JOYBALLMOTION),
+	SDL_JOYHATMOTIONMASK	= SDL_EVENTMASK(SDL_JOYHATMOTION),
+	SDL_JOYBUTTONDOWNMASK	= SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
+	SDL_JOYBUTTONUPMASK	= SDL_EVENTMASK(SDL_JOYBUTTONUP),
+	SDL_JOYEVENTMASK	= SDL_EVENTMASK(SDL_JOYAXISMOTION)|
+	                          SDL_EVENTMASK(SDL_JOYBALLMOTION)|
+	                          SDL_EVENTMASK(SDL_JOYHATMOTION)|
+	                          SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
+	                          SDL_EVENTMASK(SDL_JOYBUTTONUP),
+	SDL_VIDEORESIZEMASK	= SDL_EVENTMASK(SDL_VIDEORESIZE),
+	SDL_VIDEOEXPOSEMASK	= SDL_EVENTMASK(SDL_VIDEOEXPOSE),
+	SDL_QUITMASK		= SDL_EVENTMASK(SDL_QUIT),
+	SDL_SYSWMEVENTMASK	= SDL_EVENTMASK(SDL_SYSWMEVENT)
+} SDL_EventMask ;
+#define SDL_ALLEVENTS		0xFFFFFFFF
+
+
+typedef struct SDL_ActiveEvent {
+	Uint8 type;
+	Uint8 gain;
+	Uint8 state;
+} SDL_ActiveEvent;
+
+typedef struct SDL_KeyboardEvent {
+	Uint8 type;	
+	Uint8 which;
+	Uint8 state;
+	SDL_keysym keysym;
+} SDL_KeyboardEvent;
+
+typedef struct SDL_MouseMotionEvent {
+	Uint8 type;
+	Uint8 which;
+	Uint8 state;
+	Uint16 x, y;
+	Sint16 xrel;
+	Sint16 yrel;
+} SDL_MouseMotionEvent;
+
+typedef struct SDL_MouseButtonEvent {
+	Uint8 type;
+	Uint8 which;
+	Uint8 button;
+	Uint8 state;
+	Uint16 x, y;
+} SDL_MouseButtonEvent;
+
+typedef struct SDL_JoyAxisEvent {
+	Uint8 type;
+	Uint8 which;
+	Uint8 axis;
+	Sint16 value;
+} SDL_JoyAxisEvent;
+
+typedef struct SDL_JoyBallEvent {
+	Uint8 type;
+	Uint8 which;
+	Uint8 ball;
+	Sint16 xrel;
+	Sint16 yrel;
+} SDL_JoyBallEvent;
+
+typedef struct SDL_JoyHatEvent {
+	Uint8 type;
+	Uint8 which;
+	Uint8 hat;
+	Uint8 value;
+} SDL_JoyHatEvent;
+
+typedef struct SDL_JoyButtonEvent {
+	Uint8 type;
+	Uint8 which;
+	Uint8 button;
+	Uint8 state;
+} SDL_JoyButtonEvent;
+
+typedef struct SDL_ResizeEvent {
+	Uint8 type;
+	int w;
+	int h;
+} SDL_ResizeEvent;
+
+typedef struct SDL_ExposeEvent {
+	Uint8 type;
+} SDL_ExposeEvent;
+
+typedef struct SDL_QuitEvent {
+	Uint8 type;
+} SDL_QuitEvent;
+
+typedef struct SDL_UserEvent {
+	Uint8 type;
+	int code;
+	void *data1;
+	void *data2;
+} SDL_UserEvent;
+
+struct SDL_SysWMmsg;
+typedef struct SDL_SysWMmsg SDL_SysWMmsg;
+typedef struct SDL_SysWMEvent {
+	Uint8 type;
+	SDL_SysWMmsg *msg;
+} SDL_SysWMEvent;
+
+typedef union SDL_Event {
+	Uint8 type;
+	SDL_ActiveEvent active;
+	SDL_KeyboardEvent key;
+	SDL_MouseMotionEvent motion;
+	SDL_MouseButtonEvent button;
+	SDL_JoyAxisEvent jaxis;
+	SDL_JoyBallEvent jball;
+	SDL_JoyHatEvent jhat;
+	SDL_JoyButtonEvent jbutton;
+	SDL_ResizeEvent resize;
+	SDL_ExposeEvent expose;
+	SDL_QuitEvent quit;
+	SDL_UserEvent user;
+	SDL_SysWMEvent syswm;
+} SDL_Event;
+
+typedef enum {
+	SDL_ADDEVENT,
+	SDL_PEEKEVENT,
+	SDL_GETEVENT
+} SDL_eventaction;
+
+typedef int (NV_SDL_APIENTRY *SDL_EventFilter)(const SDL_Event *event);
Index: trunk/nv/lib/detail/sdl_events_20.inc
===================================================================
--- trunk/nv/lib/detail/sdl_events_20.inc	(revision 170)
+++ trunk/nv/lib/detail/sdl_events_20.inc	(revision 170)
@@ -0,0 +1,335 @@
+typedef enum
+{
+    SDL_FIRSTEVENT     = 0,
+    SDL_QUIT           = 0x100, 
+    SDL_APP_TERMINATING,
+    SDL_APP_LOWMEMORY, 
+    SDL_APP_WILLENTERBACKGROUND, 
+    SDL_APP_DIDENTERBACKGROUND,
+    SDL_APP_WILLENTERFOREGROUND,
+    SDL_APP_DIDENTERFOREGROUND, 
+    SDL_WINDOWEVENT    = 0x200,
+    SDL_SYSWMEVENT,   
+    SDL_KEYDOWN        = 0x300,
+    SDL_KEYUP,
+    SDL_TEXTEDITING, 
+    SDL_TEXTINPUT,
+    SDL_MOUSEMOTION    = 0x400, 
+    SDL_MOUSEBUTTONDOWN, 
+    SDL_MOUSEBUTTONUP, 
+    SDL_MOUSEWHEEL, 
+    SDL_JOYAXISMOTION  = 0x600,
+    SDL_JOYBALLMOTION,
+    SDL_JOYHATMOTION,
+    SDL_JOYBUTTONDOWN,
+    SDL_JOYBUTTONUP, 
+    SDL_JOYDEVICEADDED,
+    SDL_JOYDEVICEREMOVED,
+    SDL_CONTROLLERAXISMOTION  = 0x650,
+    SDL_CONTROLLERBUTTONDOWN,
+    SDL_CONTROLLERBUTTONUP, 
+    SDL_CONTROLLERDEVICEADDED,
+    SDL_CONTROLLERDEVICEREMOVED,
+    SDL_CONTROLLERDEVICEREMAPPED,
+    SDL_FINGERDOWN      = 0x700,
+    SDL_FINGERUP,
+    SDL_FINGERMOTION,
+    SDL_DOLLARGESTURE   = 0x800,
+    SDL_DOLLARRECORD,
+    SDL_MULTIGESTURE,
+    SDL_CLIPBOARDUPDATE = 0x900,
+    SDL_DROPFILE        = 0x1000,
+    SDL_USEREVENT    = 0x8000,
+    SDL_LASTEVENT    = 0xFFFF
+} SDL_EventType;
+
+typedef struct SDL_CommonEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+} SDL_CommonEvent;
+ 
+typedef struct SDL_WindowEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    Uint32 windowID;
+    Uint8 event;
+    Uint8 padding1;
+    Uint8 padding2;
+    Uint8 padding3;
+    Sint32 data1;
+    Sint32 data2;
+} SDL_WindowEvent;
+
+typedef struct SDL_KeyboardEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    Uint32 windowID;
+    Uint8 state;
+    Uint8 repeat;
+    Uint8 padding2;
+    Uint8 padding3;
+    SDL_Keysym keysym; 
+} SDL_KeyboardEvent;
+
+#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
+typedef struct SDL_TextEditingEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    Uint32 windowID;
+    char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
+    Sint32 start;
+    Sint32 length;
+} SDL_TextEditingEvent;
+
+
+#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
+typedef struct SDL_TextInputEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    Uint32 windowID;
+    char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
+} SDL_TextInputEvent;
+
+typedef struct SDL_MouseMotionEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    Uint32 windowID;
+    Uint32 which;
+    Uint32 state;
+    Sint32 x;
+    Sint32 y;
+    Sint32 xrel;
+    Sint32 yrel;
+} SDL_MouseMotionEvent;
+
+typedef struct SDL_MouseButtonEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    Uint32 windowID;
+    Uint32 which;
+    Uint8 button;
+    Uint8 state;
+    Uint8 padding1;
+    Uint8 padding2;
+    Sint32 x;
+    Sint32 y;
+} SDL_MouseButtonEvent;
+
+typedef struct SDL_MouseWheelEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    Uint32 windowID;
+    Uint32 which;
+    Sint32 x;
+    Sint32 y; 
+} SDL_MouseWheelEvent;
+
+typedef struct SDL_JoyAxisEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    SDL_JoystickID which;
+    Uint8 axis;
+    Uint8 padding1;
+    Uint8 padding2;
+    Uint8 padding3;
+    Sint16 value;
+    Uint16 padding4;
+} SDL_JoyAxisEvent;
+
+typedef struct SDL_JoyBallEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    SDL_JoystickID which;
+    Uint8 ball;
+    Uint8 padding1;
+    Uint8 padding2;
+    Uint8 padding3;
+    Sint16 xrel;
+    Sint16 yrel;
+} SDL_JoyBallEvent;
+
+typedef struct SDL_JoyHatEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    SDL_JoystickID which;
+    Uint8 hat;
+    Uint8 value;
+    Uint8 padding1;
+    Uint8 padding2;
+} SDL_JoyHatEvent;
+
+typedef struct SDL_JoyButtonEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    SDL_JoystickID which;
+    Uint8 button;
+    Uint8 state;
+    Uint8 padding1;
+    Uint8 padding2;
+} SDL_JoyButtonEvent;
+
+typedef struct SDL_JoyDeviceEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    Sint32 which;
+} SDL_JoyDeviceEvent;
+
+typedef struct SDL_ControllerAxisEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    SDL_JoystickID which;
+    Uint8 axis;
+    Uint8 padding1;
+    Uint8 padding2;
+    Uint8 padding3;
+    Sint16 value;
+    Uint16 padding4;
+} SDL_ControllerAxisEvent;
+
+typedef struct SDL_ControllerButtonEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    SDL_JoystickID which;
+    Uint8 button;
+    Uint8 state;
+    Uint8 padding1;
+    Uint8 padding2;
+} SDL_ControllerButtonEvent;
+
+typedef struct SDL_ControllerDeviceEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    Sint32 which;
+} SDL_ControllerDeviceEvent;
+
+typedef struct SDL_TouchFingerEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    SDL_TouchID touchId;
+    SDL_FingerID fingerId;
+    float x;
+    float y;
+    float dx;
+    float dy; 
+    float pressure;
+} SDL_TouchFingerEvent;
+
+typedef struct SDL_MultiGestureEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    SDL_TouchID touchId;
+    float dTheta;
+    float dDist;
+    float x;
+    float y;
+    Uint16 numFingers;
+    Uint16 padding;
+} SDL_MultiGestureEvent;
+
+typedef struct SDL_DollarGestureEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    SDL_TouchID touchId;
+    SDL_GestureID gestureId;
+    Uint32 numFingers;
+    float error;
+    float x;
+    float y;
+} SDL_DollarGestureEvent;
+
+typedef struct SDL_DropEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    char *file;
+} SDL_DropEvent;
+
+
+typedef struct SDL_QuitEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+} SDL_QuitEvent;
+
+typedef struct SDL_OSEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+} SDL_OSEvent;
+
+typedef struct SDL_UserEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    Uint32 windowID;
+    Sint32 code;
+    void *data1;
+    void *data2;
+} SDL_UserEvent;
+
+
+struct SDL_SysWMmsg;
+typedef struct SDL_SysWMmsg SDL_SysWMmsg;
+
+typedef struct SDL_SysWMEvent
+{
+    Uint32 type;
+    Uint32 timestamp;
+    SDL_SysWMmsg *msg;
+} SDL_SysWMEvent;
+
+typedef union SDL_Event
+{
+    Uint32 type;
+    SDL_CommonEvent common;
+    SDL_WindowEvent window;
+    SDL_KeyboardEvent key;
+    SDL_TextEditingEvent edit;
+    SDL_TextInputEvent text;
+    SDL_MouseMotionEvent motion;
+    SDL_MouseButtonEvent button;
+    SDL_MouseWheelEvent wheel;
+    SDL_JoyAxisEvent jaxis;
+    SDL_JoyBallEvent jball;
+    SDL_JoyHatEvent jhat;
+    SDL_JoyButtonEvent jbutton;
+    SDL_JoyDeviceEvent jdevice;
+    SDL_ControllerAxisEvent caxis;
+    SDL_ControllerButtonEvent cbutton;
+    SDL_ControllerDeviceEvent cdevice;
+    SDL_QuitEvent quit;
+    SDL_UserEvent user;
+    SDL_SysWMEvent syswm;
+    SDL_TouchFingerEvent tfinger;
+    SDL_MultiGestureEvent mgesture;
+    SDL_DollarGestureEvent dgesture;
+    SDL_DropEvent drop;
+    Uint8 padding[56];
+} SDL_Event;
+
+typedef enum
+{
+    SDL_ADDEVENT,
+    SDL_PEEKEVENT,
+    SDL_GETEVENT
+} SDL_eventaction;
+ 
Index: trunk/nv/lib/detail/sdl_keys_12.inc
===================================================================
--- trunk/nv/lib/detail/sdl_keys_12.inc	(revision 170)
+++ trunk/nv/lib/detail/sdl_keys_12.inc	(revision 170)
@@ -0,0 +1,236 @@
+typedef enum {
+	SDLK_UNKNOWN		= 0,
+	SDLK_FIRST		= 0,
+	SDLK_BACKSPACE		= 8,
+	SDLK_TAB		= 9,
+	SDLK_CLEAR		= 12,
+	SDLK_RETURN		= 13,
+	SDLK_PAUSE		= 19,
+	SDLK_ESCAPE		= 27,
+	SDLK_SPACE		= 32,
+	SDLK_EXCLAIM		= 33,
+	SDLK_QUOTEDBL		= 34,
+	SDLK_HASH		= 35,
+	SDLK_DOLLAR		= 36,
+	SDLK_AMPERSAND		= 38,
+	SDLK_QUOTE		= 39,
+	SDLK_LEFTPAREN		= 40,
+	SDLK_RIGHTPAREN		= 41,
+	SDLK_ASTERISK		= 42,
+	SDLK_PLUS		= 43,
+	SDLK_COMMA		= 44,
+	SDLK_MINUS		= 45,
+	SDLK_PERIOD		= 46,
+	SDLK_SLASH		= 47,
+	SDLK_0			= 48,
+	SDLK_1			= 49,
+	SDLK_2			= 50,
+	SDLK_3			= 51,
+	SDLK_4			= 52,
+	SDLK_5			= 53,
+	SDLK_6			= 54,
+	SDLK_7			= 55,
+	SDLK_8			= 56,
+	SDLK_9			= 57,
+	SDLK_COLON		= 58,
+	SDLK_SEMICOLON		= 59,
+	SDLK_LESS		= 60,
+	SDLK_EQUALS		= 61,
+	SDLK_GREATER		= 62,
+	SDLK_QUESTION		= 63,
+	SDLK_AT			= 64,
+	SDLK_LEFTBRACKET	= 91,
+	SDLK_BACKSLASH		= 92,
+	SDLK_RIGHTBRACKET	= 93,
+	SDLK_CARET		= 94,
+	SDLK_UNDERSCORE		= 95,
+	SDLK_BACKQUOTE		= 96,
+	SDLK_a			= 97,
+	SDLK_b			= 98,
+	SDLK_c			= 99,
+	SDLK_d			= 100,
+	SDLK_e			= 101,
+	SDLK_f			= 102,
+	SDLK_g			= 103,
+	SDLK_h			= 104,
+	SDLK_i			= 105,
+	SDLK_j			= 106,
+	SDLK_k			= 107,
+	SDLK_l			= 108,
+	SDLK_m			= 109,
+	SDLK_n			= 110,
+	SDLK_o			= 111,
+	SDLK_p			= 112,
+	SDLK_q			= 113,
+	SDLK_r			= 114,
+	SDLK_s			= 115,
+	SDLK_t			= 116,
+	SDLK_u			= 117,
+	SDLK_v			= 118,
+	SDLK_w			= 119,
+	SDLK_x			= 120,
+	SDLK_y			= 121,
+	SDLK_z			= 122,
+	SDLK_DELETE		= 127,
+	SDLK_WORLD_0		= 160,
+	SDLK_WORLD_1		= 161,
+	SDLK_WORLD_2		= 162,
+	SDLK_WORLD_3		= 163,
+	SDLK_WORLD_4		= 164,
+	SDLK_WORLD_5		= 165,
+	SDLK_WORLD_6		= 166,
+	SDLK_WORLD_7		= 167,
+	SDLK_WORLD_8		= 168,
+	SDLK_WORLD_9		= 169,
+	SDLK_WORLD_10		= 170,
+	SDLK_WORLD_11		= 171,
+	SDLK_WORLD_12		= 172,
+	SDLK_WORLD_13		= 173,
+	SDLK_WORLD_14		= 174,
+	SDLK_WORLD_15		= 175,
+	SDLK_WORLD_16		= 176,
+	SDLK_WORLD_17		= 177,
+	SDLK_WORLD_18		= 178,
+	SDLK_WORLD_19		= 179,
+	SDLK_WORLD_20		= 180,
+	SDLK_WORLD_21		= 181,
+	SDLK_WORLD_22		= 182,
+	SDLK_WORLD_23		= 183,
+	SDLK_WORLD_24		= 184,
+	SDLK_WORLD_25		= 185,
+	SDLK_WORLD_26		= 186,
+	SDLK_WORLD_27		= 187,
+	SDLK_WORLD_28		= 188,
+	SDLK_WORLD_29		= 189,
+	SDLK_WORLD_30		= 190,
+	SDLK_WORLD_31		= 191,
+	SDLK_WORLD_32		= 192,
+	SDLK_WORLD_33		= 193,
+	SDLK_WORLD_34		= 194,
+	SDLK_WORLD_35		= 195,
+	SDLK_WORLD_36		= 196,
+	SDLK_WORLD_37		= 197,
+	SDLK_WORLD_38		= 198,
+	SDLK_WORLD_39		= 199,
+	SDLK_WORLD_40		= 200,
+	SDLK_WORLD_41		= 201,
+	SDLK_WORLD_42		= 202,
+	SDLK_WORLD_43		= 203,
+	SDLK_WORLD_44		= 204,
+	SDLK_WORLD_45		= 205,
+	SDLK_WORLD_46		= 206,
+	SDLK_WORLD_47		= 207,
+	SDLK_WORLD_48		= 208,
+	SDLK_WORLD_49		= 209,
+	SDLK_WORLD_50		= 210,
+	SDLK_WORLD_51		= 211,
+	SDLK_WORLD_52		= 212,
+	SDLK_WORLD_53		= 213,
+	SDLK_WORLD_54		= 214,
+	SDLK_WORLD_55		= 215,
+	SDLK_WORLD_56		= 216,
+	SDLK_WORLD_57		= 217,
+	SDLK_WORLD_58		= 218,
+	SDLK_WORLD_59		= 219,
+	SDLK_WORLD_60		= 220,
+	SDLK_WORLD_61		= 221,
+	SDLK_WORLD_62		= 222,
+	SDLK_WORLD_63		= 223,
+	SDLK_WORLD_64		= 224,
+	SDLK_WORLD_65		= 225,
+	SDLK_WORLD_66		= 226,
+	SDLK_WORLD_67		= 227,
+	SDLK_WORLD_68		= 228,
+	SDLK_WORLD_69		= 229,
+	SDLK_WORLD_70		= 230,
+	SDLK_WORLD_71		= 231,
+	SDLK_WORLD_72		= 232,
+	SDLK_WORLD_73		= 233,
+	SDLK_WORLD_74		= 234,
+	SDLK_WORLD_75		= 235,
+	SDLK_WORLD_76		= 236,
+	SDLK_WORLD_77		= 237,
+	SDLK_WORLD_78		= 238,
+	SDLK_WORLD_79		= 239,
+	SDLK_WORLD_80		= 240,
+	SDLK_WORLD_81		= 241,
+	SDLK_WORLD_82		= 242,
+	SDLK_WORLD_83		= 243,
+	SDLK_WORLD_84		= 244,
+	SDLK_WORLD_85		= 245,
+	SDLK_WORLD_86		= 246,
+	SDLK_WORLD_87		= 247,
+	SDLK_WORLD_88		= 248,
+	SDLK_WORLD_89		= 249,
+	SDLK_WORLD_90		= 250,
+	SDLK_WORLD_91		= 251,
+	SDLK_WORLD_92		= 252,
+	SDLK_WORLD_93		= 253,
+	SDLK_WORLD_94		= 254,
+	SDLK_WORLD_95		= 255,
+	SDLK_KP0		= 256,
+	SDLK_KP1		= 257,
+	SDLK_KP2		= 258,
+	SDLK_KP3		= 259,
+	SDLK_KP4		= 260,
+	SDLK_KP5		= 261,
+	SDLK_KP6		= 262,
+	SDLK_KP7		= 263,
+	SDLK_KP8		= 264,
+	SDLK_KP9		= 265,
+	SDLK_KP_PERIOD		= 266,
+	SDLK_KP_DIVIDE		= 267,
+	SDLK_KP_MULTIPLY	= 268,
+	SDLK_KP_MINUS		= 269,
+	SDLK_KP_PLUS		= 270,
+	SDLK_KP_ENTER		= 271,
+	SDLK_KP_EQUALS		= 272,
+	SDLK_UP			= 273,
+	SDLK_DOWN		= 274,
+	SDLK_RIGHT		= 275,
+	SDLK_LEFT		= 276,
+	SDLK_INSERT		= 277,
+	SDLK_HOME		= 278,
+	SDLK_END		= 279,
+	SDLK_PAGEUP		= 280,
+	SDLK_PAGEDOWN		= 281,
+	SDLK_F1			= 282,
+	SDLK_F2			= 283,
+	SDLK_F3			= 284,
+	SDLK_F4			= 285,
+	SDLK_F5			= 286,
+	SDLK_F6			= 287,
+	SDLK_F7			= 288,
+	SDLK_F8			= 289,
+	SDLK_F9			= 290,
+	SDLK_F10		= 291,
+	SDLK_F11		= 292,
+	SDLK_F12		= 293,
+	SDLK_F13		= 294,
+	SDLK_F14		= 295,
+	SDLK_F15		= 296,
+	SDLK_NUMLOCK		= 300,
+	SDLK_CAPSLOCK		= 301,
+	SDLK_SCROLLOCK		= 302,
+	SDLK_RSHIFT		= 303,
+	SDLK_LSHIFT		= 304,
+	SDLK_RCTRL		= 305,
+	SDLK_LCTRL		= 306,
+	SDLK_RALT		= 307,
+	SDLK_LALT		= 308,
+	SDLK_RMETA		= 309,
+	SDLK_LMETA		= 310,
+	SDLK_LSUPER		= 311,
+	SDLK_RSUPER		= 312,
+	SDLK_MODE		= 313,
+	SDLK_COMPOSE		= 314,
+	SDLK_HELP		= 315,
+	SDLK_PRINT		= 316,
+	SDLK_SYSREQ		= 317,
+	SDLK_BREAK		= 318,
+	SDLK_MENU		= 319,
+	SDLK_POWER		= 320,
+	SDLK_EURO		= 321,
+	SDLK_UNDO		= 322,
+	SDLK_LAST
+} SDLKey;
Index: trunk/nv/lib/detail/sdl_keys_20.inc
===================================================================
--- trunk/nv/lib/detail/sdl_keys_20.inc	(revision 170)
+++ trunk/nv/lib/detail/sdl_keys_20.inc	(revision 170)
@@ -0,0 +1,534 @@
+typedef enum
+{
+    SDL_SCANCODE_UNKNOWN = 0,
+
+    SDL_SCANCODE_A = 4,
+    SDL_SCANCODE_B = 5,
+    SDL_SCANCODE_C = 6,
+    SDL_SCANCODE_D = 7,
+    SDL_SCANCODE_E = 8,
+    SDL_SCANCODE_F = 9,
+    SDL_SCANCODE_G = 10,
+    SDL_SCANCODE_H = 11,
+    SDL_SCANCODE_I = 12,
+    SDL_SCANCODE_J = 13,
+    SDL_SCANCODE_K = 14,
+    SDL_SCANCODE_L = 15,
+    SDL_SCANCODE_M = 16,
+    SDL_SCANCODE_N = 17,
+    SDL_SCANCODE_O = 18,
+    SDL_SCANCODE_P = 19,
+    SDL_SCANCODE_Q = 20,
+    SDL_SCANCODE_R = 21,
+    SDL_SCANCODE_S = 22,
+    SDL_SCANCODE_T = 23,
+    SDL_SCANCODE_U = 24,
+    SDL_SCANCODE_V = 25,
+    SDL_SCANCODE_W = 26,
+    SDL_SCANCODE_X = 27,
+    SDL_SCANCODE_Y = 28,
+    SDL_SCANCODE_Z = 29,
+
+    SDL_SCANCODE_1 = 30,
+    SDL_SCANCODE_2 = 31,
+    SDL_SCANCODE_3 = 32,
+    SDL_SCANCODE_4 = 33,
+    SDL_SCANCODE_5 = 34,
+    SDL_SCANCODE_6 = 35,
+    SDL_SCANCODE_7 = 36,
+    SDL_SCANCODE_8 = 37,
+    SDL_SCANCODE_9 = 38,
+    SDL_SCANCODE_0 = 39,
+
+    SDL_SCANCODE_RETURN = 40,
+    SDL_SCANCODE_ESCAPE = 41,
+    SDL_SCANCODE_BACKSPACE = 42,
+    SDL_SCANCODE_TAB = 43,
+    SDL_SCANCODE_SPACE = 44,
+
+    SDL_SCANCODE_MINUS = 45,
+    SDL_SCANCODE_EQUALS = 46,
+    SDL_SCANCODE_LEFTBRACKET = 47,
+    SDL_SCANCODE_RIGHTBRACKET = 48,
+    SDL_SCANCODE_BACKSLASH = 49,
+    SDL_SCANCODE_NONUSHASH = 50,
+    SDL_SCANCODE_SEMICOLON = 51,
+    SDL_SCANCODE_APOSTROPHE = 52,
+    SDL_SCANCODE_GRAVE = 53,
+    SDL_SCANCODE_COMMA = 54,
+    SDL_SCANCODE_PERIOD = 55,
+    SDL_SCANCODE_SLASH = 56,
+
+    SDL_SCANCODE_CAPSLOCK = 57,
+
+    SDL_SCANCODE_F1 = 58,
+    SDL_SCANCODE_F2 = 59,
+    SDL_SCANCODE_F3 = 60,
+    SDL_SCANCODE_F4 = 61,
+    SDL_SCANCODE_F5 = 62,
+    SDL_SCANCODE_F6 = 63,
+    SDL_SCANCODE_F7 = 64,
+    SDL_SCANCODE_F8 = 65,
+    SDL_SCANCODE_F9 = 66,
+    SDL_SCANCODE_F10 = 67,
+    SDL_SCANCODE_F11 = 68,
+    SDL_SCANCODE_F12 = 69,
+
+    SDL_SCANCODE_PRINTSCREEN = 70,
+    SDL_SCANCODE_SCROLLLOCK = 71,
+    SDL_SCANCODE_PAUSE = 72,
+    SDL_SCANCODE_INSERT = 73,
+    SDL_SCANCODE_HOME = 74,
+    SDL_SCANCODE_PAGEUP = 75,
+    SDL_SCANCODE_DELETE = 76,
+    SDL_SCANCODE_END = 77,
+    SDL_SCANCODE_PAGEDOWN = 78,
+    SDL_SCANCODE_RIGHT = 79,
+    SDL_SCANCODE_LEFT = 80,
+    SDL_SCANCODE_DOWN = 81,
+    SDL_SCANCODE_UP = 82,
+
+    SDL_SCANCODE_NUMLOCKCLEAR = 83,
+    SDL_SCANCODE_KP_DIVIDE = 84,
+    SDL_SCANCODE_KP_MULTIPLY = 85,
+    SDL_SCANCODE_KP_MINUS = 86,
+    SDL_SCANCODE_KP_PLUS = 87,
+    SDL_SCANCODE_KP_ENTER = 88,
+    SDL_SCANCODE_KP_1 = 89,
+    SDL_SCANCODE_KP_2 = 90,
+    SDL_SCANCODE_KP_3 = 91,
+    SDL_SCANCODE_KP_4 = 92,
+    SDL_SCANCODE_KP_5 = 93,
+    SDL_SCANCODE_KP_6 = 94,
+    SDL_SCANCODE_KP_7 = 95,
+    SDL_SCANCODE_KP_8 = 96,
+    SDL_SCANCODE_KP_9 = 97,
+    SDL_SCANCODE_KP_0 = 98,
+    SDL_SCANCODE_KP_PERIOD = 99,
+	SDL_SCANCODE_NONUSBACKSLASH = 100,
+    SDL_SCANCODE_APPLICATION = 101,
+    SDL_SCANCODE_POWER = 102,
+    SDL_SCANCODE_KP_EQUALS = 103,
+    SDL_SCANCODE_F13 = 104,
+    SDL_SCANCODE_F14 = 105,
+    SDL_SCANCODE_F15 = 106,
+    SDL_SCANCODE_F16 = 107,
+    SDL_SCANCODE_F17 = 108,
+    SDL_SCANCODE_F18 = 109,
+    SDL_SCANCODE_F19 = 110,
+    SDL_SCANCODE_F20 = 111,
+    SDL_SCANCODE_F21 = 112,
+    SDL_SCANCODE_F22 = 113,
+    SDL_SCANCODE_F23 = 114,
+    SDL_SCANCODE_F24 = 115,
+    SDL_SCANCODE_EXECUTE = 116,
+    SDL_SCANCODE_HELP = 117,
+    SDL_SCANCODE_MENU = 118,
+    SDL_SCANCODE_SELECT = 119,
+    SDL_SCANCODE_STOP = 120,
+    SDL_SCANCODE_AGAIN = 121,
+    SDL_SCANCODE_UNDO = 122,
+    SDL_SCANCODE_CUT = 123,
+    SDL_SCANCODE_COPY = 124,
+    SDL_SCANCODE_PASTE = 125,
+    SDL_SCANCODE_FIND = 126,
+    SDL_SCANCODE_MUTE = 127,
+    SDL_SCANCODE_VOLUMEUP = 128,
+    SDL_SCANCODE_VOLUMEDOWN = 129,
+    SDL_SCANCODE_KP_COMMA = 133,
+    SDL_SCANCODE_KP_EQUALSAS400 = 134,
+
+    SDL_SCANCODE_INTERNATIONAL1 = 135,
+    SDL_SCANCODE_INTERNATIONAL2 = 136,
+    SDL_SCANCODE_INTERNATIONAL3 = 137,
+    SDL_SCANCODE_INTERNATIONAL4 = 138,
+    SDL_SCANCODE_INTERNATIONAL5 = 139,
+    SDL_SCANCODE_INTERNATIONAL6 = 140,
+    SDL_SCANCODE_INTERNATIONAL7 = 141,
+    SDL_SCANCODE_INTERNATIONAL8 = 142,
+    SDL_SCANCODE_INTERNATIONAL9 = 143,
+    SDL_SCANCODE_LANG1 = 144,
+    SDL_SCANCODE_LANG2 = 145,
+    SDL_SCANCODE_LANG3 = 146,
+    SDL_SCANCODE_LANG4 = 147,
+    SDL_SCANCODE_LANG5 = 148,
+    SDL_SCANCODE_LANG6 = 149,
+    SDL_SCANCODE_LANG7 = 150,
+    SDL_SCANCODE_LANG8 = 151,
+    SDL_SCANCODE_LANG9 = 152,
+
+    SDL_SCANCODE_ALTERASE = 153, 
+    SDL_SCANCODE_SYSREQ = 154,
+    SDL_SCANCODE_CANCEL = 155,
+    SDL_SCANCODE_CLEAR = 156,
+    SDL_SCANCODE_PRIOR = 157,
+    SDL_SCANCODE_RETURN2 = 158,
+    SDL_SCANCODE_SEPARATOR = 159,
+    SDL_SCANCODE_OUT = 160,
+    SDL_SCANCODE_OPER = 161,
+    SDL_SCANCODE_CLEARAGAIN = 162,
+    SDL_SCANCODE_CRSEL = 163,
+    SDL_SCANCODE_EXSEL = 164,
+
+    SDL_SCANCODE_KP_00 = 176,
+    SDL_SCANCODE_KP_000 = 177,
+    SDL_SCANCODE_THOUSANDSSEPARATOR = 178,
+    SDL_SCANCODE_DECIMALSEPARATOR = 179,
+    SDL_SCANCODE_CURRENCYUNIT = 180,
+    SDL_SCANCODE_CURRENCYSUBUNIT = 181,
+    SDL_SCANCODE_KP_LEFTPAREN = 182,
+    SDL_SCANCODE_KP_RIGHTPAREN = 183,
+    SDL_SCANCODE_KP_LEFTBRACE = 184,
+    SDL_SCANCODE_KP_RIGHTBRACE = 185,
+    SDL_SCANCODE_KP_TAB = 186,
+    SDL_SCANCODE_KP_BACKSPACE = 187,
+    SDL_SCANCODE_KP_A = 188,
+    SDL_SCANCODE_KP_B = 189,
+    SDL_SCANCODE_KP_C = 190,
+    SDL_SCANCODE_KP_D = 191,
+    SDL_SCANCODE_KP_E = 192,
+    SDL_SCANCODE_KP_F = 193,
+    SDL_SCANCODE_KP_XOR = 194,
+    SDL_SCANCODE_KP_POWER = 195,
+    SDL_SCANCODE_KP_PERCENT = 196,
+    SDL_SCANCODE_KP_LESS = 197,
+    SDL_SCANCODE_KP_GREATER = 198,
+    SDL_SCANCODE_KP_AMPERSAND = 199,
+    SDL_SCANCODE_KP_DBLAMPERSAND = 200,
+    SDL_SCANCODE_KP_VERTICALBAR = 201,
+    SDL_SCANCODE_KP_DBLVERTICALBAR = 202,
+    SDL_SCANCODE_KP_COLON = 203,
+    SDL_SCANCODE_KP_HASH = 204,
+    SDL_SCANCODE_KP_SPACE = 205,
+    SDL_SCANCODE_KP_AT = 206,
+    SDL_SCANCODE_KP_EXCLAM = 207,
+    SDL_SCANCODE_KP_MEMSTORE = 208,
+    SDL_SCANCODE_KP_MEMRECALL = 209,
+    SDL_SCANCODE_KP_MEMCLEAR = 210,
+    SDL_SCANCODE_KP_MEMADD = 211,
+    SDL_SCANCODE_KP_MEMSUBTRACT = 212,
+    SDL_SCANCODE_KP_MEMMULTIPLY = 213,
+    SDL_SCANCODE_KP_MEMDIVIDE = 214,
+    SDL_SCANCODE_KP_PLUSMINUS = 215,
+    SDL_SCANCODE_KP_CLEAR = 216,
+    SDL_SCANCODE_KP_CLEARENTRY = 217,
+    SDL_SCANCODE_KP_BINARY = 218,
+    SDL_SCANCODE_KP_OCTAL = 219,
+    SDL_SCANCODE_KP_DECIMAL = 220,
+    SDL_SCANCODE_KP_HEXADECIMAL = 221,
+
+    SDL_SCANCODE_LCTRL = 224,
+    SDL_SCANCODE_LSHIFT = 225,
+    SDL_SCANCODE_LALT = 226,
+    SDL_SCANCODE_LGUI = 227,
+    SDL_SCANCODE_RCTRL = 228,
+    SDL_SCANCODE_RSHIFT = 229,
+    SDL_SCANCODE_RALT = 230, 
+    SDL_SCANCODE_RGUI = 231, 
+
+    SDL_SCANCODE_MODE = 257,  
+
+    SDL_SCANCODE_AUDIONEXT = 258,
+    SDL_SCANCODE_AUDIOPREV = 259,
+    SDL_SCANCODE_AUDIOSTOP = 260,
+    SDL_SCANCODE_AUDIOPLAY = 261,
+    SDL_SCANCODE_AUDIOMUTE = 262,
+    SDL_SCANCODE_MEDIASELECT = 263,
+    SDL_SCANCODE_WWW = 264,
+    SDL_SCANCODE_MAIL = 265,
+    SDL_SCANCODE_CALCULATOR = 266,
+    SDL_SCANCODE_COMPUTER = 267,
+    SDL_SCANCODE_AC_SEARCH = 268,
+    SDL_SCANCODE_AC_HOME = 269,
+    SDL_SCANCODE_AC_BACK = 270,
+    SDL_SCANCODE_AC_FORWARD = 271,
+    SDL_SCANCODE_AC_STOP = 272,
+    SDL_SCANCODE_AC_REFRESH = 273,
+    SDL_SCANCODE_AC_BOOKMARKS = 274,
+
+    SDL_SCANCODE_BRIGHTNESSDOWN = 275,
+    SDL_SCANCODE_BRIGHTNESSUP = 276,
+    SDL_SCANCODE_DISPLAYSWITCH = 277, 
+    SDL_SCANCODE_KBDILLUMTOGGLE = 278,
+    SDL_SCANCODE_KBDILLUMDOWN = 279,
+    SDL_SCANCODE_KBDILLUMUP = 280,
+    SDL_SCANCODE_EJECT = 281,
+    SDL_SCANCODE_SLEEP = 282,
+
+    SDL_SCANCODE_APP1 = 283,
+    SDL_SCANCODE_APP2 = 284,
+
+    SDL_NUM_SCANCODES = 512
+} SDL_Scancode;
+ 
+
+#define SDLK_SCANCODE_MASK (1<<30)
+#define SDL_SCANCODE_TO_KEYCODE(X)  (X | SDLK_SCANCODE_MASK)
+
+enum
+{
+    SDLK_UNKNOWN = 0,
+
+    SDLK_RETURN = '\r',
+    SDLK_ESCAPE = '\033',
+    SDLK_BACKSPACE = '\b',
+    SDLK_TAB = '\t',
+    SDLK_SPACE = ' ',
+    SDLK_EXCLAIM = '!',
+    SDLK_QUOTEDBL = '"',
+    SDLK_HASH = '#',
+    SDLK_PERCENT = '%',
+    SDLK_DOLLAR = '$',
+    SDLK_AMPERSAND = '&',
+    SDLK_QUOTE = '\'',
+    SDLK_LEFTPAREN = '(',
+    SDLK_RIGHTPAREN = ')',
+    SDLK_ASTERISK = '*',
+    SDLK_PLUS = '+',
+    SDLK_COMMA = ',',
+    SDLK_MINUS = '-',
+    SDLK_PERIOD = '.',
+    SDLK_SLASH = '/',
+    SDLK_0 = '0',
+    SDLK_1 = '1',
+    SDLK_2 = '2',
+    SDLK_3 = '3',
+    SDLK_4 = '4',
+    SDLK_5 = '5',
+    SDLK_6 = '6',
+    SDLK_7 = '7',
+    SDLK_8 = '8',
+    SDLK_9 = '9',
+    SDLK_COLON = ':',
+    SDLK_SEMICOLON = ';',
+    SDLK_LESS = '<',
+    SDLK_EQUALS = '=',
+    SDLK_GREATER = '>',
+    SDLK_QUESTION = '?',
+    SDLK_AT = '@',
+    /*
+       Skip uppercase letters
+     */
+    SDLK_LEFTBRACKET = '[',
+    SDLK_BACKSLASH = '\\',
+    SDLK_RIGHTBRACKET = ']',
+    SDLK_CARET = '^',
+    SDLK_UNDERSCORE = '_',
+    SDLK_BACKQUOTE = '`',
+    SDLK_a = 'a',
+    SDLK_b = 'b',
+    SDLK_c = 'c',
+    SDLK_d = 'd',
+    SDLK_e = 'e',
+    SDLK_f = 'f',
+    SDLK_g = 'g',
+    SDLK_h = 'h',
+    SDLK_i = 'i',
+    SDLK_j = 'j',
+    SDLK_k = 'k',
+    SDLK_l = 'l',
+    SDLK_m = 'm',
+    SDLK_n = 'n',
+    SDLK_o = 'o',
+    SDLK_p = 'p',
+    SDLK_q = 'q',
+    SDLK_r = 'r',
+    SDLK_s = 's',
+    SDLK_t = 't',
+    SDLK_u = 'u',
+    SDLK_v = 'v',
+    SDLK_w = 'w',
+    SDLK_x = 'x',
+    SDLK_y = 'y',
+    SDLK_z = 'z',
+
+    SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK),
+
+    SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1),
+    SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2),
+    SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3),
+    SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4),
+    SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5),
+    SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6),
+    SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7),
+    SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8),
+    SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9),
+    SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10),
+    SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11),
+    SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12),
+
+    SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN),
+    SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK),
+    SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE),
+    SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT),
+    SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME),
+    SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP),
+    SDLK_DELETE = '\177',
+    SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END),
+    SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN),
+    SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT),
+    SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT),
+    SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN),
+    SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP),
+
+    SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR),
+    SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE),
+    SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY),
+    SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS),
+    SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS),
+    SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER),
+    SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1),
+    SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2),
+    SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3),
+    SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4),
+    SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5),
+    SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6),
+    SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7),
+    SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8),
+    SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9),
+    SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0),
+    SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD),
+
+    SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION),
+    SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER),
+    SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS),
+    SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13),
+    SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14),
+    SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15),
+    SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16),
+    SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17),
+    SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18),
+    SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19),
+    SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20),
+    SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21),
+    SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22),
+    SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23),
+    SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24),
+    SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE),
+    SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP),
+    SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU),
+    SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT),
+    SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP),
+    SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN),
+    SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO),
+    SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT),
+    SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY),
+    SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE),
+    SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND),
+    SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE),
+    SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP),
+    SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN),
+    SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA),
+    SDLK_KP_EQUALSAS400 =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400),
+
+    SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE),
+    SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ),
+    SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL),
+    SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR),
+    SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR),
+    SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2),
+    SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR),
+    SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT),
+    SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER),
+    SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN),
+    SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL),
+    SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL),
+
+    SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00),
+    SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000),
+    SDLK_THOUSANDSSEPARATOR =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR),
+    SDLK_DECIMALSEPARATOR =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR),
+    SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT),
+    SDLK_CURRENCYSUBUNIT =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT),
+    SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN),
+    SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN),
+    SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE),
+    SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE),
+    SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB),
+    SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE),
+    SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A),
+    SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B),
+    SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C),
+    SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D),
+    SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E),
+    SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F),
+    SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR),
+    SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER),
+    SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT),
+    SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS),
+    SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER),
+    SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND),
+    SDLK_KP_DBLAMPERSAND =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND),
+    SDLK_KP_VERTICALBAR =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR),
+    SDLK_KP_DBLVERTICALBAR =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR),
+    SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON),
+    SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH),
+    SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE),
+    SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT),
+    SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM),
+    SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE),
+    SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL),
+    SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR),
+    SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD),
+    SDLK_KP_MEMSUBTRACT =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT),
+    SDLK_KP_MEMMULTIPLY =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY),
+    SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE),
+    SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS),
+    SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR),
+    SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY),
+    SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY),
+    SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL),
+    SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL),
+    SDLK_KP_HEXADECIMAL =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL),
+
+    SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL),
+    SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT),
+    SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT),
+    SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI),
+    SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL),
+    SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT),
+    SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT),
+    SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI),
+
+    SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE),
+
+    SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT),
+    SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV),
+    SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP),
+    SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY),
+    SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE),
+    SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT),
+    SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW),
+    SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL),
+    SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR),
+    SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER),
+    SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH),
+    SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME),
+    SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK),
+    SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD),
+    SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP),
+    SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH),
+    SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS),
+
+    SDLK_BRIGHTNESSDOWN =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN),
+    SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP),
+    SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH),
+    SDLK_KBDILLUMTOGGLE =
+        SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE),
+    SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
+    SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
+    SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
+    SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP)
+};
+ 
Index: trunk/nv/lib/sdl.hh
===================================================================
--- trunk/nv/lib/sdl.hh	(revision 170)
+++ trunk/nv/lib/sdl.hh	(revision 170)
@@ -0,0 +1,769 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+#ifndef NV_LIB_SDL_HH
+#define NV_LIB_SDL_HH
+
+#include <nv/common.hh>
+
+#define NV_SDL_DYNAMIC
+//#define NV_SDL_SHARED
+
+#define NV_SDL_C      0
+#define NV_SDL_12     1
+#define NV_SDL_20     2
+
+#if !defined(NV_SDL_VERSION)
+#	define NV_SDL_VERSION     NV_SDL_12
+#endif
+
+#if NV_PLATFORM == NV_WINDOWS
+#	define NV_SDL_PATH_12 "SDL.dll"
+#	define NV_SDL_PATH_20 "SDL2.dll"
+#elif NV_PLATFORM == NV_APPLE
+#	define NV_SDL_PATH_12 "SDL.framework/SDL"
+#	define NV_SDL_PATH_20 "SDL2.framework/SDL"
+#else
+#	define NV_SDL_PATH_12 "libSDL-1.2.so.0"
+#	define NV_SDL_PATH_20 "libSDL-1.2.so.0"
+#endif
+
+#if NV_SDL_VERSION == NV_SDL_12
+#	define NV_SDL_PATH NV_SDL_PATH_12
+#elif NV_SDL_VERSION == NV_SDL_20 
+#	define NV_SDL_PATH NV_SDL_PATH_20
+#elif NV_SDL_VERSION == NV_SDL_C
+#	define NV_SDL_PATH nullptr
+#else
+#	error "Unrecognized NV_SDL_VERSION!"
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+
+extern "C" {
+
+#if NV_PLATFORM == NV_WINDOWS 
+#	define NV_SDL_APIENTRY __cdecl
+#else
+#	define NV_SDL_APIENTRY 
+#endif
+
+#if defined(NV_SDL_SHARED) && (NV_PLATFORM == NV_WINDOWS)
+#	define NV_SDL_API __declspec(dllimport)
+#else
+#	define NV_SDL_API extern
+#endif
+
+/* SDL_stdinc.h types */
+typedef enum {
+	SDL_FALSE = 0,
+	SDL_TRUE  = 1
+} SDL_bool;
+
+typedef int8_t		Sint8;
+typedef uint8_t		Uint8;
+typedef int16_t		Sint16;
+typedef uint16_t	Uint16;
+typedef int32_t		Sint32;
+typedef uint32_t	Uint32;
+typedef int64_t		Sint64;
+typedef uint64_t	Uint64;
+
+static_assert(sizeof(Uint8) == 1, "Uint8 has wrong size!" );
+static_assert(sizeof(Sint8) == 1, "Sint8 has wrong size!");
+static_assert(sizeof(Uint16) == 2, "Uint16 has wrong size!");
+static_assert(sizeof(Sint16) == 2, "Sint16 has wrong size!");
+static_assert(sizeof(Uint32) == 4, "Uint32 has wrong size!");
+static_assert(sizeof(Sint32) == 4, "Sint32 has wrong size!");
+static_assert(sizeof(Uint64) == 8, "Uint64 has wrong size!");
+static_assert(sizeof(Sint64) == 8, "Sint64 has wrong size!");
+
+#define RW_SEEK_SET	0
+#define RW_SEEK_CUR	1
+#define RW_SEEK_END	2
+
+/* SDL.h defines */
+
+#define	SDL_INIT_TIMER		0x00000001
+#define SDL_INIT_AUDIO		0x00000010
+#define SDL_INIT_VIDEO		0x00000020
+#define SDL_INIT_JOYSTICK	0x00000200
+#if NV_SDL_VERSION == NV_SDL_20
+#define SDL_INIT_NOPARACHUTE    0x00100000
+#define SDL_INIT_EVENTTHREAD    0x01000000
+#define SDL_INIT_EVERYTHING     0x0000FFFF 
+#else
+#define SDL_INIT_HAPTIC         0x00001000
+#define SDL_INIT_GAMECONTROLLER 0x00002000 
+#define SDL_INIT_EVENTS         0x00004000
+#define SDL_INIT_NOPARACHUTE    0x00100000
+#define SDL_INIT_EVERYTHING ( \
+	SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
+	SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
+	) 
+#endif
+/* SDL_error.h defines */
+typedef enum {
+	SDL_ENOMEM,
+	SDL_EFREAD,
+	SDL_EFWRITE,
+	SDL_EFSEEK,
+	SDL_UNSUPPORTED,
+	SDL_LASTERROR
+} SDL_errorcode;
+
+#if NV_SDL_VERSION == NV_SDL_20
+#define SDL_RWOPS_UNKNOWN   0
+#define SDL_RWOPS_WINFILE   1
+#define SDL_RWOPS_STDFILE   2
+#define SDL_RWOPS_JNIFILE   3
+#define SDL_RWOPS_MEMORY    4
+#define SDL_RWOPS_MEMORY_RO 5
+#endif
+
+/* SDL_rwops.h defines */
+typedef struct SDL_RWops {
+#if NV_SDL_VERSION == NV_SDL_20
+	Sint64 (NV_SDL_APIENTRY *size)(struct SDL_RWops *context);
+	Sint64 (NV_SDL_APIENTRY *seek)(struct SDL_RWops *context, Sint64 offset, int whence);
+	size_t (NV_SDL_APIENTRY *read)(struct SDL_RWops *context, void *ptr, size_t size, size_t maxnum);
+	size_t (NV_SDL_APIENTRY *write)(struct SDL_RWops *context, const void *ptr, size_t size, size_t num);
+#else
+	int (NV_SDL_APIENTRY *seek)(struct SDL_RWops *context, int offset, int whence);
+	int (NV_SDL_APIENTRY *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum);
+	int (NV_SDL_APIENTRY *write)(struct SDL_RWops *context, const void *ptr, int size, int num);
+#endif
+	int (NV_SDL_APIENTRY *close)(struct SDL_RWops *context);
+
+	Uint32 type;
+	union {
+#if NV_PLATFORM == NV_WINDOWS 
+	    struct {
+		int   append;
+		void *h;
+		struct {
+		    void *data;
+		    int size;
+		    int left;
+		} buffer;
+	    } win32io;
+#endif
+	    struct {
+		int autoclose;
+	 	FILE *fp;
+	    } stdio;
+	    struct {
+		Uint8 *base;
+	 	Uint8 *here;
+		Uint8 *stop;
+	    } mem;
+	    struct {
+		void *data1;
+		void *data2;
+	    } unknown;
+	} hidden;
+
+} SDL_RWops;
+
+/* SDL_video.h defines */
+#define SDL_ALPHA_OPAQUE 255
+#define SDL_ALPHA_TRANSPARENT 0
+
+#if NV_SDL_VERSION == NV_SDL_20
+typedef struct
+{
+	int x;
+	int y;
+} SDL_Point;
+
+typedef struct SDL_Rect {
+	int x, y;
+	int w, h;
+} SDL_Rect;
+#else
+typedef struct SDL_Rect {
+	Sint16 x, y;
+	Uint16 w, h;
+} SDL_Rect;
+#endif
+
+typedef struct SDL_Color {
+	Uint8 r;
+	Uint8 g;
+	Uint8 b;
+#if NV_SDL_VERSION == NV_SDL_20
+	Uint8 unused;
+#else
+	Uint8 a;
+#endif
+} SDL_Color;
+
+typedef struct SDL_Palette {
+	int       ncolors;
+	SDL_Color *colors;
+#if NV_SDL_VERSION == NV_SDL_20
+	Uint32    version;
+	int       refcount;
+#endif
+
+} SDL_Palette;
+
+#if NV_SDL_VERSION == NV_SDL_20
+typedef struct SDL_PixelFormat {
+	Uint32 format;
+	SDL_Palette *palette;
+	Uint8  BitsPerPixel;
+	Uint8  BytesPerPixel;
+	Uint8  padding[2];
+	Uint32 Rmask;
+	Uint32 Gmask;
+	Uint32 Bmask;
+	Uint32 Amask;
+	Uint8 Rloss;
+	Uint8 Gloss;
+	Uint8 Bloss;
+	Uint8 Aloss;
+	Uint8 Rshift;
+	Uint8 Gshift;
+	Uint8 Bshift;
+	Uint8 Ashift;
+	int refcount;
+	struct SDL_PixelFormat *next; 
+} SDL_PixelFormat;
+#else
+typedef struct SDL_PixelFormat {
+	SDL_Palette *palette;
+	Uint8  BitsPerPixel;
+	Uint8  BytesPerPixel;
+	Uint8  Rloss;
+	Uint8  Gloss;
+	Uint8  Bloss;
+	Uint8  Aloss;
+	Uint8  Rshift;
+	Uint8  Gshift;
+	Uint8  Bshift;
+	Uint8  Ashift;
+	Uint32 Rmask;
+	Uint32 Gmask;
+	Uint32 Bmask;
+	Uint32 Amask;
+
+	Uint32 colorkey;
+	Uint8  alpha;
+} SDL_PixelFormat;
+#endif
+
+#if NV_SDL_VERSION == NV_SDL_20
+typedef struct
+{
+	Uint32 format; 
+	int w;
+	int h;
+	int refresh_rate;
+	void *driverdata;
+} SDL_DisplayMode;
+#endif
+
+#if NV_SDL_VERSION == NV_SDL_20
+typedef struct SDL_Surface 
+{
+	Uint32 flags;
+	SDL_PixelFormat *format;
+	int w, h;
+	int pitch;
+	void *pixels;
+	void *userdata;
+	int locked;
+	void *lock_data;
+	SDL_Rect clip_rect;
+	struct SDL_BlitMap *map;
+	int refcount;
+} SDL_Surface;
+#else
+typedef struct SDL_Surface
+{
+	Uint32 flags;
+	SDL_PixelFormat *format;
+	int w, h;
+	Uint16 pitch;
+	void *pixels;
+	int offset;	
+	struct private_hwdata *hwdata;
+	SDL_Rect clip_rect;
+	Uint32 unused1;
+	Uint32 locked;
+	struct SDL_BlitMap *map;
+	unsigned int format_version;
+	int refcount;
+} SDL_Surface;
+#endif
+
+#if NV_SDL_VERSION == NV_SDL_20
+#define SDL_SWSURFACE       0         
+#define SDL_PREALLOC        0x00000001
+#define SDL_RLEACCEL        0x00000002
+#define SDL_DONTFREE        0x00000004
+
+#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
+#else
+#define SDL_SWSURFACE	0x00000000	
+#define SDL_HWSURFACE	0x00000001	
+#define SDL_ASYNCBLIT	0x00000004	
+#define SDL_ANYFORMAT	0x10000000	
+#define SDL_HWPALETTE	0x20000000	
+#define SDL_DOUBLEBUF	0x40000000	
+#define SDL_FULLSCREEN	0x80000000	
+#define SDL_OPENGL      0x00000002  
+#define SDL_OPENGLBLIT	0x0000000A	
+#define SDL_RESIZABLE	0x00000010	
+#define SDL_NOFRAME	0x00000020	
+#define SDL_HWACCEL	0x00000100	
+#define SDL_SRCCOLORKEY	0x00001000	
+#define SDL_RLEACCELOK	0x00002000	
+#define SDL_RLEACCEL	0x00004000	
+#define SDL_SRCALPHA	0x00010000	
+#define SDL_PREALLOC	0x01000000	
+
+#define SDL_MUSTLOCK(surface)	\
+	(surface->offset ||		\
+	((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0))
+
+#endif
+
+typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect, 
+                        struct SDL_Surface *dst, SDL_Rect *dstrect);
+
+#if NV_SDL_VERSION == NV_SDL_12
+typedef struct SDL_VideoInfo {
+	Uint32 hw_available :1;
+	Uint32 wm_available :1;
+	Uint32 UnusedBits1  :6;
+	Uint32 UnusedBits2  :1;
+	Uint32 blit_hw      :1;
+	Uint32 blit_hw_CC   :1;
+	Uint32 blit_hw_A    :1;
+	Uint32 blit_sw      :1;
+	Uint32 blit_sw_CC   :1;
+	Uint32 blit_sw_A    :1;
+	Uint32 blit_fill    :1;
+	Uint32 UnusedBits3  :16;
+	Uint32 video_mem;
+	SDL_PixelFormat *vfmt;
+	int    current_w;
+	int    current_h;
+} SDL_VideoInfo;
+#endif
+
+#if NV_SDL_VERSION == NV_SDL_20
+typedef enum
+{
+    SDL_WINDOW_FULLSCREEN = 0x00000001,
+    SDL_WINDOW_OPENGL = 0x00000002,
+    SDL_WINDOW_SHOWN = 0x00000004,
+    SDL_WINDOW_HIDDEN = 0x00000008,
+    SDL_WINDOW_BORDERLESS = 0x00000010,
+    SDL_WINDOW_RESIZABLE = 0x00000020,
+    SDL_WINDOW_MINIMIZED = 0x00000040,
+    SDL_WINDOW_MAXIMIZED = 0x00000080,
+    SDL_WINDOW_INPUT_GRABBED = 0x00000100,
+    SDL_WINDOW_INPUT_FOCUS = 0x00000200,
+    SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
+    SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
+    SDL_WINDOW_FOREIGN = 0x00000800 
+} SDL_WindowFlags;
+
+#define SDL_WINDOWPOS_UNDEFINED_MASK    0x1FFF0000
+#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)  (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
+#define SDL_WINDOWPOS_UNDEFINED         SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
+#define SDL_WINDOWPOS_ISUNDEFINED(X)    \
+            (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
+
+#define SDL_WINDOWPOS_CENTERED_MASK    0x2FFF0000
+#define SDL_WINDOWPOS_CENTERED_DISPLAY(X)  (SDL_WINDOWPOS_CENTERED_MASK|(X))
+#define SDL_WINDOWPOS_CENTERED         SDL_WINDOWPOS_CENTERED_DISPLAY(0)
+#define SDL_WINDOWPOS_ISCENTERED(X)    \
+            (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
+
+typedef enum
+{
+    SDL_WINDOWEVENT_NONE,
+    SDL_WINDOWEVENT_SHOWN,
+    SDL_WINDOWEVENT_HIDDEN,
+    SDL_WINDOWEVENT_EXPOSED,
+    SDL_WINDOWEVENT_MOVED,
+    SDL_WINDOWEVENT_RESIZED,
+    SDL_WINDOWEVENT_SIZE_CHANGED,
+    SDL_WINDOWEVENT_MINIMIZED,
+    SDL_WINDOWEVENT_MAXIMIZED,
+    SDL_WINDOWEVENT_RESTORED,
+    SDL_WINDOWEVENT_ENTER,
+    SDL_WINDOWEVENT_LEAVE,
+    SDL_WINDOWEVENT_FOCUS_GAINED,
+    SDL_WINDOWEVENT_FOCUS_LOST,
+    SDL_WINDOWEVENT_CLOSE
+} SDL_WindowEventID;
+
+typedef void *SDL_GLContext;
+#endif
+
+
+typedef enum {
+    SDL_GL_RED_SIZE,
+    SDL_GL_GREEN_SIZE,
+    SDL_GL_BLUE_SIZE,
+    SDL_GL_ALPHA_SIZE,
+    SDL_GL_BUFFER_SIZE,
+    SDL_GL_DOUBLEBUFFER,
+    SDL_GL_DEPTH_SIZE,
+    SDL_GL_STENCIL_SIZE,
+    SDL_GL_ACCUM_RED_SIZE,
+    SDL_GL_ACCUM_GREEN_SIZE,
+    SDL_GL_ACCUM_BLUE_SIZE,
+    SDL_GL_ACCUM_ALPHA_SIZE,
+    SDL_GL_STEREO,
+    SDL_GL_MULTISAMPLEBUFFERS,
+    SDL_GL_MULTISAMPLESAMPLES,
+    SDL_GL_ACCELERATED_VISUAL,
+#if NV_SDL_VERSION == NV_SDL_12
+    SDL_GL_SWAP_CONTROL
+#else
+	SDL_GL_RETAINED_BACKING,
+	SDL_GL_CONTEXT_MAJOR_VERSION,
+	SDL_GL_CONTEXT_MINOR_VERSION,
+	SDL_GL_CONTEXT_EGL,
+	SDL_GL_CONTEXT_FLAGS,
+	SDL_GL_CONTEXT_PROFILE_MASK,
+	SDL_GL_SHARE_WITH_CURRENT_CONTEXT
+#endif
+} SDL_GLattr;
+
+#if NV_SDL_VERSION == NV_SDL_20
+typedef enum
+{
+	SDL_GL_CONTEXT_PROFILE_CORE           = 0x0001,
+	SDL_GL_CONTEXT_PROFILE_COMPATIBILITY  = 0x0002,
+	SDL_GL_CONTEXT_PROFILE_ES             = 0x0004
+} SDL_GLprofile;
+
+typedef enum
+{
+	SDL_GL_CONTEXT_DEBUG_FLAG              = 0x0001,
+	SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
+	SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG      = 0x0004,
+	SDL_GL_CONTEXT_RESET_ISOLATION_FLAG    = 0x0008
+} SDL_GLcontextFlag;
+#endif
+
+#if NV_SDL_VERSION == NV_SDL_12
+typedef enum {
+	SDL_GRAB_QUERY = -1,
+	SDL_GRAB_OFF = 0,
+	SDL_GRAB_ON = 1,
+	SDL_GRAB_FULLSCREEN	/**< Used internally */
+} SDL_GrabMode;
+#endif
+
+/* SDL_audio.h defines */
+#define AUDIO_U8	0x0008
+#define AUDIO_S8	0x8008
+#define AUDIO_U16LSB	0x0010	
+#define AUDIO_S16LSB	0x8010	
+#define AUDIO_U16MSB	0x1010	
+#define AUDIO_S16MSB	0x9010
+#define AUDIO_U16	AUDIO_U16LSB
+#define AUDIO_S16	AUDIO_S16LSB
+
+#if NV_SDL_VERSION == NV_SDL_20
+#define AUDIO_S32LSB    0x8020 
+#define AUDIO_S32MSB    0x9020 
+#define AUDIO_S32       AUDIO_S32LSB
+#define AUDIO_F32LSB    0x8120 
+#define AUDIO_F32MSB    0x9120 
+#define AUDIO_F32       AUDIO_F32LSB
+#endif
+
+/* NOTE : assuming LSB! */
+#define AUDIO_U16SYS	AUDIO_U16LSB
+#define AUDIO_S16SYS	AUDIO_S16LSB
+#if NV_SDL_VERSION == NV_SDL_20
+#define AUDIO_S32SYS    AUDIO_S32LSB
+#define AUDIO_F32SYS    AUDIO_F32LSB
+#endif
+
+typedef Uint16 SDL_AudioFormat;
+typedef void (NV_SDL_APIENTRY * SDL_AudioCallback) (void *userdata, Uint8 * stream, int len);
+struct SDL_AudioCVT;
+typedef void (NV_SDL_APIENTRY * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, SDL_AudioFormat format);
+
+typedef struct SDL_AudioSpec
+{
+	int freq;
+	SDL_AudioFormat format;
+	Uint8 channels;
+	Uint8 silence;
+	Uint16 samples;
+	Uint16 padding;
+	Uint32 size;
+	SDL_AudioCallback callback;
+	void *userdata;
+} SDL_AudioSpec;
+
+typedef struct SDL_AudioCVT {
+	int needed;
+	SDL_AudioFormat src_format;
+	SDL_AudioFormat dst_format;
+	double rate_incr;
+	Uint8 *buf;
+	int len;
+	int len_cvt;
+	int len_mult;
+	double len_ratio;
+	SDL_AudioFilter filters[10];
+	int filter_index;
+} SDL_AudioCVT; 
+
+typedef enum {
+	SDL_AUDIO_STOPPED = 0,
+	SDL_AUDIO_PLAYING,
+	SDL_AUDIO_PAUSED
+} SDL_audiostatus;
+
+typedef SDL_audiostatus SDL_AudioStatus;
+
+#if NV_SDL_VERSION == NV_SDL_20
+#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE    0x00000001
+#define SDL_AUDIO_ALLOW_FORMAT_CHANGE       0x00000002
+#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE     0x00000004
+#define SDL_AUDIO_ALLOW_ANY_CHANGE          (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
+#endif
+
+#define SDL_MIX_MAXVOLUME 128
+
+/* SDL_active.h defines */
+#if NV_SDL_VERSION == NV_SDL_12
+#define SDL_APPMOUSEFOCUS	0x01
+#define SDL_APPINPUTFOCUS	0x02
+#define SDL_APPACTIVE		0x04
+#endif
+
+/* SDL_keyboard.h defines */
+#if NV_SDL_VERSION == NV_SDL_20
+#include <nv/lib/detail/sdl_keys_20.inc>
+#else
+#include <nv/lib/detail/sdl_keys_12.inc>
+#endif
+
+typedef enum {
+	KMOD_NONE  = 0x0000,
+	KMOD_LSHIFT= 0x0001,
+	KMOD_RSHIFT= 0x0002,
+	KMOD_LCTRL = 0x0040,
+	KMOD_RCTRL = 0x0080,
+	KMOD_LALT  = 0x0100,
+	KMOD_RALT  = 0x0200,
+	KMOD_LMETA = 0x0400,
+	KMOD_RMETA = 0x0800,
+	KMOD_LGUI  = 0x0400,
+	KMOD_RGUI  = 0x0800,
+	KMOD_NUM   = 0x1000,
+	KMOD_CAPS  = 0x2000,
+	KMOD_MODE  = 0x4000,
+	KMOD_RESERVED = 0x8000
+} SDLMod;
+
+#define KMOD_CTRL	(KMOD_LCTRL|KMOD_RCTRL)
+#define KMOD_SHIFT	(KMOD_LSHIFT|KMOD_RSHIFT)
+#define KMOD_ALT	(KMOD_LALT|KMOD_RALT)
+#define KMOD_META	(KMOD_LMETA|KMOD_RMETA)
+#define KMOD_GUI	(KMOD_LGUI|KMOD_RGUI)
+
+#define SDL_DEFAULT_REPEAT_DELAY	500
+#define SDL_DEFAULT_REPEAT_INTERVAL	30
+
+#if NV_SDL_VERSION == NV_SDL_12
+typedef struct SDL_keysym {
+	Uint8 scancode;
+	SDLKey sym;
+	SDLMod mod;
+	Uint16 unicode;
+} SDL_keysym;
+
+#define SDL_ALL_HOTKEYS		0xFFFFFFFF
+#else
+typedef struct SDL_Keysym
+{
+	SDL_Scancode scancode;
+	SDL_Keycode sym;
+	Uint16 mod;
+	Uint32 unused;
+} SDL_Keysym;
+#endif
+
+/* SDL_mouse.h defines */
+#if NV_SDL_VERSION == NV_SDL_20
+typedef enum
+{
+	SDL_SYSTEM_CURSOR_ARROW,
+	SDL_SYSTEM_CURSOR_IBEAM,
+	SDL_SYSTEM_CURSOR_WAIT,
+	SDL_SYSTEM_CURSOR_CROSSHAIR,
+	SDL_SYSTEM_CURSOR_WAITARROW,
+	SDL_SYSTEM_CURSOR_SIZENWSE,
+	SDL_SYSTEM_CURSOR_SIZENESW,
+	SDL_SYSTEM_CURSOR_SIZEWE,
+	SDL_SYSTEM_CURSOR_SIZENS,
+	SDL_SYSTEM_CURSOR_SIZEALL,
+	SDL_SYSTEM_CURSOR_NO,
+	SDL_SYSTEM_CURSOR_HAND,
+	SDL_NUM_SYSTEM_CURSORS
+} SDL_SystemCursor;
+#endif
+
+typedef struct WMcursor WMcursor;
+typedef struct SDL_Cursor {
+	SDL_Rect area;	
+	Sint16 hot_x, hot_y;
+	Uint8 *data;
+	Uint8 *mask;
+	Uint8 *save[2];	
+	WMcursor *wm_cursor;
+} SDL_Cursor;
+ 
+#define SDL_BUTTON(X)		(1 << ((X)-1))
+#define SDL_BUTTON_LEFT		1
+#define SDL_BUTTON_MIDDLE	2
+#define SDL_BUTTON_RIGHT	3
+#if NV_SDL_VERSION == NV_SDL_20
+#define SDL_BUTTON_X1		4
+#define SDL_BUTTON_X2		5
+#else
+#define SDL_BUTTON_WHEELUP	4
+#define SDL_BUTTON_WHEELDOWN	5
+#define SDL_BUTTON_X1		6
+#define SDL_BUTTON_X2		7
+#endif
+#define SDL_BUTTON_LMASK	SDL_BUTTON(SDL_BUTTON_LEFT)
+#define SDL_BUTTON_MMASK	SDL_BUTTON(SDL_BUTTON_MIDDLE)
+#define SDL_BUTTON_RMASK	SDL_BUTTON(SDL_BUTTON_RIGHT)
+#define SDL_BUTTON_X1MASK	SDL_BUTTON(SDL_BUTTON_X1)
+#define SDL_BUTTON_X2MASK	SDL_BUTTON(SDL_BUTTON_X2) 
+
+/* SDL_joystick.h defines */
+
+struct _SDL_Joystick;
+typedef struct _SDL_Joystick SDL_Joystick; 
+
+#if NV_SDL_VERSION == NV_SDL_20
+typedef struct {
+	Uint8 data[16];
+} SDL_JoystickGUID;
+
+typedef Sint32 SDL_JoystickID;
+#endif
+
+
+#define SDL_HAT_CENTERED	0x00
+#define SDL_HAT_UP		0x01
+#define SDL_HAT_RIGHT		0x02
+#define SDL_HAT_DOWN		0x04
+#define SDL_HAT_LEFT		0x08
+#define SDL_HAT_RIGHTUP		(SDL_HAT_RIGHT|SDL_HAT_UP)
+#define SDL_HAT_RIGHTDOWN	(SDL_HAT_RIGHT|SDL_HAT_DOWN)
+#define SDL_HAT_LEFTUP		(SDL_HAT_LEFT|SDL_HAT_UP)
+#define SDL_HAT_LEFTDOWN	(SDL_HAT_LEFT|SDL_HAT_DOWN)
+
+/* SDL_event.h defines */
+
+#define SDL_RELEASED	0
+#define SDL_PRESSED	1
+
+#if NV_SDL_VERSION == NV_SDL_12
+#include <nv/lib/detail/sdl_events_12.inc>
+#else
+#include <nv/lib/detail/sdl_events_20.inc>
+#endif
+
+
+#define SDL_QUERY	-1
+#define SDL_IGNORE	 0
+#define SDL_DISABLE	 0
+#define SDL_ENABLE	 1
+
+/* SDL_timer.h defines */
+#if  NV_SDL_VERSION == NV_SDL_20
+typedef Uint32 (NV_SDL_APIENTRY *SDL_TimerCallback)(Uint32 interval, void *param);
+typedef int SDL_TimerID;
+#else
+#define SDL_TIMESLICE		10
+#define TIMER_RESOLUTION	10
+typedef Uint32 (NV_SDL_APIENTRY *SDL_TimerCallback)(Uint32 interval);
+typedef Uint32 (NV_SDL_APIENTRY *SDL_NewTimerCallback)(Uint32 interval, void *param);
+typedef struct _SDL_TimerID *SDL_TimerID;
+#endif
+
+/* SDL_version.h defines */
+typedef struct SDL_version {
+	Uint8 major;
+	Uint8 minor;
+	Uint8 patch;
+} SDL_version;
+
+#if  NV_SDL_VERSION == NV_SDL_20
+#define SDL_MAJOR_VERSION   2
+#define SDL_MINOR_VERSION   0
+#define SDL_PATCHLEVEL      0 
+#else
+#define SDL_MAJOR_VERSION   1
+#define SDL_MINOR_VERSION   2
+#define SDL_PATCHLEVEL      15 
+#endif
+
+#if defined(NV_SDL_DYNAMIC)
+#	define NV_SDL_FUN( rtype, fname, fparams ) NV_SDL_API rtype (NV_SDL_APIENTRY *fname) fparams
+#else
+#	define NV_SDL_FUN( rtype, fname, fparams ) NV_SDL_API rtype NV_SDL_APIENTRY fname fparams
+#endif
+#include <nv/lib/detail/sdl_functions.inc>
+#undef NV_SDL_FUN
+
+#define SDL_RWseek(ctx, offset, whence)	(ctx)->seek(ctx, offset, whence)
+#define SDL_RWtell(ctx)			(ctx)->seek(ctx, 0, RW_SEEK_CUR)
+#define SDL_RWread(ctx, ptr, size, n)	(ctx)->read(ctx, ptr, size, n)
+#define SDL_RWwrite(ctx, ptr, size, n)	(ctx)->write(ctx, ptr, size, n)
+#define SDL_RWclose(ctx)		(ctx)->close(ctx)
+#define SDL_BlitSurface SDL_UpperBlit
+#define SDL_VERSION(X)							\
+{									\
+	(X)->major = SDL_MAJOR_VERSION;					\
+	(X)->minor = SDL_MINOR_VERSION;					\
+	(X)->patch = SDL_PATCHLEVEL;					\
+}
+#define SDL_VERSIONNUM(X, Y, Z)						\
+	((X)*1000 + (Y)*100 + (Z))
+#define SDL_COMPILEDVERSION \
+	SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
+#define SDL_VERSION_ATLEAST(X, Y, Z) \
+	(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
+ 
+}
+#define SDL_VERSIONNUM(X, Y, Z)                     \
+	((X)*1000 + (Y)*100 + (Z)) 
+#define SDL_COMPILEDVERSION \
+	SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
+#define SDL_VERSION_ATLEAST(X, Y, Z) \
+	(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
+
+namespace nv {
+/* Dynamic load support */
+#	if defined( NV_SDL_DYNAMIC )
+		bool load_sdl_library( const char* path = NV_SDL_PATH );
+#	else
+		inline bool load_sdl_library( const char* path = "" ) { return true; }
+#	endif
+}
+
+#endif // NV_LIB_SDL_HH
Index: trunk/nv/lib/sdl12.hh
===================================================================
--- trunk/nv/lib/sdl12.hh	(revision 169)
+++ 	(revision )
@@ -1,769 +1,0 @@
-// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
-// http://chaosforge.org/
-//
-// This file is part of NV Libraries.
-// For conditions of distribution and use, see copyright notice in nv.hh
-
-#ifndef NV_LIB_SDL_HH
-#define NV_LIB_SDL_HH
-
-#include <nv/common.hh>
-
-#define NV_SDL_DYNAMIC
-//#define NV_SDL_SHARED
-
-#define NV_SDL_C      0
-#define NV_SDL_12     1
-#define NV_SDL_20     2
-
-#if !defined(NV_SDL_VERSION)
-#	define NV_SDL_VERSION     NV_SDL_12
-#endif
-
-#if NV_PLATFORM == NV_WINDOWS
-#	define NV_SDL_PATH_12 "SDL.dll"
-#	define NV_SDL_PATH_20 "SDL2.dll"
-#elif NV_PLATFORM == NV_APPLE
-#	define NV_SDL_PATH_12 "SDL.framework/SDL"
-#	define NV_SDL_PATH_20 "SDL2.framework/SDL"
-#else
-#	define NV_SDL_PATH_12 "libSDL-1.2.so.0"
-#	define NV_SDL_PATH_20 "libSDL-1.2.so.0"
-#endif
-
-#if NV_SDL_VERSION == NV_SDL_12
-#	define NV_SDL_PATH NV_SDL_PATH_12
-#elif NV_SDL_VERSION == NV_SDL_20 
-#	define NV_SDL_PATH NV_SDL_PATH_20
-#elif NV_SDL_VERSION == NV_SDL_C
-#	define NV_SDL_PATH nullptr
-#else
-#	error "Unrecognized NV_SDL_VERSION!"
-#endif
-
-#include <stdint.h>
-#include <stdio.h>
-
-extern "C" {
-
-#if NV_PLATFORM == NV_WINDOWS 
-#	define NV_SDL_APIENTRY __cdecl
-#else
-#	define NV_SDL_APIENTRY 
-#endif
-
-#if defined(NV_SDL_SHARED) && (NV_PLATFORM == NV_WINDOWS)
-#	define NV_SDL_API __declspec(dllimport)
-#else
-#	define NV_SDL_API extern
-#endif
-
-/* SDL_stdinc.h types */
-typedef enum {
-	SDL_FALSE = 0,
-	SDL_TRUE  = 1
-} SDL_bool;
-
-typedef int8_t		Sint8;
-typedef uint8_t		Uint8;
-typedef int16_t		Sint16;
-typedef uint16_t	Uint16;
-typedef int32_t		Sint32;
-typedef uint32_t	Uint32;
-typedef int64_t		Sint64;
-typedef uint64_t	Uint64;
-
-static_assert(sizeof(Uint8) == 1, "Uint8 has wrong size!" );
-static_assert(sizeof(Sint8) == 1, "Sint8 has wrong size!");
-static_assert(sizeof(Uint16) == 2, "Uint16 has wrong size!");
-static_assert(sizeof(Sint16) == 2, "Sint16 has wrong size!");
-static_assert(sizeof(Uint32) == 4, "Uint32 has wrong size!");
-static_assert(sizeof(Sint32) == 4, "Sint32 has wrong size!");
-static_assert(sizeof(Uint64) == 8, "Uint64 has wrong size!");
-static_assert(sizeof(Sint64) == 8, "Sint64 has wrong size!");
-
-#define RW_SEEK_SET	0
-#define RW_SEEK_CUR	1
-#define RW_SEEK_END	2
-
-/* SDL.h defines */
-
-#define	SDL_INIT_TIMER		0x00000001
-#define SDL_INIT_AUDIO		0x00000010
-#define SDL_INIT_VIDEO		0x00000020
-#define SDL_INIT_JOYSTICK	0x00000200
-#if NV_SDL_VERSION == NV_SDL_20
-#define SDL_INIT_NOPARACHUTE    0x00100000
-#define SDL_INIT_EVENTTHREAD    0x01000000
-#define SDL_INIT_EVERYTHING     0x0000FFFF 
-#else
-#define SDL_INIT_HAPTIC         0x00001000
-#define SDL_INIT_GAMECONTROLLER 0x00002000 
-#define SDL_INIT_EVENTS         0x00004000
-#define SDL_INIT_NOPARACHUTE    0x00100000
-#define SDL_INIT_EVERYTHING ( \
-	SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
-	SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
-	) 
-#endif
-/* SDL_error.h defines */
-typedef enum {
-	SDL_ENOMEM,
-	SDL_EFREAD,
-	SDL_EFWRITE,
-	SDL_EFSEEK,
-	SDL_UNSUPPORTED,
-	SDL_LASTERROR
-} SDL_errorcode;
-
-#if NV_SDL_VERSION == NV_SDL_20
-#define SDL_RWOPS_UNKNOWN   0
-#define SDL_RWOPS_WINFILE   1
-#define SDL_RWOPS_STDFILE   2
-#define SDL_RWOPS_JNIFILE   3
-#define SDL_RWOPS_MEMORY    4
-#define SDL_RWOPS_MEMORY_RO 5
-#endif
-
-/* SDL_rwops.h defines */
-typedef struct SDL_RWops {
-#if NV_SDL_VERSION == NV_SDL_20
-	Sint64 (NV_SDL_APIENTRY *size)(struct SDL_RWops *context);
-	Sint64 (NV_SDL_APIENTRY *seek)(struct SDL_RWops *context, Sint64 offset, int whence);
-	size_t (NV_SDL_APIENTRY *read)(struct SDL_RWops *context, void *ptr, size_t size, size_t maxnum);
-	size_t (NV_SDL_APIENTRY *write)(struct SDL_RWops *context, const void *ptr, size_t size, size_t num);
-#else
-	int (NV_SDL_APIENTRY *seek)(struct SDL_RWops *context, int offset, int whence);
-	int (NV_SDL_APIENTRY *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum);
-	int (NV_SDL_APIENTRY *write)(struct SDL_RWops *context, const void *ptr, int size, int num);
-#endif
-	int (NV_SDL_APIENTRY *close)(struct SDL_RWops *context);
-
-	Uint32 type;
-	union {
-#if NV_PLATFORM == NV_WINDOWS 
-	    struct {
-		int   append;
-		void *h;
-		struct {
-		    void *data;
-		    int size;
-		    int left;
-		} buffer;
-	    } win32io;
-#endif
-	    struct {
-		int autoclose;
-	 	FILE *fp;
-	    } stdio;
-	    struct {
-		Uint8 *base;
-	 	Uint8 *here;
-		Uint8 *stop;
-	    } mem;
-	    struct {
-		void *data1;
-		void *data2;
-	    } unknown;
-	} hidden;
-
-} SDL_RWops;
-
-/* SDL_video.h defines */
-#define SDL_ALPHA_OPAQUE 255
-#define SDL_ALPHA_TRANSPARENT 0
-
-#if NV_SDL_VERSION == NV_SDL_20
-typedef struct
-{
-	int x;
-	int y;
-} SDL_Point;
-
-typedef struct SDL_Rect {
-	int x, y;
-	int w, h;
-} SDL_Rect;
-#else
-typedef struct SDL_Rect {
-	Sint16 x, y;
-	Uint16 w, h;
-} SDL_Rect;
-#endif
-
-typedef struct SDL_Color {
-	Uint8 r;
-	Uint8 g;
-	Uint8 b;
-#if NV_SDL_VERSION == NV_SDL_20
-	Uint8 unused;
-#else
-	Uint8 a;
-#endif
-} SDL_Color;
-
-typedef struct SDL_Palette {
-	int       ncolors;
-	SDL_Color *colors;
-#if NV_SDL_VERSION == NV_SDL_20
-	Uint32    version;
-	int       refcount;
-#endif
-
-} SDL_Palette;
-
-#if NV_SDL_VERSION == NV_SDL_20
-typedef struct SDL_PixelFormat {
-	Uint32 format;
-	SDL_Palette *palette;
-	Uint8  BitsPerPixel;
-	Uint8  BytesPerPixel;
-	Uint8  padding[2];
-	Uint32 Rmask;
-	Uint32 Gmask;
-	Uint32 Bmask;
-	Uint32 Amask;
-	Uint8 Rloss;
-	Uint8 Gloss;
-	Uint8 Bloss;
-	Uint8 Aloss;
-	Uint8 Rshift;
-	Uint8 Gshift;
-	Uint8 Bshift;
-	Uint8 Ashift;
-	int refcount;
-	struct SDL_PixelFormat *next; 
-} SDL_PixelFormat;
-#else
-typedef struct SDL_PixelFormat {
-	SDL_Palette *palette;
-	Uint8  BitsPerPixel;
-	Uint8  BytesPerPixel;
-	Uint8  Rloss;
-	Uint8  Gloss;
-	Uint8  Bloss;
-	Uint8  Aloss;
-	Uint8  Rshift;
-	Uint8  Gshift;
-	Uint8  Bshift;
-	Uint8  Ashift;
-	Uint32 Rmask;
-	Uint32 Gmask;
-	Uint32 Bmask;
-	Uint32 Amask;
-
-	Uint32 colorkey;
-	Uint8  alpha;
-} SDL_PixelFormat;
-#endif
-
-#if NV_SDL_VERSION == NV_SDL_20
-typedef struct
-{
-	Uint32 format; 
-	int w;
-	int h;
-	int refresh_rate;
-	void *driverdata;
-} SDL_DisplayMode;
-#endif
-
-#if NV_SDL_VERSION == NV_SDL_20
-typedef struct SDL_Surface 
-{
-	Uint32 flags;
-	SDL_PixelFormat *format;
-	int w, h;
-	int pitch;
-	void *pixels;
-	void *userdata;
-	int locked;
-	void *lock_data;
-	SDL_Rect clip_rect;
-	struct SDL_BlitMap *map;
-	int refcount;
-} SDL_Surface;
-#else
-typedef struct SDL_Surface
-{
-	Uint32 flags;
-	SDL_PixelFormat *format;
-	int w, h;
-	Uint16 pitch;
-	void *pixels;
-	int offset;	
-	struct private_hwdata *hwdata;
-	SDL_Rect clip_rect;
-	Uint32 unused1;
-	Uint32 locked;
-	struct SDL_BlitMap *map;
-	unsigned int format_version;
-	int refcount;
-} SDL_Surface;
-#endif
-
-#if NV_SDL_VERSION == NV_SDL_20
-#define SDL_SWSURFACE       0         
-#define SDL_PREALLOC        0x00000001
-#define SDL_RLEACCEL        0x00000002
-#define SDL_DONTFREE        0x00000004
-
-#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
-#else
-#define SDL_SWSURFACE	0x00000000	
-#define SDL_HWSURFACE	0x00000001	
-#define SDL_ASYNCBLIT	0x00000004	
-#define SDL_ANYFORMAT	0x10000000	
-#define SDL_HWPALETTE	0x20000000	
-#define SDL_DOUBLEBUF	0x40000000	
-#define SDL_FULLSCREEN	0x80000000	
-#define SDL_OPENGL      0x00000002  
-#define SDL_OPENGLBLIT	0x0000000A	
-#define SDL_RESIZABLE	0x00000010	
-#define SDL_NOFRAME	0x00000020	
-#define SDL_HWACCEL	0x00000100	
-#define SDL_SRCCOLORKEY	0x00001000	
-#define SDL_RLEACCELOK	0x00002000	
-#define SDL_RLEACCEL	0x00004000	
-#define SDL_SRCALPHA	0x00010000	
-#define SDL_PREALLOC	0x01000000	
-
-#define SDL_MUSTLOCK(surface)	\
-	(surface->offset ||		\
-	((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0))
-
-#endif
-
-typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect, 
-                        struct SDL_Surface *dst, SDL_Rect *dstrect);
-
-#if NV_SDL_VERSION == NV_SDL_12
-typedef struct SDL_VideoInfo {
-	Uint32 hw_available :1;
-	Uint32 wm_available :1;
-	Uint32 UnusedBits1  :6;
-	Uint32 UnusedBits2  :1;
-	Uint32 blit_hw      :1;
-	Uint32 blit_hw_CC   :1;
-	Uint32 blit_hw_A    :1;
-	Uint32 blit_sw      :1;
-	Uint32 blit_sw_CC   :1;
-	Uint32 blit_sw_A    :1;
-	Uint32 blit_fill    :1;
-	Uint32 UnusedBits3  :16;
-	Uint32 video_mem;
-	SDL_PixelFormat *vfmt;
-	int    current_w;
-	int    current_h;
-} SDL_VideoInfo;
-#endif
-
-#if NV_SDL_VERSION == NV_SDL_20
-typedef enum
-{
-    SDL_WINDOW_FULLSCREEN = 0x00000001,
-    SDL_WINDOW_OPENGL = 0x00000002,
-    SDL_WINDOW_SHOWN = 0x00000004,
-    SDL_WINDOW_HIDDEN = 0x00000008,
-    SDL_WINDOW_BORDERLESS = 0x00000010,
-    SDL_WINDOW_RESIZABLE = 0x00000020,
-    SDL_WINDOW_MINIMIZED = 0x00000040,
-    SDL_WINDOW_MAXIMIZED = 0x00000080,
-    SDL_WINDOW_INPUT_GRABBED = 0x00000100,
-    SDL_WINDOW_INPUT_FOCUS = 0x00000200,
-    SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
-    SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
-    SDL_WINDOW_FOREIGN = 0x00000800 
-} SDL_WindowFlags;
-
-#define SDL_WINDOWPOS_UNDEFINED_MASK    0x1FFF0000
-#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)  (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
-#define SDL_WINDOWPOS_UNDEFINED         SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
-#define SDL_WINDOWPOS_ISUNDEFINED(X)    \
-            (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
-
-#define SDL_WINDOWPOS_CENTERED_MASK    0x2FFF0000
-#define SDL_WINDOWPOS_CENTERED_DISPLAY(X)  (SDL_WINDOWPOS_CENTERED_MASK|(X))
-#define SDL_WINDOWPOS_CENTERED         SDL_WINDOWPOS_CENTERED_DISPLAY(0)
-#define SDL_WINDOWPOS_ISCENTERED(X)    \
-            (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
-
-typedef enum
-{
-    SDL_WINDOWEVENT_NONE,
-    SDL_WINDOWEVENT_SHOWN,
-    SDL_WINDOWEVENT_HIDDEN,
-    SDL_WINDOWEVENT_EXPOSED,
-    SDL_WINDOWEVENT_MOVED,
-    SDL_WINDOWEVENT_RESIZED,
-    SDL_WINDOWEVENT_SIZE_CHANGED,
-    SDL_WINDOWEVENT_MINIMIZED,
-    SDL_WINDOWEVENT_MAXIMIZED,
-    SDL_WINDOWEVENT_RESTORED,
-    SDL_WINDOWEVENT_ENTER,
-    SDL_WINDOWEVENT_LEAVE,
-    SDL_WINDOWEVENT_FOCUS_GAINED,
-    SDL_WINDOWEVENT_FOCUS_LOST,
-    SDL_WINDOWEVENT_CLOSE
-} SDL_WindowEventID;
-
-typedef void *SDL_GLContext;
-#endif
-
-
-typedef enum {
-    SDL_GL_RED_SIZE,
-    SDL_GL_GREEN_SIZE,
-    SDL_GL_BLUE_SIZE,
-    SDL_GL_ALPHA_SIZE,
-    SDL_GL_BUFFER_SIZE,
-    SDL_GL_DOUBLEBUFFER,
-    SDL_GL_DEPTH_SIZE,
-    SDL_GL_STENCIL_SIZE,
-    SDL_GL_ACCUM_RED_SIZE,
-    SDL_GL_ACCUM_GREEN_SIZE,
-    SDL_GL_ACCUM_BLUE_SIZE,
-    SDL_GL_ACCUM_ALPHA_SIZE,
-    SDL_GL_STEREO,
-    SDL_GL_MULTISAMPLEBUFFERS,
-    SDL_GL_MULTISAMPLESAMPLES,
-    SDL_GL_ACCELERATED_VISUAL,
-#if NV_SDL_VERSION == NV_SDL_12
-    SDL_GL_SWAP_CONTROL
-#else
-	SDL_GL_RETAINED_BACKING,
-	SDL_GL_CONTEXT_MAJOR_VERSION,
-	SDL_GL_CONTEXT_MINOR_VERSION,
-	SDL_GL_CONTEXT_EGL,
-	SDL_GL_CONTEXT_FLAGS,
-	SDL_GL_CONTEXT_PROFILE_MASK,
-	SDL_GL_SHARE_WITH_CURRENT_CONTEXT
-#endif
-} SDL_GLattr;
-
-#if NV_SDL_VERSION == NV_SDL_20
-typedef enum
-{
-	SDL_GL_CONTEXT_PROFILE_CORE           = 0x0001,
-	SDL_GL_CONTEXT_PROFILE_COMPATIBILITY  = 0x0002,
-	SDL_GL_CONTEXT_PROFILE_ES             = 0x0004
-} SDL_GLprofile;
-
-typedef enum
-{
-	SDL_GL_CONTEXT_DEBUG_FLAG              = 0x0001,
-	SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
-	SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG      = 0x0004,
-	SDL_GL_CONTEXT_RESET_ISOLATION_FLAG    = 0x0008
-} SDL_GLcontextFlag;
-#endif
-
-#if NV_SDL_VERSION == NV_SDL_12
-typedef enum {
-	SDL_GRAB_QUERY = -1,
-	SDL_GRAB_OFF = 0,
-	SDL_GRAB_ON = 1,
-	SDL_GRAB_FULLSCREEN	/**< Used internally */
-} SDL_GrabMode;
-#endif
-
-/* SDL_audio.h defines */
-#define AUDIO_U8	0x0008
-#define AUDIO_S8	0x8008
-#define AUDIO_U16LSB	0x0010	
-#define AUDIO_S16LSB	0x8010	
-#define AUDIO_U16MSB	0x1010	
-#define AUDIO_S16MSB	0x9010
-#define AUDIO_U16	AUDIO_U16LSB
-#define AUDIO_S16	AUDIO_S16LSB
-
-#if NV_SDL_VERSION == NV_SDL_20
-#define AUDIO_S32LSB    0x8020 
-#define AUDIO_S32MSB    0x9020 
-#define AUDIO_S32       AUDIO_S32LSB
-#define AUDIO_F32LSB    0x8120 
-#define AUDIO_F32MSB    0x9120 
-#define AUDIO_F32       AUDIO_F32LSB
-#endif
-
-/* NOTE : assuming LSB! */
-#define AUDIO_U16SYS	AUDIO_U16LSB
-#define AUDIO_S16SYS	AUDIO_S16LSB
-#if NV_SDL_VERSION == NV_SDL_20
-#define AUDIO_S32SYS    AUDIO_S32LSB
-#define AUDIO_F32SYS    AUDIO_F32LSB
-#endif
-
-typedef Uint16 SDL_AudioFormat;
-typedef void (NV_SDL_APIENTRY * SDL_AudioCallback) (void *userdata, Uint8 * stream, int len);
-struct SDL_AudioCVT;
-typedef void (NV_SDL_APIENTRY * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, SDL_AudioFormat format);
-
-typedef struct SDL_AudioSpec
-{
-	int freq;
-	SDL_AudioFormat format;
-	Uint8 channels;
-	Uint8 silence;
-	Uint16 samples;
-	Uint16 padding;
-	Uint32 size;
-	SDL_AudioCallback callback;
-	void *userdata;
-} SDL_AudioSpec;
-
-typedef struct SDL_AudioCVT {
-	int needed;
-	SDL_AudioFormat src_format;
-	SDL_AudioFormat dst_format;
-	double rate_incr;
-	Uint8 *buf;
-	int len;
-	int len_cvt;
-	int len_mult;
-	double len_ratio;
-	SDL_AudioFilter filters[10];
-	int filter_index;
-} SDL_AudioCVT; 
-
-typedef enum {
-	SDL_AUDIO_STOPPED = 0,
-	SDL_AUDIO_PLAYING,
-	SDL_AUDIO_PAUSED
-} SDL_audiostatus;
-
-typedef SDL_audiostatus SDL_AudioStatus;
-
-#if NV_SDL_VERSION == NV_SDL_20
-#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE    0x00000001
-#define SDL_AUDIO_ALLOW_FORMAT_CHANGE       0x00000002
-#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE     0x00000004
-#define SDL_AUDIO_ALLOW_ANY_CHANGE          (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
-#endif
-
-#define SDL_MIX_MAXVOLUME 128
-
-/* SDL_active.h defines */
-#if NV_SDL_VERSION == NV_SDL_12
-#define SDL_APPMOUSEFOCUS	0x01
-#define SDL_APPINPUTFOCUS	0x02
-#define SDL_APPACTIVE		0x04
-#endif
-
-/* SDL_keyboard.h defines */
-#if NV_SDL_VERSION == NV_SDL_20
-#include <nv/lib/detail/sdl_keys_20.inc>
-#else
-#include <nv/lib/detail/sdl_keys_12.inc>
-#endif
-
-typedef enum {
-	KMOD_NONE  = 0x0000,
-	KMOD_LSHIFT= 0x0001,
-	KMOD_RSHIFT= 0x0002,
-	KMOD_LCTRL = 0x0040,
-	KMOD_RCTRL = 0x0080,
-	KMOD_LALT  = 0x0100,
-	KMOD_RALT  = 0x0200,
-	KMOD_LMETA = 0x0400,
-	KMOD_RMETA = 0x0800,
-	KMOD_LGUI  = 0x0400,
-	KMOD_RGUI  = 0x0800,
-	KMOD_NUM   = 0x1000,
-	KMOD_CAPS  = 0x2000,
-	KMOD_MODE  = 0x4000,
-	KMOD_RESERVED = 0x8000
-} SDLMod;
-
-#define KMOD_CTRL	(KMOD_LCTRL|KMOD_RCTRL)
-#define KMOD_SHIFT	(KMOD_LSHIFT|KMOD_RSHIFT)
-#define KMOD_ALT	(KMOD_LALT|KMOD_RALT)
-#define KMOD_META	(KMOD_LMETA|KMOD_RMETA)
-#define KMOD_GUI	(KMOD_LGUI|KMOD_RGUI)
-
-#define SDL_DEFAULT_REPEAT_DELAY	500
-#define SDL_DEFAULT_REPEAT_INTERVAL	30
-
-#if NV_SDL_VERSION == NV_SDL_12
-typedef struct SDL_keysym {
-	Uint8 scancode;
-	SDLKey sym;
-	SDLMod mod;
-	Uint16 unicode;
-} SDL_keysym;
-
-#define SDL_ALL_HOTKEYS		0xFFFFFFFF
-#else
-typedef struct SDL_Keysym
-{
-	SDL_Scancode scancode;
-	SDL_Keycode sym;
-	Uint16 mod;
-	Uint32 unused;
-} SDL_Keysym;
-#endif
-
-/* SDL_mouse.h defines */
-#if NV_SDL_VERSION == NV_SDL_20
-typedef enum
-{
-	SDL_SYSTEM_CURSOR_ARROW,
-	SDL_SYSTEM_CURSOR_IBEAM,
-	SDL_SYSTEM_CURSOR_WAIT,
-	SDL_SYSTEM_CURSOR_CROSSHAIR,
-	SDL_SYSTEM_CURSOR_WAITARROW,
-	SDL_SYSTEM_CURSOR_SIZENWSE,
-	SDL_SYSTEM_CURSOR_SIZENESW,
-	SDL_SYSTEM_CURSOR_SIZEWE,
-	SDL_SYSTEM_CURSOR_SIZENS,
-	SDL_SYSTEM_CURSOR_SIZEALL,
-	SDL_SYSTEM_CURSOR_NO,
-	SDL_SYSTEM_CURSOR_HAND,
-	SDL_NUM_SYSTEM_CURSORS
-} SDL_SystemCursor;
-#endif
-
-typedef struct WMcursor WMcursor;
-typedef struct SDL_Cursor {
-	SDL_Rect area;	
-	Sint16 hot_x, hot_y;
-	Uint8 *data;
-	Uint8 *mask;
-	Uint8 *save[2];	
-	WMcursor *wm_cursor;
-} SDL_Cursor;
- 
-#define SDL_BUTTON(X)		(1 << ((X)-1))
-#define SDL_BUTTON_LEFT		1
-#define SDL_BUTTON_MIDDLE	2
-#define SDL_BUTTON_RIGHT	3
-#if NV_SDL_VERSION == NV_SDL_20
-#define SDL_BUTTON_X1		4
-#define SDL_BUTTON_X2		5
-#else
-#define SDL_BUTTON_WHEELUP	4
-#define SDL_BUTTON_WHEELDOWN	5
-#define SDL_BUTTON_X1		6
-#define SDL_BUTTON_X2		7
-#endif
-#define SDL_BUTTON_LMASK	SDL_BUTTON(SDL_BUTTON_LEFT)
-#define SDL_BUTTON_MMASK	SDL_BUTTON(SDL_BUTTON_MIDDLE)
-#define SDL_BUTTON_RMASK	SDL_BUTTON(SDL_BUTTON_RIGHT)
-#define SDL_BUTTON_X1MASK	SDL_BUTTON(SDL_BUTTON_X1)
-#define SDL_BUTTON_X2MASK	SDL_BUTTON(SDL_BUTTON_X2) 
-
-/* SDL_joystick.h defines */
-
-struct _SDL_Joystick;
-typedef struct _SDL_Joystick SDL_Joystick; 
-
-#if NV_SDL_VERSION == NV_SDL_20
-typedef struct {
-	Uint8 data[16];
-} SDL_JoystickGUID;
-
-typedef Sint32 SDL_JoystickID;
-#endif
-
-
-#define SDL_HAT_CENTERED	0x00
-#define SDL_HAT_UP		0x01
-#define SDL_HAT_RIGHT		0x02
-#define SDL_HAT_DOWN		0x04
-#define SDL_HAT_LEFT		0x08
-#define SDL_HAT_RIGHTUP		(SDL_HAT_RIGHT|SDL_HAT_UP)
-#define SDL_HAT_RIGHTDOWN	(SDL_HAT_RIGHT|SDL_HAT_DOWN)
-#define SDL_HAT_LEFTUP		(SDL_HAT_LEFT|SDL_HAT_UP)
-#define SDL_HAT_LEFTDOWN	(SDL_HAT_LEFT|SDL_HAT_DOWN)
-
-/* SDL_event.h defines */
-
-#define SDL_RELEASED	0
-#define SDL_PRESSED	1
-
-#if NV_SDL_VERSION == NV_SDL_12
-#include <nv/lib/detail/sdl_events_12.inc>
-#else
-#include <nv/lib/detail/sdl_events_20.inc>
-#endif
-
-
-#define SDL_QUERY	-1
-#define SDL_IGNORE	 0
-#define SDL_DISABLE	 0
-#define SDL_ENABLE	 1
-
-/* SDL_timer.h defines */
-#if  NV_SDL_VERSION == NV_SDL_20
-typedef Uint32 (NV_SDL_APIENTRY *SDL_TimerCallback)(Uint32 interval, void *param);
-typedef int SDL_TimerID;
-#else
-#define SDL_TIMESLICE		10
-#define TIMER_RESOLUTION	10
-typedef Uint32 (NV_SDL_APIENTRY *SDL_TimerCallback)(Uint32 interval);
-typedef Uint32 (NV_SDL_APIENTRY *SDL_NewTimerCallback)(Uint32 interval, void *param);
-typedef struct _SDL_TimerID *SDL_TimerID;
-#endif
-
-/* SDL_version.h defines */
-typedef struct SDL_version {
-	Uint8 major;
-	Uint8 minor;
-	Uint8 patch;
-} SDL_version;
-
-#if  NV_SDL_VERSION == NV_SDL_20
-#define SDL_MAJOR_VERSION   2
-#define SDL_MINOR_VERSION   0
-#define SDL_PATCHLEVEL      0 
-#else
-#define SDL_MAJOR_VERSION   1
-#define SDL_MINOR_VERSION   2
-#define SDL_PATCHLEVEL      15 
-#endif
-
-#if defined(NV_SDL_DYNAMIC)
-#	define NV_SDL_FUN( rtype, fname, fparams ) NV_SDL_API rtype (NV_SDL_APIENTRY *fname) fparams
-#else
-#	define NV_SDL_FUN( rtype, fname, fparams ) NV_SDL_API rtype NV_SDL_APIENTRY fname fparams
-#endif
-#include <nv/lib/detail/sdl_functions.inc>
-#undef NV_SDL_FUN
-
-#define SDL_RWseek(ctx, offset, whence)	(ctx)->seek(ctx, offset, whence)
-#define SDL_RWtell(ctx)			(ctx)->seek(ctx, 0, RW_SEEK_CUR)
-#define SDL_RWread(ctx, ptr, size, n)	(ctx)->read(ctx, ptr, size, n)
-#define SDL_RWwrite(ctx, ptr, size, n)	(ctx)->write(ctx, ptr, size, n)
-#define SDL_RWclose(ctx)		(ctx)->close(ctx)
-#define SDL_BlitSurface SDL_UpperBlit
-#define SDL_VERSION(X)							\
-{									\
-	(X)->major = SDL_MAJOR_VERSION;					\
-	(X)->minor = SDL_MINOR_VERSION;					\
-	(X)->patch = SDL_PATCHLEVEL;					\
-}
-#define SDL_VERSIONNUM(X, Y, Z)						\
-	((X)*1000 + (Y)*100 + (Z))
-#define SDL_COMPILEDVERSION \
-	SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
-#define SDL_VERSION_ATLEAST(X, Y, Z) \
-	(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
- 
-}
-#define SDL_VERSIONNUM(X, Y, Z)                     \
-	((X)*1000 + (Y)*100 + (Z)) 
-#define SDL_COMPILEDVERSION \
-	SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
-#define SDL_VERSION_ATLEAST(X, Y, Z) \
-	(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
-
-namespace nv {
-/* Dynamic load support */
-#	if defined( NV_SDL_DYNAMIC )
-		bool load_sdl_library( const char* path = NV_SDL_PATH );
-#	else
-		inline bool load_sdl_library( const char* path = "" ) { return true; }
-#	endif
-}
-
-#endif // NV_LIB_SDL_HH
Index: trunk/nv/lib/sdl_image.hh
===================================================================
--- trunk/nv/lib/sdl_image.hh	(revision 169)
+++ trunk/nv/lib/sdl_image.hh	(revision 170)
@@ -9,5 +9,5 @@
 
 #include <nv/common.hh>
-#include <nv/lib/sdl12.hh>
+#include <nv/lib/sdl.hh>
 
 #if NV_PLATFORM == NV_WINDOWS
Index: trunk/src/gl/gl_device.cc
===================================================================
--- trunk/src/gl/gl_device.cc	(revision 169)
+++ trunk/src/gl/gl_device.cc	(revision 170)
@@ -10,5 +10,5 @@
 #include "nv/gl/gl_texture2d.hh"
 #include "nv/logging.hh"
-#include "nv/lib/sdl12.hh"
+#include "nv/lib/sdl.hh"
 #include "nv/lib/sdl_image.hh"
 
Index: trunk/src/gl/gl_window.cc
===================================================================
--- trunk/src/gl/gl_window.cc	(revision 169)
+++ trunk/src/gl/gl_window.cc	(revision 170)
@@ -7,5 +7,5 @@
 #include "nv/logging.hh"
 #include "nv/lib/gl.hh"
-#include "nv/lib/sdl12.hh"
+#include "nv/lib/sdl.hh"
 
 using namespace nv;
Index: trunk/src/lib/gl.cc
===================================================================
--- trunk/src/lib/gl.cc	(revision 169)
+++ trunk/src/lib/gl.cc	(revision 170)
@@ -13,5 +13,5 @@
 
 #if defined( NV_SDL_GL )
-#	include "nv/lib/sdl12.hh"
+#	include "nv/lib/sdl.hh"
 #endif
 
Index: trunk/src/lib/sdl.cc
===================================================================
--- trunk/src/lib/sdl.cc	(revision 170)
+++ trunk/src/lib/sdl.cc	(revision 170)
@@ -0,0 +1,27 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+#include "nv/lib/sdl.hh"
+
+#if defined( NV_SDL_DYNAMIC )
+
+#include "nv/library.hh"
+
+#define NV_SDL_FUN( rtype, fname, fparams ) rtype (NV_SDL_APIENTRY *fname) fparams = nullptr;
+#include <nv/lib/detail/sdl_functions.inc>
+#undef NV_SDL_FUN
+
+bool nv::load_sdl_library( const char* path )
+{
+	static nv::library sdl_library;
+	if ( sdl_library.is_open() ) return true;
+	sdl_library.open( path );
+#	define NV_SDL_FUN( rtype, fname, fparams ) *(void **) (&fname) = sdl_library.get(#fname);
+#	include <nv/lib/detail/sdl_functions.inc>
+#	undef NV_SDL_FUN
+	return true;
+}
+#endif
Index: trunk/src/lib/sdl12.cc
===================================================================
--- trunk/src/lib/sdl12.cc	(revision 169)
+++ 	(revision )
@@ -1,27 +1,0 @@
-// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
-// http://chaosforge.org/
-//
-// This file is part of NV Libraries.
-// For conditions of distribution and use, see copyright notice in nv.hh
-
-#include "nv/lib/sdl12.hh"
-
-#if defined( NV_SDL_DYNAMIC )
-
-#include "nv/library.hh"
-
-#define NV_SDL_FUN( rtype, fname, fparams ) rtype (NV_SDL_APIENTRY *fname) fparams = nullptr;
-#include <nv/lib/detail/sdl_functions.inc>
-#undef NV_SDL_FUN
-
-bool nv::load_sdl_library( const char* path )
-{
-	static nv::library sdl_library;
-	if ( sdl_library.is_open() ) return true;
-	sdl_library.open( path );
-#	define NV_SDL_FUN( rtype, fname, fparams ) *(void **) (&fname) = sdl_library.get(#fname);
-#	include <nv/lib/detail/sdl_functions.inc>
-#	undef NV_SDL_FUN
-	return true;
-}
-#endif
