Skip to content

Commit

Permalink
Disable dynamic height resolution. Now only 256x224 exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebuleon committed Aug 21, 2014
1 parent aa75de9 commit 0b8a1ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 39 deletions.
29 changes: 5 additions & 24 deletions menu/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ void S9xLoadSDD1Data (void)
}

u16 IntermediateScreen[SNES_WIDTH * SNES_HEIGHT_EXTENDED];
bool LastPAL; /* Whether the last frame's height was 239 (true) or 224. */

bool8_32 S9xInitUpdate ()
{
Expand All @@ -164,26 +163,16 @@ bool8_32 S9xDeinitUpdate (int Width, int Height, bool8_32)
mFramesCleared++;
}

// If the height changed from 224 to 239, or from 239 to 224,
// possibly change the resolution.
bool PAL = !!(Memory.FillRAM[0x2133] & 4);
if (PAL != LastPAL)
{
sal_VideoSetPAL(mMenuOptions.fullScreen, PAL);
LastPAL = PAL;
}

switch (mMenuOptions.fullScreen)
{
case 0: /* No scaling */
case 3: /* Hardware scaling */
{
u32 h = PAL ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT;
u32 y, pitch = sal_VideoGetPitch();
u8 *src = (u8*) IntermediateScreen, *dst = (u8*) sal_VideoGetBuffer()
+ ((sal_VideoGetWidth() - SNES_WIDTH) / 2) * sizeof(u16)
+ ((sal_VideoGetHeight() - h) / 2) * pitch;
for (y = 0; y < h; y++)
+ ((sal_VideoGetHeight() - SNES_HEIGHT) / 2) * pitch;
for (y = 0; y < SNES_HEIGHT; y++)
{
memcpy(dst, src, SNES_WIDTH * sizeof(u16));
src += SNES_WIDTH * sizeof(u16);
Expand All @@ -193,19 +182,11 @@ bool8_32 S9xDeinitUpdate (int Width, int Height, bool8_32)
}

case 1: /* Fast software scaling */
if (PAL) {
upscale_256x240_to_320x240((uint32_t*) sal_VideoGetBuffer(), (uint32_t*) IntermediateScreen, SNES_WIDTH);
} else {
upscale_p((uint32_t*) sal_VideoGetBuffer(), (uint32_t*) IntermediateScreen, SNES_WIDTH);
}
upscale_p((uint32_t*) sal_VideoGetBuffer(), (uint32_t*) IntermediateScreen, SNES_WIDTH);
break;

case 2: /* Smooth software scaling */
if (PAL) {
upscale_256x240_to_320x240_bilinearish((uint32_t*) sal_VideoGetBuffer() + 160, (uint32_t*) IntermediateScreen, SNES_WIDTH);
} else {
upscale_256x224_to_320x240_bilinearish((uint32_t*) sal_VideoGetBuffer() + 160, (uint32_t*) IntermediateScreen, SNES_WIDTH);
}
upscale_256x224_to_320x240_bilinearish((uint32_t*) sal_VideoGetBuffer() + 160, (uint32_t*) IntermediateScreen, SNES_WIDTH);
break;
}

Expand Down Expand Up @@ -440,7 +421,7 @@ int Run(int sound)
{
int i;

sal_VideoEnterGame(mMenuOptions.fullScreen, Memory.FillRAM[0x2133] & 4, Memory.ROMFramesPerSecond);
sal_VideoEnterGame(mMenuOptions.fullScreen, Memory.ROMFramesPerSecond);

Settings.SoundSync = mMenuOptions.soundSync;
Settings.SkipFrames = mMenuOptions.frameSkip == 0 ? AUTO_FRAMERATE : mMenuOptions.frameSkip - 1;
Expand Down
5 changes: 1 addition & 4 deletions sal/include/sal_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ void sal_VideoBitmapDim(u16* img, u32 pixelCount);
void sal_VideoPrint(s32 x, s32 y, const char *buffer, u32 color);
u32 sal_VideoGetWidth();
u32 sal_VideoGetHeight();
void sal_VideoEnterGame(u32 fullscreenOption, u32 pal, u32 fps);
/* Called by the main code when the height changes from 239 to 224, or from
* 224 to 239. */
void sal_VideoSetPAL(u32 fullscreenOption, u32 pal);
void sal_VideoEnterGame(u32 fullscreenOption, u32 fps);
void sal_VideoExitGame();
u32 sal_VideoGetPitch();
void sal_VideoFlip(s32 vsync);
Expand Down
13 changes: 2 additions & 11 deletions sal/linux/sal.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,11 @@ u32 sal_VideoGetPitch()
return mScreen->pitch;
}

void sal_VideoEnterGame(u32 fullscreenOption, u32 pal, u32 refreshRate)
void sal_VideoEnterGame(u32 fullscreenOption, u32 refreshRate)
{
#ifdef GCW_ZERO
/* Copied from C++ headers which we can't include in C */
unsigned int Width = 256 /* SNES_WIDTH */,
Height = pal ? 239 /* SNES_HEIGHT_EXTENDED */ : 224 /* SNES_HEIGHT */;
unsigned int Width = 256 /* SNES_WIDTH */, Height = 224 /* SNES_HEIGHT */;
if (fullscreenOption != 3)
{
Width = SAL_SCREEN_WIDTH;
Expand All @@ -285,14 +284,6 @@ void sal_VideoEnterGame(u32 fullscreenOption, u32 pal, u32 refreshRate)
#endif
}

void sal_VideoSetPAL(u32 fullscreenOption, u32 pal)
{
if (fullscreenOption == 3) /* hardware scaling */
{
sal_VideoEnterGame(fullscreenOption, pal, mRefreshRate);
}
}

void sal_VideoExitGame()
{
#ifdef GCW_ZERO
Expand Down

0 comments on commit 0b8a1ae

Please sign in to comment.