Fix 15->16 bit conversions.

This commit is contained in:
Themaister 2012-01-02 15:42:53 +01:00
parent eeebc2d06b
commit d66e039536
4 changed files with 25 additions and 13 deletions

View File

@ -101,7 +101,7 @@ unsigned (*psnes_get_memory_size)(unsigned);
void (*psnes_unload_cartridge)(void);
void (*psnes_term)(void);
#ifdef NEED_DYNAMIC
#if defined(NEED_DYNAMIC) || defined(GEKKO) || defined(__CELLOS_LV2__) || defined(XENON)
static void set_environment(void);
#endif
static void set_environment_defaults(void);
@ -222,7 +222,7 @@ void init_libsnes_sym(void)
#endif
set_environment_defaults();
#ifdef NEED_DYNAMIC
#if defined(NEED_DYNAMIC) || defined(GEKKO) || defined(__CELLOS_LV2__) || defined(XENON)
set_environment();
#endif
}
@ -280,7 +280,9 @@ void dylib_close(dylib_t lib)
dlclose(lib);
#endif
}
#endif
#if defined(NEED_DYNAMIC) || defined(GEKKO) || defined(__CELLOS_LV2__) || defined(XENON)
static bool environment_cb(unsigned cmd, void *data)
{
switch (cmd)
@ -340,7 +342,9 @@ static bool environment_cb(unsigned cmd, void *data)
return true;
}
#endif
#ifdef NEED_DYNAMIC
// SSNES extension hooks. Totally optional 'n shizz :)
static void set_environment(void)
{
@ -356,6 +360,12 @@ static void set_environment(void)
if (psnes_set_environment)
psnes_set_environment(environment_cb);
}
#elif defined(GEKKO) || defined(__CELLOS_LV2__) || defined(XENON)
// Not very optional when we're running on a console without dynamic loading support.
static void set_environment(void)
{
snes_set_environment(environment_cb);
}
#endif
// Assume SNES as defaults.

View File

@ -98,7 +98,7 @@ static bool wii_key_pressed(void *data, int key)
switch (key)
{
case SSNES_QUIT_KEY:
return g_quit || pad_state[0][SNES_DEVICE_ID_JOYPAD_START];
return g_quit || pad_state[0][SNES_DEVICE_ID_JOYPAD_SELECT];
default:
return false;
}

View File

@ -30,7 +30,7 @@ int ssnes_main(int argc, char **argv);
int main(void)
{
char arg0[] = "ssnes";
char arg1[] = "sd:/FFIII.smc";
char arg1[] = "sd:/MM2.nes";
char *argv[] = { arg0, arg1, NULL };
fatInitDefault();

View File

@ -159,15 +159,17 @@ static void update_texture(const uint32_t *src,
width &= ~15;
height &= ~3;
#define RGB15to16(col) ({ uint32_t hi = (col << 1) & 0xffe0ffe0u; uint32_t lo = col & 0x001f001f; hi | lo; })
#define BLIT_CHUNK(off) { \
tmp_dst[ 0 + off] = tmp_src[0]; \
tmp_dst[ 1 + off] = tmp_src[1]; \
tmp_dst[ 8 + off] = tmp_src[2]; \
tmp_dst[ 9 + off] = tmp_src[3]; \
tmp_dst[16 + off] = tmp_src[4]; \
tmp_dst[17 + off] = tmp_src[5]; \
tmp_dst[24 + off] = tmp_src[6]; \
tmp_dst[25 + off] = tmp_src[7]; }
tmp_dst[ 0 + off] = RGB15to16(tmp_src[0]); \
tmp_dst[ 1 + off] = RGB15to16(tmp_src[1]); \
tmp_dst[ 8 + off] = RGB15to16(tmp_src[2]); \
tmp_dst[ 9 + off] = RGB15to16(tmp_src[3]); \
tmp_dst[16 + off] = RGB15to16(tmp_src[4]); \
tmp_dst[17 + off] = RGB15to16(tmp_src[5]); \
tmp_dst[24 + off] = RGB15to16(tmp_src[6]); \
tmp_dst[25 + off] = RGB15to16(tmp_src[7]); }
#define BLIT_LINE(off) { \
const uint32_t *tmp_src = src; \
@ -178,7 +180,7 @@ static void update_texture(const uint32_t *src,
width >>= 1;
// Texture data is 4x4 tiled @ 15bpp (docs say it's RGB565, but apparently it's RGB555).
// Texture data is 4x4 tiled @ 15bpp.
// Use 32-bit to transfer more data per cycle.
uint32_t *dst = g_tex.data;
for (unsigned i = 0; i < height; i += 4, dst += 4 * width)