/**************************************************************************** * Caprice32 libretro port * * Copyright not6 - r-type (2015-2018) * Copyright David Colmenero - D_Skywalk (2019-2021) * Copyright Daniel De Matteis (2012-2021) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: * * - Redistributions may not be sold, nor may they be used in a commercial * product or activity. * * - Redistributions that are modified from the original source must include the * complete source code, including the source code for all components used by a * binary built from the modified sources. However, as a special exception, the * source code distributed need not include anything that is normally distributed * (in either source or binary form) with the major components (compiler, kernel, * and so on) of the operating system on which the executable runs, unless that * component itself accompanies the executable. * * - Redistributions must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************************/ #ifndef RETRO_UTILS_H__ #define RETRO_UTILS_H__ #include #include #include //***************************************************************************** // File helpers functions #define RETRO_PATH_MAX 512 #ifdef _WIN32 #define RETRO_PATH_SEPARATOR "\\" // Windows also support the unix path separator #define RETRO_PATH_SEPARATOR_ALT "/" #else #define RETRO_PATH_SEPARATOR "/" #endif bool file_check_extension(const char *filename, const size_t filename_size, const char *ext, const size_t ext_size); bool file_check_flag(const char *filename, const size_t filename_size, const char *flag, const size_t flag_size); void path_join(char* out, const char* basedir, const char* filename); char* path_join_dup(const char* basedir, const char* filename); bool file_exists(const char *filename); int file_size (int file_num); uint32_t get_hash(const char *filename); void *retro_malloc(size_t size); void retro_free(void * mem); #endif