Removed GFX_MULTI_FORMAT

This commit is contained in:
TwinAphex51224 2011-11-22 15:30:25 +01:00
parent 4a25691f00
commit 69b6223a03
12 changed files with 5 additions and 289 deletions

View File

@ -693,8 +693,6 @@ static bool emulator_init_system(void)
audio_active = true;
pthread_mutex_unlock(&audio_lock);
S9xSetRenderPixelFormat(RGB555);
if (current_rom == NULL)
return false; //No ROM to load

View File

@ -199,7 +199,6 @@ void S9xAPULoadState (uint8 *);
void S9xAPUSaveState (uint8 *);
bool8 S9xInitSound (int, int);
bool8 S9xOpenSoundDevice (void);
int S9xGetSampleCount (void);
void S9xFinalizeSamples (void);

View File

@ -7,10 +7,10 @@
<style type="text/css">
<!-- ul { list-style-type:none } h2 { margin-top:3em } h3 { margin-top:2em } -->
</style>
<title>Porting Snes9x</title>
<title>Porting SNES9x Next</title>
</head>
<body>
<h1 style="text-align:center">How to Port Snes9x to a New Platform</h1>
<h1 style="text-align:center">How to Port SNES9x Next to a New Platform</h1>
<div style="text-align:right">
Version: 1.52<br>
(c) Copyright 1998 Gary Henderson
@ -21,7 +21,7 @@
</p>
<h2>System Requirements</h2>
<p>
A C++ compiler. For the most part Snes9x really isn't written in C++, it just uses the C++ compiler as a &ldquo;better C&rdquo; compiler to get inline functions and so on. GCC is good for compiling Snes9x (<a href="http://gcc.gnu.org/">http://gcc.gnu.org/</a>).
A C++ compiler. For the most part Snes9x really isn't written in C++, it just uses the C++ compiler as a &ldquo;better C&rdquo; compiler. GCC is good for compiling Snes9x (<a href="http://gcc.gnu.org/">http://gcc.gnu.org/</a>).
</p>
<p>
A fast CPU. SNES emulation is very compute intensive; two, or sometimes three CPUs to emulate, an 8-channel 16-bit stereo sound digital signal processor with real-time sample decompression, filter and echo effects, two custom graphics processor chips that can produce transparency, scaling, rotation and window effects in 32768 colors, and finally hardware DMA all take their toll on the host CPU.
@ -83,7 +83,7 @@
If the byte ordering of your system is least significant byte first, make sure <code>LSB_FIRST</code> is defined, otherwise make sure it's not defined.
</p>
<p>
You'll need to make sure what pixel format your system uses for 16-bit colors (<code>RGB565</code>, <code>RGB555</code>, <code>BGR565</code> or <code>BGR555</code>), and if it's not <code>RGB565</code>, define <code>PIXEL_FORMAT</code> to it so that Snes9x will use it to render the SNES screen. For example, Windows uses <code>RGB565</code>, Mac OS X uses <code>RGB555</code>. If your system supports more than one pixel format, you can define <code>GFX_MULTI_FORMAT</code> and change Snes9x's pixel format dynamically by calling <code>S9xSetRenderPixelFormat</code> function. If your system is 24 or 32-bit only, then don't define anything; instead write a conversion routine that will take a complete rendered 16-bit SNES screen in <code>RGB565</code> format and convert to the format required to be displayed on your system.
You'll need to make sure what pixel format your system uses for 16-bit colors (<code>RGB565</code>, <code>RGB555</code>, <code>BGR565</code> or <code>BGR555</code>), and if it's not <code>RGB565</code>, define <code>PIXEL_FORMAT</code> to it so that Snes9x will use it to render the SNES screen. For example, Windows uses <code>RGB565</code>, Mac OS X uses <code>RGB555</code>. If your system is 24 or 32-bit only, then don't define anything; instead write a conversion routine that will take a complete rendered 16-bit SNES screen in <code>RGB565</code> format and convert to the format required to be displayed on your system.
</p>
<p>
<code>port.h</code> also typedefs some types; <code>uint8</code> for an unsigned 8-bit quantity, <code>uint16</code> for an unsigned 16-bit quantity, <code>uint32</code> for a 32-bit unsigned quantity and <code>bool8</code> for a <code>true</code>/<code>false</code> type. Signed versions are also typedef'ed.
@ -123,9 +123,6 @@
&nbsp;&nbsp;&nbsp;&nbsp;S9xReportButton(k1P_A_Button, (key_is_pressed ? true : false));<br>
}</code>
</p>
<p>
Prepare your <code>S9xPollButton</code> and <code>S9xPollPointer</code> function to reply Snes9x's request for other buttons/cursors states.
</p>
<p>
Call <code>S9xSetController</code> function. It connects each input device to each SNES input port.<br>
Here's typical controller settings that is used by the real SNES games:
@ -185,7 +182,7 @@
</p>
<h3><code>bool8 S9xInitSound (int buffer_ms, int lag_ms)</code></h3>
<p>
Allocates memory for mixing and queueing SNES sound data, does more sound code initialization and opens the host system's sound device by calling <code>S9xOpenSoundDevice</code>, a function you must provide. Before calling this function you must set up <code>Settings.SoundSync</code>, <code>Settings.SoundPlaybackRate</code>, <code>Settings.SoundInputRate</code> (see section below) and <code>Settings.Stereo</code>.<br>
Allocates memory for mixing and queueing SNES sound data and does more sound code initialization. Before calling this function you must set up <code>Settings.SoundSync</code>, <code>Settings.SoundPlaybackRate</code>, <code>Settings.SoundInputRate</code> (see section below) and <code>Settings.Stereo</code>.<br>
<code>buffer_ms</code>, given in milliseconds, is the memory buffer size for queueing sound data. <code>lag_ms</code> is allowable latency between when a sample is queued and when it is pulled in <code>S9xMixSamples</code>. Set <code>lag_ms</code> to zero if you have your own latency handling code in your port.
</p>
<h3><code>void S9xReset (void)</code></h3>
@ -231,10 +228,6 @@
Call this function to set up a callback that is run when sound samples are made available. <code>samples_available</code> is a function you provide that returns <code>void</code> and takes a pointer as an argument. <code>data</code> is a pointer that you may wish to pass to your callback or can be <code>NULL</code>. If you choose to provide a callback, you must call the provided <code>S9xFinalizeSamples</code> function inside it to actually buffer the samples. If you are using a callback-oriented sound API, it is recommended to set up a function that locks a common mutex during the calls to <code>S9xFinalizeSamples</code> and <code>S9xMixSamples</code> to prevent them from running at the same time and corrupting the sound buffer.<br>
If you wish to disable a callback you have set up or need to temporarily shut down your sound system, you may pass <code>NULL</code> for both arguments to revert to the built-in version.
</p>
<h3><code>bool8 S9xSyncSound (void)</code></h3>
<p>
Call this function to synchronize the sound buffers to the game state. If Snes9x is generating too much sound data, or a buffer-overrun is likely, this function will return <code>false</code>. In this case, you may wish to wait until your host sound system uses the available samples, and <code>S9xSyncSound</code> returns <code>true</code> before continuing to execute <code>S9xMainLoop</code>.
</p>
<h3><code>bool8 S9xSetSoundMute (bool8 mute)</code></h3>
<p>
Call with a <code>true</code> parameter to prevent <code>S9xMixSamples</code> function from processing SNES sample data and instead just filling the return buffer with silent sound data. Useful if your sound system is interrupt or callback driven and the game has been paused either directly or indirectly because the user interacting with the emulator's user interface in some way.
@ -247,36 +240,19 @@
<p>
Restore the SNES hardware back to the exactly the state it was in when <code>S9xFreezeGame</code> function was used to generate the file specified. You have to arrange the correct ROM is already loaded using <code>Memory.LoadROM</code> function, an easy way to arrange this is to base freeze-game filenames on the ROM image name. The UNIX/Linux ports load freeze-game files when the user presses a function key, with the names romfilename.000 for F1, romfilename.001 for F2, etc. Games are frozen in the first place when the user presses Shift-function key. You could choose some other scheme.
</p>
<h3><code>void S9xDumpSPCSnapshot (void)</code></h3>
<p>
Call this funtion to make a so-called SPC file, a snapshot of SNES sound state. Actual dump occurs at the first key-on event after this function is called.
</p>
<h3><code>void S9xSetInfoString (const char *string)</code></h3>
<p>
Call this function if you want to show a message onto the SNES screen.
</p>
<h3>Other Available Functions</h3>
<p>
See <code>movie.h</code> and <code>movie.cpp</code> to support the Snes9x movie feature.<br>
See <code>cheats.h</code>, <code>cheats.cpp</code> and <code>cheats2.cpp</code> to support the cheat feature.
</p>
<h2>Interface Functions You Need to Implement</h2>
<h3><code>bool8 S9xOpenSnapshotFile (const char *filepath, bool8 read_only, STREAM *file)</code></h3>
<p>
This function opens a freeze-game file. <code>STREAM</code> is defined as a <code>gzFile</code> if <code>ZLIB</code> is defined else it's defined as <code>FILE *</code>. The <code>read_only</code> parameter is set to <code>true</code> when reading a freeze-game file and <code>false</code> when writing a freeze-game file. Open the file <code>filepath</code> and return its pointer <code>file</code>.
</p>
<h3><code>void S9xCloseSnapshotFile (STREAM file)</code></h3>
<p>
This function closes the freeze-game file opened by <code>S9xOpenSnapshotFile</code> function.
</p>
<h3><code>void S9xExit (void)</code></h3>
<p>
Called when some fatal error situation arises or when the &ldquo;q&rdquo; debugger command is used.
</p>
<h3><code>bool8 S9xInitUpdate (void)</code></h3>
<p>
Called just before Snes9x begins to render an SNES screen. Use this function if you should prepare before drawing, otherwise let it empty.
</p>
<h3><code>bool8 S9xDeinitUpdate (int width, int height)</code></h3>
<p>
Called once a complete SNES screen has been rendered into the <code>GFX.Screen</code> memory buffer, now is your chance to copy the SNES rendered screen to the host computer's screen memory. The problem is that you have to cope with different sized SNES rendered screens: 256*224, 256*239, 512*224, 512*239, 512*448 and 512*478.
@ -287,10 +263,6 @@
The idea is display the message string so the user can see it, but you choose not to display anything at all, or change the message based on the message number or message type.<br>
Eventually all debug output will also go via this function, trace information already does.
</p>
<h3><code>bool8 S9xOpenSoundDevice (void)</code></h3>
<p>
<code>S9xInitSound</code> function calls this function to actually open the host sound device.
</p>
<h3><code>const char *S9xGetFilename (const char *extension, enum s9x_getdirtype dirtype)</code></h3>
<p>
When Snes9x needs to know the name of the cheat/IPS file and so on, this function is called. Check <code>extension</code> and <code>dirtype</code>, and return the appropriate filename. The current ports return the ROM file path with the given extension.
@ -307,10 +279,6 @@
<p>
If your port can match Snes9x's built-in <code>LoadFreezeFile</code>/<code>SaveFreezeFile</code> command (see <code>controls.cpp</code>), you may choose to use this function. Otherwise return <code>NULL</code>.
</p>
<h3><code>const char *S9xChooseMovieFilename (bool8 read_only)</code></h3>
<p>
If your port can match Snes9x's built-in <code>BeginRecordingMovie</code>/<code>LoadMovie</code> command (see <code>controls.cpp</code>), you may choose to use this function. Otherwise return <code>NULL</code>.
</p>
<h3><code>const char *S9xBasename (const char *path)</code></h3>
<p>
Called when Snes9x wants to know the name of the ROM image. Typically, extract the filename from <code>path</code> and return it.
@ -319,18 +287,6 @@
<p>
If <code>Settings.AutoSaveDelay</code> is not zero, Snes9x calls this function when the contents of the S-RAM has been changed. Typically, call <code>Memory.SaveSRAM</code> function from this function.
</p>
<h3><code>void S9xToggleSoundChannel (int c)</code></h3>
<p>
If your port can match Snes9x's built-in <code>SoundChannelXXX</code> command (see <code>controls.cpp</code>), you may choose to use this function. Otherwise return <code>NULL</code>. Basically, turn on/off the sound channel <code>c</code> (0-7), and turn on all channels if <code>c</code> is 8.
</p>
<h3><code>void S9xSetPalette (void)</code></h3>
<p>
Called when the SNES color palette has changed. Use this function if your system should change its color palette to match the SNES's. Otherwise let it empty.
</p>
<h3><code>void S9xSyncSpeed (void)</code></h3>
<p>
Called at the end of <code>S9xMainLoop</code> function, when emulating one frame has been done. You should adjust the frame rate in this function.
</p>
<h2>Global Variables</h2>
<h3><code>uint16 *GFX.Screen</code></h3>
<p>

View File

@ -180,14 +180,10 @@
#define ALL_COLOR_MASK (FIRST_COLOR_MASK | SECOND_COLOR_MASK | THIRD_COLOR_MASK)
#ifdef GFX_MULTI_FORMAT
static uint32 colorMask = 0, qcolorMask = 0, lowPixelMask = 0, qlowpixelMask = 0;
#else
#define colorMask (((~RGB_LOW_BITS_MASK & ALL_COLOR_MASK) << 16) | (~RGB_LOW_BITS_MASK & ALL_COLOR_MASK))
#define qcolorMask (((~TWO_LOW_BITS_MASK & ALL_COLOR_MASK) << 16) | (~TWO_LOW_BITS_MASK & ALL_COLOR_MASK))
#define lowPixelMask ((RGB_LOW_BITS_MASK << 16) | RGB_LOW_BITS_MASK)
#define qlowpixelMask ((TWO_LOW_BITS_MASK << 16) | TWO_LOW_BITS_MASK)
#endif
static inline int GetResult (uint32, uint32, uint32, uint32);
static inline int GetResult1 (uint32, uint32, uint32, uint32, uint32);
@ -249,13 +245,6 @@ static inline uint32 Q_INTERPOLATE (uint32 A, uint32 B, uint32 C, uint32 D)
bool8 S9xBlit2xSaIFilterInit (void)
{
#ifdef GFX_MULTI_FORMAT
colorMask = ((~RGB_LOW_BITS_MASK & ALL_COLOR_MASK) << 16) | (~RGB_LOW_BITS_MASK & ALL_COLOR_MASK);
qcolorMask = ((~TWO_LOW_BITS_MASK & ALL_COLOR_MASK) << 16) | (~TWO_LOW_BITS_MASK & ALL_COLOR_MASK);
lowPixelMask = (RGB_LOW_BITS_MASK << 16) | RGB_LOW_BITS_MASK;
qlowpixelMask = (TWO_LOW_BITS_MASK << 16) | TWO_LOW_BITS_MASK;
#endif
return (TRUE);
}

View File

@ -180,14 +180,9 @@
#define ALL_COLOR_MASK (FIRST_COLOR_MASK | SECOND_COLOR_MASK | THIRD_COLOR_MASK)
#ifdef GFX_MULTI_FORMAT
static uint16 lowPixelMask = 0, qlowPixelMask = 0;
static uint32 colorMask = 0;
#else
#define lowPixelMask (RGB_LOW_BITS_MASK)
#define qlowPixelMask ((RGB_HI_BITS_MASK >> 3) | TWO_LOW_BITS_MASK)
#define colorMask (((~RGB_HI_BITS_MASK & ALL_COLOR_MASK) << 16) | (~RGB_HI_BITS_MASK & ALL_COLOR_MASK))
#endif
static snes_ntsc_t *ntsc = NULL;
static uint8 *XDelta = NULL;
@ -201,12 +196,6 @@ bool8 S9xBlitFilterInit (void)
S9xBlitClearDelta();
#ifdef GFX_MULTI_FORMAT
lowPixelMask = RGB_LOW_BITS_MASK;
qlowPixelMask = (RGB_HI_BITS_MASK >> 3) | TWO_LOW_BITS_MASK;
colorMask = ((~RGB_HI_BITS_MASK & ALL_COLOR_MASK) << 16) | (~RGB_HI_BITS_MASK & ALL_COLOR_MASK);
#endif
return (TRUE);
}

View File

@ -186,12 +186,8 @@
#define trU 0x000700
#define trV 0x000006
#ifdef GFX_MULTI_FORMAT
static uint16 Mask_2 = 0, Mask13 = 0;
#else
#define Mask_2 SECOND_COLOR_MASK
#define Mask13 FIRST_THIRD_COLOR_MASK
#endif
#define Interp01(c1, c2) \
(c1 == c2) ? c1 : \
@ -515,11 +511,6 @@ bool8 S9xBlitHQ2xFilterInit (void)
if (!RGBtoYUV)
return (FALSE);
#ifdef GFX_MULTI_FORMAT
Mask_2 = SECOND_COLOR_MASK;
Mask13 = FIRST_THIRD_COLOR_MASK;
#endif
InitLUTs();
return (TRUE);

View File

@ -202,11 +202,6 @@ bool8 S9xGraphicsInit (void)
S9xInitTileRenderer();
ZeroMemory(BlackColourMap, 256 * sizeof(uint16));
#ifdef GFX_MULTI_FORMAT
if (GFX.BuildPixel == NULL)
S9xSetRenderPixelFormat(RGB565);
#endif
GFX.DoInterlace = 0;
GFX.InterlaceFrame = 0;
GFX.RealPPL = GFX.Pitch >> 1;
@ -426,7 +421,6 @@ void S9xEndScreenRefresh (void)
{
uint32 saved = PPU.CGDATA[0];
IPPU.ColorsChanged = FALSE;
//S9xSetPalette();
PPU.CGDATA[0] = saved;
}
@ -2280,123 +2274,3 @@ void S9xDrawCrosshair (const char *crosshair, uint8 fgcolor, uint8 bgcolor, int1
}
}
}
#ifdef GFX_MULTI_FORMAT
static uint32 BuildPixelRGB565 (uint32, uint32, uint32);
static uint32 BuildPixelRGB555 (uint32, uint32, uint32);
static uint32 BuildPixelBGR565 (uint32, uint32, uint32);
static uint32 BuildPixelBGR555 (uint32, uint32, uint32);
static uint32 BuildPixelGBR565 (uint32, uint32, uint32);
static uint32 BuildPixelGBR555 (uint32, uint32, uint32);
static uint32 BuildPixelRGB5551 (uint32, uint32, uint32);
static uint32 BuildPixel2RGB565 (uint32, uint32, uint32);
static uint32 BuildPixel2RGB555 (uint32, uint32, uint32);
static uint32 BuildPixel2BGR565 (uint32, uint32, uint32);
static uint32 BuildPixel2BGR555 (uint32, uint32, uint32);
static uint32 BuildPixel2GBR565 (uint32, uint32, uint32);
static uint32 BuildPixel2GBR555 (uint32, uint32, uint32);
static uint32 BuildPixel2RGB5551 (uint32, uint32, uint32);
static void DecomposePixelRGB565 (uint32, uint32 &, uint32 &, uint32 &);
static void DecomposePixelRGB555 (uint32, uint32 &, uint32 &, uint32 &);
static void DecomposePixelBGR565 (uint32, uint32 &, uint32 &, uint32 &);
static void DecomposePixelBGR555 (uint32, uint32 &, uint32 &, uint32 &);
static void DecomposePixelGBR565 (uint32, uint32 &, uint32 &, uint32 &);
static void DecomposePixelGBR555 (uint32, uint32 &, uint32 &, uint32 &);
static void DecomposePixelRGB5551 (uint32, uint32 &, uint32 &, uint32 &);
#define _BUILD_PIXEL(F) \
static uint32 BuildPixel##F (uint32 R, uint32 G, uint32 B) \
{ \
return (BUILD_PIXEL_##F(R, G, B)); \
} \
\
static uint32 BuildPixel2##F (uint32 R, uint32 G, uint32 B) \
{ \
return (BUILD_PIXEL2_##F(R, G, B)); \
} \
\
static void DecomposePixel##F (uint32 pixel, uint32 &R, uint32 &G, uint32 &B) \
{ \
DECOMPOSE_PIXEL_##F(pixel, R, G, B); \
}
_BUILD_PIXEL(RGB565)
_BUILD_PIXEL(RGB555)
_BUILD_PIXEL(BGR565)
_BUILD_PIXEL(BGR555)
_BUILD_PIXEL(GBR565)
_BUILD_PIXEL(GBR555)
_BUILD_PIXEL(RGB5551)
#define _BUILD_SETUP(F) \
GFX.BuildPixel = BuildPixel##F; \
GFX.BuildPixel2 = BuildPixel2##F; \
GFX.DecomposePixel = DecomposePixel##F; \
RED_LOW_BIT_MASK = RED_LOW_BIT_MASK_##F; \
GREEN_LOW_BIT_MASK = GREEN_LOW_BIT_MASK_##F; \
BLUE_LOW_BIT_MASK = BLUE_LOW_BIT_MASK_##F; \
RED_HI_BIT_MASK = RED_HI_BIT_MASK_##F; \
GREEN_HI_BIT_MASK = GREEN_HI_BIT_MASK_##F; \
BLUE_HI_BIT_MASK = BLUE_HI_BIT_MASK_##F; \
MAX_RED = MAX_RED_##F; \
MAX_GREEN = MAX_GREEN_##F; \
MAX_BLUE = MAX_BLUE_##F; \
SPARE_RGB_BIT_MASK = SPARE_RGB_BIT_MASK_##F; \
GREEN_HI_BIT = ((MAX_GREEN_##F + 1) >> 1); \
RGB_LOW_BITS_MASK = (RED_LOW_BIT_MASK_##F | GREEN_LOW_BIT_MASK_##F | BLUE_LOW_BIT_MASK_##F); \
RGB_HI_BITS_MASK = (RED_HI_BIT_MASK_##F | GREEN_HI_BIT_MASK_##F | BLUE_HI_BIT_MASK_##F); \
RGB_HI_BITS_MASKx2 = (RED_HI_BIT_MASK_##F | GREEN_HI_BIT_MASK_##F | BLUE_HI_BIT_MASK_##F) << 1; \
RGB_REMOVE_LOW_BITS_MASK = ~RGB_LOW_BITS_MASK; \
FIRST_COLOR_MASK = FIRST_COLOR_MASK_##F; \
SECOND_COLOR_MASK = SECOND_COLOR_MASK_##F; \
THIRD_COLOR_MASK = THIRD_COLOR_MASK_##F; \
ALPHA_BITS_MASK = ALPHA_BITS_MASK_##F; \
FIRST_THIRD_COLOR_MASK = FIRST_COLOR_MASK | THIRD_COLOR_MASK; \
TWO_LOW_BITS_MASK = RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 1); \
HIGH_BITS_SHIFTED_TWO_MASK = ((FIRST_COLOR_MASK | SECOND_COLOR_MASK | THIRD_COLOR_MASK) & ~TWO_LOW_BITS_MASK) >> 2;
bool8 S9xSetRenderPixelFormat (int format)
{
GFX.PixelFormat = format;
switch (format)
{
case RGB565:
_BUILD_SETUP(RGB565)
return (TRUE);
case RGB555:
_BUILD_SETUP(RGB555)
return (TRUE);
case BGR565:
_BUILD_SETUP(BGR565)
return (TRUE);
case BGR555:
_BUILD_SETUP(BGR555)
return (TRUE);
case GBR565:
_BUILD_SETUP(GBR565)
return (TRUE);
case GBR555:
_BUILD_SETUP(GBR555)
return (TRUE);
case RGB5551:
_BUILD_SETUP(RGB5551)
return (TRUE);
default:
break;
}
return (FALSE);
}
#endif

View File

@ -220,13 +220,6 @@ struct SGFX
} OBJ[32];
} OBJLines[SNES_HEIGHT_EXTENDED];
#ifdef GFX_MULTI_FORMAT
uint32 PixelFormat;
uint32 (*BuildPixel) (uint32, uint32, uint32);
uint32 (*BuildPixel2) (uint32, uint32, uint32);
void (*DecomposePixel) (uint32, uint32 &, uint32 &, uint32 &);
#endif
void (*DrawBackdropMath) (uint32, uint32, uint32);
void (*DrawBackdropNomath) (uint32, uint32, uint32);
void (*DrawTileMath) (uint32, uint32, uint32, uint32);
@ -345,9 +338,6 @@ void S9xUpdateScreen (void);
void S9xBuildDirectColourMaps (void);
void RenderLine (uint8);
void S9xComputeClipWindows (void);
#ifdef GFX_MULTI_FORMAT
bool8 S9xSetRenderPixelFormat (int);
#endif
// external port interface which must be implemented or initialised for each port
bool8 S9xGraphicsInit (void);

View File

@ -236,31 +236,6 @@ uint8 *RegRAM = NULL;
uint8 *SFXPlotTable = NULL;
#endif
#ifdef GFX_MULTI_FORMAT
uint32 RED_LOW_BIT_MASK = RED_LOW_BIT_MASK_RGB565;
uint32 GREEN_LOW_BIT_MASK = GREEN_LOW_BIT_MASK_RGB565;
uint32 BLUE_LOW_BIT_MASK = BLUE_LOW_BIT_MASK_RGB565;
uint32 RED_HI_BIT_MASK = RED_HI_BIT_MASK_RGB565;
uint32 GREEN_HI_BIT_MASK = GREEN_HI_BIT_MASK_RGB565;
uint32 BLUE_HI_BIT_MASK = BLUE_HI_BIT_MASK_RGB565;
uint32 MAX_RED = MAX_RED_RGB565;
uint32 MAX_GREEN = MAX_GREEN_RGB565;
uint32 MAX_BLUE = MAX_BLUE_RGB565;
uint32 SPARE_RGB_BIT_MASK = SPARE_RGB_BIT_MASK_RGB565;
uint32 GREEN_HI_BIT = (MAX_GREEN_RGB565 + 1) >> 1;
uint32 RGB_LOW_BITS_MASK = (RED_LOW_BIT_MASK_RGB565 | GREEN_LOW_BIT_MASK_RGB565 | BLUE_LOW_BIT_MASK_RGB565);
uint32 RGB_HI_BITS_MASK = (RED_HI_BIT_MASK_RGB565 | GREEN_HI_BIT_MASK_RGB565 | BLUE_HI_BIT_MASK_RGB565);
uint32 RGB_HI_BITS_MASKx2 = (RED_HI_BIT_MASK_RGB565 | GREEN_HI_BIT_MASK_RGB565 | BLUE_HI_BIT_MASK_RGB565) << 1;
uint32 RGB_REMOVE_LOW_BITS_MASK = ~RGB_LOW_BITS_MASK;
uint32 FIRST_COLOR_MASK = FIRST_COLOR_MASK_RGB565;
uint32 SECOND_COLOR_MASK = SECOND_COLOR_MASK_RGB565;
uint32 THIRD_COLOR_MASK = THIRD_COLOR_MASK_RGB565;
uint32 ALPHA_BITS_MASK = ALPHA_BITS_MASK_RGB565;
uint32 FIRST_THIRD_COLOR_MASK = 0;
uint32 TWO_LOW_BITS_MASK = 0;
uint32 HIGH_BITS_SHIFTED_TWO_MASK = 0;
#endif
uint8 mul_brightness[16][32] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -348,7 +348,6 @@ void snes_init()
S9xInitSound(16, 0);
S9xSetSamplesAvailableCallback(S9xAudioCallback);
S9xSetRenderPixelFormat(RGB555);
GFX.Pitch = use_overscan ? 1024 : 2048;
GFX.Screen = (uint16*) calloc(1, GFX.Pitch * 512 * sizeof(uint16));
S9xGraphicsInit();
@ -665,10 +664,8 @@ const char* S9xGetDirectory(s9x_getdirtype) { return NULL; }
const char* S9xChooseFilename(unsigned char) { return NULL; }
void S9xHandlePortCommand(s9xcommand_t, short, short) {}
const char* S9xBasename(const char* in) { return in; }
bool8 S9xOpenSoundDevice() { return TRUE; }
void S9xMessage(int, int, const char*) {}
bool S9xPollAxis(unsigned int, short*) { return FALSE; }
void S9xSetPalette() {}
void S9xExit() {}
void S9xOnSNESPadRead (void) {}
void S9xDoThrottling (bool throttle) {}

View File

@ -178,39 +178,6 @@
#ifndef _PIXFORM_H_
#define _PIXFORM_H_
#ifdef GFX_MULTI_FORMAT
enum { RGB565, RGB555, BGR565, BGR555, GBR565, GBR555, RGB5551 };
#define BUILD_PIXEL(R, G, B) ((*GFX.BuildPixel) (R, G, B))
#define BUILD_PIXEL2(R, G, B) ((*GFX.BuildPixel2) (R, G, B))
#define DECOMPOSE_PIXEL(PIX, R, G, B) ((*GFX.DecomposePixel) (PIX, R, G, B))
extern uint32 MAX_RED;
extern uint32 MAX_GREEN;
extern uint32 MAX_BLUE;
extern uint32 RED_LOW_BIT_MASK;
extern uint32 GREEN_LOW_BIT_MASK;
extern uint32 BLUE_LOW_BIT_MASK;
extern uint32 RED_HI_BIT_MASK;
extern uint32 GREEN_HI_BIT_MASK;
extern uint32 BLUE_HI_BIT_MASK;
extern uint32 FIRST_COLOR_MASK;
extern uint32 SECOND_COLOR_MASK;
extern uint32 THIRD_COLOR_MASK;
extern uint32 ALPHA_BITS_MASK;
extern uint32 GREEN_HI_BIT;
extern uint32 RGB_LOW_BITS_MASK;
extern uint32 RGB_HI_BITS_MASK;
extern uint32 RGB_HI_BITS_MASKx2;
extern uint32 RGB_REMOVE_LOW_BITS_MASK;
extern uint32 FIRST_THIRD_COLOR_MASK;
extern uint32 TWO_LOW_BITS_MASK;
extern uint32 HIGH_BITS_SHIFTED_TWO_MASK;
extern uint32 SPARE_RGB_BIT_MASK;
#endif
/* RGB565 format */
#define BUILD_PIXEL_RGB565(R, G, B) (((int) (R) << 11) | ((int) (G) << 6) | (int) (B))
#define BUILD_PIXEL2_RGB565(R, G, B) (((int) (R) << 11) | ((int) (G) << 5) | (int) (B))
@ -351,8 +318,6 @@ extern uint32 SPARE_RGB_BIT_MASK;
#define THIRD_COLOR_MASK_RGB5551 0x003e
#define ALPHA_BITS_MASK_RGB5551 0x0001
#ifndef GFX_MULTI_FORMAT
#define CONCAT(X, Y) X##Y
// C pre-processor needs a two stage macro define to enable it to concat
@ -403,5 +368,3 @@ extern uint32 SPARE_RGB_BIT_MASK;
#define HIGH_BITS_SHIFTED_TWO_MASK (((FIRST_COLOR_MASK | SECOND_COLOR_MASK | THIRD_COLOR_MASK) & ~TWO_LOW_BITS_MASK ) >> 2)
#endif
#endif

View File

@ -193,8 +193,6 @@
#endif
#include <sys/types.h>
#define GFX_MULTI_FORMAT
#ifdef __WIN32__
//#define RIGHTSHIFT_IS_SAR
#define RIGHTSHIFT_int8_IS_SAR
@ -203,10 +201,7 @@
#define SNES_JOY_READ_CALLBACKS
#endif
#ifdef __MACOSX__
#undef GFX_MULTI_FORMAT
#define PIXEL_FORMAT RGB555
#endif
#ifndef snes9x_types_defined
#define snes9x_types_defined