Skip to content

Commit

Permalink
Adjust the buffer size keeping in mind that the screen size may have
Browse files Browse the repository at this point in the history
been adjusted by the gcd calculation. This fix the problem with the
256x246 resolutions adjusted to 256x24 by the gcd.
  • Loading branch information
plrguez committed Aug 9, 2021
1 parent 1c174a7 commit 61bab3c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/sdl-dingux/sdl_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1958,10 +1958,6 @@ int VideoInit()
VideoBufferWidth = gcd(VideoBufferWidth, modes[0]->w);
VideoBufferHeight = gcd(VideoBufferHeight, modes[0]->h);
}

/* TODO: Kung fu Master This must be valid but for now it fails in OD Beta 20210809 */
if (VideoBufferWidth == 256 && VideoBufferHeight == 240)
VideoBufferHeight = 256;

if (hwscale == 1) //Aspect
setenv("SDL_VIDEO_KMSDRM_SCALING_MODE", "1", 1);
Expand Down Expand Up @@ -2023,9 +2019,22 @@ int VideoInit()
nBurnPitch = VideoBufferWidth * 2;

PhysicalBufferWidth = screen->w;
#ifdef DEVICE_GCW0
/* If resolution adjusted by gcd for hardware scaling is lesser than original */
/* then adjust the buffer size */
if (hwscale > 0) {
int bVideoBufferWidth, bVideoBufferHeight;
BurnDrvGetFullSize(&bVideoBufferWidth, &bVideoBufferHeight);
if (bVideoBufferWidth < VideoBufferWidth) bVideoBufferWidth = VideoBufferWidth;
if (bVideoBufferHeight < VideoBufferHeight) bVideoBufferHeight = VideoBufferHeight;
BurnVideoBuffer = (unsigned short *)malloc(bVideoBufferWidth * bVideoBufferHeight * 2);
memset(BurnVideoBuffer, 0, bVideoBufferWidth * bVideoBufferHeight * 2);
} else {
#endif
BurnVideoBuffer = (unsigned short *)malloc(VideoBufferWidth * VideoBufferHeight * 2);
memset(BurnVideoBuffer, 0, VideoBufferWidth * VideoBufferHeight * 2);
#ifdef DEVICE_GCW0
}
#endif

#ifdef DEVICE_GCW0
Expand Down

0 comments on commit 61bab3c

Please sign in to comment.