]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/video.cpp
Fixed problem with PATD not updating properly
[virtualjaguar] / src / video.cpp
index 45fd04c2af8f73e121ef49590f471f8c5ca45c0c..cbf1ffe473b777ac075f0c58850af8912c6642ea 100644 (file)
 //shouldn't these exist here??? Prolly.
 //And now, they do! :-)
 SDL_Surface * surface, * mainSurface;
+SDL_Joystick * joystick;
 Uint32 mainSurfaceFlags;
 //int16 * backbuffer;
 uint32 * backbuffer;
-SDL_Joystick * joystick;
 
 // One of the reasons why OpenGL is slower then normal SDL rendering, is because
 // the data is being pumped into the buffer every frame with a overflow as result.
@@ -101,8 +101,14 @@ bool InitVideo(void)
 /*     surface = SDL_CreateRGBSurface(SDL_SWSURFACE, VIRTUAL_SCREEN_WIDTH,
                (vjs.hardwareTypeNTSC ? VIRTUAL_SCREEN_HEIGHT_NTSC : VIRTUAL_SCREEN_HEIGHT_PAL),
                16, 0x7C00, 0x03E0, 0x001F, 0);//*/
+
+       uint32 vsWidth = VIRTUAL_SCREEN_WIDTH;
+
+       if (vjs.renderType == RT_TV)
+               vsWidth = 1280;
 //24BPP
-       surface = SDL_CreateRGBSurface(SDL_SWSURFACE, VIRTUAL_SCREEN_WIDTH,
+//     surface = SDL_CreateRGBSurface(SDL_SWSURFACE, VIRTUAL_SCREEN_WIDTH,
+       surface = SDL_CreateRGBSurface(SDL_SWSURFACE, vsWidth,
                (vjs.hardwareTypeNTSC ? VIRTUAL_SCREEN_HEIGHT_NTSC : VIRTUAL_SCREEN_HEIGHT_PAL), 32,
 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
                 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
@@ -186,7 +192,10 @@ void RenderBackbuffer(void)
                        SDL_Delay(10);
 
 //     memcpy(surface->pixels, backbuffer, tom_getVideoModeWidth() * tom_getVideoModeHeight() * 2);
-       memcpy(surface->pixels, backbuffer, tom_getVideoModeWidth() * tom_getVideoModeHeight() * 4);
+       if (vjs.renderType == RT_NORMAL)
+               memcpy(surface->pixels, backbuffer, tom_getVideoModeWidth() * tom_getVideoModeHeight() * 4);
+       else if (vjs.renderType == RT_TV)
+               memcpy(surface->pixels, backbuffer, 1280 * tom_getVideoModeHeight() * 4);
 
        if (SDL_MUSTLOCK(surface))
                SDL_UnlockSurface(surface);
@@ -245,7 +254,7 @@ void ResizeScreen(uint32 width, uint32 height)
        }
        else
        {
-               mainSurface = SDL_SetVideoMode(width, height, 16, mainSurfaceFlags);
+               mainSurface = SDL_SetVideoMode(width, height, 32, mainSurfaceFlags);
 
                if (mainSurface == NULL)
                {
@@ -258,14 +267,6 @@ void ResizeScreen(uint32 width, uint32 height)
        SDL_WM_SetCaption(window_title, window_title);
 }
 
-//
-// Return the screen's pitch
-//
-uint32 GetSDLScreenPitch(void)
-{
-       return surface->pitch;
-}
-
 //
 // Return the screen's width in pixels
 //
@@ -289,7 +290,7 @@ void ToggleFullscreen(void)
        if (vjs.fullscreen)
                mainSurfaceFlags |= SDL_FULLSCREEN;
 
-       mainSurface = SDL_SetVideoMode(tom_width, tom_height, 16, mainSurfaceFlags);
+       mainSurface = SDL_SetVideoMode(tom_width, tom_height, 32, mainSurfaceFlags);
 
        if (mainSurface == NULL)
        {