mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
Cleanups - 80-char limit
This commit is contained in:
parent
e84e255013
commit
4a2d3cbd4b
28
cheats.c
28
cheats.c
@ -128,7 +128,8 @@ static bool xml_grab_cheats(cheat_manager_t *handle, xmlNodePtr ptr)
|
|||||||
if (handle->size == handle->buf_size)
|
if (handle->size == handle->buf_size)
|
||||||
{
|
{
|
||||||
handle->buf_size *= 2;
|
handle->buf_size *= 2;
|
||||||
handle->cheats = (struct cheat*)realloc(handle->cheats, handle->buf_size * sizeof(struct cheat));
|
handle->cheats = (struct cheat*)
|
||||||
|
realloc(handle->cheats, handle->buf_size * sizeof(struct cheat));
|
||||||
if (!handle->cheats)
|
if (!handle->cheats)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -153,7 +154,8 @@ static void cheat_manager_apply_cheats(cheat_manager_t *handle)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cheat_manager_load_config(cheat_manager_t *handle, const char *path, const char *sha256)
|
static void cheat_manager_load_config(cheat_manager_t *handle,
|
||||||
|
const char *path, const char *sha256)
|
||||||
{
|
{
|
||||||
const char *num;
|
const char *num;
|
||||||
char *str, *save;
|
char *str, *save;
|
||||||
@ -191,7 +193,8 @@ static void cheat_manager_load_config(cheat_manager_t *handle, const char *path,
|
|||||||
cheat_manager_apply_cheats(handle);
|
cheat_manager_apply_cheats(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cheat_manager_save_config(cheat_manager_t *handle, const char *path, const char *sha256)
|
static void cheat_manager_save_config(cheat_manager_t *handle,
|
||||||
|
const char *path, const char *sha256)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char conf_str[512] = {0};
|
char conf_str[512] = {0};
|
||||||
@ -251,7 +254,8 @@ cheat_manager_t *cheat_manager_new(const char *path)
|
|||||||
cur = NULL;
|
cur = NULL;
|
||||||
|
|
||||||
handle->buf_size = 1;
|
handle->buf_size = 1;
|
||||||
handle->cheats = (struct cheat*)calloc(handle->buf_size, sizeof(struct cheat));
|
handle->cheats = (struct cheat*)
|
||||||
|
calloc(handle->buf_size, sizeof(struct cheat));
|
||||||
if (!handle->cheats)
|
if (!handle->cheats)
|
||||||
{
|
{
|
||||||
handle->buf_size = 0;
|
handle->buf_size = 0;
|
||||||
@ -280,7 +284,8 @@ cheat_manager_t *cheat_manager_new(const char *path)
|
|||||||
head = xmlDocGetRootElement(doc);
|
head = xmlDocGetRootElement(doc);
|
||||||
for (cur = head; cur; cur = cur->next)
|
for (cur = head; cur; cur = cur->next)
|
||||||
{
|
{
|
||||||
if (cur->type == XML_ELEMENT_NODE && strcmp((const char*)cur->name, "database") == 0)
|
if (cur->type == XML_ELEMENT_NODE
|
||||||
|
&& strcmp((const char*)cur->name, "database") == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +303,8 @@ cheat_manager_t *cheat_manager_new(const char *path)
|
|||||||
if (!sha256)
|
if (!sha256)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (*g_extern.sha256 && strcmp((const char*)sha256, g_extern.sha256) == 0)
|
if (*g_extern.sha256 && strcmp((const char*)sha256,
|
||||||
|
g_extern.sha256) == 0)
|
||||||
{
|
{
|
||||||
xmlFree(sha256);
|
xmlFree(sha256);
|
||||||
break;
|
break;
|
||||||
@ -323,7 +329,8 @@ cheat_manager_t *cheat_manager_new(const char *path)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
cheat_manager_load_config(handle, g_settings.cheat_settings_path, g_extern.sha256);
|
cheat_manager_load_config(handle,
|
||||||
|
g_settings.cheat_settings_path, g_extern.sha256);
|
||||||
|
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
xmlFreeParserCtxt(ctx);
|
xmlFreeParserCtxt(ctx);
|
||||||
@ -346,7 +353,8 @@ void cheat_manager_free(cheat_manager_t *handle)
|
|||||||
|
|
||||||
if (handle->cheats)
|
if (handle->cheats)
|
||||||
{
|
{
|
||||||
cheat_manager_save_config(handle, g_settings.cheat_settings_path, g_extern.sha256);
|
cheat_manager_save_config(handle,
|
||||||
|
g_settings.cheat_settings_path, g_extern.sha256);
|
||||||
for (i = 0; i < handle->size; i++)
|
for (i = 0; i < handle->size; i++)
|
||||||
{
|
{
|
||||||
xmlFree(handle->cheats[i].desc);
|
xmlFree(handle->cheats[i].desc);
|
||||||
@ -363,7 +371,9 @@ static void cheat_manager_update(cheat_manager_t *handle)
|
|||||||
{
|
{
|
||||||
msg_queue_clear(g_extern.msg_queue);
|
msg_queue_clear(g_extern.msg_queue);
|
||||||
char msg[256];
|
char msg[256];
|
||||||
snprintf(msg, sizeof(msg), "Cheat: #%u [%s]: %s", handle->ptr, handle->cheats[handle->ptr].state ? "ON" : "OFF", handle->cheats[handle->ptr].desc);
|
snprintf(msg, sizeof(msg), "Cheat: #%u [%s]: %s",
|
||||||
|
handle->ptr, handle->cheats[handle->ptr].state ? "ON" : "OFF",
|
||||||
|
handle->cheats[handle->ptr].desc);
|
||||||
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
|
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
|
||||||
RARCH_LOG("%s\n", msg);
|
RARCH_LOG("%s\n", msg);
|
||||||
}
|
}
|
||||||
|
@ -144,8 +144,7 @@ static int main_entry_iterate_menu_preinit(args_type() args)
|
|||||||
|
|
||||||
/* Override keyboard callback to redirect to menu instead.
|
/* Override keyboard callback to redirect to menu instead.
|
||||||
* We'll use this later for something ...
|
* We'll use this later for something ...
|
||||||
* FIXME: This should probably be moved to menu_common somehow.
|
* FIXME: This should probably be moved to menu_common somehow. */
|
||||||
*/
|
|
||||||
key_event = g_extern.system.key_event;
|
key_event = g_extern.system.key_event;
|
||||||
g_extern.system.key_event = menu_key_event;
|
g_extern.system.key_event = menu_key_event;
|
||||||
|
|
||||||
|
@ -38,9 +38,13 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main_entry_iterate(signature(), args_type() args);
|
int main_entry_iterate(signature(), args_type() args);
|
||||||
|
|
||||||
void main_exit(args_type() args);
|
void main_exit(args_type() args);
|
||||||
|
|
||||||
returntype main_entry(signature());
|
returntype main_entry(signature());
|
||||||
bool main_load_content(int argc, char **argv, args_type() args, environment_get_t environ_get,
|
|
||||||
|
bool main_load_content(int argc, char **argv,
|
||||||
|
args_type() args, environment_get_t environ_get,
|
||||||
process_args_t process_args);
|
process_args_t process_args);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -46,7 +46,6 @@ typedef struct frontend_ctx_driver
|
|||||||
void (*get_name)(char *, size_t);
|
void (*get_name)(char *, size_t);
|
||||||
int (*get_rating)(void);
|
int (*get_rating)(void);
|
||||||
|
|
||||||
// Human readable string.
|
|
||||||
const char *ident;
|
const char *ident;
|
||||||
} frontend_ctx_driver_t;
|
} frontend_ctx_driver_t;
|
||||||
|
|
||||||
|
@ -29,10 +29,12 @@ static void menu_common_shader_manager_init(menu_handle_t *menu)
|
|||||||
// In a multi-config setting, we can't have conflicts on menu.cgp/menu.glslp.
|
// In a multi-config setting, we can't have conflicts on menu.cgp/menu.glslp.
|
||||||
if (config_path)
|
if (config_path)
|
||||||
{
|
{
|
||||||
fill_pathname_base(menu->default_glslp, config_path, sizeof(menu->default_glslp));
|
fill_pathname_base(menu->default_glslp, config_path,
|
||||||
|
sizeof(menu->default_glslp));
|
||||||
path_remove_extension(menu->default_glslp);
|
path_remove_extension(menu->default_glslp);
|
||||||
strlcat(menu->default_glslp, ".glslp", sizeof(menu->default_glslp));
|
strlcat(menu->default_glslp, ".glslp", sizeof(menu->default_glslp));
|
||||||
fill_pathname_base(menu->default_cgp, config_path, sizeof(menu->default_cgp));
|
fill_pathname_base(menu->default_cgp, config_path,
|
||||||
|
sizeof(menu->default_cgp));
|
||||||
path_remove_extension(menu->default_cgp);
|
path_remove_extension(menu->default_cgp);
|
||||||
strlcat(menu->default_cgp, ".cgp", sizeof(menu->default_cgp));
|
strlcat(menu->default_cgp, ".cgp", sizeof(menu->default_cgp));
|
||||||
}
|
}
|
||||||
@ -89,23 +91,26 @@ static void menu_common_shader_manager_init(menu_handle_t *menu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_common_shader_manager_set_preset(struct gfx_shader *shader, unsigned type, const char *cgp_path)
|
static void menu_common_shader_manager_set_preset(struct gfx_shader *shader,
|
||||||
|
unsigned type, const char *cgp_path)
|
||||||
{
|
{
|
||||||
RARCH_LOG("Setting Menu shader: %s.\n", cgp_path ? cgp_path : "N/A (stock)");
|
RARCH_LOG("Setting Menu shader: %s.\n", cgp_path ? cgp_path : "N/A (stock)");
|
||||||
|
|
||||||
if (driver.video->set_shader && driver.video->set_shader(driver.video_data, (enum rarch_shader_type)type, cgp_path))
|
if (driver.video->set_shader && driver.video->set_shader(driver.video_data,
|
||||||
|
(enum rarch_shader_type)type, cgp_path))
|
||||||
{
|
{
|
||||||
// Makes sure that we use Menu CGP shader on driver reinit.
|
/* Makes sure that we use Menu CGP shader on driver reinit.
|
||||||
// Only do this when the cgp actually works to avoid potential errors.
|
* Only do this when the cgp actually works to avoid potential errors. */
|
||||||
strlcpy(g_settings.video.shader_path, cgp_path ? cgp_path : "",
|
strlcpy(g_settings.video.shader_path, cgp_path ? cgp_path : "",
|
||||||
sizeof(g_settings.video.shader_path));
|
sizeof(g_settings.video.shader_path));
|
||||||
g_settings.video.shader_enable = true;
|
g_settings.video.shader_enable = true;
|
||||||
|
|
||||||
if (cgp_path && shader)
|
if (cgp_path && shader)
|
||||||
{
|
{
|
||||||
// Load stored CGP into menu on success.
|
/* Load stored CGP into menu on success.
|
||||||
// Used when a preset is directly loaded.
|
* Used when a preset is directly loaded.
|
||||||
// No point in updating when the CGP was created from the menu itself.
|
* No point in updating when the CGP was
|
||||||
|
* created from the menu itself. */
|
||||||
config_file_t *conf = config_file_new(cgp_path);
|
config_file_t *conf = config_file_new(cgp_path);
|
||||||
|
|
||||||
if (conf)
|
if (conf)
|
||||||
@ -128,17 +133,22 @@ static void menu_common_shader_manager_set_preset(struct gfx_shader *shader, uns
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_common_shader_manager_get_str(struct gfx_shader *shader, char *type_str, size_t type_str_size, unsigned type)
|
static void menu_common_shader_manager_get_str(struct gfx_shader *shader,
|
||||||
|
char *type_str, size_t type_str_size, unsigned type)
|
||||||
{
|
{
|
||||||
*type_str = '\0';
|
*type_str = '\0';
|
||||||
|
|
||||||
if (type >= MENU_SETTINGS_SHADER_PARAMETER_0 && type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
|
if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
|
||||||
|
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
|
||||||
{
|
{
|
||||||
// menu->parameter_shader here.
|
/* menu->parameter_shader here. */
|
||||||
if (shader)
|
if (shader)
|
||||||
{
|
{
|
||||||
const struct gfx_shader_parameter *param = (const struct gfx_shader_parameter*)&shader->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0];
|
const struct gfx_shader_parameter *param =
|
||||||
snprintf(type_str, type_str_size, "%.2f [%.2f %.2f]", param->current, param->minimum, param->maximum);
|
(const struct gfx_shader_parameter*)&shader->parameters
|
||||||
|
[type - MENU_SETTINGS_SHADER_PARAMETER_0];
|
||||||
|
snprintf(type_str, type_str_size, "%.2f [%.2f %.2f]",
|
||||||
|
param->current, param->minimum, param->maximum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == MENU_SETTINGS_SHADER_PASSES)
|
else if (type == MENU_SETTINGS_SHADER_PASSES)
|
||||||
@ -164,7 +174,8 @@ static void menu_common_shader_manager_get_str(struct gfx_shader *shader, char *
|
|||||||
"Nearest"
|
"Nearest"
|
||||||
};
|
};
|
||||||
|
|
||||||
strlcpy(type_str, modes[shader->pass[pass].filter], type_str_size);
|
strlcpy(type_str, modes[shader->pass[pass].filter],
|
||||||
|
type_str_size);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -181,7 +192,8 @@ static void menu_common_shader_manager_get_str(struct gfx_shader *shader, char *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_common_shader_manager_save_preset(const char *basename, bool apply)
|
static void menu_common_shader_manager_save_preset(
|
||||||
|
const char *basename, bool apply)
|
||||||
{
|
{
|
||||||
char buffer[PATH_MAX], config_directory[PATH_MAX], cgp_path[PATH_MAX];
|
char buffer[PATH_MAX], config_directory[PATH_MAX], cgp_path[PATH_MAX];
|
||||||
unsigned d, type = RARCH_SHADER_NONE;
|
unsigned d, type = RARCH_SHADER_NONE;
|
||||||
@ -195,19 +207,23 @@ static void menu_common_shader_manager_save_preset(const char *basename, bool ap
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_type)
|
if (driver.menu_ctx && driver.menu_ctx->backend
|
||||||
type = driver.menu_ctx->backend->shader_manager_get_type(driver.menu->shader);
|
&& driver.menu_ctx->backend->shader_manager_get_type)
|
||||||
|
type = driver.menu_ctx->backend->shader_manager_get_type
|
||||||
|
(driver.menu->shader);
|
||||||
|
|
||||||
if (type == RARCH_SHADER_NONE)
|
if (type == RARCH_SHADER_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
conf_path = (type == RARCH_SHADER_GLSL) ? driver.menu->default_glslp : driver.menu->default_cgp;
|
conf_path = (type == RARCH_SHADER_GLSL) ?
|
||||||
|
driver.menu->default_glslp : driver.menu->default_cgp;
|
||||||
*config_directory = '\0';
|
*config_directory = '\0';
|
||||||
|
|
||||||
if (basename)
|
if (basename)
|
||||||
{
|
{
|
||||||
strlcpy(buffer, basename, sizeof(buffer));
|
strlcpy(buffer, basename, sizeof(buffer));
|
||||||
// Append extension automatically as appropriate.
|
|
||||||
|
/* Append extension automatically as appropriate. */
|
||||||
if (!strstr(basename, ".cgp") && !strstr(basename, ".glslp"))
|
if (!strstr(basename, ".cgp") && !strstr(basename, ".glslp"))
|
||||||
{
|
{
|
||||||
if (type == RARCH_SHADER_GLSL)
|
if (type == RARCH_SHADER_GLSL)
|
||||||
@ -218,7 +234,8 @@ static void menu_common_shader_manager_save_preset(const char *basename, bool ap
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*g_extern.config_path)
|
if (*g_extern.config_path)
|
||||||
fill_pathname_basedir(config_directory, g_extern.config_path, sizeof(config_directory));
|
fill_pathname_basedir(config_directory,
|
||||||
|
g_extern.config_path, sizeof(config_directory));
|
||||||
|
|
||||||
const char *dirs[] = {
|
const char *dirs[] = {
|
||||||
g_settings.video.shader_dir,
|
g_settings.video.shader_dir,
|
||||||
@ -241,8 +258,10 @@ static void menu_common_shader_manager_save_preset(const char *basename, bool ap
|
|||||||
RARCH_LOG("Saved shader preset to %s.\n", cgp_path);
|
RARCH_LOG("Saved shader preset to %s.\n", cgp_path);
|
||||||
if (apply)
|
if (apply)
|
||||||
{
|
{
|
||||||
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_set_preset)
|
if (driver.menu_ctx && driver.menu_ctx->backend
|
||||||
driver.menu_ctx->backend->shader_manager_set_preset(NULL, type, cgp_path);
|
&& driver.menu_ctx->backend->shader_manager_set_preset)
|
||||||
|
driver.menu_ctx->backend->shader_manager_set_preset(
|
||||||
|
NULL, type, cgp_path);
|
||||||
}
|
}
|
||||||
ret = true;
|
ret = true;
|
||||||
break;
|
break;
|
||||||
@ -256,9 +275,10 @@ static void menu_common_shader_manager_save_preset(const char *basename, bool ap
|
|||||||
RARCH_ERR("Failed to save shader preset. Make sure config directory and/or shader dir are writable.\n");
|
RARCH_ERR("Failed to save shader preset. Make sure config directory and/or shader dir are writable.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned menu_common_shader_manager_get_type(const struct gfx_shader *shader)
|
static unsigned menu_common_shader_manager_get_type(
|
||||||
|
const struct gfx_shader *shader)
|
||||||
{
|
{
|
||||||
// All shader types must be the same, or we cannot use it.
|
/* All shader types must be the same, or we cannot use it. */
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned type = RARCH_SHADER_NONE;
|
unsigned type = RARCH_SHADER_NONE;
|
||||||
|
|
||||||
@ -290,7 +310,8 @@ static unsigned menu_common_shader_manager_get_type(const struct gfx_shader *sha
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int menu_common_shader_manager_setting_toggle(unsigned id, unsigned action)
|
static int menu_common_shader_manager_setting_toggle(
|
||||||
|
unsigned id, unsigned action)
|
||||||
{
|
{
|
||||||
if (!driver.menu)
|
if (!driver.menu)
|
||||||
{
|
{
|
||||||
@ -307,14 +328,17 @@ static int menu_common_shader_manager_setting_toggle(unsigned id, unsigned actio
|
|||||||
|
|
||||||
if (id == MENU_SETTINGS_SHADER_FILTER)
|
if (id == MENU_SETTINGS_SHADER_FILTER)
|
||||||
{
|
{
|
||||||
if ((current_setting = setting_data_find_setting(setting_data, "video_smooth")))
|
if ((current_setting = setting_data_find_setting(
|
||||||
|
setting_data, "video_smooth")))
|
||||||
menu_common_setting_set_current_boolean(current_setting, action);
|
menu_common_setting_set_current_boolean(current_setting, action);
|
||||||
}
|
}
|
||||||
else if ((id == MENU_SETTINGS_SHADER_PARAMETERS
|
else if ((id == MENU_SETTINGS_SHADER_PARAMETERS
|
||||||
|| id == MENU_SETTINGS_SHADER_PRESET_PARAMETERS) && action == MENU_ACTION_OK)
|
|| id == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
|
||||||
|
&& action == MENU_ACTION_OK)
|
||||||
menu_entries_push(driver.menu->menu_stack, "",
|
menu_entries_push(driver.menu->menu_stack, "",
|
||||||
"shader_parameters", id, driver.menu->selection_ptr);
|
"shader_parameters", id, driver.menu->selection_ptr);
|
||||||
else if (id >= MENU_SETTINGS_SHADER_PARAMETER_0 && id <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
|
else if (id >= MENU_SETTINGS_SHADER_PARAMETER_0
|
||||||
|
&& id <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
|
||||||
{
|
{
|
||||||
struct gfx_shader *shader = NULL;
|
struct gfx_shader *shader = NULL;
|
||||||
struct gfx_shader_parameter *param = NULL;
|
struct gfx_shader_parameter *param = NULL;
|
||||||
@ -345,7 +369,8 @@ static int menu_common_shader_manager_setting_toggle(unsigned id, unsigned actio
|
|||||||
|
|
||||||
param->current = min(max(param->minimum, param->current), param->maximum);
|
param->current = min(max(param->minimum, param->current), param->maximum);
|
||||||
}
|
}
|
||||||
else if ((id == MENU_SETTINGS_SHADER_APPLY || id == MENU_SETTINGS_SHADER_PASSES))
|
else if ((id == MENU_SETTINGS_SHADER_APPLY ||
|
||||||
|
id == MENU_SETTINGS_SHADER_PASSES))
|
||||||
menu_setting_set(id, action);
|
menu_setting_set(id, action);
|
||||||
else if (((dist_shader % 3) == 0 || id == MENU_SETTINGS_SHADER_PRESET))
|
else if (((dist_shader % 3) == 0 || id == MENU_SETTINGS_SHADER_PRESET))
|
||||||
{
|
{
|
||||||
@ -377,7 +402,8 @@ static int menu_common_shader_manager_setting_toggle(unsigned id, unsigned actio
|
|||||||
{
|
{
|
||||||
dist_filter /= 3;
|
dist_filter /= 3;
|
||||||
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
||||||
struct gfx_shader_pass *pass = (struct gfx_shader_pass*)&shader->pass[dist_filter];
|
struct gfx_shader_pass *pass = (struct gfx_shader_pass*)
|
||||||
|
&shader->pass[dist_filter];
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
@ -404,7 +430,8 @@ static int menu_common_shader_manager_setting_toggle(unsigned id, unsigned actio
|
|||||||
{
|
{
|
||||||
dist_scale /= 3;
|
dist_scale /= 3;
|
||||||
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
||||||
struct gfx_shader_pass *pass = (struct gfx_shader_pass*)&shader->pass[dist_scale];
|
struct gfx_shader_pass *pass = (struct gfx_shader_pass*)
|
||||||
|
&shader->pass[dist_scale];
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
|
@ -168,24 +168,33 @@ typedef enum
|
|||||||
} menu_settings_t;
|
} menu_settings_t;
|
||||||
|
|
||||||
void *menu_init(const void *data);
|
void *menu_init(const void *data);
|
||||||
|
|
||||||
bool menu_iterate(void);
|
bool menu_iterate(void);
|
||||||
|
|
||||||
void menu_free(void *data);
|
void menu_free(void *data);
|
||||||
|
|
||||||
void menu_ticker_line(char *buf, size_t len, unsigned tick, const char *str, bool selected);
|
void menu_ticker_line(char *buf, size_t len, unsigned tick,
|
||||||
|
const char *str, bool selected);
|
||||||
|
|
||||||
bool load_menu_content(void);
|
bool load_menu_content(void);
|
||||||
|
|
||||||
void load_menu_content_history(unsigned game_index);
|
void load_menu_content_history(unsigned game_index);
|
||||||
|
|
||||||
void menu_content_history_push_current(void);
|
void menu_content_history_push_current(void);
|
||||||
|
|
||||||
bool menu_replace_config(const char *path);
|
bool menu_replace_config(const char *path);
|
||||||
|
|
||||||
bool menu_save_new_config(void);
|
bool menu_save_new_config(void);
|
||||||
|
|
||||||
int menu_defer_core(core_info_list_t *data, const char *dir, const char *path, char *deferred_path, size_t sizeof_deferred_path);
|
int menu_defer_core(core_info_list_t *data, const char *dir,
|
||||||
|
const char *path, char *deferred_path, size_t sizeof_deferred_path);
|
||||||
|
|
||||||
void menu_flush_stack_type(unsigned final_type);
|
void menu_flush_stack_type(unsigned final_type);
|
||||||
|
|
||||||
void menu_update_system_info(menu_handle_t *menu, bool *load_no_content);
|
void menu_update_system_info(menu_handle_t *menu, bool *load_no_content);
|
||||||
|
|
||||||
void menu_build_scroll_indices(file_list_t *buf);
|
void menu_build_scroll_indices(file_list_t *buf);
|
||||||
|
|
||||||
unsigned menu_common_type_is(unsigned type);
|
unsigned menu_common_type_is(unsigned type);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -24,6 +24,7 @@ static void entries_refresh(void)
|
|||||||
/* Before a refresh, we could have deleted a file on disk, causing
|
/* Before a refresh, we could have deleted a file on disk, causing
|
||||||
* selection_ptr to suddendly be out of range.
|
* selection_ptr to suddendly be out of range.
|
||||||
* Ensure it doesn't overflow. */
|
* Ensure it doesn't overflow. */
|
||||||
|
|
||||||
if (driver.menu->selection_ptr >= file_list_get_size(
|
if (driver.menu->selection_ptr >= file_list_get_size(
|
||||||
driver.menu->selection_buf) &&
|
driver.menu->selection_buf) &&
|
||||||
file_list_get_size(driver.menu->selection_buf))
|
file_list_get_size(driver.menu->selection_buf))
|
||||||
@ -588,7 +589,7 @@ int menu_parse_and_resolve(void)
|
|||||||
|
|
||||||
const char *dir = NULL;
|
const char *dir = NULL;
|
||||||
const char *label = NULL;
|
const char *label = NULL;
|
||||||
/* Directory parse */
|
|
||||||
file_list_get_last(driver.menu->menu_stack, &dir, &label, &menu_type);
|
file_list_get_last(driver.menu->menu_stack, &dir, &label, &menu_type);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -712,7 +713,7 @@ int menu_parse_and_resolve(void)
|
|||||||
else if (menu_type == MENU_CONTENT_HISTORY_PATH)
|
else if (menu_type == MENU_CONTENT_HISTORY_PATH)
|
||||||
exts = "cfg";
|
exts = "cfg";
|
||||||
else if (menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY)
|
else if (menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY)
|
||||||
exts = ""; // we ignore files anyway
|
exts = ""; /* we ignore files anyway */
|
||||||
else if (driver.menu->defer_core)
|
else if (driver.menu->defer_core)
|
||||||
exts = driver.menu->core_info ? core_info_list_get_all_extensions(
|
exts = driver.menu->core_info ? core_info_list_get_all_extensions(
|
||||||
driver.menu->core_info) : "";
|
driver.menu->core_info) : "";
|
||||||
@ -746,7 +747,7 @@ int menu_parse_and_resolve(void)
|
|||||||
if ((menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY) && !is_dir)
|
if ((menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY) && !is_dir)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Need to preserve slash first time.
|
/* Need to preserve slash first time. */
|
||||||
const char *path = str_list->elems[i].data;
|
const char *path = str_list->elems[i].data;
|
||||||
if (*dir)
|
if (*dir)
|
||||||
path = path_basename(path);
|
path = path_basename(path);
|
||||||
@ -757,8 +758,8 @@ int menu_parse_and_resolve(void)
|
|||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Push menu_type further down in the chain.
|
/* Push menu_type further down in the chain.
|
||||||
// Needed for shader manager currently.
|
* Needed for shader manager currently. */
|
||||||
file_list_push(driver.menu->selection_buf, path, "",
|
file_list_push(driver.menu->selection_buf, path, "",
|
||||||
is_dir ? menu_type : MENU_FILE_PLAIN, 0);
|
is_dir ? menu_type : MENU_FILE_PLAIN, 0);
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,16 @@
|
|||||||
void menu_entries_push(file_list_t *list,
|
void menu_entries_push(file_list_t *list,
|
||||||
const char *path, const char *label, unsigned type,
|
const char *path, const char *label, unsigned type,
|
||||||
size_t directory_ptr);
|
size_t directory_ptr);
|
||||||
|
|
||||||
int menu_entries_push_list(menu_handle_t *menu, const char *path,
|
int menu_entries_push_list(menu_handle_t *menu, const char *path,
|
||||||
const char *label, unsigned menu_type);
|
const char *label, unsigned menu_type);
|
||||||
|
|
||||||
int menu_parse_check(const char *label, unsigned menu_type);
|
int menu_parse_check(const char *label, unsigned menu_type);
|
||||||
|
|
||||||
int menu_parse_and_resolve(void);
|
int menu_parse_and_resolve(void);
|
||||||
|
|
||||||
void menu_entries_pop(void);
|
void menu_entries_pop(void);
|
||||||
|
|
||||||
void menu_flush_stack_type(unsigned final_type);
|
void menu_flush_stack_type(unsigned final_type);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,18 +22,24 @@
|
|||||||
|
|
||||||
void menu_key_event(bool down, unsigned keycode, uint32_t character,
|
void menu_key_event(bool down, unsigned keycode, uint32_t character,
|
||||||
uint16_t key_modifiers);
|
uint16_t key_modifiers);
|
||||||
|
|
||||||
void menu_key_start_line(void *data, const char *label,
|
void menu_key_start_line(void *data, const char *label,
|
||||||
const char *label_setting, input_keyboard_line_complete_t cb);
|
const char *label_setting, input_keyboard_line_complete_t cb);
|
||||||
|
|
||||||
void st_uint_callback(void *userdata, const char *str);
|
void st_uint_callback(void *userdata, const char *str);
|
||||||
|
|
||||||
void st_string_callback(void *userdata, const char *str);
|
void st_string_callback(void *userdata, const char *str);
|
||||||
|
|
||||||
void preset_filename_callback(void *userdata, const char *str);
|
void preset_filename_callback(void *userdata, const char *str);
|
||||||
|
|
||||||
void menu_poll_bind_get_rested_axes(struct menu_bind_state *state);
|
void menu_poll_bind_get_rested_axes(struct menu_bind_state *state);
|
||||||
|
|
||||||
void menu_poll_bind_state(struct menu_bind_state *state);
|
void menu_poll_bind_state(struct menu_bind_state *state);
|
||||||
|
|
||||||
bool menu_poll_find_trigger(struct menu_bind_state *state, struct menu_bind_state *new_state);
|
bool menu_poll_find_trigger(struct menu_bind_state *state, struct menu_bind_state *new_state);
|
||||||
|
|
||||||
bool menu_custom_bind_keyboard_cb(void *data, unsigned code);
|
bool menu_custom_bind_keyboard_cb(void *data, unsigned code);
|
||||||
|
|
||||||
uint64_t menu_input(void);
|
uint64_t menu_input(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,11 +20,17 @@
|
|||||||
#include "menu_common.h"
|
#include "menu_common.h"
|
||||||
|
|
||||||
void menu_clear_navigation(menu_handle_t *menu);
|
void menu_clear_navigation(menu_handle_t *menu);
|
||||||
|
|
||||||
void menu_decrement_navigation(menu_handle_t *menu);
|
void menu_decrement_navigation(menu_handle_t *menu);
|
||||||
|
|
||||||
void menu_increment_navigation(menu_handle_t *menu);
|
void menu_increment_navigation(menu_handle_t *menu);
|
||||||
|
|
||||||
void menu_set_navigation(menu_handle_t *menu, size_t i);
|
void menu_set_navigation(menu_handle_t *menu, size_t i);
|
||||||
|
|
||||||
void menu_set_navigation_last(menu_handle_t *menu);
|
void menu_set_navigation_last(menu_handle_t *menu);
|
||||||
|
|
||||||
void menu_descend_alphabet(menu_handle_t *menu, size_t *ptr_out);
|
void menu_descend_alphabet(menu_handle_t *menu, size_t *ptr_out);
|
||||||
|
|
||||||
void menu_ascend_alphabet(menu_handle_t *menu, size_t *ptr_out);
|
void menu_ascend_alphabet(menu_handle_t *menu, size_t *ptr_out);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,7 +42,8 @@ msg_queue_t *msg_queue_new(size_t size)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
queue->size = size + 1;
|
queue->size = size + 1;
|
||||||
queue->elems = (struct queue_elem**)calloc(queue->size, sizeof(struct queue_elem*));
|
queue->elems = (struct queue_elem**)
|
||||||
|
calloc(queue->size,sizeof(struct queue_elem*));
|
||||||
|
|
||||||
if (!queue->elems)
|
if (!queue->elems)
|
||||||
{
|
{
|
||||||
@ -63,12 +64,15 @@ void msg_queue_free(msg_queue_t *queue)
|
|||||||
free(queue);
|
free(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void msg_queue_push(msg_queue_t *queue, const char *msg, unsigned prio, unsigned duration)
|
void msg_queue_push(msg_queue_t *queue, const char *msg,
|
||||||
|
unsigned prio, unsigned duration)
|
||||||
{
|
{
|
||||||
if (!queue || queue->ptr >= queue->size)
|
if (!queue || queue->ptr >= queue->size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
struct queue_elem *new_elem = (struct queue_elem*)calloc(1, sizeof(struct queue_elem));
|
struct queue_elem *new_elem = (struct queue_elem*)
|
||||||
|
calloc(1, sizeof(struct queue_elem));
|
||||||
|
|
||||||
new_elem->prio = prio;
|
new_elem->prio = prio;
|
||||||
new_elem->duration = duration;
|
new_elem->duration = duration;
|
||||||
new_elem->msg = msg ? strdup(msg) : NULL;
|
new_elem->msg = msg ? strdup(msg) : NULL;
|
||||||
@ -114,7 +118,8 @@ void msg_queue_clear(msg_queue_t *queue)
|
|||||||
|
|
||||||
const char *msg_queue_pull(msg_queue_t *queue)
|
const char *msg_queue_pull(msg_queue_t *queue)
|
||||||
{
|
{
|
||||||
if (!queue || queue->ptr == 1) // Nothing in queue.
|
/* Nothing in queue. */
|
||||||
|
if (!queue || queue->ptr == 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
struct queue_elem *front = queue->elems[1];
|
struct queue_elem *front = queue->elems[1];
|
||||||
@ -135,8 +140,10 @@ const char *msg_queue_pull(msg_queue_t *queue)
|
|||||||
size_t tmp_ptr = 1;
|
size_t tmp_ptr = 1;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
bool left = (tmp_ptr * 2 <= queue->ptr) && (queue->elems[tmp_ptr] < queue->elems[tmp_ptr * 2]);
|
bool left = (tmp_ptr * 2 <= queue->ptr)
|
||||||
bool right = (tmp_ptr * 2 + 1 <= queue->ptr) && (queue->elems[tmp_ptr] < queue->elems[tmp_ptr * 2 + 1]);
|
&& (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)
|
if (!left && !right)
|
||||||
break;
|
break;
|
||||||
@ -148,7 +155,8 @@ const char *msg_queue_pull(msg_queue_t *queue)
|
|||||||
switch_index += switch_index + 1;
|
switch_index += switch_index + 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (queue->elems[tmp_ptr * 2] >= queue->elems[tmp_ptr * 2 + 1])
|
if (queue->elems[tmp_ptr * 2]
|
||||||
|
>= queue->elems[tmp_ptr * 2 + 1])
|
||||||
switch_index <<= 1;
|
switch_index <<= 1;
|
||||||
else
|
else
|
||||||
switch_index += switch_index + 1;
|
switch_index += switch_index + 1;
|
||||||
|
@ -23,16 +23,21 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct msg_queue msg_queue_t;
|
typedef struct msg_queue msg_queue_t;
|
||||||
|
|
||||||
// Creates a message queue with maximum size different messages. Returns NULL if allocation error.
|
/* Creates a message queue with maximum size different messages.
|
||||||
|
* Returns NULL if allocation error. */
|
||||||
msg_queue_t *msg_queue_new(size_t size);
|
msg_queue_t *msg_queue_new(size_t size);
|
||||||
|
|
||||||
// Higher prio is... higher prio :) Duration is how many times a message can be pulled from queue before it vanishes. (E.g. show a message for 3 seconds @ 60fps = 180 duration).
|
/* Duration is how many times a message can be pulled from queue
|
||||||
void msg_queue_push(msg_queue_t *queue, const char *msg, unsigned prio, unsigned duration);
|
* before it vanishes. (E.g. show a message for
|
||||||
|
* 3 seconds @ 60fps = 180 duration). */
|
||||||
|
void msg_queue_push(msg_queue_t *queue, const char *msg,
|
||||||
|
unsigned prio, unsigned duration);
|
||||||
|
|
||||||
// Pulls highest prio message in queue. Returns NULL if no message in queue.
|
/* Pulls highest priority message in queue. Returns NULL if
|
||||||
|
* no message in queue. */
|
||||||
const char *msg_queue_pull(msg_queue_t *queue);
|
const char *msg_queue_pull(msg_queue_t *queue);
|
||||||
|
|
||||||
// Clear out everything in queue.
|
/* Clear out everything in queue. */
|
||||||
void msg_queue_clear(msg_queue_t *queue);
|
void msg_queue_clear(msg_queue_t *queue);
|
||||||
|
|
||||||
void msg_queue_free(msg_queue_t *queue);
|
void msg_queue_free(msg_queue_t *queue);
|
||||||
|
@ -25,6 +25,7 @@ extern "C" {
|
|||||||
typedef struct content_playlist content_playlist_t;
|
typedef struct content_playlist content_playlist_t;
|
||||||
|
|
||||||
content_playlist_t *content_playlist_init(const char *path, size_t size);
|
content_playlist_t *content_playlist_init(const char *path, size_t size);
|
||||||
|
|
||||||
void content_playlist_free(content_playlist_t *playlist);
|
void content_playlist_free(content_playlist_t *playlist);
|
||||||
|
|
||||||
void content_playlist_clear(content_playlist_t *playlist);
|
void content_playlist_clear(content_playlist_t *playlist);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user