SDL: fceuX ported to SDL 1.3; full compatibility maintained with 1.2

SDL: compile-time SDL version printed with "--help"
This commit is contained in:
punkrockguy318 2010-02-23 01:31:54 +00:00
parent f5457f2ace
commit 6a45cd05e9
3 changed files with 29 additions and 5 deletions

View File

@ -137,7 +137,13 @@ _keyonly(int a)
// check for valid key // check for valid key
if(a > SDLK_LAST+1 || a < 0) if(a > SDLK_LAST+1 || a < 0)
return(0); return(0);
if(g_keyState[a]) { #if SDL_VERSION_ATLEAST(1, 3, 0)
if(g_keyState[SDL_GetScancodeFromKey((SDLKey)a)])
#else
if(g_keyState[a])
#endif
{
if(!keyonce[a]) { if(!keyonce[a]) {
keyonce[a] = 1; keyonce[a] = 1;
return(1); return(1);
@ -393,9 +399,14 @@ static void
KeyboardCommands() KeyboardCommands()
{ {
int is_shift, is_alt; int is_shift, is_alt;
char* movie_fname = ""; char* movie_fname = "";
// get the keyboard input // get the keyboard input
#if SDL_VERSION_ATLEAST(1, 3, 0)
g_keyState = SDL_GetKeyboardState(NULL);
#else
g_keyState = SDL_GetKeyState(NULL); g_keyState = SDL_GetKeyState(NULL);
#endif
// check if the family keyboard is enabled // check if the family keyboard is enabled
if(InputType[2] == SIFC_FKB) { if(InputType[2] == SIFC_FKB) {
@ -410,8 +421,10 @@ KeyboardCommands()
} }
} }
is_shift = KEY(LEFTSHIFT) | KEY(RIGHTSHIFT); //is_shift = KEY(LEFTSHIFT) | KEY(RIGHTSHIFT);
is_alt = KEY(LEFTALT) | KEY(RIGHTALT); //is_alt = KEY(LEFTALT) | KEY(RIGHTALT);
is_shift = 0;
is_alt = 0;
if(_keyonly(renderBgKey)) { if(_keyonly(renderBgKey)) {
if(is_shift) { if(is_shift) {
@ -638,8 +651,10 @@ KeyboardCommands()
if(keyonly(H)) FCEUI_NTSCSELHUE(); if(keyonly(H)) FCEUI_NTSCSELHUE();
if(keyonly(T)) FCEUI_NTSCSELTINT(); if(keyonly(T)) FCEUI_NTSCSELTINT();
if(KEY(KP_MINUS) || KEY(MINUS)) FCEUI_NTSCDEC();
if(KEY(KP_PLUS) || KEY(EQUAL)) FCEUI_NTSCINC(); // TEMPORAILY DISABLED! DO NOT COMMIT! TODO!
// if(KEY(KP_MINUS) || KEY(MINUS)) FCEUI_NTSCDEC();
// if(KEY(KP_PLUS) || KEY(EQUAL)) FCEUI_NTSCINC();
if((InputType[2] == SIFC_BWORLD) || (cspec == SIS_DATACH)) { if((InputType[2] == SIFC_BWORLD) || (cspec == SIS_DATACH)) {
if(keyonly(F8)) { if(keyonly(F8)) {
@ -813,7 +828,11 @@ DTestButton(ButtConfig *bc)
for(x = 0; x < bc->NumC; x++) { for(x = 0; x < bc->NumC; x++) {
if(bc->ButtType[x] == BUTTC_KEYBOARD) { if(bc->ButtType[x] == BUTTC_KEYBOARD) {
#if SDL_VERSION_ATLEAST(1,3,0)
if(g_keyState[SDL_GetScancodeFromKey((SDLKey)bc->ButtonNum[x])]) {
#else
if(g_keyState[bc->ButtonNum[x]]) { if(g_keyState[bc->ButtonNum[x]]) {
#endif
return(1); return(1);
} }
} else if(bc->ButtType[x] == BUTTC_JOYSTICK) { } else if(bc->ButtType[x] == BUTTC_JOYSTICK) {

View File

@ -43,4 +43,7 @@
#define SDLK_SCROLLLOCK SDLK_SCROLLOCK /* I guess the SDL people don't like lots of Ls... */ #define SDLK_SCROLLLOCK SDLK_SCROLLOCK /* I guess the SDL people don't like lots of Ls... */
#define SDLK_GRAVE SDLK_BACKQUOTE #define SDLK_GRAVE SDLK_BACKQUOTE
#define MKK(k) SDLK_##k #define MKK(k) SDLK_##k
#if SDL_VERSION_ATLEAST(1, 3, 0)
#define SDLK_LAST SDL_NUM_SCANCODES
#endif
#define MKK_COUNT (SDLK_LAST+1) #define MKK_COUNT (SDLK_LAST+1)

View File

@ -151,6 +151,8 @@ static void ShowUsage(char *prog)
puts ("--mute {0|1} Mutes FCEUX while still passing the audio stream to\n mencoder."); puts ("--mute {0|1} Mutes FCEUX while still passing the audio stream to\n mencoder.");
#endif #endif
puts(""); puts("");
printf("Compiled with SDL version %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL );
} }
/** /**