Skip to content

Commit eafc562

Browse files
committed
Resync
1 parent 79eaf02 commit eafc562

4 files changed

Lines changed: 37 additions & 12 deletions

File tree

audio/audio_mixer.c

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,17 +279,15 @@ static bool one_shot_resample(const float* in, size_t samples_in,
279279
resampler_ident, quality, ratio))
280280
return false;
281281

282-
/*
283-
* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
282+
/* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
284283
* add four more samples in the formula below just as safeguard, because
285284
* resampler->process sometimes reports more output samples than the
286285
* formula below calculates. Ideally, audio resamplers should have a
287286
* function to return the number of samples they will output given a
288-
* count of input samples.
289-
*/
290-
*samples_out = samples_in * ratio + 4;
287+
* count of input samples. */
288+
*samples_out = (size_t)(samples_in * ratio);
291289
*out = (float*)memalign_alloc(16,
292-
((*samples_out + 15) & ~15) * sizeof(float));
290+
(((*samples_out + 4) + 15) & ~15) * sizeof(float));
293291

294292
if (*out == NULL)
295293
return false;
@@ -547,9 +545,15 @@ static bool audio_mixer_play_ogg(
547545
goto error;
548546
}
549547

548+
/* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
549+
* add four more samples in the formula below just as safeguard, because
550+
* resampler->process sometimes reports more output samples than the
551+
* formula below calculates. Ideally, audio resamplers should have a
552+
* function to return the number of samples they will output given a
553+
* count of input samples. */
550554
samples = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
551555
ogg_buffer = (float*)memalign_alloc(16,
552-
((samples + 15) & ~15) * sizeof(float));
556+
(((samples + 4) + 15) & ~15) * sizeof(float));
553557

554558
if (!ogg_buffer)
555559
{
@@ -690,9 +694,15 @@ static bool audio_mixer_play_flac(
690694
goto error;
691695
}
692696

697+
/* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
698+
* add four more samples in the formula below just as safeguard, because
699+
* resampler->process sometimes reports more output samples than the
700+
* formula below calculates. Ideally, audio resamplers should have a
701+
* function to return the number of samples they will output given a
702+
* count of input samples. */
693703
samples = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
694-
flac_buffer = (float*)memalign_alloc(16,
695-
((samples + 15) & ~15) * sizeof(float));
704+
flac_buffer = (float*)memalign_alloc(16,
705+
(((samples + 4) + 15) & ~15) * sizeof(float));
696706

697707
if (!flac_buffer)
698708
{
@@ -762,9 +772,15 @@ static bool audio_mixer_play_mp3(
762772
goto error;
763773
}
764774

775+
/* Allocate on a 16-byte boundary, and pad to a multiple of 16 bytes. We
776+
* add four more samples in the formula below just as safeguard, because
777+
* resampler->process sometimes reports more output samples than the
778+
* formula below calculates. Ideally, audio resamplers should have a
779+
* function to return the number of samples they will output given a
780+
* count of input samples. */
765781
samples = (unsigned)(AUDIO_MIXER_TEMP_BUFFER * ratio);
766782
mp3_buffer = (float*)memalign_alloc(16,
767-
((samples + 15) & ~15) * sizeof(float));
783+
(((samples + 4) + 15) & ~15) * sizeof(float));
768784

769785
if (!mp3_buffer)
770786
{

formats/tga/rtga.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,9 @@ static uint8_t *rtga_tga_load(rtga_context *s,
266266
int RLE_repeating = 0;
267267
int RLE_count = 0;
268268
int read_next_pixel = 1;
269-
/* Needs to be at least 18 bytes to silence a GCC warning,
269+
/* Needs to be at least 24 bytes to silence a GCC warning,
270270
* only 4 are actually used */
271-
unsigned char raw_data[18] = {0};
271+
unsigned char raw_data[24] = {0};
272272
unsigned char *tga_palette = NULL;
273273

274274
/* Do I need to load a palette? */

vfs/vfs_implementation.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@
165165

166166
#include <vfs/vfs_implementation.h>
167167
#include <libretro.h>
168+
#if defined(HAVE_MMAP)
168169
#include <memmap.h>
170+
#endif
169171
#include <encodings/utf.h>
170172
#include <compat/fopen_utf8.h>
171173
#include <file/file_path.h>

vfs/vfs_implementation_uwp.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(
365365

366366
path_wide = utf8_to_utf16_string_alloc(path);
367367
windowsize_path(path_wide);
368+
std::wstring temp_path = path_wide;
369+
while (true) {
370+
size_t p = temp_path.find(L"\\\\");
371+
if (p == std::wstring::npos) break;
372+
temp_path.replace(p, 2, L"\\");
373+
}
374+
path_wide = _wcsdup(temp_path.c_str());
368375
path_str = ref new Platform::String(path_wide);
369376
free(path_wide);
370377

0 commit comments

Comments
 (0)