mirror of
https://github.com/libretro/RetroArch
synced 2025-04-17 11:43:00 +00:00
Function argument name standardization
This commit is contained in:
parent
ec54cdfcf0
commit
b211adaaca
@ -110,7 +110,7 @@ typedef struct audio_driver
|
||||
* Unless said otherwise with set_nonblock_state(), all writes
|
||||
* are blocking, and it should block till it has written all frames.
|
||||
*/
|
||||
ssize_t (*write)(void *data, const void *buf, size_t size);
|
||||
ssize_t (*write)(void *data, const void *buf, size_t len);
|
||||
|
||||
/**
|
||||
* Temporarily pauses the audio driver.
|
||||
|
@ -54,8 +54,8 @@ void retro_unload_game(void) { libretro_dummy_retro_unload_game(); }
|
||||
unsigned retro_get_region(void) { return libretro_dummy_retro_get_region(); }
|
||||
bool retro_load_game_special(unsigned type, const struct retro_game_info *info, size_t num) { return libretro_dummy_retro_load_game_special(type, info, num); }
|
||||
size_t retro_serialize_size(void) { return libretro_dummy_retro_serialize_size(); }
|
||||
bool retro_serialize(void *data, size_t size) { return libretro_dummy_retro_serialize(data, size); }
|
||||
bool retro_unserialize(const void *data, size_t size) { return libretro_dummy_retro_unserialize(data, size); }
|
||||
bool retro_serialize(void *data, size_t len) { return libretro_dummy_retro_serialize(data, len); }
|
||||
bool retro_unserialize(const void *data, size_t len) { return libretro_dummy_retro_unserialize(data, len); }
|
||||
void *retro_get_memory_data(unsigned id) { return libretro_dummy_retro_get_memory_data(id); }
|
||||
size_t retro_get_memory_size(unsigned id) { return libretro_dummy_retro_get_memory_size(id); }
|
||||
void retro_cheat_reset(void) { libretro_dummy_retro_cheat_reset(); }
|
||||
@ -119,13 +119,6 @@ unsigned libretro_dummy_retro_api_version(void)
|
||||
return RETRO_API_VERSION;
|
||||
}
|
||||
|
||||
void libretro_dummy_retro_set_controller_port_device(
|
||||
unsigned port, unsigned device)
|
||||
{
|
||||
(void)port;
|
||||
(void)device;
|
||||
}
|
||||
|
||||
void libretro_dummy_retro_get_system_info(
|
||||
struct retro_system_info *info)
|
||||
{
|
||||
@ -197,9 +190,6 @@ void libretro_dummy_retro_set_video_refresh(retro_video_refresh_t cb)
|
||||
dummy_video_cb = cb;
|
||||
}
|
||||
|
||||
void libretro_dummy_retro_reset(void)
|
||||
{}
|
||||
|
||||
void libretro_dummy_retro_run(void)
|
||||
{
|
||||
dummy_input_poll_cb();
|
||||
@ -209,66 +199,22 @@ void libretro_dummy_retro_run(void)
|
||||
/* This should never be called, it's only used as a placeholder. */
|
||||
bool libretro_dummy_retro_load_game(const struct retro_game_info *info)
|
||||
{
|
||||
(void)info;
|
||||
return false;
|
||||
}
|
||||
|
||||
void libretro_dummy_retro_unload_game(void)
|
||||
{}
|
||||
|
||||
unsigned libretro_dummy_retro_get_region(void)
|
||||
{
|
||||
return RETRO_REGION_NTSC;
|
||||
}
|
||||
|
||||
void libretro_dummy_retro_set_controller_port_device(
|
||||
unsigned port, unsigned device) { }
|
||||
void libretro_dummy_retro_reset(void) { }
|
||||
unsigned libretro_dummy_retro_get_region(void) { return RETRO_REGION_NTSC; }
|
||||
void libretro_dummy_retro_unload_game(void) { }
|
||||
bool libretro_dummy_retro_load_game_special(unsigned type,
|
||||
const struct retro_game_info *info, size_t num)
|
||||
{
|
||||
(void)type;
|
||||
(void)info;
|
||||
(void)num;
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t libretro_dummy_retro_serialize_size(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool libretro_dummy_retro_serialize(void *data, size_t size)
|
||||
{
|
||||
(void)data;
|
||||
(void)size;
|
||||
return false;
|
||||
}
|
||||
|
||||
const struct retro_game_info *info, size_t num) { return false; }
|
||||
size_t libretro_dummy_retro_serialize_size(void) { return 0; }
|
||||
bool libretro_dummy_retro_serialize(void *data, size_t len) { return false; }
|
||||
bool libretro_dummy_retro_unserialize(const void *data,
|
||||
size_t size)
|
||||
{
|
||||
(void)data;
|
||||
(void)size;
|
||||
return false;
|
||||
}
|
||||
|
||||
void *libretro_dummy_retro_get_memory_data(unsigned id)
|
||||
{
|
||||
(void)id;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t libretro_dummy_retro_get_memory_size(unsigned id)
|
||||
{
|
||||
(void)id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void libretro_dummy_retro_cheat_reset(void)
|
||||
{}
|
||||
|
||||
size_t len) { return false; }
|
||||
void *libretro_dummy_retro_get_memory_data(unsigned id) { return NULL; }
|
||||
size_t libretro_dummy_retro_get_memory_size(unsigned id) { return 0; }
|
||||
void libretro_dummy_retro_cheat_reset(void) { }
|
||||
void libretro_dummy_retro_cheat_set(unsigned idx,
|
||||
bool enabled, const char *code)
|
||||
{
|
||||
(void)idx;
|
||||
(void)enabled;
|
||||
(void)code;
|
||||
}
|
||||
bool enabled, const char *code) { }
|
||||
|
@ -59,9 +59,9 @@ void libretro_dummy_retro_run(void);
|
||||
|
||||
size_t libretro_dummy_retro_serialize_size(void);
|
||||
|
||||
bool libretro_dummy_retro_serialize(void *data, size_t size);
|
||||
bool libretro_dummy_retro_serialize(void *data, size_t len);
|
||||
|
||||
bool libretro_dummy_retro_unserialize(const void *data, size_t size);
|
||||
bool libretro_dummy_retro_unserialize(const void *data, size_t len);
|
||||
|
||||
void libretro_dummy_retro_cheat_reset(void);
|
||||
|
||||
@ -113,9 +113,9 @@ void libretro_ffmpeg_retro_run(void);
|
||||
|
||||
size_t libretro_ffmpeg_retro_serialize_size(void);
|
||||
|
||||
bool libretro_ffmpeg_retro_serialize(void *data, size_t size);
|
||||
bool libretro_ffmpeg_retro_serialize(void *data, size_t len);
|
||||
|
||||
bool libretro_ffmpeg_retro_unserialize(const void *data, size_t size);
|
||||
bool libretro_ffmpeg_retro_unserialize(const void *data, size_t len);
|
||||
|
||||
void libretro_ffmpeg_retro_cheat_reset(void);
|
||||
|
||||
@ -169,9 +169,9 @@ void libretro_mpv_retro_run(void);
|
||||
|
||||
size_t libretro_mpv_retro_serialize_size(void);
|
||||
|
||||
bool libretro_mpv_retro_serialize(void *data, size_t size);
|
||||
bool libretro_mpv_retro_serialize(void *data, size_t len);
|
||||
|
||||
bool libretro_mpv_retro_unserialize(const void *data, size_t size);
|
||||
bool libretro_mpv_retro_unserialize(const void *data, size_t len);
|
||||
|
||||
void libretro_mpv_retro_cheat_reset(void);
|
||||
|
||||
@ -225,9 +225,9 @@ void libretro_imageviewer_retro_run(void);
|
||||
|
||||
size_t libretro_imageviewer_retro_serialize_size(void);
|
||||
|
||||
bool libretro_imageviewer_retro_serialize(void *data, size_t size);
|
||||
bool libretro_imageviewer_retro_serialize(void *data, size_t len);
|
||||
|
||||
bool libretro_imageviewer_retro_unserialize(const void *data, size_t size);
|
||||
bool libretro_imageviewer_retro_unserialize(const void *data, size_t len);
|
||||
|
||||
void libretro_imageviewer_retro_cheat_reset(void);
|
||||
|
||||
@ -281,9 +281,9 @@ void libretro_netretropad_retro_run(void);
|
||||
|
||||
size_t libretro_netretropad_retro_serialize_size(void);
|
||||
|
||||
bool libretro_netretropad_retro_serialize(void *data, size_t size);
|
||||
bool libretro_netretropad_retro_serialize(void *data, size_t len);
|
||||
|
||||
bool libretro_netretropad_retro_unserialize(const void *data, size_t size);
|
||||
bool libretro_netretropad_retro_unserialize(const void *data, size_t len);
|
||||
|
||||
void libretro_netretropad_retro_cheat_reset(void);
|
||||
|
||||
@ -337,9 +337,9 @@ void libretro_videoprocessor_retro_run(void);
|
||||
|
||||
size_t libretro_videoprocessor_retro_serialize_size(void);
|
||||
|
||||
bool libretro_videoprocessor_retro_serialize(void *data, size_t size);
|
||||
bool libretro_videoprocessor_retro_serialize(void *data, size_t len);
|
||||
|
||||
bool libretro_videoprocessor_retro_unserialize(const void *data, size_t size);
|
||||
bool libretro_videoprocessor_retro_unserialize(const void *data, size_t len);
|
||||
|
||||
void libretro_videoprocessor_retro_cheat_reset(void);
|
||||
|
||||
|
@ -222,14 +222,14 @@ static void ass_msg_cb(int level, const char *fmt, va_list args, void *data)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void append_attachment(const uint8_t *data, size_t size)
|
||||
static void append_attachment(const uint8_t *data, size_t len)
|
||||
{
|
||||
attachments = (struct attachment*)av_realloc(
|
||||
attachments, (attachments_size + 1) * sizeof(*attachments));
|
||||
|
||||
attachments[attachments_size].data = (uint8_t*)av_malloc(size);
|
||||
attachments[attachments_size].size = size;
|
||||
memcpy(attachments[attachments_size].data, data, size);
|
||||
attachments[attachments_size].data = (uint8_t*)av_malloc(len);
|
||||
attachments[attachments_size].size = len;
|
||||
memcpy(attachments[attachments_size].data, data, len);
|
||||
|
||||
attachments_size++;
|
||||
}
|
||||
@ -2278,41 +2278,12 @@ size_t CORE_PREFIX(retro_serialize_size)(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CORE_PREFIX(retro_serialize)(void *data, size_t size)
|
||||
{
|
||||
(void)data;
|
||||
(void)size;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CORE_PREFIX(retro_unserialize)(const void *data, size_t size)
|
||||
{
|
||||
(void)data;
|
||||
(void)size;
|
||||
return false;
|
||||
}
|
||||
|
||||
void *CORE_PREFIX(retro_get_memory_data)(unsigned id)
|
||||
{
|
||||
(void)id;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t CORE_PREFIX(retro_get_memory_size)(unsigned id)
|
||||
{
|
||||
(void)id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CORE_PREFIX(retro_cheat_reset)(void)
|
||||
{}
|
||||
|
||||
void CORE_PREFIX(retro_cheat_set)(unsigned index, bool enabled, const char *code)
|
||||
{
|
||||
(void)index;
|
||||
(void)enabled;
|
||||
(void)code;
|
||||
}
|
||||
bool CORE_PREFIX(retro_serialize)(void *data, size_t len) { return false; }
|
||||
bool CORE_PREFIX(retro_unserialize)(const void *data, size_t len) { return false; }
|
||||
void *CORE_PREFIX(retro_get_memory_data)(unsigned id) { return NULL; }
|
||||
size_t CORE_PREFIX(retro_get_memory_size)(unsigned id) { return 0; }
|
||||
void CORE_PREFIX(retro_cheat_reset)(void) { }
|
||||
void CORE_PREFIX(retro_cheat_set)(unsigned a, bool b, const char *c) { }
|
||||
|
||||
#if defined(LIBRETRO_SWITCH)
|
||||
|
||||
|
@ -143,10 +143,7 @@ static void audio_callback(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
audio_set_state(bool enable)
|
||||
{
|
||||
}
|
||||
static void audio_set_state(bool enable) { }
|
||||
#endif
|
||||
|
||||
static void
|
||||
@ -330,9 +327,7 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_set_input_state)(retro_input_state_t
|
||||
VIDEOPROC_CORE_PREFIX(input_state_cb) = cb;
|
||||
}
|
||||
|
||||
RETRO_API void VIDEOPROC_CORE_PREFIX(retro_init)(void)
|
||||
{
|
||||
}
|
||||
RETRO_API void VIDEOPROC_CORE_PREFIX(retro_init)(void) { }
|
||||
|
||||
static bool open_devices(void)
|
||||
{
|
||||
@ -345,9 +340,8 @@ static bool open_devices(void)
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &videodev);
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &audiodev);
|
||||
|
||||
if (strcmp(videodev.value, "dummy") == 0) {
|
||||
if (strcmp(videodev.value, "dummy") == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Video device is required */
|
||||
if (videodev.value == NULL)
|
||||
@ -504,14 +498,17 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_get_system_av_info)(struct retro_syst
|
||||
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &videodev);
|
||||
|
||||
if (strcmp(videodev.value, "dummy") == 0) {
|
||||
if (strcmp(videodev.value, "dummy") == 0)
|
||||
{
|
||||
info->geometry.aspect_ratio = 4.0/3.0;
|
||||
info->geometry.base_width = info->geometry.max_width = video_cap_width;
|
||||
info->geometry.base_height = video_cap_height; /* out? */
|
||||
info->geometry.max_height = video_out_height;
|
||||
info->timing.fps = 60;
|
||||
info->timing.sample_rate = AUDIO_SAMPLE_RATE;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Query the device cropping limits. If available, we can use this to find the capture pixel aspect.
|
||||
*/
|
||||
@ -530,11 +527,10 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_get_system_av_info)(struct retro_syst
|
||||
(double)video_standard.frameperiod.numerator;
|
||||
info->timing.sample_rate = AUDIO_SAMPLE_RATE;
|
||||
|
||||
if (error == 0) {
|
||||
/* TODO Allow for fixed 4:3 and 16:9 modes */
|
||||
info->geometry.aspect_ratio = (double)info->geometry.base_width / (double)info->geometry.max_height /\
|
||||
((double)cc.pixelaspect.numerator / (double)cc.pixelaspect.denominator);
|
||||
}
|
||||
/* TODO/FIXME Allow for fixed 4:3 and 16:9 modes */
|
||||
if (error == 0)
|
||||
info->geometry.aspect_ratio = (double)info->geometry.base_width / (double)info->geometry.max_height /
|
||||
((double)cc.pixelaspect.numerator / (double)cc.pixelaspect.denominator);
|
||||
}
|
||||
|
||||
printf("Aspect ratio: %f\n",info->geometry.aspect_ratio);
|
||||
@ -544,7 +540,7 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_get_system_av_info)(struct retro_syst
|
||||
info->geometry.max_height);
|
||||
}
|
||||
|
||||
RETRO_API void VIDEOPROC_CORE_PREFIX(retro_set_controller_port_device)(unsigned port, unsigned device)
|
||||
RETRO_API void VIDEOPROC_CORE_PREFIX(retro_set_controller_port_device)(unsigned a, unsigned b)
|
||||
{
|
||||
}
|
||||
|
||||
@ -555,7 +551,8 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_reset)(void)
|
||||
}
|
||||
|
||||
/* TODO improve this mess and make it generic enough for use with dummy mode */
|
||||
void v4l2_frame_times(struct v4l2_buffer buf) {
|
||||
void v4l2_frame_times(struct v4l2_buffer buf)
|
||||
{
|
||||
if (strcmp("Off", video_frame_times) == 0)
|
||||
return;
|
||||
|
||||
@ -563,45 +560,49 @@ void v4l2_frame_times(struct v4l2_buffer buf) {
|
||||
ft_info = (char*)calloc(5000, sizeof(char));
|
||||
|
||||
if ( (buf.timestamp.tv_sec - ft_prevtime.tv_sec >= 1) && \
|
||||
(buf.timestamp.tv_usec + 1000000 - ft_prevtime2.tv_usec) >= 1000000) {
|
||||
(buf.timestamp.tv_usec + 1000000 - ft_prevtime2.tv_usec) >= 1000000)
|
||||
{
|
||||
double csec = ((double) buf.timestamp.tv_sec) + (buf.timestamp.tv_usec/1000000);
|
||||
double psec = ((double) ft_prevtime.tv_sec) + (ft_prevtime.tv_usec/1000000);
|
||||
printf("Fields last %.2f seconds: %d\n", csec - psec, ft_fcount);
|
||||
printf("Average frame times: %.3fms\n", ft_favg/(1000*ft_fcount));
|
||||
printf("Fields timestampdiffs last second:\n%s\n", ft_info);
|
||||
free(ft_info);
|
||||
ft_info = (char*)calloc(5000, sizeof(char));
|
||||
ft_fcount = 0;
|
||||
ft_favg = 0;
|
||||
ft_info = (char*)calloc(5000, sizeof(char));
|
||||
ft_fcount = 0;
|
||||
ft_favg = 0;
|
||||
ft_prevtime = buf.timestamp;
|
||||
}
|
||||
ft_fcount++;
|
||||
ft_info2 = strdup(ft_info);
|
||||
ft_ftime = (double) (buf.timestamp.tv_usec + ((buf.timestamp.tv_sec - ft_prevtime2.tv_sec >= 1) ? 1000000 : 0) - ft_prevtime2.tv_usec);
|
||||
ft_favg += ft_ftime;
|
||||
snprintf(ft_info, 5000 * sizeof(char), "%s %6.d %d %d %.2fms%s", ft_info2, buf.sequence, buf.index, buf.field, ft_ftime/1000, (!(ft_fcount % 7)) ? "\n" : "");
|
||||
snprintf(ft_info, 5000 * sizeof(char), "%s %6.d %d %d %.2fms%s",
|
||||
ft_info2, buf.sequence, buf.index, buf.field, ft_ftime/1000,
|
||||
(!(ft_fcount % 7)) ? "\n" : "");
|
||||
free(ft_info2);
|
||||
|
||||
ft_prevtime2 = buf.timestamp;
|
||||
}
|
||||
|
||||
void source_dummy(int width, int height) {
|
||||
void source_dummy(int width, int height)
|
||||
{
|
||||
int i, triangpos, triangpos_t=0, triangpos_b=0, offset=0;
|
||||
bool field_ahead = false;
|
||||
uint8_t *src = frame_cap;
|
||||
float step = M_PI/64;
|
||||
|
||||
if (video_buf.field == V4L2_FIELD_TOP) {
|
||||
if (video_buf.field == V4L2_FIELD_TOP)
|
||||
offset=0;
|
||||
} else if (video_buf.field == V4L2_FIELD_BOTTOM) {
|
||||
else if (video_buf.field == V4L2_FIELD_BOTTOM)
|
||||
offset=1;
|
||||
}
|
||||
|
||||
dummy_pos += step;
|
||||
/* no animation */
|
||||
/* dummy_pos = M_PI/4; step = 0; */
|
||||
triangpos = (sinf(dummy_pos)+1)/2*width;
|
||||
if (video_buf.field == V4L2_FIELD_INTERLACED) {
|
||||
if (video_buf.field == V4L2_FIELD_INTERLACED)
|
||||
{
|
||||
if (video_half_feed_rate == 0)
|
||||
video_half_feed_rate = 1;
|
||||
triangpos_t = (sinf(dummy_pos)+1)/2*width;
|
||||
@ -609,22 +610,28 @@ void source_dummy(int width, int height) {
|
||||
triangpos_b = (sinf(dummy_pos)+1)/2*width;
|
||||
}
|
||||
|
||||
for (i = 0; i < width * height; i+=1, src+=3) {
|
||||
for (i = 0; i < width * height; i+=1, src+=3)
|
||||
{
|
||||
float color = (clamp_float((float)(triangpos - (i%width) + offset)/10, -1, 1)+1)/2;
|
||||
src[0] = 0x10 + color*0xE0;
|
||||
src[1] = 0x10 + color*0xE0;
|
||||
src[2] = 0x10 + color*0xE0;
|
||||
|
||||
/* End of a line */
|
||||
if ( ((i+1) % width) == 0 ) {
|
||||
if ( ((i+1) % width) == 0 )
|
||||
{
|
||||
triangpos -= 2; /* offset should be half of this? */
|
||||
triangpos_t -= 1;
|
||||
triangpos_b -= 1;
|
||||
if (video_buf.field == V4L2_FIELD_INTERLACED) {
|
||||
if (field_ahead) {
|
||||
if (video_buf.field == V4L2_FIELD_INTERLACED)
|
||||
{
|
||||
if (field_ahead)
|
||||
{
|
||||
triangpos = triangpos_b;
|
||||
field_ahead = false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
triangpos = triangpos_t;
|
||||
field_ahead = true;
|
||||
}
|
||||
@ -638,16 +645,17 @@ void source_dummy(int width, int height) {
|
||||
video_buf.field = V4L2_FIELD_TOP;
|
||||
}
|
||||
|
||||
void source_v4l2_normal(int width, int height) {
|
||||
void source_v4l2_normal(int width, int height)
|
||||
{
|
||||
struct v4l2_buffer bufcp;
|
||||
|
||||
int error;
|
||||
|
||||
/* Wait until v4l2 dequees a buffer */
|
||||
memset(&video_buf, 0, sizeof(struct v4l2_buffer));
|
||||
video_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
video_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
video_buf.memory = V4L2_MEMORY_MMAP;
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_DQBUF, &video_buf);
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_DQBUF, &video_buf);
|
||||
if (error != 0)
|
||||
{
|
||||
printf("VIDIOC_DQBUF failed: %s\n", strerror(errno));
|
||||
@ -665,7 +673,8 @@ void source_v4l2_normal(int width, int height) {
|
||||
v4l2_frame_times(bufcp);
|
||||
}
|
||||
|
||||
void source_v4l2_alternate_hack(int width, int height) {
|
||||
void source_v4l2_alternate_hack(int width, int height)
|
||||
{
|
||||
struct v4l2_buffer bufcp;
|
||||
struct v4l2_format fmt;
|
||||
struct v4l2_requestbuffers reqbufs;
|
||||
@ -677,7 +686,7 @@ void source_v4l2_alternate_hack(int width, int height) {
|
||||
/* For later, saving time */
|
||||
memset(&fmt, 0, sizeof(fmt));
|
||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_G_FMT, &fmt);
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_G_FMT, &fmt);
|
||||
if (error != 0)
|
||||
{
|
||||
printf("VIDIOC_G_FMT failed: %s\n", strerror(errno));
|
||||
@ -700,7 +709,9 @@ void source_v4l2_alternate_hack(int width, int height) {
|
||||
|
||||
/* Let's get the data as fast as possible! */
|
||||
bufcp = video_buf;
|
||||
memcpy( (uint32_t*) frame_cap, (uint8_t*) v4l2_capbuf[video_buf.index].start, video_format.fmt.pix.width * video_format.fmt.pix.height * 3);
|
||||
memcpy( (uint32_t*) frame_cap,
|
||||
(uint8_t*)v4l2_capbuf[video_buf.index].start,
|
||||
video_format.fmt.pix.width * video_format.fmt.pix.height * 3);
|
||||
|
||||
v4l2_munmap(v4l2_capbuf[0].start, v4l2_capbuf[0].len);
|
||||
|
||||
@ -730,20 +741,20 @@ void source_v4l2_alternate_hack(int width, int height) {
|
||||
v4l2_ncapbuf = reqbufs.count;
|
||||
/* printf("GOT v4l2_ncapbuf=%ld\n", v4l2_ncapbuf); */
|
||||
|
||||
index = 0;
|
||||
index = 0;
|
||||
memset(&video_buf, 0, sizeof(struct v4l2_buffer));
|
||||
video_buf.index = index;
|
||||
video_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
video_buf.index = index;
|
||||
video_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
video_buf.memory = V4L2_MEMORY_MMAP;
|
||||
|
||||
v4l2_ioctl(video_device_fd, VIDIOC_QUERYBUF, &video_buf);
|
||||
v4l2_capbuf[index].len = video_buf.length;
|
||||
v4l2_capbuf[index].len = video_buf.length;
|
||||
v4l2_capbuf[index].start = v4l2_mmap(NULL, video_buf.length,
|
||||
PROT_READ|PROT_WRITE, MAP_SHARED, video_device_fd, video_buf.m.offset);
|
||||
memset(&video_buf, 0, sizeof(struct v4l2_buffer));
|
||||
|
||||
video_buf.index = index;
|
||||
video_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
video_buf.index = index;
|
||||
video_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
video_buf.memory = V4L2_MEMORY_MMAP;
|
||||
|
||||
v4l2_ioctl(video_device_fd, VIDIOC_QBUF,& video_buf);
|
||||
@ -764,25 +775,31 @@ void source_v4l2_alternate_hack(int width, int height) {
|
||||
v4l2_frame_times(bufcp);
|
||||
}
|
||||
|
||||
void processing_heal(uint8_t *src, int width, int height) {
|
||||
uint32_t *fp1 = frame_prev1;
|
||||
void processing_heal(uint8_t *src, int width, int height)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < width * height; i+=1, src += 3, ++fp1) {
|
||||
uint32_t *fp1 = frame_prev1;
|
||||
for (i = 0; i < width * height; i+=1, src += 3, ++fp1)
|
||||
{
|
||||
/* Tries to filter a bunch of blanked out scanline sections my capture cards spits out with this crazy hack
|
||||
* Since the blanked out scanlines are set to a black value bellow anything that can be captured, it's quite
|
||||
* easy to select the scanlines...
|
||||
*/
|
||||
if (src[0] <= 0 && src[1] <= 0 && src[2] <= 0 && i >= width && i <= width * height - width) {
|
||||
if (src[0] <= 0 && src[1] <= 0 && src[2] <= 0 && i >= width && i <= width * height - width)
|
||||
{
|
||||
if (*(src + 0 - width*3) >= ((*fp1>> 0&0xFF)-6) && \
|
||||
*(src + 1 - width*3) >= ((*fp1>> 8&0xFF)-6) && \
|
||||
*(src + 2 - width*3) >= ((*fp1>>16&0xFF)-6) && \
|
||||
*(src + 0 - width*3) <= ((*fp1>> 0&0xFF)+6) && \
|
||||
*(src + 1 - width*3) <= ((*fp1>> 8&0xFF)+6) && \
|
||||
*(src + 2 - width*3) <= ((*fp1>>16&0xFF)+6)) {
|
||||
*(src + 2 - width*3) <= ((*fp1>>16&0xFF)+6))
|
||||
{
|
||||
src[0] = (*fp1>> 0&0xFF);
|
||||
src[1] = (*fp1>> 8&0xFF);
|
||||
src[2] = (*fp1>>16&0xFF);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
src[0] = (*(fp1+i+width)>> 0&0xFF);
|
||||
src[1] = (*(fp1+i+width)>> 8&0xFF);
|
||||
src[2] = (*(fp1+i+width)>>16&0xFF);
|
||||
@ -791,7 +808,9 @@ void processing_heal(uint8_t *src, int width, int height) {
|
||||
}
|
||||
}
|
||||
|
||||
void processing_deinterlacing_crap(uint32_t *src, uint32_t *dst, int width, int height, enum v4l2_field field, int skip_lines_src) {
|
||||
void processing_deinterlacing_crap(uint32_t *src, uint32_t *dst, int width,
|
||||
int height, enum v4l2_field field, int skip_lines_src)
|
||||
{
|
||||
int i, targetrow=0;
|
||||
uint32_t pixacul=0;
|
||||
uint32_t *fp1 = frame_prev1, *fp2 = frame_prev2, *fp3 = frame_prev3;
|
||||
@ -806,9 +825,11 @@ void processing_deinterlacing_crap(uint32_t *src, uint32_t *dst, int width, int
|
||||
* On progressive sources, should only skip the destination lines, since all lines the source are the same fields
|
||||
* On interlaced sources, should skip both the source and the destination lines, since only half the lines in the source are the same fields (must also skip fields later)
|
||||
*/
|
||||
if (field == V4L2_FIELD_BOTTOM) {
|
||||
if (field == V4L2_FIELD_BOTTOM)
|
||||
{
|
||||
dst += width;
|
||||
if (skip_lines_src == 1) {
|
||||
if (skip_lines_src == 1)
|
||||
{
|
||||
src += width;
|
||||
fp1 += width;
|
||||
fp2 += width;
|
||||
@ -816,7 +837,8 @@ void processing_deinterlacing_crap(uint32_t *src, uint32_t *dst, int width, int
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < width * height; i+=1, src += 1, dst += 1, ++fp1, ++fp2, ++fp3) {
|
||||
for (i = 0; i < width * height; i+=1, src += 1, dst += 1, ++fp1, ++fp2, ++fp3)
|
||||
{
|
||||
/* Will fill the current destination line with current field
|
||||
* The masking is used to prserve some information set by the
|
||||
* deinterlacing process, uses the alpha channel to tell if a
|
||||
@ -825,32 +847,35 @@ void processing_deinterlacing_crap(uint32_t *src, uint32_t *dst, int width, int
|
||||
*(dst) = (*(src) & 0x00FFFFFF) | (*dst & 0xFF000000);
|
||||
|
||||
/* Crappy deinterlacing */
|
||||
if (i >= width && i <= (width*height-width)) {
|
||||
if (i >= width && i <= (width*height-width))
|
||||
{
|
||||
pixacul=((((*(dst)>> 0&0xFF) + (pixacul>> 0&0xFF))>>1<<0 |\
|
||||
((*(dst)>> 8&0xFF) + (pixacul>> 8&0xFF))>>1<<8 |\
|
||||
((*(dst)>>16&0xFF) + (pixacul>>16&0xFF))>>1<<16) \
|
||||
& 0x00FFFFFF) | 0xFE000000;
|
||||
|
||||
if ( ((*(dst ) & 0xFF000000) == 0xFE000000) ||\
|
||||
((*(dst+targetrow) & 0xFF000000) == 0xFE000000) ) {
|
||||
((*(dst+targetrow) & 0xFF000000) == 0xFE000000) )
|
||||
{
|
||||
*dst = pixacul | 0xFF000000;
|
||||
*(dst+targetrow) = pixacul | 0xFF000000;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(((*(src+0)>> 0&0xFF) >= ((*(fp2+0)>> 0&0xFF)-9) ) &&\
|
||||
((*(src+0)>> 8&0xFF) >= ((*(fp2+0)>> 8&0xFF)-9) ) &&\
|
||||
((*(src+0)>>16&0xFF) >= ((*(fp2+0)>>16&0xFF)-9) ) &&\
|
||||
((*(src+0)>> 0&0xFF) <= ((*(fp2+0)>> 0&0xFF)+9) ) &&\
|
||||
((*(src+0)>> 8&0xFF) <= ((*(fp2+0)>> 8&0xFF)+9) ) &&\
|
||||
((*(src+0)>>16&0xFF) <= ((*(fp2+0)>>16&0xFF)+9) )) ) {
|
||||
((*(src+0)>>16&0xFF) <= ((*(fp2+0)>>16&0xFF)+9) )) )
|
||||
*(dst+targetrow) = pixacul;
|
||||
} else if (!(((*fp3>> 0&0xFF) >= ((*fp1>> 0&0xFF)-9) ) &&\
|
||||
else if (!(((*fp3>> 0&0xFF) >= ((*fp1>> 0&0xFF)-9) ) &&\
|
||||
((*fp3>> 8&0xFF) >= ((*fp1>> 8&0xFF)-9) ) &&\
|
||||
((*fp3>>16&0xFF) >= ((*fp1>>16&0xFF)-9) ) &&\
|
||||
((*fp3>> 0&0xFF) <= ((*fp1>> 0&0xFF)+9) ) &&\
|
||||
((*fp3>> 8&0xFF) <= ((*fp1>> 8&0xFF)+9) ) &&\
|
||||
((*fp3>>16&0xFF) <= ((*fp1>>16&0xFF)+9) ))) {
|
||||
((*fp3>>16&0xFF) <= ((*fp1>>16&0xFF)+9) )))
|
||||
*(dst+targetrow) = pixacul;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -858,9 +883,11 @@ void processing_deinterlacing_crap(uint32_t *src, uint32_t *dst, int width, int
|
||||
* On progressive sources, should only skip the destination lines,
|
||||
* On interlaced sources, should skip both the source and the destination lines
|
||||
*/
|
||||
if ( ((i+1) % width) == 0 ) {
|
||||
if ( ((i+1) % width) == 0 )
|
||||
{
|
||||
dst += width;
|
||||
if (skip_lines_src == 1) {
|
||||
if (skip_lines_src == 1)
|
||||
{
|
||||
src += width;
|
||||
fp1 += width;
|
||||
fp2 += width;
|
||||
@ -870,12 +897,12 @@ void processing_deinterlacing_crap(uint32_t *src, uint32_t *dst, int width, int
|
||||
}
|
||||
}
|
||||
|
||||
void processing_bgr_xrgb(uint8_t *src, uint32_t *dst, int width, int height) {
|
||||
void processing_bgr_xrgb(uint8_t *src, uint32_t *dst, int width, int height)
|
||||
{
|
||||
/* BGR24 to XRGB8888 conversion */
|
||||
int i;
|
||||
for (i = 0; i < width * height; i+=1, src += 3, dst += 1) {
|
||||
for (i = 0; i < width * height; i+=1, src += 3, dst += 1)
|
||||
*dst = 0xFF << 24 | src[2] << 16 | src[1] << 8 | src[0] << 0;
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void VIDEOPROC_CORE_PREFIX(retro_run)(void)
|
||||
@ -888,7 +915,8 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_run)(void)
|
||||
struct retro_variable frametimes = { "videoproc_frame_times", NULL };
|
||||
bool updated = false;
|
||||
|
||||
if (VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated) {
|
||||
if (VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
||||
{
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &videodev);
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &audiodev);
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &capturemode);
|
||||
@ -900,15 +928,15 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_run)(void)
|
||||
if ((videodev.value && (strcmp(video_device, videodev.value) != 0)) ||\
|
||||
(audiodev.value && (strcmp(audio_device, audiodev.value) != 0)) ||\
|
||||
(capturemode.value && (strcmp(video_capture_mode, capturemode.value) != 0)) ||\
|
||||
(outputmode.value && (strcmp(video_output_mode, outputmode.value) != 0))) {
|
||||
(outputmode.value && (strcmp(video_output_mode, outputmode.value) != 0)))
|
||||
{
|
||||
VIDEOPROC_CORE_PREFIX(retro_unload_game)();
|
||||
/* This core does not cares for the retro_game_info * argument? */
|
||||
VIDEOPROC_CORE_PREFIX(retro_load_game)(NULL);
|
||||
}
|
||||
|
||||
if (frametimes.value != NULL) {
|
||||
if (frametimes.value != NULL)
|
||||
strncpy(video_frame_times, frametimes.value, ENVVAR_BUFLEN-1);
|
||||
}
|
||||
}
|
||||
|
||||
VIDEOPROC_CORE_PREFIX(input_poll_cb)();
|
||||
@ -918,36 +946,45 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_run)(void)
|
||||
* half_feed_rate allows interlaced input to be fed at half the calls to this function
|
||||
* where the same frame is then read by the deinterlacer twice, for each field
|
||||
*/
|
||||
if (video_half_feed_rate == 0) {
|
||||
if (video_half_feed_rate == 0)
|
||||
{
|
||||
/* Capture */
|
||||
if (strcmp(video_device, "dummy") == 0) {
|
||||
if (strcmp(video_device, "dummy") == 0)
|
||||
{
|
||||
source_dummy(video_cap_width, video_cap_height);
|
||||
} else {
|
||||
if (strcmp(video_capture_mode, "alternate_hack") == 0) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(video_capture_mode, "alternate_hack") == 0)
|
||||
{
|
||||
source_v4l2_alternate_hack(video_cap_width, video_cap_height);
|
||||
processing_heal(frame_cap, video_cap_width, video_cap_height);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
source_v4l2_normal(video_cap_width, video_cap_height);
|
||||
}
|
||||
}
|
||||
|
||||
if (video_buf.field == V4L2_FIELD_INTERLACED)
|
||||
video_half_feed_rate = 1;
|
||||
} else {
|
||||
video_half_feed_rate = 0;
|
||||
}
|
||||
else
|
||||
video_half_feed_rate = 0;
|
||||
|
||||
/* Converts from bgr to xrgb, deinterlacing, final copy to the outpuit buffer (frame_out)
|
||||
* Every frame except frame_cap shall be encoded in xrgb
|
||||
* Every frame except frame_out shall have the same height
|
||||
*/
|
||||
if (strcmp(video_output_mode, "deinterlaced") == 0) {
|
||||
if (strcmp(video_output_mode, "deinterlaced") == 0)
|
||||
{
|
||||
processing_bgr_xrgb(frame_cap, frame_curr, video_cap_width, video_cap_height);
|
||||
/* When deinterlacing a interlaced input, we need to process both fields of a frame,
|
||||
* one at a time (retro_run needs to be called twice, vide_half_feed_rate prevents the
|
||||
* source from being read twice...
|
||||
*/
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0) {
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0)
|
||||
{
|
||||
enum v4l2_field field_read;
|
||||
if (video_half_feed_rate == 0)
|
||||
field_read = V4L2_FIELD_TOP;
|
||||
@ -957,34 +994,41 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_run)(void)
|
||||
* deinterlacing algo twice, extracting a given field for each run.
|
||||
*/
|
||||
processing_deinterlacing_crap(frame_curr, frame_out, video_cap_width, video_cap_height/2, field_read, 1);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
processing_deinterlacing_crap(frame_curr, frame_out, video_cap_width, video_cap_height, (enum v4l2_field)video_buf.field, 0);
|
||||
}
|
||||
aux = frame_prev3;
|
||||
aux = frame_prev3;
|
||||
frame_prev3 = frame_prev2;
|
||||
frame_prev2 = frame_prev1;
|
||||
frame_prev1 = frame_curr;
|
||||
frame_curr = aux;
|
||||
frame_curr = aux;
|
||||
|
||||
VIDEOPROC_CORE_PREFIX(video_refresh_cb)(frame_out, video_cap_width,
|
||||
video_out_height, video_cap_width * sizeof(uint32_t));
|
||||
} else if (strcmp(video_capture_mode, "alternate_hack") == 0) {
|
||||
/* Case where alternate_hack without deinterlacing would not generate previous frame for processing_heal */
|
||||
}
|
||||
else if (strcmp(video_capture_mode, "alternate_hack") == 0)
|
||||
{
|
||||
/* Case where alternate_hack without deinterlacing would
|
||||
* not generate previous frame for processing_heal */
|
||||
processing_bgr_xrgb(frame_cap, frame_curr, video_cap_width, video_cap_height);
|
||||
aux = frame_prev3;
|
||||
aux = frame_prev3;
|
||||
frame_prev3 = frame_prev2;
|
||||
frame_prev2 = frame_prev1;
|
||||
frame_prev1 = frame_curr;
|
||||
frame_curr = aux;
|
||||
frame_curr = aux;
|
||||
|
||||
aux = frame_out;
|
||||
frame_out = frame_curr;
|
||||
aux = frame_out;
|
||||
frame_out = frame_curr;
|
||||
|
||||
VIDEOPROC_CORE_PREFIX(video_refresh_cb)(frame_out, video_cap_width,
|
||||
video_out_height, video_cap_width * sizeof(uint32_t));
|
||||
|
||||
frame_out = aux;
|
||||
} else {
|
||||
frame_out = aux;
|
||||
}
|
||||
else
|
||||
{
|
||||
processing_bgr_xrgb(frame_cap, frame_out, video_cap_width, video_out_height);
|
||||
|
||||
VIDEOPROC_CORE_PREFIX(video_refresh_cb)(frame_out, video_cap_width,
|
||||
@ -993,47 +1037,35 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_run)(void)
|
||||
}
|
||||
|
||||
RETRO_API size_t VIDEOPROC_CORE_PREFIX(retro_serialize_size)(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_serialize)(void *data, size_t size)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_unserialize)(const void *data, size_t size)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RETRO_API void VIDEOPROC_CORE_PREFIX(retro_cheat_reset)(void)
|
||||
{
|
||||
}
|
||||
|
||||
RETRO_API void VIDEOPROC_CORE_PREFIX(retro_cheat_set)(unsigned index, bool enabled, const char *code)
|
||||
{
|
||||
}
|
||||
{ return 0; }
|
||||
RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_serialize)(
|
||||
void *data, size_t len) { return false; }
|
||||
RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_unserialize)(
|
||||
const void *data, size_t len) { return false; }
|
||||
RETRO_API void VIDEOPROC_CORE_PREFIX(retro_cheat_reset)(void) { }
|
||||
RETRO_API void VIDEOPROC_CORE_PREFIX(retro_cheat_set)(unsigned a,
|
||||
bool b, const char *c) { }
|
||||
|
||||
#if 0
|
||||
static void videoinput_set_control_v4l2( uint32_t id, double val )
|
||||
static void videoinput_set_control_v4l2( uint32_t id, double val)
|
||||
{
|
||||
struct v4l2_queryctrl query;
|
||||
|
||||
query.id = id;
|
||||
if( ioctl( video_device_fd, VIDIOC_QUERYCTRL, &query ) >= 0 && !(query.flags & V4L2_CTRL_FLAG_DISABLED) ) {
|
||||
if(ioctl(video_device_fd, VIDIOC_QUERYCTRL, &query) >= 0 && !(query.flags & V4L2_CTRL_FLAG_DISABLED))
|
||||
{
|
||||
struct v4l2_control control;
|
||||
control.id = id;
|
||||
control.value = query.minimum + ((int) ((val * ((double) (query.maximum - query.minimum))) + 0.5));
|
||||
ioctl( video_device_fd, VIDIOC_S_CTRL, &control );
|
||||
ioctl(video_device_fd, VIDIOC_S_CTRL, &control);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_info *game)
|
||||
{
|
||||
struct retro_variable videodev = { "videoproc_videodev", NULL };
|
||||
struct retro_variable audiodev = { "videoproc_audiodev", NULL };
|
||||
struct retro_variable videodev = { "videoproc_videodev", NULL };
|
||||
struct retro_variable audiodev = { "videoproc_audiodev", NULL };
|
||||
struct retro_variable capture_mode = { "videoproc_capture_mode", NULL };
|
||||
struct retro_variable output_mode = { "videoproc_output_mode", NULL };
|
||||
struct retro_variable frame_times = { "videoproc_frame_times", NULL };
|
||||
@ -1056,7 +1088,8 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
}
|
||||
|
||||
#ifdef HAVE_ALSA
|
||||
if (audio_handle != NULL) {
|
||||
if (audio_handle != NULL)
|
||||
{
|
||||
struct retro_audio_callback audio_cb;
|
||||
audio_cb.callback = audio_callback;
|
||||
audio_cb.set_state = audio_set_state;
|
||||
@ -1065,7 +1098,8 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
#endif
|
||||
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &videodev);
|
||||
if (videodev.value == NULL) {
|
||||
if (videodev.value == NULL)
|
||||
{
|
||||
close_devices();
|
||||
return false;
|
||||
}
|
||||
@ -1073,13 +1107,13 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
|
||||
/* Audio device is optional... */
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &audiodev);
|
||||
if (audiodev.value != NULL) {
|
||||
if (audiodev.value != NULL)
|
||||
strncpy(audio_device, audiodev.value, ENVVAR_BUFLEN-1);
|
||||
}
|
||||
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &capture_mode);
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &output_mode);
|
||||
if (capture_mode.value == NULL || output_mode.value == NULL) {
|
||||
if (capture_mode.value == NULL || output_mode.value == NULL)
|
||||
{
|
||||
close_devices();
|
||||
return false;
|
||||
}
|
||||
@ -1087,32 +1121,37 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
strncpy(video_output_mode, output_mode.value, ENVVAR_BUFLEN-1);
|
||||
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &frame_times);
|
||||
if (frame_times.value != NULL) {
|
||||
if (frame_times.value != NULL)
|
||||
strncpy(video_frame_times, frame_times.value, ENVVAR_BUFLEN-1);
|
||||
}
|
||||
|
||||
if (strcmp(video_device, "dummy") == 0) {
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0) {
|
||||
if (strcmp(video_device, "dummy") == 0)
|
||||
{
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0)
|
||||
{
|
||||
video_format.fmt.pix.height = 480;
|
||||
video_cap_height = 480;
|
||||
video_buf.field = V4L2_FIELD_INTERLACED;
|
||||
} else if (strcmp(video_capture_mode, "alternate") == 0 ||\
|
||||
strcmp(video_capture_mode, "top") == 0 ||\
|
||||
strcmp(video_capture_mode, "bottom") == 0 ||\
|
||||
strcmp(video_capture_mode, "alternate_hack") == 0) {
|
||||
video_cap_height = 480;
|
||||
video_buf.field = V4L2_FIELD_INTERLACED;
|
||||
}
|
||||
else if ( strcmp(video_capture_mode, "alternate") == 0
|
||||
|| strcmp(video_capture_mode, "top") == 0
|
||||
|| strcmp(video_capture_mode, "bottom") == 0
|
||||
|| strcmp(video_capture_mode, "alternate_hack") == 0)
|
||||
{
|
||||
video_format.fmt.pix.height = 240;
|
||||
video_cap_height = 240;
|
||||
video_buf.field = V4L2_FIELD_TOP;
|
||||
video_cap_height = 240;
|
||||
video_buf.field = V4L2_FIELD_TOP;
|
||||
}
|
||||
|
||||
dummy_pos=0;
|
||||
dummy_pos = 0;
|
||||
video_format.fmt.pix.width = 640;
|
||||
video_cap_width = 640;
|
||||
} else {
|
||||
video_cap_width = 640;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&fmt, 0, sizeof(fmt));
|
||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_G_FMT, &fmt);
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_G_FMT, &fmt);
|
||||
|
||||
if (error != 0)
|
||||
{
|
||||
@ -1129,29 +1168,33 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
fmt.fmt.pix.field = V4L2_FIELD_TOP;
|
||||
|
||||
/* TODO Query the size and FPS */
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0) {
|
||||
v4l2_ncapbuf_target = 2;
|
||||
fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0)
|
||||
{
|
||||
v4l2_ncapbuf_target = 2;
|
||||
fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
|
||||
video_format.fmt.pix.height = 480;
|
||||
video_cap_height = 480;
|
||||
} else {
|
||||
v4l2_ncapbuf_target = 2;
|
||||
video_cap_height = 480;
|
||||
}
|
||||
else
|
||||
{
|
||||
v4l2_ncapbuf_target = 2;
|
||||
video_format.fmt.pix.height = 240;
|
||||
video_cap_height = 240;
|
||||
video_cap_height = 240;
|
||||
if (strcmp(video_capture_mode, "alternate") == 0)
|
||||
fmt.fmt.pix.field = V4L2_FIELD_ALTERNATE;
|
||||
else if (strcmp(video_capture_mode, "top") == 0)
|
||||
fmt.fmt.pix.field = V4L2_FIELD_TOP;
|
||||
else if (strcmp(video_capture_mode, "bottom") == 0)
|
||||
fmt.fmt.pix.field = V4L2_FIELD_BOTTOM;
|
||||
else if (strcmp(video_capture_mode, "alternate_hack") == 0) {
|
||||
fmt.fmt.pix.field = V4L2_FIELD_TOP;
|
||||
else if (strcmp(video_capture_mode, "alternate_hack") == 0)
|
||||
{
|
||||
fmt.fmt.pix.field = V4L2_FIELD_TOP;
|
||||
v4l2_ncapbuf_target = 1;
|
||||
}
|
||||
}
|
||||
|
||||
video_format.fmt.pix.width = 720;
|
||||
video_cap_width = 720;
|
||||
video_cap_width = 720;
|
||||
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_S_FMT, &fmt);
|
||||
if (error != 0)
|
||||
@ -1170,13 +1213,13 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
{
|
||||
memset(&std, 0, sizeof(std));
|
||||
std.index = index;
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_ENUMSTD, &std);
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_ENUMSTD, &std);
|
||||
if (error)
|
||||
break;
|
||||
if (std.id == std_id)
|
||||
{
|
||||
video_standard = std;
|
||||
std_found = true;
|
||||
std_found = true;
|
||||
}
|
||||
printf("VIDIOC_ENUMSTD[%u]: %s%s\n", index, std.name, std.id == std_id ? " [*]" : "");
|
||||
}
|
||||
@ -1190,11 +1233,11 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
/* TODO Check if what we got is indeed what we asked for */
|
||||
|
||||
memset(&reqbufs, 0, sizeof(reqbufs));
|
||||
reqbufs.count = v4l2_ncapbuf_target;
|
||||
reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
reqbufs.count = v4l2_ncapbuf_target;
|
||||
reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
reqbufs.memory = V4L2_MEMORY_MMAP;
|
||||
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_REQBUFS, &reqbufs);
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_REQBUFS, &reqbufs);
|
||||
if (error != 0)
|
||||
{
|
||||
printf("VIDIOC_REQBUFS failed: %s\n", strerror(errno));
|
||||
@ -1206,18 +1249,18 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
for (index = 0; index < v4l2_ncapbuf; index++)
|
||||
{
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
buf.index = index;
|
||||
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
buf.index = index;
|
||||
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
buf.memory = V4L2_MEMORY_MMAP;
|
||||
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_QUERYBUF, &buf);
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_QUERYBUF, &buf);
|
||||
if (error != 0)
|
||||
{
|
||||
printf("VIDIOC_QUERYBUF failed for %u: %s\n", index, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
v4l2_capbuf[index].len = buf.length;
|
||||
v4l2_capbuf[index].len = buf.length;
|
||||
v4l2_capbuf[index].start = v4l2_mmap(NULL, buf.length,
|
||||
PROT_READ|PROT_WRITE, MAP_SHARED, video_device_fd, buf.m.offset);
|
||||
if (v4l2_capbuf[index].start == MAP_FAILED)
|
||||
@ -1230,19 +1273,20 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
for (index = 0; index < v4l2_ncapbuf; index++)
|
||||
{
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
buf.index = index;
|
||||
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
buf.index = index;
|
||||
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
buf.memory = V4L2_MEMORY_MMAP;
|
||||
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_QBUF, &buf);
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_QBUF, &buf);
|
||||
if (error != 0)
|
||||
{
|
||||
printf("VIDIOC_QBUF failed for %u: %s\n", index, strerror(errno));
|
||||
printf("VIDIOC_QBUF failed for %u: %s\n", index,
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
error = v4l2_ioctl(video_device_fd, VIDIOC_STREAMON, &type);
|
||||
if (error != 0)
|
||||
{
|
||||
@ -1253,33 +1297,41 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
/* videoinput_set_control_v4l2(V4L2_CID_HUE, (double) 0.4f); */
|
||||
}
|
||||
|
||||
/* TODO Framerates?
|
||||
* Each frame should combine both fields into a full frame (if not already captured interlaced), half frame-rate
|
||||
/* TODO/FIXME Framerates?
|
||||
* Each frame should combine both fields into a full frame
|
||||
* (if not already captured interlaced), half frame-rate
|
||||
*/
|
||||
if (strcmp(video_output_mode, "interlaced") == 0) {
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0) {
|
||||
if (strcmp(video_output_mode, "interlaced") == 0)
|
||||
{
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0)
|
||||
video_out_height = video_cap_height;
|
||||
} else {
|
||||
printf("WARNING: Capture mode %s with output mode %s is not properly supported yet... (Is this even useful?)\n", \
|
||||
else
|
||||
{
|
||||
printf("WARNING: Capture mode %s with output mode %s is not"
|
||||
" properly supported yet... (Is this even useful?)\n", \
|
||||
video_capture_mode, video_output_mode);
|
||||
video_out_height = video_cap_height*2;
|
||||
}
|
||||
/* Each frame has one field, full frame-rate */
|
||||
} else if (strcmp(video_output_mode, "progressive") == 0) {
|
||||
/* Each frame has one field, full frame-rate */
|
||||
}
|
||||
/* Each frame has one or both field to be deinterlaced
|
||||
* into a full frame (double the lines if one field), full frame-rate */
|
||||
else if (strcmp(video_output_mode, "progressive") == 0)
|
||||
video_out_height = video_cap_height;
|
||||
/* Each frame has one or both field to be deinterlaced into a full frame (double the lines if one field), full frame-rate */
|
||||
} else if (strcmp(video_output_mode, "deinterlaced") == 0) {
|
||||
else if (strcmp(video_output_mode, "deinterlaced") == 0)
|
||||
{
|
||||
if (strcmp(video_capture_mode, "interlaced") == 0)
|
||||
video_out_height = video_cap_height;
|
||||
else
|
||||
video_out_height = video_cap_height*2;
|
||||
} else
|
||||
}
|
||||
else
|
||||
video_out_height = video_cap_height;
|
||||
|
||||
printf("Capture Resolution %ux%u\n", video_cap_width, video_cap_height);
|
||||
printf("Output Resolution %ux%u\n", video_cap_width, video_out_height);
|
||||
|
||||
frame_cap = (uint8_t*)calloc(1, video_cap_width * video_cap_height * sizeof(uint8_t) * 3);
|
||||
frame_cap = (uint8_t*)calloc (1, video_cap_width * video_cap_height * sizeof(uint8_t) * 3);
|
||||
frame_out = (uint32_t*)calloc(1, video_cap_width * video_out_height * sizeof(uint32_t));
|
||||
/* TODO: Only allocate frames if we are going to use it (for deinterlacing or other filters?) */
|
||||
frames[0] = (uint32_t*)calloc(1, video_cap_width * video_out_height * sizeof(uint32_t));
|
||||
@ -1287,17 +1339,14 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
|
||||
frames[2] = (uint32_t*)calloc(1, video_cap_width * video_out_height * sizeof(uint32_t));
|
||||
frames[3] = (uint32_t*)calloc(1, video_cap_width * video_out_height * sizeof(uint32_t));
|
||||
|
||||
frame_curr = frames[0];
|
||||
frame_curr = frames[0];
|
||||
frame_prev1 = frames[1];
|
||||
frame_prev2 = frames[2];
|
||||
frame_prev3 = frames[3];
|
||||
|
||||
/* TODO: Check frames[] allocation */
|
||||
if (!frame_out || !frame_cap)
|
||||
{
|
||||
printf("Cannot allocate buffers\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
printf("Allocated %" PRI_SIZET " byte conversion buffer\n",
|
||||
(size_t)(video_cap_width * video_cap_height) * sizeof(uint32_t));
|
||||
@ -1318,7 +1367,8 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_unload_game)(void)
|
||||
int i;
|
||||
|
||||
#ifdef HAVE_ALSA
|
||||
if (audio_handle != NULL) {
|
||||
if (audio_handle != NULL)
|
||||
{
|
||||
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK, NULL);
|
||||
}
|
||||
#endif
|
||||
@ -1327,7 +1377,8 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_unload_game)(void)
|
||||
{
|
||||
uint32_t index;
|
||||
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
int error = v4l2_ioctl(video_device_fd, VIDIOC_STREAMOFF, &type);
|
||||
int error = v4l2_ioctl(video_device_fd,
|
||||
VIDIOC_STREAMOFF, &type);
|
||||
if (error != 0)
|
||||
printf("VIDIOC_STREAMOFF failed: %s\n", strerror(errno));
|
||||
|
||||
@ -1351,7 +1402,8 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_unload_game)(void)
|
||||
free(frame_cap);
|
||||
frame_cap = NULL;
|
||||
|
||||
for (i = 0; i<4; ++i) {
|
||||
for (i = 0; i<4; ++i)
|
||||
{
|
||||
if (frames[i])
|
||||
free(frames[i]);
|
||||
frames[i] = NULL;
|
||||
@ -1361,12 +1413,14 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_unload_game)(void)
|
||||
frame_prev2 = NULL;
|
||||
frame_prev3 = NULL;
|
||||
|
||||
if (ft_info) {
|
||||
if (ft_info)
|
||||
{
|
||||
free(ft_info);
|
||||
ft_info = NULL;
|
||||
}
|
||||
|
||||
if (ft_info2) {
|
||||
if (ft_info2)
|
||||
{
|
||||
free(ft_info2);
|
||||
ft_info2 = NULL;
|
||||
}
|
||||
@ -1377,10 +1431,7 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_unload_game)(void)
|
||||
}
|
||||
|
||||
RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game_special)(unsigned game_type,
|
||||
const struct retro_game_info *info, size_t num_info)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
const struct retro_game_info *info, size_t num_info) { return false; }
|
||||
|
||||
RETRO_API unsigned VIDEOPROC_CORE_PREFIX(retro_get_region)(void)
|
||||
{
|
||||
|
@ -685,10 +685,8 @@ static enum frontend_architecture frontend_darwin_get_arch(void)
|
||||
return FRONTEND_ARCH_ARMV8;
|
||||
#else
|
||||
cpu_type_t type;
|
||||
size_t size = sizeof(type);
|
||||
|
||||
sysctlbyname("hw.cputype", &type, &size, NULL, 0);
|
||||
|
||||
size_t _len = sizeof(type);
|
||||
sysctlbyname("hw.cputype", &type, &_len, NULL, 0);
|
||||
if (type == CPU_TYPE_X86_64)
|
||||
return FRONTEND_ARCH_X86_64;
|
||||
else if (type == CPU_TYPE_X86)
|
||||
@ -756,14 +754,14 @@ static uint64_t frontend_darwin_get_total_mem(void)
|
||||
uint64_t size;
|
||||
int mib[2] = { CTL_HW, HW_MEMSIZE };
|
||||
u_int namelen = ARRAY_SIZE(mib);
|
||||
size_t len = sizeof(size);
|
||||
if (sysctl(mib, namelen, &size, &len, NULL, 0) >= 0)
|
||||
size_t _len = sizeof(size);
|
||||
if (sysctl(mib, namelen, &size, &_len, NULL, 0) >= 0)
|
||||
return size;
|
||||
#elif defined(IOS)
|
||||
task_vm_info_data_t vmInfo;
|
||||
task_vm_info_data_t vm_info;
|
||||
mach_msg_type_number_t count = TASK_VM_INFO_COUNT;
|
||||
if (task_info(mach_task_self(), TASK_VM_INFO, (task_info_t) &vmInfo, &count) == KERN_SUCCESS)
|
||||
return vmInfo.phys_footprint + vmInfo.limit_bytes_remaining;
|
||||
if (task_info(mach_task_self(), TASK_VM_INFO, (task_info_t) &vm_info, &count) == KERN_SUCCESS)
|
||||
return vm_info.phys_footprint + vm_info.limit_bytes_remaining;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -776,8 +774,8 @@ static uint64_t frontend_darwin_get_free_mem(void)
|
||||
mach_port_t mach_port = mach_host_self();
|
||||
mach_msg_type_number_t count = sizeof(vm_stats) / sizeof(natural_t);
|
||||
|
||||
if (KERN_SUCCESS == host_page_size(mach_port, &page_size) &&
|
||||
KERN_SUCCESS == host_statistics64(mach_port, HOST_VM_INFO,
|
||||
if ( KERN_SUCCESS == host_page_size(mach_port, &page_size)
|
||||
&& KERN_SUCCESS == host_statistics64(mach_port, HOST_VM_INFO,
|
||||
(host_info64_t)&vm_stats, &count))
|
||||
{
|
||||
long long used_memory = (
|
||||
@ -787,10 +785,10 @@ static uint64_t frontend_darwin_get_free_mem(void)
|
||||
return used_memory;
|
||||
}
|
||||
#elif defined(IOS)
|
||||
task_vm_info_data_t vmInfo;
|
||||
task_vm_info_data_t vm_info;
|
||||
mach_msg_type_number_t count = TASK_VM_INFO_COUNT;
|
||||
if (task_info(mach_task_self(), TASK_VM_INFO, (task_info_t) &vmInfo, &count) == KERN_SUCCESS)
|
||||
return vmInfo.limit_bytes_remaining;
|
||||
if (task_info(mach_task_self(), TASK_VM_INFO, (task_info_t) &vm_info, &count) == KERN_SUCCESS)
|
||||
return vm_info.limit_bytes_remaining;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -808,7 +806,8 @@ static enum retro_language frontend_darwin_get_user_language(void)
|
||||
CFArrayRef langs = CFLocaleCopyPreferredLanguages();
|
||||
CFStringRef langCode = CFArrayGetValueAtIndex(langs, 0);
|
||||
CFStringGetCString(langCode, s, sizeof(s), kCFStringEncodingUTF8);
|
||||
/* iOS and OS X only support the language ID syntax consisting of a language designator and optional region or script designator. */
|
||||
/* iOS and OS X only support the language ID syntax consisting
|
||||
* of a language designator and optional region or script designator. */
|
||||
string_replace_all_chars(s, '-', '_');
|
||||
return retroarch_get_language_from_iso(s);
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ static void dol_copy_argv_path(const char *dolpath, const char *argpath)
|
||||
}
|
||||
|
||||
static void dol_copy_raw_argv(const char *dolpath,
|
||||
const void *args, size_t size)
|
||||
const void *args, size_t len)
|
||||
{
|
||||
struct __argv *argv = (struct __argv*)ARGS_ADDR;
|
||||
char *cmdline = (char*)++argv;
|
||||
@ -154,8 +154,8 @@ static void dol_copy_raw_argv(const char *dolpath,
|
||||
argv->length = (int)strlcat(cmdline, dolpath, PATH_MAX_LENGTH);
|
||||
argv->length += 1;
|
||||
|
||||
memcpy(cmdline + argv->length, args, size);
|
||||
argv->length += size;
|
||||
memcpy(cmdline + argv->length, args, len);
|
||||
argv->length += len;
|
||||
|
||||
DCFlushRange(argv, sizeof(*argv) + argv->length);
|
||||
}
|
||||
|
@ -388,8 +388,7 @@ enum frontend_architecture frontend_driver_get_cpu_architecture(void)
|
||||
return FRONTEND_ARCH_NONE;
|
||||
}
|
||||
|
||||
const void *frontend_driver_get_cpu_architecture_str(
|
||||
char *s, size_t len)
|
||||
const void *frontend_driver_get_cpu_architecture_str(char *s, size_t len)
|
||||
{
|
||||
frontend_state_t *frontend_st = &frontend_driver_st;
|
||||
frontend_ctx_driver_t *frontend = frontend_st->current_frontend_ctx;
|
||||
|
@ -162,8 +162,7 @@ void frontend_driver_free(void);
|
||||
|
||||
enum frontend_architecture frontend_driver_get_cpu_architecture(void);
|
||||
|
||||
const void *frontend_driver_get_cpu_architecture_str(
|
||||
char *frontend_architecture, size_t size);
|
||||
const void *frontend_driver_get_cpu_architecture_str(char *s, size_t len);
|
||||
|
||||
bool frontend_driver_has_get_video_driver_func(void);
|
||||
|
||||
|
@ -683,7 +683,7 @@ typedef struct vk
|
||||
} vk_t;
|
||||
|
||||
bool vulkan_buffer_chain_alloc(const struct vulkan_context *context,
|
||||
struct vk_buffer_chain *chain, size_t size,
|
||||
struct vk_buffer_chain *chain, size_t len,
|
||||
struct vk_buffer_range *range);
|
||||
|
||||
struct vk_descriptor_pool *vulkan_alloc_descriptor_pool(
|
||||
@ -703,7 +703,7 @@ void vulkan_debug_mark_buffer(VkDevice device, VkBuffer buffer);
|
||||
|
||||
struct vk_buffer vulkan_create_buffer(
|
||||
const struct vulkan_context *context,
|
||||
size_t size, VkBufferUsageFlags usage);
|
||||
size_t len, VkBufferUsageFlags usage);
|
||||
|
||||
void vulkan_destroy_buffer(
|
||||
VkDevice device,
|
||||
|
@ -282,12 +282,12 @@ uint32_t gl3_get_cross_compiler_target_version(void)
|
||||
return 100 * major + 10 * minor;
|
||||
}
|
||||
|
||||
static void gl3_bind_scratch_vbo(gl3_t *gl, const void *data, size_t size)
|
||||
static void gl3_bind_scratch_vbo(gl3_t *gl, const void *data, size_t len)
|
||||
{
|
||||
if (!gl->scratch_vbos[gl->scratch_vbo_index])
|
||||
glGenBuffers(1, &gl->scratch_vbos[gl->scratch_vbo_index]);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, gl->scratch_vbos[gl->scratch_vbo_index]);
|
||||
glBufferData(GL_ARRAY_BUFFER, size, data, GL_STREAM_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, len, data, GL_STREAM_DRAW);
|
||||
gl->scratch_vbo_index++;
|
||||
if (gl->scratch_vbo_index >= GL_CORE_NUM_VBOS)
|
||||
gl->scratch_vbo_index = 0;
|
||||
|
@ -133,24 +133,19 @@ static void omapfb_page_flip(omapfb_data_t *pdata)
|
||||
pdata->old_page->used = false;
|
||||
}
|
||||
|
||||
static int omapfb_read_sysfs(const char *fname, char *buff, size_t size)
|
||||
static int omapfb_read_sysfs(const char *fname, char *s, size_t len)
|
||||
{
|
||||
int ret;
|
||||
FILE *f = fopen(fname, "r");
|
||||
|
||||
if (!f)
|
||||
return -1;
|
||||
|
||||
ret = fread(buff, 1, size - 1, f);
|
||||
ret = fread(s, 1, len - 1, f);
|
||||
fclose(f);
|
||||
|
||||
if (ret <= 0)
|
||||
return -1;
|
||||
|
||||
buff[ret] = 0;
|
||||
for (ret--; ret >= 0 && isspace(buff[ret]); ret--)
|
||||
buff[ret] = 0;
|
||||
|
||||
s[ret] = 0;
|
||||
for (ret--; ret >= 0 && isspace(s[ret]); ret--)
|
||||
s[ret] = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1683,11 +1683,11 @@ void Pass::build_commands(
|
||||
unsigned vertex_binding = locations.buffer_index_ubo_vertex;
|
||||
unsigned fragment_binding = locations.buffer_index_ubo_fragment;
|
||||
const void *data = uniforms.data();
|
||||
size_t size = reflection.ubo_size;
|
||||
size_t _len = reflection.ubo_size;
|
||||
GLuint id = ubo_ring.buffers[ubo_ring.buffer_index];
|
||||
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, id);
|
||||
glBufferSubData(GL_UNIFORM_BUFFER, 0, size, data);
|
||||
glBufferSubData(GL_UNIFORM_BUFFER, 0, _len, data);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
if (vertex_binding != GL_INVALID_INDEX)
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, vertex_binding, id);
|
||||
|
@ -766,12 +766,12 @@ static void btpad_increment_position(uint32_t *ptr)
|
||||
}
|
||||
|
||||
static void btpad_connection_send_control(void *data,
|
||||
uint8_t* data_buf, size_t size)
|
||||
uint8_t* data_buf, size_t len)
|
||||
{
|
||||
struct btstack_hid_adapter *connection = (struct btstack_hid_adapter*)data;
|
||||
|
||||
if (connection)
|
||||
bt_send_l2cap_ptr(connection->channels[0], data_buf, size);
|
||||
bt_send_l2cap_ptr(connection->channels[0], data_buf, len);
|
||||
}
|
||||
|
||||
static void btpad_queue_process_cmd(struct btpad_queue_command *cmd)
|
||||
|
@ -269,14 +269,14 @@ static bool iohidmanager_hid_joypad_rumble(void *data, unsigned pad,
|
||||
}
|
||||
|
||||
static void iohidmanager_hid_device_send_control(void *data,
|
||||
uint8_t* data_buf, size_t size)
|
||||
uint8_t* data_buf, size_t len)
|
||||
{
|
||||
struct iohidmanager_hid_adapter *adapter =
|
||||
(struct iohidmanager_hid_adapter*)data;
|
||||
|
||||
if (adapter)
|
||||
IOHIDDeviceSetReport(adapter->handle,
|
||||
kIOHIDReportTypeOutput, 0x01, data_buf + 1, size - 1);
|
||||
kIOHIDReportTypeOutput, 0x01, data_buf + 1, len - 1);
|
||||
}
|
||||
|
||||
static void iohidmanager_hid_device_report(void *data,
|
||||
@ -490,7 +490,7 @@ static void iohidmanager_hid_device_remove(IOHIDDeviceRef device, iohidmanager_h
|
||||
{
|
||||
int i, slot;
|
||||
struct iohidmanager_hid_adapter *adapter = NULL;
|
||||
|
||||
|
||||
/*loop though the controller ports and find the device with a matching IOHINDeviceRef*/
|
||||
for (i=0; i<MAX_USERS; i++)
|
||||
{
|
||||
@ -1036,11 +1036,11 @@ static int iohidmanager_hid_manager_set_device_matching(
|
||||
kHIDUsage_GD_GamePad);
|
||||
/* The GameCube Adapter reports usage id 0x00 */
|
||||
iohidmanager_hid_append_matching_dictionary(matcher, kHIDPage_Game, 0x00);
|
||||
|
||||
|
||||
IOHIDManagerSetDeviceMatchingMultiple(hid->ptr, matcher);
|
||||
IOHIDManagerRegisterDeviceMatchingCallback(hid->ptr,iohidmanager_hid_device_matched, 0);
|
||||
IOHIDManagerRegisterDeviceRemovalCallback(hid->ptr,iohidmanager_hid_device_removed, 0);
|
||||
|
||||
|
||||
CFRelease(matcher);
|
||||
|
||||
return 0;
|
||||
@ -1088,27 +1088,29 @@ static void iohidmanager_hid_free(const void *data)
|
||||
|
||||
static void iohidmanager_hid_poll(void *data) { }
|
||||
|
||||
static int32_t iohidmanager_set_report(void *handle, uint8_t report_type, uint8_t report_id, uint8_t *data_buf, size_t size)
|
||||
static int32_t iohidmanager_set_report(void *handle, uint8_t report_type, uint8_t report_id, uint8_t *data_buf, size_t len)
|
||||
{
|
||||
struct iohidmanager_hid_adapter *adapter =
|
||||
(struct iohidmanager_hid_adapter*)handle;
|
||||
if (adapter)
|
||||
return IOHIDDeviceSetReport(adapter->handle,
|
||||
translate_hid_report_type(report_type), report_id,
|
||||
data_buf + 1, size - 1);
|
||||
data_buf + 1, len - 1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int32_t iohidmanager_get_report(void *handle, uint8_t report_type, uint8_t report_id,
|
||||
uint8_t *data_buf, size_t size)
|
||||
uint8_t *data_buf, size_t len)
|
||||
{
|
||||
struct iohidmanager_hid_adapter *adapter =
|
||||
(struct iohidmanager_hid_adapter*)handle;
|
||||
|
||||
if (adapter)
|
||||
{
|
||||
CFIndex length = size;
|
||||
return IOHIDDeviceGetReport(adapter->handle, translate_hid_report_type(report_type), report_id, data_buf, &length);
|
||||
CFIndex length = len;
|
||||
return IOHIDDeviceGetReport(adapter->handle,
|
||||
translate_hid_report_type(report_type),
|
||||
report_id, data_buf, &length);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -124,7 +124,7 @@ static void adapter_thread(void *data)
|
||||
}
|
||||
|
||||
static void libusb_hid_device_send_control(void *data,
|
||||
uint8_t* data_buf, size_t size)
|
||||
uint8_t* data_buf, size_t len)
|
||||
{
|
||||
struct libusb_adapter *adapter = (struct libusb_adapter*)data;
|
||||
|
||||
@ -133,10 +133,10 @@ static void libusb_hid_device_send_control(void *data,
|
||||
|
||||
slock_lock(adapter->send_control_lock);
|
||||
|
||||
if (FIFO_WRITE_AVAIL(adapter->send_control_buffer) >= size + sizeof(size))
|
||||
if (FIFO_WRITE_AVAIL(adapter->send_control_buffer) >= len + sizeof(len))
|
||||
{
|
||||
fifo_write(adapter->send_control_buffer, &size, sizeof(size));
|
||||
fifo_write(adapter->send_control_buffer, data_buf, size);
|
||||
fifo_write(adapter->send_control_buffer, &len, sizeof(len));
|
||||
fifo_write(adapter->send_control_buffer, data_buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ static int32_t wiiusb_hid_read_cb(int32_t size, void *data)
|
||||
}
|
||||
|
||||
static void wiiusb_hid_device_send_control(void *data,
|
||||
uint8_t* data_buf, size_t size)
|
||||
uint8_t* data_buf, size_t len)
|
||||
{
|
||||
uint8_t control_type;
|
||||
struct wiiusb_adapter *adapter = (struct wiiusb_adapter*)data;
|
||||
@ -129,9 +129,9 @@ static void wiiusb_hid_device_send_control(void *data,
|
||||
|
||||
/* first byte contains the type of control to use
|
||||
* which can be NONE, INT_MSG, CTRL_MSG, CTRL_MSG2 */
|
||||
control_type = data_buf[0];
|
||||
control_type = data_buf[0];
|
||||
/* decrement size by one as we are getting rid of first byte */
|
||||
adapter->send_control_size = size - 1;
|
||||
adapter->send_control_size = len - 1;
|
||||
/* increase the buffer address so we access the actual data */
|
||||
data_buf++;
|
||||
memcpy(adapter->send_control_buffer, data_buf, adapter->send_control_size);
|
||||
|
@ -56,7 +56,7 @@ void free_xkb(void)
|
||||
xkb_state = NULL;
|
||||
}
|
||||
|
||||
int init_xkb(int fd, size_t size)
|
||||
int init_xkb(int fd, size_t len)
|
||||
{
|
||||
mod_map_idx = (xkb_mod_index_t *)calloc(
|
||||
MOD_MAP_SIZE, sizeof(xkb_mod_index_t));
|
||||
@ -76,19 +76,19 @@ int init_xkb(int fd, size_t size)
|
||||
{
|
||||
if (fd >= 0)
|
||||
{
|
||||
char *map_str = (char*)mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
|
||||
char *map_str = (char*)mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if (map_str == MAP_FAILED)
|
||||
goto error;
|
||||
|
||||
xkb_map = xkb_keymap_new_from_string(xkb_ctx, map_str,
|
||||
XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||
munmap(map_str, size);
|
||||
munmap(map_str, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct xkb_rule_names rule = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *input_keyboard_layout =
|
||||
const char *input_keyboard_layout =
|
||||
settings->arrays.input_keyboard_layout;
|
||||
|
||||
rule.rules = "evdev";
|
||||
|
@ -49,12 +49,12 @@ struct hid_driver
|
||||
bool (*set_rumble)(void *handle, unsigned pad, enum retro_rumble_effect effect, uint16_t);
|
||||
const char *(*name)(void *handle, unsigned pad);
|
||||
const char *ident;
|
||||
void (*send_control)(void *handle, uint8_t *buf, size_t size);
|
||||
void (*send_control)(void *handle, uint8_t *buf, size_t len);
|
||||
int32_t (*set_report)(void *handle, uint8_t report_type, uint8_t report_id, uint8_t *data, size_t len);
|
||||
int32_t (*get_report)(void *handle, uint8_t report_type, uint8_t report_id, uint8_t *data, size_t len);
|
||||
int32_t (*set_idle)(void *handle, uint8_t amount);
|
||||
int32_t (*set_protocol)(void *handle, uint8_t protocol);
|
||||
int32_t (*read)(void *handle, void *buf, size_t size);
|
||||
int32_t (*read)(void *handle, void *buf, size_t len);
|
||||
};
|
||||
|
||||
#endif /* HID_DRIVER_H__ */
|
||||
|
@ -500,7 +500,7 @@ static int rpng_reverse_filter_init(const struct png_ihdr *ihdr,
|
||||
{
|
||||
size_t pass_size;
|
||||
|
||||
if ( !(pngp->flags & RPNG_PROCESS_FLAG_ADAM7_PASS_INITIALIZED)
|
||||
if ( !(pngp->flags & RPNG_PROCESS_FLAG_ADAM7_PASS_INITIALIZED)
|
||||
&& ihdr->interlace)
|
||||
{
|
||||
if ( ihdr->width <= rpng_passes[pngp->pass_pos].x
|
||||
@ -924,7 +924,7 @@ static enum png_chunk_type rpng_read_chunk_header(
|
||||
type[i] = byte;
|
||||
}
|
||||
|
||||
if (
|
||||
if (
|
||||
type[0] == 'I'
|
||||
&& type[1] == 'H'
|
||||
&& type[2] == 'D'
|
||||
@ -998,7 +998,7 @@ bool rpng_iterate_image(rpng_t *rpng)
|
||||
return false;
|
||||
|
||||
case PNG_CHUNK_IHDR:
|
||||
if ( (rpng->flags & RPNG_FLAG_HAS_IHDR)
|
||||
if ( (rpng->flags & RPNG_FLAG_HAS_IHDR)
|
||||
|| (rpng->flags & RPNG_FLAG_HAS_IDAT)
|
||||
|| (rpng->flags & RPNG_FLAG_HAS_IEND))
|
||||
return false;
|
||||
@ -1016,8 +1016,8 @@ bool rpng_iterate_image(rpng_t *rpng)
|
||||
rpng->ihdr.filter = buf[11];
|
||||
rpng->ihdr.interlace = buf[12];
|
||||
|
||||
if ( rpng->ihdr.width == 0
|
||||
|| rpng->ihdr.height == 0
|
||||
if ( rpng->ihdr.width == 0
|
||||
|| rpng->ihdr.height == 0
|
||||
/* ensure multiplications don't overflow and wrap around, that'd give buffer overflow crashes */
|
||||
|| (uint64_t)rpng->ihdr.width*rpng->ihdr.height*sizeof(uint32_t) >= 0x80000000)
|
||||
return false;
|
||||
@ -1091,10 +1091,10 @@ bool rpng_iterate_image(rpng_t *rpng)
|
||||
break;
|
||||
|
||||
case PNG_CHUNK_IDAT:
|
||||
if ( !(rpng->flags & RPNG_FLAG_HAS_IHDR)
|
||||
if ( !(rpng->flags & RPNG_FLAG_HAS_IHDR)
|
||||
|| (rpng->flags & RPNG_FLAG_HAS_IEND)
|
||||
|| (rpng->ihdr.color_type == PNG_IHDR_COLOR_PLT
|
||||
&&
|
||||
|| (rpng->ihdr.color_type == PNG_IHDR_COLOR_PLT
|
||||
&&
|
||||
!(rpng->flags & RPNG_FLAG_HAS_PLTE)))
|
||||
return false;
|
||||
|
||||
@ -1112,7 +1112,7 @@ bool rpng_iterate_image(rpng_t *rpng)
|
||||
break;
|
||||
|
||||
case PNG_CHUNK_IEND:
|
||||
if ( !(rpng->flags & RPNG_FLAG_HAS_IHDR)
|
||||
if ( !(rpng->flags & RPNG_FLAG_HAS_IHDR)
|
||||
|| !(rpng->flags & RPNG_FLAG_HAS_IDAT))
|
||||
return false;
|
||||
|
||||
@ -1129,7 +1129,7 @@ bool rpng_iterate_image(rpng_t *rpng)
|
||||
}
|
||||
|
||||
int rpng_process_image(rpng_t *rpng,
|
||||
void **_data, size_t size, unsigned *width, unsigned *height)
|
||||
void **_data, size_t len, unsigned *width, unsigned *height)
|
||||
{
|
||||
uint32_t **data = (uint32_t**)_data;
|
||||
|
||||
|
@ -179,7 +179,7 @@ static void sha256_subhash(struct sha256_ctx *p, uint32_t *t)
|
||||
*
|
||||
* Hashes SHA256 and outputs a human readable string.
|
||||
**/
|
||||
void sha256_hash(char *s, const uint8_t *in, size_t size)
|
||||
void sha256_hash(char *s, const uint8_t *in, size_t len)
|
||||
{
|
||||
unsigned i;
|
||||
struct sha256_ctx sha;
|
||||
@ -191,7 +191,7 @@ void sha256_hash(char *s, const uint8_t *in, size_t size)
|
||||
} shahash;
|
||||
|
||||
sha256_init(&sha);
|
||||
sha256_chunk(&sha, in, (unsigned)size);
|
||||
sha256_chunk(&sha, in, (unsigned)len);
|
||||
sha256_final(&sha);
|
||||
sha256_subhash(&sha, shahash.u32);
|
||||
|
||||
|
@ -38,12 +38,12 @@ extern "C" {
|
||||
#ifndef snprintf
|
||||
#define snprintf c99_snprintf_retro__
|
||||
#endif
|
||||
int c99_snprintf_retro__(char *outBuf, size_t size, const char *format, ...);
|
||||
int c99_snprintf_retro__(char *s, size_t len, const char *format, ...);
|
||||
|
||||
#ifndef vsnprintf
|
||||
#define vsnprintf c99_vsnprintf_retro__
|
||||
#endif
|
||||
int c99_vsnprintf_retro__(char *outBuf, size_t size, const char *format, va_list ap);
|
||||
int c99_vsnprintf_retro__(char *s, size_t len, const char *format, va_list ap);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -60,13 +60,13 @@ RETRO_BEGIN_DECLS
|
||||
* @brief Portable implementation of \c strlcpy(3).
|
||||
* @see https://linux.die.net/man/3/strlcpy
|
||||
*/
|
||||
size_t strlcpy(char *dest, const char *source, size_t size);
|
||||
size_t strlcpy(char *s, const char *source, size_t len);
|
||||
|
||||
/**
|
||||
* @brief Portable implementation of \c strlcat(3).
|
||||
* @see https://linux.die.net/man/3/strlcpy
|
||||
*/
|
||||
size_t strlcat(char *dest, const char *source, size_t size);
|
||||
size_t strlcat(char *s, const char *source, size_t len);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -25,68 +25,68 @@
|
||||
#include <string.h>
|
||||
#include <retro_inline.h>
|
||||
|
||||
static INLINE void* memcpy16(void* dst,void* src,size_t size)
|
||||
static INLINE void* memcpy16(void* dst, void* src, size_t len)
|
||||
{
|
||||
return memcpy(dst,src,size * 2);
|
||||
return memcpy(dst, src, len * 2);
|
||||
}
|
||||
|
||||
static INLINE void* memcpy32(void* dst,void* src,size_t size)
|
||||
static INLINE void* memcpy32(void* dst, void* src, size_t len)
|
||||
{
|
||||
return memcpy(dst,src,size * 4);
|
||||
return memcpy(dst, src, len * 4);
|
||||
}
|
||||
|
||||
static INLINE void* memcpy64(void* dst,void* src,size_t size)
|
||||
static INLINE void* memcpy64(void* dst, void* src, size_t len)
|
||||
{
|
||||
return memcpy(dst,src,size * 8);
|
||||
return memcpy(dst, src, len * 8);
|
||||
}
|
||||
|
||||
#ifdef USECPPSTDFILL
|
||||
#include <algorithm>
|
||||
|
||||
static INLINE void* memset16(void* dst,uint16_t val,size_t size)
|
||||
static INLINE void* memset16(void* dst,uint16_t val, size_t len)
|
||||
{
|
||||
uint16_t *typedptr = (uint16_t*)dst;
|
||||
std::fill(typedptr, typedptr + size, val);
|
||||
std::fill(typedptr, typedptr + len, val);
|
||||
return dst;
|
||||
}
|
||||
|
||||
static INLINE void* memset32(void* dst,uint32_t val,size_t size)
|
||||
static INLINE void* memset32(void* dst, uint32_t val, size_t len)
|
||||
{
|
||||
uint32_t *typedptr = (uint32_t*)dst;
|
||||
std::fill(typedptr, typedptr + size, val);
|
||||
std::fill(typedptr, typedptr + len, val);
|
||||
return dst;
|
||||
}
|
||||
|
||||
static INLINE void* memset64(void* dst,uint64_t val,size_t size)
|
||||
static INLINE void* memset64(void* dst, uint64_t val, size_t len)
|
||||
{
|
||||
uint64_t *typedptr = (uint64_t*)dst;
|
||||
std::fill(typedptr, typedptr + size, val);
|
||||
std::fill(typedptr, typedptr + len, val);
|
||||
return dst;
|
||||
}
|
||||
#else
|
||||
static INLINE void *memset16(void* dst,uint16_t val,size_t size)
|
||||
static INLINE void *memset16(void* dst, uint16_t val, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
uint16_t *typedptr = (uint16_t*)dst;
|
||||
for (i = 0;i < size;i++)
|
||||
for (i = 0; i < len; i++)
|
||||
typedptr[i] = val;
|
||||
return dst;
|
||||
}
|
||||
|
||||
static INLINE void *memset32(void* dst,uint32_t val,size_t size)
|
||||
static INLINE void *memset32(void* dst, uint32_t val, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
uint32_t *typedptr = (uint32_t*)dst;
|
||||
for (i = 0; i < size; i++)
|
||||
for (i = 0; i < len; i++)
|
||||
typedptr[i] = val;
|
||||
return dst;
|
||||
}
|
||||
|
||||
static INLINE void *memset64(void* dst,uint64_t val,size_t size)
|
||||
static INLINE void *memset64(void* dst, uint64_t val, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
uint64_t *typedptr = (uint64_t*)dst;
|
||||
for (i = 0; i < size;i++)
|
||||
for (i = 0; i < len;i++)
|
||||
typedptr[i] = val;
|
||||
return dst;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ size_t path_parent_dir(char *path, size_t len);
|
||||
* e.g. on Android it is "/"
|
||||
* Use of fill_pathname_resolve_relative() should be preferred
|
||||
**/
|
||||
char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks);
|
||||
char *path_resolve_realpath(char *buf, size_t len, bool resolve_symlinks);
|
||||
|
||||
/**
|
||||
* path_relative_to:
|
||||
@ -238,8 +238,8 @@ char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks);
|
||||
*
|
||||
* @return Length of the string copied into @out
|
||||
**/
|
||||
size_t path_relative_to(char *out, const char *path, const char *base,
|
||||
size_t size);
|
||||
size_t path_relative_to(char *s, const char *path, const char *base,
|
||||
size_t len);
|
||||
|
||||
/**
|
||||
* path_is_absolute:
|
||||
@ -253,24 +253,24 @@ bool path_is_absolute(const char *path);
|
||||
|
||||
/**
|
||||
* fill_pathname:
|
||||
* @out_path : output path
|
||||
* @s : output path
|
||||
* @in_path : input path
|
||||
* @replace : what to replace
|
||||
* @size : buffer size of output path
|
||||
* @len : buffer size of output path
|
||||
*
|
||||
* FIXME: Verify
|
||||
*
|
||||
* Replaces filename extension with 'replace' and outputs result to out_path.
|
||||
* Replaces filename extension with 'replace' and outputs result to s.
|
||||
* The extension here is considered to be the string from the last '.'
|
||||
* to the end.
|
||||
*
|
||||
* Only '.'s after the last slash are considered as extensions.
|
||||
* If no '.' is present, in_path and replace will simply be concatenated.
|
||||
* 'size' is buffer size of 'out_path'.
|
||||
* 'len' is buffer size of 's'.
|
||||
* E.g.: in_path = "/foo/bar/baz/boo.c", replace = ".asm" =>
|
||||
* out_path = "/foo/bar/baz/boo.asm"
|
||||
* s = "/foo/bar/baz/boo.asm"
|
||||
* E.g.: in_path = "/foo/bar/baz/boo.c", replace = "" =>
|
||||
* out_path = "/foo/bar/baz/boo"
|
||||
* s = "/foo/bar/baz/boo"
|
||||
*
|
||||
* Hidden non-leaf function cost:
|
||||
* - calls strlcpy 2x
|
||||
@ -279,20 +279,20 @@ bool path_is_absolute(const char *path);
|
||||
*
|
||||
* @return Length of the string copied into @out
|
||||
*/
|
||||
size_t fill_pathname(char *out_path, const char *in_path,
|
||||
const char *replace, size_t size);
|
||||
size_t fill_pathname(char *s, const char *in_path,
|
||||
const char *replace, size_t len);
|
||||
|
||||
/**
|
||||
* fill_dated_filename:
|
||||
* @out_filename : output filename
|
||||
* @s : output filename
|
||||
* @ext : extension of output filename
|
||||
* @size : buffer size of output filename
|
||||
* @len : buffer size of output filename
|
||||
*
|
||||
* Creates a 'dated' filename prefixed by 'RetroArch', and
|
||||
* concatenates extension (@ext) to it.
|
||||
*
|
||||
* E.g.:
|
||||
* out_filename = "RetroArch-{month}{day}-{Hours}{Minutes}.{@ext}"
|
||||
* s = "RetroArch-{month}{day}-{Hours}{Minutes}.{@ext}"
|
||||
*
|
||||
* Hidden non-leaf function cost:
|
||||
* - Calls rtime_localtime()
|
||||
@ -300,21 +300,20 @@ size_t fill_pathname(char *out_path, const char *in_path,
|
||||
* - Calls strlcat
|
||||
*
|
||||
**/
|
||||
size_t fill_dated_filename(char *out_filename,
|
||||
const char *ext, size_t size);
|
||||
size_t fill_dated_filename(char *s, const char *ext, size_t len);
|
||||
|
||||
/**
|
||||
* fill_str_dated_filename:
|
||||
* @out_filename : output filename
|
||||
* @s : output filename
|
||||
* @in_str : input string
|
||||
* @ext : extension of output filename
|
||||
* @size : buffer size of output filename
|
||||
* @len : buffer size of output filename
|
||||
*
|
||||
* Creates a 'dated' filename prefixed by the string @in_str, and
|
||||
* concatenates extension (@ext) to it.
|
||||
*
|
||||
* E.g.:
|
||||
* out_filename = "RetroArch-{year}{month}{day}-{Hour}{Minute}{Second}.{@ext}"
|
||||
* s = "RetroArch-{year}{month}{day}-{Hour}{Minute}{Second}.{@ext}"
|
||||
*
|
||||
* Hidden non-leaf function cost:
|
||||
* - Calls time
|
||||
@ -324,15 +323,13 @@ size_t fill_dated_filename(char *out_filename,
|
||||
* - Calls strftime
|
||||
* - Calls strlcat
|
||||
*
|
||||
* @return Length of the string copied into @out_path
|
||||
* @return Length of the string copied into @s
|
||||
**/
|
||||
size_t fill_str_dated_filename(char *out_filename,
|
||||
const char *in_str, const char *ext, size_t size);
|
||||
size_t fill_str_dated_filename(char *s, const char *in_str, const char *ext, size_t len);
|
||||
|
||||
/**
|
||||
* find_last_slash:
|
||||
* @str : path
|
||||
* @size : size of path
|
||||
*
|
||||
* Find last slash in path. Tries to find
|
||||
* a backslash on Windows too which takes precedence
|
||||
@ -347,36 +344,36 @@ char *find_last_slash(const char *str);
|
||||
|
||||
/**
|
||||
* fill_pathname_dir:
|
||||
* @in_dir : input directory path
|
||||
* @in_basename : input basename to be appended to @in_dir
|
||||
* @s : input directory path
|
||||
* @in_basename : input basename to be appended to @s
|
||||
* @replace : replacement to be appended to @in_basename
|
||||
* @size : size of buffer
|
||||
* @len : size of buffer
|
||||
*
|
||||
* Appends basename of 'in_basename', to 'in_dir', along with 'replace'.
|
||||
* Appends basename of 'in_basename', to 's', along with 'replace'.
|
||||
* Basename of in_basename is the string after the last '/' or '\\',
|
||||
* i.e the filename without directories.
|
||||
*
|
||||
* If in_basename has no '/' or '\\', the whole 'in_basename' will be used.
|
||||
* 'size' is buffer size of 'in_dir'.
|
||||
* 'len' is buffer size of 's'.
|
||||
*
|
||||
* E.g..: in_dir = "/tmp/some_dir", in_basename = "/some_content/foo.c",
|
||||
* replace = ".asm" => in_dir = "/tmp/some_dir/foo.c.asm"
|
||||
* E.g..: s = "/tmp/some_dir", in_basename = "/some_content/foo.c",
|
||||
* replace = ".asm" => s = "/tmp/some_dir/foo.c.asm"
|
||||
*
|
||||
* Hidden non-leaf function cost:
|
||||
* - Calls fill_pathname_slash()
|
||||
* - Calls path_basename()
|
||||
* - Calls strlcpy 2x
|
||||
**/
|
||||
size_t fill_pathname_dir(char *in_dir, const char *in_basename,
|
||||
const char *replace, size_t size);
|
||||
size_t fill_pathname_dir(char *s, const char *in_basename,
|
||||
const char *replace, size_t len);
|
||||
|
||||
/**
|
||||
* fill_pathname_base:
|
||||
* @out : output path
|
||||
* @s : output path
|
||||
* @in_path : input path
|
||||
* @size : size of output path
|
||||
*
|
||||
* Copies basename of @in_path into @out_path.
|
||||
* Copies basename of @in_path into @s.
|
||||
*
|
||||
* Hidden non-leaf function cost:
|
||||
* - Calls path_basename()
|
||||
@ -384,23 +381,23 @@ size_t fill_pathname_dir(char *in_dir, const char *in_basename,
|
||||
*
|
||||
* @return length of the string copied into @out
|
||||
**/
|
||||
size_t fill_pathname_base(char *out_path, const char *in_path, size_t size);
|
||||
size_t fill_pathname_base(char *s, const char *in_path, size_t len);
|
||||
|
||||
/**
|
||||
* fill_pathname_basedir:
|
||||
* @out_dir : output directory
|
||||
* @s : output directory
|
||||
* @in_path : input path
|
||||
* @size : size of output directory
|
||||
*
|
||||
* Copies base directory of @in_path into @out_path.
|
||||
* Copies base directory of @in_path into @s.
|
||||
* If in_path is a path without any slashes (relative current directory),
|
||||
* @out_path will get path "./".
|
||||
* @s will get path "./".
|
||||
*
|
||||
* Hidden non-leaf function cost:
|
||||
* - Calls strlcpy
|
||||
* - Calls path_basedir()
|
||||
**/
|
||||
size_t fill_pathname_basedir(char *out_path, const char *in_path, size_t size);
|
||||
size_t fill_pathname_basedir(char *s, const char *in_path, size_t len);
|
||||
|
||||
/**
|
||||
* fill_pathname_parent_dir_name:
|
||||
@ -435,27 +432,27 @@ size_t fill_pathname_parent_dir_name(char *s,
|
||||
* - Calls strlen if (@out_dir == @in_dir)
|
||||
* - Calls path_parent_dir()
|
||||
**/
|
||||
void fill_pathname_parent_dir(char *out_dir,
|
||||
const char *in_dir, size_t size);
|
||||
void fill_pathname_parent_dir(char *s,
|
||||
const char *in_dir, size_t len);
|
||||
|
||||
/**
|
||||
* fill_pathname_resolve_relative:
|
||||
* @out_path : output path
|
||||
* @s : output path
|
||||
* @in_refpath : input reference path
|
||||
* @in_path : input path
|
||||
* @size : size of @out_path
|
||||
* @size : size of @s
|
||||
*
|
||||
* Joins basedir of @in_refpath together with @in_path.
|
||||
* If @in_path is an absolute path, out_path = in_path.
|
||||
* If @in_path is an absolute path, s = in_path.
|
||||
* E.g.: in_refpath = "/foo/bar/baz.a", in_path = "foobar.cg",
|
||||
* out_path = "/foo/bar/foobar.cg".
|
||||
* s = "/foo/bar/foobar.cg".
|
||||
**/
|
||||
void fill_pathname_resolve_relative(char *out_path, const char *in_refpath,
|
||||
const char *in_path, size_t size);
|
||||
void fill_pathname_resolve_relative(char *s, const char *in_refpath,
|
||||
const char *in_path, size_t len);
|
||||
|
||||
/**
|
||||
* fill_pathname_join:
|
||||
* @out_path : output path
|
||||
* @s : output path
|
||||
* @dir : directory
|
||||
* @path : path
|
||||
* @size : size of output path
|
||||
@ -469,24 +466,24 @@ void fill_pathname_resolve_relative(char *out_path, const char *in_refpath,
|
||||
* - calls fill_pathname_slash()
|
||||
*
|
||||
* Deprecated. Use fill_pathname_join_special() instead
|
||||
* if you can ensure @dir != @out_path
|
||||
* if you can ensure @dir != @s
|
||||
*
|
||||
* @return Length of the string copied into @out_path
|
||||
* @return Length of the string copied into @s
|
||||
**/
|
||||
size_t fill_pathname_join(char *out_path, const char *dir,
|
||||
const char *path, size_t size);
|
||||
size_t fill_pathname_join(char *s, const char *dir,
|
||||
const char *path, size_t len);
|
||||
|
||||
/**
|
||||
* fill_pathname_join_special:
|
||||
* @out_path : output path
|
||||
* @dir : directory. Cannot be identical to @out_path
|
||||
* @s : output path
|
||||
* @dir : directory. Cannot be identical to @s
|
||||
* @path : path
|
||||
* @size : size of output path
|
||||
*
|
||||
*
|
||||
* Specialized version of fill_pathname_join.
|
||||
* Unlike fill_pathname_join(),
|
||||
* @dir and @out_path CANNOT be identical.
|
||||
* @dir and @s CANNOT be identical.
|
||||
*
|
||||
* Joins a directory (@dir) and path (@path) together.
|
||||
* Makes sure not to get two consecutive slashes
|
||||
@ -495,19 +492,19 @@ size_t fill_pathname_join(char *out_path, const char *dir,
|
||||
* Hidden non-leaf function cost:
|
||||
* - calls strlcpy 2x
|
||||
*
|
||||
* @return Length of the string copied into @out_path
|
||||
* @return Length of the string copied into @s
|
||||
**/
|
||||
size_t fill_pathname_join_special(char *out_path,
|
||||
const char *dir, const char *path, size_t size);
|
||||
size_t fill_pathname_join_special(char *s,
|
||||
const char *dir, const char *path, size_t len);
|
||||
|
||||
size_t fill_pathname_join_special_ext(char *out_path,
|
||||
size_t fill_pathname_join_special_ext(char *s,
|
||||
const char *dir, const char *path,
|
||||
const char *last, const char *ext,
|
||||
size_t size);
|
||||
size_t len);
|
||||
|
||||
/**
|
||||
* fill_pathname_join_delim:
|
||||
* @out_path : output path
|
||||
* @s : output path
|
||||
* @dir : directory
|
||||
* @path : path
|
||||
* @delim : delimiter
|
||||
@ -521,14 +518,14 @@ size_t fill_pathname_join_special_ext(char *out_path,
|
||||
* - can call strlcpy
|
||||
* - can call strlcat
|
||||
**/
|
||||
size_t fill_pathname_join_delim(char *out_path, const char *dir,
|
||||
const char *path, const char delim, size_t size);
|
||||
size_t fill_pathname_join_delim(char *s, const char *dir,
|
||||
const char *path, const char delim, size_t len);
|
||||
|
||||
size_t fill_pathname_expand_special(char *out_path,
|
||||
const char *in_path, size_t size);
|
||||
size_t fill_pathname_expand_special(char *s,
|
||||
const char *in_path, size_t len);
|
||||
|
||||
size_t fill_pathname_abbreviate_special(char *out_path,
|
||||
const char *in_path, size_t size);
|
||||
size_t fill_pathname_abbreviate_special(char *s,
|
||||
const char *in_path, size_t len);
|
||||
|
||||
/**
|
||||
* fill_pathname_abbreviated_or_relative:
|
||||
@ -540,10 +537,10 @@ size_t fill_pathname_abbreviate_special(char *out_path,
|
||||
* the relative path will be used
|
||||
* @in_path can be an absolute, relative or abbreviated path
|
||||
*
|
||||
* @return Length of the string copied into @out_path
|
||||
* @return Length of the string copied into @s
|
||||
**/
|
||||
size_t fill_pathname_abbreviated_or_relative(char *out_path,
|
||||
const char *in_refpath, const char *in_path, size_t size);
|
||||
size_t fill_pathname_abbreviated_or_relative(char *s,
|
||||
const char *in_refpath, const char *in_path, size_t len);
|
||||
|
||||
/**
|
||||
* sanitize_path_part:
|
||||
@ -557,7 +554,7 @@ size_t fill_pathname_abbreviated_or_relative(char *out_path,
|
||||
*
|
||||
* @returns new string that has been sanitized
|
||||
**/
|
||||
const char *sanitize_path_part(const char *path_part, size_t size);
|
||||
const char *sanitize_path_part(const char *path_part, size_t len);
|
||||
|
||||
/**
|
||||
* pathname_conform_slashes_to_os:
|
||||
@ -569,7 +566,7 @@ const char *sanitize_path_part(const char *path_part, size_t size);
|
||||
* Changes the slashes to the correct kind for the os
|
||||
* So forward slash on linux and backslash on Windows
|
||||
**/
|
||||
void pathname_conform_slashes_to_os(char *path);
|
||||
void pathname_conform_slashes_to_os(char *s);
|
||||
|
||||
/**
|
||||
* pathname_make_slashes_portable:
|
||||
@ -580,7 +577,7 @@ void pathname_conform_slashes_to_os(char *path);
|
||||
* Change all slashes to forward so they are more
|
||||
* portable between Windows and Linux
|
||||
**/
|
||||
void pathname_make_slashes_portable(char *path);
|
||||
void pathname_make_slashes_portable(char *s);
|
||||
|
||||
/**
|
||||
* path_basedir:
|
||||
@ -589,7 +586,7 @@ void pathname_make_slashes_portable(char *path);
|
||||
* Extracts base directory by mutating path.
|
||||
* Keeps trailing '/'.
|
||||
**/
|
||||
void path_basedir_wrapper(char *path);
|
||||
void path_basedir_wrapper(char *s);
|
||||
|
||||
/**
|
||||
* path_char_is_slash:
|
||||
@ -632,12 +629,12 @@ void path_basedir_wrapper(char *path);
|
||||
* - can call strlcat once if it returns false
|
||||
* - calls strlen
|
||||
**/
|
||||
size_t fill_pathname_slash(char *path, size_t size);
|
||||
size_t fill_pathname_slash(char *s, size_t len);
|
||||
|
||||
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
||||
size_t fill_pathname_application_path(char *buf, size_t size);
|
||||
size_t fill_pathname_application_dir(char *buf, size_t size);
|
||||
size_t fill_pathname_home_dir(char *buf, size_t size);
|
||||
size_t fill_pathname_application_path(char *s, size_t len);
|
||||
size_t fill_pathname_application_dir(char *s, size_t len);
|
||||
size_t fill_pathname_home_dir(char *s, size_t len);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -29,9 +29,9 @@
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
void *memalign_alloc(size_t boundary, size_t size);
|
||||
void *memalign_alloc(size_t boundary, size_t len);
|
||||
|
||||
void *memalign_alloc_aligned(size_t size);
|
||||
void *memalign_alloc_aligned(size_t len);
|
||||
|
||||
void memalign_free(void *ptr);
|
||||
|
||||
|
@ -84,7 +84,7 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total);
|
||||
* Report HTTP status. 200, 404, or whatever.
|
||||
*
|
||||
* Leaf function.
|
||||
*
|
||||
*
|
||||
* @return HTTP status code.
|
||||
**/
|
||||
int net_http_status(struct http_t *state);
|
||||
@ -138,7 +138,7 @@ void net_http_urlencode(char **dest, const char *source);
|
||||
*
|
||||
* Re-encode a full URL
|
||||
**/
|
||||
void net_http_urlencode_full(char *dest, const char *source, size_t size);
|
||||
void net_http_urlencode_full(char *s, const char *source, size_t len);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
|
@ -81,23 +81,21 @@ int socket_poll(struct pollfd *fds, unsigned nfds, int timeout);
|
||||
|
||||
bool socket_wait(int fd, bool *rd, bool *wr, int timeout);
|
||||
|
||||
bool socket_send_all_blocking(int fd, const void *data_, size_t size, bool no_signal);
|
||||
bool socket_send_all_blocking(int fd, const void *data_, size_t len, bool no_signal);
|
||||
|
||||
bool socket_send_all_blocking_with_timeout(int fd,
|
||||
const void *data_, size_t size,
|
||||
int timeout, bool no_signal);
|
||||
const void *data_, size_t len, int timeout, bool no_signal);
|
||||
|
||||
ssize_t socket_send_all_nonblocking(int fd, const void *data_, size_t size,
|
||||
ssize_t socket_send_all_nonblocking(int fd, const void *data_, size_t len,
|
||||
bool no_signal);
|
||||
|
||||
bool socket_receive_all_blocking(int fd, void *data_, size_t size);
|
||||
bool socket_receive_all_blocking(int fd, void *data_, size_t len);
|
||||
|
||||
bool socket_receive_all_blocking_with_timeout(int fd,
|
||||
void *data_, size_t size,
|
||||
int timeout);
|
||||
void *data_, size_t len, int timeout);
|
||||
|
||||
ssize_t socket_receive_all_nonblocking(int fd, bool *error,
|
||||
void *data_, size_t size);
|
||||
void *data_, size_t len);
|
||||
|
||||
bool socket_bind(int fd, void *data);
|
||||
|
||||
|
@ -33,13 +33,13 @@ void* ssl_socket_init(int fd, const char *domain);
|
||||
|
||||
int ssl_socket_connect(void *state_data, void *data, bool timeout_enable, bool nonblock);
|
||||
|
||||
int ssl_socket_send_all_blocking(void *state_data, const void *data_, size_t size, bool no_signal);
|
||||
int ssl_socket_send_all_blocking(void *state_data, const void *data_, size_t len, bool no_signal);
|
||||
|
||||
ssize_t ssl_socket_send_all_nonblocking(void *state_data, const void *data_, size_t size, bool no_signal);
|
||||
ssize_t ssl_socket_send_all_nonblocking(void *state_data, const void *data_, size_t len, bool no_signal);
|
||||
|
||||
int ssl_socket_receive_all_blocking(void *state_data, void *data_, size_t size);
|
||||
int ssl_socket_receive_all_blocking(void *state_data, void *data_, size_t len);
|
||||
|
||||
ssize_t ssl_socket_receive_all_nonblocking(void *state_data, bool *error, void *data_, size_t size);
|
||||
ssize_t ssl_socket_receive_all_nonblocking(void *state_data, bool *error, void *data_, size_t len);
|
||||
|
||||
void ssl_socket_close(void *state_data);
|
||||
|
||||
|
@ -90,7 +90,7 @@ typedef struct fifo_buffer fifo_buffer_t;
|
||||
* @return The new queue if successful, \c NULL otherwise.
|
||||
* @see fifo_initialize
|
||||
*/
|
||||
fifo_buffer_t *fifo_new(size_t size);
|
||||
fifo_buffer_t *fifo_new(size_t len);
|
||||
|
||||
/**
|
||||
* Initializes an existing FIFO queue with \c size bytes of memory.
|
||||
@ -105,7 +105,7 @@ fifo_buffer_t *fifo_new(size_t size);
|
||||
* @return \c true if \c buf was initialized with the requested memory,
|
||||
* \c false if \c buf is \c NULL or there was an error.
|
||||
*/
|
||||
bool fifo_initialize(fifo_buffer_t *buf, size_t size);
|
||||
bool fifo_initialize(fifo_buffer_t *buf, size_t len);
|
||||
|
||||
/**
|
||||
* Resets the bounds of \c buffer,
|
||||
@ -130,7 +130,7 @@ static INLINE void fifo_clear(fifo_buffer_t *buffer)
|
||||
* @param in_buf The buffer to read bytes from.
|
||||
* @param size The length of \c in_buf, in bytes.
|
||||
*/
|
||||
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size);
|
||||
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t len);
|
||||
|
||||
/**
|
||||
* Reads \c size bytes from the given queue.
|
||||
@ -140,7 +140,7 @@ void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size);
|
||||
* @param size The length of \c in_buf, in bytes.
|
||||
* @post Upon return, \c buffer will have up to \c size more bytes of space available for writing.
|
||||
*/
|
||||
void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t size);
|
||||
void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t len);
|
||||
|
||||
/**
|
||||
* Releases \c buffer and its contents.
|
||||
|
@ -73,16 +73,16 @@ typedef struct
|
||||
|
||||
/**
|
||||
* msg_queue_new:
|
||||
* @size : maximum size of message
|
||||
* @len : maximum size of message
|
||||
*
|
||||
* Creates a message queue with maximum size different messages.
|
||||
*
|
||||
* Returns: NULL if allocation error, pointer to a message queue
|
||||
* if successful. Has to be freed manually.
|
||||
**/
|
||||
msg_queue_t *msg_queue_new(size_t size);
|
||||
msg_queue_t *msg_queue_new(size_t len);
|
||||
|
||||
bool msg_queue_initialize(msg_queue_t *queue, size_t size);
|
||||
bool msg_queue_initialize(msg_queue_t *queue, size_t len);
|
||||
|
||||
/**
|
||||
* msg_queue_push:
|
||||
|
@ -97,7 +97,7 @@ typedef struct netstream
|
||||
* or less than \c used.
|
||||
* @see netstream_close
|
||||
*/
|
||||
bool netstream_open(netstream_t *stream, void *buf, size_t size, size_t used);
|
||||
bool netstream_open(netstream_t *stream, void *buf, size_t len, size_t used);
|
||||
|
||||
/**
|
||||
* Closes a network-order stream.
|
||||
|
@ -43,7 +43,7 @@ RETRO_BEGIN_DECLS
|
||||
* but this function can read binary data as well.
|
||||
* @see https://man7.org/linux/man-pages/man3/stdout.3.html
|
||||
*/
|
||||
size_t read_stdin(char *buf, size_t size);
|
||||
size_t read_stdin(char *s, size_t len);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
|
@ -73,9 +73,9 @@ static INLINE bool string_is_equal(const char *a, const char *b)
|
||||
}
|
||||
|
||||
static INLINE bool string_starts_with_size(const char *str, const char *prefix,
|
||||
size_t size)
|
||||
size_t len)
|
||||
{
|
||||
return (str && prefix) ? !strncmp(prefix, str, size) : false;
|
||||
return (str && prefix) ? !strncmp(prefix, str, len) : false;
|
||||
}
|
||||
|
||||
static INLINE bool string_starts_with(const char *str, const char *prefix)
|
||||
@ -106,11 +106,11 @@ static INLINE bool string_ends_with(const char *str, const char *suffix)
|
||||
* - If 'str' is not NULL and no '\0' character is found
|
||||
* in the first 'size' characters, returns 'size'
|
||||
**/
|
||||
static INLINE size_t strlen_size(const char *str, size_t size)
|
||||
static INLINE size_t strlen_size(const char *str, size_t len)
|
||||
{
|
||||
size_t i = 0;
|
||||
if (str)
|
||||
while (i < size && str[i]) i++;
|
||||
while (i < len && str[i]) i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -61,20 +61,20 @@ static bool append_cert_x509(void* x509, size_t len)
|
||||
br_x509_pkey* pk;
|
||||
br_x509_decoder_context dc;
|
||||
br_x509_trust_anchor* ta = &TAs[TAs_NUM];
|
||||
|
||||
|
||||
current_vdn = NULL;
|
||||
current_vdn_size = 0;
|
||||
|
||||
|
||||
br_x509_decoder_init(&dc, vdn_append, NULL);
|
||||
br_x509_decoder_push(&dc, x509, len);
|
||||
pk = br_x509_decoder_get_pkey(&dc);
|
||||
if (!pk || !br_x509_decoder_isCA(&dc))
|
||||
return false;
|
||||
|
||||
|
||||
ta->dn.len = current_vdn_size;
|
||||
ta->dn.data = current_vdn;
|
||||
ta->flags = BR_X509_TA_CA;
|
||||
|
||||
|
||||
switch (pk->key_type)
|
||||
{
|
||||
case BR_KEYTYPE_RSA:
|
||||
@ -93,7 +93,7 @@ static bool append_cert_x509(void* x509, size_t len)
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
TAs_NUM++;
|
||||
return true;
|
||||
}
|
||||
@ -120,7 +120,7 @@ static char* delete_linebreaks(char* in)
|
||||
return in;
|
||||
}
|
||||
|
||||
/* this rearranges its input, it's easier to implement
|
||||
/* this rearranges its input, it's easier to implement
|
||||
* that way and caller doesn't need it anymore anyways */
|
||||
static void append_certs_pem_x509(char * certs_pem)
|
||||
{
|
||||
@ -148,7 +148,7 @@ static void append_certs_pem_x509(char * certs_pem)
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: not thread safe, rthreads doesn't provide any
|
||||
/* TODO: not thread safe, rthreads doesn't provide any
|
||||
* statically allocatable mutex/etc */
|
||||
static void initialize(void)
|
||||
{
|
||||
@ -186,8 +186,8 @@ static bool process_inner(struct ssl_state *state, bool blocking)
|
||||
if (buflen)
|
||||
{
|
||||
if (blocking)
|
||||
bytes = (socket_send_all_blocking(state->fd, buf, buflen, true)
|
||||
? buflen
|
||||
bytes = (socket_send_all_blocking(state->fd, buf, buflen, true)
|
||||
? buflen
|
||||
: -1);
|
||||
else
|
||||
bytes = socket_send_all_nonblocking(state->fd, buf, buflen, true);
|
||||
@ -196,9 +196,9 @@ static bool process_inner(struct ssl_state *state, bool blocking)
|
||||
br_ssl_engine_sendrec_ack(&state->sc.eng, bytes);
|
||||
if (bytes < 0)
|
||||
return false;
|
||||
/* if we did something, return immediately so we
|
||||
/* if we did something, return immediately so we
|
||||
* don't try to read if Bear still wants to send */
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
buf = br_ssl_engine_recvrec_buf(&state->sc.eng, &buflen);
|
||||
@ -252,51 +252,48 @@ int ssl_socket_connect(void *state_data,
|
||||
}
|
||||
|
||||
ssize_t ssl_socket_receive_all_nonblocking(void *state_data,
|
||||
bool *error, void *data_, size_t size)
|
||||
bool *error, void *data_, size_t len)
|
||||
{
|
||||
size_t __len;
|
||||
uint8_t *bear_data;
|
||||
struct ssl_state *state = (struct ssl_state*)state_data;
|
||||
uint8_t * bear_data;
|
||||
size_t bear_data_size;
|
||||
|
||||
socket_set_block(state->fd, false);
|
||||
|
||||
if (!process_inner(state, false))
|
||||
{
|
||||
*error = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
bear_data = br_ssl_engine_recvapp_buf(&state->sc.eng, &bear_data_size);
|
||||
if (bear_data_size > size) bear_data_size = size;
|
||||
memcpy(data_, bear_data, bear_data_size);
|
||||
if (bear_data_size)
|
||||
br_ssl_engine_recvapp_ack(&state->sc.eng, bear_data_size);
|
||||
|
||||
return bear_data_size;
|
||||
bear_data = br_ssl_engine_recvapp_buf(&state->sc.eng, &__len);
|
||||
if (__len > len)
|
||||
__len = len;
|
||||
memcpy(data_, bear_data, __len);
|
||||
if (__len)
|
||||
br_ssl_engine_recvapp_ack(&state->sc.eng, __len);
|
||||
return __len;
|
||||
}
|
||||
|
||||
int ssl_socket_receive_all_blocking(void *state_data,
|
||||
void *data_, size_t size)
|
||||
void *data_, size_t len)
|
||||
{
|
||||
size_t __len;
|
||||
struct ssl_state *state = (struct ssl_state*)state_data;
|
||||
uint8_t *data = (uint8_t*)data_;
|
||||
uint8_t * bear_data;
|
||||
size_t bear_data_size;
|
||||
|
||||
socket_set_block(state->fd, true);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
bear_data = br_ssl_engine_recvapp_buf(&state->sc.eng, &bear_data_size);
|
||||
if (bear_data_size > size)
|
||||
bear_data_size = size;
|
||||
memcpy(data, bear_data, bear_data_size);
|
||||
if (bear_data_size)
|
||||
br_ssl_engine_recvapp_ack(&state->sc.eng, bear_data_size);
|
||||
data += bear_data_size;
|
||||
size -= bear_data_size;
|
||||
bear_data = br_ssl_engine_recvapp_buf(&state->sc.eng, &__len);
|
||||
if (__len > len)
|
||||
__len = len;
|
||||
memcpy(data, bear_data, __len);
|
||||
if (__len)
|
||||
br_ssl_engine_recvapp_ack(&state->sc.eng, __len);
|
||||
data += __len;
|
||||
len -= __len;
|
||||
|
||||
if (size)
|
||||
if (len)
|
||||
process_inner(state, true);
|
||||
else
|
||||
break;
|
||||
@ -305,27 +302,27 @@ int ssl_socket_receive_all_blocking(void *state_data,
|
||||
}
|
||||
|
||||
int ssl_socket_send_all_blocking(void *state_data,
|
||||
const void *data_, size_t size, bool no_signal)
|
||||
const void *data_, size_t len, bool no_signal)
|
||||
{
|
||||
size_t __len;
|
||||
struct ssl_state *state = (struct ssl_state*)state_data;
|
||||
const uint8_t *data = (const uint8_t*)data_;
|
||||
uint8_t * bear_data;
|
||||
size_t bear_data_size;
|
||||
|
||||
socket_set_block(state->fd, true);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
bear_data = br_ssl_engine_sendapp_buf(&state->sc.eng, &bear_data_size);
|
||||
if (bear_data_size > size)
|
||||
bear_data_size = size;
|
||||
memcpy(bear_data, data_, bear_data_size);
|
||||
if (bear_data_size)
|
||||
br_ssl_engine_sendapp_ack(&state->sc.eng, bear_data_size);
|
||||
data += bear_data_size;
|
||||
size -= bear_data_size;
|
||||
bear_data = br_ssl_engine_sendapp_buf(&state->sc.eng, &__len);
|
||||
if (__len > len)
|
||||
__len = len;
|
||||
memcpy(bear_data, data_, __len);
|
||||
if (__len)
|
||||
br_ssl_engine_sendapp_ack(&state->sc.eng, __len);
|
||||
data += __len;
|
||||
len -= __len;
|
||||
|
||||
if (size)
|
||||
if (len)
|
||||
process_inner(state, true);
|
||||
else
|
||||
break;
|
||||
@ -337,28 +334,25 @@ int ssl_socket_send_all_blocking(void *state_data,
|
||||
}
|
||||
|
||||
ssize_t ssl_socket_send_all_nonblocking(void *state_data,
|
||||
const void *data_, size_t size, bool no_signal)
|
||||
const void *data_, size_t len, bool no_signal)
|
||||
{
|
||||
size_t __len;
|
||||
uint8_t *bear_data;
|
||||
struct ssl_state *state = (struct ssl_state*)state_data;
|
||||
uint8_t * bear_data;
|
||||
size_t bear_data_size;
|
||||
|
||||
socket_set_block(state->fd, false);
|
||||
|
||||
bear_data = br_ssl_engine_sendapp_buf(&state->sc.eng, &bear_data_size);
|
||||
if (bear_data_size > size)
|
||||
bear_data_size = size;
|
||||
memcpy(bear_data, data_, bear_data_size);
|
||||
if (bear_data_size)
|
||||
bear_data = br_ssl_engine_sendapp_buf(&state->sc.eng, &__len);
|
||||
if (__len > len)
|
||||
__len = len;
|
||||
memcpy(bear_data, data_, __len);
|
||||
if (__len)
|
||||
{
|
||||
br_ssl_engine_sendapp_ack(&state->sc.eng, bear_data_size);
|
||||
br_ssl_engine_sendapp_ack(&state->sc.eng, __len);
|
||||
br_ssl_engine_flush(&state->sc.eng, false);
|
||||
}
|
||||
|
||||
if (!process_inner(state, false))
|
||||
return -1;
|
||||
|
||||
return bear_data_size;
|
||||
return __len;
|
||||
}
|
||||
|
||||
void ssl_socket_close(void *state_data)
|
||||
@ -367,15 +361,15 @@ void ssl_socket_close(void *state_data)
|
||||
|
||||
br_ssl_engine_close(&state->sc.eng);
|
||||
process_inner(state, false); /* send close notification */
|
||||
socket_close(state->fd); /* but immediately close socket
|
||||
and don't worry about recipient
|
||||
socket_close(state->fd); /* but immediately close socket
|
||||
and don't worry about recipient
|
||||
getting our message */
|
||||
}
|
||||
|
||||
void ssl_socket_free(void *state_data)
|
||||
{
|
||||
struct ssl_state *state = (struct ssl_state*)state_data;
|
||||
/* BearSSL does zero allocations of its own,
|
||||
/* BearSSL does zero allocations of its own,
|
||||
* so other than this struct, there is nothing to free */
|
||||
free(state);
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ int ssl_socket_connect(void *state_data,
|
||||
}
|
||||
|
||||
ssize_t ssl_socket_receive_all_nonblocking(void *state_data,
|
||||
bool *error, void *data_, size_t size)
|
||||
bool *error, void *data_, size_t len)
|
||||
{
|
||||
ssize_t ret;
|
||||
struct ssl_state *state = (struct ssl_state*)state_data;
|
||||
@ -180,7 +180,7 @@ ssize_t ssl_socket_receive_all_nonblocking(void *state_data,
|
||||
|
||||
mbedtls_net_set_nonblock(&state->net_ctx);
|
||||
|
||||
ret = mbedtls_ssl_read(&state->ctx, (unsigned char*)data, size);
|
||||
ret = mbedtls_ssl_read(&state->ctx, (unsigned char*)data, len);
|
||||
|
||||
if (ret > 0)
|
||||
return ret;
|
||||
@ -200,7 +200,7 @@ ssize_t ssl_socket_receive_all_nonblocking(void *state_data,
|
||||
}
|
||||
|
||||
int ssl_socket_receive_all_blocking(void *state_data,
|
||||
void *data_, size_t size)
|
||||
void *data_, size_t len)
|
||||
{
|
||||
struct ssl_state *state = (struct ssl_state*)state_data;
|
||||
const uint8_t *data = (const uint8_t*)data_;
|
||||
@ -209,12 +209,12 @@ int ssl_socket_receive_all_blocking(void *state_data,
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* mbedtls_ssl_read wants non-const data but it only reads it,
|
||||
/* mbedtls_ssl_read wants non-const data but it only reads it,
|
||||
* so this cast is safe */
|
||||
int ret = mbedtls_ssl_read(&state->ctx, (unsigned char*)data, size);
|
||||
int ret = mbedtls_ssl_read(&state->ctx, (unsigned char*)data, len);
|
||||
|
||||
if ( ret == MBEDTLS_ERR_SSL_WANT_READ ||
|
||||
ret == MBEDTLS_ERR_SSL_WANT_WRITE)
|
||||
if ( ret == MBEDTLS_ERR_SSL_WANT_READ
|
||||
|| ret == MBEDTLS_ERR_SSL_WANT_WRITE)
|
||||
continue;
|
||||
|
||||
if (ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)
|
||||
@ -231,7 +231,7 @@ int ssl_socket_receive_all_blocking(void *state_data,
|
||||
}
|
||||
|
||||
int ssl_socket_send_all_blocking(void *state_data,
|
||||
const void *data_, size_t size, bool no_signal)
|
||||
const void *data_, size_t len, bool no_signal)
|
||||
{
|
||||
int ret;
|
||||
struct ssl_state *state = (struct ssl_state*)state_data;
|
||||
@ -239,9 +239,9 @@ int ssl_socket_send_all_blocking(void *state_data,
|
||||
|
||||
mbedtls_net_set_block(&state->net_ctx);
|
||||
|
||||
while (size)
|
||||
while (len)
|
||||
{
|
||||
ret = mbedtls_ssl_write(&state->ctx, data, size);
|
||||
ret = mbedtls_ssl_write(&state->ctx, data, len);
|
||||
|
||||
if (!ret)
|
||||
continue;
|
||||
@ -255,7 +255,7 @@ int ssl_socket_send_all_blocking(void *state_data,
|
||||
else
|
||||
{
|
||||
data += ret;
|
||||
size -= ret;
|
||||
len -= ret;
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,21 +263,17 @@ int ssl_socket_send_all_blocking(void *state_data,
|
||||
}
|
||||
|
||||
ssize_t ssl_socket_send_all_nonblocking(void *state_data,
|
||||
const void *data_, size_t size, bool no_signal)
|
||||
const void *data_, size_t len, bool no_signal)
|
||||
{
|
||||
int ret;
|
||||
ssize_t sent = size;
|
||||
ssize_t __len = len;
|
||||
struct ssl_state *state = (struct ssl_state*)state_data;
|
||||
const uint8_t *data = (const uint8_t*)data_;
|
||||
|
||||
mbedtls_net_set_nonblock(&state->net_ctx);
|
||||
|
||||
ret = mbedtls_ssl_write(&state->ctx, data, size);
|
||||
|
||||
ret = mbedtls_ssl_write(&state->ctx, data, len);
|
||||
if (ret <= 0)
|
||||
return -1;
|
||||
|
||||
return sent;
|
||||
return __len;
|
||||
}
|
||||
|
||||
void ssl_socket_close(void *state_data)
|
||||
|
@ -353,14 +353,14 @@ int rmsgpack_write_uint(RFILE *fd, uint64_t value)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int rmsgpack_read_uint(RFILE *fd, uint64_t *out, size_t size)
|
||||
static int rmsgpack_read_uint(RFILE *fd, uint64_t *out, size_t len)
|
||||
{
|
||||
union { uint64_t u64; uint32_t u32; uint16_t u16; uint8_t u8; } tmp;
|
||||
|
||||
if (filestream_read(fd, &tmp, size) == -1)
|
||||
if (filestream_read(fd, &tmp, len) == -1)
|
||||
return -1;
|
||||
|
||||
switch (size)
|
||||
switch (len)
|
||||
{
|
||||
case 1:
|
||||
*out = tmp.u8;
|
||||
@ -378,14 +378,14 @@ static int rmsgpack_read_uint(RFILE *fd, uint64_t *out, size_t size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rmsgpack_read_int(RFILE *fd, int64_t *out, size_t size)
|
||||
static int rmsgpack_read_int(RFILE *fd, int64_t *out, size_t len)
|
||||
{
|
||||
union { uint64_t u64; uint32_t u32; uint16_t u16; uint8_t u8; } tmp;
|
||||
|
||||
if (filestream_read(fd, &tmp, size) == -1)
|
||||
if (filestream_read(fd, &tmp, len) == -1)
|
||||
return -1;
|
||||
|
||||
switch (size)
|
||||
switch (len)
|
||||
{
|
||||
case 1:
|
||||
*out = (int8_t)tmp.u8;
|
||||
|
@ -258,11 +258,11 @@ static int action_left_mainmenu(unsigned type, const char *label,
|
||||
#ifdef HAVE_XMB
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx;
|
||||
size_t size = (driver_ctx && driver_ctx->list_get_size) ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_PLAIN) : 0;
|
||||
size_t _len = (driver_ctx && driver_ctx->list_get_size) ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_PLAIN) : 0;
|
||||
const char *menu_ident = (driver_ctx && driver_ctx->ident) ? driver_ctx->ident : NULL;
|
||||
/* Tab switching functionality only applies
|
||||
* to XMB */
|
||||
if ( (size == 1)
|
||||
if ( (_len == 1)
|
||||
&& string_is_equal(menu_ident, "xmb"))
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
@ -290,12 +290,12 @@ static int action_right_mainmenu(unsigned type, const char *label,
|
||||
const char *menu_ident = (driver_ctx && driver_ctx->ident)
|
||||
? driver_ctx->ident
|
||||
: NULL;
|
||||
size_t size = (driver_ctx && driver_ctx->list_get_size)
|
||||
size_t _len = (driver_ctx && driver_ctx->list_get_size)
|
||||
? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_PLAIN)
|
||||
: 0;
|
||||
/* Tab switching functionality only applies
|
||||
* to XMB */
|
||||
if ( (size == 1)
|
||||
if ( (_len == 1)
|
||||
&& string_is_equal(menu_ident, "xmb"))
|
||||
{
|
||||
size_t horiz_size = 0, tabs_size = 0, selection = 0;
|
||||
|
@ -11098,13 +11098,13 @@ static void materialui_list_insert(
|
||||
static void materialui_list_clear(file_list_t *list)
|
||||
{
|
||||
size_t i;
|
||||
size_t size = list ? list->size : 0;
|
||||
size_t _len = list ? list->size : 0;
|
||||
|
||||
/* Must cancel pending thumbnail requests before
|
||||
* freeing node->thumbnails objects */
|
||||
gfx_thumbnail_cancel_pending_requests();
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
for (i = 0; i < _len; i++)
|
||||
{
|
||||
materialui_node_t *node = (materialui_node_t*)list->list[i].userdata;
|
||||
|
||||
|
@ -3592,13 +3592,13 @@ static int menu_displaylist_parse_horizontal_list(
|
||||
struct item_file *item = NULL;
|
||||
const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx;
|
||||
size_t selection = driver_ctx->list_get_selection ? driver_ctx->list_get_selection(menu_st->userdata) : 0;
|
||||
size_t size = driver_ctx->list_get_size ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS) : 0;
|
||||
size_t _len = driver_ctx->list_get_size ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS) : 0;
|
||||
|
||||
if (!driver_ctx->list_get_entry)
|
||||
return -1;
|
||||
|
||||
if (!(item = (struct item_file*)driver_ctx->list_get_entry(menu_st->userdata, MENU_LIST_HORIZONTAL,
|
||||
(unsigned)(selection - (size +1)))))
|
||||
(unsigned)(selection - (_len +1)))))
|
||||
return -1;
|
||||
|
||||
/* When opening a saved view the explore menu will handle the list */
|
||||
|
@ -811,7 +811,7 @@ bool netplay_send_cur_input(netplay_t *netplay,
|
||||
*/
|
||||
bool netplay_send_raw_cmd(netplay_t *netplay,
|
||||
struct netplay_connection *connection, uint32_t cmd, const void *data,
|
||||
size_t size);
|
||||
size_t len);
|
||||
|
||||
/**
|
||||
* netplay_send_raw_cmd_all
|
||||
@ -822,7 +822,7 @@ bool netplay_send_raw_cmd(netplay_t *netplay,
|
||||
*/
|
||||
void netplay_send_raw_cmd_all(netplay_t *netplay,
|
||||
struct netplay_connection *except, uint32_t cmd, const void *data,
|
||||
size_t size);
|
||||
size_t len);
|
||||
|
||||
/**
|
||||
* netplay_cmd_mode
|
||||
|
@ -331,11 +331,11 @@ static int task_database_cue_get_serial(const char *name, char *s, size_t len)
|
||||
{
|
||||
char track_path[PATH_MAX_LENGTH];
|
||||
uint64_t offset = 0;
|
||||
size_t size = 0;
|
||||
size_t _len = 0;
|
||||
|
||||
track_path[0] = '\0';
|
||||
|
||||
if (cue_find_track(name, true, &offset, &size,
|
||||
if (cue_find_track(name, true, &offset, &_len,
|
||||
track_path, sizeof(track_path)) < 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
@ -345,7 +345,7 @@ static int task_database_cue_get_serial(const char *name, char *s, size_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return intfstream_file_get_serial(track_path, offset, size, s, len);
|
||||
return intfstream_file_get_serial(track_path, offset, _len, s, len);
|
||||
}
|
||||
|
||||
static int task_database_gdi_get_serial(const char *name, char *s, size_t len)
|
||||
@ -385,7 +385,7 @@ static int task_database_chd_get_serial(const char *name, char *serial, size_t l
|
||||
}
|
||||
|
||||
static bool intfstream_file_get_crc(const char *name,
|
||||
uint64_t offset, size_t size, uint32_t *crc)
|
||||
uint64_t offset, size_t len, uint32_t *crc)
|
||||
{
|
||||
bool rv;
|
||||
intfstream_t *fd = intfstream_open_file(name,
|
||||
@ -407,20 +407,20 @@ static bool intfstream_file_get_crc(const char *name,
|
||||
if (file_size < 0)
|
||||
goto error;
|
||||
|
||||
if (offset != 0 || size < (uint64_t) file_size)
|
||||
if (offset != 0 || len < (uint64_t) file_size)
|
||||
{
|
||||
if (intfstream_seek(fd, (int64_t)offset, SEEK_SET) == -1)
|
||||
goto error;
|
||||
|
||||
data = (uint8_t*)malloc(size);
|
||||
data = (uint8_t*)malloc(len);
|
||||
|
||||
if (intfstream_read(fd, data, size) != (int64_t) size)
|
||||
if (intfstream_read(fd, data, len) != (int64_t)len)
|
||||
goto error;
|
||||
|
||||
intfstream_close(fd);
|
||||
free(fd);
|
||||
fd = intfstream_open_memory(data, RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE, size);
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE, len);
|
||||
|
||||
if (!fd)
|
||||
goto error;
|
||||
@ -447,11 +447,11 @@ static int task_database_cue_get_crc(const char *name, uint32_t *crc)
|
||||
{
|
||||
char track_path[PATH_MAX_LENGTH];
|
||||
uint64_t offset = 0;
|
||||
size_t size = 0;
|
||||
size_t _len = 0;
|
||||
|
||||
track_path[0] = '\0';
|
||||
|
||||
if (cue_find_track(name, false, &offset, &size,
|
||||
if (cue_find_track(name, false, &offset, &_len,
|
||||
track_path, sizeof(track_path)) < 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
@ -461,7 +461,7 @@ static int task_database_cue_get_crc(const char *name, uint32_t *crc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return intfstream_file_get_crc(track_path, offset, size, crc);
|
||||
return intfstream_file_get_crc(track_path, offset, _len, crc);
|
||||
}
|
||||
|
||||
static int task_database_gdi_get_crc(const char *name, uint32_t *crc)
|
||||
|
@ -94,14 +94,14 @@ static void cb_task_menu_explore_init(
|
||||
const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx;
|
||||
if (driver_ctx->list_get_entry)
|
||||
{
|
||||
size_t selection = driver_ctx->list_get_selection ? driver_ctx->list_get_selection(menu_st->userdata) : 0;
|
||||
size_t size = driver_ctx->list_get_size ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS) : 0;
|
||||
if (selection > 0 && size > 0)
|
||||
size_t selection = driver_ctx->list_get_selection ? driver_ctx->list_get_selection(menu_st->userdata) : 0;
|
||||
size_t _len = driver_ctx->list_get_size ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS) : 0;
|
||||
if (selection > 0 && _len > 0)
|
||||
{
|
||||
struct item_file *item = NULL;
|
||||
/* Label contains the path and path contains the label */
|
||||
if ((item = (struct item_file*)driver_ctx->list_get_entry(menu_st->userdata, MENU_LIST_HORIZONTAL,
|
||||
(unsigned)(selection - (size +1)))))
|
||||
(unsigned)(selection - (_len +1)))))
|
||||
menu_type = item->type;
|
||||
}
|
||||
}
|
||||
|
@ -989,7 +989,7 @@ static void content_load_state_cb(retro_task_t *task,
|
||||
unsigned i;
|
||||
bool ret;
|
||||
load_task_data_t *load_data = (load_task_data_t*)task_data;
|
||||
ssize_t size = load_data->size;
|
||||
ssize_t _len = load_data->size;
|
||||
unsigned num_blocks = 0;
|
||||
void *buf = load_data->data;
|
||||
struct sram_block *blocks = NULL;
|
||||
@ -1005,10 +1005,10 @@ static void content_load_state_cb(retro_task_t *task,
|
||||
RARCH_LOG("[State]: %s \"%s\", %u %s.\n",
|
||||
msg_hash_to_str(MSG_LOADING_STATE),
|
||||
load_data->path,
|
||||
(unsigned)size,
|
||||
(unsigned)_len,
|
||||
msg_hash_to_str(MSG_BYTES));
|
||||
|
||||
if (size < 0 || !buf)
|
||||
if (_len < 0 || !buf)
|
||||
goto error;
|
||||
|
||||
/* This means we're backing up the file in memory,
|
||||
@ -1023,11 +1023,11 @@ static void content_load_state_cb(retro_task_t *task,
|
||||
undo_save_buf.data = NULL;
|
||||
}
|
||||
|
||||
if (!(undo_save_buf.data = malloc(size)))
|
||||
if (!(undo_save_buf.data = malloc(_len)))
|
||||
goto error;
|
||||
|
||||
memcpy(undo_save_buf.data, buf, size);
|
||||
undo_save_buf.size = size;
|
||||
memcpy(undo_save_buf.data, buf, _len);
|
||||
undo_save_buf.size = _len;
|
||||
strlcpy(undo_save_buf.path, load_data->path, sizeof(undo_save_buf.path));
|
||||
|
||||
free(buf);
|
||||
@ -1083,7 +1083,7 @@ static void content_load_state_cb(retro_task_t *task,
|
||||
/* Backup the current state so we can undo this load */
|
||||
content_save_state("RAM", false);
|
||||
|
||||
ret = content_deserialize_state(buf, size);
|
||||
ret = content_deserialize_state(buf, _len);
|
||||
|
||||
/* Flush back. */
|
||||
for (i = 0; i < num_blocks; i++)
|
||||
|
@ -57,16 +57,16 @@ public:
|
||||
QString categoryIconName() const { return m_categoryIconName; }
|
||||
virtual void load()
|
||||
{
|
||||
unsigned i;
|
||||
size_t size = m_pages.size();
|
||||
for (i = 0; i < size; i++)
|
||||
size_t i;
|
||||
size_t _len = m_pages.size();
|
||||
for (i = 0; i < _len; i++)
|
||||
m_pages.at(i)->load();
|
||||
}
|
||||
virtual void apply()
|
||||
{
|
||||
unsigned i;
|
||||
size_t size = m_pages.size();
|
||||
for (i = 0; i < size; i++)
|
||||
size_t i;
|
||||
size_t _len = m_pages.size();
|
||||
for (i = 0; i < _len; i++)
|
||||
m_pages.at(i)->apply();
|
||||
}
|
||||
protected:
|
||||
|
@ -1623,9 +1623,9 @@ void MainWindow::updateVisibleItems()
|
||||
{
|
||||
size_t i;
|
||||
QVector<QModelIndex> indexes = m_gridView->visibleIndexes();
|
||||
size_t size = indexes.size();
|
||||
size_t _len = indexes.size();
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
for (i = 0; i < _len; i++)
|
||||
m_playlistModel->loadThumbnail(m_proxyModel->mapToSource(indexes.at(i)));
|
||||
}
|
||||
}
|
||||
@ -1662,9 +1662,9 @@ QVector<QPair<QString, QString> > MainWindow::getPlaylists()
|
||||
{
|
||||
size_t i;
|
||||
QVector<QPair<QString, QString> > playlists;
|
||||
size_t size = m_listWidget->count();
|
||||
size_t _len = m_listWidget->count();
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
for (i = 0; i < _len; i++)
|
||||
{
|
||||
QString label, path;
|
||||
QPair<QString, QString> pair;
|
||||
@ -1740,10 +1740,10 @@ void MainWindow::onZoomValueChanged(int zoom_val)
|
||||
int new_size = 0;
|
||||
|
||||
if (zoom_val < 50)
|
||||
new_size = exp_scale(
|
||||
lerp(0, 49, 25, 49, zoom_val) / 50.0, 102, 256);
|
||||
new_size = exp_scale(lerp(0, 49, 25, 49, zoom_val)
|
||||
/ 50.0, 102, 256);
|
||||
else
|
||||
new_size = exp_scale(zoom_val / 100.0, 256, 1024);
|
||||
new_size = exp_scale(zoom_val / 100.0, 256, 1024);
|
||||
|
||||
m_gridView->setGridSize(new_size);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user