diff --git a/zsnes/src/cfgload.asm b/zsnes/src/cfgload.asm index 0197bb7d..cce2173e 100644 --- a/zsnes/src/cfgload.asm +++ b/zsnes/src/cfgload.asm @@ -612,6 +612,7 @@ db '; 8 = 768x672 OGL WIN 9 = 896x784 OGL WIN',13,10 db '; 10 = 1024x896 OGL WIN 11 = 800x600 OGL FULL',13,10 db '; 12 = 1024x768 OGL FULL 13 = 640x480 OGL WIN',13,10 db '; 14 = 800x600 OGL WIN 15 = 1024x768 OGL WIN',13,10 +db '; 16 = VARIABLE OGL WIN',13,10 %endif db '',13,10 db 'VideoMode = %U',13,10 diff --git a/zsnes/src/linux/gl_draw.c b/zsnes/src/linux/gl_draw.c index 9000bfd9..0b4fff19 100644 --- a/zsnes/src/linux/gl_draw.c +++ b/zsnes/src/linux/gl_draw.c @@ -15,10 +15,12 @@ typedef enum { FALSE = 0, TRUE = !FALSE } BOOL; -// SDL VIDEO VARIOABLES -static SDL_Surface *surface; -static int SurfaceX, SurfaceY; -static int SurfaceLocking = 0; +// VIDEO VARIABLES +extern unsigned char cvidmode; +extern SDL_Surface *surface; +extern int SurfaceX, SurfaceY; +extern int SurfaceLocking; +extern DWORD BitDepth; // OPENGL VARIABLES static unsigned short *glvidbuffer = 0; @@ -39,6 +41,7 @@ int gl_start(int width, int height, int req_depth, int FullScreen) GLubyte scanbuffer[256]; int i; + flags |= (cvidmode == 16 ? SDL_RESIZABLE : 0); flags |= (FullScreen ? SDL_FULLSCREEN : 0); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); @@ -142,10 +145,8 @@ static void gl_drawspan(int hires, int start, int end) { if (!gltexture512) { - unsigned short *vbuf1 = - &((unsigned short *) vidbuffer)[16]; - unsigned short *vbuf2 = - &((unsigned short *) vidbuffer)[75036 * 2 + 16]; + unsigned short *vbuf1 = &((unsigned short *) vidbuffer)[16]; + unsigned short *vbuf2 = &((unsigned short *) vidbuffer)[75036 * 2 + 16]; unsigned short *vbuf = &glvidbuffer[0]; for (j = 0; j < 224; j++) diff --git a/zsnes/src/linux/sdlintrf.asm b/zsnes/src/linux/sdlintrf.asm index 856936db..a3674c19 100644 --- a/zsnes/src/linux/sdlintrf.asm +++ b/zsnes/src/linux/sdlintrf.asm @@ -970,7 +970,7 @@ SECTION .data ; Total Number of Video Modes %ifdef __OPENGL__ -NEWSYM NumVideoModes, dd 16 +NEWSYM NumVideoModes, dd 17 %else NEWSYM NumVideoModes, dd 4 %endif @@ -995,29 +995,30 @@ db '1024x768 OGL FULL',0 ;12 db '640x480 OGL WIN ',0 ;13 db '800x600 OGL WIN ',0 ;14 db '1024x768 OGL WIN ',0 ;15 +db 'VARIABLE OGL WIN ',0 ;16 %endif ; Video Mode Feature Availability (1 = Available, 0 = Not Available) ; Left side starts with Video Mode 0 -; vid mode column = 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5 -NEWSYM GUI16VID, db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; 16-bit mode -NEWSYM GUINGVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; New Graphics Mode Available -NEWSYM GUISLVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Scanlines -NEWSYM GUIINVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Interpolation -NEWSYM GUII2VID, db 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0 ; Interpolation(w) -NEWSYM GUIEAVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Eagle -NEWSYM GUIIEVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (Interp | Eagle) -NEWSYM GUIFSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Full Screen -NEWSYM GUISSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Small Screen -NEWSYM GUITBVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Triple Buffering -NEWSYM GUIHSVID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1 ; Half/Quarter Scanlines -NEWSYM GUI2xVID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1 ; 2xSaI/Super Eagle Engines -NEWSYM GUIM7VID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1 ; ?Mode 7 video thing? -NEWSYM GUIWFVID, db 0,1,0,1,0,0,1,0,0,0,0,1,1,0,0,0 ; If Windows Full Screen -NEWSYM GUIDSIZE, db 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0 -NEWSYM GUIRATIO, db 0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0 -NEWSYM GUIBIFIL, db 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1 ; binlinear = 1, nearest = 0 -NEWSYM GUITBWVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Triple Buffering (Win) +; vid mode column = 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6 +NEWSYM GUI16VID, db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; 16-bit mode +NEWSYM GUINGVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; New Graphics Mode Available +NEWSYM GUISLVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Scanlines +NEWSYM GUIINVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Interpolation +NEWSYM GUII2VID, db 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Interpolation(w) +NEWSYM GUIEAVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Eagle +NEWSYM GUIIEVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (Interp | Eagle) +NEWSYM GUIFSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Full Screen +NEWSYM GUISSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Small Screen +NEWSYM GUITBVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Triple Buffering +NEWSYM GUIHSVID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1 ; Half/Quarter Scanlines +NEWSYM GUI2xVID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1 ; 2xSaI/Super Eagle Engines +NEWSYM GUIM7VID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1 ; ?Mode 7 video thing? +NEWSYM GUIWFVID, db 0,1,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0 ; If Windows Full Screen +NEWSYM GUIDSIZE, db 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0 +NEWSYM GUIRATIO, db 0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0 +NEWSYM GUIBIFIL, db 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1 ; binlinear = 1, nearest = 0 +NEWSYM GUITBWVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Triple Buffering (Win) SECTION .text diff --git a/zsnes/src/linux/sdllink.c b/zsnes/src/linux/sdllink.c index 546b433c..ea5cd4bf 100644 --- a/zsnes/src/linux/sdllink.c +++ b/zsnes/src/linux/sdllink.c @@ -10,6 +10,10 @@ #include "sw_draw.h" #include "gl_draw.h" +#ifdef __OPENGL__ +#include +#endif + #define BYTE unsigned char #define WORD unsigned short #define DWORD unsigned long @@ -33,6 +37,11 @@ DWORD PrevSoundQuality; extern BYTE StereoSound; extern DWORD SoundQuality; +// SDL VIDEO VARIABLES +SDL_Surface *surface; +int SurfaceLocking = 0; +int SurfaceX, SurfaceY; + // VIDEO VARIABLES static DWORD WindowWidth = 256; static DWORD WindowHeight = 224; @@ -44,7 +53,7 @@ DWORD BitDepth = 0; // Do NOT change this for ANY reason // JOYSTICK AND KEYBOARD INPUT SDL_Joystick *JoystickInput[4]; -DWORD CurrentJoy = 0; +//DWORD CurrentJoy = 0; unsigned char keyboardhit = 0; int shiftptr = 0; DWORD numlockptr; @@ -86,9 +95,8 @@ static _int64 zsnes_GetTicks() struct timeval tv; gettimeofday(&tv, NULL); - return (tv.tv_sec - start_time.tv_sec) * 1000000L + (tv.tv_usec - - start_time. - tv_usec); + return (tv.tv_sec - start_time.tv_sec) * 1000000L + + (tv.tv_usec - start_time.tv_usec); } void drawscreenwin(void); @@ -100,7 +108,7 @@ int Main_Proc(void) { int j; SDL_Event event; - Uint8 JoyButton; + //Uint8 JoyButton; while (SDL_PollEvent(&event)) { @@ -116,11 +124,8 @@ int Main_Proc(void) numlockptr = 0; if (event.key.keysym.scancode - 8 >= 0) { - if (pressed - [event.key.keysym.scancode - 8] != - 2) - pressed[event.key.keysym. - scancode - 8] = 1; + if (pressed[event.key.keysym.scancode - 8] != 2) + pressed[event.key.keysym.scancode - 8] = 1; ProcessKeyBuf(event.key.keysym.sym); } break; @@ -130,21 +135,16 @@ int Main_Proc(void) event.key.keysym.sym == SDLK_RSHIFT) shiftptr = 0; if (event.key.keysym.scancode - 8 >= 0) - pressed[event.key.keysym.scancode - 8] = - 0; + pressed[event.key.keysym.scancode - 8] = 0; break; case SDL_MOUSEMOTION: MouseX = event.motion.x; MouseY = event.motion.y; - if (MouseX < MouseMinX) - MouseX = MouseMinX; - if (MouseX > MouseMaxX) - MouseX = MouseMaxX; - if (MouseY < MouseMinY) - MouseY = MouseMinY; - if (MouseY > MouseMaxY) - MouseY = MouseMaxY; + if (MouseX < MouseMinX) MouseX = MouseMinX; + if (MouseX > MouseMaxX) MouseX = MouseMaxX; + if (MouseY < MouseMinY) MouseY = MouseMinY; + if (MouseY > MouseMaxY) MouseY = MouseMaxY; break; case SDL_MOUSEBUTTONDOWN: @@ -165,9 +165,7 @@ int Main_Proc(void) ProcessKeyBuf(SDLK_RETURN); // Yes, this is intentional - DDOI default: - MouseButton = - MouseButton | event. - button.button; + MouseButton = MouseButton | event.button.button; break; } @@ -185,50 +183,34 @@ int Main_Proc(void) really general here, but this may break the format of 'pressed' */ case SDL_JOYBALLMOTION: - CurrentJoy = event.jball.which; + //CurrentJoy = event.jball.which; if (event.jball.ball == 0) { if (event.jball.xrel < -100) { - pressed[0x100 + - CurrentJoy * 32 + 6] = - 0; - pressed[0x100 + - CurrentJoy * 32 + 7] = - 1; + pressed[0x100 + event.jball.which * 32 + 6] = 0; + pressed[0x100 + event.jball.which * 32 + 7] = 1; } if (event.jball.xrel > 100) { - pressed[0x100 + - CurrentJoy * 32 + 6] = - 1; - pressed[0x100 + - CurrentJoy * 32 + 7] = - 0; + pressed[0x100 + event.jball.which * 32 + 6] = 1; + pressed[0x100 + event.jball.which * 32 + 7] = 0; } if (event.jball.yrel < -100) { - pressed[0x100 + - CurrentJoy * 32 + 8] = - 0; - pressed[0x100 + - CurrentJoy * 32 + 9] = - 1; + pressed[0x100 + event.jball.which * 32 + 8] = 0; + pressed[0x100 + event.jball.which * 32 + 9] = 1; } if (event.jball.yrel > 100) { - pressed[0x100 + - CurrentJoy * 32 + 8] = - 1; - pressed[0x100 + - CurrentJoy * 32 + 9] = - 0; + pressed[0x100 + event.jball.which * 32 + 8] = 1; + pressed[0x100 + event.jball.which * 32 + 9] = 0; } } break; case SDL_JOYAXISMOTION: - CurrentJoy = event.jaxis.which; + //CurrentJoy = event.jaxis.which; for (j = 0; j < 3; j++) { if (event.jaxis.axis == j) @@ -236,57 +218,59 @@ int Main_Proc(void) if (event.jaxis.value < -16384) { pressed[0x100 + - CurrentJoy * - 32 + 2 * j + - 1] = 1; + event.jaxis.which * 32 + 2 * j + 1] = 1; pressed[0x100 + - CurrentJoy * - 32 + 2 * j + - 0] = 0; + event.jaxis.which * 32 + 2 * j + 0] = 0; } - else if (event.jaxis.value > - 16384) + else if (event.jaxis.value > 16384) { pressed[0x100 + - CurrentJoy * - 32 + 2 * j + - 0] = 1; + event.jaxis.which * 32 + 2 * j + 0] = 1; pressed[0x100 + - CurrentJoy * - 32 + 2 * j + - 1] = 0; + event.jaxis.which * 32 + 2 * j + 1] = 0; } else { pressed[0x100 + - CurrentJoy * - 32 + 2 * j + - 0] = 0; + event.jaxis.which * 32 + 2 * j + 0] = 0; pressed[0x100 + - CurrentJoy * - 32 + 2 * j + - 1] = 0; + event.jaxis.which * 32 + 2 * j + 1] = 0; } } } break; case SDL_JOYBUTTONDOWN: - CurrentJoy = event.jbutton.which; - JoyButton = event.jbutton.button; - pressed[0x100 + CurrentJoy * 32 + 16 + - JoyButton] = 1; + //CurrentJoy = event.jbutton.which; + //JoyButton = event.jbutton.button; + pressed[0x100 + event.jbutton.which * 32 + 16 + + event.jbutton.button] = 1; break; case SDL_JOYBUTTONUP: - CurrentJoy = event.jbutton.which; - JoyButton = event.jbutton.button; - pressed[0x100 + CurrentJoy * 32 + 16 + - JoyButton] = 0; + //CurrentJoy = event.jbutton.which; + //JoyButton = event.jbutton.button; + pressed[0x100 + event.jbutton.which * 32 + 16 + + event.jbutton.button] = 0; break; case SDL_QUIT: LinuxExit(); break; +#ifdef __OPENGL__ + case SDL_VIDEORESIZE: + if(cvidmode != 16) { + surface = SDL_SetVideoMode(WindowWidth, WindowHeight, + BitDepth, surface->flags & ~SDL_RESIZABLE); + break; + } + WindowWidth = SurfaceX = event.resize.w; + WindowHeight = SurfaceY = event.resize.h; + surface = SDL_SetVideoMode(WindowWidth, + WindowHeight, BitDepth, surface->flags); + glViewport(0,0, WindowWidth, WindowHeight); + glFlush(); + break; +#endif default: break; } @@ -324,42 +308,21 @@ void ProcessKeyBuf(int scancode) { switch (scancode) { - case '1': - vkeyval = '!'; - break; - case '2': - vkeyval = '@'; - break; - case '3': - vkeyval = '#'; - break; - case '4': - vkeyval = '$'; - break; - case '5': - vkeyval = '%'; - break; - case '6': - vkeyval = '^'; - break; - case '7': - vkeyval = '&'; - break; - case '8': - vkeyval = '*'; - break; - case '9': - vkeyval = '('; - break; - case '0': - vkeyval = ')'; - break; + case '1': vkeyval = '!'; break; + case '2': vkeyval = '@'; break; + case '3': vkeyval = '#'; break; + case '4': vkeyval = '$'; break; + case '5': vkeyval = '%'; break; + case '6': vkeyval = '^'; break; + case '7': vkeyval = '&'; break; + case '8': vkeyval = '*'; break; + case '9': vkeyval = '('; break; + case '0': vkeyval = ')'; break; } } } if ((scancode >= SDLK_KP0) && (scancode <= SDLK_KP9)) { - if (numlockptr) { accept = true; @@ -370,42 +333,15 @@ void ProcessKeyBuf(int scancode) switch (scancode) { - case SDLK_KP9: - vkeyval = 256 + 73; - accept = true; - break; - case SDLK_KP8: - vkeyval = 256 + 72; - accept = true; - break; - case SDLK_KP7: - vkeyval = 256 + 71; - accept = true; - break; - case SDLK_KP6: - vkeyval = 256 + 77; - accept = true; - break; - case SDLK_KP5: - vkeyval = 256 + 76; - accept = true; - break; - case SDLK_KP4: - vkeyval = 256 + 75; - accept = true; - break; - case SDLK_KP3: - vkeyval = 256 + 81; - accept = true; - break; - case SDLK_KP2: - vkeyval = 256 + 80; - accept = true; - break; - case SDLK_KP1: - vkeyval = 256 + 79; - accept = true; - break; + case SDLK_KP9: vkeyval = 256 + 73; accept = true; break; + case SDLK_KP8: vkeyval = 256 + 72; accept = true; break; + case SDLK_KP7: vkeyval = 256 + 71; accept = true; break; + case SDLK_KP6: vkeyval = 256 + 77; accept = true; break; + case SDLK_KP5: vkeyval = 256 + 76; accept = true; break; + case SDLK_KP4: vkeyval = 256 + 75; accept = true; break; + case SDLK_KP3: vkeyval = 256 + 81; accept = true; break; + case SDLK_KP2: vkeyval = 256 + 80; accept = true; break; + case SDLK_KP1: vkeyval = 256 + 79; accept = true; break; } } // end no-numlock } // end testing of keypad @@ -413,153 +349,54 @@ void ProcessKeyBuf(int scancode) { switch (scancode) { - case SDLK_MINUS: - vkeyval = '-'; - accept = true; - break; - case SDLK_EQUALS: - vkeyval = '='; - accept = true; - break; - case SDLK_LEFTBRACKET: - vkeyval = '['; - accept = true; - break; - case SDLK_RIGHTBRACKET: - vkeyval = ']'; - accept = true; - break; - case SDLK_SEMICOLON: - vkeyval = ';'; - accept = true; - break; + case SDLK_MINUS: vkeyval = '-'; accept = true; break; + case SDLK_EQUALS: vkeyval = '='; accept = true; break; + case SDLK_LEFTBRACKET: vkeyval = '['; accept = true; break; + case SDLK_RIGHTBRACKET: vkeyval = ']'; accept = true; break; + case SDLK_SEMICOLON: vkeyval = ';'; accept = true; break; // ??? - DDOI //case 222: vkeyval=39; accept = true; break; //case 220: vkeyval=92; accept = true; break; - case SDLK_COMMA: - vkeyval = ','; - accept = true; - break; - case SDLK_PERIOD: - vkeyval = '.'; - accept = true; - break; - case SDLK_SLASH: - vkeyval = '/'; - accept = true; - break; - case SDLK_QUOTE: - vkeyval = '`'; - accept = true; - break; + case SDLK_COMMA: vkeyval = ','; accept = true; break; + case SDLK_PERIOD: vkeyval = '.'; accept = true; break; + case SDLK_SLASH: vkeyval = '/'; accept = true; break; + case SDLK_QUOTE: vkeyval = '`'; accept = true; break; } } else { switch (scancode) { - case SDLK_MINUS: - vkeyval = '_'; - accept = true; - break; - case SDLK_EQUALS: - vkeyval = '+'; - accept = true; - break; - case SDLK_LEFTBRACKET: - vkeyval = '{'; - accept = true; - break; - case SDLK_RIGHTBRACKET: - vkeyval = '}'; - accept = true; - break; - case SDLK_SEMICOLON: - vkeyval = ':'; - accept = true; - break; - case SDLK_QUOTE: - vkeyval = '"'; - accept = true; - break; - case SDLK_COMMA: - vkeyval = '<'; - accept = true; - break; - case SDLK_PERIOD: - vkeyval = '>'; - accept = true; - break; - case SDLK_SLASH: - vkeyval = '?'; - accept = true; - break; - case SDLK_BACKQUOTE: - vkeyval = '~'; - accept = true; - break; - case SDLK_BACKSLASH: - vkeyval = '|'; - accept = true; - break; + case SDLK_MINUS: vkeyval = '_'; accept = true; break; + case SDLK_EQUALS: vkeyval = '+'; accept = true; break; + case SDLK_LEFTBRACKET: vkeyval = '{'; accept = true; break; + case SDLK_RIGHTBRACKET: vkeyval = '}'; accept = true; break; + case SDLK_SEMICOLON: vkeyval = ':'; accept = true; break; + case SDLK_QUOTE: vkeyval = '"'; accept = true; break; + case SDLK_COMMA: vkeyval = '<'; accept = true; break; + case SDLK_PERIOD: vkeyval = '>'; accept = true; break; + case SDLK_SLASH: vkeyval = '?'; accept = true; break; + case SDLK_BACKQUOTE: vkeyval = '~'; accept = true; break; + case SDLK_BACKSLASH: vkeyval = '|'; accept = true; break; } } // TODO Figure out what the rest these are supposed to be - DDOI switch (scancode) { - case SDLK_PAGEUP: - vkeyval = 256 + 73; - accept = true; - break; - case SDLK_UP: - vkeyval = 256 + 72; - accept = true; - break; - case SDLK_HOME: - vkeyval = 256 + 71; - accept = true; - break; - case SDLK_RIGHT: - vkeyval = 256 + 77; - accept = true; - break; + case SDLK_PAGEUP: vkeyval = 256 + 73; accept = true; break; + case SDLK_UP: vkeyval = 256 + 72; accept = true; break; + case SDLK_HOME: vkeyval = 256 + 71; accept = true; break; + case SDLK_RIGHT: vkeyval = 256 + 77; accept = true; break; //case 12: vkeyval = 256+76; accept = true; break; - case SDLK_LEFT: - vkeyval = 256 + 75; - accept = true; - break; - case SDLK_PAGEDOWN: - vkeyval = 256 + 81; - accept = true; - break; - case SDLK_DOWN: - vkeyval = 256 + 80; - accept = true; - break; - case SDLK_END: - vkeyval = 256 + 79; - accept = true; - break; - case SDLK_KP_PLUS: - vkeyval = '+'; - accept = true; - break; - case SDLK_KP_MINUS: - vkeyval = '-'; - accept = true; - break; - case SDLK_KP_MULTIPLY: - vkeyval = '*'; - accept = true; - break; - case SDLK_KP_DIVIDE: - vkeyval = '/'; - accept = true; - break; - case SDLK_KP_PERIOD: - vkeyval = '.'; - accept = true; - break; + case SDLK_LEFT: vkeyval = 256 + 75; accept = true; break; + case SDLK_PAGEDOWN: vkeyval = 256 + 81; accept = true; break; + case SDLK_DOWN: vkeyval = 256 + 80; accept = true; break; + case SDLK_END: vkeyval = 256 + 79; accept = true; break; + case SDLK_KP_PLUS: vkeyval = '+'; accept = true; break; + case SDLK_KP_MINUS: vkeyval = '-'; accept = true; break; + case SDLK_KP_MULTIPLY: vkeyval = '*'; accept = true; break; + case SDLK_KP_DIVIDE: vkeyval = '/'; accept = true; break; + case SDLK_KP_PERIOD: vkeyval = '.'; accept = true; break; } if (accept) @@ -666,7 +503,8 @@ int startgame(void) if (!sdl_inited) { - if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) + if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_TIMER | + SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) { fprintf(stderr, "Could not initialize SDL!\n"); return FALSE; @@ -677,29 +515,22 @@ int startgame(void) BitDepth = (UseOpenGL ? 16 : 0); - if (sdl_inited == 1) - sw_end(); + if (sdl_inited == 1) sw_end(); #ifdef __OPENGL__ - else if (sdl_inited == 2) - gl_end(); + else if (sdl_inited == 2) gl_end(); if (UseOpenGL) { - status = gl_start(WindowWidth, WindowHeight, BitDepth, - FullScreen); + status = gl_start(WindowWidth, WindowHeight, BitDepth, FullScreen); } else #endif { - status = sw_start(WindowWidth, WindowHeight, BitDepth, - FullScreen); + status = sw_start(WindowWidth, WindowHeight, BitDepth, FullScreen); } - if (!status) - return FALSE; - + if (!status) return FALSE; sdl_inited = UseOpenGL + 1; - return TRUE; } @@ -806,7 +637,7 @@ void initwinvideo(void) UseOpenGL = 1; #else if (cvidmode > 3) - cvidmode = 0; + cvidmode = 2; // set it to the default 512x448 W #endif switch (cvidmode) @@ -822,12 +653,13 @@ void initwinvideo(void) break; case 2: case 5: + case 13: WindowWidth = 512; WindowHeight = 448; break; case 3: case 6: - case 13: + case 16: WindowWidth = 640; WindowHeight = 480; break; diff --git a/zsnes/src/linux/sw_draw.c b/zsnes/src/linux/sw_draw.c index 9582fb96..cf12b794 100644 --- a/zsnes/src/linux/sw_draw.c +++ b/zsnes/src/linux/sw_draw.c @@ -10,13 +10,14 @@ typedef enum { FALSE = 0, TRUE = !FALSE } BOOL; -extern void LinuxExit(); +// VIDEO VARIABLES +extern unsigned char cvidmode; +extern SDL_Surface *surface; +extern int SurfaceX, SurfaceY; +extern int SurfaceLocking; +extern DWORD BitDepth; -// SDL VIDEO VARIOABLES -static SDL_Surface *surface; -static int SurfaceLocking = 0; -static int SurfaceX, SurfaceY; -static DWORD BitDepth = 0; // Do NOT change this for ANY reason +extern void LinuxExit(); extern unsigned int vidbuffer; extern DWORD converta; @@ -31,11 +32,9 @@ BOOL sw_start(int width, int height, int req_depth, int FullScreen) p = BitConv32Ptr; for(i=0; i<65536; i++) { - color32 = ((i&0xF800)<<8)+ - ((i&0x07E0)<<5)+ - ((i&0x001F)<<3)+0xFF000000; - (*(unsigned int *)(p)) = color32; - p += 4; + color32 = ((i&0xF800)<<8) + ((i&0x07E0)<<5) + ((i&0x001F)<<3)+0xFF000000; + (*(unsigned int *)(p)) = color32; + p += 4; } flags |= (FullScreen ? SDL_FULLSCREEN : 0); @@ -43,8 +42,8 @@ BOOL sw_start(int width, int height, int req_depth, int FullScreen) SurfaceX = width; SurfaceY = height; surface = SDL_SetVideoMode(SurfaceX, SurfaceY, req_depth, flags); if (surface == NULL) { - fprintf (stderr, "Could not set %dx%d video mode.\n", SurfaceX, SurfaceY); - return FALSE; + fprintf (stderr, "Could not set %dx%d video mode.\n", SurfaceX, SurfaceY); + return FALSE; } SurfaceLocking = SDL_MUSTLOCK(surface);