diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index 0bd8c0598e..03188ccff3 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -589,7 +589,7 @@ static bool udev_joypad_init(void *data) } } - /* Sort the udev entries by devnode name so that they are + /* Sort the udev entries by devnode name so that they are * created in the proper order */ qsort(sorted, sorted_count, sizeof(struct joypad_udev_entry), sort_devnodes); diff --git a/libretro-common/include/libretro_vfs.h b/libretro-common/include/libretro_vfs.h index c0a40afe01..ce864b771f 100644 --- a/libretro-common/include/libretro_vfs.h +++ b/libretro-common/include/libretro_vfs.h @@ -1,129 +1,129 @@ -/* Copyright (C) 2010-2017 The RetroArch team - * - * --------------------------------------------------------------------------------------- - * The following license statement only applies to this libretro API header (libretro_vfs.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_VFS_H__ -#define LIBRETRO_VFS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <libretro.h> - -/* Opaque file handle - * Introduced in VFS API v1 */ -struct retro_vfs_file_handle; - -/* File open flags - * Introduced in VFS API v1 */ -#define RETRO_VFS_FILE_ACCESS_READ (1 << 0) /* Read only mode */ -#define RETRO_VFS_FILE_ACCESS_WRITE (1 << 1) /* Write only mode, discard contents and overwrites existing file unless RETRO_VFS_FILE_ACCESS_UPDATE is also specified */ -#define RETRO_VFS_FILE_ACCESS_READ_WRITE (RETRO_VFS_FILE_ACCESS_READ | RETRO_VFS_FILE_ACCESS_WRITE) /* Read-write mode, discard contents and overwrites existing file unless RETRO_VFS_FILE_ACCESS_UPDATE is also specified*/ -#define RETRO_VFS_FILE_ACCESS_UPDATE_EXISTING (1 << 2) /* Prevents discarding content of existing files opened for writing */ - -#define RETRO_VFS_FILE_ACCESS_HINT_NONE (0) -/* Indicate that we would want to map the file into memory if possible. Requires RETRO_VFS_FILE_ACCESS_READ. This is only a hint and it is up to the frontend to honor and implement it. */ -#define RETRO_VFS_FILE_ACCESS_HINT_MEMORY_MAP (1 << 0) - - -/* Get path from opaque handle. Returns the exact same path passed to file_open when getting the handle - * Introduced in VFS API v1 */ -typedef const char *(RETRO_CALLCONV *retro_vfs_file_get_path_t)(struct retro_vfs_file_handle *stream); - -/* Open a file for reading or writing. If path points to a directory, this will - * fail. Returns the opaque file handle, or NULL for error. - * Introduced in VFS API v1 */ -typedef struct retro_vfs_file_handle *(RETRO_CALLCONV *retro_vfs_file_open_t)(const char *path, uint64_t flags); - -/* Close the file and release its resources. Must be called if open_file returns non-NULL. Returns 0 on succes, -1 on failure. - * Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used. - * Introduced in VFS API v1 */ -typedef int (RETRO_CALLCONV *retro_vfs_file_close_t)(struct retro_vfs_file_handle *stream); - -/* Return the size of the file in bytes, or -1 for error. - * Introduced in VFS API v1 */ -typedef int64_t (RETRO_CALLCONV *retro_vfs_file_size_t)(struct retro_vfs_file_handle *stream); - -/* Get the current read / write position for the file. Returns - 1 for error. - * Introduced in VFS API v1 */ -typedef int64_t (RETRO_CALLCONV *retro_vfs_file_tell_t)(struct retro_vfs_file_handle *stream); - -/* Set the current read/write position for the file. Returns the new position, -1 for error. - * Introduced in VFS API v1 */ -typedef int64_t (RETRO_CALLCONV *retro_vfs_file_seek_t)(struct retro_vfs_file_handle *stream, int64_t offset); - -/* Read data from a file. Returns the number of bytes read, or -1 for error. - * Introduced in VFS API v1 */ -typedef int64_t (RETRO_CALLCONV *retro_vfs_file_read_t)(struct retro_vfs_file_handle *stream, void *s, uint64_t len); - -/* Write data to a file. Returns the number of bytes written, or -1 for error. - * Introduced in VFS API v1 */ -typedef int64_t (RETRO_CALLCONV *retro_vfs_file_write_t)(struct retro_vfs_file_handle *stream, const void *s, uint64_t len); - -/* Flush pending writes to file, if using buffered IO. Returns 0 on sucess, or -1 on failure. - * Introduced in VFS API v1 */ -typedef int (RETRO_CALLCONV *retro_vfs_file_flush_t)(struct retro_vfs_file_handle *stream); - -/* Delete the specified file. Returns 0 on success, -1 on failure - * Introduced in VFS API v1 */ -typedef int (RETRO_CALLCONV *retro_vfs_file_delete_t)(const char *path); - -struct retro_vfs_interface -{ - retro_vfs_file_get_path_t file_get_path; - retro_vfs_file_open_t file_open; - retro_vfs_file_close_t file_close; - retro_vfs_file_size_t file_size; - retro_vfs_file_tell_t file_tell; - retro_vfs_file_seek_t file_seek; - retro_vfs_file_read_t file_read; - retro_vfs_file_write_t file_write; - retro_vfs_file_flush_t file_flush; - retro_vfs_file_delete_t file_delete; -}; - -struct retro_vfs_interface_info -{ - /* Set by core: should this be higher than the version the front end supports, - * front end will return false in the RETRO_ENVIRONMENT_GET_VFS_INTERFACE call - * Introduced in VFS API v1 */ - uint32_t required_interface_version; - - /* Frontend writes interface pointer here. The frontend also sets the actual - * version, must be at least required_interface_version. - * Introduced in VFS API v1 */ - struct retro_vfs_interface *iface; -}; - -#define RETRO_ENVIRONMENT_GET_VFS_INTERFACE (45 | RETRO_ENVIRONMENT_EXPERIMENTAL) - /* struct retro_vfs_interface_info * -- - * Gets access to the VFS interface. - * VFS presence needs to be queried prior to load_game or any - * get_system/save/other_directory being called to let front end know - * core supports VFS before it starts handing out paths. - * It is recomended to do so in retro_set_environment */ - -#ifdef __cplusplus -} -#endif - -#endif +/* Copyright (C) 2010-2017 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this libretro API header (libretro_vfs.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_VFS_H__ +#define LIBRETRO_VFS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <libretro.h> + +/* Opaque file handle + * Introduced in VFS API v1 */ +struct retro_vfs_file_handle; + +/* File open flags + * Introduced in VFS API v1 */ +#define RETRO_VFS_FILE_ACCESS_READ (1 << 0) /* Read only mode */ +#define RETRO_VFS_FILE_ACCESS_WRITE (1 << 1) /* Write only mode, discard contents and overwrites existing file unless RETRO_VFS_FILE_ACCESS_UPDATE is also specified */ +#define RETRO_VFS_FILE_ACCESS_READ_WRITE (RETRO_VFS_FILE_ACCESS_READ | RETRO_VFS_FILE_ACCESS_WRITE) /* Read-write mode, discard contents and overwrites existing file unless RETRO_VFS_FILE_ACCESS_UPDATE is also specified*/ +#define RETRO_VFS_FILE_ACCESS_UPDATE_EXISTING (1 << 2) /* Prevents discarding content of existing files opened for writing */ + +#define RETRO_VFS_FILE_ACCESS_HINT_NONE (0) +/* Indicate that we would want to map the file into memory if possible. Requires RETRO_VFS_FILE_ACCESS_READ. This is only a hint and it is up to the frontend to honor and implement it. */ +#define RETRO_VFS_FILE_ACCESS_HINT_MEMORY_MAP (1 << 0) + + +/* Get path from opaque handle. Returns the exact same path passed to file_open when getting the handle + * Introduced in VFS API v1 */ +typedef const char *(RETRO_CALLCONV *retro_vfs_file_get_path_t)(struct retro_vfs_file_handle *stream); + +/* Open a file for reading or writing. If path points to a directory, this will + * fail. Returns the opaque file handle, or NULL for error. + * Introduced in VFS API v1 */ +typedef struct retro_vfs_file_handle *(RETRO_CALLCONV *retro_vfs_file_open_t)(const char *path, uint64_t flags); + +/* Close the file and release its resources. Must be called if open_file returns non-NULL. Returns 0 on succes, -1 on failure. + * Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used. + * Introduced in VFS API v1 */ +typedef int (RETRO_CALLCONV *retro_vfs_file_close_t)(struct retro_vfs_file_handle *stream); + +/* Return the size of the file in bytes, or -1 for error. + * Introduced in VFS API v1 */ +typedef int64_t (RETRO_CALLCONV *retro_vfs_file_size_t)(struct retro_vfs_file_handle *stream); + +/* Get the current read / write position for the file. Returns - 1 for error. + * Introduced in VFS API v1 */ +typedef int64_t (RETRO_CALLCONV *retro_vfs_file_tell_t)(struct retro_vfs_file_handle *stream); + +/* Set the current read/write position for the file. Returns the new position, -1 for error. + * Introduced in VFS API v1 */ +typedef int64_t (RETRO_CALLCONV *retro_vfs_file_seek_t)(struct retro_vfs_file_handle *stream, int64_t offset); + +/* Read data from a file. Returns the number of bytes read, or -1 for error. + * Introduced in VFS API v1 */ +typedef int64_t (RETRO_CALLCONV *retro_vfs_file_read_t)(struct retro_vfs_file_handle *stream, void *s, uint64_t len); + +/* Write data to a file. Returns the number of bytes written, or -1 for error. + * Introduced in VFS API v1 */ +typedef int64_t (RETRO_CALLCONV *retro_vfs_file_write_t)(struct retro_vfs_file_handle *stream, const void *s, uint64_t len); + +/* Flush pending writes to file, if using buffered IO. Returns 0 on sucess, or -1 on failure. + * Introduced in VFS API v1 */ +typedef int (RETRO_CALLCONV *retro_vfs_file_flush_t)(struct retro_vfs_file_handle *stream); + +/* Delete the specified file. Returns 0 on success, -1 on failure + * Introduced in VFS API v1 */ +typedef int (RETRO_CALLCONV *retro_vfs_file_delete_t)(const char *path); + +struct retro_vfs_interface +{ + retro_vfs_file_get_path_t file_get_path; + retro_vfs_file_open_t file_open; + retro_vfs_file_close_t file_close; + retro_vfs_file_size_t file_size; + retro_vfs_file_tell_t file_tell; + retro_vfs_file_seek_t file_seek; + retro_vfs_file_read_t file_read; + retro_vfs_file_write_t file_write; + retro_vfs_file_flush_t file_flush; + retro_vfs_file_delete_t file_delete; +}; + +struct retro_vfs_interface_info +{ + /* Set by core: should this be higher than the version the front end supports, + * front end will return false in the RETRO_ENVIRONMENT_GET_VFS_INTERFACE call + * Introduced in VFS API v1 */ + uint32_t required_interface_version; + + /* Frontend writes interface pointer here. The frontend also sets the actual + * version, must be at least required_interface_version. + * Introduced in VFS API v1 */ + struct retro_vfs_interface *iface; +}; + +#define RETRO_ENVIRONMENT_GET_VFS_INTERFACE (45 | RETRO_ENVIRONMENT_EXPERIMENTAL) + /* struct retro_vfs_interface_info * -- + * Gets access to the VFS interface. + * VFS presence needs to be queried prior to load_game or any + * get_system/save/other_directory being called to let front end know + * core supports VFS before it starts handing out paths. + * It is recomended to do so in retro_set_environment */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libretro-common/include/vfs/vfs_implementation.h b/libretro-common/include/vfs/vfs_implementation.h index 852907b5d2..25fdc1d41e 100644 --- a/libretro-common/include/vfs/vfs_implementation.h +++ b/libretro-common/include/vfs/vfs_implementation.h @@ -1,63 +1,63 @@ -/* Copyright (C) 2010-2017 The RetroArch team -* -* --------------------------------------------------------------------------------------- -* The following license statement only applies to this file (vfs_implementation.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_VFS_IMPLEMENTATION_H -#define __LIBRETRO_SDK_VFS_IMPLEMENTATION_H - -#include <stdint.h> -#include <libretro.h> - -/* Replace the following symbol with something appropriate - * to signify the file is being compiled for a front end instead of a core. - * This allows the same code to act as reference implementation - * for VFS and as fallbacks for when the front end does not provide VFS functionality. - */ - -#ifdef VFS_FRONTEND -typedef struct retro_vfs_file_handle libretro_vfs_implementation_file; -#else -typedef struct libretro_vfs_implementation_file libretro_vfs_implementation_file; -#endif - -libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uint64_t flags); - -int retro_vfs_file_close_impl(libretro_vfs_implementation_file *stream); - -int retro_vfs_file_error_impl(libretro_vfs_implementation_file *stream); - -int64_t retro_vfs_file_size_impl(libretro_vfs_implementation_file *stream); - -int64_t retro_vfs_file_tell_impl(libretro_vfs_implementation_file *stream); - -int64_t retro_vfs_file_seek_impl(libretro_vfs_implementation_file *stream, int64_t offset); - -int64_t retro_vfs_file_read_impl(libretro_vfs_implementation_file *stream, void *s, uint64_t len); - -int64_t retro_vfs_file_write_impl(libretro_vfs_implementation_file *stream, const void *s, uint64_t len); - -int retro_vfs_file_flush_impl(libretro_vfs_implementation_file *stream); - -int retro_vfs_file_delete_impl(const char *path); - -const char *retro_vfs_file_get_path_impl(libretro_vfs_implementation_file *stream); - -#endif +/* Copyright (C) 2010-2017 The RetroArch team +* +* --------------------------------------------------------------------------------------- +* The following license statement only applies to this file (vfs_implementation.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_VFS_IMPLEMENTATION_H +#define __LIBRETRO_SDK_VFS_IMPLEMENTATION_H + +#include <stdint.h> +#include <libretro.h> + +/* Replace the following symbol with something appropriate + * to signify the file is being compiled for a front end instead of a core. + * This allows the same code to act as reference implementation + * for VFS and as fallbacks for when the front end does not provide VFS functionality. + */ + +#ifdef VFS_FRONTEND +typedef struct retro_vfs_file_handle libretro_vfs_implementation_file; +#else +typedef struct libretro_vfs_implementation_file libretro_vfs_implementation_file; +#endif + +libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uint64_t flags); + +int retro_vfs_file_close_impl(libretro_vfs_implementation_file *stream); + +int retro_vfs_file_error_impl(libretro_vfs_implementation_file *stream); + +int64_t retro_vfs_file_size_impl(libretro_vfs_implementation_file *stream); + +int64_t retro_vfs_file_tell_impl(libretro_vfs_implementation_file *stream); + +int64_t retro_vfs_file_seek_impl(libretro_vfs_implementation_file *stream, int64_t offset); + +int64_t retro_vfs_file_read_impl(libretro_vfs_implementation_file *stream, void *s, uint64_t len); + +int64_t retro_vfs_file_write_impl(libretro_vfs_implementation_file *stream, const void *s, uint64_t len); + +int retro_vfs_file_flush_impl(libretro_vfs_implementation_file *stream); + +int retro_vfs_file_delete_impl(const char *path); + +const char *retro_vfs_file_get_path_impl(libretro_vfs_implementation_file *stream); + +#endif diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index 7fe5b0d555..9a0643063c 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -342,7 +342,7 @@ int filestream_getc(RFILE *stream) return 0; if(filestream_read(stream, &c, 1) == 1) return (int)c; - return EOF; + return EOF; } ssize_t filestream_seek(RFILE *stream, ssize_t offset, int whence) diff --git a/libretro-common/streams/interface_stream.c b/libretro-common/streams/interface_stream.c index c1156ecb47..255d7e1e41 100644 --- a/libretro-common/streams/interface_stream.c +++ b/libretro-common/streams/interface_stream.c @@ -416,7 +416,7 @@ intfstream_t *intfstream_open_memory(void *data, info.memory.writable = false; fd = (intfstream_t*)intfstream_init(&info); - + if (!fd) return NULL; diff --git a/libretro-common/vfs/vfs_implementation.c b/libretro-common/vfs/vfs_implementation.c index b0046889b3..c2f0e6433f 100644 --- a/libretro-common/vfs/vfs_implementation.c +++ b/libretro-common/vfs/vfs_implementation.c @@ -1,111 +1,111 @@ -/* Copyright (C) 2010-2017 The RetroArch team -* -* --------------------------------------------------------------------------------------- -* The following license statement only applies to this file (vfs_implementation.c). -* --------------------------------------------------------------------------------------- -* -* 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. -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vfs/vfs_implementation.h> -#include <string/stdstring.h> -#include <memmap.h> -#include <retro_miscellaneous.h> -#include <encodings/utf.h> - -#ifdef VFS_FRONTEND -struct retro_vfs_file_handle -#else -struct libretro_vfs_implementation_file -#endif -{ - void *empty; -}; - -int64_t retro_vfs_file_seek_internal(libretro_vfs_implementation_file *stream, int64_t offset, int whence) -{ - return -1; -} - -libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uint64_t mode) -{ - libretro_vfs_implementation_file *stream = (libretro_vfs_implementation_file*)calloc(1, sizeof(*stream)); - - if (!stream) - return NULL; - - return stream; -} - -int retro_vfs_file_close_impl(libretro_vfs_implementation_file *stream) -{ - return -1; -} - -int retro_vfs_file_error_impl(libretro_vfs_implementation_file *stream) -{ - return 0; -} - -int64_t retro_vfs_file_size_impl(libretro_vfs_implementation_file *stream) -{ - return -1; -} - -int64_t retro_vfs_file_tell_impl(libretro_vfs_implementation_file *stream) -{ - return -1; -} - -int64_t retro_vfs_file_seek_impl(libretro_vfs_implementation_file *stream, int64_t offset) -{ - return retro_vfs_file_seek_internal(stream, offset, SEEK_SET); -} - -int64_t retro_vfs_file_read_impl(libretro_vfs_implementation_file *stream, void *s, uint64_t len) -{ - return -1; -} - -int64_t retro_vfs_file_write_impl(libretro_vfs_implementation_file *stream, const void *s, uint64_t len) -{ - return -1; -} - -int retro_vfs_file_flush_impl(libretro_vfs_implementation_file *stream) -{ - return 0; -} - -int retro_vfs_file_delete_impl(const char *path) -{ - return 0; -} - -const char *retro_vfs_file_get_path_impl(libretro_vfs_implementation_file *stream) -{ - return NULL; -} - +/* Copyright (C) 2010-2017 The RetroArch team +* +* --------------------------------------------------------------------------------------- +* The following license statement only applies to this file (vfs_implementation.c). +* --------------------------------------------------------------------------------------- +* +* 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. +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vfs/vfs_implementation.h> +#include <string/stdstring.h> +#include <memmap.h> +#include <retro_miscellaneous.h> +#include <encodings/utf.h> + +#ifdef VFS_FRONTEND +struct retro_vfs_file_handle +#else +struct libretro_vfs_implementation_file +#endif +{ + void *empty; +}; + +int64_t retro_vfs_file_seek_internal(libretro_vfs_implementation_file *stream, int64_t offset, int whence) +{ + return -1; +} + +libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uint64_t mode) +{ + libretro_vfs_implementation_file *stream = (libretro_vfs_implementation_file*)calloc(1, sizeof(*stream)); + + if (!stream) + return NULL; + + return stream; +} + +int retro_vfs_file_close_impl(libretro_vfs_implementation_file *stream) +{ + return -1; +} + +int retro_vfs_file_error_impl(libretro_vfs_implementation_file *stream) +{ + return 0; +} + +int64_t retro_vfs_file_size_impl(libretro_vfs_implementation_file *stream) +{ + return -1; +} + +int64_t retro_vfs_file_tell_impl(libretro_vfs_implementation_file *stream) +{ + return -1; +} + +int64_t retro_vfs_file_seek_impl(libretro_vfs_implementation_file *stream, int64_t offset) +{ + return retro_vfs_file_seek_internal(stream, offset, SEEK_SET); +} + +int64_t retro_vfs_file_read_impl(libretro_vfs_implementation_file *stream, void *s, uint64_t len) +{ + return -1; +} + +int64_t retro_vfs_file_write_impl(libretro_vfs_implementation_file *stream, const void *s, uint64_t len) +{ + return -1; +} + +int retro_vfs_file_flush_impl(libretro_vfs_implementation_file *stream) +{ + return 0; +} + +int retro_vfs_file_delete_impl(const char *path) +{ + return 0; +} + +const char *retro_vfs_file_get_path_impl(libretro_vfs_implementation_file *stream) +{ + return NULL; +} + diff --git a/tasks/task_database.c b/tasks/task_database.c index a641f4b172..a3d200627d 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -322,7 +322,7 @@ static int task_database_chd_get_serial(const char *name, char* serial) { int result; intfstream_t *fd = intfstream_open_chd_track( - name, + name, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE, CHDSTREAM_TRACK_FIRST_DATA);