diff --git a/audio/audio_mixer.c b/audio/audio_mixer.c index 685e4f8716..a0e49f40f8 100644 --- a/audio/audio_mixer.c +++ b/audio/audio_mixer.c @@ -673,7 +673,8 @@ static bool audio_mixer_play_flac( if (!flac_buffer) { - resamp->free(resampler_data); + if (resamp && resamp->free) + resamp->free(resampler_data); goto error; } diff --git a/file/file_path.c b/file/file_path.c index 75bc3bdfb0..2d7b2e23ec 100644 --- a/file/file_path.c +++ b/file/file_path.c @@ -378,13 +378,15 @@ const char *path_get_extension(const char *path) * path_remove_extension: * @path : path * - * Removes the extension from the path and returns the result. - * Removes all text after and including the last '.'. + * Mutates path by removing its extension. Removes all + * text after and including the last '.'. * Only '.'s after the last slash are considered. * - * Returns: path with the extension part removed. - * If there is no extension at the end of path, - * returns a pointer to the unaltered original path. + * Returns: + * 1) If path has an extension, returns path with the + * extension removed. + * 2) If there is no extension, returns NULL. + * 3) If path is empty or NULL, returns NULL */ char *path_remove_extension(char *path) { diff --git a/gfx/gl_capabilities.c b/gfx/gl_capabilities.c index d7ec069e4b..8eea056584 100644 --- a/gfx/gl_capabilities.c +++ b/gfx/gl_capabilities.c @@ -311,7 +311,7 @@ bool gl_check_capability(enum gl_capability_enum enum_idx) if (major >= 3) return true; #else - if (strstr(vendor, "ATI Technologies")) + if (vendor && strstr(vendor, "ATI Technologies")) return false; if (gl_query_extension("ARB_texture_storage")) return true; diff --git a/glsm/glsm.c b/glsm/glsm.c index 85a7ced78a..6d32f224e4 100644 --- a/glsm/glsm.c +++ b/glsm/glsm.c @@ -163,7 +163,7 @@ struct gl_cached_state GLenum mode; } frontface; - struct + struct { bool used; GLenum mode; @@ -189,14 +189,14 @@ struct gl_cached_state GLuint vao; GLuint framebuf; GLuint array_buffer; - GLuint program; + GLuint program; GLenum active_texture; int cap_state[SGL_CAP_MAX]; int cap_translate[SGL_CAP_MAX]; }; static GLint glsm_max_textures; -static struct retro_hw_render_callback hw_render; +struct retro_hw_render_callback hw_render; static struct gl_cached_state gl_state; /* GL wrapper-side */ @@ -359,7 +359,7 @@ void rglFrontFace(GLenum mode) glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL); glFrontFace(mode); gl_state.frontface.used = true; - gl_state.frontface.mode = mode; + gl_state.frontface.mode = mode; } /* @@ -520,7 +520,7 @@ void rglBlendFuncSeparate(GLenum sfactor, GLenum dfactor) * Category: Textures * * Core in: - * OpenGL : 1.3 + * OpenGL : 1.3 */ void rglActiveTexture(GLenum texture) { @@ -569,7 +569,7 @@ void rglEnable(GLenum cap) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUseProgram(GLuint program) { @@ -653,7 +653,7 @@ void rglLinkProgram(GLuint program) * Category: FBO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 2.0 */ void rglFramebufferTexture2D(GLenum target, GLenum attachment, @@ -702,7 +702,7 @@ void rglCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) { - glCompressedTexImage2D(target, level, internalformat, + glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); } @@ -720,7 +720,7 @@ void rglDeleteTextures(GLsizei n, const GLuint *textures) /* * * Core in: - * OpenGLES : 2.0 + * OpenGLES : 2.0 */ void rglRenderbufferStorage(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height) @@ -733,7 +733,7 @@ void rglRenderbufferStorage(GLenum target, GLenum internalFormat, * Core in: * * OpenGL : 3.0 - * OpenGLES : 2.0 + * OpenGLES : 2.0 */ void rglBindRenderbuffer(GLenum target, GLuint renderbuffer) { @@ -744,7 +744,7 @@ void rglBindRenderbuffer(GLenum target, GLuint renderbuffer) * * Core in: * - * OpenGLES : 2.0 + * OpenGLES : 2.0 */ void rglDeleteRenderbuffers(GLsizei n, GLuint *renderbuffers) { @@ -756,7 +756,7 @@ void rglDeleteRenderbuffers(GLsizei n, GLuint *renderbuffers) * Core in: * * OpenGL : 3.0 - * OpenGLES : 2.0 + * OpenGLES : 2.0 */ void rglGenRenderbuffers(GLsizei n, GLuint *renderbuffers) { @@ -768,7 +768,7 @@ void rglGenRenderbuffers(GLsizei n, GLuint *renderbuffers) * Core in: * * OpenGL : 3.0 - * OpenGLES : 2.0 + * OpenGLES : 2.0 */ void rglGenerateMipmap(GLenum target) { @@ -779,7 +779,7 @@ void rglGenerateMipmap(GLenum target) * Category: FBO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 */ GLenum rglCheckFramebufferStatus(GLenum target) { @@ -790,7 +790,7 @@ GLenum rglCheckFramebufferStatus(GLenum target) * Category: FBO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 2.0 */ void rglFramebufferRenderbuffer(GLenum target, GLenum attachment, @@ -803,7 +803,7 @@ void rglFramebufferRenderbuffer(GLenum target, GLenum attachment, * Category: Shaders * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 */ void rglBindFragDataLocation(GLuint program, GLuint colorNumber, const char * name) @@ -818,7 +818,7 @@ void rglBindFragDataLocation(GLuint program, GLuint colorNumber, * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglGetProgramiv(GLuint shader, GLenum pname, GLint *params) { @@ -829,7 +829,7 @@ void rglGetProgramiv(GLuint shader, GLenum pname, GLint *params) * Category: Shaders * * Core in: - * OpenGL : 4.1 + * OpenGL : 4.1 * OpenGLES : 3.0 */ void rglProgramParameteri( GLuint program, @@ -846,7 +846,7 @@ void rglProgramParameteri( GLuint program, /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) @@ -859,7 +859,7 @@ void rglGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, * * Core in: * - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglGetActiveUniformBlockiv(GLuint program, @@ -973,7 +973,7 @@ void rglUniformBlockBinding( GLuint program, /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglUniform1ui(GLint location, GLuint v) @@ -986,7 +986,7 @@ void rglUniform1ui(GLint location, GLuint v) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglUniform2ui(GLint location, GLuint v0, GLuint v1) @@ -999,7 +999,7 @@ void rglUniform2ui(GLint location, GLuint v0, GLuint v1) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) @@ -1012,7 +1012,7 @@ void rglUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) @@ -1025,7 +1025,7 @@ void rglUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) @@ -1037,7 +1037,7 @@ void rglUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglDetachShader(GLuint program, GLuint shader) { @@ -1048,7 +1048,7 @@ void rglDetachShader(GLuint program, GLuint shader) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglGetShaderiv(GLuint shader, GLenum pname, GLint *params) { @@ -1059,7 +1059,7 @@ void rglGetShaderiv(GLuint shader, GLenum pname, GLint *params) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglAttachShader(GLuint program, GLuint shader) { @@ -1069,7 +1069,7 @@ void rglAttachShader(GLuint program, GLuint shader) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ GLint rglGetAttribLocation(GLuint program, const GLchar *name) { @@ -1080,7 +1080,7 @@ GLint rglGetAttribLocation(GLuint program, const GLchar *name) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglShaderSource(GLuint shader, GLsizei count, const GLchar **string, const GLint *length) @@ -1092,7 +1092,7 @@ void rglShaderSource(GLuint shader, GLsizei count, * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglCompileShader(GLuint shader) { @@ -1103,7 +1103,7 @@ void rglCompileShader(GLuint shader) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ GLuint rglCreateProgram(void) { @@ -1113,7 +1113,7 @@ GLuint rglCreateProgram(void) /* * * Core in: - * OpenGL : 1.1 + * OpenGL : 1.1 */ void rglGenTextures(GLsizei n, GLuint *textures) { @@ -1123,7 +1123,7 @@ void rglGenTextures(GLsizei n, GLuint *textures) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglGetShaderInfoLog(GLuint shader, GLsizei maxLength, GLsizei *length, GLchar *infoLog) @@ -1134,7 +1134,7 @@ void rglGetShaderInfoLog(GLuint shader, GLsizei maxLength, /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglGetProgramInfoLog(GLuint shader, GLsizei maxLength, GLsizei *length, GLchar *infoLog) @@ -1145,7 +1145,7 @@ void rglGetProgramInfoLog(GLuint shader, GLsizei maxLength, /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ GLboolean rglIsProgram(GLuint program) { @@ -1164,7 +1164,7 @@ void rglTexCoord2f(GLfloat s, GLfloat t) * Category: Generic vertex attributes * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * */ void rglDisableVertexAttribArray(GLuint index) @@ -1177,7 +1177,7 @@ void rglDisableVertexAttribArray(GLuint index) * Category: Generic vertex attributes * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglEnableVertexAttribArray(GLuint index) { @@ -1190,7 +1190,7 @@ void rglEnableVertexAttribArray(GLuint index) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglVertexAttribIPointer( GLuint index, @@ -1220,7 +1220,7 @@ void rglVertexAttribLPointer( * Category: Generic vertex attributes * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglVertexAttribPointer(GLuint name, GLint size, GLenum type, GLboolean normalized, GLsizei stride, @@ -1240,7 +1240,7 @@ void rglVertexAttribPointer(GLuint name, GLint size, * Category: Generic vertex attributes * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglBindAttribLocation(GLuint program, GLuint index, const GLchar *name) { @@ -1250,7 +1250,7 @@ void rglBindAttribLocation(GLuint program, GLuint index, const GLchar *name) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglVertexAttrib4f(GLuint name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) @@ -1261,7 +1261,7 @@ void rglVertexAttrib4f(GLuint name, GLfloat x, GLfloat y, /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglVertexAttrib4fv(GLuint name, GLfloat* v) { @@ -1272,7 +1272,7 @@ void rglVertexAttrib4fv(GLuint name, GLfloat* v) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ GLuint rglCreateShader(GLenum shaderType) { @@ -1283,7 +1283,7 @@ GLuint rglCreateShader(GLenum shaderType) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglDeleteProgram(GLuint program) { @@ -1294,7 +1294,7 @@ void rglDeleteProgram(GLuint program) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglDeleteShader(GLuint shader) { @@ -1305,7 +1305,7 @@ void rglDeleteShader(GLuint shader) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ GLint rglGetUniformLocation(GLuint program, const GLchar *name) { @@ -1316,7 +1316,7 @@ GLint rglGetUniformLocation(GLuint program, const GLchar *name) * Category: VBO and PBO * * Core in: - * OpenGL : 1.5 + * OpenGL : 1.5 */ void rglDeleteBuffers(GLsizei n, const GLuint *buffers) { @@ -1327,7 +1327,7 @@ void rglDeleteBuffers(GLsizei n, const GLuint *buffers) * Category: VBO and PBO * * Core in: - * OpenGL : 1.5 + * OpenGL : 1.5 */ void rglGenBuffers(GLsizei n, GLuint *buffers) { @@ -1338,7 +1338,7 @@ void rglGenBuffers(GLsizei n, GLuint *buffers) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform1f(GLint location, GLfloat v0) { @@ -1349,7 +1349,7 @@ void rglUniform1f(GLint location, GLfloat v0) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform1fv(GLint location, GLsizei count, const GLfloat *value) { @@ -1360,7 +1360,7 @@ void rglUniform1fv(GLint location, GLsizei count, const GLfloat *value) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform1iv(GLint location, GLsizei count, const GLint *value) { @@ -1386,7 +1386,7 @@ void rglTexBuffer(GLenum target, GLenum internalFormat, GLuint buffer) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ const GLubyte* rglGetStringi(GLenum name, GLuint index) @@ -1411,7 +1411,7 @@ void rglClearBufferfi( GLenum buffer, /* * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 3.0 */ void rglRenderbufferStorageMultisample( GLenum target, @@ -1429,7 +1429,7 @@ void rglRenderbufferStorageMultisample( GLenum target, * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform1i(GLint location, GLint v0) { @@ -1440,7 +1440,7 @@ void rglUniform1i(GLint location, GLint v0) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform2f(GLint location, GLfloat v0, GLfloat v1) { @@ -1451,7 +1451,7 @@ void rglUniform2f(GLint location, GLfloat v0, GLfloat v1) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform2i(GLint location, GLint v0, GLint v1) { @@ -1462,7 +1462,7 @@ void rglUniform2i(GLint location, GLint v0, GLint v1) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform2fv(GLint location, GLsizei count, const GLfloat *value) { @@ -1473,7 +1473,7 @@ void rglUniform2fv(GLint location, GLsizei count, const GLfloat *value) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { @@ -1484,7 +1484,7 @@ void rglUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform3fv(GLint location, GLsizei count, const GLfloat *value) { @@ -1506,7 +1506,7 @@ void rglUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { @@ -1517,7 +1517,7 @@ void rglUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3 * Category: Shaders * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglUniform4fv(GLint location, GLsizei count, const GLfloat *value) { @@ -1528,7 +1528,7 @@ void rglUniform4fv(GLint location, GLsizei count, const GLfloat *value) /* * * Core in: - * OpenGL : 1.0 + * OpenGL : 1.0 */ void rglPolygonOffset(GLfloat factor, GLfloat units) { @@ -1543,7 +1543,7 @@ void rglPolygonOffset(GLfloat factor, GLfloat units) * Category: FBO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 */ void rglGenFramebuffers(GLsizei n, GLuint *ids) { @@ -1554,7 +1554,7 @@ void rglGenFramebuffers(GLsizei n, GLuint *ids) * Category: FBO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 */ void rglBindFramebuffer(GLenum target, GLuint framebuffer) { @@ -1567,7 +1567,7 @@ void rglBindFramebuffer(GLenum target, GLuint framebuffer) * Category: FBO * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void rglDrawBuffers(GLsizei n, const GLenum *bufs) @@ -1581,7 +1581,7 @@ void rglDrawBuffers(GLsizei n, const GLenum *bufs) * Category: FBO * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.0 */ void *rglMapBufferRange( GLenum target, @@ -1629,7 +1629,7 @@ void rglTexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat, /* * * Core in: - * OpenGL : 4.2 + * OpenGL : 4.2 * OpenGLES : 3.1 */ void rglMemoryBarrier( GLbitfield barriers) @@ -1644,7 +1644,7 @@ void rglMemoryBarrier( GLbitfield barriers) /* * * Core in: - * OpenGL : 4.2 + * OpenGL : 4.2 * OpenGLES : 3.1 */ void rglBindImageTexture( GLuint unit, @@ -1714,7 +1714,7 @@ void rglTexImage2DMultisample( GLenum target, /* * * Core in: - * OpenGL : 1.5 + * OpenGL : 1.5 */ void * rglMapBuffer( GLenum target, GLenum access) { @@ -1728,7 +1728,7 @@ void * rglMapBuffer( GLenum target, GLenum access) /* * * Core in: - * OpenGL : 1.5 + * OpenGL : 1.5 */ GLboolean rglUnmapBuffer( GLenum target) { @@ -1753,7 +1753,7 @@ void rglBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) * Category: Blending * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 */ void rglBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { @@ -1763,7 +1763,7 @@ void rglBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) /* * * Core in: - * OpenGL : 2.0 + * OpenGL : 2.0 * OpenGLES : 3.2 */ void rglCopyImageSubData( GLuint srcName, @@ -1805,7 +1805,7 @@ void rglCopyImageSubData( GLuint srcName, * Category: VAO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 3.0 */ void rglBindVertexArray(GLuint array) @@ -1819,7 +1819,7 @@ void rglBindVertexArray(GLuint array) * Category: VAO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 3.0 */ void rglGenVertexArrays(GLsizei n, GLuint *arrays) @@ -1833,7 +1833,7 @@ void rglGenVertexArrays(GLsizei n, GLuint *arrays) * Category: VAO * * Core in: - * OpenGL : 3.0 + * OpenGL : 3.0 * OpenGLES : 3.0 */ void rglDeleteVertexArrays(GLsizei n, const GLuint *arrays) @@ -1973,7 +1973,7 @@ static void glsm_state_setup(void) gl_state.framebuf = hw_render.get_current_framebuffer(); gl_state.cullface.mode = GL_BACK; - gl_state.frontface.mode = GL_CCW; + gl_state.frontface.mode = GL_CCW; gl_state.blendfunc_separate.used = false; gl_state.blendfunc_separate.srcRGB = GL_ONE; @@ -1982,7 +1982,7 @@ static void glsm_state_setup(void) gl_state.blendfunc_separate.dstAlpha = GL_ZERO; gl_state.depthfunc.used = false; - + gl_state.colormask.used = false; gl_state.colormask.red = GL_TRUE; gl_state.colormask.green = GL_TRUE; diff --git a/include/file/file_path.h b/include/file/file_path.h index 89321c8f80..026b4f7933 100644 --- a/include/file/file_path.h +++ b/include/file/file_path.h @@ -100,11 +100,15 @@ const char *path_get_extension(const char *path); * path_remove_extension: * @path : path * - * Removes the extension from the path and returns the result. - * Removes all text after and including the last '.'. + * Mutates path by removing its extension. Removes all + * text after and including the last '.'. * Only '.'s after the last slash are considered. * - * Returns: path with the extension part removed. + * Returns: + * 1) If path has an extension, returns path with the + * extension removed. + * 2) If there is no extension, returns NULL. + * 3) If path is empty or NULL, returns NULL */ char *path_remove_extension(char *path); diff --git a/include/libretro.h b/include/libretro.h index 2516bba4ee..e5c7e58a2d 100644 --- a/include/libretro.h +++ b/include/libretro.h @@ -857,26 +857,39 @@ enum retro_mod #define RETRO_ENVIRONMENT_SET_CONTROLLER_INFO 35 /* const struct retro_controller_info * -- * This environment call lets a libretro core tell the frontend - * which controller types are recognized in calls to + * which controller subclasses are recognized in calls to * retro_set_controller_port_device(). * - * Some emulators such as Super Nintendo - * support multiple lightgun types which must be specifically - * selected from. - * It is therefore sometimes necessary for a frontend to be able - * to tell the core about a special kind of input device which is - * not covered by the libretro input API. + * Some emulators such as Super Nintendo support multiple lightgun + * types which must be specifically selected from. It is therefore + * sometimes necessary for a frontend to be able to tell the core + * about a special kind of input device which is not specifcally + * provided by the Libretro API. * - * In order for a frontend to understand the workings of an input device, - * it must be a specialized type - * of the generic device types already defined in the libretro API. + * In order for a frontend to understand the workings of those devices, + * they must be defined as a specialized subclass of the generic device + * types already defined in the libretro API. * - * Which devices are supported can vary per input port. * The core must pass an array of const struct retro_controller_info which - * is terminated with a blanked out struct. Each element of the struct - * corresponds to an ascending port index to - * retro_set_controller_port_device(). - * Even if special device types are set in the libretro core, + * is terminated with a blanked out struct. Each element of the + * retro_controller_info struct corresponds to the ascending port index + * that is passed to retro_set_controller_port_device() when that function + * is called to indicate to the core that the frontend has changed the + * active device subclass. SEE ALSO: retro_set_controller_port_device() + * + * The ascending input port indexes provided by the core in the struct + * are generally presented by frontends as ascending User # or Player #, + * such as Player 1, Player 2, Player 3, etc. Which device subclasses are + * supported can vary per input port. + * + * The first inner element of each entry in the retro_controller_info array + * is a retro_controller_description struct that specifies the names and + * codes of all device subclasses that are available for the corresponding + * User or Player, beginning with the generic Libretro device that the + * subclasses are derived from. The second inner element of each entry is the + * total number of subclasses that are listed in the retro_controller_description. + * + * NOTE: Even if special device types are set in the libretro core, * libretro should only poll input based on the base input device types. */ #define RETRO_ENVIRONMENT_SET_MEMORY_MAPS (36 | RETRO_ENVIRONMENT_EXPERIMENTAL) @@ -2337,7 +2350,13 @@ RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info); * will only poll input based on that particular device type. It is only a * hint to the libretro core when a core cannot automatically detect the * appropriate input device type on its own. It is also relevant when a - * core can change its behavior depending on device type. */ + * core can change its behavior depending on device type. + * + * As part of the core's implementation of retro_set_controller_port_device, + * the core should call RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS to notify the + * frontend if the descriptions for any controls have changed as a + * result of changing the device type. + */ RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device); /* Resets the current game. */