diff --git a/audio/audio_mixer.c b/audio/audio_mixer.c index 3b66d0b..21a0089 100644 --- a/audio/audio_mixer.c +++ b/audio/audio_mixer.c @@ -52,7 +52,6 @@ #include #endif - #ifdef HAVE_DR_MP3 #define DR_MP3_IMPLEMENTATION #include @@ -402,7 +401,6 @@ audio_mixer_sound_t* audio_mixer_load_ogg(void *buffer, int32_t size) #endif } - audio_mixer_sound_t* audio_mixer_load_flac(void *buffer, int32_t size) { #ifdef HAVE_DR_FLAC @@ -641,7 +639,6 @@ error: } #endif - #ifdef HAVE_DR_FLAC static bool audio_mixer_play_flac( audio_mixer_sound_t* sound, @@ -748,7 +745,6 @@ error: } #endif - audio_mixer_voice_t* audio_mixer_play(audio_mixer_sound_t* sound, bool repeat, float volume, audio_mixer_stop_cb_t stop_cb) { diff --git a/audio/dsp_filters/crystalizer.c b/audio/dsp_filters/crystalizer.c index c0e253c..61510d5 100644 --- a/audio/dsp_filters/crystalizer.c +++ b/audio/dsp_filters/crystalizer.c @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #include #include #include @@ -88,6 +87,5 @@ const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_si return &delta_plug; } - #undef dspfilter_get_implementation diff --git a/audio/dsp_filters/echo.c b/audio/dsp_filters/echo.c index 4b0c6cc..47c5b20 100644 --- a/audio/dsp_filters/echo.c +++ b/audio/dsp_filters/echo.c @@ -157,7 +157,6 @@ error: return NULL; } - static const struct dspfilter_implementation echo_plug = { echo_init, echo_process, diff --git a/audio/dsp_filters/eq.c b/audio/dsp_filters/eq.c index a3defe7..b926a41 100644 --- a/audio/dsp_filters/eq.c +++ b/audio/dsp_filters/eq.c @@ -271,7 +271,6 @@ static void *eq_init(const struct dspfilter_info *info, if (!eq) return NULL; - config->get_float(userdata, "window_beta", &beta, 4.0f); config->get_int(userdata, "block_size_log2", &size_log2, 8); diff --git a/audio/dsp_filters/fft/fft.h b/audio/dsp_filters/fft/fft.h index e5bcdf7..38e67cc 100644 --- a/audio/dsp_filters/fft/fft.h +++ b/audio/dsp_filters/fft/fft.h @@ -41,6 +41,5 @@ void fft_process_forward(fft_t *fft, void fft_process_inverse(fft_t *fft, float *out, const fft_complex_t *in, unsigned step); - #endif diff --git a/audio/dsp_filters/iir.c b/audio/dsp_filters/iir.c index 748d0b8..9b38f4b 100644 --- a/audio/dsp_filters/iir.c +++ b/audio/dsp_filters/iir.c @@ -261,7 +261,6 @@ static void iir_filter_init(struct iir_data *iir, a1 = a[1]; a2 = a[2]; - /* Normalise to 0dB at 1kHz (Thanks to Glenn Davis) */ y = 2.0 * M_PI * 1000.0 / sample_rate; b_re = b0 + b1 * cos(-y) + b2 * cos(-2.0 * y); diff --git a/audio/dsp_filters/reverb.c b/audio/dsp_filters/reverb.c index d1a770f..0b517e5 100644 --- a/audio/dsp_filters/reverb.c +++ b/audio/dsp_filters/reverb.c @@ -60,7 +60,6 @@ static INLINE float comb_process(struct comb *c, float input) return output; } - static INLINE float allpass_process(struct allpass *a, float input) { float bufout = a->buffer[a->bufidx]; @@ -316,4 +315,3 @@ const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_si #undef dspfilter_get_implementation - diff --git a/audio/dsp_filters/vibrato.c b/audio/dsp_filters/vibrato.c index 6e79d2f..ff2b3f9 100644 --- a/audio/dsp_filters/vibrato.c +++ b/audio/dsp_filters/vibrato.c @@ -30,7 +30,6 @@ #define sqr(a) ((a) * (a)) - const float BASE_DELAY_SEC = 0.002; // 2 ms const float VIBRATO_FREQUENCY_DEFAULT_HZ = 2; const float VIBRATO_FREQUENCY_MAX_HZ = 14; diff --git a/features/features_cpu.c b/features/features_cpu.c index 6c056f0..b5fca01 100644 --- a/features/features_cpu.c +++ b/features/features_cpu.c @@ -68,7 +68,6 @@ #if defined(PS2) #include #include -#include #endif #if defined(__PSL1GHT__) @@ -128,7 +127,6 @@ static int ra_clock_gettime(int clk_ik, struct timespec *t) #define ra_clock_gettime clock_gettime #endif - #ifdef EMSCRIPTEN #include #endif @@ -174,9 +172,9 @@ retro_perf_tick_t cpu_features_get_perf_counter(void) time_ticks = (retro_perf_tick_t)tv.tv_sec * 1000000000 + (retro_perf_tick_t)tv.tv_nsec; -#elif defined(__GNUC__) && defined(__i386__) || defined(__i486__) || defined(__i686__) +#elif defined(__GNUC__) && defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_X64) || defined(_M_AMD64) __asm__ volatile ("rdtsc" : "=A" (time_ticks)); -#elif defined(__GNUC__) && defined(__x86_64__) +#elif defined(__GNUC__) && defined(__x86_64__) || defined(_M_IX86) unsigned a, d; __asm__ volatile ("rdtsc" : "=a" (a), "=d" (d)); time_ticks = (retro_perf_tick_t)a | ((retro_perf_tick_t)d << 32); @@ -191,7 +189,7 @@ retro_perf_tick_t cpu_features_get_perf_counter(void) #elif defined(VITA) sceRtcGetCurrentTick((SceRtcTick*)&time_ticks); #elif defined(PS2) - time_ticks = SDL_GetTicks()*294912; // 294,912MHZ / 1000 msecs + time_ticks = clock()*294912; // 294,912MHZ / 1000 msecs #elif defined(_3DS) time_ticks = svcGetSystemTick(); #elif defined(WIIU) @@ -200,6 +198,8 @@ retro_perf_tick_t cpu_features_get_perf_counter(void) struct timeval tv; gettimeofday(&tv,NULL); time_ticks = (1000000 * tv.tv_sec + tv.tv_usec); +#elif defined(HAVE_LIBNX) + time_ticks = armGetSystemTick(); #endif return time_ticks; @@ -241,7 +241,7 @@ retro_time_t cpu_features_get_time_usec(void) #elif defined(EMSCRIPTEN) return emscripten_get_now() * 1000; #elif defined(PS2) - return SDL_GetTicks()*1000; + return clock()*1000; #elif defined(__mips__) || defined(DJGPP) struct timeval tv; gettimeofday(&tv,NULL); @@ -485,7 +485,7 @@ unsigned cpu_features_get_core_amount(void) #if defined(_WIN32) && !defined(_XBOX) /* Win32 */ SYSTEM_INFO sysinfo; -#ifdef __WINRT__ +#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP GetNativeSystemInfo(&sysinfo); #else GetSystemInfo(&sysinfo); @@ -708,7 +708,6 @@ uint64_t cpu_features_get(void) cpu |= RETRO_SIMD_MMXEXT; } - if (flags[3] & (1 << 26)) cpu |= RETRO_SIMD_SSE2; @@ -733,7 +732,6 @@ uint64_t cpu_features_get(void) if (flags[2] & (1 << 25)) cpu |= RETRO_SIMD_AES; - /* Must only perform xgetbv check if we have * AVX CPU support (guaranteed to have at least i686). */ if (((flags[2] & avx_flags) == avx_flags) diff --git a/file/archive_file.c b/file/archive_file.c index 6751454..becdf63 100644 --- a/file/archive_file.c +++ b/file/archive_file.c @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #include #include #include diff --git a/file/config_file.c b/file/config_file.c index fcf95de..b92acfd 100644 --- a/file/config_file.c +++ b/file/config_file.c @@ -34,7 +34,10 @@ #elif defined(_XBOX) #include #endif - +#ifdef ORBIS +#include +#include +#endif #include #include #include @@ -413,10 +416,10 @@ static config_file_t *config_file_new_internal( if (!path || !*path) return conf; - +#if !defined(ORBIS) if (path_is_directory(path)) goto error; - +#endif conf->path = strdup(path); if (!conf->path) goto error; @@ -544,7 +547,6 @@ bool config_append_file(config_file_t *conf, const char *path) return true; } - config_file_t *config_file_new_from_string(const char *from_string) { size_t i; @@ -976,11 +978,20 @@ void config_set_bool(config_file_t *conf, const char *key, bool val) config_set_string(conf, key, val ? "true" : "false"); } -bool config_file_write(config_file_t *conf, const char *path) +bool config_file_write(config_file_t *conf, const char *path, bool sort) { if (!string_is_empty(path)) { void* buf = NULL; +#ifdef ORBIS + int fd = orbisOpen(path,O_RDWR|O_CREAT,0644); + RARCH_LOG("[Config]config_file_write orbisOpen path=%s fd=%d\n", path, fd); + if (fd < 0) + return false; + config_file_dump_orbis(conf,fd); + orbisClose(fd); + RARCH_LOG("[Config]config_file_write orbisClose path=%s fd=%d\n", path, fd); +#else FILE *file = (FILE*)fopen_utf8(path, "wb"); if (!file) return false; @@ -991,19 +1002,49 @@ bool config_file_write(config_file_t *conf, const char *path) setvbuf(file, (char*)buf, _IOFBF, 0x4000); #endif - config_file_dump(conf, file); + config_file_dump(conf, file, sort); if (file != stdout) fclose(file); free(buf); +#endif } else - config_file_dump(conf, stdout); + config_file_dump(conf, stdout, sort); return true; } -void config_file_dump(config_file_t *conf, FILE *file) +#ifdef ORBIS +void config_file_dump_orbis(config_file_t *conf, int fd) +{ + struct config_entry_list *list = NULL; + struct config_include_list *includes = conf->includes; + while (includes) + { + char cad[256]; + sprintf(cad,"#include %s\n", includes->path); + orbisWrite(fd,cad,strlen(cad)); + includes = includes->next; + } + + list = merge_sort_linked_list((struct config_entry_list*)conf->entries, config_sort_compare_func); + conf->entries = list; + + while (list) + { + if (!list->readonly && list->key) + { + char newlist[256]; + sprintf(newlist,"%s = %s\n", list->key, list->value); + orbisWrite(fd,newlist,strlen(newlist)); + } + list = list->next; + } +} +#endif + +void config_file_dump(config_file_t *conf, FILE *file, bool sort) { struct config_entry_list *list = NULL; struct config_include_list *includes = conf->includes; @@ -1014,7 +1055,11 @@ void config_file_dump(config_file_t *conf, FILE *file) includes = includes->next; } - list = merge_sort_linked_list((struct config_entry_list*)conf->entries, config_sort_compare_func); + if (sort) + list = merge_sort_linked_list((struct config_entry_list*)conf->entries, config_sort_compare_func); + else + list = (struct config_entry_list*)conf->entries; + conf->entries = list; while (list) diff --git a/file/file_path.c b/file/file_path.c index 408a242..6db4f00 100644 --- a/file/file_path.c +++ b/file/file_path.c @@ -75,6 +75,11 @@ #include #endif +#if defined(ORBIS) +#include +#include +#include +#endif #if defined(PSP) #include #endif @@ -120,12 +125,15 @@ enum stat_mode static bool path_stat(const char *path, enum stat_mode mode, int32_t *size) { +#if defined(ORBIS) + return false; /* for now */ +#endif #if defined(VITA) || defined(PSP) SceIoStat buf; char *tmp = strdup(path); size_t len = strlen(tmp); if (tmp[len-1] == '/') - tmp[len-1]='\0'; + tmp[len-1] = '\0'; if (sceIoGetstat(tmp, &buf) < 0) { @@ -138,7 +146,7 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size) char *tmp = strdup(path); size_t len = strlen(tmp); if (tmp[len-1] == '/') - tmp[len-1]='\0'; + tmp[len-1] = '\0'; if (fileXioGetStat(tmp, &buf) < 0) { @@ -151,10 +159,10 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size) if (cellFsStat(path, &buf) < 0) return false; #elif defined(_WIN32) - struct _stat buf; - char *path_local; - wchar_t *path_wide; DWORD file_info; + struct _stat buf; + char *path_local = NULL; + wchar_t *path_wide = NULL; if (!path || !*path) return false; @@ -232,7 +240,18 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size) */ bool path_is_directory(const char *path) { +#ifdef ORBIS + int dfd; + if (!path) + return false; + dfd = orbisDopen(path); + if (dfd < 0) + return false; + orbisDclose(dfd); + return true; +#else return path_stat(path, IS_DIRECTORY, NULL); +#endif } bool path_is_character_special(const char *path) @@ -258,7 +277,7 @@ static bool path_mkdir_error(int ret) { #if defined(VITA) return (ret == SCE_ERROR_ERRNO_EEXIST); -#elif defined(PSP) || defined(PS2) || defined(_3DS) || defined(WIIU) || defined(SWITCH) +#elif defined(PSP) || defined(PS2) || defined(_3DS) || defined(WIIU) || defined(SWITCH) || defined(ORBIS) return (ret == -1); #else return (ret < 0 && errno == EEXIST); @@ -329,6 +348,8 @@ bool path_mkdir(const char *dir) int ret = sceIoMkdir(dir, 0777); #elif defined(PS2) int ret =fileXioMkdir(dir, 0777); +#elif defined(ORBIS) + int ret =orbisMkdir(dir, 0755); #elif defined(__QNX__) int ret = mkdir(dir, 0777); #else @@ -936,7 +957,6 @@ void fill_pathname_join_noext(char *out_path, path_remove_extension(out_path); } - /** * fill_pathname_join_delim: * @out_path : output path @@ -961,7 +981,8 @@ void fill_pathname_join_delim(char *out_path, const char *dir, out_path[copied] = delim; out_path[copied+1] = '\0'; - strlcat(out_path, path, size); + if (path) + strlcat(out_path, path, size); } void fill_pathname_join_delim_concat(char *out_path, const char *dir, @@ -1028,7 +1049,16 @@ void fill_pathname_expand_special(char *out_path, out_path += src_size; size -= src_size; - in_path++; + if (!path_char_is_slash(out_path[-1])) + { + src_size = strlcpy(out_path, path_default_slash(), size); + retro_assert(src_size < size); + + out_path += src_size; + size -= src_size; + } + + in_path += 2; } free(home_dir); @@ -1050,7 +1080,16 @@ void fill_pathname_expand_special(char *out_path, out_path += src_size; size -= src_size; - in_path++; + if (!path_char_is_slash(out_path[-1])) + { + src_size = strlcpy(out_path, path_default_slash(), size); + retro_assert(src_size < size); + + out_path += src_size; + size -= src_size; + } + + in_path += 2; } free(application_dir); diff --git a/file/nbio/nbio_intf.c b/file/nbio/nbio_intf.c index 1ce6322..2fac18a 100644 --- a/file/nbio/nbio_intf.c +++ b/file/nbio/nbio_intf.c @@ -32,14 +32,17 @@ extern nbio_intf_t nbio_linux; extern nbio_intf_t nbio_mmap_unix; extern nbio_intf_t nbio_mmap_win32; +extern nbio_intf_t nbio_orbis; extern nbio_intf_t nbio_stdio; #if defined(_linux__) static nbio_intf_t *internal_nbio = &nbio_linux; #elif defined(HAVE_MMAP) && defined(BSD) static nbio_intf_t *internal_nbio = &nbio_mmap_unix; -#elif defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) +#elif defined(_WIN32) && !defined(_XBOX) static nbio_intf_t *internal_nbio = &nbio_mmap_win32; +#elif defined(ORBIS) +static nbio_intf_t *internal_nbio = &nbio_orbis; #else static nbio_intf_t *internal_nbio = &nbio_stdio; #endif diff --git a/file/nbio/nbio_linux.c b/file/nbio/nbio_linux.c index 8644bb9..c454440 100644 --- a/file/nbio/nbio_linux.c +++ b/file/nbio/nbio_linux.c @@ -32,7 +32,6 @@ #include #include - #include #include #include diff --git a/file/nbio/nbio_stdio.c b/file/nbio/nbio_stdio.c index f80e91a..52e8eee 100644 --- a/file/nbio/nbio_stdio.c +++ b/file/nbio/nbio_stdio.c @@ -194,6 +194,7 @@ static bool nbio_stdio_iterate(void *data) static void nbio_stdio_resize(void *data, size_t len) { + void *new_data = NULL; struct nbio_stdio_t *handle = (struct nbio_stdio_t*)data; if (!handle) return; @@ -209,10 +210,14 @@ static void nbio_stdio_resize(void *data, size_t len) abort(); } - handle->len = len; - handle->data = realloc(handle->data, handle->len); - handle->op = -1; - handle->progress = handle->len; + handle->len = len; + handle->progress = len; + handle->op = -1; + + new_data = realloc(handle->data, handle->len); + + if (new_data) + handle->data = new_data; } static void *nbio_stdio_get_ptr(void *data, size_t* len) diff --git a/file/nbio/nbio_windowsmmap.c b/file/nbio/nbio_windowsmmap.c index 67860a3..cac7194 100644 --- a/file/nbio/nbio_windowsmmap.c +++ b/file/nbio/nbio_windowsmmap.c @@ -22,7 +22,7 @@ #include -#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) +#if defined(_WIN32) && !defined(_XBOX) #include #include @@ -69,7 +69,11 @@ static void *nbio_mmap_win32_open(const char * filename, unsigned mode) HANDLE file = CreateFile(filename, access, FILE_SHARE_ALL, NULL, dispositions[mode], FILE_ATTRIBUTE_NORMAL, NULL); #else wchar_t *filename_wide = utf8_to_utf16_string_alloc(filename); +#ifdef __WINRT__ + HANDLE file = CreateFile2(filename_wide, access, FILE_SHARE_ALL, dispositions[mode], NULL); +#else HANDLE file = CreateFileW(filename_wide, access, FILE_SHARE_ALL, NULL, dispositions[mode], FILE_ATTRIBUTE_NORMAL, NULL); +#endif if (filename_wide) free(filename_wide); diff --git a/file/retro_dirent.c b/file/retro_dirent.c index 561c1b0..bf11e06 100644 --- a/file/retro_dirent.c +++ b/file/retro_dirent.c @@ -50,6 +50,11 @@ # include # include # include +#elif defined(ORBIS) +# include +# include +# include +# include #else # if defined(PSP) # include @@ -98,6 +103,9 @@ struct RDIR CellFsErrno error; int directory; CellFsDirent entry; +#elif defined(ORBIS) + int directory; + struct dirent entry; #else DIR *directory; const struct dirent *entry; @@ -159,6 +167,8 @@ struct RDIR *retro_opendir(const char *name) rdir->entry = NULL; #elif defined(__CELLOS_LV2__) rdir->error = cellFsOpendir(name, &rdir->directory); +#elif defined(ORBIS) + rdir->directory = orbisDopen(name); #else rdir->directory = opendir(name); rdir->entry = NULL; @@ -175,7 +185,7 @@ bool retro_dirent_error(struct RDIR *rdir) { #if defined(_WIN32) return (rdir->directory == INVALID_HANDLE_VALUE); -#elif defined(VITA) || defined(PSP) || defined(PS2) +#elif defined(VITA) || defined(PSP) || defined(PS2) || defined(ORBIS) return (rdir->directory < 0); #elif defined(__CELLOS_LV2__) return (rdir->error != CELL_FS_SUCCEEDED); @@ -207,6 +217,8 @@ int retro_readdir(struct RDIR *rdir) uint64_t nread; rdir->error = cellFsReaddir(rdir->directory, &rdir->entry, &nread); return (nread != 0); +#elif defined(ORBIS) + return (orbisDread(rdir->directory, &rdir->entry) > 0); #else return ((rdir->entry = readdir(rdir->directory)) != NULL); #endif @@ -231,7 +243,7 @@ const char *retro_dirent_get_name(struct RDIR *rdir) free(name); #endif return (char*)rdir->entry.cFileName; -#elif defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__) +#elif defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__) || defined(ORBIS) return rdir->entry.d_name; #elif defined(PS2) return rdir->entry.name; @@ -270,6 +282,12 @@ bool retro_dirent_is_dir(struct RDIR *rdir, const char *path) #elif defined(__CELLOS_LV2__) CellFsDirent *entry = (CellFsDirent*)&rdir->entry; return (entry->d_type == CELL_FS_TYPE_DIRECTORY); +#elif defined(ORBIS) + const struct dirent *entry = &rdir->entry; + if (entry->d_type==DT_DIR) + return true; + if (!(entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK)) + return false; #else struct stat buf; #if defined(DT_DIR) @@ -311,6 +329,8 @@ void retro_closedir(struct RDIR *rdir) fileXioDclose(rdir->directory); #elif defined(__CELLOS_LV2__) rdir->error = cellFsClosedir(rdir->directory); +#elif defined(ORBIS) + orbisDclose(rdir->directory); #else if (rdir->directory) closedir(rdir->directory); diff --git a/formats/image_texture.c b/formats/image_texture.c index e2f3c3d..58df1e2 100644 --- a/formats/image_texture.c +++ b/formats/image_texture.c @@ -202,7 +202,6 @@ end: return success; } - void image_texture_free(struct texture_image *img) { if (!img) diff --git a/formats/jpeg/rjpeg.c b/formats/jpeg/rjpeg.c index e321b69..7d4e45a 100644 --- a/formats/jpeg/rjpeg.c +++ b/formats/jpeg/rjpeg.c @@ -779,7 +779,6 @@ static INLINE uint8_t rjpeg__clamp(int x) return (uint8_t) x; } - /* derived from jidctint -- DCT_ISLOW */ #define RJPEG__IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \ int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \ @@ -1292,7 +1291,6 @@ static uint8_t rjpeg__get_marker(rjpeg__jpeg *j) return x; } - /* after a restart interval, rjpeg__jpeg_reset the entropy decoder and * the dc prediction */ @@ -1866,7 +1864,6 @@ static int rjpeg__process_frame_header(rjpeg__jpeg *z, int scan) return 1; } - static int rjpeg__decode_jpeg_header(rjpeg__jpeg *z, int scan) { int m; @@ -2014,7 +2011,6 @@ static uint8_t* rjpeg__resample_row_h_2(uint8_t *out, uint8_t *in_near, return out; } - static uint8_t *rjpeg__resample_row_hv_2(uint8_t *out, uint8_t *in_near, uint8_t *in_far, int w, int hs) { @@ -2370,7 +2366,6 @@ static void rjpeg__setup_jpeg(rjpeg__jpeg *j) j->YCbCr_to_RGB_kernel = rjpeg__YCbCr_to_RGB_row; j->resample_row_hv_2_kernel = rjpeg__resample_row_hv_2; - #if defined(__SSE2__) if (mask & RETRO_SIMD_SSE2) { diff --git a/formats/libchdr/libchdr_bitstream.c b/formats/libchdr/libchdr_bitstream.c index 036c60d..1a6cf73 100644 --- a/formats/libchdr/libchdr_bitstream.c +++ b/formats/libchdr/libchdr_bitstream.c @@ -34,7 +34,6 @@ struct bitstream* create_bitstream(const void *src, uint32_t srclength) return bitstream; } - /*----------------------------------------------------- * bitstream_peek - fetch the requested number of bits * but don't advance the input pointer @@ -62,7 +61,6 @@ uint32_t bitstream_peek(struct bitstream* bitstream, int numbits) return bitstream->buffer >> (32 - numbits); } - /*----------------------------------------------------- * bitstream_remove - advance the input pointer by the * specified number of bits @@ -75,7 +73,6 @@ void bitstream_remove(struct bitstream* bitstream, int numbits) bitstream->bits -= numbits; } - /*----------------------------------------------------- * bitstream_read - fetch the requested number of bits *----------------------------------------------------- @@ -88,7 +85,6 @@ uint32_t bitstream_read(struct bitstream* bitstream, int numbits) return result; } - /*------------------------------------------------- * read_offset - return the current read offset *------------------------------------------------- @@ -106,7 +102,6 @@ uint32_t bitstream_read_offset(struct bitstream* bitstream) return result; } - /*------------------------------------------------- * flush - flush to the nearest byte *------------------------------------------------- diff --git a/formats/libchdr/libchdr_cdrom.c b/formats/libchdr/libchdr_cdrom.c index f59c171..f6876e0 100644 --- a/formats/libchdr/libchdr_cdrom.c +++ b/formats/libchdr/libchdr_cdrom.c @@ -66,8 +66,6 @@ void CLIB_DECL logerror(const char *text, ...) ATTR_PRINTF(1,2); #define LOG(x) #endif - - /*************************************************************************** CONSTANTS ***************************************************************************/ @@ -94,8 +92,6 @@ void CLIB_DECL logerror(const char *text, ...) ATTR_PRINTF(1,2); /** @brief 43 bytes each. */ #define ECC_Q_COMP 43 - - /** * @brief ------------------------------------------------- * ECC lookup tables pre-calculated tables for ECC data calcs @@ -303,7 +299,6 @@ static const uint16_t qoffsets[ECC_Q_NUM_BYTES][ECC_Q_COMP] = { 0x867,0x003,0x05b,0x0b3,0x10b,0x163,0x1bb,0x213,0x26b,0x2c3,0x31b,0x373,0x3cb,0x423,0x47b,0x4d3,0x52b,0x583,0x5db,0x633,0x68b,0x6e3,0x73b,0x793,0x7eb,0x843,0x89b,0x037,0x08f,0x0e7,0x13f,0x197,0x1ef,0x247,0x29f,0x2f7,0x34f,0x3a7,0x3ff,0x457,0x4af,0x507,0x55f } }; - /*------------------------------------------------- * ecc_source_byte - return data from the sector * at the given offset, masking anything diff --git a/formats/libchdr/libchdr_chd.c b/formats/libchdr/libchdr_chd.c index 79a50aa..ddb9512 100644 --- a/formats/libchdr/libchdr_chd.c +++ b/formats/libchdr/libchdr_chd.c @@ -986,7 +986,7 @@ chd_error chd_precache(chd_file *chd) size = filestream_tell(chd->file); if (size <= 0) return CHDERR_INVALID_DATA; - chd->file_cache = malloc(size); + chd->file_cache = (UINT8*)malloc(size); if (chd->file_cache == NULL) return CHDERR_OUT_OF_MEMORY; filestream_seek(chd->file, 0, SEEK_SET); @@ -1545,8 +1545,6 @@ static chd_error read_uncompressed(chd_file *chd, UINT64 offset, size_t size, UI return CHDERR_NONE; } - - /*------------------------------------------------- hunk_read_into_memory - read a hunk into memory at the given location diff --git a/formats/libchdr/libchdr_huffman.c b/formats/libchdr/libchdr_huffman.c index dd041a7..9d69a7b 100644 --- a/formats/libchdr/libchdr_huffman.c +++ b/formats/libchdr/libchdr_huffman.c @@ -232,7 +232,6 @@ enum huffman_error huffman_import_tree_rle(struct huffman_decoder* decoder, stru return bitstream_overflow(bitbuf) ? HUFFERR_INPUT_BUFFER_TOO_SMALL : HUFFERR_NONE; } - /*------------------------------------------------- * import_tree_huffman - import a huffman-encoded * huffman tree from a source data stream diff --git a/formats/tga/rtga.c b/formats/tga/rtga.c index 47017d7..d39ea57 100644 --- a/formats/tga/rtga.c +++ b/formats/tga/rtga.c @@ -37,7 +37,6 @@ #define RTGA_COMPUTE_Y(r, g, b) ((uint8_t)((((r) * 77) + ((g) * 150) + (29 * (b))) >> 8)) - struct rtga { uint8_t *buff_data; diff --git a/glsm/glsm.c b/glsm/glsm.c index 70fed4b..22ae5f2 100644 --- a/glsm/glsm.c +++ b/glsm/glsm.c @@ -131,7 +131,6 @@ struct gl_cached_state GLenum func; } depthfunc; - struct { bool used; @@ -335,7 +334,6 @@ void rglTexSubImage2D( width, height, format, type, pixels); } - void rglGetBufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, @@ -898,7 +896,6 @@ void rglCompressedTexImage2D(GLenum target, GLint level, width, height, border, imageSize, data); } - void rglDeleteFramebuffers(GLsizei n, const GLuint *framebuffers) { #ifdef GLSM_DEBUG @@ -1035,7 +1032,6 @@ void rglBindFragDataLocation(GLuint program, GLuint colorNumber, #endif } - /* * Category: Shaders * @@ -1140,7 +1136,6 @@ void rglEndQuery( GLenum target) #endif } - /* * Category: UBO * @@ -1505,7 +1500,6 @@ GLboolean rglIsProgram(GLuint program) return glIsProgram(program); } - void rglTexCoord2f(GLfloat s, GLfloat t) { #ifdef HAVE_LEGACY_GL @@ -1973,7 +1967,6 @@ void rglUniform4fv(GLint location, GLsizei count, const GLfloat *value) glUniform4fv(location, count, value); } - /* * * Core in: @@ -2208,7 +2201,6 @@ void rglTexImage2DMultisample( GLenum target, #endif } - void rglTexImage3D( GLenum target, GLint level, GLint internalFormat, diff --git a/include/compat/msvc/stdint.h b/include/compat/msvc/stdint.h index c791176..63baea0 100644 --- a/include/compat/msvc/stdint.h +++ b/include/compat/msvc/stdint.h @@ -67,7 +67,6 @@ extern "C" { # endif #endif - /* 7.18.1 Integer types. */ /* 7.18.1.1 Exact-width integer types. */ @@ -94,7 +93,6 @@ extern "C" { typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; - /* 7.18.1.2 Minimum-width integer types. */ typedef int8_t int_least8_t; typedef int16_t int_least16_t; diff --git a/include/compat/posix_string.h b/include/compat/posix_string.h index 46c1441..f4380c3 100644 --- a/include/compat/posix_string.h +++ b/include/compat/posix_string.h @@ -59,7 +59,6 @@ int isblank(int c); #endif - RETRO_END_DECLS #endif diff --git a/include/compat/zlib.h b/include/compat/zlib.h index 60fa3be..94110af 100644 --- a/include/compat/zlib.h +++ b/include/compat/zlib.h @@ -31,7 +31,6 @@ Jean-loup Gailly Mark Adler jloup@gzip.org madler@alumni.caltech.edu - The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). @@ -220,7 +219,6 @@ typedef gz_header FAR *gz_headerp; #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ - /* basic functions */ const char * zlibVersion (void); @@ -252,7 +250,6 @@ typedef gz_header FAR *gz_headerp; this will be done by deflate(). */ - int deflate (z_streamp strm, int flush); /* deflate compresses as much data as possible, and stops when the input @@ -359,7 +356,6 @@ typedef gz_header FAR *gz_headerp; space to continue compressing. */ - int deflateEnd (z_streamp strm); /* All dynamically allocated data structures for this stream are freed. @@ -373,7 +369,6 @@ typedef gz_header FAR *gz_headerp; deallocated). */ - /* int inflateInit (z_streamp strm); @@ -398,7 +393,6 @@ typedef gz_header FAR *gz_headerp; until inflate() is called. */ - int inflate (z_streamp strm, int flush); /* inflate decompresses as much data as possible, and stops when the input @@ -514,7 +508,6 @@ typedef gz_header FAR *gz_headerp; recovery of the data is desired. */ - int inflateEnd (z_streamp strm); /* All dynamically allocated data structures for this stream are freed. @@ -526,7 +519,6 @@ typedef gz_header FAR *gz_headerp; static string (which must not be deallocated). */ - /* Advanced functions */ /* @@ -1634,7 +1626,6 @@ uint32_t adler32 (uint32_t adler, const uint8_t *buf, size_t len); len2. */ - /* various hacks, don't look :) */ /* deflateInit and inflateInit are macros to allow checking the zlib version diff --git a/include/file/config_file.h b/include/file/config_file.h index d2d5b02..bf8102f 100644 --- a/include/file/config_file.h +++ b/include/file/config_file.h @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #ifndef __LIBRETRO_SDK_CONFIG_FILE_H #define __LIBRETRO_SDK_CONFIG_FILE_H @@ -64,7 +63,6 @@ struct config_file struct config_include_list *includes; }; - typedef struct config_file config_file_t; struct config_file_cb @@ -181,15 +179,19 @@ void config_set_bool(config_file_t *conf, const char *entry, bool val); void config_set_uint(config_file_t *conf, const char *key, unsigned int val); /* Write the current config to a file. */ -bool config_file_write(config_file_t *conf, const char *path); +bool config_file_write(config_file_t *conf, const char *path, bool val); /* Dump the current config to an already opened file. * Does not close the file. */ -void config_file_dump(config_file_t *conf, FILE *file); +void config_file_dump(config_file_t *conf, FILE *file, bool val); + +#ifdef ORBIS +void config_file_dump_orbis(config_file_t *conf, int fd); +#endif + bool config_file_exists(const char *path); RETRO_END_DECLS #endif - diff --git a/include/file/file_path.h b/include/file/file_path.h index b6b533a..51adab9 100644 --- a/include/file/file_path.h +++ b/include/file/file_path.h @@ -46,7 +46,6 @@ enum RARCH_FILE_UNSUPPORTED }; - /** * path_is_compressed_file: * @path : path diff --git a/include/formats/jsonsax.h b/include/formats/jsonsax.h index c98331f..837d5b2 100644 --- a/include/formats/jsonsax.h +++ b/include/formats/jsonsax.h @@ -29,7 +29,6 @@ RETRO_BEGIN_DECLS - enum { JSONSAX_OK = 0, diff --git a/include/gfx/math/matrix_3x3.h b/include/gfx/math/matrix_3x3.h index 791f1da..8dbf66c 100644 --- a/include/gfx/math/matrix_3x3.h +++ b/include/gfx/math/matrix_3x3.h @@ -197,7 +197,6 @@ static INLINE bool matrix_3x3_square_to_quad( e = dy3 - dy0 + h * dy3; } - matrix_3x3_init(*mat, a, d, g, b, e, h, diff --git a/include/gfx/scaler/pixconv.h b/include/gfx/scaler/pixconv.h index b83e0e7..27b98b0 100644 --- a/include/gfx/scaler/pixconv.h +++ b/include/gfx/scaler/pixconv.h @@ -29,7 +29,6 @@ RETRO_BEGIN_DECLS - void conv_0rgb1555_argb8888(void *output, const void *input, int width, int height, int out_stride, int in_stride); diff --git a/include/libchdr/bitstream.h b/include/libchdr/bitstream.h index d376373..271c89c 100644 --- a/include/libchdr/bitstream.h +++ b/include/libchdr/bitstream.h @@ -39,5 +39,4 @@ uint32_t bitstream_peek(struct bitstream* bitstream, int numbits); void bitstream_remove(struct bitstream* bitstream, int numbits); uint32_t bitstream_flush(struct bitstream* bitstream); - #endif diff --git a/include/libchdr/cdrom.h b/include/libchdr/cdrom.h index 232314e..041ff2f 100644 --- a/include/libchdr/cdrom.h +++ b/include/libchdr/cdrom.h @@ -15,7 +15,6 @@ #include - /*************************************************************************** CONSTANTS ***************************************************************************/ diff --git a/include/libchdr/chd.h b/include/libchdr/chd.h index 9b4df95..454de38 100644 --- a/include/libchdr/chd.h +++ b/include/libchdr/chd.h @@ -49,7 +49,6 @@ extern "C" { #include "coretypes.h" #include - /*************************************************************************** Compressed Hunks of Data header format. All numbers are stored in @@ -171,7 +170,6 @@ extern "C" { ***************************************************************************/ - /*************************************************************************** CONSTANTS ***************************************************************************/ @@ -279,8 +277,6 @@ enum _chd_error }; typedef enum _chd_error chd_error; - - /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ @@ -288,7 +284,6 @@ typedef enum _chd_error chd_error; /* opaque types */ typedef struct _chd_file chd_file; - /* extract header structure (NOT the on-disk header structure) */ typedef struct _chd_header chd_header; struct _chd_header @@ -321,7 +316,6 @@ struct _chd_header UINT32 obsolete_hunksize; /* obsolete field -- do not use! */ }; - /* structure for returning information about a verification pass */ typedef struct _chd_verify_result chd_verify_result; struct _chd_verify_result @@ -332,13 +326,10 @@ struct _chd_verify_result UINT8 metasha1[CHD_SHA1_BYTES]; /* SHA1 checksum of metadata */ }; - - /*************************************************************************** FUNCTION PROTOTYPES ***************************************************************************/ - /* ----- CHD file management ----- */ /* create a new CHD file fitting the given description */ @@ -364,31 +355,21 @@ RFILE *chd_core_file(chd_file *chd); /* return an error string for the given CHD error */ const char *chd_error_string(chd_error err); - - /* ----- CHD header management ----- */ /* return a pointer to the extracted CHD header data */ const chd_header *chd_get_header(chd_file *chd); - - - /* ----- core data read/write ----- */ /* read one hunk from the CHD file */ chd_error chd_read(chd_file *chd, UINT32 hunknum, void *buffer); - - /* ----- metadata management ----- */ /* get indexed metadata of a particular sort */ chd_error chd_get_metadata(chd_file *chd, UINT32 searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 *resultlen, UINT32 *resulttag, UINT8 *resultflags); - - - /* ----- codec interfaces ----- */ /* set internal codec parameters */ diff --git a/include/libchdr/huffman.h b/include/libchdr/huffman.h index 183bd74..ec5ef54 100644 --- a/include/libchdr/huffman.h +++ b/include/libchdr/huffman.h @@ -15,7 +15,6 @@ #include "bitstream.h" - /*************************************************************************** * CONSTANTS *************************************************************************** diff --git a/include/libchdr/libchdr_zlib.h b/include/libchdr/libchdr_zlib.h index 4f3f141..324faee 100644 --- a/include/libchdr/libchdr_zlib.h +++ b/include/libchdr/libchdr_zlib.h @@ -36,7 +36,6 @@ struct _zlib_codec_data zlib_allocator allocator; }; - /* codec-private data for the CDZL codec */ typedef struct _cdzl_codec_data cdzl_codec_data; struct _cdzl_codec_data { diff --git a/include/libretro_d3d.h b/include/libretro_d3d.h index d95931b..a0ba716 100644 --- a/include/libretro_d3d.h +++ b/include/libretro_d3d.h @@ -54,7 +54,6 @@ struct retro_hw_render_interface_d3d11 pD3DCompile D3DCompile; }; - #endif #endif /* LIBRETRO_DIRECT3D_H__ */ diff --git a/include/lists/dir_list.h b/include/lists/dir_list.h index 4babb02..d1d61d9 100644 --- a/include/lists/dir_list.h +++ b/include/lists/dir_list.h @@ -29,6 +29,23 @@ RETRO_BEGIN_DECLS +/** + * dir_list_append: + * @list : existing list to append to. + * @dir : directory path. + * @ext : allowed extensions of file directory entries to include. + * @include_dirs : include directories as part of the finished directory listing? + * @include_hidden : include hidden files and directories as part of the finished directory listing? + * @include_compressed : Only include files which match ext. Do not try to match compressed files, etc. + * @recursive : list directory contents recursively + * + * Create a directory listing, appending to an existing list + * + * Returns: true success, false in case of error. + **/ +bool dir_list_append(struct string_list *list, const char *dir, const char *ext, + bool include_dirs, bool include_hidden, bool include_compressed, bool recursive); + /** * dir_list_new: * @dir : directory path. diff --git a/include/lists/file_list.h b/include/lists/file_list.h index 208bf15..587967d 100644 --- a/include/lists/file_list.h +++ b/include/lists/file_list.h @@ -52,7 +52,6 @@ typedef struct file_list size_t size; } file_list_t; - void *file_list_get_userdata_at_offset(const file_list_t *list, size_t index); diff --git a/include/math/float_minmax.h b/include/math/float_minmax.h index 2164dde..9d446d6 100644 --- a/include/math/float_minmax.h +++ b/include/math/float_minmax.h @@ -58,5 +58,4 @@ static INLINE float float_max(float a, float b) #endif } - #endif diff --git a/include/net/net_compat.h b/include/net/net_compat.h index 789f944..516120a 100644 --- a/include/net/net_compat.h +++ b/include/net/net_compat.h @@ -46,7 +46,6 @@ #define MSG_NOSIGNAL 0 #endif - #elif defined(_XBOX) #define NOD3D diff --git a/include/net/net_ifinfo.h b/include/net/net_ifinfo.h index b1d2535..14fbf68 100644 --- a/include/net/net_ifinfo.h +++ b/include/net/net_ifinfo.h @@ -32,7 +32,6 @@ RETRO_BEGIN_DECLS - struct net_ifinfo_entry { char *name; @@ -53,5 +52,4 @@ bool net_ifinfo_new(net_ifinfo_t *list); RETRO_END_DECLS - #endif diff --git a/include/queues/task_queue.h b/include/queues/task_queue.h index 40c35dd..c0965ec 100644 --- a/include/queues/task_queue.h +++ b/include/queues/task_queue.h @@ -42,7 +42,6 @@ enum task_type TASK_TYPE_BLOCKING }; - typedef struct retro_task retro_task_t; typedef void (*retro_task_callback_t)(void *task_data, void *user_data, const char *error); @@ -210,7 +209,6 @@ void task_queue_push(retro_task_t *task); * This must only be called from the main thread. */ void task_queue_wait(retro_task_condition_fn_t cond, void* data); - /* Sends a signal to terminate all the tasks. * * This won't terminate the tasks immediately. diff --git a/include/retro_common_api.h b/include/retro_common_api.h index c3b3f49..fc4f745 100644 --- a/include/retro_common_api.h +++ b/include/retro_common_api.h @@ -113,6 +113,5 @@ Of course, another school of thought is that you should do as little damage as p in as few places as possible... */ - /* _LIBRETRO_COMMON_RETRO_COMMON_API_H */ #endif diff --git a/include/retro_environment.h b/include/retro_environment.h index e220c15..4a68046 100644 --- a/include/retro_environment.h +++ b/include/retro_environment.h @@ -101,6 +101,14 @@ printf("This is C++, version %d.\n", __cplusplus); #define __WINRT__ 1 #endif +/* MSVC obviously has to have some non-standard constants... */ +#if _M_IX86_FP == 1 +#define __SSE__ 1 +#elif _M_IX86_FP == 2 || (defined(_M_AMD64) || defined(_M_X64)) +#define __SSE__ 1 +#define __SSE2__ 1 +#endif + #endif #endif diff --git a/include/retro_miscellaneous.h b/include/retro_miscellaneous.h index 629ce12..bdb41f7 100644 --- a/include/retro_miscellaneous.h +++ b/include/retro_miscellaneous.h @@ -77,7 +77,7 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count) #ifndef PATH_MAX_LENGTH #if defined(__CELLOS_LV2__) #define PATH_MAX_LENGTH CELL_FS_MAX_FS_PATH_LENGTH -#elif defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) +#elif defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(ORBIS) #define PATH_MAX_LENGTH 512 #else #define PATH_MAX_LENGTH 4096 diff --git a/include/retro_timers.h b/include/retro_timers.h index d5526bc..884c078 100644 --- a/include/retro_timers.h +++ b/include/retro_timers.h @@ -96,7 +96,7 @@ static INLINE void retro_sleep(unsigned msec) #elif defined(_3DS) svcSleepThread(1000000 * (s64)msec); #elif defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP - /* TODO/FIXME */ + SleepEx(msec, FALSE); #elif defined(_WIN32) Sleep(msec); #elif defined(XENON) diff --git a/include/streams/interface_stream.h b/include/streams/interface_stream.h index 71d5c97..ec480c6 100644 --- a/include/streams/interface_stream.h +++ b/include/streams/interface_stream.h @@ -103,7 +103,6 @@ intfstream_t *intfstream_open_memory(void *data, intfstream_t *intfstream_open_chd_track(const char *path, unsigned mode, unsigned hints, int32_t track); - RETRO_END_DECLS #endif diff --git a/include/streams/trans_stream.h b/include/streams/trans_stream.h index 0a10368..9adc09a 100644 --- a/include/streams/trans_stream.h +++ b/include/streams/trans_stream.h @@ -39,7 +39,6 @@ RETRO_BEGIN_DECLS - enum trans_stream_error { TRANS_STREAM_ERROR_NONE = 0, diff --git a/include/utils/md5.h b/include/utils/md5.h index 6e84851..caf160b 100644 --- a/include/utils/md5.h +++ b/include/utils/md5.h @@ -32,7 +32,6 @@ RETRO_BEGIN_DECLS - /* Any 32-bit or wider unsigned integer data type will do */ typedef unsigned int MD5_u32plus; diff --git a/include/vulkan/vulkan_symbol_wrapper.h b/include/vulkan/vulkan_symbol_wrapper.h index 06f404e..ac891aa 100644 --- a/include/vulkan/vulkan_symbol_wrapper.h +++ b/include/vulkan/vulkan_symbol_wrapper.h @@ -348,7 +348,6 @@ VkBool32 vulkan_symbol_wrapper_load_device_symbol(VkDevice device, const char *n #define VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, name, pfn) vulkan_symbol_wrapper_load_device_symbol(device, name, (PFN_vkVoidFunction*) &(pfn)) #define VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_EXTENSION_SYMBOL(device, name) vulkan_symbol_wrapper_load_device_symbol(device, #name, (PFN_vkVoidFunction*) & name) - #ifdef __cplusplus } #endif diff --git a/lists/dir_list.c b/lists/dir_list.c index fc360f7..0972ec8 100644 --- a/lists/dir_list.c +++ b/lists/dir_list.c @@ -53,7 +53,6 @@ static int qstrcmp_dir(const void *a_, const void *b_) int a_type = a->attr.i; int b_type = b->attr.i; - /* Sort directories before files. */ if (a_type != b_type) return b_type - a_type; @@ -230,6 +229,42 @@ error: return -1; } +/** + * dir_list_append: + * @list : existing list to append to. + * @dir : directory path. + * @ext : allowed extensions of file directory entries to include. + * @include_dirs : include directories as part of the finished directory listing? + * @include_hidden : include hidden files and directories as part of the finished directory listing? + * @include_compressed : Only include files which match ext. Do not try to match compressed files, etc. + * @recursive : list directory contents recursively + * + * Create a directory listing, appending to an existing list + * + * Returns: true success, false in case of error. + **/ +bool dir_list_append(struct string_list *list, + const char *dir, + const char *ext, bool include_dirs, + bool include_hidden, bool include_compressed, + bool recursive) +{ + struct string_list *ext_list = NULL; + + if (ext) + ext_list = string_split(ext, "|"); + + if(dir_list_read(dir, list, ext_list, include_dirs, + include_hidden, include_compressed, recursive) == -1) + { + string_list_free(ext_list); + return false; + } + + string_list_free(ext_list); + return true; +} + /** * dir_list_new: * @dir : directory path. @@ -249,24 +284,18 @@ struct string_list *dir_list_new(const char *dir, bool include_hidden, bool include_compressed, bool recursive) { - struct string_list *ext_list = NULL; struct string_list *list = NULL; if (!(list = string_list_new())) return NULL; - if (ext) - ext_list = string_split(ext, "|"); - - if(dir_list_read(dir, list, ext_list, include_dirs, - include_hidden, include_compressed, recursive) == -1) + if (!dir_list_append(list, dir, ext, include_dirs, + include_hidden, include_compressed, recursive)) { string_list_free(list); - string_list_free(ext_list); return NULL; } - string_list_free(ext_list); return list; } diff --git a/lists/file_list.c b/lists/file_list.c index 1525d88..dcf03d4 100644 --- a/lists/file_list.c +++ b/lists/file_list.c @@ -136,7 +136,6 @@ size_t file_list_get_directory_ptr(const file_list_t *list) return list->list[size].directory_ptr; } - void file_list_pop(file_list_t *list, size_t *directory_ptr) { if (!list) diff --git a/memmap/memalign.c b/memmap/memalign.c index 449d847..c233296 100644 --- a/memmap/memalign.c +++ b/memmap/memalign.c @@ -25,7 +25,6 @@ #include - void *memalign_alloc(size_t boundary, size_t size) { void **place = NULL; @@ -54,9 +53,9 @@ void memalign_free(void *ptr) void *memalign_alloc_aligned(size_t size) { -#if defined(__x86_64__) || defined(__LP64) || defined(__IA64__) || defined(_M_X64) || defined(_WIN64) +#if defined(__x86_64__) || defined(__LP64) || defined(__IA64__) || defined(_M_X64) || defined(_M_X64) || defined(_WIN64) return memalign_alloc(64, size); -#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(GEKKO) +#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(GEKKO) || defined(_M_IX86) return memalign_alloc(32, size); #else return memalign_alloc(32, size); diff --git a/net/net_compat.c b/net/net_compat.c index ea45743..cec24a0 100644 --- a/net/net_compat.c +++ b/net/net_compat.c @@ -447,7 +447,6 @@ error: return NULL; } - /* convert presentation format to network format */ static const char * inet_ntop6x(const unsigned char *src, char *dst, size_t size) diff --git a/queues/fifo_queue.c b/queues/fifo_queue.c index d6b21ac..09fae57 100644 --- a/queues/fifo_queue.c +++ b/queues/fifo_queue.c @@ -64,7 +64,6 @@ void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size) buffer->end = (buffer->end + size) % buffer->size; } - void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t size) { size_t first_read = size; diff --git a/queues/message_queue.c b/queues/message_queue.c index a8086c3..f5af162 100644 --- a/queues/message_queue.c +++ b/queues/message_queue.c @@ -93,7 +93,6 @@ void msg_queue_free(msg_queue_t *queue) free(queue); } - /** * msg_queue_push: * @queue : pointer to queue object diff --git a/queues/task_queue.c b/queues/task_queue.c index 2eb51dd..7ca188e 100644 --- a/queues/task_queue.c +++ b/queues/task_queue.c @@ -401,7 +401,6 @@ static void retro_task_threaded_reset(void) slock_unlock(running_lock); } - static bool retro_task_threaded_find( retro_task_finder_t func, void *user_data) { diff --git a/rthreads/psp_pthread.h b/rthreads/psp_pthread.h index 007aa5c..7aea08a 100644 --- a/rthreads/psp_pthread.h +++ b/rthreads/psp_pthread.h @@ -62,7 +62,6 @@ typedef struct sthreadEntry start_routine; } sthread_args_struct; - static int psp_thread_wrap(SceSize args, void *argp) { sthread_args_struct* sthread_args = (sthread_args_struct*)argp; @@ -137,7 +136,6 @@ static INLINE int pthread_mutex_unlock(pthread_mutex_t *mutex) #endif } - static INLINE int pthread_join(pthread_t thread, void **retval) { #ifdef VITA @@ -238,7 +236,6 @@ static INLINE int pthread_cond_init(pthread_cond_t *cond, return 0; - #else /* FIXME: stub */ return 1; @@ -282,7 +279,6 @@ static INLINE int pthread_cond_destroy(pthread_cond_t *cond) #endif } - static INLINE int pthread_detach(pthread_t thread) { return 0; diff --git a/rthreads/rthreads.c b/rthreads/rthreads.c index 7c67d94..930f71b 100644 --- a/rthreads/rthreads.c +++ b/rthreads/rthreads.c @@ -853,9 +853,9 @@ bool scond_wait_timeout(scond_t *cond, slock_t *lock, int64_t timeout_us) now.tv_sec = s; now.tv_nsec = n; #elif defined(PS2) - int tickUS = cpu_ticks()/295.0; - now.tv_sec = tickUS/1000000; - now.tv_nsec = tickUS * 1000; + int tickms = clock(); + now.tv_sec = tickms/1000; + now.tv_nsec = tickms * 1000; #elif defined(__mips__) || defined(VITA) || defined(_3DS) struct timeval tm; diff --git a/samples/utils/Makefile b/samples/utils/Makefile index b9c785e..94942be 100644 --- a/samples/utils/Makefile +++ b/samples/utils/Makefile @@ -62,13 +62,11 @@ asflags := $(extra_flags) LDFLAGS := flags += -std=c99 -DMD5_BUILD_UTILITY -DSHA1_BUILD_UTILITY - ifeq (1,$(use_neon)) ASMFLAGS := -INEON/asm asflags += -mfpu=neon endif - OBJS += $(CORE_DIR)/djb2.o \ $(CORE_DIR)/md5.o \ $(CORE_DIR)/sha1.o \ diff --git a/streams/chd_stream.c b/streams/chd_stream.c index 669bd43..f622a78 100644 --- a/streams/chd_stream.c +++ b/streams/chd_stream.c @@ -251,7 +251,6 @@ chdstream_t *chdstream_open(const char *path, int32_t track) else pregap = 0; - stream->chd = chd; stream->frames_per_hunk = hd->hunkbytes / hd->unitbytes; stream->track_frame = meta.frame_offset; diff --git a/streams/file_stream.c b/streams/file_stream.c index 680a809..3a6f161 100644 --- a/streams/file_stream.c +++ b/streams/file_stream.c @@ -323,7 +323,6 @@ int filestream_eof(RFILE *stream) return stream->eof_flag; } - int64_t filestream_tell(RFILE *stream) { int64_t output; diff --git a/string/stdstring.c b/string/stdstring.c index 6d55cfe..af7f7ca 100644 --- a/string/stdstring.c +++ b/string/stdstring.c @@ -82,6 +82,10 @@ char *string_replace_substring(const char *in, outlen = strlen(in) - pattern_len*numhits + replacement_len*numhits; out = (char *)malloc(outlen+1); + + if (!out) + return NULL; + outat = out; inat = in; inprev = in; @@ -105,18 +109,17 @@ char *string_trim_whitespace_left(char *const s) { if(s && *s) { - size_t len = strlen(s); - char *cur = s; + size_t len = strlen(s); + char *current = s; - while(*cur && isspace((unsigned char)*cur)) + while(*current && isspace((unsigned char)*current)) { - ++cur; + ++current; --len; } - if(s != cur) - memmove(s, cur, len + 1); - + if(s != current) + memmove(s, current, len + 1); } return s; @@ -127,16 +130,16 @@ char *string_trim_whitespace_right(char *const s) { if(s && *s) { - size_t len = strlen(s); - char *cur = s + len - 1; + size_t len = strlen(s); + char *current = s + len - 1; - while(cur != s && isspace((unsigned char)*cur)) + while(current != s && isspace((unsigned char)*current)) { - --cur; + --current; --len; } - cur[isspace((unsigned char)*cur) ? 0 : 1] = '\0'; + current[isspace((unsigned char)*current) ? 0 : 1] = '\0'; } return s; diff --git a/utils/sha1_main.c b/utils/sha1_main.c index 1eb0c8e..55b0e0c 100644 --- a/utils/sha1_main.c +++ b/utils/sha1_main.c @@ -31,7 +31,6 @@ */ void usage(void); - /* * main * diff --git a/vfs/vfs_implementation.c b/vfs/vfs_implementation.c index 4721e72..c2232fd 100644 --- a/vfs/vfs_implementation.c +++ b/vfs/vfs_implementation.c @@ -56,6 +56,10 @@ # include # endif # include +# if defined(ORBIS) +# include +# include +# endif #endif #ifdef __CELLOS_LV2__ @@ -123,6 +127,7 @@ int64_t retro_vfs_file_seek_internal(libretro_vfs_implementation_file *stream, i goto error; if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0) + { /* VC2005 and up have a special 64-bit fseek */ #ifdef ATLEAST_VC2005 return _fseeki64(stream->fp, offset, whence); @@ -130,10 +135,18 @@ int64_t retro_vfs_file_seek_internal(libretro_vfs_implementation_file *stream, i return fseek(stream->fp, (long)offset, whence); #elif defined(PS2) return fioLseek(fileno(stream->fp), (off_t)offset, whence); +#elif defined(ORBIS) + int ret = orbisLseek(stream->fd, offset, whence); + + RARCH_LOG("[VFS]retro_vfs_file_seek_internal orbisLseek return %d on fd=%d filename=%s\n", ret, stream->fd, stream->orig_path); + + if (ret < 0) + return -1; + return 0; #else return fseeko(stream->fp, (off_t)offset, whence); #endif - + } #ifdef HAVE_MMAP /* Need to check stream->mapped because this function is * called in filestream_open() */ @@ -236,25 +249,28 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uns mode_str = "wb"; flags = O_WRONLY | O_CREAT | O_TRUNC; +#if !defined(ORBIS) #if defined(PS2) flags |= FIO_S_IRUSR | FIO_S_IWUSR; #elif !defined(_WIN32) flags |= S_IRUSR | S_IWUSR; #else flags |= O_BINARY; +#endif #endif break; case RETRO_VFS_FILE_ACCESS_READ_WRITE: mode_str = "w+b"; - flags = O_RDWR | O_CREAT | O_TRUNC; +#if !defined(ORBIS) #if defined(PS2) flags |= FIO_S_IRUSR | FIO_S_IWUSR; #elif !defined(_WIN32) flags |= S_IRUSR | S_IWUSR; #else flags |= O_BINARY; +#endif #endif break; @@ -263,12 +279,14 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uns mode_str = "r+b"; flags = O_RDWR; +#if !defined(ORBIS) #if defined(PS2) flags |= FIO_S_IRUSR | FIO_S_IWUSR; #elif !defined(_WIN32) flags |= S_IRUSR | S_IWUSR; #else flags |= O_BINARY; +#endif #endif break; @@ -278,6 +296,16 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uns if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0) { +#ifdef ORBIS + int fd = orbisOpen(path, flags, 0644); + RARCH_LOG("[VFS]retro_vfs_file_open_impl orbisOpen fd=%d path=%s\n", fd, path); + if( fd < 0) + { + stream->fd=-1; + goto error; + } + stream->fd = fd; +#else FILE *fp = (FILE*)fopen_utf8(path, mode_str); if (!fp) @@ -294,9 +322,10 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uns */ /* TODO: this is only useful for a few platforms, find which and add ifdef */ stream->fp = fp; -#if !defined(PS2) +#if !defined(PS2) /* TODO: PS2 IMPROVEMENT */ stream->buf = (char*)calloc(1, 0x4000); setvbuf(stream->fp, stream->buf, _IOFBF, 0x4000); +#endif #endif } else @@ -340,14 +369,18 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uns } #endif } - +#ifdef ORBIS + stream->size = orbisLseek(stream->fd, 0, SEEK_END); + orbisLseek(stream->fd, 0, SEEK_SET); + RARCH_LOG("[VFS]retro_vfs_file_open_impl size=%d fd=%d path=%s\n", stream->size, stream->fd, stream->orig_path); +#else retro_vfs_file_seek_internal(stream, 0, SEEK_SET); retro_vfs_file_seek_internal(stream, 0, SEEK_END); stream->size = retro_vfs_file_tell_impl(stream); retro_vfs_file_seek_internal(stream, 0, SEEK_SET); - +#endif return stream; error: @@ -374,7 +407,15 @@ int retro_vfs_file_close_impl(libretro_vfs_implementation_file *stream) } if (stream->fd > 0) + { +#ifdef ORBIS + RARCH_LOG("[VFS]retro_vfs_file_close_impl orbisClose fd=%d path=%s\n", stream->fd, stream->orig_path); + orbisClose(stream->fd); + stream->fd=-1; +#else close(stream->fd); +#endif + } if (stream->buf) free(stream->buf); if (stream->orig_path) @@ -386,7 +427,11 @@ int retro_vfs_file_close_impl(libretro_vfs_implementation_file *stream) int retro_vfs_file_error_impl(libretro_vfs_implementation_file *stream) { +#ifdef ORBIS + return 0; +#else return ferror(stream->fp); +#endif } int64_t retro_vfs_file_size_impl(libretro_vfs_implementation_file *stream) @@ -404,7 +449,7 @@ int64_t retro_vfs_file_truncate_impl(libretro_vfs_implementation_file *stream, i #ifdef _WIN32 if(_chsize(_fileno(stream->fp), length) != 0) return -1; -#elif !defined(VITA) && !defined(PSP) && !defined(PS2) && (!defined(SWITCH) || defined(HAVE_LIBNX)) +#elif !defined(VITA) && !defined(PSP) && !defined(PS2) && !defined(ORBIS) && (!defined(SWITCH) || defined(HAVE_LIBNX)) if(ftruncate(fileno(stream->fp), length) != 0) return -1; #endif @@ -418,13 +463,22 @@ int64_t retro_vfs_file_tell_impl(libretro_vfs_implementation_file *stream) return -1; if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0) + { +#ifdef ORBIS + int64_t ret = orbisLseek(stream->fd, 0, SEEK_CUR); + RARCH_LOG("[VFS]retro_vfs_file_tell_impl orbisLseek fd=%d path=%s ret=%d\n", stream->fd, stream->orig_path, ret); + if(ret < 0) + return -1; + return ret; +#else /* VC2005 and up have a special 64-bit ftell */ #ifdef ATLEAST_VC2005 return _ftelli64(stream->fp); #else return ftell(stream->fp); #endif - +#endif + } #ifdef HAVE_MMAP /* Need to check stream->mapped because this function * is called in filestream_open() */ @@ -437,7 +491,8 @@ int64_t retro_vfs_file_tell_impl(libretro_vfs_implementation_file *stream) return 0; } -int64_t retro_vfs_file_seek_impl(libretro_vfs_implementation_file *stream, int64_t offset, int seek_position) +int64_t retro_vfs_file_seek_impl(libretro_vfs_implementation_file *stream, + int64_t offset, int seek_position) { int whence = -1; switch (seek_position) @@ -456,14 +511,25 @@ int64_t retro_vfs_file_seek_impl(libretro_vfs_implementation_file *stream, int64 return retro_vfs_file_seek_internal(stream, offset, whence); } -int64_t retro_vfs_file_read_impl(libretro_vfs_implementation_file *stream, void *s, uint64_t len) +int64_t retro_vfs_file_read_impl(libretro_vfs_implementation_file *stream, + void *s, uint64_t len) { if (!stream || !s) goto error; if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0) - return fread(s, 1, (size_t)len, stream->fp); + { +#ifdef ORBIS + int64_t ret = orbisRead(stream->fd, s, (size_t)len); + RARCH_LOG("[VFS]retro_vfs_file_read_impl orbisRead fd=%d path=%s bytesread=%d\n", stream->fd, stream->orig_path, ret); + if( ret < 0) + return -1; + return 0; +#else + return fread(s, 1, (size_t)len, stream->fp); +#endif + } #ifdef HAVE_MMAP if (stream->hints & RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS) { @@ -492,8 +558,19 @@ int64_t retro_vfs_file_write_impl(libretro_vfs_implementation_file *stream, cons goto error; if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0) - return fwrite(s, 1, (size_t)len, stream->fp); + { +#ifdef ORBIS + int64_t ret = orbisWrite(stream->fd, s, (size_t)len); + RARCH_LOG("[VFS]retro_vfs_file_write_impl orbisWrite fd=%d path=%s byteswrite=%d\n", stream->fd, stream->orig_path, ret); + + if( ret < 0) + return -1; + return 0; +#else + return fwrite(s, 1, (size_t)len, stream->fp); +#endif + } #ifdef HAVE_MMAP if (stream->hints & RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS) goto error; @@ -508,7 +585,11 @@ int retro_vfs_file_flush_impl(libretro_vfs_implementation_file *stream) { if (!stream) return -1; +#ifdef ORBIS + return 0; +#else return fflush(stream->fp)==0 ? 0 : -1; +#endif } int retro_vfs_file_remove_impl(const char *path) @@ -546,9 +627,14 @@ int retro_vfs_file_remove_impl(const char *path) return 0; } #endif +#else +#ifdef ORBIS + /* stub for now */ + return 0; #else if (remove(path) == 0) return 0; +#endif #endif return -1; } @@ -609,9 +695,14 @@ int retro_vfs_file_rename_impl(const char *old_path, const char *new_path) free(new_path_wide); #endif return -1; +#else +#ifdef ORBIS + /* stub for now */ + return 0; #else return rename(old_path, new_path)==0 ? 0 : -1; #endif +#endif } const char *retro_vfs_file_get_path_impl(libretro_vfs_implementation_file *stream) diff --git a/vulkan/vulkan_symbol_wrapper.c b/vulkan/vulkan_symbol_wrapper.c index abf02dc..7fe13ea 100644 --- a/vulkan/vulkan_symbol_wrapper.c +++ b/vulkan/vulkan_symbol_wrapper.c @@ -176,7 +176,6 @@ PFN_vkGetInstanceProcAddr vulkan_symbol_wrapper_instance_proc_addr(void) return GetInstanceProcAddr; } - VkBool32 vulkan_symbol_wrapper_load_instance_symbol(VkInstance instance, const char *name, PFN_vkVoidFunction *ppSymbol) { *ppSymbol = GetInstanceProcAddr(instance, name);