mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-31 05:56:07 +00:00
Static code analysis cleanups
This commit is contained in:
parent
28b9ac73ad
commit
e986b9e42a
66
deps/stb/stb_image.h
vendored
66
deps/stb/stb_image.h
vendored
@ -1747,14 +1747,18 @@ static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman
|
||||
|
||||
static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__huffman *hdc, int b)
|
||||
{
|
||||
int diff,dc;
|
||||
int t;
|
||||
if (j->spec_end != 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG");
|
||||
if (j->spec_end != 0)
|
||||
return stbi__err("can't merge dc and ac", "Corrupt JPEG");
|
||||
|
||||
if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
|
||||
if (j->code_bits < 16)
|
||||
stbi__grow_buffer_unsafe(j);
|
||||
|
||||
if (j->succ_high == 0) {
|
||||
// first scan for DC coefficient, must be first
|
||||
if (j->succ_high == 0)
|
||||
{
|
||||
int diff,dc;
|
||||
int t;
|
||||
|
||||
/* first scan for DC coefficient, must be first */
|
||||
memset(data,0,64*sizeof(data[0])); // 0 all the ac values now
|
||||
t = stbi__jpeg_huff_decode(j, hdc);
|
||||
diff = t ? stbi__extend_receive(j, t) : 0;
|
||||
@ -1762,8 +1766,10 @@ static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__
|
||||
dc = j->img_comp[b].dc_pred + diff;
|
||||
j->img_comp[b].dc_pred = dc;
|
||||
data[0] = (short) (dc << j->succ_low);
|
||||
} else {
|
||||
// refinement scan for DC coefficient
|
||||
}
|
||||
else
|
||||
{
|
||||
/* refinement scan for DC coefficient */
|
||||
if (stbi__jpeg_get_bit(j))
|
||||
data[0] += (short) (1 << j->succ_low);
|
||||
}
|
||||
@ -2648,25 +2654,36 @@ static int stbi__process_scan_header(stbi__jpeg *z)
|
||||
{
|
||||
int i;
|
||||
int Ls = stbi__get16be(z->s);
|
||||
|
||||
z->scan_n = stbi__get8(z->s);
|
||||
if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s->img_n) return stbi__err("bad SOS component count","Corrupt JPEG");
|
||||
if (Ls != 6+2*z->scan_n) return stbi__err("bad SOS len","Corrupt JPEG");
|
||||
for (i=0; i < z->scan_n; ++i) {
|
||||
|
||||
if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s->img_n)
|
||||
return stbi__err("bad SOS component count","Corrupt JPEG");
|
||||
if (Ls != 6+2*z->scan_n)
|
||||
return stbi__err("bad SOS len","Corrupt JPEG");
|
||||
|
||||
for (i=0; i < z->scan_n; ++i)
|
||||
{
|
||||
int id = stbi__get8(z->s), which;
|
||||
int q = stbi__get8(z->s);
|
||||
int q = stbi__get8(z->s);
|
||||
|
||||
for (which = 0; which < z->s->img_n; ++which)
|
||||
if (z->img_comp[which].id == id)
|
||||
break;
|
||||
if (which == z->s->img_n) return 0; // no match
|
||||
z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return stbi__err("bad DC huff","Corrupt JPEG");
|
||||
z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return stbi__err("bad AC huff","Corrupt JPEG");
|
||||
if (which == z->s->img_n)
|
||||
return 0; /* no match */
|
||||
|
||||
z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3)
|
||||
return stbi__err("bad DC huff","Corrupt JPEG");
|
||||
z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3)
|
||||
return stbi__err("bad AC huff","Corrupt JPEG");
|
||||
z->order[i] = which;
|
||||
}
|
||||
|
||||
{
|
||||
int aa;
|
||||
z->spec_start = stbi__get8(z->s);
|
||||
z->spec_end = stbi__get8(z->s); // should be 63, but might be 0
|
||||
z->spec_end = stbi__get8(z->s); /* should be 63, but might be 0 */
|
||||
aa = stbi__get8(z->s);
|
||||
z->succ_high = (aa >> 4);
|
||||
z->succ_low = (aa & 15);
|
||||
@ -4590,7 +4607,7 @@ static int stbi__shiftsigned(int v, int shift, int bits)
|
||||
static stbi_uc *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
|
||||
{
|
||||
stbi_uc *out;
|
||||
unsigned int mr=0,mg=0,mb=0,ma=0, fake_a=0;
|
||||
unsigned int mr=0,mg=0,mb=0,ma=0;
|
||||
stbi_uc pal[256][4];
|
||||
int psize=0,i,j,compress=0,width;
|
||||
int bpp, flip_vertically, pad, target, offset, hsz;
|
||||
@ -4631,17 +4648,20 @@ static stbi_uc *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int
|
||||
stbi__get32le(s);
|
||||
stbi__get32le(s);
|
||||
}
|
||||
if (bpp == 16 || bpp == 32) {
|
||||
if (bpp == 16 || bpp == 32)
|
||||
{
|
||||
mr = mg = mb = 0;
|
||||
if (compress == 0) {
|
||||
if (bpp == 32) {
|
||||
if (compress == 0)
|
||||
{
|
||||
if (bpp == 32)
|
||||
{
|
||||
mr = 0xffu << 16;
|
||||
mg = 0xffu << 8;
|
||||
mb = 0xffu << 0;
|
||||
ma = 0xffu << 24;
|
||||
fake_a = 1; // @TODO: check for cases like alpha value is all 0 and switch it to 255
|
||||
STBI_NOTUSED(fake_a);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
mr = 31u << 10;
|
||||
mg = 31u << 5;
|
||||
mb = 31u << 0;
|
||||
|
@ -2012,12 +2012,14 @@ static void gl_set_nonblock_state(void *data, bool state)
|
||||
static bool resolve_extensions(gl_t *gl, const char *context_ident)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *vendor = (const char*)glGetString(GL_VENDOR);
|
||||
const char *renderer = (const char*)glGetString(GL_RENDERER);
|
||||
const char *version = (const char*)glGetString(GL_VERSION);
|
||||
const struct retro_hw_render_callback *hw_render =
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
#if defined(HAVE_GL_SYNC) || defined(HAVE_FBO)
|
||||
settings_t *settings = config_get_ptr();
|
||||
#endif
|
||||
|
||||
(void)vendor;
|
||||
(void)renderer;
|
||||
|
@ -466,15 +466,17 @@ static void gx_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
|
||||
|
||||
static void setup_video_mode(void *data)
|
||||
{
|
||||
unsigned i;
|
||||
if (!g_framebuf[0])
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < 2; i++)
|
||||
g_framebuf[i] = MEM_K0_TO_K1(
|
||||
memalign(32, 640 * 576 * VI_DISPLAY_PIX_SZ));
|
||||
}
|
||||
|
||||
g_current_framebuf = 0;
|
||||
g_draw_done = true;
|
||||
g_orientation = ORIENTATION_NORMAL;
|
||||
g_draw_done = true;
|
||||
g_orientation = ORIENTATION_NORMAL;
|
||||
OSInitThreadQueue(&g_video_cond);
|
||||
|
||||
VIDEO_GetPreferredMode(&gx_mode);
|
||||
@ -569,8 +571,8 @@ static void init_vtx(void *data, const video_info_t *video)
|
||||
}
|
||||
}
|
||||
|
||||
DCFlushRange(g_tex.data, g_tex.width *
|
||||
g_tex.height * video->rgb32 ? 4 : 2);
|
||||
DCFlushRange(g_tex.data, (g_tex.width *
|
||||
g_tex.height * video->rgb32) ? 4 : 2);
|
||||
|
||||
gx->rgb32 = video->rgb32;
|
||||
gx->scale = video->input_scale;
|
||||
@ -840,12 +842,11 @@ static void convert_texture32(const uint32_t *_src, uint32_t *_dst,
|
||||
|
||||
static void gx_resize(void *data)
|
||||
{
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
int x = 0, y = 0;
|
||||
unsigned width = gx->vp.full_width, height = gx->vp.full_height;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const global_t *global = (const global_t*)global_get_ptr();
|
||||
struct video_viewport *custom_vp = video_viewport_get_custom();
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const global_t *global = (const global_t*)global_get_ptr();
|
||||
|
||||
#ifdef HW_RVL
|
||||
VIDEO_SetTrapFilter(global->console.softfilter_enable);
|
||||
@ -857,20 +858,14 @@ static void gx_resize(void *data)
|
||||
float desired_aspect = video_driver_get_aspect_ratio();
|
||||
if (desired_aspect == 0.0)
|
||||
desired_aspect = 1.0;
|
||||
#ifdef HW_RVL
|
||||
float device_aspect = CONF_GetAspectRatio() == CONF_ASPECT_4_3 ?
|
||||
4.0 / 3.0 : 16.0 / 9.0;
|
||||
#else
|
||||
float device_aspect = 4.0 / 3.0;
|
||||
#endif
|
||||
if (g_orientation == ORIENTATION_VERTICAL ||
|
||||
g_orientation == ORIENTATION_FLIPPED_ROTATED)
|
||||
desired_aspect = 1.0 / desired_aspect;
|
||||
float delta;
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
struct video_viewport *custom_vp = video_viewport_get_custom();
|
||||
|
||||
if (!custom_vp->width || !custom_vp->height)
|
||||
{
|
||||
custom_vp->x = 0;
|
||||
@ -885,8 +880,14 @@ static void gx_resize(void *data)
|
||||
height = custom_vp->height;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
float delta;
|
||||
#ifdef HW_RVL
|
||||
float device_aspect = CONF_GetAspectRatio() == CONF_ASPECT_4_3 ?
|
||||
4.0 / 3.0 : 16.0 / 9.0;
|
||||
#else
|
||||
float device_aspect = 4.0 / 3.0;
|
||||
#endif
|
||||
if (fabs(device_aspect - desired_aspect) < 0.0001)
|
||||
{
|
||||
/* If the aspect ratios of screen and desired aspect ratio
|
||||
@ -1216,9 +1217,9 @@ static bool gx_has_windowed(void *data)
|
||||
static void gx_free(void *data)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
#ifdef HAVE_OVERLAY
|
||||
gx_video_t *gx = (gx_video_t*)driver->video_data;
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
gx_free_overlay(gx);
|
||||
#endif
|
||||
|
||||
|
@ -207,10 +207,10 @@ static void sdl2_render_msg(sdl2_video_t *vid, const char *msg)
|
||||
|
||||
static void sdl2_gfx_set_handles(sdl2_video_t *vid)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
/* SysWMinfo headers are broken on OSX. */
|
||||
#if defined(_WIN32) || defined(HAVE_X11)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION(&info.version);
|
||||
|
||||
@ -496,7 +496,6 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
{
|
||||
char buf[128] = {0};
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (vid->should_resize)
|
||||
sdl_refresh_viewport(vid);
|
||||
|
@ -218,10 +218,9 @@ static void sdl_render_msg(sdl_video_t *vid, SDL_Surface *buffer,
|
||||
|
||||
static void sdl_gfx_set_handles(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
/* SysWMinfo headers are broken on OSX. */
|
||||
#if defined(_WIN32) || defined(HAVE_X11)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION(&info.version);
|
||||
|
||||
@ -403,12 +402,9 @@ static bool sdl_gfx_focus(void *data)
|
||||
|
||||
static bool sdl_gfx_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
#ifdef HAVE_X11
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
(void)data;
|
||||
(void)enable;
|
||||
|
||||
#ifdef HAVE_X11
|
||||
if (driver->display_type == RARCH_DISPLAY_X11)
|
||||
{
|
||||
x11_suspend_screensaver(driver->video_window);
|
||||
@ -416,6 +412,9 @@ static bool sdl_gfx_suppress_screensaver(void *data, bool enable)
|
||||
}
|
||||
#endif
|
||||
|
||||
(void)data;
|
||||
(void)enable;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -443,9 +442,7 @@ static void sdl_set_filtering(void *data, unsigned index, bool smooth)
|
||||
|
||||
static void sdl_set_aspect_ratio(void *data, unsigned aspectratio_index)
|
||||
{
|
||||
sdl_video_t *vid = (sdl_video_t*)data;
|
||||
struct retro_system_av_info *av_info =
|
||||
video_viewport_get_system_av_info();
|
||||
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
|
||||
|
||||
switch (aspectratio_index)
|
||||
{
|
||||
|
@ -726,7 +726,6 @@ static void sunxi_setup_scale (void *data,
|
||||
int i;
|
||||
unsigned int xpos, visible_width;
|
||||
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
_dispvars->src_width = width;
|
||||
_dispvars->src_height = height;
|
||||
@ -892,7 +891,6 @@ static void sunxi_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
|
||||
/* Remember, memcpy() works with 8bits pointers for increments. */
|
||||
char *dst_base_addr = (char*)(_dispvars->pages[0].address);
|
||||
char *src_base_addr = (char*)frame;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
|
@ -367,9 +367,8 @@ static bool vg_frame(void *data, const void *frame,
|
||||
static bool vg_alive(void *data)
|
||||
{
|
||||
bool quit;
|
||||
bool ret = false;
|
||||
unsigned temp_width = 0, temp_height = 0;
|
||||
vg_t *vg = (vg_t*)data;
|
||||
vg_t *vg = (vg_t*)data;
|
||||
|
||||
gfx_ctx_check_window(data, &quit,
|
||||
&vg->should_resize, &temp_width, &temp_height);
|
||||
|
@ -56,16 +56,14 @@ typedef struct vita_video
|
||||
static void *vita2d_gfx_init(const video_info_t *video,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
void *pspinput = NULL;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
(void)video;
|
||||
|
||||
vita_video_t *vita = (vita_video_t *)calloc(1, sizeof(vita_video_t));
|
||||
|
||||
if (!vita)
|
||||
return NULL;
|
||||
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
|
||||
RARCH_LOG("vita2d_gfx_init: w: %i h: %i\n", video->width, video->height);
|
||||
RARCH_LOG("RARCH_SCALE_BASE: %i input_scale: %i = %i\n",
|
||||
RARCH_SCALE_BASE, video->input_scale, RARCH_SCALE_BASE * video->input_scale);
|
||||
@ -100,8 +98,8 @@ static void *vita2d_gfx_init(const video_info_t *video,
|
||||
|
||||
if (input && input_data)
|
||||
{
|
||||
pspinput = input_psp.init();
|
||||
*input = pspinput ? &input_psp : NULL;
|
||||
void *pspinput = input_psp.init();
|
||||
*input = pspinput ? &input_psp : NULL;
|
||||
*input_data = pspinput;
|
||||
}
|
||||
|
||||
@ -117,7 +115,6 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
unsigned width, unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
int i;
|
||||
void *tex_p;
|
||||
vita_video_t *vita = (vita_video_t *)data;
|
||||
|
||||
@ -129,7 +126,7 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
|
||||
|
||||
if (frame)
|
||||
{
|
||||
unsigned j;
|
||||
unsigned i, j;
|
||||
unsigned int stride;
|
||||
|
||||
if ((width != vita->width || height != vita->height) && vita->texture)
|
||||
|
@ -407,6 +407,7 @@ static void *xv_init(const video_info_t *video,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
unsigned i;
|
||||
XWindowAttributes target;
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
struct sigaction sa = {{0}};
|
||||
@ -420,12 +421,12 @@ static void *xv_init(const video_info_t *video,
|
||||
void *xinput = NULL;
|
||||
XVisualInfo *visualinfo = NULL;
|
||||
XvAdaptorInfo *adaptor_info = NULL;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct retro_game_geometry *geom = NULL;
|
||||
struct retro_system_av_info *av_info = NULL;
|
||||
xv_t *xv = (xv_t*)calloc(1, sizeof(*xv));
|
||||
XWindowAttributes target;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
xv_t *xv = (xv_t*)calloc(1, sizeof(*xv));
|
||||
if (!xv)
|
||||
return NULL;
|
||||
|
||||
@ -487,9 +488,11 @@ static void *xv_init(const video_info_t *video,
|
||||
visualinfo = XGetVisualInfo(xv->display, VisualIDMask |
|
||||
VisualScreenMask | VisualDepthMask, &visualtemplate, &visualmatches);
|
||||
|
||||
if (!visualinfo)
|
||||
goto error;
|
||||
|
||||
if (visualmatches < 1 || !visualinfo->visual)
|
||||
{
|
||||
if (visualinfo) XFree(visualinfo);
|
||||
RARCH_ERR("XVideo: Unable to find Xv-compatible visual.\n");
|
||||
goto error;
|
||||
}
|
||||
@ -601,6 +604,8 @@ static void *xv_init(const video_info_t *video,
|
||||
return xv;
|
||||
|
||||
error:
|
||||
if (visualinfo)
|
||||
XFree(visualinfo);
|
||||
free(xv);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -134,13 +134,14 @@ static void gfx_ctx_d3d_update_title(void *data)
|
||||
{
|
||||
char buf[128] = {0};
|
||||
char buffer_fps[128] = {0};
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (video_monitor_get_fps(buf, sizeof(buf),
|
||||
buffer_fps, sizeof(buffer_fps)))
|
||||
{
|
||||
#ifndef _XBOX
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
|
||||
SetWindowText(d3d->hWnd, buf);
|
||||
#endif
|
||||
}
|
||||
@ -270,9 +271,9 @@ static void gfx_ctx_d3d_input_driver(void *data,
|
||||
static void gfx_ctx_d3d_get_video_size(void *data,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
#ifdef _XBOX
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
|
||||
#ifdef _XBOX
|
||||
(void)width;
|
||||
(void)height;
|
||||
#if defined(_XBOX360)
|
||||
|
@ -130,11 +130,9 @@ static void sdl_ctx_destroy(void *data)
|
||||
static bool sdl_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major,
|
||||
unsigned minor)
|
||||
{
|
||||
#ifdef HAVE_SDL2
|
||||
unsigned profile;
|
||||
|
||||
(void)data;
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
if (api != GFX_CTX_OPENGL_API && api != GFX_CTX_OPENGL_ES_API)
|
||||
return false;
|
||||
|
||||
@ -255,10 +253,9 @@ static void sdl_ctx_get_video_size(void *data,
|
||||
|
||||
if (!sdl->g_win)
|
||||
{
|
||||
int i = settings->video.monitor_index;
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
SDL_DisplayMode mode = {0};
|
||||
int i = settings->video.monitor_index;
|
||||
|
||||
if (SDL_GetCurrentDisplayMode(i, &mode) < 0)
|
||||
RARCH_WARN("[SDL_GL]: Failed to get display #%i mode: %s\n", i,
|
||||
@ -369,9 +366,9 @@ static void sdl_ctx_set_resize(void *data, unsigned width, unsigned height)
|
||||
static bool sdl_ctx_has_focus(void *data)
|
||||
{
|
||||
unsigned flags;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)driver->video_context_data;
|
||||
flags = (SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS);
|
||||
return (SDL_GetWindowFlags(sdl->g_win) & flags) == flags;
|
||||
|
@ -294,6 +294,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
if (settings->ui.menubar_enable)
|
||||
{
|
||||
LRESULT ret = win32_menu_loop(g_hwnd, wparam);
|
||||
(void)ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -388,10 +388,10 @@ static EGLint *xegl_fill_attribs(EGLint *attr)
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
unsigned version = g_major * 1000 + g_minor;
|
||||
bool core = version >= 3001;
|
||||
bool debug = hw_render->debug_context;
|
||||
|
||||
#ifdef GL_DEBUG
|
||||
debug = true;
|
||||
bool debug = true;
|
||||
#else
|
||||
bool debug = hw_render->debug_context;
|
||||
#endif
|
||||
|
||||
if (core)
|
||||
@ -472,7 +472,6 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
|
||||
windowed_full = settings->video.windowed_fullscreen;
|
||||
true_full = false;
|
||||
|
||||
attr = egl_attribs;
|
||||
attr = xegl_fill_attribs(attr);
|
||||
|
@ -369,7 +369,9 @@ static void xdk360_draw_text(xdk360_video_font_t *font,
|
||||
while (*strText)
|
||||
{
|
||||
float fOffset, fAdvance, fWidth, fHeight;
|
||||
#ifdef MSB_FIRST
|
||||
uint32_t tu1, tu2, tv1, tv2;
|
||||
#endif
|
||||
const GLYPH_ATTR *pGlyph;
|
||||
wchar_t letter = *strText++; /* Get the current letter in the string */
|
||||
|
||||
@ -396,11 +398,13 @@ static void xdk360_draw_text(xdk360_video_font_t *font,
|
||||
|
||||
/* Add the vertices to draw this glyph. */
|
||||
|
||||
#ifdef MSB_FIRST
|
||||
/* Convert shorts to 32 bit longs for in register merging */
|
||||
tu1 = pGlyph->tu1;
|
||||
tv1 = pGlyph->tv1;
|
||||
tu2 = pGlyph->tu2;
|
||||
tv2 = pGlyph->tv2;
|
||||
#endif
|
||||
|
||||
/* NOTE: The vertexes are 2 floats for the screen coordinates,
|
||||
* followed by two USHORTS for the u/vs of the character,
|
||||
|
@ -410,7 +410,6 @@ static const gfx_ctx_driver_t *gfx_ctx_find_driver(void *data,
|
||||
enum gfx_ctx_api api, unsigned major,
|
||||
unsigned minor, bool hw_render_ctx)
|
||||
{
|
||||
const gfx_ctx_driver_t *ctx = NULL;
|
||||
int i = find_gfx_ctx_driver_index(ident);
|
||||
|
||||
if (i >= 0)
|
||||
@ -419,8 +418,10 @@ static const gfx_ctx_driver_t *gfx_ctx_find_driver(void *data,
|
||||
|
||||
for (i = 0; gfx_ctx_drivers[i]; i++)
|
||||
{
|
||||
ctx = gfx_ctx_init(data, gfx_ctx_drivers[i], ident,
|
||||
const gfx_ctx_driver_t *ctx =
|
||||
gfx_ctx_init(data, gfx_ctx_drivers[i], ident,
|
||||
api, major, minor, hw_render_ctx);
|
||||
|
||||
if (ctx)
|
||||
return ctx;
|
||||
}
|
||||
|
@ -126,9 +126,9 @@ static void thread_update_driver_state(thread_video_t *thr)
|
||||
/* returns true when thread_loop should quit */
|
||||
static bool thread_handle_packet(thread_video_t *thr, const thread_packet_t *incoming)
|
||||
{
|
||||
unsigned i;
|
||||
thread_packet_t pkt = *incoming;
|
||||
bool ret = false;
|
||||
unsigned i = 0;
|
||||
bool ret = false;
|
||||
|
||||
switch (pkt.type)
|
||||
{
|
||||
@ -363,7 +363,6 @@ static void thread_loop(void *data)
|
||||
for (;;)
|
||||
{
|
||||
thread_packet_t pkt;
|
||||
bool ret = false;
|
||||
bool updated = false;
|
||||
|
||||
slock_lock(thr->lock);
|
||||
@ -383,10 +382,10 @@ static void thread_loop(void *data)
|
||||
|
||||
if (updated)
|
||||
{
|
||||
ret = false;
|
||||
bool alive = false;
|
||||
bool focus = false;
|
||||
bool has_windowed = true;
|
||||
bool ret = false;
|
||||
bool alive = false;
|
||||
bool focus = false;
|
||||
bool has_windowed = true;
|
||||
struct video_viewport vp = {0};
|
||||
|
||||
slock_lock(thr->frame.lock);
|
||||
@ -414,11 +413,11 @@ static void thread_loop(void *data)
|
||||
thr->driver->viewport_info(thr->driver_data, &vp);
|
||||
|
||||
slock_lock(thr->lock);
|
||||
thr->alive = alive;
|
||||
thr->focus = focus;
|
||||
thr->has_windowed = has_windowed;
|
||||
thr->alive = alive;
|
||||
thr->focus = focus;
|
||||
thr->has_windowed = has_windowed;
|
||||
thr->frame.updated = false;
|
||||
thr->vp = vp;
|
||||
thr->vp = vp;
|
||||
scond_signal(thr->cond_cmd);
|
||||
slock_unlock(thr->lock);
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ static uint64_t iohidmanager_hid_joypad_get_buttons(void *data, unsigned port)
|
||||
|
||||
static bool iohidmanager_hid_joypad_button(void *data, unsigned port, uint16_t joykey)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
|
||||
#endif
|
||||
uint64_t buttons = iohidmanager_hid_joypad_get_buttons(data, port);
|
||||
@ -98,8 +98,8 @@ static bool iohidmanager_hid_joypad_rumble(void *data, unsigned pad,
|
||||
|
||||
static int16_t iohidmanager_hid_joypad_axis(void *data, unsigned port, uint32_t joyaxis)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
|
||||
#endif
|
||||
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)data;
|
||||
@ -166,8 +166,8 @@ static void iohidmanager_hid_device_report(void *data,
|
||||
static void iohidmanager_hid_device_input_callback(void *data, IOReturn result,
|
||||
void* sender, IOHIDValueRef value)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
|
||||
#endif
|
||||
struct iohidmanager_hid_adapter *adapter = (struct iohidmanager_hid_adapter*)data;
|
||||
@ -204,7 +204,9 @@ static void iohidmanager_hid_device_input_callback(void *data, IOReturn result,
|
||||
CFIndex min = IOHIDElementGetPhysicalMin(element);
|
||||
CFIndex max = IOHIDElementGetPhysicalMax(element) - min;
|
||||
CFIndex state = IOHIDValueGetIntegerValue(value) - min;
|
||||
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
|
||||
float val = (float)state / (float)max;
|
||||
#endif
|
||||
|
||||
if (use != axis_use_ids[i])
|
||||
continue;
|
||||
@ -225,8 +227,10 @@ static void iohidmanager_hid_device_input_callback(void *data, IOReturn result,
|
||||
{
|
||||
case kIOHIDElementTypeInput_Button:
|
||||
{
|
||||
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
|
||||
CFIndex state = IOHIDValueGetIntegerValue(value);
|
||||
unsigned id = use - 1;
|
||||
#endif
|
||||
unsigned id = use - 1;
|
||||
|
||||
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
|
||||
if (state)
|
||||
|
@ -69,13 +69,8 @@ static void adapter_thread(void *data)
|
||||
while (!adapter->quitting)
|
||||
{
|
||||
size_t send_command_size;
|
||||
int tmp;
|
||||
int report_number;
|
||||
int size = 0;
|
||||
|
||||
(void)tmp;
|
||||
(void)report_number;
|
||||
|
||||
slock_lock(adapter->send_control_lock);
|
||||
|
||||
if (fifo_read_avail(adapter->send_control_buffer) >= sizeof(send_command_size))
|
||||
|
@ -197,7 +197,9 @@ static const char *dinput_joypad_friendly_name(unsigned pad)
|
||||
|
||||
static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
{
|
||||
#ifdef HAVE_XINPUT
|
||||
bool is_xinput_pad;
|
||||
#endif
|
||||
LPDIRECTINPUTDEVICE8 *pad = NULL;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -235,10 +237,6 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
RARCH_LOG("Device #%u PID: {%04lX} VID:{%04lX}\n", g_joypad_cnt, g_pads[g_joypad_cnt].pid, g_pads[g_joypad_cnt].vid);
|
||||
|
||||
#ifdef HAVE_XINPUT
|
||||
#if 0
|
||||
is_xinput_pad = g_xinput_block_pads
|
||||
&& name_is_xinput_pad(inst->tszProductName);
|
||||
#endif
|
||||
is_xinput_pad = g_xinput_block_pads
|
||||
&& guid_is_xinput_device(&inst->guidProduct);
|
||||
|
||||
@ -278,7 +276,9 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
settings->input.vid[g_joypad_cnt] = params.vid;
|
||||
}
|
||||
|
||||
#ifdef HAVE_XINPUT
|
||||
enum_iteration_done:
|
||||
#endif
|
||||
g_joypad_cnt++;
|
||||
return DIENUM_CONTINUE;
|
||||
}
|
||||
|
@ -84,7 +84,6 @@ void x11_handle_key_event(XEvent *event, XIC ic, bool filter)
|
||||
int i;
|
||||
unsigned state, key;
|
||||
uint16_t mod = 0;
|
||||
char keybuf[32] = {0};
|
||||
uint32_t chars[32] = {0};
|
||||
|
||||
bool down = event->type == KeyPress;
|
||||
@ -93,6 +92,7 @@ void x11_handle_key_event(XEvent *event, XIC ic, bool filter)
|
||||
|
||||
if (down && !filter)
|
||||
{
|
||||
char keybuf[32] = {0};
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
Status status = 0;
|
||||
|
||||
|
@ -185,20 +185,22 @@ static bool input_autoconfigure_joypad_from_conf_dir(
|
||||
autoconfig_params_t *params)
|
||||
{
|
||||
size_t i;
|
||||
int ret = 0;
|
||||
int index = -1;
|
||||
int current_best = 0;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
int ret = 0;
|
||||
int index = -1;
|
||||
int current_best = 0;
|
||||
config_file_t *conf = NULL;
|
||||
struct string_list *list = NULL;
|
||||
char path[PATH_MAX_LENGTH] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
fill_pathname_join(path,settings->input.autoconfig_dir,
|
||||
if (!settings)
|
||||
return false;
|
||||
|
||||
fill_pathname_join(path,
|
||||
settings->input.autoconfig_dir,
|
||||
settings->input.joypad_driver,
|
||||
sizeof(path));
|
||||
|
||||
if (settings)
|
||||
list = dir_list_new(path, "cfg", false, false);
|
||||
list = dir_list_new(path, "cfg", false, false);
|
||||
|
||||
if (!list || !list->size)
|
||||
list = dir_list_new(settings->input.autoconfig_dir, "cfg", false, false);
|
||||
|
@ -61,8 +61,13 @@ bool input_remapping_load_file(const char *path)
|
||||
{
|
||||
int key_remap = -1;
|
||||
|
||||
snprintf(key_ident[RARCH_FIRST_CUSTOM_BIND + j], sizeof(key_ident[RARCH_FIRST_CUSTOM_BIND + j]), "%s_%s", buf, key_strings[RARCH_FIRST_CUSTOM_BIND + j]);
|
||||
if (config_get_int(conf, key_ident[RARCH_FIRST_CUSTOM_BIND + j], &key_remap) && key_remap < 4)
|
||||
snprintf(key_ident[RARCH_FIRST_CUSTOM_BIND + j],
|
||||
sizeof(key_ident[RARCH_FIRST_CUSTOM_BIND + j]),
|
||||
"%s_%s",
|
||||
buf,
|
||||
key_strings[RARCH_FIRST_CUSTOM_BIND + j]);
|
||||
|
||||
if (config_get_int(conf, key_ident[RARCH_FIRST_CUSTOM_BIND + j], &key_remap) && (key_remap < 4))
|
||||
settings->input.remap_ids[i][RARCH_FIRST_CUSTOM_BIND + j] = key_remap;
|
||||
}
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ static int menu_displaylist_parse_debug_info(menu_displaylist_info_t *info)
|
||||
static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
|
||||
{
|
||||
int controller;
|
||||
char tmp[PATH_MAX_LENGTH], tmp2[PATH_MAX_LENGTH], feat_str[PATH_MAX_LENGTH];
|
||||
char tmp[PATH_MAX_LENGTH], feat_str[PATH_MAX_LENGTH];
|
||||
const char *tmp_string = NULL;
|
||||
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -500,6 +500,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
|
||||
|
||||
if (frontend)
|
||||
{
|
||||
char tmp2[PATH_MAX_LENGTH];
|
||||
int major = 0, minor = 0;
|
||||
|
||||
strlcpy(tmp, menu_hash_to_str(MENU_LABEL_VALUE_SYSTEM_INFO_FRONTEND_IDENTIFIER), sizeof(tmp));
|
||||
@ -1550,17 +1551,14 @@ static void menu_displaylist_realloc_settings(menu_entries_t *entries, unsigned
|
||||
|
||||
static int menu_setting_set_flags(rarch_setting_t *setting)
|
||||
{
|
||||
enum setting_type setting_type;
|
||||
uint64_t flags = menu_setting_get_flags(setting);
|
||||
uint64_t flags = menu_setting_get_flags(setting);
|
||||
if (!setting)
|
||||
return 0;
|
||||
|
||||
if (flags & SD_FLAG_IS_DRIVER)
|
||||
return MENU_SETTING_DRIVER;
|
||||
|
||||
setting_type = menu_setting_get_type(setting);
|
||||
|
||||
switch (setting_type)
|
||||
switch (menu_setting_get_type(setting))
|
||||
{
|
||||
case ST_ACTION:
|
||||
return MENU_SETTING_ACTION;
|
||||
@ -1631,7 +1629,6 @@ static int menu_displaylist_parse_settings_in_subgroup(menu_displaylist_info_t *
|
||||
{
|
||||
char elem0[PATH_MAX_LENGTH] = {0};
|
||||
char elem1[PATH_MAX_LENGTH] = {0};
|
||||
struct string_list *str_list = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
@ -1639,15 +1636,15 @@ static int menu_displaylist_parse_settings_in_subgroup(menu_displaylist_info_t *
|
||||
|
||||
if (info->label[0] != '\0')
|
||||
{
|
||||
str_list = string_split(info->label, "|");
|
||||
|
||||
if (str_list && str_list->size > 0)
|
||||
strlcpy(elem0, str_list->elems[0].data, sizeof(elem0));
|
||||
if (str_list && str_list->size > 1)
|
||||
strlcpy(elem1, str_list->elems[1].data, sizeof(elem1));
|
||||
struct string_list *str_list = string_split(info->label, "|");
|
||||
|
||||
if (str_list)
|
||||
{
|
||||
if (str_list->size > 0)
|
||||
strlcpy(elem0, str_list->elems[0].data, sizeof(elem0));
|
||||
if (str_list->size > 1)
|
||||
strlcpy(elem1, str_list->elems[1].data, sizeof(elem1));
|
||||
|
||||
string_list_free(str_list);
|
||||
str_list = NULL;
|
||||
}
|
||||
@ -2542,18 +2539,18 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
{
|
||||
for (; menu_setting_get_type(setting) != ST_NONE; setting++)
|
||||
{
|
||||
char group_label[PATH_MAX_LENGTH], subgroup_label[PATH_MAX_LENGTH];
|
||||
enum setting_type setting_type = menu_setting_get_type(setting);
|
||||
char group_label[PATH_MAX_LENGTH];
|
||||
const char *short_description = menu_setting_get_short_description(setting);
|
||||
const char *name = menu_setting_get_name(setting);
|
||||
|
||||
switch (setting_type)
|
||||
switch (menu_setting_get_type(setting))
|
||||
{
|
||||
case ST_GROUP:
|
||||
strlcpy(group_label, name, sizeof(group_label));
|
||||
break;
|
||||
case ST_SUB_GROUP:
|
||||
{
|
||||
char subgroup_label[PATH_MAX_LENGTH];
|
||||
char new_label[PATH_MAX_LENGTH], new_path[PATH_MAX_LENGTH];
|
||||
|
||||
strlcpy(subgroup_label, name, sizeof(group_label));
|
||||
|
@ -194,16 +194,14 @@ int menu_action_handle_setting(rarch_setting_t *setting,
|
||||
unsigned type, unsigned action, bool wraparound)
|
||||
{
|
||||
const char *name;
|
||||
enum setting_type setting_type;
|
||||
menu_displaylist_info_t info = {0};
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
setting_type = menu_setting_get_type(setting);
|
||||
name = menu_setting_get_name(setting);
|
||||
|
||||
switch (setting_type)
|
||||
switch (menu_setting_get_type(setting))
|
||||
{
|
||||
case ST_PATH:
|
||||
if (action == MENU_ACTION_OK)
|
||||
@ -379,13 +377,10 @@ int menu_setting_set(unsigned type, const char *label,
|
||||
**/
|
||||
static void setting_reset_setting(rarch_setting_t* setting)
|
||||
{
|
||||
enum setting_type setting_type;
|
||||
if (!setting)
|
||||
return;
|
||||
|
||||
setting_type = menu_setting_get_type(setting);
|
||||
|
||||
switch (setting_type)
|
||||
switch (menu_setting_get_type(setting))
|
||||
{
|
||||
case ST_BOOL:
|
||||
*setting->value.boolean = setting->default_value.boolean;
|
||||
@ -448,16 +443,14 @@ int setting_set_with_string_representation(rarch_setting_t* setting,
|
||||
const char* value)
|
||||
{
|
||||
double min, max;
|
||||
enum setting_type setting_type;
|
||||
uint64_t flags = menu_setting_get_flags(setting);
|
||||
if (!setting || !value)
|
||||
return -1;
|
||||
|
||||
setting_type = menu_setting_get_type(setting);
|
||||
min = menu_setting_get_min(setting);
|
||||
max = menu_setting_get_max(setting);
|
||||
|
||||
switch (setting_type)
|
||||
switch (menu_setting_get_type(setting))
|
||||
{
|
||||
case ST_INT:
|
||||
sscanf(value, "%d", setting->value.integer);
|
||||
@ -1365,7 +1358,6 @@ static int setting_action_ok_video_refresh_rate_auto(void *data, bool wraparound
|
||||
|
||||
static int setting_generic_action_ok_linefeed(void *data, bool wraparound)
|
||||
{
|
||||
enum setting_type setting_type;
|
||||
input_keyboard_line_complete_t cb = NULL;
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
const char *short_description = menu_setting_get_short_description(setting);
|
||||
@ -1374,9 +1366,8 @@ static int setting_generic_action_ok_linefeed(void *data, bool wraparound)
|
||||
return -1;
|
||||
|
||||
(void)wraparound;
|
||||
setting_type = menu_setting_get_type(setting);
|
||||
|
||||
switch (setting_type)
|
||||
switch (menu_setting_get_type(setting))
|
||||
{
|
||||
case ST_UINT:
|
||||
cb = menu_input_st_uint_callback;
|
||||
|
Loading…
x
Reference in New Issue
Block a user