diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 753d6a59ca..1a4ee5d64c 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -2969,6 +2969,7 @@ static uintptr_t gl_get_current_framebuffer(void *data) gl_t *gl = (gl_t*)data; return gl->hw_render_fbo[(gl->tex_index + 1) % gl->textures]; } +#endif static retro_proc_address_t gl_get_proc_address(void *data, const char *sym) { @@ -2976,7 +2977,6 @@ static retro_proc_address_t gl_get_proc_address(void *data, const char *sym) return gl->ctx_driver->get_proc_address(sym); } -#endif static void gl_set_aspect_ratio(void *data, unsigned aspect_ratio_idx) { diff --git a/gfx/drivers/xvideo.c b/gfx/drivers/xvideo.c index 3b26a56e1a..4d5e9dbc03 100644 --- a/gfx/drivers/xvideo.c +++ b/gfx/drivers/xvideo.c @@ -90,7 +90,7 @@ static void xv_set_nonblock_state(void *data, bool state) } static volatile sig_atomic_t g_quit = 0; -static void sighandler(int sig) +static void xvideo_sighandler(int sig) { g_quit = 1; } @@ -548,7 +548,7 @@ static void *xv_init(const video_info_t *video, if (xv->quit_atom) XSetWMProtocols(xv->display, xv->window, &xv->quit_atom, 1); - sa.sa_handler = sighandler; + sa.sa_handler = xvideo_sighandler; sa.sa_flags = SA_RESTART; sigemptyset(&sa.sa_mask); sigaction(SIGINT, &sa, NULL); diff --git a/gfx/drivers_context/glx_ctx.c b/gfx/drivers_context/glx_ctx.c index 5317d167b1..967d67652c 100644 --- a/gfx/drivers_context/glx_ctx.c +++ b/gfx/drivers_context/glx_ctx.c @@ -64,7 +64,7 @@ static unsigned g_minor; static PFNGLXCREATECONTEXTATTRIBSARBPROC glx_create_context_attribs; -static void sighandler(int sig) +static void glx_sighandler(int sig) { (void)sig; g_quit = 1; @@ -82,7 +82,7 @@ static Bool glx_wait_notify(Display *d, XEvent *e, char *arg) return (e->type == MapNotify) && (e->xmap.window == glx->g_win); } -static int nul_handler(Display *dpy, XErrorEvent *event) +static int glx_nul_handler(Display *dpy, XErrorEvent *event) { (void)dpy; (void)event; @@ -401,7 +401,7 @@ static bool gfx_ctx_glx_set_video_mode(void *data, gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver.video_context_data; struct sigaction sa = {{0}}; - sa.sa_handler = sighandler; + sa.sa_handler = glx_sighandler; sa.sa_flags = SA_RESTART; sigemptyset(&sa.sa_mask); sigaction(SIGINT, &sa, NULL); @@ -595,7 +595,7 @@ static bool gfx_ctx_glx_set_video_mode(void *data, gfx_ctx_glx_swap_interval(data, glx->g_interval); /* This can blow up on some drivers. It's not fatal, so override errors for this call. */ - old_handler = XSetErrorHandler(nul_handler); + old_handler = XSetErrorHandler(glx_nul_handler); XSetInputFocus(glx->g_dpy, glx->g_win, RevertToNone, CurrentTime); XSync(glx->g_dpy, False); XSetErrorHandler(old_handler); diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index a476fe58c6..885abf35a3 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -62,7 +62,7 @@ static enum gfx_ctx_api g_api; static unsigned g_major; static unsigned g_minor; -static void sighandler(int sig) +static void egl_sighandler(int sig) { (void)sig; g_quit = 1; @@ -75,7 +75,7 @@ static Bool egl_wait_notify(Display *d, XEvent *e, char *arg) return e->type == MapNotify && e->xmap.window == g_win; } -static int nul_handler(Display *dpy, XErrorEvent *event) +static int egl_nul_handler(Display *dpy, XErrorEvent *event) { (void)dpy; (void)event; @@ -365,7 +365,7 @@ error: return false; } -static EGLint *egl_fill_attribs(EGLint *attr) +static EGLint *xegl_fill_attribs(EGLint *attr) { switch (g_api) { @@ -445,7 +445,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data, XSetWindowAttributes swa = {0}; XVisualInfo *vi = NULL; - sa.sa_handler = sighandler; + sa.sa_handler = egl_sighandler; sa.sa_flags = SA_RESTART; sigemptyset(&sa.sa_mask); sigaction(SIGINT, &sa, NULL); @@ -457,7 +457,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data, int (*old_handler)(Display*, XErrorEvent*) = NULL; attr = egl_attribs; - attr = egl_fill_attribs(attr); + attr = xegl_fill_attribs(attr); if (!eglGetConfigAttrib(g_egl_dpy, g_config, EGL_NATIVE_VISUAL_ID, &vid)) goto error; @@ -592,7 +592,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data, /* This can blow up on some drivers. It's not fatal, * so override errors for this call. */ - old_handler = XSetErrorHandler(nul_handler); + old_handler = XSetErrorHandler(egl_nul_handler); XSetInputFocus(g_dpy, g_win, RevertToNone, CurrentTime); XSync(g_dpy, False); XSetErrorHandler(old_handler); diff --git a/gfx/drivers_font_renderer/bitmapfont.c b/gfx/drivers_font_renderer/bitmapfont.c index 0ddec545b7..02ff13b9a1 100644 --- a/gfx/drivers_font_renderer/bitmapfont.c +++ b/gfx/drivers_font_renderer/bitmapfont.c @@ -21,14 +21,14 @@ #include #include -#define ATLAS_COLS 16 -#define ATLAS_ROWS 16 -#define ATLAS_SIZE (ATLAS_COLS * ATLAS_ROWS) +#define BMP_ATLAS_COLS 16 +#define BMP_ATLAS_ROWS 16 +#define BMP_ATLAS_SIZE (BMP_ATLAS_COLS * BMP_ATLAS_ROWS) typedef struct bm_renderer { unsigned scale_factor; - struct font_glyph glyphs[ATLAS_SIZE]; + struct font_glyph glyphs[BMP_ATLAS_SIZE]; struct font_atlas atlas; } bm_renderer_t; @@ -46,7 +46,7 @@ static const struct font_glyph *font_renderer_bmp_get_glyph( bm_renderer_t *handle = (bm_renderer_t*)data; if (!handle) return NULL; - return code < ATLAS_SIZE ? &handle->glyphs[code] : NULL; + return code < BMP_ATLAS_SIZE ? &handle->glyphs[code] : NULL; } static void char_to_texture(bm_renderer_t *handle, uint8_t letter, @@ -90,14 +90,14 @@ static void *font_renderer_bmp_init(const char *font_path, float font_size) if (!handle->scale_factor) handle->scale_factor = 1; - handle->atlas.width = FONT_WIDTH * handle->scale_factor * ATLAS_COLS; - handle->atlas.height = FONT_HEIGHT * handle->scale_factor * ATLAS_ROWS; + handle->atlas.width = FONT_WIDTH * handle->scale_factor * BMP_ATLAS_COLS; + handle->atlas.height = FONT_HEIGHT * handle->scale_factor * BMP_ATLAS_ROWS; handle->atlas.buffer = (uint8_t*)calloc(handle->atlas.width * handle->atlas.height, 1); - for (i = 0; i < ATLAS_SIZE; i++) + for (i = 0; i < BMP_ATLAS_SIZE; i++) { - unsigned x = (i % ATLAS_COLS) * handle->scale_factor * FONT_WIDTH; - unsigned y = (i / ATLAS_COLS) * handle->scale_factor * FONT_HEIGHT; + unsigned x = (i % BMP_ATLAS_COLS) * handle->scale_factor * FONT_WIDTH; + unsigned y = (i / BMP_ATLAS_COLS) * handle->scale_factor * FONT_HEIGHT; char_to_texture(handle, i, x, y); diff --git a/gfx/drivers_font_renderer/freetype.c b/gfx/drivers_font_renderer/freetype.c index 30e1a192bb..e134256ceb 100644 --- a/gfx/drivers_font_renderer/freetype.c +++ b/gfx/drivers_font_renderer/freetype.c @@ -24,9 +24,9 @@ #include #include FT_FREETYPE_H -#define ATLAS_ROWS 8 -#define ATLAS_COLS 16 -#define ATLAS_SIZE (ATLAS_ROWS * ATLAS_COLS) +#define FT_ATLAS_ROWS 8 +#define FT_ATLAS_COLS 16 +#define FT_ATLAS_SIZE (FT_ATLAS_ROWS * FT_ATLAS_COLS) typedef struct freetype_renderer { @@ -34,7 +34,7 @@ typedef struct freetype_renderer FT_Face face; struct font_atlas atlas; - struct font_glyph glyphs[ATLAS_SIZE]; + struct font_glyph glyphs[FT_ATLAS_SIZE]; } font_renderer_t; static const struct font_atlas *font_renderer_ft_get_atlas(void *data) @@ -51,7 +51,7 @@ static const struct font_glyph *font_renderer_ft_get_glyph( font_renderer_t *handle = (font_renderer_t*)data; if (!handle) return NULL; - return code < ATLAS_SIZE ? &handle->glyphs[code] : NULL; + return code < FT_ATLAS_SIZE ? &handle->glyphs[code] : NULL; } static void font_renderer_ft_free(void *data) @@ -74,13 +74,13 @@ static bool font_renderer_create_atlas(font_renderer_t *handle) unsigned i; bool ret = true; - uint8_t *buffer[ATLAS_SIZE] = {NULL}; - unsigned pitches[ATLAS_SIZE] = {0}; + uint8_t *buffer[FT_ATLAS_SIZE] = {NULL}; + unsigned pitches[FT_ATLAS_SIZE] = {0}; unsigned max_width = 0; unsigned max_height = 0; - for (i = 0; i < ATLAS_SIZE; i++) + for (i = 0; i < FT_ATLAS_SIZE; i++) { struct font_glyph *glyph = &handle->glyphs[i]; @@ -115,8 +115,8 @@ static bool font_renderer_create_atlas(font_renderer_t *handle) max_height = max(max_height, (unsigned)slot->bitmap.rows); } - handle->atlas.width = max_width * ATLAS_COLS; - handle->atlas.height = max_height * ATLAS_ROWS; + handle->atlas.width = max_width * FT_ATLAS_COLS; + handle->atlas.height = max_height * FT_ATLAS_ROWS; handle->atlas.buffer = (uint8_t*) calloc(handle->atlas.width * handle->atlas.height, 1); @@ -128,12 +128,12 @@ static bool font_renderer_create_atlas(font_renderer_t *handle) } /* Blit our texture atlas. */ - for (i = 0; i < ATLAS_SIZE; i++) + for (i = 0; i < FT_ATLAS_SIZE; i++) { unsigned r, c; uint8_t *dst = NULL; - unsigned offset_x = (i % ATLAS_COLS) * max_width; - unsigned offset_y = (i / ATLAS_COLS) * max_height; + unsigned offset_x = (i % FT_ATLAS_COLS) * max_width; + unsigned offset_y = (i / FT_ATLAS_COLS) * max_height; handle->glyphs[i].atlas_offset_x = offset_x; handle->glyphs[i].atlas_offset_y = offset_y; @@ -153,7 +153,7 @@ static bool font_renderer_create_atlas(font_renderer_t *handle) } end: - for (i = 0; i < ATLAS_SIZE; i++) + for (i = 0; i < FT_ATLAS_SIZE; i++) free(buffer[i]); return ret; } diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index f640b84d65..79fd52404a 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -249,7 +249,7 @@ static void udev_handle_mouse(udev_input_t *udev, } } -static bool hotplug_available(udev_input_t *udev) +static bool udev_input_hotplug_available(udev_input_t *udev) { struct pollfd fds = {0}; @@ -325,7 +325,7 @@ static bool add_device(udev_input_t *udev, return true; } -static void remove_device(udev_input_t *udev, const char *devnode) +static void udev_input_remove_device(udev_input_t *udev, const char *devnode) { unsigned i; @@ -342,7 +342,7 @@ static void remove_device(udev_input_t *udev, const char *devnode) } } -static void handle_hotplug(udev_input_t *udev) +static void udev_input_handle_hotplug(udev_input_t *udev) { bool is_keyboard, is_mouse, is_touchpad; struct udev_device *dev = udev_monitor_receive_device(udev->monitor); @@ -394,7 +394,7 @@ static void handle_hotplug(udev_input_t *udev) else if (!strcmp(action, "remove")) { RARCH_LOG("[udev]: Hotplug remove %s: %s.\n", devtype, devnode); - remove_device(udev, devnode); + udev_input_remove_device(udev, devnode); } end: @@ -409,8 +409,8 @@ static void udev_input_poll(void *data) udev->mouse_x = udev->mouse_y = 0; - while (hotplug_available(udev)) - handle_hotplug(udev); + while (udev_input_hotplug_available(udev)) + udev_input_handle_hotplug(udev); ret = epoll_wait(udev->epfd, events, ARRAY_SIZE(events), 0); diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index ebb30df956..0eed07ca11 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -159,9 +159,9 @@ static bool hotplug_available(void) } static void check_device(struct udev_device *dev, const char *path, bool hotplugged); -static void remove_device(const char *path); +static void udev_joypad_remove_device(const char *path); -static void handle_hotplug(void) +static void udev_joypad_handle_hotplug(void) { struct udev_device *dev = udev_monitor_receive_device(g_udev_mon); if (!dev) @@ -182,7 +182,7 @@ static void handle_hotplug(void) else if (!strcmp(action, "remove")) { RARCH_LOG("[udev]: Hotplug remove: %s.\n", devnode); - remove_device(devnode); + udev_joypad_remove_device(devnode); } end: @@ -264,7 +264,7 @@ static void udev_joypad_poll(void) { unsigned i; while (hotplug_available()) - handle_hotplug(); + udev_joypad_handle_hotplug(); for (i = 0; i < MAX_USERS; i++) udev_poll_pad(&udev_pads[i], i); @@ -471,7 +471,7 @@ static void check_device(struct udev_device *dev, const char *path, bool hotplug } } -static void remove_device(const char *path) +static void udev_joypad_remove_device(const char *path) { unsigned i; diff --git a/libretro-common/include/file/nbio.h b/libretro-common/include/file/nbio.h index 910deaae3d..589a893707 100644 --- a/libretro-common/include/file/nbio.h +++ b/libretro-common/include/file/nbio.h @@ -1,5 +1,27 @@ -#ifndef _NBIO_STDIO_H -#define _NBIO_STDIO_H +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (dir_list.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_NBIO_H +#define __LIBRETRO_SDK_NBIO_H #include #include