libretro-common: update
Signed-off-by: Mahyar Koshkouei <mahyar.koshkouei@gmail.com>
This commit is contained in:
parent
dde40b7732
commit
e3077ac078
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (audio_mix.c).
|
||||
|
@ -111,7 +111,7 @@ 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;
|
||||
int64_t len = 0;
|
||||
void *buf = NULL;
|
||||
audio_chunk_t *chunk = (audio_chunk_t*)calloc(1, sizeof(*chunk));
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (audio_mixer.c).
|
||||
|
@ -44,7 +44,18 @@
|
|||
#define STB_VORBIS_NO_STDIO
|
||||
#define STB_VORBIS_NO_CRT
|
||||
|
||||
#include <stb_vorbis.h>
|
||||
#include <stb/stb_vorbis.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DR_FLAC
|
||||
#define DR_FLAC_IMPLEMENTATION
|
||||
#include <dr/dr_flac.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_DR_MP3
|
||||
#define DR_MP3_IMPLEMENTATION
|
||||
#include <dr/dr_mp3.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IBXM
|
||||
|
@ -52,7 +63,7 @@
|
|||
#endif
|
||||
|
||||
#define AUDIO_MIXER_MAX_VOICES 8
|
||||
#define AUDIO_MIXER_TEMP_OGG_BUFFER 8192
|
||||
#define AUDIO_MIXER_TEMP_BUFFER 8192
|
||||
|
||||
struct audio_mixer_sound
|
||||
{
|
||||
|
@ -76,6 +87,24 @@ struct audio_mixer_sound
|
|||
} ogg;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DR_FLAC
|
||||
struct
|
||||
{
|
||||
/* flac */
|
||||
unsigned size;
|
||||
const void* data;
|
||||
} flac;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DR_MP3
|
||||
struct
|
||||
{
|
||||
/* mp */
|
||||
unsigned size;
|
||||
const void* data;
|
||||
} mp3;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IBXM
|
||||
struct
|
||||
{
|
||||
|
@ -116,6 +145,34 @@ struct audio_mixer_voice
|
|||
} ogg;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DR_FLAC
|
||||
struct
|
||||
{
|
||||
unsigned position;
|
||||
unsigned samples;
|
||||
unsigned buf_samples;
|
||||
float* buffer;
|
||||
float ratio;
|
||||
drflac *stream;
|
||||
void *resampler_data;
|
||||
const retro_resampler_t *resampler;
|
||||
} flac;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DR_MP3
|
||||
struct
|
||||
{
|
||||
unsigned position;
|
||||
unsigned samples;
|
||||
unsigned buf_samples;
|
||||
float* buffer;
|
||||
float ratio;
|
||||
drmp3 stream;
|
||||
void *resampler_data;
|
||||
const retro_resampler_t *resampler;
|
||||
} mp3;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IBXM
|
||||
struct
|
||||
{
|
||||
|
@ -343,6 +400,43 @@ 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
|
||||
audio_mixer_sound_t* sound = (audio_mixer_sound_t*)calloc(1, sizeof(*sound));
|
||||
|
||||
if (!sound)
|
||||
return NULL;
|
||||
|
||||
sound->type = AUDIO_MIXER_TYPE_FLAC;
|
||||
sound->types.flac.size = size;
|
||||
sound->types.flac.data = buffer;
|
||||
|
||||
return sound;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
audio_mixer_sound_t* audio_mixer_load_mp3(void *buffer, int32_t size)
|
||||
{
|
||||
#ifdef HAVE_DR_MP3
|
||||
audio_mixer_sound_t* sound = (audio_mixer_sound_t*)calloc(1, sizeof(*sound));
|
||||
|
||||
if (!sound)
|
||||
return NULL;
|
||||
|
||||
sound->type = AUDIO_MIXER_TYPE_MP3;
|
||||
sound->types.mp3.size = size;
|
||||
sound->types.mp3.data = buffer;
|
||||
|
||||
return sound;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
audio_mixer_sound_t* audio_mixer_load_mod(void *buffer, int32_t size)
|
||||
{
|
||||
#ifdef HAVE_IBXM
|
||||
|
@ -386,6 +480,20 @@ void audio_mixer_destroy(audio_mixer_sound_t* sound)
|
|||
handle = (void*)sound->types.mod.data;
|
||||
if (handle)
|
||||
free(handle);
|
||||
#endif
|
||||
break;
|
||||
case AUDIO_MIXER_TYPE_FLAC:
|
||||
#ifdef HAVE_DR_FLAC
|
||||
handle = (void*)sound->types.flac.data;
|
||||
if (handle)
|
||||
free(handle);
|
||||
#endif
|
||||
break;
|
||||
case AUDIO_MIXER_TYPE_MP3:
|
||||
#ifdef HAVE_DR_MP3
|
||||
handle = (void*)sound->types.mp3.data;
|
||||
if (handle)
|
||||
free(handle);
|
||||
#endif
|
||||
break;
|
||||
case AUDIO_MIXER_TYPE_NONE:
|
||||
|
@ -412,7 +520,7 @@ static bool audio_mixer_play_ogg(
|
|||
{
|
||||
stb_vorbis_info info;
|
||||
int res = 0;
|
||||
float ratio = 0.0f;
|
||||
float ratio = 1.0f;
|
||||
unsigned samples = 0;
|
||||
void *ogg_buffer = NULL;
|
||||
void *resampler_data = NULL;
|
||||
|
@ -436,7 +544,7 @@ static bool audio_mixer_play_ogg(
|
|||
goto error;
|
||||
}
|
||||
|
||||
samples = (unsigned)(AUDIO_MIXER_TEMP_OGG_BUFFER * ratio);
|
||||
samples = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
|
||||
ogg_buffer = (float*)memalign_alloc(16,
|
||||
((samples + 15) & ~15) * sizeof(float));
|
||||
|
||||
|
@ -531,6 +639,113 @@ error:
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_DR_FLAC
|
||||
static bool audio_mixer_play_flac(
|
||||
audio_mixer_sound_t* sound,
|
||||
audio_mixer_voice_t* voice,
|
||||
bool repeat, float volume,
|
||||
audio_mixer_stop_cb_t stop_cb)
|
||||
{
|
||||
float ratio = 1.0f;
|
||||
unsigned samples = 0;
|
||||
void *flac_buffer = NULL;
|
||||
void *resampler_data = NULL;
|
||||
const retro_resampler_t* resamp = NULL;
|
||||
drflac *dr_flac = drflac_open_memory((const unsigned char*)sound->types.flac.data,sound->types.flac.size);
|
||||
|
||||
|
||||
if (!dr_flac)
|
||||
return false;
|
||||
if (dr_flac->sampleRate != s_rate)
|
||||
{
|
||||
ratio = (double)s_rate / (double)(dr_flac->sampleRate);
|
||||
|
||||
if (!retro_resampler_realloc(&resampler_data,
|
||||
&resamp, NULL, RESAMPLER_QUALITY_DONTCARE,
|
||||
ratio))
|
||||
goto error;
|
||||
}
|
||||
|
||||
samples = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
|
||||
flac_buffer = (float*)memalign_alloc(16,
|
||||
((samples + 15) & ~15) * sizeof(float));
|
||||
|
||||
if (!flac_buffer)
|
||||
{
|
||||
resamp->free(resampler_data);
|
||||
goto error;
|
||||
}
|
||||
|
||||
voice->types.flac.resampler = resamp;
|
||||
voice->types.flac.resampler_data = resampler_data;
|
||||
voice->types.flac.buffer = (float*)flac_buffer;
|
||||
voice->types.flac.buf_samples = samples;
|
||||
voice->types.flac.ratio = ratio;
|
||||
voice->types.flac.stream = dr_flac;
|
||||
voice->types.flac.position = 0;
|
||||
voice->types.flac.samples = 0;
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
drflac_close(dr_flac);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DR_MP3
|
||||
static bool audio_mixer_play_mp3(
|
||||
audio_mixer_sound_t* sound,
|
||||
audio_mixer_voice_t* voice,
|
||||
bool repeat, float volume,
|
||||
audio_mixer_stop_cb_t stop_cb)
|
||||
{
|
||||
float ratio = 1.0f;
|
||||
unsigned samples = 0;
|
||||
void *mp3_buffer = NULL;
|
||||
void *resampler_data = NULL;
|
||||
const retro_resampler_t* resamp = NULL;
|
||||
bool res =drmp3_init_memory(&voice->types.mp3.stream,(const unsigned char*)sound->types.mp3.data,sound->types.mp3.size,NULL);
|
||||
if (!res)
|
||||
return false;
|
||||
if (voice->types.mp3.stream.sampleRate != s_rate)
|
||||
{
|
||||
ratio = (double)s_rate / (double)(voice->types.mp3.stream.sampleRate);
|
||||
|
||||
if (!retro_resampler_realloc(&resampler_data,
|
||||
&resamp, NULL, RESAMPLER_QUALITY_DONTCARE,
|
||||
ratio))
|
||||
goto error;
|
||||
}
|
||||
|
||||
samples = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
|
||||
mp3_buffer = (float*)memalign_alloc(16,
|
||||
((samples + 15) & ~15) * sizeof(float));
|
||||
|
||||
if (!mp3_buffer)
|
||||
{
|
||||
resamp->free(resampler_data);
|
||||
goto error;
|
||||
}
|
||||
|
||||
voice->types.mp3.resampler = resamp;
|
||||
voice->types.mp3.resampler_data = resampler_data;
|
||||
voice->types.mp3.buffer = (float*)mp3_buffer;
|
||||
voice->types.mp3.buf_samples = samples;
|
||||
voice->types.mp3.ratio = ratio;
|
||||
voice->types.mp3.position = 0;
|
||||
voice->types.mp3.samples = 0;
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
drmp3_uninit(&voice->types.mp3.stream);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
audio_mixer_voice_t* audio_mixer_play(audio_mixer_sound_t* sound, bool repeat,
|
||||
float volume, audio_mixer_stop_cb_t stop_cb)
|
||||
{
|
||||
|
@ -563,6 +778,16 @@ audio_mixer_voice_t* audio_mixer_play(audio_mixer_sound_t* sound, bool repeat,
|
|||
case AUDIO_MIXER_TYPE_MOD:
|
||||
#ifdef HAVE_IBXM
|
||||
res = audio_mixer_play_mod(sound, voice, repeat, volume, stop_cb);
|
||||
#endif
|
||||
break;
|
||||
case AUDIO_MIXER_TYPE_FLAC:
|
||||
#ifdef HAVE_DR_FLAC
|
||||
res = audio_mixer_play_flac(sound, voice, repeat, volume, stop_cb);
|
||||
#endif
|
||||
break;
|
||||
case AUDIO_MIXER_TYPE_MP3:
|
||||
#ifdef HAVE_DR_MP3
|
||||
res = audio_mixer_play_mp3(sound, voice, repeat, volume, stop_cb);
|
||||
#endif
|
||||
break;
|
||||
case AUDIO_MIXER_TYPE_NONE:
|
||||
|
@ -665,9 +890,9 @@ static void audio_mixer_mix_ogg(float* buffer, size_t num_frames,
|
|||
float volume)
|
||||
{
|
||||
int i;
|
||||
struct resampler_data info;
|
||||
float temp_buffer[AUDIO_MIXER_TEMP_OGG_BUFFER];
|
||||
unsigned buf_free = num_frames * 2;
|
||||
struct resampler_data info = { 0 };
|
||||
float temp_buffer[AUDIO_MIXER_TEMP_BUFFER] = { 0 };
|
||||
unsigned buf_free = (unsigned)(num_frames * 2);
|
||||
unsigned temp_samples = 0;
|
||||
float* pcm = NULL;
|
||||
|
||||
|
@ -676,7 +901,7 @@ static void audio_mixer_mix_ogg(float* buffer, size_t num_frames,
|
|||
again:
|
||||
temp_samples = stb_vorbis_get_samples_float_interleaved(
|
||||
voice->types.ogg.stream, 2, temp_buffer,
|
||||
AUDIO_MIXER_TEMP_OGG_BUFFER) * 2;
|
||||
AUDIO_MIXER_TEMP_BUFFER) * 2;
|
||||
|
||||
if (temp_samples == 0)
|
||||
{
|
||||
|
@ -704,7 +929,10 @@ again:
|
|||
info.output_frames = 0;
|
||||
info.ratio = voice->types.ogg.ratio;
|
||||
|
||||
if (voice->types.ogg.resampler)
|
||||
voice->types.ogg.resampler->process(voice->types.ogg.resampler_data, &info);
|
||||
else
|
||||
memcpy(voice->types.ogg.buffer, temp_buffer, temp_samples * sizeof(float));
|
||||
voice->types.ogg.position = 0;
|
||||
voice->types.ogg.samples = voice->types.ogg.buf_samples;
|
||||
}
|
||||
|
@ -740,7 +968,7 @@ static void audio_mixer_mix_mod(float* buffer, size_t num_frames,
|
|||
float samplef = 0.0f;
|
||||
int samplei = 0;
|
||||
unsigned temp_samples = 0;
|
||||
unsigned buf_free = num_frames * 2;
|
||||
unsigned buf_free = (unsigned)(num_frames * 2);
|
||||
int* pcm = NULL;
|
||||
|
||||
if (voice->types.mod.position == voice->types.mod.samples)
|
||||
|
@ -806,6 +1034,151 @@ again:
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DR_FLAC
|
||||
static void audio_mixer_mix_flac(float* buffer, size_t num_frames,
|
||||
audio_mixer_voice_t* voice,
|
||||
float volume)
|
||||
{
|
||||
int i;
|
||||
struct resampler_data info = { 0 };
|
||||
float temp_buffer[AUDIO_MIXER_TEMP_BUFFER] = { 0 };
|
||||
unsigned buf_free = (unsigned)(num_frames * 2);
|
||||
unsigned temp_samples = 0;
|
||||
float* pcm = NULL;
|
||||
|
||||
if (voice->types.flac.position == voice->types.flac.samples)
|
||||
{
|
||||
again:
|
||||
temp_samples = drflac_read_f32( voice->types.flac.stream, AUDIO_MIXER_TEMP_BUFFER, temp_buffer);
|
||||
if (temp_samples == 0)
|
||||
{
|
||||
if (voice->repeat)
|
||||
{
|
||||
if (voice->stop_cb)
|
||||
voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_REPEATED);
|
||||
|
||||
drflac_seek_to_sample(voice->types.flac.stream,0);
|
||||
goto again;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (voice->stop_cb)
|
||||
voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_FINISHED);
|
||||
|
||||
voice->type = AUDIO_MIXER_TYPE_NONE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
info.data_in = temp_buffer;
|
||||
info.data_out = voice->types.flac.buffer;
|
||||
info.input_frames = temp_samples / 2;
|
||||
info.output_frames = 0;
|
||||
info.ratio = voice->types.flac.ratio;
|
||||
|
||||
if (voice->types.flac.resampler)
|
||||
voice->types.flac.resampler->process(voice->types.flac.resampler_data, &info);
|
||||
else
|
||||
memcpy(voice->types.flac.buffer, temp_buffer, temp_samples * sizeof(float));
|
||||
voice->types.flac.position = 0;
|
||||
voice->types.flac.samples = voice->types.flac.buf_samples;
|
||||
}
|
||||
|
||||
pcm = voice->types.flac.buffer + voice->types.flac.position;
|
||||
|
||||
if (voice->types.flac.samples < buf_free)
|
||||
{
|
||||
for (i = voice->types.flac.samples; i != 0; i--)
|
||||
*buffer++ += *pcm++ * volume;
|
||||
|
||||
buf_free -= voice->types.flac.samples;
|
||||
goto again;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for (i = buf_free; i != 0; --i )
|
||||
*buffer++ += *pcm++ * volume;
|
||||
|
||||
voice->types.flac.position += buf_free;
|
||||
voice->types.flac.samples -= buf_free;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DR_MP3
|
||||
static void audio_mixer_mix_mp3(float* buffer, size_t num_frames,
|
||||
audio_mixer_voice_t* voice,
|
||||
float volume)
|
||||
{
|
||||
int i;
|
||||
struct resampler_data info = { 0 };
|
||||
float temp_buffer[AUDIO_MIXER_TEMP_BUFFER] = { 0 };
|
||||
unsigned buf_free = (unsigned)(num_frames * 2);
|
||||
unsigned temp_samples = 0;
|
||||
float* pcm = NULL;
|
||||
|
||||
if (voice->types.mp3.position == voice->types.mp3.samples)
|
||||
{
|
||||
again:
|
||||
temp_samples = drmp3_read_f32(&voice->types.mp3.stream, AUDIO_MIXER_TEMP_BUFFER/2, temp_buffer) * 2;
|
||||
|
||||
if (temp_samples == 0)
|
||||
{
|
||||
if (voice->repeat)
|
||||
{
|
||||
if (voice->stop_cb)
|
||||
voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_REPEATED);
|
||||
|
||||
drmp3_seek_to_frame(&voice->types.mp3.stream,0);
|
||||
goto again;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (voice->stop_cb)
|
||||
voice->stop_cb(voice->sound, AUDIO_MIXER_SOUND_FINISHED);
|
||||
|
||||
voice->type = AUDIO_MIXER_TYPE_NONE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
info.data_in = temp_buffer;
|
||||
info.data_out = voice->types.mp3.buffer;
|
||||
info.input_frames = temp_samples / 2;
|
||||
info.output_frames = 0;
|
||||
info.ratio = voice->types.mp3.ratio;
|
||||
|
||||
if (voice->types.mp3.resampler)
|
||||
voice->types.mp3.resampler->process(voice->types.mp3.resampler_data, &info);
|
||||
else
|
||||
memcpy(voice->types.mp3.buffer, temp_buffer, temp_samples * sizeof(float));
|
||||
voice->types.mp3.position = 0;
|
||||
voice->types.mp3.samples = voice->types.mp3.buf_samples;
|
||||
}
|
||||
|
||||
pcm = voice->types.mp3.buffer + voice->types.mp3.position;
|
||||
|
||||
if (voice->types.mp3.samples < buf_free)
|
||||
{
|
||||
for (i = voice->types.mp3.samples; i != 0; i--)
|
||||
*buffer++ += *pcm++ * volume;
|
||||
|
||||
buf_free -= voice->types.mp3.samples;
|
||||
goto again;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for (i = buf_free; i != 0; --i )
|
||||
*buffer++ += *pcm++ * volume;
|
||||
|
||||
voice->types.mp3.position += buf_free;
|
||||
voice->types.mp3.samples -= buf_free;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void audio_mixer_mix(float* buffer, size_t num_frames, float volume_override, bool override)
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -834,6 +1207,16 @@ void audio_mixer_mix(float* buffer, size_t num_frames, float volume_override, bo
|
|||
case AUDIO_MIXER_TYPE_MOD:
|
||||
#ifdef HAVE_IBXM
|
||||
audio_mixer_mix_mod(buffer, num_frames, voice, volume);
|
||||
#endif
|
||||
break;
|
||||
case AUDIO_MIXER_TYPE_FLAC:
|
||||
#ifdef HAVE_DR_FLAC
|
||||
audio_mixer_mix_flac(buffer, num_frames, voice, volume);
|
||||
#endif
|
||||
break;
|
||||
case AUDIO_MIXER_TYPE_MP3:
|
||||
#ifdef HAVE_DR_MP3
|
||||
audio_mixer_mix_mp3(buffer, num_frames, voice, volume);
|
||||
#endif
|
||||
break;
|
||||
case AUDIO_MIXER_TYPE_NONE:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (float_to_s16.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (float_to_s16_neon.S).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (float_to_s16_neon.S).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (s16_to_float.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (s16_to_float_neon.S).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (s16_to_float_neon.S).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (dsp_filter.c).
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
filters = 1
|
||||
filter0 = tremolo
|
||||
|
||||
# Defaults.
|
||||
#tremolo_frequency = 4.0
|
||||
#tremolo_depth = 0.9
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
filters = 1
|
||||
filter0 = vibrato
|
||||
|
||||
# Defaults.
|
||||
#vibrato_frequency = 5.0
|
||||
#vibrato_depth = 0.5
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (fft.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (fft.h).
|
||||
|
|
|
@ -91,37 +91,13 @@ static const float initialwidth = 1;
|
|||
static const float initialmode = 0;
|
||||
static const float freezemode = 0.5f;
|
||||
|
||||
#define combtuningL1 1116
|
||||
#define combtuningL2 1188
|
||||
#define combtuningL3 1277
|
||||
#define combtuningL4 1356
|
||||
#define combtuningL5 1422
|
||||
#define combtuningL6 1491
|
||||
#define combtuningL7 1557
|
||||
#define combtuningL8 1617
|
||||
#define allpasstuningL1 556
|
||||
#define allpasstuningL2 441
|
||||
#define allpasstuningL3 341
|
||||
#define allpasstuningL4 225
|
||||
|
||||
struct revmodel
|
||||
{
|
||||
struct comb combL[numcombs];
|
||||
struct allpass allpassL[numallpasses];
|
||||
|
||||
float bufcombL1[combtuningL1];
|
||||
float bufcombL2[combtuningL2];
|
||||
float bufcombL3[combtuningL3];
|
||||
float bufcombL4[combtuningL4];
|
||||
float bufcombL5[combtuningL5];
|
||||
float bufcombL6[combtuningL6];
|
||||
float bufcombL7[combtuningL7];
|
||||
float bufcombL8[combtuningL8];
|
||||
|
||||
float bufallpassL1[allpasstuningL1];
|
||||
float bufallpassL2[allpasstuningL2];
|
||||
float bufallpassL3[allpasstuningL3];
|
||||
float bufallpassL4[allpasstuningL4];
|
||||
float **bufcomb;
|
||||
float **bufallpass;
|
||||
|
||||
float gain;
|
||||
float roomsize, roomsize1;
|
||||
|
@ -210,21 +186,29 @@ static void revmodel_setmode(struct revmodel *rev, float value)
|
|||
revmodel_update(rev);
|
||||
}
|
||||
|
||||
static void revmodel_init(struct revmodel *rev)
|
||||
static void revmodel_init(struct revmodel *rev,int srate)
|
||||
{
|
||||
rev->combL[0].buffer = rev->bufcombL1; rev->combL[0].bufsize = combtuningL1;
|
||||
rev->combL[1].buffer = rev->bufcombL2; rev->combL[1].bufsize = combtuningL2;
|
||||
rev->combL[2].buffer = rev->bufcombL3; rev->combL[2].bufsize = combtuningL3;
|
||||
rev->combL[3].buffer = rev->bufcombL4; rev->combL[3].bufsize = combtuningL4;
|
||||
rev->combL[4].buffer = rev->bufcombL5; rev->combL[4].bufsize = combtuningL5;
|
||||
rev->combL[5].buffer = rev->bufcombL6; rev->combL[5].bufsize = combtuningL6;
|
||||
rev->combL[6].buffer = rev->bufcombL7; rev->combL[6].bufsize = combtuningL7;
|
||||
rev->combL[7].buffer = rev->bufcombL8; rev->combL[7].bufsize = combtuningL8;
|
||||
|
||||
rev->allpassL[0].buffer = rev->bufallpassL1; rev->allpassL[0].bufsize = allpasstuningL1;
|
||||
rev->allpassL[1].buffer = rev->bufallpassL2; rev->allpassL[1].bufsize = allpasstuningL2;
|
||||
rev->allpassL[2].buffer = rev->bufallpassL3; rev->allpassL[2].bufsize = allpasstuningL3;
|
||||
rev->allpassL[3].buffer = rev->bufallpassL4; rev->allpassL[3].bufsize = allpasstuningL4;
|
||||
static const int comb_lengths[8] = { 1116,1188,1277,1356,1422,1491,1557,1617 };
|
||||
static const int allpass_lengths[4] = { 225,341,441,556 };
|
||||
double r = srate * (1 / 44100.0);
|
||||
unsigned c;
|
||||
|
||||
rev->bufcomb=malloc(numcombs*sizeof(float*));
|
||||
for (c = 0; c < numcombs; ++c)
|
||||
{
|
||||
rev->bufcomb[c] = malloc(r*comb_lengths[c]*sizeof(float));
|
||||
rev->combL[c].buffer = rev->bufcomb[c];
|
||||
rev->combL[c].bufsize=r*comb_lengths[c];
|
||||
}
|
||||
|
||||
rev->bufallpass=malloc(numallpasses*sizeof(float*));
|
||||
for (c = 0; c < numallpasses; ++c)
|
||||
{
|
||||
rev->bufallpass[c] = malloc(r*allpass_lengths[c]*sizeof(float));
|
||||
rev->allpassL[c].buffer = rev->bufallpass[c];
|
||||
rev->allpassL[c].bufsize=r*allpass_lengths[c];
|
||||
}
|
||||
|
||||
rev->allpassL[0].feedback = 0.5f;
|
||||
rev->allpassL[1].feedback = 0.5f;
|
||||
|
@ -246,6 +230,22 @@ struct reverb_data
|
|||
|
||||
static void reverb_free(void *data)
|
||||
{
|
||||
struct reverb_data *rev = (struct reverb_data*)data;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < numcombs; i++) {
|
||||
free(rev->left.bufcomb[i]);
|
||||
free(rev->right.bufcomb[i]);
|
||||
}
|
||||
free(rev->left.bufcomb);
|
||||
free(rev->right.bufcomb);
|
||||
|
||||
for (i = 0; i < numallpasses; i++) {
|
||||
free(rev->left.bufallpass[i]);
|
||||
free(rev->right.bufallpass[i]);
|
||||
}
|
||||
free(rev->left.bufallpass);
|
||||
free(rev->right.bufallpass);
|
||||
free(data);
|
||||
}
|
||||
|
||||
|
@ -284,8 +284,8 @@ static void *reverb_init(const struct dspfilter_info *info,
|
|||
config->get_float(userdata, "roomwidth", &roomwidth, 0.56f);
|
||||
config->get_float(userdata, "roomsize", &roomsize, 0.56f);
|
||||
|
||||
revmodel_init(&rev->left);
|
||||
revmodel_init(&rev->right);
|
||||
revmodel_init(&rev->left,info->input_rate);
|
||||
revmodel_init(&rev->right,info->input_rate);
|
||||
|
||||
revmodel_setdamp(&rev->left, damping);
|
||||
revmodel_setdry(&rev->left, drytime);
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (tremolo.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 <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#define sqr(a) ((a) * (a))
|
||||
|
||||
struct tremolo_core
|
||||
{
|
||||
float freq;
|
||||
float depth;
|
||||
float* wavetable;
|
||||
int index;
|
||||
int maxindex;
|
||||
};
|
||||
|
||||
struct tremolo
|
||||
{
|
||||
struct tremolo_core left, right;
|
||||
};
|
||||
|
||||
static void tremolo_free(void *data)
|
||||
{
|
||||
struct tremolo *tre = (struct tremolo*)data;
|
||||
free(tre->left.wavetable);
|
||||
free(tre->right.wavetable);
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void tremolocore_init(struct tremolo_core *core,float depth,int samplerate,float freq)
|
||||
{
|
||||
const double offset = 1. - depth / 2.;
|
||||
unsigned i;
|
||||
double env;
|
||||
core->index = 0;
|
||||
core->maxindex = samplerate/freq;
|
||||
core->wavetable = malloc(core->maxindex*sizeof(float));
|
||||
memset(core->wavetable, 0, core->maxindex * sizeof(float));
|
||||
for (i = 0; i < core->maxindex; i++) {
|
||||
env = freq * i / samplerate;
|
||||
env = sin((M_PI*2) * fmod(env + 0.25, 1.0));
|
||||
core->wavetable[i] = env * (1 - fabs(offset)) + offset;
|
||||
}
|
||||
}
|
||||
|
||||
float tremolocore_core(struct tremolo_core *core,float in)
|
||||
{
|
||||
core->index = core->index % core->maxindex;
|
||||
return in * core->wavetable[core->index++];
|
||||
}
|
||||
|
||||
static void tremolo_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct tremolo *tre = (struct tremolo*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float in[2] = { out[0], out[1] };
|
||||
|
||||
out[0] = tremolocore_core(&tre->left, in[0]);
|
||||
out[1] = tremolocore_core(&tre->right, in[1]);
|
||||
}
|
||||
}
|
||||
|
||||
static void *tremolo_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
float freq, depth;
|
||||
struct tremolo *tre = (struct tremolo*)calloc(1, sizeof(*tre));
|
||||
if (!tre)
|
||||
return NULL;
|
||||
|
||||
config->get_float(userdata, "freq", &freq,4.0f);
|
||||
config->get_float(userdata, "depth", &depth, 0.9f);
|
||||
tremolocore_init(&tre->left,depth,info->input_rate,freq);
|
||||
tremolocore_init(&tre->right,depth,info->input_rate,freq);
|
||||
return tre;
|
||||
}
|
||||
|
||||
static const struct dspfilter_implementation tremolo_plug = {
|
||||
tremolo_init,
|
||||
tremolo_process,
|
||||
tremolo_free,
|
||||
|
||||
DSPFILTER_API_VERSION,
|
||||
"Tremolo",
|
||||
"tremolo",
|
||||
};
|
||||
|
||||
#ifdef HAVE_FILTERS_BUILTIN
|
||||
#define dspfilter_get_implementation tremolo_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &tremolo_plug;
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (vibrato.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 <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#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;
|
||||
const float VIBRATO_DEPTH_DEFAULT_PERCENT = 50;
|
||||
const int add_delay = 3;
|
||||
|
||||
float hermite_interp(float x, float *y)
|
||||
{
|
||||
float c0, c1, c2, c3;
|
||||
c0 = y[1];
|
||||
c1 = (1.0 / 2.0)*(y[2] - y[0]);
|
||||
c2 = (y[0] - (5.0 / 2.0)*y[1]) + (2.0*y[2] - (1.0 / 2.0)*y[3]);
|
||||
c3 = (1.0 / 2.0)*(y[3] - y[0]) + (3.0 / 2.0)*(y[1] - y[2]);
|
||||
return ((c3*x + c2)*x + c1)*x + c0;
|
||||
}
|
||||
|
||||
struct vibrato_core
|
||||
{
|
||||
float freq;
|
||||
float samplerate;
|
||||
int phase;
|
||||
float depth;
|
||||
float* buffer;
|
||||
int writeindex;
|
||||
int size;
|
||||
};
|
||||
|
||||
struct vibrato
|
||||
{
|
||||
struct vibrato_core left, right;
|
||||
};
|
||||
|
||||
static void vibrato_free(void *data)
|
||||
{
|
||||
struct vibrato *vib = (struct vibrato*)data;
|
||||
free(vib->left.buffer);
|
||||
free(vib->right.buffer);
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void vibratocore_init(struct vibrato_core *core,float depth,int samplerate,float freq)
|
||||
{
|
||||
core->size = BASE_DELAY_SEC * samplerate * 2;
|
||||
core->buffer = malloc((core->size + add_delay)*sizeof(float));
|
||||
memset(core->buffer, 0, (core->size + add_delay) * sizeof(float));
|
||||
core->samplerate = samplerate;
|
||||
core->freq = freq;
|
||||
core->depth = depth;
|
||||
core->phase = 0;
|
||||
core->writeindex = 0;
|
||||
}
|
||||
|
||||
float vibratocore_core(struct vibrato_core *core,float in)
|
||||
{
|
||||
float M = core->freq / core->samplerate;
|
||||
int maxphase = core->samplerate / core->freq;
|
||||
float lfo = sin(M * 2. * M_PI * core->phase++);
|
||||
core->phase = core->phase % maxphase;
|
||||
lfo = (lfo + 1) * 1.; // transform from [-1; 1] to [0; 1]
|
||||
int maxdelay = BASE_DELAY_SEC * core->samplerate;
|
||||
float delay = lfo * core->depth * maxdelay;
|
||||
delay += add_delay;
|
||||
float readindex = core->writeindex - 1 - delay;
|
||||
while (readindex < 0)readindex += core->size;
|
||||
while (readindex >= core->size)readindex -= core->size;
|
||||
int ipart = (int)readindex; // integer part of the delay
|
||||
float fpart = readindex - ipart; // fractional part of the delay
|
||||
float value = hermite_interp(fpart, &(core->buffer[ipart]));
|
||||
core->buffer[core->writeindex] = in;
|
||||
if (core->writeindex < add_delay){
|
||||
core->buffer[core->size + core->writeindex] = in;
|
||||
}
|
||||
core->writeindex++;
|
||||
if (core->writeindex == core->size) {
|
||||
core->writeindex = 0;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
static void vibrato_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct vibrato *vib = (struct vibrato*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float in[2] = { out[0], out[1] };
|
||||
|
||||
out[0] = vibratocore_core(&vib->left, in[0]);
|
||||
out[1] = vibratocore_core(&vib->right, in[1]);
|
||||
}
|
||||
}
|
||||
|
||||
static void *vibrato_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
float freq, depth;
|
||||
struct vibrato *vib = (struct vibrato*)calloc(1, sizeof(*vib));
|
||||
if (!vib)
|
||||
return NULL;
|
||||
|
||||
config->get_float(userdata, "freq", &freq,5.0f);
|
||||
config->get_float(userdata, "depth", &depth, 0.5f);
|
||||
vibratocore_init(&vib->left,depth,info->input_rate,freq);
|
||||
vibratocore_init(&vib->right,depth,info->input_rate,freq);
|
||||
return vib;
|
||||
}
|
||||
|
||||
static const struct dspfilter_implementation vibrato_plug = {
|
||||
vibrato_init,
|
||||
vibrato_process,
|
||||
vibrato_free,
|
||||
|
||||
DSPFILTER_API_VERSION,
|
||||
"Vibrato",
|
||||
"vibrato",
|
||||
};
|
||||
|
||||
#ifdef HAVE_FILTERS_BUILTIN
|
||||
#define dspfilter_get_implementation vibrato_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &vibrato_plug;
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (audio_resampler.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (nearest_resampler.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (null_resampler.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (sinc_resampler.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (sinc_resampler_neon.S).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (compat_fnmatch.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (compat_getopt.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (compat_posix_string.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (compat_snprintf.c).
|
||||
|
@ -24,8 +24,9 @@
|
|||
#ifdef _MSC_VER
|
||||
|
||||
#include <retro_common.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#if _MSC_VER >= 1800
|
||||
#include <stdio.h> /* added for _vsnprintf_s and _vscprintf on VS2015 and VS2017 */
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
|
||||
#if _MSC_VER < 1800
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (compat_strcasestr.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (compat_strl.c).
|
||||
|
|
|
@ -1,5 +1,28 @@
|
|||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (fopen_utf8.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 <compat/fopen_utf8.h>
|
||||
#include <encodings/utf.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX)
|
||||
|
@ -11,7 +34,7 @@
|
|||
#ifdef _WIN32
|
||||
#undef fopen
|
||||
|
||||
FILE* fopen_utf8(const char * filename, const char * mode)
|
||||
void *fopen_utf8(const char * filename, const char * mode)
|
||||
{
|
||||
#if defined(_XBOX)
|
||||
return fopen(filename, mode);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (dylib.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (encoding_crc32.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (encoding_utf.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (features_cpu.c).
|
||||
|
@ -219,6 +219,8 @@ retro_time_t cpu_features_get_time_usec(void)
|
|||
return sys_time_get_system_time();
|
||||
#elif defined(GEKKO)
|
||||
return ticks_to_microsecs(gettime());
|
||||
#elif defined(SWITCH)
|
||||
return (svcGetSystemTick() * 10) / 192;
|
||||
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(ANDROID) || defined(__MACH__)
|
||||
struct timespec tv = {0};
|
||||
if (ra_clock_gettime(CLOCK_MONOTONIC, &tv) < 0)
|
||||
|
@ -236,8 +238,6 @@ retro_time_t cpu_features_get_time_usec(void)
|
|||
return sceKernelGetProcessTimeWide();
|
||||
#elif defined(WIIU)
|
||||
return ticks_to_us(OSGetSystemTime());
|
||||
#elif defined(SWITCH)
|
||||
return (svcGetSystemTick() * 10) / 192;
|
||||
#else
|
||||
#error "Your platform does not have a timer function implemented in cpu_features_get_time_usec(). Cannot continue."
|
||||
#endif
|
||||
|
@ -649,6 +649,10 @@ uint64_t cpu_features_get(void)
|
|||
if (sysctlbyname("hw.optional.neon", NULL, &len, NULL, 0) == 0)
|
||||
cpu |= RETRO_SIMD_NEON;
|
||||
|
||||
#elif defined(_XBOX1)
|
||||
cpu |= RETRO_SIMD_MMX;
|
||||
cpu |= RETRO_SIMD_SSE;
|
||||
cpu |= RETRO_SIMD_MMXEXT;
|
||||
#elif defined(CPU_X86)
|
||||
(void)avx_flags;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (archive_file.c).
|
||||
|
@ -129,7 +129,7 @@ static void file_archive_free(file_archive_file_data_t *data)
|
|||
|
||||
static file_archive_file_data_t* file_archive_open(const char *path)
|
||||
{
|
||||
ssize_t ret = -1;
|
||||
int64_t ret = -1;
|
||||
bool read_from_file = false;
|
||||
file_archive_file_data_t *data = (file_archive_file_data_t*)
|
||||
calloc(1, sizeof(*data));
|
||||
|
@ -722,7 +722,7 @@ error:
|
|||
*/
|
||||
int file_archive_compressed_read(
|
||||
const char * path, void **buf,
|
||||
const char* optional_filename, ssize_t *length)
|
||||
const char* optional_filename, int64_t *length)
|
||||
{
|
||||
const struct file_archive_file_backend *backend = NULL;
|
||||
int ret = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (archive_file_sevenzip.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (archive_file_zlib.c).
|
||||
|
@ -240,7 +240,7 @@ static int zip_file_read(
|
|||
const char *needle, void **buf,
|
||||
const char *optional_outfile)
|
||||
{
|
||||
file_archive_transfer_t zlib;
|
||||
file_archive_transfer_t zlib = {0};
|
||||
struct archive_extract_userdata userdata = {{0}};
|
||||
bool returnerr = true;
|
||||
int ret = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (config_file.c).
|
||||
|
@ -862,7 +862,7 @@ bool config_file_write(config_file_t *conf, const char *path)
|
|||
if (!string_is_empty(path))
|
||||
{
|
||||
void* buf = NULL;
|
||||
FILE *file = fopen_utf8(path, "wb");
|
||||
FILE *file = (FILE*)fopen_utf8(path, "wb");
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (config_file_userdata.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (file_path.c).
|
||||
|
@ -392,7 +392,7 @@ char *path_remove_extension(char *path)
|
|||
return NULL;
|
||||
if (*last)
|
||||
*last = '\0';
|
||||
return last;
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -793,7 +793,7 @@ bool path_is_absolute(const char *path)
|
|||
**/
|
||||
void path_resolve_realpath(char *buf, size_t size)
|
||||
{
|
||||
#ifndef RARCH_CONSOLE
|
||||
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
|
||||
tmp[0] = '\0';
|
||||
|
@ -971,7 +971,7 @@ void fill_short_pathname_representation_noext(char* out_rep,
|
|||
void fill_pathname_expand_special(char *out_path,
|
||||
const char *in_path, size_t size)
|
||||
{
|
||||
#if !defined(RARCH_CONSOLE)
|
||||
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
||||
if (*in_path == '~')
|
||||
{
|
||||
const char *home = getenv("HOME");
|
||||
|
@ -1020,7 +1020,7 @@ void fill_pathname_expand_special(char *out_path,
|
|||
void fill_pathname_abbreviate_special(char *out_path,
|
||||
const char *in_path, size_t size)
|
||||
{
|
||||
#if !defined(RARCH_CONSOLE)
|
||||
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
||||
unsigned i;
|
||||
const char *candidates[3];
|
||||
const char *notations[3];
|
||||
|
@ -1107,7 +1107,7 @@ void path_basedir_wrapper(char *path)
|
|||
snprintf(path, 3, ".%s", path_default_slash());
|
||||
}
|
||||
|
||||
#if !defined(RARCH_CONSOLE)
|
||||
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
||||
void fill_pathname_application_path(char *s, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (nbio_intf.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (nbio_linux.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (nbio_stdio.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (nbio_unixmmap.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (nbio_windowsmmap.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_dirent.c).
|
||||
|
@ -106,8 +106,14 @@ struct RDIR *retro_opendir(const char *name)
|
|||
wchar_t *path_wide = NULL;
|
||||
unsigned path_len;
|
||||
#endif
|
||||
struct RDIR *rdir = (struct RDIR*)calloc(1, sizeof(*rdir));
|
||||
struct RDIR *rdir;
|
||||
|
||||
/*Reject null or empty string paths*/
|
||||
if (!name||(*name==0))
|
||||
return NULL;
|
||||
|
||||
/*Allocate RDIR struct. Tidied later with retro_closedir*/
|
||||
rdir = (struct RDIR*)calloc(1, sizeof(*rdir));
|
||||
if (!rdir)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rbmp.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rbmp_encode.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (image_texture.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (image_transfer.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rjpeg.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (jsonsax.c).
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -49,7 +50,9 @@
|
|||
#include <zlib.h>
|
||||
#include <LzmaEnc.h>
|
||||
#include <LzmaDec.h>
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <streams/file_stream.h>
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
@ -253,7 +256,7 @@ struct _chd_file
|
|||
{
|
||||
UINT32 cookie; /* cookie, should equal COOKIE_VALUE */
|
||||
|
||||
core_file * file; /* handle to the open core file */
|
||||
RFILE * file; /* handle to the open core file */
|
||||
UINT8 owns_file; /* flag indicating if this file should be closed on chd_close() */
|
||||
chd_header header; /* header, extracted from file */
|
||||
|
||||
|
@ -280,6 +283,7 @@ struct _chd_file
|
|||
#ifdef NEED_CACHE_HUNK
|
||||
UINT32 maxhunk; /* maximum hunk accessed */
|
||||
#endif
|
||||
UINT8 * file_cache; /* cache of underlying file */
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -405,9 +409,10 @@ void *lzma_fast_alloc(void *p, size_t size)
|
|||
}
|
||||
|
||||
/* alloc a new one and put it into the list */
|
||||
addr = (uint32_t *)malloc(sizeof(uint8_t) * (size + sizeof(uint32_t)));
|
||||
if (addr==NULL)
|
||||
addr = (uint32_t *)malloc(sizeof(uint32_t) * (size + sizeof(uint32_t)));
|
||||
if (!addr)
|
||||
return NULL;
|
||||
|
||||
for (scan = 0; scan < MAX_LZMA_ALLOCS; scan++)
|
||||
{
|
||||
if (codec->allocptr[scan] == NULL)
|
||||
|
@ -465,7 +470,7 @@ chd_error lzma_codec_init(void* codec, uint32_t hunkbytes)
|
|||
{
|
||||
CLzmaEncProps encoder_props;
|
||||
CLzmaEncHandle enc;
|
||||
Byte decoder_props[LZMA_PROPS_SIZE];
|
||||
uint8_t decoder_props[LZMA_PROPS_SIZE];
|
||||
lzma_allocator* alloc;
|
||||
size_t props_size;
|
||||
lzma_codec_data* lzma_codec = (lzma_codec_data*) codec;
|
||||
|
@ -1146,8 +1151,8 @@ static chd_error decompress_v5_map(chd_file* chd, chd_header* header)
|
|||
}
|
||||
|
||||
/* read the reader */
|
||||
core_fseek(chd->file, header->mapoffset, SEEK_SET);
|
||||
core_fread(chd->file, rawbuf, sizeof(rawbuf));
|
||||
filestream_seek(chd->file, header->mapoffset, SEEK_SET);
|
||||
filestream_read(chd->file, rawbuf, sizeof(rawbuf));
|
||||
mapbytes = get_bigendian_uint32(&rawbuf[0]);
|
||||
firstoffs = get_bigendian_uint48(&rawbuf[4]);
|
||||
mapcrc = get_bigendian_uint16(&rawbuf[10]);
|
||||
|
@ -1160,8 +1165,8 @@ static chd_error decompress_v5_map(chd_file* chd, chd_header* header)
|
|||
if (compressed == NULL)
|
||||
return CHDERR_OUT_OF_MEMORY;
|
||||
|
||||
core_fseek(chd->file, header->mapoffset + 16, SEEK_SET);
|
||||
core_fread(chd->file, compressed, mapbytes);
|
||||
filestream_seek(chd->file, header->mapoffset + 16, SEEK_SET);
|
||||
filestream_read(chd->file, compressed, mapbytes);
|
||||
bitbuf = create_bitstream(compressed, sizeof(uint8_t) * mapbytes);
|
||||
if (bitbuf == NULL)
|
||||
{
|
||||
|
@ -1313,7 +1318,7 @@ static INLINE void map_extract_old(const UINT8 *base, map_entry *entry, UINT32 h
|
|||
chd_open_file - open a CHD file for access
|
||||
-------------------------------------------------*/
|
||||
|
||||
chd_error chd_open_file(core_file *file, int mode, chd_file *parent, chd_file **chd)
|
||||
chd_error chd_open_file(RFILE *file, int mode, chd_file *parent, chd_file **chd)
|
||||
{
|
||||
chd_file *newchd = NULL;
|
||||
chd_error err;
|
||||
|
@ -1405,13 +1410,13 @@ chd_error chd_open_file(core_file *file, int mode, chd_file *parent, chd_file **
|
|||
/* find the codec interface */
|
||||
if (newchd->header.version < 5)
|
||||
{
|
||||
for (intfnum = 0; intfnum < ARRAY_LENGTH(codec_interfaces); intfnum++)
|
||||
for (intfnum = 0; intfnum < ARRAY_SIZE(codec_interfaces); intfnum++)
|
||||
if (codec_interfaces[intfnum].compression == newchd->header.compression[0])
|
||||
{
|
||||
newchd->codecintf[0] = &codec_interfaces[intfnum];
|
||||
break;
|
||||
}
|
||||
if (intfnum == ARRAY_LENGTH(codec_interfaces))
|
||||
if (intfnum == ARRAY_SIZE(codec_interfaces))
|
||||
EARLY_EXIT(err = CHDERR_UNSUPPORTED_FORMAT);
|
||||
|
||||
/* initialize the codec */
|
||||
|
@ -1425,9 +1430,9 @@ chd_error chd_open_file(core_file *file, int mode, chd_file *parent, chd_file **
|
|||
{
|
||||
int i, decompnum;
|
||||
/* verify the compression types and initialize the codecs */
|
||||
for (decompnum = 0; decompnum < ARRAY_LENGTH(newchd->header.compression); decompnum++)
|
||||
for (decompnum = 0; decompnum < ARRAY_SIZE(newchd->header.compression); decompnum++)
|
||||
{
|
||||
for (i = 0 ; i < ARRAY_LENGTH(codec_interfaces) ; i++)
|
||||
for (i = 0 ; i < ARRAY_SIZE(codec_interfaces) ; i++)
|
||||
{
|
||||
if (codec_interfaces[i].compression == newchd->header.compression[decompnum])
|
||||
{
|
||||
|
@ -1492,7 +1497,7 @@ cleanup:
|
|||
chd_error chd_open(const char *filename, int mode, chd_file *parent, chd_file **chd)
|
||||
{
|
||||
chd_error err;
|
||||
core_file *file = NULL;
|
||||
RFILE *file = NULL;
|
||||
|
||||
/* choose the proper mode */
|
||||
switch(mode)
|
||||
|
@ -1506,8 +1511,11 @@ chd_error chd_open(const char *filename, int mode, chd_file *parent, chd_file **
|
|||
}
|
||||
|
||||
/* open the file */
|
||||
file = core_fopen(filename);
|
||||
if (file == 0)
|
||||
file = filestream_open(filename,
|
||||
RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
if (!file)
|
||||
{
|
||||
err = CHDERR_FILE_NOT_FOUND;
|
||||
goto cleanup;
|
||||
|
@ -1523,10 +1531,36 @@ chd_error chd_open(const char *filename, int mode, chd_file *parent, chd_file **
|
|||
|
||||
cleanup:
|
||||
if ((err != CHDERR_NONE) && (file != NULL))
|
||||
core_fclose(file);
|
||||
filestream_close(file);
|
||||
return err;
|
||||
}
|
||||
|
||||
chd_error chd_precache(chd_file *chd)
|
||||
{
|
||||
int64_t size, count;
|
||||
|
||||
if (!chd->file_cache)
|
||||
{
|
||||
filestream_seek(chd->file, 0, SEEK_END);
|
||||
size = filestream_tell(chd->file);
|
||||
if (size <= 0)
|
||||
return CHDERR_INVALID_DATA;
|
||||
chd->file_cache = malloc(size);
|
||||
if (chd->file_cache == NULL)
|
||||
return CHDERR_OUT_OF_MEMORY;
|
||||
filestream_seek(chd->file, 0, SEEK_SET);
|
||||
count = filestream_read(chd->file, chd->file_cache, size);
|
||||
if (count != size)
|
||||
{
|
||||
free(chd->file_cache);
|
||||
chd->file_cache = NULL;
|
||||
return CHDERR_READ_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return CHDERR_NONE;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
chd_close - close a CHD file for access
|
||||
-------------------------------------------------*/
|
||||
|
@ -1593,12 +1627,15 @@ void chd_close(chd_file *chd)
|
|||
|
||||
/* close the file */
|
||||
if (chd->owns_file && chd->file != NULL)
|
||||
core_fclose(chd->file);
|
||||
filestream_close(chd->file);
|
||||
|
||||
#ifdef NEED_CACHE_HUNK
|
||||
if (PRINTF_MAX_HUNK) printf("Max hunk = %d/%d\n", chd->maxhunk, chd->header.totalhunks);
|
||||
#endif
|
||||
|
||||
if (chd->file_cache)
|
||||
free(chd->file_cache);
|
||||
|
||||
/* free our memory */
|
||||
free(chd);
|
||||
}
|
||||
|
@ -1608,7 +1645,7 @@ void chd_close(chd_file *chd)
|
|||
core_file
|
||||
-------------------------------------------------*/
|
||||
|
||||
core_file *chd_core_file(chd_file *chd)
|
||||
RFILE *chd_core_file(chd_file *chd)
|
||||
{
|
||||
return chd->file;
|
||||
}
|
||||
|
@ -1704,7 +1741,7 @@ chd_error chd_get_metadata(chd_file *chd, UINT32 searchtag, UINT32 searchindex,
|
|||
{
|
||||
metadata_entry metaentry;
|
||||
chd_error err;
|
||||
UINT32 count;
|
||||
int64_t count;
|
||||
|
||||
/* if we didn't find it, just return */
|
||||
err = metadata_find_entry(chd, searchtag, searchindex, &metaentry);
|
||||
|
@ -1735,8 +1772,8 @@ chd_error chd_get_metadata(chd_file *chd, UINT32 searchtag, UINT32 searchindex,
|
|||
|
||||
/* read the metadata */
|
||||
outputlen = MIN(outputlen, metaentry.length);
|
||||
core_fseek(chd->file, metaentry.offset + METADATA_HEADER_SIZE, SEEK_SET);
|
||||
count = core_fread(chd->file, output, outputlen);
|
||||
filestream_seek(chd->file, metaentry.offset + METADATA_HEADER_SIZE, SEEK_SET);
|
||||
count = filestream_read(chd->file, output, outputlen);
|
||||
if (count != outputlen)
|
||||
return CHDERR_READ_ERROR;
|
||||
|
||||
|
@ -1807,11 +1844,11 @@ static chd_error header_validate(const chd_header *header)
|
|||
return CHDERR_INVALID_PARAMETER;
|
||||
|
||||
/* require a supported compression mechanism */
|
||||
for (intfnum = 0; intfnum < ARRAY_LENGTH(codec_interfaces); intfnum++)
|
||||
for (intfnum = 0; intfnum < ARRAY_SIZE(codec_interfaces); intfnum++)
|
||||
if (codec_interfaces[intfnum].compression == header->compression[0])
|
||||
break;
|
||||
|
||||
if (intfnum == ARRAY_LENGTH(codec_interfaces))
|
||||
if (intfnum == ARRAY_SIZE(codec_interfaces))
|
||||
return CHDERR_INVALID_PARAMETER;
|
||||
|
||||
/* require a valid hunksize */
|
||||
|
@ -1875,7 +1912,7 @@ static UINT32 header_guess_unitbytes(chd_file *chd)
|
|||
static chd_error header_read(chd_file *chd, chd_header *header)
|
||||
{
|
||||
UINT8 rawheader[CHD_MAX_HEADER_SIZE];
|
||||
UINT32 count;
|
||||
int64_t count;
|
||||
|
||||
/* punt if NULL */
|
||||
if (header == NULL)
|
||||
|
@ -1886,8 +1923,8 @@ static chd_error header_read(chd_file *chd, chd_header *header)
|
|||
return CHDERR_INVALID_FILE;
|
||||
|
||||
/* seek and read */
|
||||
core_fseek(chd->file, 0, SEEK_SET);
|
||||
count = core_fread(chd->file, rawheader, sizeof(rawheader));
|
||||
filestream_seek(chd->file, 0, SEEK_SET);
|
||||
count = filestream_read(chd->file, rawheader, sizeof(rawheader));
|
||||
if (count != sizeof(rawheader))
|
||||
return CHDERR_READ_ERROR;
|
||||
|
||||
|
@ -2034,6 +2071,35 @@ static chd_error hunk_read_into_cache(chd_file *chd, UINT32 hunknum)
|
|||
}
|
||||
#endif
|
||||
|
||||
static UINT8* read_compressed(chd_file *chd, UINT64 offset, size_t size)
|
||||
{
|
||||
int64_t bytes;
|
||||
if (chd->file_cache)
|
||||
return chd->file_cache + offset;
|
||||
filestream_seek(chd->file, offset, SEEK_SET);
|
||||
bytes = filestream_read(chd->file, chd->compressed, size);
|
||||
if (bytes != size)
|
||||
return NULL;
|
||||
return chd->compressed;
|
||||
}
|
||||
|
||||
static chd_error read_uncompressed(chd_file *chd, UINT64 offset, size_t size, UINT8 *dest)
|
||||
{
|
||||
int64_t bytes;
|
||||
if (chd->file_cache)
|
||||
{
|
||||
memcpy(dest, chd->file_cache + offset, size);
|
||||
return CHDERR_NONE;
|
||||
}
|
||||
filestream_seek(chd->file, offset, SEEK_SET);
|
||||
bytes = filestream_read(chd->file, dest, size);
|
||||
if (bytes != size)
|
||||
return CHDERR_READ_ERROR;
|
||||
return CHDERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
hunk_read_into_memory - read a hunk into
|
||||
memory at the given location
|
||||
|
@ -2065,12 +2131,11 @@ static chd_error hunk_read_into_memory(chd_file *chd, UINT32 hunknum, UINT8 *des
|
|||
{
|
||||
/* compressed data */
|
||||
case V34_MAP_ENTRY_TYPE_COMPRESSED:
|
||||
|
||||
/* read it into the decompression buffer */
|
||||
if (core_fseek(chd->file, entry->offset, SEEK_SET) != 0)
|
||||
return CHDERR_READ_ERROR;
|
||||
bytes = core_fread(chd->file, chd->compressed, entry->length);
|
||||
if (bytes != entry->length)
|
||||
{
|
||||
void *codec;
|
||||
UINT8 *bytes = read_compressed(chd, entry->offset,
|
||||
entry->length);
|
||||
if (bytes == NULL)
|
||||
return CHDERR_READ_ERROR;
|
||||
|
||||
/* now decompress using the codec */
|
||||
|
@ -2080,15 +2145,14 @@ static chd_error hunk_read_into_memory(chd_file *chd, UINT32 hunknum, UINT8 *des
|
|||
err = (*chd->codecintf[0]->decompress)(codec, chd->compressed, entry->length, dest, chd->header.hunkbytes);
|
||||
if (err != CHDERR_NONE)
|
||||
return err;
|
||||
}
|
||||
break;
|
||||
|
||||
/* uncompressed data */
|
||||
case V34_MAP_ENTRY_TYPE_UNCOMPRESSED:
|
||||
if (core_fseek(chd->file, entry->offset, SEEK_SET) != 0)
|
||||
return CHDERR_READ_ERROR;
|
||||
bytes = core_fread(chd->file, dest, chd->header.hunkbytes);
|
||||
if (bytes != chd->header.hunkbytes)
|
||||
return CHDERR_READ_ERROR;
|
||||
err = read_uncompressed(chd, entry->offset, chd->header.hunkbytes, dest);
|
||||
if (err != CHDERR_NONE)
|
||||
return err;
|
||||
break;
|
||||
|
||||
/* mini-compressed data */
|
||||
|
@ -2125,6 +2189,7 @@ static chd_error hunk_read_into_memory(chd_file *chd, UINT32 hunknum, UINT8 *des
|
|||
uint16_t blockcrc;
|
||||
#endif
|
||||
uint8_t *rawmap = &chd->header.rawmap[chd->header.mapentrybytes * hunknum];
|
||||
UINT8 *bytes;
|
||||
|
||||
#if 0
|
||||
/* uncompressed case - TODO */
|
||||
|
@ -2155,11 +2220,9 @@ static chd_error hunk_read_into_memory(chd_file *chd, UINT32 hunknum, UINT8 *des
|
|||
case COMPRESSION_TYPE_1:
|
||||
case COMPRESSION_TYPE_2:
|
||||
case COMPRESSION_TYPE_3:
|
||||
if (core_fseek(chd->file, blockoffs, SEEK_SET) != 0)
|
||||
bytes = read_compressed(chd, blockoffs, blocklen);
|
||||
if (bytes == NULL)
|
||||
return CHDERR_READ_ERROR;
|
||||
if(core_fread(chd->file, chd->compressed, blocklen) != blocklen)
|
||||
return CHDERR_READ_ERROR;
|
||||
|
||||
switch (chd->codecintf[rawmap[0]]->compression)
|
||||
{
|
||||
case CHD_CODEC_CD_LZMA:
|
||||
|
@ -2186,10 +2249,9 @@ static chd_error hunk_read_into_memory(chd_file *chd, UINT32 hunknum, UINT8 *des
|
|||
return CHDERR_NONE;
|
||||
|
||||
case COMPRESSION_NONE:
|
||||
if (core_fseek(chd->file, blockoffs, SEEK_SET) != 0)
|
||||
return CHDERR_READ_ERROR;
|
||||
if (core_fread(chd->file, dest, chd->header.hunkbytes) != chd->header.hunkbytes)
|
||||
return CHDERR_READ_ERROR;
|
||||
err = read_uncompressed(chd, blockoffs, blocklen, dest);
|
||||
if (err != CHDERR_NONE)
|
||||
return err;
|
||||
#ifdef VERIFY_BLOCK_CRC
|
||||
if (crc16(dest, chd->header.hunkbytes) != blockcrc)
|
||||
return CHDERR_DECOMPRESSION_ERROR;
|
||||
|
@ -2219,12 +2281,12 @@ static chd_error hunk_read_into_memory(chd_file *chd, UINT32 hunknum, UINT8 *des
|
|||
INTERNAL MAP ACCESS
|
||||
***************************************************************************/
|
||||
|
||||
static size_t core_fsize(core_file *f)
|
||||
static size_t core_fsize(RFILE *f)
|
||||
{
|
||||
long rv,p = ftell(f);
|
||||
fseek(f, 0, SEEK_END);
|
||||
rv = ftell(f);
|
||||
fseek(f, p, SEEK_SET);
|
||||
int64_t rv, p = filestream_tell(f);
|
||||
filestream_seek(f, 0, SEEK_END);
|
||||
rv = filestream_tell(f);
|
||||
filestream_seek(f, p, SEEK_SET);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -2238,7 +2300,7 @@ static chd_error map_read(chd_file *chd)
|
|||
UINT8 raw_map_entries[MAP_STACK_ENTRIES * MAP_ENTRY_SIZE];
|
||||
UINT64 fileoffset, maxoffset = 0;
|
||||
UINT8 cookie[MAP_ENTRY_SIZE];
|
||||
UINT32 count;
|
||||
int64_t count;
|
||||
chd_error err;
|
||||
int i;
|
||||
|
||||
|
@ -2257,8 +2319,8 @@ static chd_error map_read(chd_file *chd)
|
|||
entries = MAP_STACK_ENTRIES;
|
||||
|
||||
/* read that many */
|
||||
core_fseek(chd->file, fileoffset, SEEK_SET);
|
||||
count = core_fread(chd->file, raw_map_entries, entries * entrysize);
|
||||
filestream_seek(chd->file, fileoffset, SEEK_SET);
|
||||
count = filestream_read(chd->file, raw_map_entries, entries * entrysize);
|
||||
if (count != entries * entrysize)
|
||||
{
|
||||
err = CHDERR_READ_ERROR;
|
||||
|
@ -2286,8 +2348,8 @@ static chd_error map_read(chd_file *chd)
|
|||
}
|
||||
|
||||
/* verify the cookie */
|
||||
core_fseek(chd->file, fileoffset, SEEK_SET);
|
||||
count = core_fread(chd->file, &cookie, entrysize);
|
||||
filestream_seek(chd->file, fileoffset, SEEK_SET);
|
||||
count = filestream_read(chd->file, &cookie, entrysize);
|
||||
if (count != entrysize || memcmp(&cookie, END_OF_LIST_COOKIE, entrysize))
|
||||
{
|
||||
err = CHDERR_INVALID_FILE;
|
||||
|
@ -2327,11 +2389,11 @@ static chd_error metadata_find_entry(chd_file *chd, UINT32 metatag, UINT32 metai
|
|||
while (metaentry->offset != 0)
|
||||
{
|
||||
UINT8 raw_meta_header[METADATA_HEADER_SIZE];
|
||||
UINT32 count;
|
||||
int64_t count;
|
||||
|
||||
/* read the raw header */
|
||||
core_fseek(chd->file, metaentry->offset, SEEK_SET);
|
||||
count = core_fread(chd->file, raw_meta_header, sizeof(raw_meta_header));
|
||||
filestream_seek(chd->file, metaentry->offset, SEEK_SET);
|
||||
count = filestream_read(chd->file, raw_meta_header, sizeof(raw_meta_header));
|
||||
if (count != sizeof(raw_meta_header))
|
||||
break;
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
#include <string.h>
|
||||
#include <libchdr/flac.h>
|
||||
#include <libchdr/minmax.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
/***************************************************************************
|
||||
* FLAC DECODER
|
||||
|
@ -153,7 +154,7 @@ bool flac_decoder::decode(int16_t **samples, uint32_t num_samples, bool swap_end
|
|||
{
|
||||
/* make sure we don't have too many channels */
|
||||
int chans = channels();
|
||||
if (chans > ARRAY_LENGTH(m_uncompressed_start))
|
||||
if (chans > ARRAY_SIZE(m_uncompressed_start))
|
||||
return false;
|
||||
|
||||
/* configure the uncompressed buffer */
|
|
@ -294,7 +294,10 @@ enum huffman_error huffman_import_tree_huffman(struct huffman_decoder* decoder,
|
|||
|
||||
/* make sure we ended up with the right number */
|
||||
if (curcode != decoder->numcodes)
|
||||
{
|
||||
delete_huffman_decoder(smallhuff);
|
||||
return HUFFERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
/* assign canonical codes for all nodes based on their code lengths */
|
||||
error = huffman_assign_canonical_codes(decoder);
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rpng.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rpng_encode.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rpng_internal.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rtga.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rwav.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rxml.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rxml_test.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (gl_capabilities.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (pixconv.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (scaler.c).
|
||||
|
@ -239,6 +239,10 @@ bool scaler_ctx_gen_filter(struct scaler_ctx *ctx)
|
|||
ctx->out_pixconv = conv_argb8888_bgr24;
|
||||
break;
|
||||
|
||||
case SCALER_FMT_ABGR8888:
|
||||
ctx->out_pixconv = conv_argb8888_abgr8888;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (scaler_filter.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (scaler_int.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this libretro SDK code part (glsm).
|
||||
|
@ -2207,7 +2207,7 @@ static bool glsm_state_ctx_init(void *data)
|
|||
#ifdef CORE
|
||||
hw_render.context_type = RETRO_HW_CONTEXT_OPENGL_CORE;
|
||||
hw_render.version_major = 3;
|
||||
hw_render.version_minor = 1;
|
||||
hw_render.version_minor = 3;
|
||||
#else
|
||||
hw_render.context_type = RETRO_HW_CONTEXT_OPENGL;
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this libretro SDK code part (glsym).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this libretro SDK code part (glsym).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rhash.c).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (audio_mix.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (audio_mixer.h).
|
||||
|
@ -41,7 +41,9 @@ enum audio_mixer_type
|
|||
AUDIO_MIXER_TYPE_NONE = 0,
|
||||
AUDIO_MIXER_TYPE_WAV,
|
||||
AUDIO_MIXER_TYPE_OGG,
|
||||
AUDIO_MIXER_TYPE_MOD
|
||||
AUDIO_MIXER_TYPE_MOD,
|
||||
AUDIO_MIXER_TYPE_FLAC,
|
||||
AUDIO_MIXER_TYPE_MP3
|
||||
};
|
||||
|
||||
typedef struct audio_mixer_sound audio_mixer_sound_t;
|
||||
|
@ -61,6 +63,8 @@ void audio_mixer_done(void);
|
|||
audio_mixer_sound_t* audio_mixer_load_wav(void *buffer, int32_t size);
|
||||
audio_mixer_sound_t* audio_mixer_load_ogg(void *buffer, int32_t size);
|
||||
audio_mixer_sound_t* audio_mixer_load_mod(void *buffer, int32_t size);
|
||||
audio_mixer_sound_t* audio_mixer_load_flac(void *buffer, int32_t size);
|
||||
audio_mixer_sound_t* audio_mixer_load_mp3(void *buffer, int32_t size);
|
||||
|
||||
void audio_mixer_destroy(audio_mixer_sound_t* sound);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (audio_resampler.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (float_to_s16.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (s16_to_float.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (dsp_filter.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (boolean.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (clamping.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (apple_compat.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (fnmatch.h).
|
||||
|
|
|
@ -1,13 +1,33 @@
|
|||
#ifndef __FOPEN_UTF8_H
|
||||
#define __FOPEN_UTF8_H
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (fopen_utf8.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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#ifndef __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H
|
||||
#define __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H
|
||||
|
||||
#ifdef _WIN32
|
||||
/* defined to error rather than fopen_utf8, to make it clear to everyone reading the code that not worrying about utf16 is fine */
|
||||
/* Defined to error rather than fopen_utf8, to make it clear to everyone reading the code that not worrying about utf16 is fine */
|
||||
/* TODO: enable */
|
||||
/* #define fopen (use fopen_utf8 instead) */
|
||||
FILE* fopen_utf8(const char * filename, const char * mode);
|
||||
void *fopen_utf8(const char * filename, const char * mode);
|
||||
#else
|
||||
#define fopen_utf8 fopen
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (getopt.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (intrinsics.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (msvc.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (posix_string.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (strcasestr.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (strl.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (dylib.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (crc32.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (utf.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2016 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (utf.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (fastcpy.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (features_cpu.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (archive_file.h).
|
||||
|
@ -187,7 +187,7 @@ bool file_archive_perform_mode(const char *name, const char *valid_exts,
|
|||
|
||||
int file_archive_compressed_read(
|
||||
const char* path, void **buf,
|
||||
const char* optional_filename, ssize_t *length);
|
||||
const char* optional_filename, int64_t *length);
|
||||
|
||||
const struct file_archive_file_backend* file_archive_get_zlib_file_backend(void);
|
||||
const struct file_archive_file_backend* file_archive_get_7z_file_backend(void);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (config_file.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (config_file_userdata.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (file_path.h).
|
||||
|
@ -432,7 +432,7 @@ void path_basedir_wrapper(char *path);
|
|||
#endif
|
||||
|
||||
/**
|
||||
* path_default_slash:
|
||||
* path_default_slash and path_default_slash_c:
|
||||
*
|
||||
* Gets the default slash separator.
|
||||
*
|
||||
|
@ -440,8 +440,10 @@ void path_basedir_wrapper(char *path);
|
|||
*/
|
||||
#ifdef _WIN32
|
||||
#define path_default_slash() "\\"
|
||||
#define path_default_slash_c() '\\'
|
||||
#else
|
||||
#define path_default_slash() "/"
|
||||
#define path_default_slash_c() '/'
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -454,7 +456,7 @@ void path_basedir_wrapper(char *path);
|
|||
**/
|
||||
void fill_pathname_slash(char *path, size_t size);
|
||||
|
||||
#ifndef RARCH_CONSOLE
|
||||
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
||||
void fill_pathname_application_path(char *buf, size_t size);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (nbio.h).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (filters.h).
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue