This commit is contained in:
twinaphex 2021-09-17 14:25:11 +02:00
parent 79eaf02ada
commit eafc5622b7
4 changed files with 37 additions and 12 deletions

View File

@ -279,17 +279,15 @@ static bool one_shot_resample(const float* in, size_t samples_in,
resampler_ident, quality, ratio))
return false;
/*
* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
/* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
* add four more samples in the formula below just as safeguard, because
* resampler->process sometimes reports more output samples than the
* formula below calculates. Ideally, audio resamplers should have a
* function to return the number of samples they will output given a
* count of input samples.
*/
*samples_out = samples_in * ratio + 4;
* count of input samples. */
*samples_out = (size_t)(samples_in * ratio);
*out = (float*)memalign_alloc(16,
((*samples_out + 15) & ~15) * sizeof(float));
(((*samples_out + 4) + 15) & ~15) * sizeof(float));
if (*out == NULL)
return false;
@ -547,9 +545,15 @@ static bool audio_mixer_play_ogg(
goto error;
}
/* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
* add four more samples in the formula below just as safeguard, because
* resampler->process sometimes reports more output samples than the
* formula below calculates. Ideally, audio resamplers should have a
* function to return the number of samples they will output given a
* count of input samples. */
samples = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
ogg_buffer = (float*)memalign_alloc(16,
((samples + 15) & ~15) * sizeof(float));
(((samples + 4) + 15) & ~15) * sizeof(float));
if (!ogg_buffer)
{
@ -690,9 +694,15 @@ static bool audio_mixer_play_flac(
goto error;
}
/* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
* add four more samples in the formula below just as safeguard, because
* resampler->process sometimes reports more output samples than the
* formula below calculates. Ideally, audio resamplers should have a
* function to return the number of samples they will output given a
* count of input samples. */
samples = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
flac_buffer = (float*)memalign_alloc(16,
((samples + 15) & ~15) * sizeof(float));
flac_buffer = (float*)memalign_alloc(16,
(((samples + 4) + 15) & ~15) * sizeof(float));
if (!flac_buffer)
{
@ -762,9 +772,15 @@ static bool audio_mixer_play_mp3(
goto error;
}
/* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
* add four more samples in the formula below just as safeguard, because
* resampler->process sometimes reports more output samples than the
* formula below calculates. Ideally, audio resamplers should have a
* function to return the number of samples they will output given a
* count of input samples. */
samples = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
mp3_buffer = (float*)memalign_alloc(16,
((samples + 15) & ~15) * sizeof(float));
(((samples + 4) + 15) & ~15) * sizeof(float));
if (!mp3_buffer)
{

View File

@ -266,9 +266,9 @@ static uint8_t *rtga_tga_load(rtga_context *s,
int RLE_repeating = 0;
int RLE_count = 0;
int read_next_pixel = 1;
/* Needs to be at least 18 bytes to silence a GCC warning,
/* Needs to be at least 24 bytes to silence a GCC warning,
* only 4 are actually used */
unsigned char raw_data[18] = {0};
unsigned char raw_data[24] = {0};
unsigned char *tga_palette = NULL;
/* Do I need to load a palette? */

View File

@ -165,7 +165,9 @@
#include <vfs/vfs_implementation.h>
#include <libretro.h>
#if defined(HAVE_MMAP)
#include <memmap.h>
#endif
#include <encodings/utf.h>
#include <compat/fopen_utf8.h>
#include <file/file_path.h>

View File

@ -365,6 +365,13 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(
path_wide = utf8_to_utf16_string_alloc(path);
windowsize_path(path_wide);
std::wstring temp_path = path_wide;
while (true) {
size_t p = temp_path.find(L"\\\\");
if (p == std::wstring::npos) break;
temp_path.replace(p, 2, L"\\");
}
path_wide = _wcsdup(temp_path.c_str());
path_str = ref new Platform::String(path_wide);
free(path_wide);