mirror of
https://github.com/libretro/libretro-common.git
synced 2025-02-26 11:36:14 +00:00
Updates
This commit is contained in:
parent
164bf715e3
commit
d5cdb5af73
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
|
@ -64,7 +64,7 @@ asflags := $(ASFLAGS) -fPIC $(extra_flags)
|
||||
objects :=
|
||||
|
||||
ifeq (1,$(use_neon))
|
||||
ASMFLAGS := -INEON/asm
|
||||
ASMFLAGS := -INEON/asm
|
||||
asflags += -mfpu=neon
|
||||
endif
|
||||
|
||||
|
@ -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
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include <file/file_path.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <streams/file_stream.h>
|
||||
|
||||
#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)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
"""
|
||||
License statement applies to this file (glgen.py) only.
|
||||
"""
|
||||
"""
|
||||
|
||||
"""
|
||||
Permission is hereby granted, free of charge,
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
"""
|
||||
License statement applies to this file (glgen.py) only.
|
||||
"""
|
||||
"""
|
||||
|
||||
"""
|
||||
Permission is hereby granted, free of charge,
|
||||
|
@ -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
|
||||
|
@ -42,6 +42,13 @@
|
||||
#include <compat/msvc.h>
|
||||
#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;
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user