Hello community,
here is the log from the commit of package libretro-beetle-wswan for
openSUSE:Factory checked in at 2020-06-07 21:36:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libretro-beetle-wswan (Old)
and /work/SRC/openSUSE:Factory/.libretro-beetle-wswan.new.3606 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libretro-beetle-wswan"
Sun Jun 7 21:36:51 2020 rev:2 rq:812090 version:0~git20200518
Changes:
--------
---
/work/SRC/openSUSE:Factory/libretro-beetle-wswan/libretro-beetle-wswan.changes
2020-02-11 22:22:57.507487140 +0100
+++
/work/SRC/openSUSE:Factory/.libretro-beetle-wswan.new.3606/libretro-beetle-wswan.changes
2020-06-07 21:37:22.537270798 +0200
@@ -1,0 +2,8 @@
+Sat May 30 16:48:02 UTC 2020 - [email protected]
+
+- Update to version 0~git20200518:
+ * Silence some warnings
+ * fix refresh rate
+ * backport variable color depth
+
+-------------------------------------------------------------------
Old:
----
libretro-beetle-wswan-0~git20200120.tar.xz
New:
----
libretro-beetle-wswan-0~git20200518.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libretro-beetle-wswan.spec ++++++
--- /var/tmp/diff_new_pack.DBoTjO/_old 2020-06-07 21:37:23.721274551 +0200
+++ /var/tmp/diff_new_pack.DBoTjO/_new 2020-06-07 21:37:23.721274551 +0200
@@ -1,7 +1,7 @@
#
# spec file for package libretro-beetle-wswan
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,10 +17,10 @@
Name: libretro-beetle-wswan
-Version: 0~git20200120
+Version: 0~git20200518
Release: 0
Summary: Mednafen WonderSwan libretro core for WonderSwan emulation
-License: GPL-2.0
+License: GPL-2.0-only
Group: System/Emulators/Other
URL: http://www.retroarch.com
Source: %{name}-%{version}.tar.xz
++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.DBoTjO/_old 2020-06-07 21:37:23.769274703 +0200
+++ /var/tmp/diff_new_pack.DBoTjO/_new 2020-06-07 21:37:23.773274716 +0200
@@ -1,4 +1,4 @@
<servicedata>
<service name="tar_scm">
<param
name="url">https://github.com/libretro/beetle-wswan-libretro.git</param>
- <param
name="changesrevision">33806930cc404dde0a36565abd482a08829c2f5a</param></service></servicedata>
\ No newline at end of file
+ <param
name="changesrevision">29acc9d01bb475479096885afc4e12bb40dda8e4</param></service></servicedata>
\ No newline at end of file
++++++ libretro-beetle-wswan-0~git20200120.tar.xz ->
libretro-beetle-wswan-0~git20200518.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libretro-beetle-wswan-0~git20200120/libretro.cpp
new/libretro-beetle-wswan-0~git20200518/libretro.cpp
--- old/libretro-beetle-wswan-0~git20200120/libretro.cpp 2020-01-20
00:59:51.000000000 +0100
+++ new/libretro-beetle-wswan-0~git20200518/libretro.cpp 2020-05-18
15:46:36.000000000 +0200
@@ -11,6 +11,9 @@
/* core options */
static int RETRO_SAMPLE_RATE = 44100;
+static int RETRO_PIX_BYTES = 2;
+static int RETRO_PIX_DEPTH = 15;
+
static MDFNGI *game;
struct retro_perf_callback perf_cb;
@@ -105,6 +108,8 @@
espec->DisplayRect.w = 224;
espec->DisplayRect.h = 144;
+ if(espec->VideoFormatChanged)
+ WSwan_SetPixelFormat(espec->surface->depth);
if(espec->SoundFormatChanged)
WSwan_SetSoundRate(espec->SoundRate);
@@ -511,45 +516,53 @@
environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level);
}
-void retro_init(void)
+static void check_depth(void)
{
- struct retro_log_callback log;
- if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
- log_cb = log.log;
- else
- log_cb = NULL;
+ if (RETRO_PIX_DEPTH == 24)
+ {
+ enum retro_pixel_format rgb888 = RETRO_PIXEL_FORMAT_XRGB8888;
-#if defined(WANT_16BPP) && defined(FRONTEND_SUPPORTS_RGB565)
- enum retro_pixel_format rgb565 = RETRO_PIXEL_FORMAT_RGB565;
- if (environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &rgb565) && log_cb)
- log_cb(RETRO_LOG_INFO, "Frontend supports RGB565 - will use that instead
of XRGB1555.\n");
-#endif
+ if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &rgb888))
+ {
+ if (log_cb) log_cb(RETRO_LOG_ERROR, "Pixel format XRGB8888 not
supported by platform.\n");
- if (environ_cb(RETRO_ENVIRONMENT_GET_PERF_INTERFACE, &perf_cb))
- perf_get_cpu_features_cb = perf_cb.get_cpu_features;
- else
- perf_get_cpu_features_cb = NULL;
+ RETRO_PIX_BYTES = 2;
+ RETRO_PIX_DEPTH = 15;
+ }
+ }
- check_system_specs();
-}
+#if defined(FRONTEND_SUPPORTS_RGB565)
+ if (RETRO_PIX_BYTES == 2)
+ {
+ enum retro_pixel_format rgb565 = RETRO_PIXEL_FORMAT_RGB565;
-void retro_reset(void)
-{
- DoSimpleCommand(MDFN_MSC_RESET);
-}
+ if (environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &rgb565))
+ {
+ if (log_cb) log_cb(RETRO_LOG_INFO, "Frontend supports RGB565 - will
use that instead of XRGB1555.\n");
-bool retro_load_game_special(unsigned, const struct retro_game_info *, size_t)
-{
- return false;
+ RETRO_PIX_DEPTH = 16;
+ }
+ }
+#endif
}
-static void set_volume (uint32_t *ptr, unsigned number)
+static void rotate_display(void)
{
- switch(number)
+ if (rotate_tall)
{
- default:
- *ptr = number;
- break;
+ struct retro_game_geometry new_geom = {FB_WIDTH, FB_HEIGHT, FB_WIDTH,
FB_HEIGHT, (9.0 / 14.0)};
+ const unsigned rot_angle = 1;/*90 degrees*/
+
+ environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, (void*)&new_geom);
+ environ_cb(RETRO_ENVIRONMENT_SET_ROTATION, (void*)&rot_angle);
+ }
+ else
+ {
+ struct retro_game_geometry new_geom = {FB_WIDTH, FB_HEIGHT, FB_WIDTH,
FB_HEIGHT, (14.0 / 9.0)};
+ const unsigned rot_angle = 0;/*0 degrees*/
+
+ environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, (void*)&new_geom);
+ environ_cb(RETRO_ENVIRONMENT_SET_ROTATION, (void*)&rot_angle);
}
}
@@ -581,6 +594,66 @@
if (old_value != RETRO_SAMPLE_RATE)
update_audio = true;
}
+
+ var.key = "wswan_gfx_colors";
+ var.value = NULL;
+
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
+ {
+ unsigned old_value = RETRO_PIX_BYTES;
+
+ if (strcmp(var.value, "16bit") == 0)
+ {
+ RETRO_PIX_BYTES = 2;
+ RETRO_PIX_DEPTH = 16;
+ }
+ else if (strcmp(var.value, "24bit") == 0)
+ {
+ RETRO_PIX_BYTES = 4;
+ RETRO_PIX_DEPTH = 24;
+ }
+
+ if (old_value != RETRO_PIX_BYTES)
+ update_video = true;
+ }
+}
+
+void retro_init(void)
+{
+ struct retro_log_callback log;
+ if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
+ log_cb = log.log;
+ else
+ log_cb = NULL;
+
+ if (environ_cb(RETRO_ENVIRONMENT_GET_PERF_INTERFACE, &perf_cb))
+ perf_get_cpu_features_cb = perf_cb.get_cpu_features;
+ else
+ perf_get_cpu_features_cb = NULL;
+
+ check_system_specs();
+ check_variables();
+ check_depth();
+}
+
+void retro_reset(void)
+{
+ DoSimpleCommand(MDFN_MSC_RESET);
+}
+
+bool retro_load_game_special(unsigned, const struct retro_game_info *, size_t)
+{
+ return false;
+}
+
+static void set_volume (uint32_t *ptr, unsigned number)
+{
+ switch(number)
+ {
+ default:
+ *ptr = number;
+ break;
+ }
}
#define MAX_PLAYERS 1
@@ -630,26 +703,25 @@
surf->width = FB_WIDTH;
surf->height = FB_HEIGHT;
surf->pitch = FB_WIDTH;
+ surf->depth = RETRO_PIX_DEPTH;
- surf->pixels = (uint16_t*)calloc(1, FB_WIDTH * FB_HEIGHT * 2);
+ surf->pixels = (uint16_t*)calloc(1, FB_WIDTH * FB_HEIGHT *
sizeof(uint32_t));
if (!surf->pixels)
{
free(surf);
return false;
}
-
+
rotate_tall = false;
select_pressed_last_frame = false;
rotate_joymap = 0;
check_variables();
- WSwan_SetPixelFormat();
+ WSwan_SetPixelFormat(RETRO_PIX_DEPTH);
-#if 0
update_video = false;
-#endif
update_audio = true;
return true;
@@ -703,30 +775,15 @@
RETRO_DEVICE_ID_JOYPAD_R,
}
};
-
+
bool select_button = input_state_cb(0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_SELECT);
-
+
if(select_button && !select_pressed_last_frame)
{
rotate_tall = !rotate_tall;
- if(rotate_tall)
- {
- struct retro_game_geometry new_geom = {FB_WIDTH, FB_HEIGHT, FB_WIDTH,
FB_HEIGHT, (9.0 / 14.0)};
- const unsigned rot_angle = 1;/*90 degrees*/
-
- environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, (void*)&new_geom);
- environ_cb(RETRO_ENVIRONMENT_SET_ROTATION, (void*)&rot_angle);
- }
- else
- {
- struct retro_game_geometry new_geom = {FB_WIDTH, FB_HEIGHT, FB_WIDTH,
FB_HEIGHT, (14.0 / 9.0)};
- const unsigned rot_angle = 0;/*0 degrees*/
-
- environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, (void*)&new_geom);
- environ_cb(RETRO_ENVIRONMENT_SET_ROTATION, (void*)&rot_angle);
- }
+ rotate_display();
}
-
+
select_pressed_last_frame = select_button;
bool joymap = (rotate_joymap == 2) ? rotate_tall : (rotate_joymap ? true :
false);
@@ -774,34 +831,28 @@
spec.SoundVolume = 1.0;
spec.soundmultiplier = 1.0;
spec.SoundBufSize = 0;
- spec.VideoFormatChanged = false;
+ spec.VideoFormatChanged = update_video;
spec.SoundFormatChanged = update_audio;
-#if 0
if (update_video || update_audio)
-#else
- if (update_audio)
-#endif
{
struct retro_system_av_info system_av_info;
-#if 0
if (update_video)
{
memset(&system_av_info, 0, sizeof(system_av_info));
environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &system_av_info);
}
-#endif
retro_get_system_av_info(&system_av_info);
environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &system_av_info);
-#if 0
if (update_video)
rotate_display();
+ surf->depth = RETRO_PIX_DEPTH;
+
update_video = false;
-#endif
update_audio = false;
}
@@ -813,15 +864,14 @@
unsigned width = spec.DisplayRect.w;
unsigned height = spec.DisplayRect.h;
-
- video_cb(surf->pixels, width, height, FB_WIDTH << 1);
+
+ video_cb(surf->pixels, width, height, FB_WIDTH * RETRO_PIX_BYTES);
video_frames++;
audio_frames += spec.SoundBufSize;
for (total = 0; total < spec.SoundBufSize; )
total += audio_batch_cb(spec.SoundBuf + total*2, spec.SoundBufSize -
total);
-
}
void retro_get_system_info(struct retro_system_info *info)
@@ -847,6 +897,8 @@
info->geometry.max_width = MEDNAFEN_CORE_GEOMETRY_MAX_W;
info->geometry.max_height = MEDNAFEN_CORE_GEOMETRY_MAX_H;
info->geometry.aspect_ratio = MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIO;
+
+ check_depth();
}
void retro_deinit(void)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libretro-beetle-wswan-0~git20200120/libretro_core_options.h
new/libretro-beetle-wswan-0~git20200518/libretro_core_options.h
--- old/libretro-beetle-wswan-0~git20200120/libretro_core_options.h
2020-01-20 00:59:51.000000000 +0100
+++ new/libretro-beetle-wswan-0~git20200518/libretro_core_options.h
2020-05-18 15:46:36.000000000 +0200
@@ -77,6 +77,17 @@
},
"44100",
},
+ {
+ "wswan_gfx_colors",
+ "Color Depth",
+ "24-bit is slower and not available on all platforms.",
+ {
+ { "16bit", "Thousands (16-bit)" },
+ { "24bit", "Millions (24-bit)" },
+ { NULL, NULL },
+ },
+ "16bit"
+ },
{ NULL, NULL, NULL, { NULL, NULL }, NULL },
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libretro-beetle-wswan-0~git20200120/mednafen/mempatcher.cpp
new/libretro-beetle-wswan-0~git20200518/mednafen/mempatcher.cpp
--- old/libretro-beetle-wswan-0~git20200120/mednafen/mempatcher.cpp
2020-01-20 00:59:51.000000000 +0100
+++ new/libretro-beetle-wswan-0~git20200518/mednafen/mempatcher.cpp
2020-05-18 15:46:36.000000000 +0200
@@ -271,14 +271,16 @@
//printf("TR: %s\n", string);
while(sscanf(string, "%u %c %63s %63s %63s", &bytelen, &endian, address,
operation, value) == 5 && passed)
{
- uint32 v_address;
uint64 v_value;
uint64 value_at_address;
+#if 0
+ uint32 v_address;
if(address[0] == '0' && address[1] == 'x')
v_address = strtoul(address + 2, NULL, 16);
else
v_address = strtoul(address, NULL, 10);
+#endif
if(value[0] == '0' && value[1] == 'x')
v_value = strtoull(value + 2, NULL, 16);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libretro-beetle-wswan-0~git20200120/mednafen/state.cpp
new/libretro-beetle-wswan-0~git20200518/mednafen/state.cpp
--- old/libretro-beetle-wswan-0~git20200120/mednafen/state.cpp 2020-01-20
00:59:51.000000000 +0100
+++ new/libretro-beetle-wswan-0~git20200518/mednafen/state.cpp 2020-05-18
15:46:36.000000000 +0200
@@ -228,10 +228,7 @@
nameo[0] = slen;
if(slen >= 255)
- {
- printf("Warning: state variable name possibly too long: %s %s %s
%d\n", sf->name, name_prefix, nameo, slen);
slen = 255;
- }
smem_write(st, nameo, 1 + nameo[0]);
smem_write32le(st, bytesize);
@@ -295,7 +292,7 @@
uint8_t sname_tmp[32];
memset(sname_tmp, 0, sizeof(sname_tmp));
- strncpy((char *)sname_tmp, sname, 32);
+ memcpy((char *)sname_tmp, sname, 32);
if(strlen(sname) > 32)
printf("Warning: section name is too long: %s\n", sname);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libretro-beetle-wswan-0~git20200120/mednafen/video.h
new/libretro-beetle-wswan-0~git20200518/mednafen/video.h
--- old/libretro-beetle-wswan-0~git20200120/mednafen/video.h 2020-01-20
00:59:51.000000000 +0100
+++ new/libretro-beetle-wswan-0~git20200518/mednafen/video.h 2020-05-18
15:46:36.000000000 +0200
@@ -3,31 +3,36 @@
#include <stdint.h>
-#if defined(FRONTEND_SUPPORTS_RGB565)
+
+#define RED_SHIFT_24 16
+#define GREEN_SHIFT_24 8
+#define BLUE_SHIFT_24 0
+#define ALPHA_SHIFT_24 24
+#define MAKECOLOR_24(r, g, b, a) ((r << RED_SHIFT_24) | (g << GREEN_SHIFT_24)
| (b << BLUE_SHIFT_24) | (a << ALPHA_SHIFT_24))
+
/* 16bit color - RGB565 */
-#define RED_MASK 0xf800
-#define GREEN_MASK 0x7e0
-#define BLUE_MASK 0x1f
-#define RED_EXPAND 3
-#define GREEN_EXPAND 2
-#define BLUE_EXPAND 3
-#define RED_SHIFT 11
-#define GREEN_SHIFT 5
-#define BLUE_SHIFT 0
-#define MAKECOLOR(r, g, b, a) (((r >> RED_EXPAND) << RED_SHIFT) | ((g >>
GREEN_EXPAND) << GREEN_SHIFT) | ((b >> BLUE_EXPAND) << BLUE_SHIFT))
-#else
+#define RED_MASK_16 0xf800
+#define GREEN_MASK_16 0x7e0
+#define BLUE_MASK_16 0x1f
+#define RED_EXPAND_16 3
+#define GREEN_EXPAND_16 2
+#define BLUE_EXPAND_16 3
+#define RED_SHIFT_16 11
+#define GREEN_SHIFT_16 5
+#define BLUE_SHIFT_16 0
+#define MAKECOLOR_16(r, g, b, a) (((r >> RED_EXPAND_16) << RED_SHIFT_16) | ((g
>> GREEN_EXPAND_16) << GREEN_SHIFT_16) | ((b >> BLUE_EXPAND_16) <<
BLUE_SHIFT_16))
+
/* 16bit color - RGB555 */
-#define RED_MASK 0x7c00
-#define GREEN_MASK 0x3e0
-#define BLUE_MASK 0x1f
-#define RED_EXPAND 3
-#define GREEN_EXPAND 3
-#define BLUE_EXPAND 3
-#define RED_SHIFT 10
-#define GREEN_SHIFT 5
-#define BLUE_SHIFT 0
-#define MAKECOLOR(r, g, b, a) (((r >> RED_EXPAND) << RED_SHIFT) | ((g >>
GREEN_EXPAND) << GREEN_SHIFT) | ((b >> BLUE_EXPAND) << BLUE_SHIFT))
-#endif
+#define RED_MASK_15 0x7c00
+#define GREEN_MASK_15 0x3e0
+#define BLUE_MASK_15 0x1f
+#define RED_EXPAND_15 3
+#define GREEN_EXPAND_15 3
+#define BLUE_EXPAND_15 3
+#define RED_SHIFT_15 10
+#define GREEN_SHIFT_15 5
+#define BLUE_SHIFT_15 0
+#define MAKECOLOR_15(r, g, b, a) (((r >> RED_EXPAND_15) << RED_SHIFT_15) | ((g
>> GREEN_EXPAND_15) << GREEN_SHIFT_15) | ((b >> BLUE_EXPAND_15) <<
BLUE_SHIFT_15))
#ifdef __cplusplus
extern "C" {
@@ -53,6 +58,7 @@
int32_t width;
int32_t height;
int32_t pitch;
+ int32_t depth;
} MDFN_Surface;
#ifdef __cplusplus
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libretro-beetle-wswan-0~git20200120/mednafen/wswan/gfx.cpp
new/libretro-beetle-wswan-0~git20200518/mednafen/wswan/gfx.cpp
--- old/libretro-beetle-wswan-0~git20200120/mednafen/wswan/gfx.cpp
2020-01-20 00:59:51.000000000 +0100
+++ new/libretro-beetle-wswan-0~git20200518/mednafen/wswan/gfx.cpp
2020-05-18 15:46:36.000000000 +0200
@@ -29,8 +29,8 @@
static uint32 wsColors[8];
static uint32 wsCols[16][16];
-static uint16 ColorMapG[16];
-static uint16 ColorMap[4096];
+static uint32 ColorMapG[16];
+static uint32 ColorMap[4096];
static uint32 LayerEnabled;
static uint8 wsLine; /*current scanline*/
@@ -179,7 +179,19 @@
if(wsLine < 144)
{
if(!skip)
- wsScanline(surface->pixels + wsLine * surface->pitch);
+ {
+ switch(surface->depth)
+ {
+ case 15:
+ case 16:
+ wsScanline(surface->pixels + wsLine * surface->pitch,
surface->depth);
+ break;
+
+ case 24:
+ wsScanline(surface->pixels + wsLine * surface->pitch * 2,
surface->depth);
+ break;
+ }
+ }
}
WSwan_CheckSoundDMA();
@@ -232,7 +244,7 @@
WSwan_CheckSoundDMA();
-#define MAX(a,b) ((a < b) ? a : b)
+#define MAX(a,b) ((a >= b) ? a : b)
v30mz_execute(96);
@@ -254,19 +266,45 @@
LayerEnabled = mask;
}
-void WSwan_SetPixelFormat(void)
+void WSwan_SetPixelFormat(int depth)
{
unsigned r, g, b, i;
for(r = 0; r < 16; r++)
for(g = 0; g < 16; g++)
for(b = 0; b < 16; b++)
- ColorMap[(r << 8) | (g << 4) | (b << 0)] = MAKECOLOR((r * 17), (g
* 17), (b * 17), 0); //(neo_r << rs) | (neo_g << gs) | (neo_b << bs);
+ {
+ uint32 neo_r, neo_g, neo_b;
+
+ neo_r = r * 17;
+ neo_g = g * 17;
+ neo_b = b * 17;
+
+ switch(depth)
+ {
+ case 15: ColorMap[(r << 8) | (g << 4) | (b << 0)] =
MAKECOLOR_15(neo_r, neo_g, neo_b, 0); break;
+ case 16: ColorMap[(r << 8) | (g << 4) | (b << 0)] =
MAKECOLOR_16(neo_r, neo_g, neo_b, 0); break;
+ case 24: ColorMap[(r << 8) | (g << 4) | (b << 0)] =
MAKECOLOR_24(neo_r, neo_g, neo_b, 0); break;
+ }
+ }
for(i = 0; i < 16; i++)
- ColorMapG[i] = MAKECOLOR((i * 17), (i * 17), (i * 17), 0); //(neo_r <<
rs) | (neo_g << gs) | (neo_b << bs);
+ {
+ uint32 neo_r, neo_g, neo_b;
+
+ neo_r = i * 17;
+ neo_g = i * 17;
+ neo_b = i * 17;
+
+ switch(depth)
+ {
+ case 15: ColorMapG[i] = MAKECOLOR_15(neo_r, neo_g, neo_b, 0); break;
+ case 16: ColorMapG[i] = MAKECOLOR_16(neo_r, neo_g, neo_b, 0); break;
+ case 24: ColorMapG[i] = MAKECOLOR_24(neo_r, neo_g, neo_b, 0); break;
+ }
+ }
}
-void wsScanline(uint16 *target)
+void wsScanline(uint16 *target, int depth)
{
uint32 start_tile_n,map_a,startindex,adrbuf,b1,b2,j,t,l;
uint8 b_bg[256];
@@ -530,13 +568,35 @@
if(wsVMode)
{
- for(l=0;l<224;l++)
- target[l] = ColorMap[wsCols[b_bg_pal[l+7]][b_bg[(l+7)]&0xf]];
+ switch(depth)
+ {
+ case 15:
+ case 16: {
+ for(l=0;l<224;l++)
+ target[l] = ColorMap[wsCols[b_bg_pal[l+7]][b_bg[(l+7)]&0xf]];
+ } break;
+
+ case 24: {
+ for(l=0;l<224;l++)
+ ((uint32_t*)target)[l] =
ColorMap[wsCols[b_bg_pal[l+7]][b_bg[(l+7)]&0xf]];
+ } break;
+ }
}
else
{
- for(l=0;l<224;l++)
- target[l] = ColorMapG[(b_bg[l+7])&15];
+ switch(depth)
+ {
+ case 15:
+ case 16: {
+ for(l=0;l<224;l++)
+ target[l] = ColorMapG[(b_bg[l+7])&15];
+ } break;
+
+ case 24: {
+ for(l=0;l<224;l++)
+ ((uint32_t*)target)[l] = ColorMapG[(b_bg[l+7])&15];
+ } break;
+ }
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libretro-beetle-wswan-0~git20200120/mednafen/wswan/gfx.h
new/libretro-beetle-wswan-0~git20200518/mednafen/wswan/gfx.h
--- old/libretro-beetle-wswan-0~git20200120/mednafen/wswan/gfx.h
2020-01-20 00:59:51.000000000 +0100
+++ new/libretro-beetle-wswan-0~git20200518/mednafen/wswan/gfx.h
2020-05-18 15:46:36.000000000 +0200
@@ -16,13 +16,13 @@
void wsGetTile(uint32,uint32,int,int,int);
void wsSetVideo(int, bool);
-void wsScanline(uint16 *target);
+void wsScanline(uint16 *target, int depth);
extern uint32 dx_r,dx_g,dx_b,dx_sr,dx_sg,dx_sb;
extern uint32 dx_bits,dx_pitch,cmov,dx_linewidth_blit,dx_buffer_line;
-void WSwan_SetPixelFormat(void);
+void WSwan_SetPixelFormat(int depth);
void WSwan_GfxInit(void);
void WSwan_GfxReset(void);