X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvideo.cpp;h=ffeee21d0e70139820954f489fc358fad5f46a58;hb=847f593941ee60d7be72cd07309201bfdb3651f8;hp=1df9fca1e15627bfd619bfb8fb77dbf810729130;hpb=824222a5bc2a86fdef6763104fc0f48b8972cfbe;p=virtualjaguar diff --git a/src/video.cpp b/src/video.cpp index 1df9fca..ffeee21 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -13,10 +13,11 @@ // External global variables //shouldn't these exist here??? Prolly. -extern SDL_Surface * surface, * mainSurface; -extern Uint32 mainSurfaceFlags; -extern int16 * backbuffer; -extern SDL_Joystick * joystick; +//And now, they do! :-) +SDL_Surface * surface, * mainSurface; +Uint32 mainSurfaceFlags; +int16 * backbuffer; +SDL_Joystick * joystick; // // Prime SDL and create surfaces @@ -57,9 +58,9 @@ bool InitVideo(void) mainSurfaceFlags |= SDL_FULLSCREEN; if (!vjs.useOpenGL) - mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT, 16, mainSurfaceFlags); + mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT_NTSC, 16, mainSurfaceFlags); else - mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH * 2, VIRTUAL_SCREEN_HEIGHT * 2, 16, mainSurfaceFlags); + mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH * 2, VIRTUAL_SCREEN_HEIGHT_NTSC * 2, 16, mainSurfaceFlags); if (mainSurface == NULL) { @@ -70,7 +71,7 @@ bool InitVideo(void) SDL_WM_SetCaption("Virtual Jaguar", "Virtual Jaguar"); // Create the primary SDL display (16 BPP, 5/5/5 RGB format) - surface = SDL_CreateRGBSurface(SDL_SWSURFACE, VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT, + surface = SDL_CreateRGBSurface(SDL_SWSURFACE, VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT_NTSC, 16, 0x7C00, 0x03E0, 0x001F, 0); if (surface == NULL) @@ -80,7 +81,9 @@ bool InitVideo(void) } if (vjs.useOpenGL) - sdlemu_init_opengl(surface, 1/*method*/, 2/*size*/, 0/*texture type (linear, nearest)*/); +//Should make another setting here, for either linear or nearest (instead of just picking one) +//And we have! ;-) + sdlemu_init_opengl(surface, 1/*method*/, 2/*size*/, vjs.glFilter/*texture type (linear, nearest)*/); // Initialize Joystick support under SDL if (vjs.useJoystick) @@ -102,6 +105,12 @@ bool InitVideo(void) } } + // Set up the backbuffer +//To be safe, this should be 1280 * 625 * 2... +// backbuffer = (int16 *)malloc(845 * 525 * sizeof(int16)); + backbuffer = (int16 *)malloc(1280 * 625 * sizeof(int16)); + memset(backbuffer, 0x44, VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT_NTSC * sizeof(int16)); + return true; } @@ -117,6 +126,8 @@ void VideoDone(void) SDL_FreeSurface(surface); SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER); SDL_Quit(); + + free(backbuffer); } // @@ -160,9 +171,10 @@ void ResizeScreen(uint32 width, uint32 height) exit(1); } - sprintf(window_title, "Virtual Jaguar (%i x %i)", (int)width, (int)height); - - if (!vjs.useOpenGL) + if (vjs.useOpenGL) + // This seems to work well for resizing (i.e., changes in the pixel width)... + sdlemu_resize_texture(surface, mainSurface, vjs.glFilter); + else { mainSurface = SDL_SetVideoMode(width, height, 16, mainSurfaceFlags); @@ -173,11 +185,12 @@ void ResizeScreen(uint32 width, uint32 height) } } + sprintf(window_title, "Virtual Jaguar (%i x %i)", (int)width, (int)height); SDL_WM_SetCaption(window_title, window_title); // This seems to work well for resizing (i.e., changes in the pixel width)... - if (vjs.useOpenGL) - sdlemu_resize_texture(surface, mainSurface); +// if (vjs.useOpenGL) +// sdlemu_resize_texture(surface, mainSurface); } //