diff --git a/audio/audio_mix.c b/audio/audio_mix.c index bd40ccb..795898c 100644 --- a/audio/audio_mix.c +++ b/audio/audio_mix.c @@ -111,20 +111,23 @@ void audio_mix_free_chunk(audio_chunk_t *chunk) audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate) { int sample_size; + ssize_t len = 0; + void *buf = NULL; audio_chunk_t *chunk = (audio_chunk_t*)calloc(1, sizeof(*chunk)); if (!chunk) return NULL; - chunk->sample_rate = sample_rate; - - if (!filestream_read_file(path, &chunk->buf, &chunk->len)) + if (!filestream_read_file(path, &buf, &len)) { printf("Could not open WAV file for reading.\n"); goto error; } - chunk->rwav = (rwav_t*)malloc(sizeof(rwav_t)); + chunk->sample_rate = sample_rate; + chunk->buf = buf; + chunk->len = len; + chunk->rwav = (rwav_t*)malloc(sizeof(rwav_t)); if (rwav_load(chunk->rwav, chunk->buf, chunk->len) == RWAV_ITERATE_ERROR) { diff --git a/audio/dsp_filters/ChipTuneEnhance.dsp b/audio/dsp_filters/ChipTuneEnhance.dsp index 41b2775..d45db3c 100644 --- a/audio/dsp_filters/ChipTuneEnhance.dsp +++ b/audio/dsp_filters/ChipTuneEnhance.dsp @@ -13,7 +13,7 @@ eq_gains = "6 9 12 7 6 5 7 9 11 6 0" reverb_damping = 0.8 reverb_roomwidth = 0.25 reverb_roomsize = 0.25 - + # IIR - filters out some harsh sounds on the upper end iir_type = RIAA_CD diff --git a/audio/dsp_filters/Makefile b/audio/dsp_filters/Makefile index d3c228c..ab0900f 100644 --- a/audio/dsp_filters/Makefile +++ b/audio/dsp_filters/Makefile @@ -64,7 +64,7 @@ asflags := $(ASFLAGS) -fPIC $(extra_flags) objects := ifeq (1,$(use_neon)) - ASMFLAGS := -INEON/asm + ASMFLAGS := -INEON/asm asflags += -mfpu=neon endif diff --git a/audio/resampler/drivers/sinc_resampler_neon.S b/audio/resampler/drivers/sinc_resampler_neon.S index 50942bf..033104e 100644 --- a/audio/resampler/drivers/sinc_resampler_neon.S +++ b/audio/resampler/drivers/sinc_resampler_neon.S @@ -39,7 +39,7 @@ process_sinc_neon_asm: _process_sinc_neon_asm: - push {r4, lr} + push {r4, lr} vmov.f32 q0, #0.0 vmov.f32 q8, #0.0 @@ -68,7 +68,7 @@ _process_sinc_neon_asm: vadd.f32 d16, d16, d17 vpadd.f32 d0, d0, d16 vst1.f32 d0, [r0] - + pop {r4, pc} #endif diff --git a/file/config_file.c b/file/config_file.c index 306aa7d..72f1014 100644 --- a/file/config_file.c +++ b/file/config_file.c @@ -44,7 +44,6 @@ #include #include #include -#include #define MAX_INCLUDE_DEPTH 16 @@ -78,6 +77,40 @@ struct config_file static config_file_t *config_file_new_internal( const char *path, unsigned depth); +static char *getaline(FILE *file) +{ + char* newline = (char*)malloc(9); + char* newline_tmp = NULL; + size_t cur_size = 8; + size_t idx = 0; + int in = fgetc(file); + + if (!newline) + return NULL; + + while (in != EOF && in != '\n') + { + if (idx == cur_size) + { + cur_size *= 2; + newline_tmp = (char*)realloc(newline, cur_size + 1); + + if (!newline_tmp) + { + free(newline); + return NULL; + } + + newline = newline_tmp; + } + + newline[idx++] = in; + in = fgetc(file); + } + newline[idx] = '\0'; + return newline; +} + static char *strip_comment(char *str) { /* Remove everything after comment. @@ -190,7 +223,7 @@ static void add_child_list(config_file_t *parent, config_file_t *child) /* Rebase tail. */ if (parent->entries) { - struct config_entry_list *head = + struct config_entry_list *head = (struct config_entry_list*)parent->entries; while (head->next) @@ -311,11 +344,10 @@ static bool parse_line(config_file_t *conf, key[idx++] = *line++; } - key[idx] = '\0'; - list->key = key; - - list->value = extract_value(line, true); + key[idx] = '\0'; + list->key = key; + list->value = extract_value(line, true); if (!list->value) { list->key = NULL; @@ -332,7 +364,7 @@ error: static config_file_t *config_file_new_internal( const char *path, unsigned depth) { - RFILE *file = NULL; + FILE *file = NULL; struct config_file *conf = (struct config_file*)malloc(sizeof(*conf)); if (!conf) return NULL; @@ -354,9 +386,7 @@ static config_file_t *config_file_new_internal( goto error; conf->include_depth = depth; - file = filestream_open(path, - RETRO_VFS_FILE_ACCESS_READ, - RETRO_VFS_FILE_ACCESS_HINT_NONE); + file = fopen_utf8(path, "r"); if (!file) { @@ -364,7 +394,7 @@ static config_file_t *config_file_new_internal( goto error; } - while (!filestream_eof(file)) + while (!feof(file)) { char *line = NULL; struct config_entry_list *list = (struct config_entry_list*)malloc(sizeof(*list)); @@ -372,7 +402,7 @@ static config_file_t *config_file_new_internal( if (!list) { config_file_free(conf); - filestream_close(file); + fclose(file); return NULL; } @@ -381,7 +411,7 @@ static config_file_t *config_file_new_internal( list->value = NULL; list->next = NULL; - line = filestream_getline(file); + line = getaline(file); if (!line) { @@ -405,7 +435,7 @@ static config_file_t *config_file_new_internal( free(list); } - filestream_close(file); + fclose(file); return conf; @@ -490,7 +520,7 @@ config_file_t *config_file_new_from_string(const char *from_string) conf->tail = NULL; conf->includes = NULL; conf->include_depth = 0; - + lines = string_split(from_string, "\n"); if (!lines) return conf; @@ -542,8 +572,11 @@ config_file_t *config_file_new(const char *path) static struct config_entry_list *config_get_entry(const config_file_t *conf, const char *key, struct config_entry_list **prev) { - struct config_entry_list *entry = NULL; - struct config_entry_list *previous = prev ? *prev : NULL; + struct config_entry_list *entry; + struct config_entry_list *previous = NULL; + + if (prev) + previous = *prev; for (entry = conf->entries; entry; entry = entry->next) { diff --git a/glsym/glgen.py b/glsym/glgen.py index 531f9de..3e2c810 100755 --- a/glsym/glgen.py +++ b/glsym/glgen.py @@ -2,7 +2,7 @@ """ License statement applies to this file (glgen.py) only. -""" +""" """ Permission is hereby granted, free of charge, diff --git a/glsym/rglgen.py b/glsym/rglgen.py index 579ba17..897d8cb 100755 --- a/glsym/rglgen.py +++ b/glsym/rglgen.py @@ -2,7 +2,7 @@ """ License statement applies to this file (glgen.py) only. -""" +""" """ Permission is hereby granted, free of charge, diff --git a/include/net/net_compat.h b/include/net/net_compat.h index dc8cdc1..7a182af 100644 --- a/include/net/net_compat.h +++ b/include/net/net_compat.h @@ -156,8 +156,10 @@ static INLINE bool isagain(int bytes) if (WSAGetLastError() != WSAEWOULDBLOCK) return false; return true; +#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) + return (sys_net_errno == SYS_NET_EWOULDBLOCK) || (sys_net_errno == SYS_NET_EAGAIN);//35 #elif defined(VITA) - return (bytes<0 && (bytes == SCE_NET_ERROR_EAGAIN || bytes == SCE_NET_ERROR_EWOULDBLOCK)); + return (bytes<0 && (bytes == SCE_NET_ERROR_EAGAIN || bytes == SCE_NET_ERROR_EWOULDBLOCK)); #elif defined(WIIU) return (bytes == -1) && ((socketlasterr() == SO_SUCCESS) || (socketlasterr() == SO_EWOULDBLOCK)); #else diff --git a/include/retro_miscellaneous.h b/include/retro_miscellaneous.h index 4768b90..02aa521 100644 --- a/include/retro_miscellaneous.h +++ b/include/retro_miscellaneous.h @@ -42,6 +42,13 @@ #include #endif +static INLINE void bits_or_bits(uint32_t *a, uint32_t *b, uint32_t count) +{ + uint32_t i; + for (i = 0; i < count;i++) + a[i] |= b[i]; +} + static INLINE void bits_clear_bits(uint32_t *a, uint32_t *b, uint32_t count) { uint32_t i; diff --git a/net/net_compat.c b/net/net_compat.c index 9238ebc..a5ab125 100644 --- a/net/net_compat.c +++ b/net/net_compat.c @@ -193,12 +193,6 @@ int getaddrinfo_retro(const char *node, const char *service, in_addr->sin_family = AF_INET; in_addr->sin_port = inet_htons(strtoul(service, NULL, 0)); - //sin_port seems to be the wrong endian for ps3 - #if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) - in_addr->sin_port = (in_addr->sin_port>>8) | (in_addr->sin_port<<8); - #endif - - if (!node && (hints->ai_flags & AI_PASSIVE)) in_addr->sin_addr.s_addr = INADDR_ANY; else if (node && isdigit(*node)) diff --git a/samples/utils/Makefile b/samples/utils/Makefile index 28cab5d..ec251f2 100644 --- a/samples/utils/Makefile +++ b/samples/utils/Makefile @@ -62,7 +62,7 @@ CC := $(compiler) CXX := $(subst CC,++,$(compiler)) flags := -fPIC $(extra_flags) -I$(LIBRETRO_COMM_DIR)/include asflags := -fPIC $(extra_flags) -LDFLAGS := +LDFLAGS := flags += -std=c99 -DMD5_BUILD_UTILITY -DSHA1_BUILD_UTILITY diff --git a/streams/file_stream.c b/streams/file_stream.c index 64a321a..b193974 100644 --- a/streams/file_stream.c +++ b/streams/file_stream.c @@ -97,7 +97,7 @@ bool filestream_exists(const char *path) if (!path || !*path) return false; - + dummy = filestream_open(path, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE); diff --git a/streams/interface_stream.c b/streams/interface_stream.c index 44177aa..5edb5fd 100644 --- a/streams/interface_stream.c +++ b/streams/interface_stream.c @@ -161,6 +161,7 @@ int intfstream_close(intfstream_internal_t *intf) case INTFSTREAM_FILE: if (intf->file.fp) return filestream_close(intf->file.fp); + return 0; case INTFSTREAM_MEMORY: if (intf->memory.fp) memstream_close(intf->memory.fp); diff --git a/vfs/vfs_implementation.c b/vfs/vfs_implementation.c index 0171e06..9f7b216 100644 --- a/vfs/vfs_implementation.c +++ b/vfs/vfs_implementation.c @@ -124,10 +124,10 @@ int64_t retro_vfs_file_seek_internal(libretro_vfs_implementation_file *stream, i #ifdef HAVE_MMAP /* Need to check stream->mapped because this function is * called in filestream_open() */ - if (stream->mapped && stream->hints & + if (stream->mapped && stream->hints & RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS) { - /* fseek() returns error on under/overflow but + /* fseek() returns error on under/overflow but * allows cursor > EOF for read-only file descriptors. */ switch (whence)