mirror of https://github.com/snes9xgit/snes9x.git
parent
784667f5b2
commit
aa6abace40
33
gfx.cpp
33
gfx.cpp
|
@ -49,15 +49,13 @@ bool8 S9xGraphicsInit (void)
|
||||||
S9xInitTileRenderer();
|
S9xInitTileRenderer();
|
||||||
memset(BlackColourMap, 0, 256 * sizeof(uint16));
|
memset(BlackColourMap, 0, 256 * sizeof(uint16));
|
||||||
|
|
||||||
GFX.RealPPL = GFX.Pitch >> 1;
|
|
||||||
IPPU.OBJChanged = TRUE;
|
IPPU.OBJChanged = TRUE;
|
||||||
Settings.BG_Forced = 0;
|
Settings.BG_Forced = 0;
|
||||||
S9xFixColourBrightness();
|
S9xFixColourBrightness();
|
||||||
S9xBuildDirectColourMaps();
|
S9xBuildDirectColourMaps();
|
||||||
|
|
||||||
|
GFX.Screen = &GFX.ScreenBuffer[GFX.RealPPL * 32];
|
||||||
GFX.ZERO = (uint16 *) malloc(sizeof(uint16) * 0x10000);
|
GFX.ZERO = (uint16 *) malloc(sizeof(uint16) * 0x10000);
|
||||||
|
|
||||||
GFX.ScreenSize = GFX.Pitch / 2 * SNES_HEIGHT_EXTENDED * (Settings.SupportHiRes ? 2 : 1);
|
|
||||||
GFX.SubScreen = (uint16 *) malloc(GFX.ScreenSize * sizeof(uint16));
|
GFX.SubScreen = (uint16 *) malloc(GFX.ScreenSize * sizeof(uint16));
|
||||||
GFX.ZBuffer = (uint8 *) malloc(GFX.ScreenSize);
|
GFX.ZBuffer = (uint8 *) malloc(GFX.ScreenSize);
|
||||||
GFX.SubZBuffer = (uint8 *) malloc(GFX.ScreenSize);
|
GFX.SubZBuffer = (uint8 *) malloc(GFX.ScreenSize);
|
||||||
|
@ -121,19 +119,11 @@ void S9xGraphicsScreenResize (void)
|
||||||
|
|
||||||
if (Settings.SupportHiRes && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires))
|
if (Settings.SupportHiRes && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires))
|
||||||
{
|
{
|
||||||
GFX.RealPPL = GFX.Pitch >> 1;
|
|
||||||
IPPU.DoubleWidthPixels = TRUE;
|
IPPU.DoubleWidthPixels = TRUE;
|
||||||
IPPU.RenderedScreenWidth = SNES_WIDTH << 1;
|
IPPU.RenderedScreenWidth = SNES_WIDTH << 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGL
|
|
||||||
if (Settings.OpenGLEnable)
|
|
||||||
GFX.RealPPL = SNES_WIDTH;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
GFX.RealPPL = GFX.Pitch >> 1;
|
|
||||||
|
|
||||||
IPPU.DoubleWidthPixels = FALSE;
|
IPPU.DoubleWidthPixels = FALSE;
|
||||||
IPPU.RenderedScreenWidth = SNES_WIDTH;
|
IPPU.RenderedScreenWidth = SNES_WIDTH;
|
||||||
}
|
}
|
||||||
|
@ -471,27 +461,6 @@ void S9xUpdateScreen (void)
|
||||||
{
|
{
|
||||||
if (!IPPU.DoubleWidthPixels && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires))
|
if (!IPPU.DoubleWidthPixels && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires))
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGL
|
|
||||||
if (Settings.OpenGLEnable && GFX.RealPPL == 256)
|
|
||||||
{
|
|
||||||
// Have to back out of the speed up hack where the low res.
|
|
||||||
// SNES image was rendered into a 256x239 sized buffer,
|
|
||||||
// ignoring the true, larger size of the buffer.
|
|
||||||
GFX.RealPPL = GFX.Pitch >> 1;
|
|
||||||
|
|
||||||
for (int32 y = (int32) GFX.StartY - 1; y >= 0; y--)
|
|
||||||
{
|
|
||||||
uint16 *p = GFX.Screen + y * GFX.PPL + 255;
|
|
||||||
uint16 *q = GFX.Screen + y * GFX.RealPPL + 510;
|
|
||||||
|
|
||||||
for (int x = 255; x >= 0; x--, p--, q -= 2)
|
|
||||||
*q = *(q + 1) = *p;
|
|
||||||
}
|
|
||||||
|
|
||||||
GFX.PPL = GFX.RealPPL; // = GFX.Pitch >> 1 above
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
// Have to back out of the regular speed hack
|
// Have to back out of the regular speed hack
|
||||||
for (uint32 y = 0; y < GFX.StartY; y++)
|
for (uint32 y = 0; y < GFX.StartY; y++)
|
||||||
{
|
{
|
||||||
|
|
7
gfx.h
7
gfx.h
|
@ -11,16 +11,17 @@
|
||||||
|
|
||||||
struct SGFX
|
struct SGFX
|
||||||
{
|
{
|
||||||
|
const uint32 Pitch = sizeof(uint16) * MAX_SNES_WIDTH;
|
||||||
|
const uint32 RealPPL = MAX_SNES_WIDTH; // true PPL of Screen buffer
|
||||||
|
const uint32 ScreenSize = MAX_SNES_WIDTH * SNES_HEIGHT_EXTENDED;
|
||||||
|
uint16 ScreenBuffer[512 * (478 + 64)];
|
||||||
uint16 *Screen;
|
uint16 *Screen;
|
||||||
uint16 *SubScreen;
|
uint16 *SubScreen;
|
||||||
uint8 *ZBuffer;
|
uint8 *ZBuffer;
|
||||||
uint8 *SubZBuffer;
|
uint8 *SubZBuffer;
|
||||||
uint32 Pitch;
|
|
||||||
uint32 ScreenSize;
|
|
||||||
uint16 *S;
|
uint16 *S;
|
||||||
uint8 *DB;
|
uint8 *DB;
|
||||||
uint16 *ZERO;
|
uint16 *ZERO;
|
||||||
uint32 RealPPL; // true PPL of Screen buffer
|
|
||||||
uint32 PPL; // number of pixels on each of Screen buffer
|
uint32 PPL; // number of pixels on each of Screen buffer
|
||||||
uint32 LinesPerTile; // number of lines in 1 tile (4 or 8 due to interlace)
|
uint32 LinesPerTile; // number of lines in 1 tile (4 or 8 due to interlace)
|
||||||
uint16 *ScreenColors; // screen colors for rendering main
|
uint16 *ScreenColors; // screen colors for rendering main
|
||||||
|
|
|
@ -1624,12 +1624,7 @@ static void S9xGTKDisplayString(const char *string, int linesFromBottom,
|
||||||
|
|
||||||
void S9xInitDisplay(int argc, char **argv)
|
void S9xInitDisplay(int argc, char **argv)
|
||||||
{
|
{
|
||||||
static uint16_t screen_buffer[512 * 1024];
|
|
||||||
|
|
||||||
Settings.SupportHiRes = true;
|
Settings.SupportHiRes = true;
|
||||||
GFX.Screen = (uint16_t *)&screen_buffer[512 * 256];
|
|
||||||
GFX.Pitch = 512 * 2;
|
|
||||||
|
|
||||||
S9xBlit2xSaIFilterInit();
|
S9xBlit2xSaIFilterInit();
|
||||||
#ifdef USE_HQ2X
|
#ifdef USE_HQ2X
|
||||||
S9xBlitHQ2xFilterInit();
|
S9xBlitHQ2xFilterInit();
|
||||||
|
|
|
@ -1355,11 +1355,8 @@ void retro_init(void)
|
||||||
S9xSetSoundMute(FALSE);
|
S9xSetSoundMute(FALSE);
|
||||||
S9xSetSamplesAvailableCallback(NULL, NULL);
|
S9xSetSamplesAvailableCallback(NULL, NULL);
|
||||||
|
|
||||||
GFX.Pitch = MAX_SNES_WIDTH_NTSC * sizeof(uint16);
|
ntsc_screen_buffer = (uint16*) calloc(1, MAX_SNES_WIDTH_NTSC * 2 * (MAX_SNES_HEIGHT + 16));
|
||||||
screen_buffer = (uint16*) calloc(1, GFX.Pitch * (MAX_SNES_HEIGHT + 16));
|
snes_ntsc_buffer = ntsc_screen_buffer + (MAX_SNES_WIDTH_NTSC >> 1) * 16;
|
||||||
GFX.Screen = screen_buffer + (GFX.Pitch >> 1) * 16;
|
|
||||||
ntsc_screen_buffer = (uint16*) calloc(1, GFX.Pitch * (MAX_SNES_HEIGHT + 16));
|
|
||||||
snes_ntsc_buffer = ntsc_screen_buffer + (GFX.Pitch >> 1) * 16;
|
|
||||||
S9xGraphicsInit();
|
S9xGraphicsInit();
|
||||||
|
|
||||||
S9xInitInputDevices();
|
S9xInitInputDevices();
|
||||||
|
@ -2013,11 +2010,11 @@ bool8 S9xDeinitUpdate(int width, int height)
|
||||||
burst_phase = (burst_phase + 1) % 3;
|
burst_phase = (burst_phase + 1) % 3;
|
||||||
|
|
||||||
if (width == 512)
|
if (width == 512)
|
||||||
snes_ntsc_blit_hires(snes_ntsc, GFX.Screen, GFX.Pitch / 2, burst_phase, width, height, snes_ntsc_buffer, GFX.Pitch);
|
snes_ntsc_blit_hires(snes_ntsc, GFX.Screen, GFX.Pitch / 2, burst_phase, width, height, snes_ntsc_buffer, MAX_SNES_WIDTH_NTSC * 2);
|
||||||
else
|
else
|
||||||
snes_ntsc_blit(snes_ntsc, GFX.Screen, GFX.Pitch / 2, burst_phase, width, height, snes_ntsc_buffer, GFX.Pitch);
|
snes_ntsc_blit(snes_ntsc, GFX.Screen, GFX.Pitch / 2, burst_phase, width, height, snes_ntsc_buffer, MAX_SNES_WIDTH_NTSC * 2);
|
||||||
|
|
||||||
video_cb(snes_ntsc_buffer + ((int)(GFX.Pitch >> 1) * overscan_offset), SNES_NTSC_OUT_WIDTH(256), height, GFX.Pitch);
|
video_cb(snes_ntsc_buffer + ((int)(MAX_SNES_WIDTH_NTSC) * overscan_offset), SNES_NTSC_OUT_WIDTH(256), height, MAX_SNES_WIDTH_NTSC * 2);
|
||||||
}
|
}
|
||||||
else if (width == MAX_SNES_WIDTH && hires_blend)
|
else if (width == MAX_SNES_WIDTH && hires_blend)
|
||||||
{
|
{
|
||||||
|
|
2
snes9x.h
2
snes9x.h
|
@ -303,8 +303,6 @@ struct SSettings
|
||||||
bool8 DontSaveOopsSnapshot;
|
bool8 DontSaveOopsSnapshot;
|
||||||
bool8 UpAndDown;
|
bool8 UpAndDown;
|
||||||
|
|
||||||
bool8 OpenGLEnable;
|
|
||||||
|
|
||||||
bool8 SeparateEchoBuffer;
|
bool8 SeparateEchoBuffer;
|
||||||
uint32 SuperFXClockMultiplier;
|
uint32 SuperFXClockMultiplier;
|
||||||
int OverclockMode;
|
int OverclockMode;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
AC_PREREQ([2.60])
|
AC_PREREQ([2.71])
|
||||||
AC_INIT([Snes9x], [1.61], [], [snes9x])
|
AC_INIT([Snes9x],[1.61],[],[snes9x])
|
||||||
AC_REVISION([$Revision: 1.61 $])
|
AC_REVISION([$Revision: 1.61 $])
|
||||||
|
|
||||||
AC_CONFIG_SRCDIR([unix.cpp])
|
AC_CONFIG_SRCDIR([unix.cpp])
|
||||||
|
@ -23,8 +23,7 @@ AC_DEFUN([AC_S9X_COMPILER_FLAG],
|
||||||
OLD_CXXFLAGS="[$]CXXFLAGS"
|
OLD_CXXFLAGS="[$]CXXFLAGS"
|
||||||
CXXFLAGS="[$]OLD_CXXFLAGS $1"
|
CXXFLAGS="[$]OLD_CXXFLAGS $1"
|
||||||
|
|
||||||
AC_TRY_RUN(
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||||
[
|
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
|
@ -37,8 +36,7 @@ AC_DEFUN([AC_S9X_COMPILER_FLAG],
|
||||||
|
|
||||||
return (argc);
|
return (argc);
|
||||||
}
|
}
|
||||||
],
|
]])],[snes9x_cv_option_$2="yes"],[snes9x_cv_option_$2="no"],[])
|
||||||
[snes9x_cv_option_$2="yes"], [snes9x_cv_option_$2="no"])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
CXXFLAGS="[$]OLD_CXXFLAGS"
|
CXXFLAGS="[$]OLD_CXXFLAGS"
|
||||||
|
@ -350,14 +348,12 @@ AC_CHECK_HEADERS([unistd.h sys/socket.h])
|
||||||
if test "x$snes9x_have_stdint_h" = "x"; then
|
if test "x$snes9x_have_stdint_h" = "x"; then
|
||||||
AC_MSG_CHECKING([whether the size of pointer is int])
|
AC_MSG_CHECKING([whether the size of pointer is int])
|
||||||
|
|
||||||
AC_TRY_RUN(
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||||
[
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
return (!(sizeof(void *) == sizeof(int)));
|
return (!(sizeof(void *) == sizeof(int)));
|
||||||
}
|
}
|
||||||
],
|
]])],[snes9x_ptr_is_int="yes"],[snes9x_ptr_is_int="no"],[])
|
||||||
[snes9x_ptr_is_int="yes"], [snes9x_ptr_is_int="no"])
|
|
||||||
|
|
||||||
if test "x$snes9x_ptr_is_int" = "xyes"; then
|
if test "x$snes9x_ptr_is_int" = "xyes"; then
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
|
@ -376,8 +372,7 @@ AC_DEFUN([AC_S9X_CHECK_SAR],
|
||||||
OLD_CXXFLAGS="[$]CXXFLAGS"
|
OLD_CXXFLAGS="[$]CXXFLAGS"
|
||||||
CXXFLAGS="[$]OLD_CXXFLAGS $snes9x_have_stdint_h"
|
CXXFLAGS="[$]OLD_CXXFLAGS $snes9x_have_stdint_h"
|
||||||
|
|
||||||
AC_TRY_RUN(
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||||
[
|
|
||||||
#ifdef HAVE_STDINT_H
|
#ifdef HAVE_STDINT_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
typedef int8_t int8;
|
typedef int8_t int8;
|
||||||
|
@ -403,8 +398,7 @@ AC_DEFUN([AC_S9X_CHECK_SAR],
|
||||||
|
|
||||||
return (i < 0 ? 0 : 1);
|
return (i < 0 ? 0 : 1);
|
||||||
}
|
}
|
||||||
],
|
]])],[snes9x_sar_$1="yes"],[snes9x_sar_$1="no"],[])
|
||||||
[snes9x_sar_$1="yes"], [snes9x_sar_$1="no"])
|
|
||||||
|
|
||||||
CXXFLAGS="[$]OLD_CXXFLAGS"
|
CXXFLAGS="[$]OLD_CXXFLAGS"
|
||||||
|
|
||||||
|
@ -581,4 +575,5 @@ EOF
|
||||||
|
|
||||||
cat config.info
|
cat config.info
|
||||||
|
|
||||||
AC_OUTPUT(Makefile)
|
AC_CONFIG_FILES([Makefile])
|
||||||
|
AC_OUTPUT
|
||||||
|
|
15
unix/x11.cpp
15
unix/x11.cpp
|
@ -92,7 +92,6 @@ struct GUIData
|
||||||
uint32 blue_size;
|
uint32 blue_size;
|
||||||
Window window;
|
Window window;
|
||||||
Image *image;
|
Image *image;
|
||||||
uint8 *snes_buffer;
|
|
||||||
uint8 *filter_buffer;
|
uint8 *filter_buffer;
|
||||||
uint8 *blit_screen;
|
uint8 *blit_screen;
|
||||||
uint32 blit_screen_pitch;
|
uint32 blit_screen_pitch;
|
||||||
|
@ -932,14 +931,6 @@ static void SetupImage (void)
|
||||||
#endif
|
#endif
|
||||||
SetupXImage();
|
SetupXImage();
|
||||||
|
|
||||||
// Setup SNES buffers
|
|
||||||
GFX.Pitch = SNES_WIDTH * 2 * 2;
|
|
||||||
GUI.snes_buffer = (uint8 *) calloc(GFX.Pitch * ((SNES_HEIGHT_EXTENDED + 4) * 2), 1);
|
|
||||||
if (!GUI.snes_buffer)
|
|
||||||
FatalError("Failed to allocate GUI.snes_buffer.");
|
|
||||||
|
|
||||||
GFX.Screen = (uint16 *) (GUI.snes_buffer + (GFX.Pitch * 2 * 2));
|
|
||||||
|
|
||||||
GUI.filter_buffer = (uint8 *) calloc((SNES_WIDTH * 2) * 2 * (SNES_HEIGHT_EXTENDED * 2), 1);
|
GUI.filter_buffer = (uint8 *) calloc((SNES_WIDTH * 2) * 2 * (SNES_HEIGHT_EXTENDED * 2), 1);
|
||||||
if (!GUI.filter_buffer)
|
if (!GUI.filter_buffer)
|
||||||
FatalError("Failed to allocate GUI.filter_buffer.");
|
FatalError("Failed to allocate GUI.filter_buffer.");
|
||||||
|
@ -967,12 +958,6 @@ static void SetupImage (void)
|
||||||
|
|
||||||
static void TakedownImage (void)
|
static void TakedownImage (void)
|
||||||
{
|
{
|
||||||
if (GUI.snes_buffer)
|
|
||||||
{
|
|
||||||
free(GUI.snes_buffer);
|
|
||||||
GUI.snes_buffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GUI.filter_buffer)
|
if (GUI.filter_buffer)
|
||||||
{
|
{
|
||||||
free(GUI.filter_buffer);
|
free(GUI.filter_buffer);
|
||||||
|
|
Loading…
Reference in New Issue