static int gamepad_load_mappings(const char *vpath, int warn_noexist) { char *repr = vfs_repr(vpath, true); char *errstr = NULL; const char *const_errstr = NULL; SDL_RWops *mappings = vfs_open(vpath, VFS_MODE_READ | VFS_MODE_SEEKABLE); int num_loaded = -1; LogLevel loglvl = LOG_WARN; if(!mappings) { if(!warn_noexist) { VFSInfo vinfo = vfs_query(vpath); if(!vinfo.error && !vinfo.exists && !vinfo.is_dir) { loglvl = LOG_INFO; const_errstr = errstr = strfmt("Custom mappings file '%s' does not exist (this is ok)", repr); goto cleanup; } } const_errstr = vfs_get_error(); goto cleanup; } if((num_loaded = SDL_GameControllerAddMappingsFromRW(mappings, true)) < 0) { const_errstr = SDL_GetError(); } cleanup: if(const_errstr) { log_custom(loglvl, "Couldn't load mappings: %s", const_errstr); } else if(num_loaded >= 0) { log_info("Loaded %i mappings from '%s'", num_loaded, repr); } free(repr); free(errstr); return num_loaded; }
static void APIENTRY video_gl_debug( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *arg ) { char *strtype = "unknown"; char *strsev = "unknown"; LogLevel lvl = LOG_DEBUG; switch(type) { case GL_DEBUG_TYPE_ERROR: strtype = "error"; lvl = LOG_FATAL; break; case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: strtype = "deprecated"; lvl = LOG_WARN; break; case GL_DEBUG_TYPE_PORTABILITY: strtype = "portability"; break; case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: strtype = "undefined"; break; case GL_DEBUG_TYPE_PERFORMANCE: strtype = "performance"; break; case GL_DEBUG_TYPE_OTHER: strtype = "other"; break; } switch(severity) { case GL_DEBUG_SEVERITY_LOW: strsev = "low"; break; case GL_DEBUG_SEVERITY_MEDIUM: strsev = "medium"; break; case GL_DEBUG_SEVERITY_HIGH: strsev = "high"; break; case GL_DEBUG_SEVERITY_NOTIFICATION: strsev = "notify"; break; } if(type == GL_DEBUG_TYPE_OTHER && severity == GL_DEBUG_SEVERITY_NOTIFICATION) { // too verbose, spits a message every time some text is drawn return; } log_custom(lvl, "[OpenGL debug, %s, %s] %i: %s", strtype, strsev, id, message); }