mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
Add SET_PIXEL_FORMAT environ.
This commit is contained in:
parent
ae33d8c899
commit
53f645ed0b
8
driver.c
8
driver.c
@ -397,6 +397,12 @@ static void init_filter(void)
|
||||
if (*g_settings.video.filter_path == '\0')
|
||||
return;
|
||||
|
||||
if (g_extern.system.rgb32)
|
||||
{
|
||||
RARCH_WARN("libretro implementation uses XRGB8888 format. CPU filters only support 0RGB1555.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
RARCH_LOG("Loading bSNES filter from \"%s\"\n", g_settings.video.filter_path);
|
||||
g_extern.filter.lib = dylib_load(g_settings.video.filter_path);
|
||||
if (!g_extern.filter.lib)
|
||||
@ -553,7 +559,7 @@ void init_video_input(void)
|
||||
video.force_aspect = g_settings.video.force_aspect;
|
||||
video.smooth = g_settings.video.smooth;
|
||||
video.input_scale = scale;
|
||||
video.rgb32 = g_extern.filter.active;
|
||||
video.rgb32 = g_extern.filter.active || g_extern.system.rgb32;
|
||||
|
||||
const input_driver_t *tmp = driver.input;
|
||||
driver.video_data = video_init_func(&video, &driver.input, &driver.input_data);
|
||||
|
25
dynamic.c
25
dynamic.c
@ -331,6 +331,31 @@ static bool environment_cb(unsigned cmd, void *data)
|
||||
RARCH_LOG("Environ SYSTEM_DIRECTORY: \"%s\".\n", g_settings.system_directory);
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_SET_PIXEL_FORMAT:
|
||||
{
|
||||
enum retro_pixel_format pix_fmt = *(const enum retro_pixel_format*)data;
|
||||
bool rgb32 = false;
|
||||
switch (pix_fmt)
|
||||
{
|
||||
case RETRO_PIXEL_FORMAT_0RGB1555:
|
||||
rgb32 = false;
|
||||
RARCH_LOG("Environ SET_PIXEL_FORMAT: 0RGB1555.\n");
|
||||
break;
|
||||
|
||||
#ifndef RARCH_CONSOLE
|
||||
case RETRO_PIXEL_FORMAT_XRGB8888:
|
||||
rgb32 = true;
|
||||
RARCH_LOG("Environ SET_PIXEL_FORMAT: XRGB8888.\n");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
g_extern.system.rgb32 = rgb32;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd);
|
||||
return false;
|
||||
|
@ -332,6 +332,7 @@ struct global
|
||||
unsigned rotation;
|
||||
bool shutdown;
|
||||
unsigned performance_level;
|
||||
bool rgb32;
|
||||
} system;
|
||||
|
||||
struct
|
||||
|
14
libretro.h
14
libretro.h
@ -150,7 +150,19 @@ extern "C" {
|
||||
// The returned value can be NULL.
|
||||
// If so, no such directory is defined,
|
||||
// and it's up to the implementation to find a suitable directory.
|
||||
//
|
||||
#define RETRO_ENVIRONMENT_SET_PIXEL_FORMAT 10
|
||||
// const enum retro_pixel_format * --
|
||||
// Sets the internal pixel format used by the implementation.
|
||||
// The default pixel format is RETRO_PIXEL_FORMAT_XRGB1555.
|
||||
// If the call returns false, the frontend does not support this pixel format.
|
||||
// This function should be called inside retro_load_game() or retro_get_system_av_info().
|
||||
|
||||
enum retro_pixel_format
|
||||
{
|
||||
RETRO_PIXEL_FORMAT_0RGB1555 = 0, // 0RGB1555, native endian. 0 bit must be set to 0.
|
||||
RETRO_PIXEL_FORMAT_XRGB8888 // XRGB8888, native endian. X bits are ignored.
|
||||
};
|
||||
|
||||
struct retro_message
|
||||
{
|
||||
@ -225,7 +237,7 @@ struct retro_game_info
|
||||
// Environment callback. Gives implementations a way of performing uncommon tasks. Extensible.
|
||||
typedef bool (*retro_environment_t)(unsigned cmd, void *data);
|
||||
|
||||
// Render a frame. Pixel format is 15-bit XRGB1555 native endian.
|
||||
// Render a frame. Pixel format is 15-bit 0RGB1555 native endian unless changed (see RETRO_ENVIRONMENT_SET_PIXEL_FORMAT).
|
||||
// Width and height specify dimensions of buffer.
|
||||
// Pitch specifices length in bytes between two lines in buffer.
|
||||
typedef void (*retro_video_refresh_t)(const void *data, unsigned width, unsigned height, size_t pitch);
|
||||
|
@ -1171,7 +1171,7 @@ static void init_recording(void)
|
||||
params.filename = g_extern.record_path;
|
||||
params.fps = fps;
|
||||
params.samplerate = samplerate;
|
||||
params.rgb32 = false;
|
||||
params.rgb32 = g_extern.system.rgb32;
|
||||
|
||||
if (g_extern.record_width || g_extern.record_height)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user