From 20702c726720388a06a486098ab44b8a7c81f8e0 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Thu, 27 Jun 2013 01:58:10 +0000 Subject: [PATCH] sdl: stub off functions that need to be rewritten for SDL2 sdl: sdl2 now compiles (albeit does not work whatsoever at this point) (TODO: write InitVideo for SDL2) --- trunk/src/drivers/sdl/gui.cpp | 4 +++- trunk/src/drivers/sdl/input.cpp | 4 ++-- trunk/src/drivers/sdl/sdl-video.cpp | 23 ++++++++++++++++++++++- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/trunk/src/drivers/sdl/gui.cpp b/trunk/src/drivers/sdl/gui.cpp index de8a5cfb..06438a1e 100644 --- a/trunk/src/drivers/sdl/gui.cpp +++ b/trunk/src/drivers/sdl/gui.cpp @@ -2154,7 +2154,9 @@ gint convertKeypress(GtkWidget *grab, GdkEventKey *event, gpointer user_data) if(keystate == 0 || gtk_window_is_active(GTK_WINDOW(MainWindow))) { #if SDL_VERSION_ATLEAST(2, 0, 0) - SDL_GetKeyboardState(NULL)[SDL_GetScancodeFromKey(sdlkey)] = keystate; + // Not sure how to do this yet with SDL 2.0 + // TODO - SDL 2.0 + //SDL_GetKeyboardState(NULL)[SDL_GetScancodeFromKey(sdlkey)] = keystate; #else SDL_GetKeyState(NULL)[sdlkey] = keystate; #endif diff --git a/trunk/src/drivers/sdl/input.cpp b/trunk/src/drivers/sdl/input.cpp index 68c90d7a..c371b2fe 100644 --- a/trunk/src/drivers/sdl/input.cpp +++ b/trunk/src/drivers/sdl/input.cpp @@ -433,7 +433,7 @@ unsigned int *GetKeyboard(void) { int size = 256; #if SDL_VERSION_ATLEAST(2, 0, 0) - Uint8* keystate = SDL_GetKeyboardState(&size); + Uint8* keystate = (Uint8*)SDL_GetKeyboardState(&size); #else Uint8* keystate = SDL_GetKeyState(&size); #endif @@ -450,7 +450,7 @@ static void KeyboardCommands () char *movie_fname = ""; // get the keyboard input #if SDL_VERSION_ATLEAST(1, 3, 0) - g_keyState = SDL_GetKeyboardState (NULL); + g_keyState = (Uint8*)SDL_GetKeyboardState (NULL); #else g_keyState = SDL_GetKeyState (NULL); #endif diff --git a/trunk/src/drivers/sdl/sdl-video.cpp b/trunk/src/drivers/sdl/sdl-video.cpp index df629913..88aacd3f 100644 --- a/trunk/src/drivers/sdl/sdl-video.cpp +++ b/trunk/src/drivers/sdl/sdl-video.cpp @@ -147,6 +147,15 @@ void FCEUD_VideoChanged() else PAL = 0; } + +#if SDL_VERSION_ATLEAST(2, 0, 0) +int InitVideo(FCEUGI *gi) +{ + // This is a big TODO. Stubbing this off into its own function, + // as the SDL surface routines have changed drastically in SDL2 + // TODO - SDL2 +} +#else /** * Attempts to initialize the graphical video display. Returns 0 on * success, -1 on failure. @@ -494,6 +503,7 @@ InitVideo(FCEUGI *gi) } return 0; } +#endif /** * Toggles the full-screen display. @@ -580,11 +590,14 @@ static void RedoPalette() SetPaletteBlitToHigh((uint8*)s_psdl); } else { +#if SDL_VERSION_ATLEAST(2, 0, 0) + //TODO - SDL2 +#else SDL_SetPalette(s_screen, SDL_PHYSPAL, s_psdl, 0, 256); +#endif } } } - // XXX soules - console lock/unlock unimplemented? ///Currently unimplemented. @@ -693,8 +706,12 @@ BlitScreen(uint8 *XBuf) } // ensure that the display is updated +#if SDL_VERSION_ATLEAST(2, 0, 0) + //TODO - SDL2 +#else SDL_UpdateRect(s_screen, xo, yo, (Uint32)(NWIDTH * s_exs), (Uint32)(s_tlines * s_eys)); +#endif #ifdef CREATE_AVI #if 0 /* PAL INTO NTSC HACK */ @@ -770,10 +787,14 @@ BlitScreen(uint8 *XBuf) #endif #endif +#if SDL_VERSION_ATLEAST(2, 0, 0) + // TODO +#else // have to flip the displayed buffer in the case of double buffering if(s_screen->flags & SDL_DOUBLEBUF) { SDL_Flip(s_screen); } +#endif } /**