Sync with libretro/RetroArch main repo

This commit is contained in:
Cristian Sandu 2014-10-14 22:54:02 +03:00
commit 07c8f2442a
27 changed files with 220 additions and 211 deletions

View File

@ -274,6 +274,17 @@
96355CD91788E6E00010DBFA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_WARN_ASSIGN_ENUM = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/..";
ONLY_ACTIVE_ARCH = YES;
};
@ -282,6 +293,17 @@
96355CDA1788E6E00010DBFA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_WARN_ASSIGN_ENUM = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/..";
};
name = Release;

View File

@ -32,28 +32,25 @@ static void* const associated_core_key = (void*)&associated_core_key;
- (void)sendEvent:(NSEvent *)event
{
int i;
NSEventType event_type;
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
[super sendEvent:event];
event_type = event.type;
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
NSEventType event_type = event.type;
switch ((NSInteger)event_type)
{
case NSKeyDown:
case NSKeyUp:
{
NSString* ch = (NSString*)event.characters;
if (!ch || ch.length == 0)
apple_input_keyboard_event(event_type == NSKeyDown, event.keyCode, 0, 0);
else
{
apple_input_keyboard_event(event_type == NSKeyDown, event.keyCode, [ch characterAtIndex:0], event.modifierFlags);
for (i = 1; i < ch.length; i ++)
for (NSUInteger i = 1; i < ch.length; i ++)
apple_input_keyboard_event(event_type == NSKeyDown, 0, [ch characterAtIndex:i], event.modifierFlags);
}
}
@ -64,7 +61,7 @@ static void* const associated_core_key = (void*)&associated_core_key;
uint32_t new_flags = event.modifierFlags;
bool down = (new_flags & old_flags) == old_flags;
old_flags = new_flags;
apple_input_keyboard_event(down, event.keyCode, 0, event.modifierFlags);
}
break;
@ -77,7 +74,7 @@ static void* const associated_core_key = (void*)&associated_core_key;
// Relative
apple->mouse_delta[0] += event.deltaX;
apple->mouse_delta[1] += event.deltaY;
// Absolute
pos = [[RAGameView get] convertPoint:[event locationInWindow] fromView:nil];
apple->touches[0].screen_x = pos.x;
@ -133,14 +130,9 @@ static char** waiting_argv;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSComboBox* cb;
const core_info_list_t* core_list;
int i;
const char *paths;
apple_platform = self;
paths = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) firstObject] UTF8String];
const char* paths = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) firstObject] UTF8String];
fill_pathname_join(g_defaults.core_dir, NSBundle.mainBundle.bundlePath.UTF8String, "Contents/Resources/modules", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.menu_config_dir, paths, "RetroArch", sizeof(g_defaults.menu_config_dir));
@ -152,22 +144,22 @@ static char** waiting_argv;
#endif
[self.window setAcceptsMouseMovedEvents: YES];
[[RAGameView get] setFrame: [[self.window contentView] bounds]];
[[self.window contentView] setAutoresizesSubviews:YES];
[[self.window contentView] addSubview:[RAGameView get]];
[self.window makeFirstResponder:[RAGameView get]];
self.settingsWindow = [[[NSWindowController alloc] initWithWindowNibName:BOXSTRING("Settings")] autorelease];
// Warn if there are no cores present
core_info_set_core_path();
core_list = (const core_info_list_t*)core_info_list_get();
const core_info_list_t* core_list = (const core_info_list_t*)core_info_list_get();
// Create core select list
cb = (NSComboBox*)[[self.coreSelectSheet contentView] viewWithTag:1];
for (i = 0; core_list && i < core_list->count; i ++)
NSComboBox* cb = (NSComboBox*)[[self.coreSelectSheet contentView] viewWithTag:1];
for (size_t i = 0; core_list && i < core_list->count; i ++)
{
NSString* desc = (NSString*)BOXSTRING(core_list->list[i].display_name);
#if defined(MAC_OS_X_VERSION_10_6)
@ -176,7 +168,7 @@ static char** waiting_argv;
#endif
[cb addItemWithObjectValue:desc];
}
apple_run_core(waiting_argc, waiting_argv, nil, 0);
waiting_argc = 0;

View File

@ -60,17 +60,17 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
- (void)checkBind:(NSTimer*)send
{
int32_t value = 0;
int32_t index = _setting->index ? _setting->index - 1 : 0;
int32_t index = self.setting->index ? self.setting->index - 1 : 0;
if ((value = apple_input_find_any_key()))
BINDFOR(*_setting).key = input_translate_keysym_to_rk(value);
BINDFOR(*[self setting]).key = input_translate_keysym_to_rk(value);
else if ((value = apple_input_find_any_button(index)) >= 0)
BINDFOR(*_setting).joykey = value;
BINDFOR(*[self setting]).joykey = value;
else if ((value = apple_input_find_any_axis(index)))
BINDFOR(*_setting).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1);
BINDFOR(*[self setting]).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1);
else
return;
[self goAway:self];
}
@ -123,14 +123,13 @@ NSWindowDelegate>
- (void)awakeFromNib
{
int i;
const rarch_setting_t *setting_data;
NSMutableArray* thisGroup = nil;
NSMutableArray* thisSubGroup = nil;
self.settings = [NSMutableArray array];
setting_data = (const rarch_setting_t *)driver.menu->list_settings;
for (i = 0; setting_data[i].type; i ++)
for (int i = 0; setting_data[i].type; i ++)
{
switch (setting_data[i].type)
{
@ -138,8 +137,8 @@ NSWindowDelegate>
{
thisGroup = [NSMutableArray array];
#if defined(MAC_OS_X_VERSION_10_6)
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
objc_setAssociatedObject(thisGroup, associated_name_tag, [NSString stringWithFormat:BOXSTRING("%s"), setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
objc_setAssociatedObject(thisGroup, associated_name_tag, BOXSTRING(setting_data[i].name), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
#endif
break;
}
@ -156,8 +155,8 @@ NSWindowDelegate>
{
thisSubGroup = [NSMutableArray array];
#if defined(MAC_OS_X_VERSION_10_6)
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
objc_setAssociatedObject(thisSubGroup, associated_name_tag, [NSString stringWithFormat:BOXSTRING("%s"), setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
objc_setAssociatedObject(thisSubGroup, associated_name_tag, BOXSTRING(setting_data[i].name), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
#endif
break;
}

View File

@ -64,14 +64,13 @@ void apple_display_alert(const char *message, const char *title)
- (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error
{
NSUInteger i;
bool hasDot = false;
if (partialString.length)
for (i = 0; i < partialString.length; i ++)
for (NSUInteger i = 0; i < partialString.length; i ++)
{
unichar ch = [partialString characterAtIndex:i];
if (i == 0 && (!self.minimum || self.minimum.intValue < 0) && ch == '-')
continue;
else if (self.allowsFloats && !hasDot && ch == '.')

View File

@ -204,16 +204,16 @@ static const audio_driver_t audio_thread = {
};
bool rarch_threaded_audio_init(const audio_driver_t **out_driver, void **out_data,
const char *device, unsigned out_rate, unsigned latency,
const audio_driver_t *driver)
const char *device, unsigned audio_out_rate, unsigned latency,
const audio_driver_t *drv)
{
audio_thread_t *thr = (audio_thread_t*)calloc(1, sizeof(*thr));
if (!thr)
return false;
thr->driver = driver;
thr->driver = (const audio_driver_t*)drv;
thr->device = device;
thr->out_rate = out_rate;
thr->out_rate = audio_out_rate;
thr->latency = latency;
if (!(thr->cond = scond_new()))

View File

@ -36,11 +36,11 @@ static const struct resampler_config resampler_config = {
config_userdata_free,
};
static int find_resampler_driver_index(const char *driver)
static int find_resampler_driver_index(const char *drv)
{
unsigned i;
for (i = 0; resampler_drivers[i]; i++)
if (strcasecmp(driver, resampler_drivers[i]->ident) == 0)
if (strcasecmp(drv, resampler_drivers[i]->ident) == 0)
return i;
return -1;
}

View File

@ -253,63 +253,63 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = {
static const void *find_driver_nonempty(const char *label, int i,
char *str, size_t sizeof_str)
{
const void *driver = NULL;
const void *drv = NULL;
if (!strcmp(label, "camera_driver"))
{
driver = camera_drivers[i];
if (driver)
drv = camera_drivers[i];
if (drv)
strlcpy(str, camera_drivers[i]->ident, sizeof_str);
}
else if (!strcmp(label, "location_driver"))
{
driver = location_drivers[i];
if (driver)
drv = location_drivers[i];
if (drv)
strlcpy(str, location_drivers[i]->ident, sizeof_str);
}
else if (!strcmp(label, "osk_driver"))
{
driver = osk_drivers[i];
if (driver)
drv = osk_drivers[i];
if (drv)
strlcpy(str, osk_drivers[i]->ident, sizeof_str);
}
#ifdef HAVE_MENU
else if (!strcmp(label, "menu_driver"))
{
driver = menu_ctx_drivers[i];
if (driver)
drv = menu_ctx_drivers[i];
if (drv)
strlcpy(str, menu_ctx_drivers[i]->ident, sizeof_str);
}
#endif
else if (!strcmp(label, "input_driver"))
{
driver = input_drivers[i];
if (driver)
drv = input_drivers[i];
if (drv)
strlcpy(str, input_drivers[i]->ident, sizeof_str);
}
else if (!strcmp(label, "input_joypad_driver"))
{
driver = joypad_drivers[i];
if (driver)
drv = joypad_drivers[i];
if (drv)
strlcpy(str, joypad_drivers[i]->ident, sizeof_str);
}
else if (!strcmp(label, "video_driver"))
{
driver = video_drivers[i];
if (driver)
drv = video_drivers[i];
if (drv)
strlcpy(str, video_drivers[i]->ident, sizeof_str);
}
else if (!strcmp(label, "audio_driver"))
{
driver = audio_drivers[i];
if (driver)
drv = audio_drivers[i];
if (drv)
strlcpy(str, audio_drivers[i]->ident, sizeof_str);
}
return driver;
return drv;
}
static int find_driver_index(const char * label, const char *driver)
static int find_driver_index(const char * label, const char *drv)
{
unsigned i;
char str[PATH_MAX];
@ -322,7 +322,7 @@ static int find_driver_index(const char * label, const char *driver)
return -1;
if (str[0] == '\0')
break;
if (!strcasecmp(driver, str))
if (!strcasecmp(drv, str))
return i;
}

View File

@ -164,7 +164,7 @@ static const struct zlib_file_backend zlib_backend = {
zlib_file_free,
};
const struct zlib_file_backend *zlib_get_default_file_backend(void)
static const struct zlib_file_backend *zlib_get_default_file_backend(void)
{
return &zlib_backend;
}

View File

@ -126,7 +126,7 @@ static void lakka_draw_text(lakka_handle_t *lakka,
str, &params);
}
void lakka_draw_background(bool force_transparency)
static void lakka_draw_background(bool force_transparency)
{
float alpha = 0.75f;
gl_t *gl = NULL;
@ -882,9 +882,7 @@ static void lakka_context_reset(void *data)
for (i = 1; i < lakka->num_categories; i++)
{
char core_id[PATH_MAX], texturepath[PATH_MAX], content_texturepath[PATH_MAX],
mediapath[PATH_MAX], themepath[PATH_MAX];
char core_id[PATH_MAX], texturepath[PATH_MAX], content_texturepath[PATH_MAX];
menu_category_t *category = (menu_category_t*)&lakka->categories[i];
core_info_t *info = NULL;
core_info_list_t *info_list = NULL;

View File

@ -466,7 +466,7 @@ static void rgui_free(void *data)
free((uint8_t*)menu->font);
}
void rgui_set_texture(void *data)
static void rgui_set_texture(void *data)
{
menu_handle_t *menu = (menu_handle_t*)data;

View File

@ -224,16 +224,16 @@ void menu_action_setting_driver(
else if (setting->flags & SD_FLAG_IS_DRIVER)
{
const char *label = setting->name;
char *driver = (char*)setting->value.string;
char *drv = (char*)setting->value.string;
size_t sizeof_driver = setting->size;
switch (action)
{
case MENU_ACTION_LEFT:
find_prev_driver(label, driver, sizeof_driver);
find_prev_driver(label, drv, sizeof_driver);
break;
case MENU_ACTION_RIGHT:
find_next_driver(label, driver, sizeof_driver);
find_next_driver(label, drv, sizeof_driver);
break;
}
}

View File

@ -427,7 +427,6 @@ static int push_list(menu_handle_t *menu,
file_list_clear(list);
if (g_extern.system.core_options)
{
size_t i;
size_t opts = core_option_size(g_extern.system.core_options);
for (i = 0; i < opts; i++)
file_list_push(list,

View File

@ -13,6 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "menu_entries_cbs.h"
#include "menu_action.h"
#include "menu_common.h"
#include "menu_input_line_cb.h"

View File

@ -147,22 +147,22 @@ void menu_shader_manager_set_preset(struct gfx_shader *shader,
}
}
void menu_shader_manager_get_str(struct gfx_shader *shader,
void menu_shader_manager_get_str(struct gfx_shader *program,
char *type_str, size_t type_str_size, const char *menu_label,
const char *label, unsigned type)
{
*type_str = '\0';
if (!strcmp(label, "video_shader_num_passes"))
snprintf(type_str, type_str_size, "%u", shader->passes);
snprintf(type_str, type_str_size, "%u", program->passes);
else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
{
/* menu->parameter_shader here. */
if (shader)
if (program)
{
const struct gfx_shader_parameter *param =
(const struct gfx_shader_parameter*)&shader->parameters
(const struct gfx_shader_parameter*)&program->parameters
[type - MENU_SETTINGS_SHADER_PARAMETER_0];
snprintf(type_str, type_str_size, "%.2f [%.2f %.2f]",
param->current, param->minimum, param->maximum);
@ -174,9 +174,9 @@ void menu_shader_manager_get_str(struct gfx_shader *shader,
else if (!strcmp(label, "video_shader_pass"))
{
unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_0);
if (*shader->pass[pass].source.path)
if (*program->pass[pass].source.path)
fill_pathname_base(type_str,
shader->pass[pass].source.path, type_str_size);
program->pass[pass].source.path, type_str_size);
else
strlcpy(type_str, "N/A", type_str_size);
}
@ -189,17 +189,17 @@ void menu_shader_manager_get_str(struct gfx_shader *shader,
"Nearest"
};
strlcpy(type_str, modes[shader->pass[pass].filter],
strlcpy(type_str, modes[program->pass[pass].filter],
type_str_size);
}
else if (!strcmp(label, "video_shader_scale_pass"))
{
unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_SCALE_0);
unsigned scale = shader->pass[pass].fbo.scale_x;
if (!scale)
unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_SCALE_0);
unsigned scale_value = program->pass[pass].fbo.scale_x;
if (!scale_value)
strlcpy(type_str, "Don't care", type_str_size);
else
snprintf(type_str, type_str_size, "%ux", scale);
snprintf(type_str, type_str_size, "%ux", scale_value);
}
}

View File

@ -29,7 +29,7 @@ static const font_renderer_driver_t *font_backends[] = {
};
bool font_renderer_create_default(
const font_renderer_driver_t **driver, void **handle,
const font_renderer_driver_t **drv, void **handle,
const char *font_path, unsigned font_size)
{
unsigned i;
@ -46,7 +46,7 @@ bool font_renderer_create_default(
{
RARCH_LOG("Using font rendering backend: %s.\n",
font_backends[i]->ident);
*driver = font_backends[i];
*drv = font_backends[i];
return true;
}
else
@ -54,7 +54,7 @@ bool font_renderer_create_default(
font_backends[i]->ident);
}
*driver = NULL;
*drv = NULL;
*handle = NULL;
return false;
}

View File

@ -48,7 +48,7 @@ void gl_load_texture_data(GLuint obj, const struct texture_image *img,
}
bool gl_load_luts(const struct gfx_shader *generic_shader,
GLuint *lut_textures)
GLuint *textures_lut)
{
unsigned i;
unsigned num_luts = min(generic_shader->luts, GFX_MAX_TEXTURES);
@ -59,7 +59,7 @@ bool gl_load_luts(const struct gfx_shader *generic_shader,
/* Original shader_glsl.c code only generated one
* texture handle. I assume it was a bug, but if not,
* replace num_luts with 1 when GLSL is used. */
glGenTextures(num_luts, lut_textures);
glGenTextures(num_luts, textures_lut);
for (i = 0; i < num_luts; i++)
{
struct texture_image img = {0};
@ -73,7 +73,7 @@ bool gl_load_luts(const struct gfx_shader *generic_shader,
return false;
}
gl_load_texture_data(lut_textures[i], &img,
gl_load_texture_data(textures_lut[i], &img,
driver.video->wrap_type_to_enum(generic_shader->lut[i].wrap),
generic_shader->lut[i].filter != RARCH_FILTER_NEAREST,
generic_shader->lut[i].mipmap);

View File

@ -737,30 +737,30 @@ static void set_program_base_attrib(unsigned i)
prg[i].lut_tex = cgGetNamedParameter(prg[i].vprg, "IN.lut_tex_coord");
}
static void set_pass_attrib(struct cg_program *prg, struct cg_fbo_params *fbo,
static void set_pass_attrib(struct cg_program *program, struct cg_fbo_params *fbo,
const char *attr)
{
char attr_buf[64];
snprintf(attr_buf, sizeof(attr_buf), "%s.texture", attr);
if (!fbo->tex)
fbo->tex = cgGetNamedParameter(prg->fprg, attr_buf);
fbo->tex = cgGetNamedParameter(program->fprg, attr_buf);
snprintf(attr_buf, sizeof(attr_buf), "%s.video_size", attr);
if (!fbo->vid_size_v)
fbo->vid_size_v = cgGetNamedParameter(prg->vprg, attr_buf);
fbo->vid_size_v = cgGetNamedParameter(program->vprg, attr_buf);
if (!fbo->vid_size_f)
fbo->vid_size_f = cgGetNamedParameter(prg->fprg, attr_buf);
fbo->vid_size_f = cgGetNamedParameter(program->fprg, attr_buf);
snprintf(attr_buf, sizeof(attr_buf), "%s.texture_size", attr);
if (!fbo->tex_size_v)
fbo->tex_size_v = cgGetNamedParameter(prg->vprg, attr_buf);
fbo->tex_size_v = cgGetNamedParameter(program->vprg, attr_buf);
if (!fbo->tex_size_f)
fbo->tex_size_f = cgGetNamedParameter(prg->fprg, attr_buf);
fbo->tex_size_f = cgGetNamedParameter(program->fprg, attr_buf);
snprintf(attr_buf, sizeof(attr_buf), "%s.tex_coord", attr);
if (!fbo->coord)
fbo->coord = cgGetNamedParameter(prg->vprg, attr_buf);
fbo->coord = cgGetNamedParameter(program->vprg, attr_buf);
}
static void set_program_attributes(unsigned i)

View File

@ -238,7 +238,7 @@ static GLint get_uniform(GLuint prog, const char *base)
for (i = 0; i < ARRAY_SIZE(glsl_prefixes); i++)
{
snprintf(buf, sizeof(buf), "%s%s", glsl_prefixes[i], base);
GLint loc = glGetUniformLocation(prog, buf);
loc = glGetUniformLocation(prog, buf);
if (loc >= 0)
return loc;
}
@ -258,7 +258,7 @@ static GLint get_attrib(GLuint prog, const char *base)
for (i = 0; i < ARRAY_SIZE(glsl_prefixes); i++)
{
snprintf(buf, sizeof(buf), "%s%s", glsl_prefixes[i], base);
GLint loc = glGetAttribLocation(prog, buf);
loc = glGetAttribLocation(prog, buf);
if (loc >= 0)
return loc;
}

View File

@ -117,15 +117,6 @@ static struct gfx_shader *shader_null_get_current_shader(void)
return NULL;
}
void shader_null_set_get_proc_address(gfx_ctx_proc_t (*proc)(const char*))
{
}
void shader_null_set_context_type(bool core_profile,
unsigned major, unsigned minor)
{
}
const shader_backend_t shader_null_backend = {
shader_null_init,
shader_null_deinit,

View File

@ -301,7 +301,7 @@ bool gfx_shader_resolve_parameters(config_file_t *conf,
/* Find all parameters in our shaders. */
for (i = 0; i < shader->passes; i++)
{
char line[2048];
char line[PATH_MAX];
FILE *file = fopen(shader->pass[i].source.path, "r");
if (!file)
continue;
@ -338,7 +338,7 @@ bool gfx_shader_resolve_parameters(config_file_t *conf,
/* Read in parameters which override the defaults. */
if (conf)
{
char parameters[1024];
char parameters[PATH_MAX];
char *save = NULL;
const char *id;
@ -349,7 +349,7 @@ bool gfx_shader_resolve_parameters(config_file_t *conf,
for (id = strtok_r(parameters, ";", &save); id;
id = strtok_r(NULL, ";", &save))
{
struct gfx_shader_parameter *param = (struct gfx_shader_parameter*)
param = (struct gfx_shader_parameter*)
find_parameter(shader->parameters, shader->num_parameters, id);
if (!param)

View File

@ -817,19 +817,19 @@ static const video_driver_t video_thread = {
};
static void thread_set_callbacks(thread_video_t *thr,
const video_driver_t *driver)
const video_driver_t *drv)
{
thr->video_thread = video_thread;
/* Disable optional features if not present. */
if (!driver->read_viewport)
if (!drv->read_viewport)
thr->video_thread.read_viewport = NULL;
if (!driver->set_rotation)
if (!drv->set_rotation)
thr->video_thread.set_rotation = NULL;
if (!driver->set_shader)
if (!drv->set_shader)
thr->video_thread.set_shader = NULL;
#ifdef HAVE_OVERLAY
if (!driver->overlay_interface)
if (!drv->overlay_interface)
thr->video_thread.overlay_interface = NULL;
#endif
@ -840,15 +840,15 @@ static void thread_set_callbacks(thread_video_t *thr,
bool rarch_threaded_video_init(const video_driver_t **out_driver,
void **out_data, const input_driver_t **input, void **input_data,
const video_driver_t *driver, const video_info_t *info)
const video_driver_t *drv, const video_info_t *info)
{
thread_video_t *thr = (thread_video_t*)calloc(1, sizeof(*thr));
if (!thr)
return false;
thread_set_callbacks(thr, driver);
thread_set_callbacks(thr, drv);
thr->driver = driver;
thr->driver = drv;
*out_driver = &thr->video_thread;
*out_data = thr;
return thread_init(thr, info, input, input_data);

View File

@ -73,4 +73,7 @@ int16_t pad_connection_get_axis(joypad_connection_t *joyconn,
bool pad_connection_has_interface(joypad_connection_t *joyconn,
unsigned index);
bool pad_connection_rumble(joypad_connection_t *s,
unsigned pad, enum retro_rumble_effect effect, uint16_t strength);
#endif

View File

@ -36,7 +36,7 @@ static void input_autoconfigure_joypad_conf(config_file_t *conf,
}
static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
unsigned index, const char *name, const char *driver,
unsigned index, const char *name, const char *drv,
int32_t vid, int32_t pid, bool block_osd_spam)
{
if (!conf)
@ -59,7 +59,7 @@ static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
//RARCH_LOG("ident_idx: %s\n", ident_idx);
cond_found_idx = !strcmp(ident_idx, name);
cond_found_general = !strcmp(ident, name) && !strcmp(driver, input_driver);
cond_found_general = !strcmp(ident, name) && !strcmp(drv, input_driver);
if ((vid != 0) && (input_vid != 0))
cond_found_vid = (vid == input_vid);
if ((pid != 0) && (input_pid != 0))
@ -95,7 +95,7 @@ found:
void input_config_autoconfigure_joypad(unsigned index,
const char *name, int32_t vid, int32_t pid,
const char *driver)
const char *drv)
{
size_t i;
@ -127,7 +127,7 @@ void input_config_autoconfigure_joypad(unsigned index,
config_file_t *conf = (config_file_t*)
config_file_new_from_string(input_builtin_autoconfs[i]);
bool success = input_try_autoconfigure_joypad_from_conf(conf,
index, name, driver, vid, pid, block_osd_spam);
index, name, drv, vid, pid, block_osd_spam);
config_file_free(conf);
if (success)
break;
@ -148,7 +148,7 @@ void input_config_autoconfigure_joypad(unsigned index,
if (!conf)
continue;
bool success = input_try_autoconfigure_joypad_from_conf(conf,
index, name, driver, vid, pid, block_osd_spam);
index, name, drv, vid, pid, block_osd_spam);
config_file_free(conf);
if (success)
break;

View File

@ -136,31 +136,31 @@ const rarch_joypad_driver_t *input_joypad_init_first(void)
return NULL;
}
const char *input_joypad_name(const rarch_joypad_driver_t *driver,
const char *input_joypad_name(const rarch_joypad_driver_t *drv,
unsigned joypad)
{
if (driver)
return driver->name(joypad);
if (drv)
return drv->name(joypad);
return NULL;
}
bool input_joypad_set_rumble(const rarch_joypad_driver_t *driver,
bool input_joypad_set_rumble(const rarch_joypad_driver_t *drv,
unsigned port, enum retro_rumble_effect effect, uint16_t strength)
{
if (!driver || !driver->set_rumble)
if (!drv || !drv->set_rumble)
return false;
int joy_index = g_settings.input.joypad_map[port];
if (joy_index < 0 || joy_index >= MAX_PLAYERS)
return false;
return driver->set_rumble(joy_index, effect, strength);
return drv->set_rumble(joy_index, effect, strength);
}
bool input_joypad_pressed(const rarch_joypad_driver_t *driver,
bool input_joypad_pressed(const rarch_joypad_driver_t *drv,
unsigned port, const struct retro_keybind *binds, unsigned key)
{
if (!driver)
if (!drv)
return false;
int joy_index = g_settings.input.joypad_map[port];
@ -178,23 +178,23 @@ bool input_joypad_pressed(const rarch_joypad_driver_t *driver,
if (joykey == NO_BTN)
joykey = auto_binds[key].joykey;
if (driver->button(joy_index, (uint16_t)joykey))
if (drv->button(joy_index, (uint16_t)joykey))
return true;
uint32_t joyaxis = binds[key].joyaxis;
if (joyaxis == AXIS_NONE)
joyaxis = auto_binds[key].joyaxis;
int16_t axis = driver->axis(joy_index, joyaxis);
int16_t axis = drv->axis(joy_index, joyaxis);
float scaled_axis = (float)abs(axis) / 0x8000;
return scaled_axis > g_settings.input.axis_threshold;
}
int16_t input_joypad_analog(const rarch_joypad_driver_t *driver,
int16_t input_joypad_analog(const rarch_joypad_driver_t *drv,
unsigned port, unsigned index, unsigned id,
const struct retro_keybind *binds)
{
if (!driver)
if (!drv)
return 0;
int joy_index = g_settings.input.joypad_map[port];
@ -221,8 +221,8 @@ int16_t input_joypad_analog(const rarch_joypad_driver_t *driver,
if (axis_plus == AXIS_NONE)
axis_plus = auto_binds[id_plus].joyaxis;
int16_t pressed_minus = abs(driver->axis(joy_index, axis_minus));
int16_t pressed_plus = abs(driver->axis(joy_index, axis_plus));
int16_t pressed_minus = abs(drv->axis(joy_index, axis_minus));
int16_t pressed_plus = abs(drv->axis(joy_index, axis_plus));
int16_t res = pressed_plus - pressed_minus;
@ -236,35 +236,35 @@ int16_t input_joypad_analog(const rarch_joypad_driver_t *driver,
if (key_plus == NO_BTN)
key_plus = auto_binds[id_plus].joykey;
int16_t digital_left = driver->button(joy_index,
int16_t digital_left = drv->button(joy_index,
(uint16_t)key_minus) ? -0x7fff : 0;
int16_t digital_right = driver->button(joy_index,
int16_t digital_right = drv->button(joy_index,
(uint16_t)key_plus) ? 0x7fff : 0;
return digital_right + digital_left;
}
int16_t input_joypad_axis_raw(const rarch_joypad_driver_t *driver,
int16_t input_joypad_axis_raw(const rarch_joypad_driver_t *drv,
unsigned joypad, unsigned axis)
{
if (driver)
return driver->axis(joypad, AXIS_POS(axis)) +
driver->axis(joypad, AXIS_NEG(axis));
if (drv)
return drv->axis(joypad, AXIS_POS(axis)) +
drv->axis(joypad, AXIS_NEG(axis));
return 0;
}
bool input_joypad_button_raw(const rarch_joypad_driver_t *driver,
bool input_joypad_button_raw(const rarch_joypad_driver_t *drv,
unsigned joypad, unsigned button)
{
if (driver)
return driver->button(joypad, button);
if (drv)
return drv->button(joypad, button);
return false;
}
bool input_joypad_hat_raw(const rarch_joypad_driver_t *driver,
bool input_joypad_hat_raw(const rarch_joypad_driver_t *drv,
unsigned joypad, unsigned hat_dir, unsigned hat)
{
if (driver)
return driver->button(joypad, HAT_MAP(hat, hat_dir));
if (drv)
return drv->button(joypad, HAT_MAP(hat, hat_dir));
return false;
}
@ -1483,7 +1483,7 @@ void input_config_parse_joy_button(config_file_t *conf, const char *prefix,
if (config_get_array(conf, key, tmp, sizeof(tmp)))
{
const char *btn = tmp;
btn = tmp;
if (strcmp(btn, "nul") == 0)
bind->joykey = NO_BTN;
else
@ -1509,11 +1509,11 @@ void input_config_parse_joy_axis(config_file_t *conf, const char *prefix,
bind->joyaxis = AXIS_NONE;
else if (strlen(tmp) >= 2 && (*tmp == '+' || *tmp == '-'))
{
int axis = strtol(tmp + 1, NULL, 0);
int i_axis = strtol(tmp + 1, NULL, 0);
if (*tmp == '+')
bind->joyaxis = AXIS_POS(axis);
bind->joyaxis = AXIS_POS(i_axis);
else
bind->joyaxis = AXIS_NEG(axis);
bind->joyaxis = AXIS_NEG(i_axis);
}
/* Ensure that d-pad emulation doesn't screw this over. */

View File

@ -124,56 +124,61 @@ void msg_queue_clear(msg_queue_t *queue)
const char *msg_queue_pull(msg_queue_t *queue)
{
struct queue_elem *front = NULL, *last = NULL, *parent = NULL, *child = NULL;
size_t tmp_ptr = 1;
(void)parent;
(void)child;
(void)tmp_ptr;
/* Nothing in queue. */
if (!queue || queue->ptr == 1)
return NULL;
struct queue_elem *front = queue->elems[1];
front = (struct queue_elem*)queue->elems[1];
front->duration--;
if (front->duration > 0)
return front->msg;
else
free(queue->tmp_msg);
queue->tmp_msg = front->msg;
front->msg = NULL;
front = (struct queue_elem*)queue->elems[1];
last = (struct queue_elem*)queue->elems[--queue->ptr];
queue->elems[1] = last;
free(front);
for (;;)
{
free(queue->tmp_msg);
queue->tmp_msg = front->msg;
front->msg = NULL;
bool left = (tmp_ptr * 2 <= queue->ptr)
&& (queue->elems[tmp_ptr] < queue->elems[tmp_ptr * 2]);
bool right = (tmp_ptr * 2 + 1 <= queue->ptr)
&& (queue->elems[tmp_ptr] < queue->elems[tmp_ptr * 2 + 1]);
struct queue_elem *front = queue->elems[1];
struct queue_elem *last = queue->elems[--queue->ptr];
queue->elems[1] = last;
free(front);
if (!left && !right)
break;
size_t tmp_ptr = 1;
for (;;)
size_t switch_index = tmp_ptr;
if (left && !right)
switch_index <<= 1;
else if (right && !left)
switch_index += switch_index + 1;
else
{
bool left = (tmp_ptr * 2 <= queue->ptr)
&& (queue->elems[tmp_ptr] < queue->elems[tmp_ptr * 2]);
bool right = (tmp_ptr * 2 + 1 <= queue->ptr)
&& (queue->elems[tmp_ptr] < queue->elems[tmp_ptr * 2 + 1]);
if (!left && !right)
break;
size_t switch_index = tmp_ptr;
if (left && !right)
if (queue->elems[tmp_ptr * 2]
>= queue->elems[tmp_ptr * 2 + 1])
switch_index <<= 1;
else if (right && !left)
switch_index += switch_index + 1;
else
{
if (queue->elems[tmp_ptr * 2]
>= queue->elems[tmp_ptr * 2 + 1])
switch_index <<= 1;
else
switch_index += switch_index + 1;
}
struct queue_elem *parent = queue->elems[tmp_ptr];
struct queue_elem *child = queue->elems[switch_index];
queue->elems[tmp_ptr] = child;
queue->elems[switch_index] = parent;
tmp_ptr = switch_index;
switch_index += switch_index + 1;
}
return queue->tmp_msg;
parent = (struct queue_elem*)queue->elems[tmp_ptr];
child = (struct queue_elem*)queue->elems[switch_index];
queue->elems[tmp_ptr] = child;
queue->elems[switch_index] = parent;
tmp_ptr = switch_index;
}
return queue->tmp_msg;
}

View File

@ -2070,10 +2070,10 @@ static bool save_core_config(void)
sizeof(config_dir));
else
{
const char *msg = "Config directory not set. Cannot save new config.";
const char *message = "Config directory not set. Cannot save new config.";
msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
RARCH_ERR("%s\n", msg);
msg_queue_push(g_extern.msg_queue, message, 1, 180);
RARCH_ERR("%s\n", message);
return false;
}

View File

@ -2169,7 +2169,7 @@ static void general_write_handler(void *data)
#define MAX_GAMMA_SETTING 1
#endif
bool setting_data_append_list_main_menu_options(
static bool setting_data_append_list_main_menu_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -2462,7 +2462,7 @@ bool setting_data_append_list_main_menu_options(
return true;
}
bool setting_data_append_list_driver_options(
static bool setting_data_append_list_driver_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -2592,7 +2592,7 @@ bool setting_data_append_list_driver_options(
return true;
}
bool setting_data_append_list_general_options(
static bool setting_data_append_list_general_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -2899,7 +2899,7 @@ bool setting_data_append_list_general_options(
return true;
}
bool setting_data_append_list_video_options(
static bool setting_data_append_list_video_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -3454,7 +3454,7 @@ bool setting_data_append_list_video_options(
return true;
}
bool setting_data_append_list_shader_options(
static bool setting_data_append_list_shader_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -3493,7 +3493,7 @@ bool setting_data_append_list_shader_options(
return true;
}
bool setting_data_append_list_font_options(
static bool setting_data_append_list_font_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -3569,7 +3569,7 @@ bool setting_data_append_list_font_options(
return true;
}
bool setting_data_append_list_audio_options(
static bool setting_data_append_list_audio_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -3742,7 +3742,7 @@ bool setting_data_append_list_audio_options(
return true;
}
bool setting_data_append_list_input_options(
static bool setting_data_append_list_input_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -3950,7 +3950,7 @@ bool setting_data_append_list_input_options(
return true;
}
bool setting_data_append_list_overlay_options(
static bool setting_data_append_list_overlay_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -4010,7 +4010,7 @@ bool setting_data_append_list_overlay_options(
return true;
}
bool setting_data_append_list_menu_options(
static bool setting_data_append_list_menu_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -4054,7 +4054,7 @@ bool setting_data_append_list_menu_options(
return true;
}
bool setting_data_append_list_netplay_options(
static bool setting_data_append_list_netplay_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -4143,7 +4143,7 @@ bool setting_data_append_list_netplay_options(
return true;
}
bool setting_data_append_list_user_options(
static bool setting_data_append_list_user_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -4190,7 +4190,7 @@ bool setting_data_append_list_user_options(
return true;
}
bool setting_data_append_list_path_options(
static bool setting_data_append_list_path_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
@ -4525,7 +4525,7 @@ bool setting_data_append_list_path_options(
return true;
}
bool setting_data_append_list_privacy_options(
static bool setting_data_append_list_privacy_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{