Squashed 'libretro-common/' changes from 156677b98e..3d989dc968

3d989dc968 Cleanups
dabdf7c539 Updates

git-subtree-dir: libretro-common
git-subtree-split: 3d989dc968fa529e91d8e8e4f42f8909451aa7a3
This commit is contained in:
twinaphex 2018-06-21 08:07:19 +02:00
parent 950525a370
commit 944cac8352
8 changed files with 121 additions and 22 deletions

View File

@ -1050,7 +1050,7 @@ static void audio_mixer_mix_flac(float* buffer, size_t num_frames,
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);
temp_samples = (unsigned)drflac_read_f32( voice->types.flac.stream, AUDIO_MIXER_TEMP_BUFFER, temp_buffer);
if (temp_samples == 0)
{
if (voice->repeat)
@ -1122,7 +1122,7 @@ static void audio_mixer_mix_mp3(float* buffer, size_t num_frames,
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;
temp_samples = (unsigned)drmp3_read_f32(&voice->types.mp3.stream, AUDIO_MIXER_TEMP_BUFFER/2, temp_buffer) * 2;
if (temp_samples == 0)
{

View File

@ -178,8 +178,8 @@ static bool append_plugs(retro_dsp_filter_t *dsp, struct string_list *list)
static bool append_plugs(retro_dsp_filter_t *dsp, struct string_list *list)
{
unsigned i;
dspfilter_simd_mask_t mask = cpu_features_get();
unsigned list_size = list ? list->size : 0;
dspfilter_simd_mask_t mask = (dspfilter_simd_mask_t)cpu_features_get();
unsigned list_size = list ? (unsigned)list->size : 0;
for (i = 0; i < list_size; i++)
{

View File

@ -113,7 +113,10 @@ static unsigned char *rbmp__convert_format(
{
case ((1)*8+(2)):
for(i=x-1; i >= 0; --i, src += 1, dest += 2)
dest[0]=src[0], dest[1]=255;
{
dest[0]=src[0];
dest[1]=255;
}
break;
case ((1)*8+(3)):
for(i=x-1; i >= 0; --i, src += 1, dest += 3)
@ -121,7 +124,10 @@ static unsigned char *rbmp__convert_format(
break;
case ((1)*8+(4)):
for(i=x-1; i >= 0; --i, src += 1, dest += 4)
dest[0]=dest[1]=dest[2]=src[0], dest[3]=255;
{
dest[0]=dest[1]=dest[2]=src[0];
dest[3]=255;
}
break;
case ((2)*8+(1)):
for(i=x-1; i >= 0; --i, src += 2, dest += 1)
@ -133,11 +139,19 @@ static unsigned char *rbmp__convert_format(
break;
case ((2)*8+(4)):
for(i=x-1; i >= 0; --i, src += 2, dest += 4)
dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1];
{
dest[0]=dest[1]=dest[2]=src[0];
dest[3]=src[1];
}
break;
case ((3)*8+(4)):
for(i=x-1; i >= 0; --i, src += 3, dest += 4)
dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255;
{
dest[0]=src[0];
dest[1]=src[1];
dest[2]=src[2];
dest[3]=255;
}
break;
case ((3)*8+(1)):
for(i=x-1; i >= 0; --i, src += 3, dest += 1)
@ -157,7 +171,11 @@ static unsigned char *rbmp__convert_format(
break;
case ((4)*8+(3)):
for(i=x-1; i >= 0; --i, src += 4, dest += 3)
dest[0]=src[0],dest[1]=src[1],dest[2]=src[2];
{
dest[0]=src[0];
dest[1]=src[1];
dest[2]=src[2];
}
break;
default:
break;
@ -176,11 +194,31 @@ static int rbmp__high_bit(unsigned int z)
int n=0;
if (z == 0)
return -1;
if (z >= 0x10000) n += 16, z >>= 16;
if (z >= 0x00100) n += 8, z >>= 8;
if (z >= 0x00010) n += 4, z >>= 4;
if (z >= 0x00004) n += 2, z >>= 2;
if (z >= 0x00002) n += 1, z >>= 1;
if (z >= 0x10000)
{
n += 16;
z >>= 16;
}
if (z >= 0x00100)
{
n += 8;
z >>= 8;
}
if (z >= 0x00010)
{
n += 4;
z >>= 4;
}
if (z >= 0x00004)
{
n += 2;
z >>= 2;
}
if (z >= 0x00002)
{
n += 1;
z >>= 1;
}
return n;
}
@ -525,7 +563,9 @@ static unsigned char *rbmp__bmp_load(rbmp__context *s, unsigned *x, unsigned *y,
unsigned char *p2 = out + (s->img_y-1-j)*s->img_x*target;
for (i=0; i < (int) s->img_x*target; ++i)
{
t = p1[i], p1[i] = p2[i], p2[i] = t;
t = p1[i];
p1[i] = p2[i];
p2[i] = t;
}
}
}

View File

@ -2523,7 +2523,10 @@ static uint8_t *rjpeg_load_jpeg_image(rjpeg__jpeg *z,
out[i] = y[i];
else
for (i=0; i < z->s->img_x; ++i)
*out++ = y[i], *out++ = 255;
{
*out++ = y[i];
*out++ = 255;
}
}
}

View File

@ -117,7 +117,10 @@ static unsigned char *rtga__convert_format(
{
case ((1)*8+(2)):
for(i=x-1; i >= 0; --i, src += 1, dest += 2)
dest[0]=src[0], dest[1]=255;
{
dest[0]=src[0];
dest[1]=255;
}
break;
case ((1)*8+(3)):
for(i=x-1; i >= 0; --i, src += 1, dest += 3)
@ -141,7 +144,12 @@ static unsigned char *rtga__convert_format(
break;
case ((3)*8+(4)):
for(i=x-1; i >= 0; --i, src += 3, dest += 4)
dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255;
{
dest[0]=src[0];
dest[1]=src[1];
dest[2]=src[2];
dest[3]=255;
}
break;
case ((3)*8+(1)):
for(i=x-1; i >= 0; --i, src += 3, dest += 1)
@ -161,7 +169,11 @@ static unsigned char *rtga__convert_format(
break;
case ((4)*8+(3)):
for(i=x-1; i >= 0; --i, src += 4, dest += 3)
dest[0]=src[0],dest[1]=src[1],dest[2]=src[2];
{
dest[0]=src[0];
dest[1]=src[1];
dest[2]=src[2];
}
break;
default:
break;

View File

@ -1176,6 +1176,41 @@ struct retro_led_interface
* * State will never be saved when using Hard Disable Audio.
*/
#define RETRO_ENVIRONMENT_GET_MIDI_INTERFACE (48 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* struct retro_midi_interface ** --
* Returns a MIDI interface that can be used for raw data I/O.
*/
/* Retrieves the current state of the MIDI input.
* Returns true if it's enabled, false otherwise. */
typedef bool (RETRO_CALLCONV *retro_midi_input_enabled_t)(void);
/* Retrieves the current state of the MIDI output.
* Returns true if it's enabled, false otherwise */
typedef bool (RETRO_CALLCONV *retro_midi_output_enabled_t)(void);
/* Reads next byte from the input stream.
* Returns true if byte is read, false otherwise. */
typedef bool (RETRO_CALLCONV *retro_midi_read_t)(uint8_t *byte);
/* Writes byte to the output stream.
* 'delta_time' is in microseconds and represent time elapsed since previous write.
* Returns true if byte is written, false otherwise. */
typedef bool (RETRO_CALLCONV *retro_midi_write_t)(uint8_t byte, uint32_t delta_time);
/* Flushes previously written data.
* Returns true if successful, false otherwise. */
typedef bool (RETRO_CALLCONV *retro_midi_flush_t)(void);
struct retro_midi_interface
{
retro_midi_input_enabled_t input_enabled;
retro_midi_output_enabled_t output_enabled;
retro_midi_read_t read;
retro_midi_write_t write;
retro_midi_flush_t flush;
};
#define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* const struct retro_hw_render_interface ** --
* Returns an API specific rendering interface for accessing API specific data.

View File

@ -45,7 +45,10 @@ static INLINE bool string_is_equal(const char *a, const char *b)
if (!a || !b)
return false;
while(*a && (*a == *b))
a++, b++;
{
a++;
b++;
}
return (*(const unsigned char*)a - *(const unsigned char*)b) == 0;
}

View File

@ -109,7 +109,10 @@ char *string_trim_whitespace_left(char *const s)
char *cur = s;
while(*cur && isspace((unsigned char)*cur))
++cur, --len;
{
++cur;
--len;
}
if(s != cur)
memmove(s, cur, len + 1);
@ -128,7 +131,10 @@ char *string_trim_whitespace_right(char *const s)
char *cur = s + len - 1;
while(cur != s && isspace((unsigned char)*cur))
--cur, --len;
{
--cur;
--len;
}
cur[isspace((unsigned char)*cur) ? 0 : 1] = '\0';
}