This commit is contained in:
Jean-André Santoni 2014-09-15 11:59:35 +02:00
commit c8266fab3a
43 changed files with 618 additions and 444 deletions

View File

@ -155,6 +155,11 @@ $(OBJDIR)/%.o: %.S config.h config.mk $(HEADERS)
@$(if $(Q), $(shell echo echo AS $<),)
$(Q)$(CC) $(CFLAGS) $(ASFLAGS) $(DEFINES) -c -o $@ $<
$(OBJDIR)/%.o: %.rc $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo WINDRES $<),)
$(Q)$(WINDRES) -o $@ $<
install: $(TARGET)
rm -f $(OBJDIR)/git_version.o
mkdir -p $(DESTDIR)$(PREFIX)/bin 2>/dev/null || /bin/true

View File

@ -584,8 +584,8 @@ ifeq ($(HAVE_NETPLAY), 1)
endif
ifneq ($(findstring Win32,$(OS)),)
OBJ += media/rarch.o \
gfx/context/win32_common.o
OBJ += media/rarch.o \
gfx/context/win32_common.o
endif
# Record

View File

@ -351,6 +351,7 @@
"-DHAVE_CG",
"-DHAVE_7ZIP",
"-DHAVE_LAKKA",
"-DHAVE_GLUI",
);
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@ -419,6 +420,7 @@
"-DHAVE_CG",
"-DHAVE_7ZIP",
"-DHAVE_LAKKA",
"-DHAVE_GLUI",
);
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;

View File

@ -304,10 +304,8 @@ NSWindowDelegate>
if ([item isKindOfClass:[NSNumber class]])
{
const rarch_setting_t *setting_data, *setting;
setting_data = (const rarch_setting_t*)setting_data_get_list();
setting = (const rarch_setting_t*)&setting_data[[item intValue]];
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list();
rarch_setting_t *setting = (rarch_setting_t*)&setting_data[[item intValue]];
switch (setting->type)
{
@ -336,12 +334,9 @@ NSWindowDelegate>
if ([item isKindOfClass:[NSNumber class]])
{
NSString *editor_string;
const rarch_setting_t *setting_data, *setting;
setting_data = (const rarch_setting_t *)setting_data_get_list();
setting = (const rarch_setting_t*)&setting_data[[item intValue]];
editor_string = (NSString*)editor.string;
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list();
rarch_setting_t *setting = (rarch_setting_t*)&setting_data[[item intValue]];
NSString *editor_string = (NSString*)editor.string;
setting_data_set_with_string_representation(setting, editor_string.UTF8String);
}

View File

@ -63,22 +63,36 @@ struct config_file
struct include_list *includes;
};
static config_file_t *config_file_new_internal(const char *path,
unsigned depth);
static config_file_t *config_file_new_internal(const char *path, unsigned depth);
void config_file_free(config_file_t *conf);
static char *getaline(FILE *file)
{
char *newline = (char*)malloc(9);
char* newline = (char*)malloc(9);
char* newline_tmp = NULL;
size_t cur_size = 8;
size_t index = 0;
int in = getc(file);
if (!newline)
return NULL;
while (in != EOF && in != '\n')
{
if (index == cur_size)
{
cur_size *= 2;
newline = (char*)realloc(newline, cur_size + 1);
newline_tmp = (char*)realloc(newline, cur_size + 1);
if (newline_tmp)
{
newline = newline_tmp;
}
else
{
free(newline);
return NULL;
}
}
newline[index++] = in;
@ -173,6 +187,10 @@ static void add_include_list(config_file_t *conf, const char *path)
{
struct include_list *head = conf->includes;
struct include_list *node = (struct include_list*)calloc(1, sizeof(*node));
if (!node)
return;
node->path = strdup(path);
if (head)
@ -267,10 +285,19 @@ static char *strip_comment(char *str)
static bool parse_line(config_file_t *conf,
struct config_entry_list *list, char *line)
{
if (!*line)
char* comment = NULL;
char* key = (char*)malloc(9);
char* key_tmp = NULL;
size_t cur_size = 8;
size_t index = 0;
if (!line || !*line)
return false;
char *comment = strip_comment(line);
if (!key)
return false;
comment = strip_comment(line);
/* Starting line with # and include includes config files. */
if ((comment == line) && (conf->include_depth < MAX_INCLUDE_DEPTH))
@ -283,22 +310,30 @@ static bool parse_line(config_file_t *conf,
}
}
else if (conf->include_depth >= MAX_INCLUDE_DEPTH)
{
fprintf(stderr, "!!! #include depth exceeded for config. Might be a cycle.\n");
}
/* Skips to first character. */
while (isspace(*line))
line++;
char *key = (char*)malloc(9);
size_t cur_size = 8;
size_t index = 0;
while (isgraph(*line))
{
if (index == cur_size)
{
cur_size *= 2;
key = (char*)realloc(key, cur_size + 1);
key_tmp = (char*)realloc(key, cur_size + 1);
if (key_tmp)
{
key = key_tmp;
}
else
{
free(key);
return false;
}
}
key[index++] = *line++;
@ -365,7 +400,16 @@ static config_file_t *config_file_new_internal(
{
struct config_entry_list *list = (struct config_entry_list*)
calloc(1, sizeof(*list));
char *line = getaline(file);
char *line = NULL;
if (!list)
{
config_file_free(conf);
fclose(file);
return NULL;
}
line = getaline(file);
if (line)
{
@ -375,6 +419,7 @@ static config_file_t *config_file_new_internal(
conf->tail->next = list;
else
conf->entries = list;
conf->tail = list;
}
@ -410,9 +455,15 @@ config_file_t *config_file_new_from_string(const char *from_string)
{
struct config_entry_list *list = (struct config_entry_list*)
calloc(1, sizeof(*list));
char* line = lines->elems[i].data;
if (!list)
{
string_list_free(lines);
config_file_free(conf);
return NULL;
}
if (line)
{
if (parse_line(conf, list, line))
@ -421,6 +472,7 @@ config_file_t *config_file_new_from_string(const char *from_string)
conf->tail->next = list;
else
conf->entries = list;
conf->tail = list;
}
}
@ -428,7 +480,7 @@ config_file_t *config_file_new_from_string(const char *from_string)
if (list != conf->tail)
free(list);
}
string_list_free(lines);
return conf;
@ -703,6 +755,10 @@ void config_set_string(config_file_t *conf, const char *key, const char *val)
struct config_entry_list *elem = (struct config_entry_list*)
calloc(1, sizeof(*elem));
if (!elem)
return;
elem->key = strdup(key);
elem->value = strdup(val);

View File

@ -80,6 +80,17 @@ bool write_file(const char *path, const void *data, size_t size)
return ret;
}
bool write_empty_file(const char *path)
{
FILE *file = fopen(path, "w");
if (!file)
return false;
fclose(file);
return true;
}
/* Generic compressed file loader. */
#ifdef HAVE_COMPRESSION
long read_compressed_file(const char * path, void **buf)

View File

@ -46,6 +46,7 @@ long read_compressed_file(const char * path, void **buf);
long read_file(const char *path, void **buf);
bool read_file_string(const char *path, char **buf);
bool write_file(const char *path, const void *buf, size_t size);
bool write_empty_file(const char *path);
union string_list_elem_attr
{

View File

@ -274,6 +274,8 @@ static void check_defaults_dirs(void)
path_mkdir(g_defaults.audio_filter_dir);
if (*g_defaults.assets_dir)
path_mkdir(g_defaults.assets_dir);
if (*g_defaults.playlist_dir)
path_mkdir(g_defaults.playlist_dir);
if (*g_defaults.core_dir)
path_mkdir(g_defaults.core_dir);
if (*g_defaults.core_info_dir)

View File

@ -215,7 +215,7 @@ static int menu_common_setting_set_perf(unsigned setting, unsigned action,
}
static void menu_common_setting_set_current_path_selection(
static int menu_common_setting_set_current_path_selection(
rarch_setting_t *setting, const char *start_path,
const char *label, unsigned type,
unsigned action)
@ -226,70 +226,42 @@ static void menu_common_setting_set_current_path_selection(
menu_entries_push(driver.menu->menu_stack,
start_path, label, type,
driver.menu->selection_ptr);
if (setting->cmd_trigger.idx != RARCH_CMD_NONE)
setting->cmd_trigger.triggered = true;
break;
case MENU_ACTION_START:
*setting->value.string = '\0';
break;
}
if (setting->change_handler)
setting->change_handler(setting);
return menu_action_setting_apply(setting);
}
static void menu_common_setting_set_current_string_path(
rarch_setting_t *setting, const char *dir, const char *path)
{
fill_pathname_join(setting->value.string, dir, path, setting->size);
if (setting->change_handler)
setting->change_handler(setting);
}
void menu_common_set_current_string_based_on_label(
const char *label, const char *str)
{
if (!strcmp(label, "video_shader_preset_save_as"))
{
#ifdef HAVE_SHADER_MANAGER
if (driver.menu_ctx && driver.menu_ctx->backend
&& driver.menu_ctx->backend->shader_manager_save_preset)
driver.menu_ctx->backend->shader_manager_save_preset(str, false);
#endif
}
}
void menu_common_setting_set_current_string(
rarch_setting_t *setting, const char *str)
{
strlcpy(setting->value.string, str, setting->size);
if (setting->change_handler)
setting->change_handler(setting);
}
static void handle_setting(rarch_setting_t *setting,
static int handle_setting(rarch_setting_t *setting,
unsigned id, const char *label, unsigned action)
{
if (setting->type == ST_BOOL)
menu_action_setting_boolean(setting, action);
else if (setting->type == ST_UINT)
menu_action_setting_unsigned_integer(setting, id, action);
else if (setting->type == ST_FLOAT)
menu_action_setting_fraction(setting, action);
else if (setting->type == ST_DIR)
return menu_action_setting_boolean(setting, action);
if (setting->type == ST_UINT)
return menu_action_setting_unsigned_integer(setting, id, action);
if (setting->type == ST_FLOAT)
return menu_action_setting_fraction(setting, action);
if (setting->type == ST_PATH)
return menu_common_setting_set_current_path_selection(setting,
setting->default_value.string, setting->name, id, action);
if (setting->type == ST_DIR)
{
if (action == MENU_ACTION_START)
{
*setting->value.string = '\0';
if (setting->change_handler)
setting->change_handler(setting);
return menu_action_setting_apply(setting);
}
return 0;
}
else if (setting->type == ST_PATH)
menu_common_setting_set_current_path_selection(setting,
setting->default_value.string, setting->name, id, action);
else if (setting->type == ST_STRING)
if (setting->type == ST_STRING)
{
if (
(setting->flags & SD_FLAG_ALLOW_INPUT) ||
@ -304,6 +276,8 @@ static void handle_setting(rarch_setting_t *setting,
else
menu_action_setting_driver(setting, action);
}
return 0;
}
static int menu_setting_set(unsigned id, const char *label,
@ -316,7 +290,7 @@ static int menu_setting_set(unsigned id, const char *label,
);
if (setting)
handle_setting(setting, id, label, action);
return handle_setting(setting, id, label, action);
else
{
setting = (rarch_setting_t*)get_last_setting(
@ -350,7 +324,7 @@ static int menu_setting_set(unsigned id, const char *label,
}
}
handle_setting(setting, id, label, action);
return handle_setting(setting, id, label, action);
}
else if (!strcmp(label, "video_shader_num_passes"))
{
@ -1232,7 +1206,7 @@ static int menu_action_ok(const char *menu_path,
}
else if ((setting && setting->type == ST_PATH))
{
menu_common_setting_set_current_string_path(setting, menu_path, path);
menu_action_setting_set_current_string_path(setting, menu_path, path);
menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
}
else if (!strcmp(menu_label, "disk_image_append"))
@ -1291,7 +1265,7 @@ static int menu_action_ok(const char *menu_path,
case MENU_FILE_AUDIOFILTER:
case MENU_FILE_VIDEOFILTER:
menu_common_setting_set_current_string_path(setting, menu_path, path);
menu_action_setting_set_current_string_path(setting, menu_path, path);
menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
return 0;
@ -1365,7 +1339,7 @@ static int menu_action_ok(const char *menu_path,
if (setting && setting->type == ST_DIR)
{
menu_common_setting_set_current_string(setting, menu_path);
menu_action_setting_set_current_string(setting, menu_path);
menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
}

View File

@ -331,6 +331,13 @@ static int menu_lakka_iterate(unsigned action)
return 0;
}
if (action == MENU_ACTION_TOGGLE &&
g_extern.main_is_init && !g_extern.libretro_dummy)
{
rarch_main_command(RARCH_CMD_RESUME);
return -1;
}
active_category = (menu_category_t*)&categories[menu_active_category];
if (active_category)
@ -350,25 +357,26 @@ static int menu_lakka_iterate(unsigned action)
if (action && depth == 1 && menu_active_category == 0
&& active_subitem->setting)
{
rarch_setting_t *setting = (rarch_setting_t*)
active_subitem->setting;
switch (action)
{
case MENU_ACTION_OK:
if (setting->cmd_trigger.idx != RARCH_CMD_NONE)
setting->cmd_trigger.triggered = true;
/* fall-through */
case MENU_ACTION_LEFT:
case MENU_ACTION_RIGHT:
case MENU_ACTION_OK:
case MENU_ACTION_START:
{
rarch_setting_t *setting = (rarch_setting_t*)
active_subitem->setting;
if (setting->type == ST_BOOL)
menu_action_setting_boolean(setting, action);
else if (setting->type == ST_UINT)
menu_action_setting_unsigned_integer(setting, 0, action);
else if (setting->type == ST_FLOAT)
menu_action_setting_fraction(setting, action);
else if (setting->type == ST_STRING)
menu_action_setting_driver(setting, action);
}
if (setting->type == ST_BOOL)
menu_action_setting_boolean(setting, action);
else if (setting->type == ST_UINT)
menu_action_setting_unsigned_integer(setting, 0, action);
else if (setting->type == ST_FLOAT)
menu_action_setting_fraction(setting, action);
else if (setting->type == ST_STRING)
menu_action_setting_driver(setting, action);
break;
default:
break;

View File

@ -342,6 +342,8 @@ static void glui_context_reset(void *data)
{
menu_handle_t *menu = (menu_handle_t*)data;
gl_t *gl = (gl_t*)driver_video_resolve(NULL);
(void)gl;
driver.gfx_use_rgba = true;

View File

@ -80,6 +80,8 @@ static void get_title(const char *label, const char *dir,
snprintf(title, sizeof_title, "DSP FILTER %s", dir);
else if (!strcmp(label, "rgui_browser_directory"))
snprintf(title, sizeof_title, "BROWSER DIR %s", dir);
else if (!strcmp(label, "playlist_directory"))
snprintf(title, sizeof_title, "PLAYLIST DIR %s", dir);
else if (!strcmp(label, "content_directory"))
snprintf(title, sizeof_title, "CONTENT DIR %s", dir);
else if (!strcmp(label, "screenshot_directory"))

View File

@ -18,7 +18,22 @@
#include "menu_input_line_cb.h"
#include "menu_action.h"
void menu_action_setting_boolean(
int menu_action_setting_apply(rarch_setting_t *setting)
{
if (setting->change_handler)
setting->change_handler(setting);
if (setting->flags & SD_FLAG_EXIT
&& setting->cmd_trigger.triggered)
{
setting->cmd_trigger.triggered = false;
return -1;
}
return 0;
}
int menu_action_setting_boolean(
rarch_setting_t *setting, unsigned action)
{
if (
@ -36,13 +51,21 @@ void menu_action_setting_boolean(
else if (action == MENU_ACTION_RIGHT)
g_settings.state_slot++;
else if (action == MENU_ACTION_OK)
{
*setting->value.boolean = !(*setting->value.boolean);
if (setting->cmd_trigger.idx != RARCH_CMD_NONE)
setting->cmd_trigger.triggered = true;
}
}
else
{
switch (action)
{
case MENU_ACTION_OK:
if (setting->cmd_trigger.idx != RARCH_CMD_NONE)
setting->cmd_trigger.triggered = true;
/* fall-through */
case MENU_ACTION_LEFT:
case MENU_ACTION_RIGHT:
*setting->value.boolean = !(*setting->value.boolean);
@ -53,11 +76,10 @@ void menu_action_setting_boolean(
}
}
if (setting->change_handler)
setting->change_handler(setting);
return menu_action_setting_apply(setting);
}
void menu_action_setting_unsigned_integer(
int menu_action_setting_unsigned_integer(
rarch_setting_t *setting, unsigned id, unsigned action)
{
if (id == MENU_FILE_LINEFEED)
@ -85,8 +107,11 @@ void menu_action_setting_unsigned_integer(
}
break;
case MENU_ACTION_RIGHT:
case MENU_ACTION_OK:
if (setting->cmd_trigger.idx != RARCH_CMD_NONE)
setting->cmd_trigger.triggered = true;
/* fall-through */
case MENU_ACTION_RIGHT:
*setting->value.unsigned_integer =
*setting->value.unsigned_integer + setting->step;
@ -104,11 +129,10 @@ void menu_action_setting_unsigned_integer(
}
}
if (setting->change_handler)
setting->change_handler(setting);
return menu_action_setting_apply(setting);
}
void menu_action_setting_fraction(
int menu_action_setting_fraction(
rarch_setting_t *setting, unsigned action)
{
if (!strcmp(setting->name, "video_refresh_rate_auto"))
@ -127,6 +151,9 @@ void menu_action_setting_fraction(
/* Incase refresh rate update forced non-block video. */
rarch_main_command(RARCH_CMD_VIDEO_SET_BLOCKING_STATE);
}
if (setting->cmd_trigger.idx != RARCH_CMD_NONE)
setting->cmd_trigger.triggered = true;
}
}
else if (!strcmp(setting->name, "fastforward_ratio"))
@ -168,8 +195,11 @@ void menu_action_setting_fraction(
}
break;
case MENU_ACTION_RIGHT:
case MENU_ACTION_OK:
if (setting->cmd_trigger.idx != RARCH_CMD_NONE)
setting->cmd_trigger.triggered = true;
/* fall-through */
case MENU_ACTION_RIGHT:
*setting->value.fraction =
*setting->value.fraction + setting->step;
@ -186,8 +216,7 @@ void menu_action_setting_fraction(
}
}
if (setting->change_handler)
setting->change_handler(setting);
return menu_action_setting_apply(setting);
}
void menu_action_setting_driver(
@ -217,3 +246,34 @@ void menu_action_setting_driver(
}
}
}
int menu_action_setting_set_current_string(
rarch_setting_t *setting, const char *str)
{
strlcpy(setting->value.string, str, setting->size);
return menu_action_setting_apply(setting);
}
int menu_action_set_current_string_based_on_label(
const char *label, const char *str)
{
if (!strcmp(label, "video_shader_preset_save_as"))
{
#ifdef HAVE_SHADER_MANAGER
if (driver.menu_ctx && driver.menu_ctx->backend
&& driver.menu_ctx->backend->shader_manager_save_preset)
driver.menu_ctx->backend->shader_manager_save_preset(str, false);
#endif
}
return 0;
}
int menu_action_setting_set_current_string_path(
rarch_setting_t *setting, const char *dir, const char *path)
{
fill_pathname_join(setting->value.string, dir, path, setting->size);
return menu_action_setting_apply(setting);
}

View File

@ -19,16 +19,27 @@
#include "../../settings_data.h"
void menu_action_setting_boolean(
int menu_action_setting_apply(rarch_setting_t *setting);
int menu_action_setting_boolean(
rarch_setting_t *setting, unsigned action);
void menu_action_setting_fraction(
int menu_action_setting_fraction(
rarch_setting_t *setting, unsigned action);
void menu_action_setting_unsigned_integer(
int menu_action_setting_unsigned_integer(
rarch_setting_t *setting, unsigned id, unsigned action);
void menu_action_setting_driver(
rarch_setting_t *setting, unsigned action);
int menu_action_set_current_string_based_on_label(
const char *label, const char *str);
int menu_action_setting_set_current_string(
rarch_setting_t *setting, const char *str);
int menu_action_setting_set_current_string_path(
rarch_setting_t *setting, const char *dir, const char *path);
#endif

View File

@ -315,7 +315,6 @@ bool menu_iterate(void)
{
driver.menu->need_refresh = true;
rarch_main_set_state(RARCH_ACTION_STATE_MENU_PREINIT_FINISHED);
driver.menu->old_input_state |= 1ULL << RARCH_MENU_TOGGLE;
}
rarch_input_poll();
@ -372,17 +371,20 @@ bool menu_iterate(void)
if (driver.menu_ctx && driver.menu_ctx->backend
&& driver.menu_ctx->backend->iterate)
driver.menu_ctx->backend->iterate(action);
ret = driver.menu_ctx->backend->iterate(action);
draw_frame(true);
throttle_frame();
draw_frame(false);
if (driver.menu_ctx && driver.menu_ctx->input_postprocess)
ret = driver.menu_ctx->input_postprocess(driver.menu->old_input_state);
driver.menu_ctx->input_postprocess(driver.menu->old_input_state);
#if 0
/* Go back to Main Menu when exiting */
if (ret < 0)
menu_flush_stack_type(driver.menu->menu_stack, MENU_SETTINGS);
#endif
if (ret)
return false;
@ -444,6 +446,7 @@ unsigned menu_common_type_is(const char *label, unsigned type)
!strcmp(label, "overlay_directory") ||
!strcmp(label, "screenshot_directory") ||
!strcmp(label, "joypad_autoconfig_dir") ||
!strcmp(label, "playlist_directory") ||
!strcmp(label, "extraction_directory") ||
!strcmp(label, "system_directory"))
return MENU_FILE_DIRECTORY;

View File

@ -25,16 +25,11 @@
#include <limits.h>
#include <ctype.h>
#include "menu_common.h"
#include "menu_action.h"
#include "../../input/keyboard_line.h"
#include "menu_input_line_cb.h"
#include "../../settings_data.h"
/* forward decls */
void menu_common_setting_set_current_string(rarch_setting_t *setting,
const char *str);
void menu_common_set_current_string_based_on_label(
const char *label, const char *str);
void menu_key_start_line(void *data, const char *label,
const char *label_setting, input_keyboard_line_complete_t cb)
{
@ -100,9 +95,10 @@ void st_string_callback(void *userdata, const char *str)
if ((current_setting = (rarch_setting_t*)
setting_data_find_setting(
setting_data, menu->keyboard.label_setting)))
menu_common_setting_set_current_string(current_setting, str);
menu_action_setting_set_current_string(current_setting, str);
else
menu_common_set_current_string_based_on_label(menu->keyboard.label_setting, str);
menu_action_set_current_string_based_on_label(
menu->keyboard.label_setting, str);
}
menu_key_end_line(menu);
}

View File

@ -620,6 +620,8 @@ static void frontend_android_get_environment_settings(int *argc,
path, "info", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.autoconfig_dir,
path, "autoconfig", sizeof(g_defaults.autoconfig_dir));
fill_pathname_join(g_defaults.playlist_dir,
path, "playlists", sizeof(g_defaults.playlist_dir));
}
}
}

View File

@ -198,6 +198,8 @@ static void frontend_gx_get_environment_settings(int *argc, char *argv[],
"savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.port_dir,
"savefiles", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.playlist_dir, g_defaults.port_dir,
"playlists", sizeof(g_defaults.playlist_dir));
#ifdef IS_SALAMANDER
if (*argc > 2 && argv[1] != NULL && argv[2] != NULL)

View File

@ -207,6 +207,8 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
"overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.assets_dir, g_defaults.core_dir,
"media", sizeof(g_defaults.assets_dir));
fill_pathname_join(g_defaults.playlist_dir, g_defaults.core_dir,
"playlists", sizeof(g_defaults.playlist_dir));
}
#ifndef IS_SALAMANDER

View File

@ -77,6 +77,8 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
"savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, g_defaults.core_dir,
"system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.playlist_dir, g_defaults.core_dir,
"playlists", sizeof(g_defaults.playlist_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.port_dir,
"retroarch.cfg", sizeof(g_defaults.config_path));

View File

@ -55,6 +55,8 @@ static void frontend_qnx_get_environment_settings(int *argc, char *argv[],
"lib", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, "app/native",
"info", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.playlist_dir, "app/native",
"playlists", sizeof(g_defaults.playlist_dir));
}
const frontend_ctx_driver_t frontend_ctx_qnx = {

View File

@ -162,6 +162,8 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
"game:", sizeof(g_defaults.screenshot_dir));
strlcpy(g_defaults.savestate_dir,
"game:\\savestates", sizeof(g_defaults.savestate_dir));
strlcpy(g_defaults.playlist_dir,
"game:\\playlists", sizeof(g_defaults.playlist_dir));
strlcpy(g_defaults.sram_dir,
"game:\\savefiles", sizeof(g_defaults.sram_dir));
strlcpy(g_defaults.system_dir,

View File

@ -197,6 +197,7 @@ struct defaults
char sram_dir[PATH_MAX];
char screenshot_dir[PATH_MAX];
char system_dir[PATH_MAX];
char playlist_dir[PATH_MAX];
struct
{
@ -365,6 +366,7 @@ struct settings
char system_directory[PATH_MAX];
char extraction_directory[PATH_MAX];
char playlist_directory[PATH_MAX];
bool rewind_enable;
size_t rewind_buffer_size;

View File

@ -677,10 +677,9 @@ static bool inside_hitbox(const struct overlay_desc *desc, float x, float y)
case OVERLAY_HITBOX_RECT:
return (fabs(x - desc->x) <= desc->range_x_mod) &&
(fabs(y - desc->y) <= desc->range_y_mod);
default:
return false;
}
return false;
}
static inline float clamp(float val, float lower, float upper)
@ -689,8 +688,7 @@ static inline float clamp(float val, float lower, float upper)
return lower;
else if (val > upper)
return upper;
else
return val;
return val;
}
void input_overlay_poll(input_overlay_t *ol, input_overlay_state_t *out,

View File

@ -49,7 +49,8 @@ static inline void RARCH_LOG(const char *fmt, ...)
va_end(ap);
}
static inline void RARCH_LOG_OUTPUT_V(const char *tag, const char *fmt, va_list ap)
static inline void RARCH_LOG_OUTPUT_V(const char *tag,
const char *fmt, va_list ap)
{
RARCH_LOG_V(tag, fmt, ap);
}

View File

@ -29,9 +29,11 @@ static inline void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
{
char msg_new[1024], buffer[1024];
#ifdef IS_SALAMANDER
snprintf(msg_new, sizeof(msg_new), "RetroArch Salamander: %s%s", tag ? tag : "", fmt);
snprintf(msg_new, sizeof(msg_new),
"RetroArch Salamander: %s%s", tag ? tag : "", fmt);
#else
snprintf(msg_new, sizeof(msg_new), "RetroArch: %s%s", tag ? tag : "", fmt);
snprintf(msg_new, sizeof(msg_new),
"RetroArch: %s%s", tag ? tag : "", fmt);
#endif
wvsprintf(buffer, msg_new, ap);
OutputDebugStringA(buffer);
@ -47,7 +49,8 @@ static inline void RARCH_LOG(const char *fmt, ...)
va_end(ap);
}
static inline void RARCH_LOG_OUTPUT_V(const char *tag, const char *msg, va_list ap)
static inline void RARCH_LOG_OUTPUT_V(const char *tag,
const char *msg, va_list ap)
{
RARCH_LOG_V(tag, msg, ap);
}
@ -64,9 +67,11 @@ static inline void RARCH_WARN_V(const char *tag, const char *fmt, va_list ap)
{
char msg_new[1024], buffer[1024];
#ifdef IS_SALAMANDER
snprintf(msg_new, sizeof(msg_new), "RetroArch Salamander [WARN] :: %s%s", tag ? tag : "", fmt);
snprintf(msg_new, sizeof(msg_new),
"RetroArch Salamander [WARN] :: %s%s", tag ? tag : "", fmt);
#else
snprintf(msg_new, sizeof(msg_new), "RetroArch [WARN] :: %s%s", tag ? tag : "", fmt);
snprintf(msg_new, sizeof(msg_new),
"RetroArch [WARN] :: %s%s", tag ? tag : "", fmt);
#endif
wvsprintf(buffer, msg_new, ap);
OutputDebugStringA(buffer);
@ -86,9 +91,11 @@ static inline void RARCH_ERR_V(const char *tag, const char *fmt, ...)
{
char msg_new[1024];
#ifdef IS_SALAMANDER
snprintf(msg_new, sizeof(msg_new), "RetroArch Salamander [ERR] :: %s%s", tag ? tag : "", fmt);
snprintf(msg_new, sizeof(msg_new),
"RetroArch Salamander [ERR] :: %s%s", tag ? tag : "", fmt);
#else
snprintf(msg_new, sizeof(msg_new), "RetroArch [ERR] :: %s%s", tag ? tag : "", fmt);
snprintf(msg_new, sizeof(msg_new),
"RetroArch [ERR] :: %s%s", tag ? tag : "", fmt);
#endif
OutputDebugStringA(fmt);
}

View File

@ -32,7 +32,7 @@
#define __RARCH_STDINT_H
#if _MSC_VER && (_MSC_VER < 1600)
//pre-MSVC 2010 needs an implementation of stdint.h
/* pre-MSVC 2010 needs an implementation of stdint.h */
#if _MSC_VER > 1000
#pragma once
@ -40,10 +40,11 @@
#include <limits.h>
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
// or compiler give many errors like this:
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
/* For Visual Studio 6 in C++ mode and for many Visual Studio versions when
* compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
* or compiler give many errors like this:
* error C2733: second C linkage of overloaded function 'wmemchr' not allowed
*/
#ifdef __cplusplus
extern "C" {
#endif
@ -52,7 +53,7 @@ extern "C" {
}
#endif
// Define _W64 macros to mark types changing their size, like intptr_t.
/* Define _W64 macros to mark types changing their size, like intptr_t. */
#ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
@ -62,13 +63,14 @@ extern "C" {
#endif
// 7.18.1 Integer types
/* 7.18.1 Integer types */
// 7.18.1.1 Exact-width integer types
/* 7.18.1.1 Exact-width integer types */
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
// realize that, e.g. char has the same size as __int8
// so we give up on __intX for them.
/* Visual Studio 6 and Embedded Visual C++ 4 doesn't
* realize that, e.g. char has the same size as __int8
* so we give up on __intX for them.
*/
#if (_MSC_VER < 1300)
typedef signed char int8_t;
typedef signed short int16_t;
@ -88,7 +90,7 @@ typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
// 7.18.1.2 Minimum-width integer types
/* 7.18.1.2 Minimum-width integer types */
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
@ -98,7 +100,7 @@ typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
// 7.18.1.3 Fastest minimum-width integer types
/* 7.18.1.3 Fastest minimum-width integer types */
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
@ -108,25 +110,26 @@ typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
// 7.18.1.4 Integer types capable of holding object pointers
#ifdef _WIN64 // [
/* 7.18.1.4 Integer types capable of holding object pointers */
#ifdef _WIN64 /* [ */
typedef signed __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else // _WIN64 ][
#else /* _WIN64 ][ */
typedef _W64 signed int intptr_t;
typedef _W64 unsigned int uintptr_t;
#endif // _WIN64 ]
// 7.18.1.5 Greatest-width integer types
/* 7.18.1.5 Greatest-width integer types */
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
// 7.18.2 Limits of specified-width integer types
/* 7.18.2 Limits of specified-width integer types */
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
/* [ See footnote 220 at page 257 and footnote 221 at page 259 */
// 7.18.2.1 Limits of exact-width integer types
/* 7.18.2.1 Limits of exact-width integer types */
#define INT8_MIN ((int8_t)_I8_MIN)
#define INT8_MAX _I8_MAX
#define INT16_MIN ((int16_t)_I16_MIN)
@ -140,7 +143,7 @@ typedef uint64_t uintmax_t;
#define UINT32_MAX _UI32_MAX
#define UINT64_MAX _UI64_MAX
// 7.18.2.2 Limits of minimum-width integer types
/* 7.18.2.2 Limits of minimum-width integer types */
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MIN INT16_MIN
@ -154,7 +157,7 @@ typedef uint64_t uintmax_t;
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
// 7.18.2.3 Limits of fastest minimum-width integer types
/* 7.18.2.3 Limits of fastest minimum-width integer types */
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MIN INT16_MIN
@ -168,23 +171,23 @@ typedef uint64_t uintmax_t;
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
// 7.18.2.4 Limits of integer types capable of holding object pointers
#ifdef _WIN64 // [
/* 7.18.2.4 Limits of integer types capable of holding object pointers */
#ifdef _WIN64 /* [ */
# define INTPTR_MIN INT64_MIN
# define INTPTR_MAX INT64_MAX
# define UINTPTR_MAX UINT64_MAX
#else // _WIN64 ][
#else /* _WIN64 ][ */
# define INTPTR_MIN INT32_MIN
# define INTPTR_MAX INT32_MAX
# define UINTPTR_MAX UINT32_MAX
#endif // _WIN64 ]
#endif /* _WIN64 ] */
// 7.18.2.5 Limits of greatest-width integer types
/* 7.18.2.5 Limits of greatest-width integer types */
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
// 7.18.3 Limits of other integer types
/* 7.18.3 Limits of other integer types */
#ifdef _WIN64 // [
# define PTRDIFF_MIN _I64_MIN
@ -205,25 +208,25 @@ typedef uint64_t uintmax_t;
# endif // _WIN64 ]
#endif // SIZE_MAX ]
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
#ifndef WCHAR_MIN // [
/* WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h> */
#ifndef WCHAR_MIN /* [ */
# define WCHAR_MIN 0
#endif // WCHAR_MIN ]
#endif /* WCHAR_MIN ] */
#ifndef WCHAR_MAX // [
# define WCHAR_MAX _UI16_MAX
#endif // WCHAR_MAX ]
#endif /* WCHAR_MAX ] */
#define WINT_MIN 0
#define WINT_MAX _UI16_MAX
#endif // __STDC_LIMIT_MACROS ]
#endif /* __STDC_LIMIT_MACROS ] */
/* 7.18.4 Limits of other integer types */
// 7.18.4 Limits of other integer types
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
/* [ See footnote 224 at page 260 */
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
// 7.18.4.1 Macros for minimum-width integer constants
/* 7.18.4.1 Macros for minimum-width integer constants */
#define INT8_C(val) val##i8
#define INT16_C(val) val##i16
@ -235,14 +238,14 @@ typedef uint64_t uintmax_t;
#define UINT32_C(val) val##ui32
#define UINT64_C(val) val##ui64
// 7.18.4.2 Macros for greatest-width integer constants
/* 7.18.4.2 Macros for greatest-width integer constants */
#define INTMAX_C INT64_C
#define UINTMAX_C UINT64_C
#endif // __STDC_CONSTANT_MACROS ]
#endif /* __STDC_CONSTANT_MACROS ] */
#else
//sanity for everything else
/* Sanity for everything else */
#include <stdint.h>
#endif

View File

@ -19,12 +19,14 @@
#ifdef _MSC_VER
#undef UNICODE // Do not bother with UNICODE at this time.
#undef UNICODE /* Do not bother with UNICODE at this time. */
#include <direct.h>
#include <stddef.h>
#include <math.h>
// Python headers defines ssize_t and sets HAVE_SSIZE_T. Cannot duplicate these efforts.
/* Python headers defines ssize_t and sets HAVE_SSIZE_T.
* Cannot duplicate these efforts.
*/
#ifndef HAVE_SSIZE_T
#if defined(_WIN64)
typedef __int64 ssize_t;
@ -41,7 +43,7 @@ typedef int ssize_t;
#undef strncasecmp
#define strncasecmp _strnicmp
// Disable some of the annoying warnings.
/* Disable some of the annoying warnings. */
#pragma warning(disable : 4800)
#pragma warning(disable : 4805)
#pragma warning(disable : 4244)

View File

@ -87,17 +87,25 @@ struct netplay
struct delta_frame *buffer;
size_t buffer_size;
size_t self_ptr; // Ptr where we are now.
size_t other_ptr; // Points to the last reliable state that self ever had.
size_t read_ptr; // Ptr to where we are reading. Generally, other_ptr <= read_ptr <= self_ptr.
size_t tmp_ptr; // A temporary pointer used on replay.
/* Pointer where we are now. */
size_t self_ptr;
/* Points to the last reliable state that self ever had. */
size_t other_ptr;
/* Pointer to where we are reading.
* Generally, other_ptr <= read_ptr <= self_ptr. */
size_t read_ptr;
/* A temporary pointer used on replay. */
size_t tmp_ptr;
size_t state_size;
bool is_replay; // Are we replaying old frames?
bool can_poll; // We don't want to poll several times on a frame.
/* Are we replaying old frames? */
bool is_replay;
/* We don't want to poll several times on a frame. */
bool can_poll;
// To compat UDP packet loss we also send old data along with the packets.
/* To compat UDP packet loss we also send
* old data along with the packets. */
uint32_t packet_buffer[UDP_FRAME_PACKETS * 2];
uint32_t frame_count;
uint32_t read_frame_count;
@ -109,7 +117,7 @@ struct netplay
unsigned timeout_cnt;
// Spectating.
/* Spectating. */
bool spectate;
bool spectate_client;
int spectate_fds[MAX_SPECTATORS];
@ -117,11 +125,11 @@ struct netplay
size_t spectate_input_ptr;
size_t spectate_input_size;
// Player flipping
// Flipping state. If ptr >= flip_frame, we apply the flip.
// If not, we apply the opposite, effectively creating a trigger point.
// To avoid collition we need to make sure our client/host is synced up
// well after flip_frame before allowing another flip.
/* Player flipping
* Flipping state. If ptr >= flip_frame, we apply the flip.
* If not, we apply the opposite, effectively creating a trigger point.
* To avoid collition we need to make sure our client/host is synced up
* well after flip_frame before allowing another flip. */
bool flip;
uint32_t flip_frame;
};
@ -167,11 +175,13 @@ static void warn_hangup(void)
void input_poll_net(void)
{
if (!netplay_should_skip(g_extern.netplay) && netplay_can_poll(g_extern.netplay))
if (!netplay_should_skip(g_extern.netplay)
&& netplay_can_poll(g_extern.netplay))
netplay_poll(g_extern.netplay);
}
void video_frame_net(const void *data, unsigned width, unsigned height, size_t pitch)
void video_frame_net(const void *data, unsigned width,
unsigned height, size_t pitch)
{
if (!netplay_should_skip(g_extern.netplay))
g_extern.netplay->cbs.frame_cb(data, width, height, pitch);
@ -190,7 +200,8 @@ size_t audio_sample_batch_net(const int16_t *data, size_t frames)
return frames;
}
int16_t input_state_net(unsigned port, unsigned device, unsigned index, unsigned id)
int16_t input_state_net(unsigned port, unsigned device,
unsigned index, unsigned id)
{
if (netplay_is_alive(g_extern.netplay))
return netplay_input_state(g_extern.netplay, port, device, index, id);
@ -614,7 +625,7 @@ static bool get_info(netplay_t *handle)
return false;
}
// Send SRAM data to our Player 2.
/* Send SRAM data to our Player 2. */
const void *sram = pretro_get_memory_data(RETRO_MEMORY_SAVE_RAM);
unsigned sram_size = pretro_get_memory_size(RETRO_MEMORY_SAVE_RAM);
if (!send_all(handle->fd, sram, sram_size))
@ -682,7 +693,8 @@ static bool bsv_parse_header(const uint32_t *header, uint32_t magic)
uint32_t in_crc = swap_if_big32(header[CRC_INDEX]);
if (in_crc != g_extern.content_crc)
{
RARCH_ERR("CRC32 mismatch, got 0x%x, expected 0x%x.\n", in_crc, g_extern.content_crc);
RARCH_ERR("CRC32 mismatch, got 0x%x, expected 0x%x.\n", in_crc,
g_extern.content_crc);
return false;
}
@ -1134,13 +1146,14 @@ static bool netplay_get_cmd(netplay_t *handle)
{
case NETPLAY_CMD_FLIP_PLAYERS:
{
uint32_t flip_frame;
if (cmd_size != sizeof(uint32_t))
{
RARCH_ERR("CMD_FLIP_PLAYERS has unexpected command size.\n");
return netplay_cmd_nak(handle);
}
uint32_t flip_frame;
if (!recv_all(handle->fd, &flip_frame, sizeof(flip_frame)))
{
RARCH_ERR("Failed to receive CMD_FLIP_PLAYERS argument.\n");

View File

@ -85,7 +85,8 @@ unsigned perf_ptr_libretro;
void rarch_perf_register(struct retro_perf_counter *perf)
{
if (!g_extern.perfcnt_enable || perf->registered || perf_ptr_rarch >= MAX_COUNTERS)
if (!g_extern.perfcnt_enable || perf->registered
|| perf_ptr_rarch >= MAX_COUNTERS)
return;
perf_counters_rarch[perf_ptr_rarch++] = perf;
@ -107,7 +108,8 @@ void retro_perf_clear(void)
memset(perf_counters_libretro, 0, sizeof(perf_counters_libretro));
}
static void log_counters(const struct retro_perf_counter **counters, unsigned num)
static void log_counters(
const struct retro_perf_counter **counters, unsigned num)
{
unsigned i;
for (i = 0; i < num; i++)
@ -116,7 +118,8 @@ static void log_counters(const struct retro_perf_counter **counters, unsigned nu
{
RARCH_LOG(PERF_LOG_FMT,
counters[i]->ident,
(unsigned long long)counters[i]->total / (unsigned long long)counters[i]->call_cnt,
(unsigned long long)counters[i]->total /
(unsigned long long)counters[i]->call_cnt,
(unsigned long long)counters[i]->call_cnt);
}
}
@ -147,7 +150,8 @@ retro_perf_tick_t rarch_get_perf_counter(void)
#elif defined(__linux__) || defined(__QNX__)
struct timespec tv;
if (clock_gettime(CLOCK_MONOTONIC, &tv) == 0)
time = (retro_perf_tick_t)tv.tv_sec * 1000000000 + (retro_perf_tick_t)tv.tv_nsec;
time = (retro_perf_tick_t)tv.tv_sec * 1000000000 +
(retro_perf_tick_t)tv.tv_nsec;
else
time = 0;
@ -194,7 +198,8 @@ retro_time_t rarch_get_time_usec(void)
{
#if defined(_WIN32)
static LARGE_INTEGER freq;
if (!freq.QuadPart && !QueryPerformanceFrequency(&freq)) // Frequency is guaranteed to not change.
/* Frequency is guaranteed to not change. */
if (!freq.QuadPart && !QueryPerformanceFrequency(&freq))
return 0;
LARGE_INTEGER count;
@ -205,7 +210,8 @@ retro_time_t rarch_get_time_usec(void)
return sys_time_get_system_time();
#elif defined(GEKKO)
return ticks_to_microsecs(gettime());
#elif defined(__MACH__) // OSX doesn't have clock_gettime ...
#elif defined(__MACH__)
/* OSX doesn't have clock_gettime. */
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
@ -239,8 +245,8 @@ retro_time_t rarch_get_time_usec(void)
#ifdef CPU_X86
static void x86_cpuid(int func, int flags[4])
{
// On Android, we compile RetroArch with PIC, and we are not allowed to clobber the ebx
// register.
/* On Android, we compile RetroArch with PIC, and we
* are not allowed to clobber the ebx register. */
#ifdef __x86_64__
#define REG_b "rbx"
#define REG_S "rsi"
@ -264,18 +270,21 @@ static void x86_cpuid(int func, int flags[4])
#endif
}
// Only runs on i686 and above. Needs to be conditionally run.
/* Only runs on i686 and above. Needs to be conditionally run. */
static uint64_t xgetbv_x86(uint32_t index)
{
#if defined(__GNUC__)
uint32_t eax, edx;
asm volatile (
// Older GCC versions (Apple's GCC for example) do not understand xgetbv instruction.
// Stamp out the machine code directly.
/* Older GCC versions (Apple's GCC for example) do
* not understand xgetbv instruction.
* Stamp out the machine code directly.
*/
".byte 0x0f, 0x01, 0xd0\n"
: "=a"(eax), "=d"(edx) : "c"(index));
return ((uint64_t)edx << 32) | eax;
#elif _MSC_FULL_VER >= 160040219 // Intrinsic only works on 2010 SP1 and above.
#elif _MSC_FULL_VER >= 160040219
/* Intrinsic only works on 2010 SP1 and above. */
return _xgetbv(index);
#else
RARCH_WARN("Unknown compiler. Cannot check xgetbv bits.\n");
@ -287,15 +296,16 @@ static uint64_t xgetbv_x86(uint32_t index)
#if defined(__ARM_NEON__)
static void arm_enable_runfast_mode(void)
{
// RunFast mode. Enables flush-to-zero and some floating point optimizations.
/* RunFast mode. Enables flush-to-zero and some
* floating point optimizations. */
static const unsigned x = 0x04086060;
static const unsigned y = 0x03000000;
int r;
asm volatile(
"fmrx %0, fpscr \n\t" // r0 = FPSCR
"and %0, %0, %1 \n\t" // r0 = r0 & 0x04086060
"orr %0, %0, %2 \n\t" // r0 = r0 | 0x03000000
"fmxr fpscr, %0 \n\t" // FPSCR = r0
"fmrx %0, fpscr \n\t" /* r0 = FPSCR */
"and %0, %0, %1 \n\t" /* r0 = r0 & 0x04086060 */
"orr %0, %0, %2 \n\t" /* r0 = r0 | 0x03000000 */
"fmxr fpscr, %0 \n\t" /* FPSCR = r0 */
: "=r"(r)
: "r"(x), "r"(y)
);
@ -304,7 +314,8 @@ static void arm_enable_runfast_mode(void)
unsigned rarch_get_cpu_cores(void)
{
#if defined(_WIN32) && !defined(_XBOX) // Win32
#if defined(_WIN32) && !defined(_XBOX)
/* Win32 */
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
return sysinfo.dwNumberOfProcessors;
@ -312,13 +323,15 @@ unsigned rarch_get_cpu_cores(void)
return android_getCpuCount();
#elif defined(GEKKO)
return 1;
#elif defined(_SC_NPROCESSORS_ONLN) // Linux, most unix-likes.
#elif defined(_SC_NPROCESSORS_ONLN)
/* Linux, most UNIX-likes. */
long ret = sysconf(_SC_NPROCESSORS_ONLN);
if (ret <= 0)
return (unsigned)1;
return ret;
#elif defined(BSD) || defined(__APPLE__) // BSD
// Copypasta from stackoverflow, dunno if it works.
#elif defined(BSD) || defined(__APPLE__)
/* BSD */
/* Copypasta from stackoverflow, dunno if it works. */
int num_cpu = 0;
int mib[4];
size_t len = sizeof(num_cpu);
@ -337,7 +350,7 @@ unsigned rarch_get_cpu_cores(void)
#elif defined(_XBOX360)
return 3;
#else
// No idea, assume single core.
/* No idea, assume single core. */
return 1;
#endif
}
@ -356,7 +369,7 @@ uint64_t rarch_get_cpu_features(void)
RARCH_LOG("[CPUID]: Vendor: %s\n", vendor);
unsigned max_flag = flags[0];
if (max_flag < 1) // Does CPUID not support func = 1? (unlikely ...)
if (max_flag < 1) /* Does CPUID not support func = 1? (unlikely ...) */
return 0;
x86_cpuid(1, flags);
@ -366,7 +379,7 @@ uint64_t rarch_get_cpu_features(void)
if (flags[3] & (1 << 25))
{
// SSE also implies MMXEXT (according to FFmpeg source).
/* SSE also implies MMXEXT (according to FFmpeg source). */
cpu |= RETRO_SIMD_SSE;
cpu |= RETRO_SIMD_MMXEXT;
}
@ -390,8 +403,11 @@ uint64_t rarch_get_cpu_features(void)
cpu |= RETRO_SIMD_AES;
const int avx_flags = (1 << 27) | (1 << 28);
// Must only perform xgetbv check if we have AVX CPU support (guaranteed to have at least i686).
if (((flags[2] & avx_flags) == avx_flags) && ((xgetbv_x86(0) & 0x6) == 0x6))
/* Must only perform xgetbv check if we have
* AVX CPU support (guaranteed to have at least i686). */
if (((flags[2] & avx_flags) == avx_flags)
&& ((xgetbv_x86(0) & 0x6) == 0x6))
cpu |= RETRO_SIMD_AVX;
if (max_flag >= 7)

View File

@ -61,6 +61,9 @@ void content_playlist_get_index(content_playlist_t *playlist,
static void content_playlist_free_entry(
struct content_playlist_entry *entry)
{
if (!entry)
return;
if (entry->path)
free(entry->path);
entry->path = NULL;

View File

@ -52,3 +52,12 @@ EOF
echo "$ECHOBUF ... $CXX"
rm -f "$TEMP_CXX" "$TEMP_EXE"
fi
if [ "$OS" = "Win32" ]; then
ECHOBUF="Checking for windres"
if [ -z "$WINDRES" ]; then
WINDRES=$(which ${CROSS_COMPILE}windres)
[ "$WINDRES" ] || { echo "$ECHOBUF ... Not found. Exiting."; exit 1; }
fi
echo "$ECHOBUF ... $WINDRES"
fi

View File

@ -232,6 +232,7 @@ create_config_make()
echo "CXX = $CXX"
echo "CXXFLAGS = $CXXFLAGS"
fi
echo "WINDRES = $WINDRES"
echo "ASFLAGS = $ASFLAGS"
echo "LDFLAGS = $LDFLAGS"
echo "INCLUDE_DIRS = $INCLUDE_DIRS"

View File

@ -3479,9 +3479,18 @@ void rarch_main_command(unsigned cmd)
break;
case RARCH_CMD_HISTORY_INIT:
if (!g_extern.history)
g_extern.history = content_playlist_init(
g_settings.content_history_path,
g_settings.content_history_size);
{
bool init_history = true;
if (!path_file_exists(g_settings.content_history_path))
init_history = write_empty_file(
g_settings.content_history_path);
if (init_history)
g_extern.history = content_playlist_init(
g_settings.content_history_path,
g_settings.content_history_size);
}
break;
case RARCH_CMD_HISTORY_DEINIT:
if (g_extern.history)

View File

@ -12,6 +12,10 @@
# will be extracted to this directory.
# extraction_directory =
# If set to a directory, the content history playlist will be saved
# to this directory along with any other playlists.
# playlist_directory =
# Automatically saves a savestate at the end of RetroArch's lifetime.
# The path is $SRAM_PATH.auto.
# RetroArch will automatically load any savestate with this path on startup if savestate_auto_load is set.

View File

@ -133,17 +133,21 @@ state_manager_t *state_manager_new(size_t state_size, size_t buffer_size)
state->data = (uint8_t*)malloc(buffer_size);
state->thisblock = (uint8_t*)calloc(state->blocksize + sizeof(uint16_t) * 4 + 16, 1);
state->nextblock = (uint8_t*)calloc(state->blocksize + sizeof(uint16_t) * 4 + 16, 1);
state->thisblock = (uint8_t*)
calloc(state->blocksize + sizeof(uint16_t) * 4 + 16, 1);
state->nextblock = (uint8_t*)
calloc(state->blocksize + sizeof(uint16_t) * 4 + 16, 1);
if (!state->data || !state->thisblock || !state->nextblock)
goto error;
/* Force in a different byte at the end, so we don't need to check
* bounds in the innermost loop (it's expensive).
*
* There is also a large amount of data that's the same, to stop the other scan
* There is also some padding at the end. This is so we don't read outside the
* buffer end if we're reading in large blocks;
* There is also a large amount of data that's the same, to stop
* the other scan.
*
* There is also some padding at the end. This is so we don't
* read outside the buffer end if we're reading in large blocks;
*
* It doesn't make any difference to us, but sacrificing 16 bytes to get
* Valgrind happy is worth it. */

View File

@ -452,6 +452,7 @@ void config_set_defaults(void)
*g_settings.input.overlay = '\0';
*g_settings.content_directory = '\0';
*g_settings.assets_directory = '\0';
*g_settings.playlist_directory = '\0';
*g_settings.video.shader_path = '\0';
*g_settings.video.shader_dir = '\0';
*g_settings.video.filter_dir = '\0';
@ -488,6 +489,9 @@ void config_set_defaults(void)
if (*g_defaults.assets_dir)
strlcpy(g_settings.assets_directory,
g_defaults.assets_dir, sizeof(g_settings.assets_directory));
if (*g_defaults.playlist_dir)
strlcpy(g_settings.playlist_directory,
g_defaults.playlist_dir, sizeof(g_settings.playlist_directory));
if (*g_defaults.core_dir)
fill_pathname_expand_special(g_settings.libretro_directory,
g_defaults.core_dir, sizeof(g_settings.libretro_directory));
@ -1067,10 +1071,13 @@ bool config_load_file(const char *path, bool set_defaults)
CONFIG_GET_PATH(extraction_directory, "extraction_directory");
CONFIG_GET_PATH(content_directory, "content_directory");
CONFIG_GET_PATH(assets_directory, "assets_directory");
CONFIG_GET_PATH(playlist_directory, "playlist_directory");
if (!strcmp(g_settings.content_directory, "default"))
*g_settings.content_directory = '\0';
if (!strcmp(g_settings.assets_directory, "default"))
*g_settings.assets_directory = '\0';
if (!strcmp(g_settings.playlist_directory, "default"))
*g_settings.playlist_directory = '\0';
#ifdef HAVE_MENU
CONFIG_GET_PATH(menu_content_directory, "rgui_browser_directory");
if (!strcmp(g_settings.menu_content_directory, "default"))
@ -1125,9 +1132,16 @@ bool config_load_file(const char *path, bool set_defaults)
CONFIG_GET_INT(network_cmd_port, "network_cmd_port");
CONFIG_GET_BOOL(stdin_cmd_enable, "stdin_cmd_enable");
fill_pathname_resolve_relative(g_settings.content_history_path,
g_extern.config_path, "retroarch-content-history.txt",
sizeof(g_settings.content_history_path));
if (g_settings.playlist_directory[0] != '\0')
fill_pathname_join(g_settings.content_history_path,
g_settings.playlist_directory,
"retroarch-content-history.txt",
sizeof(g_settings.content_history_path));
else
fill_pathname_resolve_relative(g_settings.content_history_path,
g_extern.config_path, "retroarch-content-history.txt",
sizeof(g_settings.content_history_path));
CONFIG_GET_PATH(content_history_path, "game_history_path");
CONFIG_GET_INT(content_history_size, "game_history_size");
@ -1507,6 +1521,9 @@ bool config_save_file(const char *path)
config_set_path(conf, "assets_directory",
*g_settings.assets_directory ?
g_settings.assets_directory : "default");
config_set_path(conf, "playlist_directory",
*g_settings.playlist_directory ?
g_settings.playlist_directory : "default");
#ifdef HAVE_MENU
config_set_path(conf, "rgui_browser_directory",
*g_settings.menu_content_directory ?

View File

@ -39,7 +39,7 @@
#endif
static void get_input_config_prefix(char *buf, size_t sizeof_buf,
const rarch_setting_t *setting)
rarch_setting_t *setting)
{
if (!buf)
{
@ -58,7 +58,7 @@ static void get_input_config_prefix(char *buf, size_t sizeof_buf,
}
static void get_input_config_key(char *buf, size_t sizeof_buf,
const rarch_setting_t* setting, const char* type)
rarch_setting_t* setting, const char* type)
{
char prefix[32];
@ -83,7 +83,7 @@ static void get_input_config_key(char *buf, size_t sizeof_buf,
/* FIXME - make portable */
static void get_key_name(char *buf, size_t sizeof_buf,
const rarch_setting_t* setting)
rarch_setting_t* setting)
{
uint32_t hidkey, i;
@ -116,7 +116,7 @@ static void get_key_name(char *buf, size_t sizeof_buf,
#endif
static void get_button_name(char *buf, size_t sizeof_buf,
const rarch_setting_t* setting)
rarch_setting_t* setting)
{
if (!buf)
{
@ -138,7 +138,7 @@ static void get_button_name(char *buf, size_t sizeof_buf,
}
static void get_axis_name(char *buf, size_t sizeof_buf,
const rarch_setting_t* setting)
rarch_setting_t* setting)
{
uint32_t joyaxis;
@ -162,7 +162,7 @@ static void get_axis_name(char *buf, size_t sizeof_buf,
snprintf(buf, sizeof_buf, "+%u", AXIS_POS_GET(joyaxis));
}
void setting_data_reset_setting(const rarch_setting_t* setting)
void setting_data_reset_setting(rarch_setting_t* setting)
{
if (!setting)
{
@ -219,14 +219,14 @@ void setting_data_reset_setting(const rarch_setting_t* setting)
setting->change_handler(setting);
}
void setting_data_reset(const rarch_setting_t* settings)
void setting_data_reset(rarch_setting_t* settings)
{
for (; settings->type != ST_NONE; settings++)
setting_data_reset_setting(settings);
}
static bool setting_data_load_config(
const rarch_setting_t* settings, config_file_t* config)
rarch_setting_t* settings, config_file_t* config)
{
if (!settings || !config)
return false;
@ -318,7 +318,7 @@ static bool setting_data_load_config(
return true;
}
bool setting_data_load_config_path(const rarch_setting_t* settings,
bool setting_data_load_config_path(rarch_setting_t* settings,
const char* path)
{
config_file_t *config = (config_file_t*)config_file_new(path);
@ -332,7 +332,7 @@ bool setting_data_load_config_path(const rarch_setting_t* settings,
return config;
}
bool setting_data_save_config(const rarch_setting_t* settings,
bool setting_data_save_config(rarch_setting_t* settings,
config_file_t* config)
{
if (!settings || !config)
@ -459,7 +459,7 @@ rarch_setting_t* setting_data_find_setting(rarch_setting_t* setting,
return setting;
}
void setting_data_set_with_string_representation(const rarch_setting_t* setting,
void setting_data_set_with_string_representation(rarch_setting_t* setting,
const char* value)
{
if (!setting || !value)
@ -2005,9 +2005,9 @@ void setting_data_get_label(char *type_str,
}
}
static void general_read_handler(const void *data)
static void general_read_handler(void *data)
{
const rarch_setting_t *setting = (const rarch_setting_t*)data;
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return;
@ -2040,63 +2040,27 @@ static void general_read_handler(const void *data)
*setting->value.integer = g_settings.input.joypad_map[4];
}
static void general_write_handler(const void *data)
static void general_write_handler(void *data)
{
unsigned rarch_cmd = RARCH_CMD_NONE;
const rarch_setting_t *setting = (const rarch_setting_t*)data;
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return;
if (!strcmp(setting->name, "quit_retroarch"))
if (setting->cmd_trigger.idx != RARCH_CMD_NONE)
{
if (*setting->value.boolean)
if (setting->flags & SD_FLAG_EXIT)
{
rarch_cmd = RARCH_CMD_QUIT_RETROARCH;
*setting->value.boolean = false;
if (*setting->value.boolean)
*setting->value.boolean = false;
}
if (setting->cmd_trigger.triggered ||
(setting->flags & SD_FLAG_CMD_APPLY_AUTO))
rarch_cmd = setting->cmd_trigger.idx;
}
else if (!strcmp(setting->name, "save_new_config"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_MENU_SAVE_CONFIG;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "restart_retroarch"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_RESTART_RETROARCH;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "resume_content"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_RESUME;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "restart_content"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_RESET;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "take_screenshot"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_TAKE_SCREENSHOT;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "help"))
if (!strcmp(setting->name, "help"))
{
if (*setting->value.boolean)
{
@ -2106,13 +2070,6 @@ static void general_write_handler(const void *data)
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "rewind_enable"))
rarch_cmd = RARCH_CMD_REWIND;
else if (!strcmp(setting->name, "soft_filter"))
{
if (*setting->value.boolean)
rarch_cmd = RARCH_CMD_VIDEO_APPLY_STATE_CHANGES;
}
else if (!strcmp(setting->name, "video_smooth"))
{
if (driver.video_data && driver.video_poke
@ -2127,12 +2084,6 @@ static void general_write_handler(const void *data)
else
*setting->value.boolean = false;
}
else if (!strcmp(setting->name, "video_monitor_index"))
rarch_cmd = RARCH_CMD_REINIT;
else if (!strcmp(setting->name, "video_disable_composition"))
rarch_cmd = RARCH_CMD_REINIT;
else if (!strcmp(setting->name, "video_fullscreen"))
rarch_cmd = RARCH_CMD_REINIT;
else if (!strcmp(setting->name, "video_rotation"))
{
if (driver.video && driver.video->set_rotation)
@ -2140,16 +2091,6 @@ static void general_write_handler(const void *data)
(*setting->value.unsigned_integer +
g_extern.system.rotation) % 4);
}
else if (!strcmp(setting->name, "video_gamma"))
rarch_cmd = RARCH_CMD_VIDEO_APPLY_STATE_CHANGES;
else if (!strcmp(setting->name, "video_threaded"))
rarch_cmd = RARCH_CMD_REINIT;
else if (!strcmp(setting->name, "video_swap_interval"))
rarch_cmd = RARCH_CMD_VIDEO_SET_BLOCKING_STATE;
#ifdef HAVE_OVERLAY
else if (!strcmp(setting->name, "input_overlay_opacity"))
rarch_cmd = RARCH_CMD_OVERLAY_SET_ALPHA_MOD;
#endif
else if (!strcmp(setting->name, "system_bgm_enable"))
{
if (*setting->value.boolean)
@ -2167,8 +2108,6 @@ static void general_write_handler(const void *data)
}
else if (!strcmp(setting->name, "audio_volume"))
g_extern.audio_data.volume_gain = db_to_gain(*setting->value.fraction);
else if (!strcmp(setting->name, "audio_dsp_plugin"))
rarch_cmd = RARCH_CMD_DSP_FILTER_INIT;
else if (!strcmp(setting->name, "audio_rate_control_delta"))
{
if (*setting->value.fraction < 0.0005)
@ -2182,30 +2121,6 @@ static void general_write_handler(const void *data)
g_settings.audio.rate_control_delta = *setting->value.fraction;
}
}
else if (!strcmp(setting->name, "savestate"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_SAVE_STATE;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "loadstate"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_LOAD_STATE;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "autosave_interval"))
rarch_cmd = RARCH_CMD_AUTOSAVE;
#ifdef HAVE_OVERLAY
else if (!strcmp(setting->name, "input_overlay"))
rarch_cmd = RARCH_CMD_OVERLAY_REINIT;
else if (!strcmp(setting->name, "input_overlay_scale"))
rarch_cmd = RARCH_CMD_OVERLAY_SET_SCALE_FACTOR;
#endif
else if (!strcmp(setting->name, "video_refresh_rate_auto"))
{
if (driver.video && driver.video_data)
@ -2223,8 +2138,6 @@ static void general_write_handler(const void *data)
if (!g_settings.video.fullscreen)
rarch_cmd = RARCH_CMD_REINIT;
}
else if (!strcmp(setting->name, "aspect_ratio_index"))
rarch_cmd = RARCH_CMD_VIDEO_SET_ASPECT_RATIO;
else if (!strcmp(setting->name, "input_player1_joypad_index"))
g_settings.input.joypad_map[0] = *setting->value.integer;
else if (!strcmp(setting->name, "input_player2_joypad_index"))
@ -2235,12 +2148,6 @@ static void general_write_handler(const void *data)
g_settings.input.joypad_map[3] = *setting->value.integer;
else if (!strcmp(setting->name, "input_player5_joypad_index"))
g_settings.input.joypad_map[4] = *setting->value.integer;
else if (!strcmp(setting->name, "libretro_info_path"))
rarch_cmd = RARCH_CMD_CORE_INFO_INIT;
else if (!strcmp(setting->name, "libretro_dir_path"))
rarch_cmd = RARCH_CMD_CORE_INFO_INIT;
else if (!strcmp(setting->name, "video_filter"))
rarch_cmd = RARCH_CMD_REINIT;
#ifdef HAVE_NETPLAY
else if (!strcmp(setting->name, "netplay_ip_address"))
g_extern.has_set_netplay_ip_address = (setting->value.string[0] != '\0');
@ -2264,7 +2171,7 @@ static void general_write_handler(const void *data)
g_extern.has_set_verbosity = *setting->value.boolean;
}
if (rarch_cmd)
if (rarch_cmd || setting->cmd_trigger.triggered)
rarch_main_command(rarch_cmd);
}
@ -2317,6 +2224,8 @@ static void general_write_handler(const void *data)
#define WITH_VALUES(VALUES) (list[index -1]).values = VALUES;
#define WITH_CMD(VALUES) (list[index -1]).cmd_trigger.idx = VALUES;
#ifdef GEKKO
#define MAX_GAMMA_SETTING 2
#else
@ -2364,7 +2273,9 @@ rarch_setting_t *setting_data_get_mainmenu(bool regenerate)
CONFIG_BOOL(lists[3], "load_content", "Load Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[4], "core_options", "Core Options", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[5], "core_information", "Core Information", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
if (g_extern.main_is_init && !g_extern.libretro_dummy)
if (g_extern.main_is_init
&& !g_extern.libretro_dummy
&& g_extern.system.disk_control.get_num_images)
{
CONFIG_BOOL(lists[6], "disk_options", "Core Disk Options", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
}
@ -2375,19 +2286,19 @@ rarch_setting_t *setting_data_get_mainmenu(bool regenerate)
}
if (g_extern.main_is_init && !g_extern.libretro_dummy)
{
CONFIG_BOOL(lists[9], "savestate", "Save State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[10], "loadstate", "Load State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[11], "take_screenshot", "Take Screenshot", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[12], "resume_content", "Resume Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[13], "restart_content", "Restart Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[9], "savestate", "Save State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_EXIT) WITH_CMD(RARCH_CMD_SAVE_STATE)
CONFIG_BOOL(lists[10], "loadstate", "Load State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_EXIT) WITH_CMD(RARCH_CMD_LOAD_STATE)
CONFIG_BOOL(lists[11], "take_screenshot", "Take Screenshot", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION) WITH_CMD(RARCH_CMD_TAKE_SCREENSHOT)
CONFIG_BOOL(lists[12], "resume_content", "Resume Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION) WITH_FLAGS(SD_FLAG_EXIT) WITH_CMD(RARCH_CMD_RESUME)
CONFIG_BOOL(lists[13], "restart_content", "Restart Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION) WITH_FLAGS(SD_FLAG_EXIT) WITH_CMD(RARCH_CMD_RESET)
}
#ifndef HAVE_DYNAMIC
CONFIG_BOOL(lists[14], "restart_retroarch", "Restart RetroArch", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[14], "restart_retroarch", "Restart RetroArch", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION) WITH_CMD(RARCH_CMD_RESTART_RETROARCH)
#endif
CONFIG_BOOL(lists[15], "configurations", "Configurations", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(lists[16], "save_new_config", "Save New Config", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[16], "save_new_config", "Save New Config", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION) WITH_CMD(RARCH_CMD_MENU_SAVE_CONFIG)
CONFIG_BOOL(lists[17], "help", "Help", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[18], "quit_retroarch", "Quit RetroArch", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
CONFIG_BOOL(lists[18], "quit_retroarch", "Quit RetroArch", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION) WITH_CMD(RARCH_CMD_QUIT_RETROARCH)
END_SUB_GROUP()
END_GROUP()
@ -2459,16 +2370,16 @@ rarch_setting_t *setting_data_get_list(void)
CONFIG_BOOL(g_settings.core_specific_config, "core_specific_config", "Configuration Per-Core", default_core_specific_config, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(g_settings.load_dummy_on_core_shutdown, "dummy_on_core_shutdown", "Dummy On Core Shutdown", load_dummy_on_core_shutdown, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(g_settings.fps_show, "fps_show", "Show Framerate", fps_show, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(g_settings.rewind_enable, "rewind_enable", "Rewind", rewind_enable, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(g_settings.rewind_enable, "rewind_enable", "Rewind", rewind_enable, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_CMD(RARCH_CMD_REWIND) WITH_FLAGS(SD_FLAG_CMD_APPLY_AUTO)
#if 0
CONFIG_SIZE(g_settings.rewind_buffer_size, "rewind_buffer_size", "Rewind Buffer Size", rewind_buffer_size, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
#endif
CONFIG_UINT(g_settings.rewind_granularity, "rewind_granularity", "Rewind Granularity", rewind_granularity, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(1, 32768, 1, true, false)
CONFIG_BOOL(g_settings.block_sram_overwrite, "block_sram_overwrite", "SRAM Block overwrite", block_sram_overwrite, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
#ifdef HAVE_THREADS
CONFIG_UINT(g_settings.autosave_interval, "autosave_interval", "SRAM Autosave", autosave_interval, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 0, 10, true, false)
CONFIG_UINT(g_settings.autosave_interval, "autosave_interval", "SRAM Autosave", autosave_interval, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 0, 10, true, false) WITH_CMD(RARCH_CMD_AUTOSAVE) WITH_FLAGS(SD_FLAG_CMD_APPLY_AUTO)
#endif
CONFIG_BOOL(g_settings.video.disable_composition, "video_disable_composition", "Window Compositing Disable", disable_composition, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(g_settings.video.disable_composition, "video_disable_composition", "Window Compositing Disable", disable_composition, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_CMD(RARCH_CMD_REINIT) WITH_FLAGS(SD_FLAG_CMD_APPLY_AUTO)
CONFIG_BOOL(g_settings.pause_nonactive, "pause_nonactive", "Window Unfocus Pause", pause_nonactive, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_FLOAT(g_settings.fastforward_ratio, "fastforward_ratio", "Maximum Run Speed", fastforward_ratio, "%.1fx", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 10, 0.1, true, true)
CONFIG_FLOAT(g_settings.slowmotion_ratio, "slowmotion_ratio", "Slow-Motion Ratio", slowmotion_ratio, "%.1fx", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(1, 10, 1.0, true, true)
@ -2493,9 +2404,9 @@ rarch_setting_t *setting_data_get_list(void)
CONFIG_BOOL(g_settings.video.shared_context, "video_shared_context", "HW Shared Context Enable", false, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
END_SUB_GROUP()
START_SUB_GROUP("Monitor", GROUP_NAME)
CONFIG_UINT(g_settings.video.monitor_index, "video_monitor_index", "Monitor Index", monitor_index, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 1, 1, true, false)
CONFIG_UINT(g_settings.video.monitor_index, "video_monitor_index", "Monitor Index", monitor_index, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 1, 1, true, false) WITH_CMD(RARCH_CMD_REINIT)
#if !defined(RARCH_CONSOLE) && !defined(RARCH_MOBILE)
CONFIG_BOOL(g_settings.video.fullscreen, "video_fullscreen", "Use Fullscreen mode", fullscreen, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(g_settings.video.fullscreen, "video_fullscreen", "Use Fullscreen mode", fullscreen, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_CMD(RARCH_CMD_REINIT) WITH_FLAGS(SD_FLAG_CMD_APPLY_AUTO)
#endif
CONFIG_BOOL(g_settings.video.windowed_fullscreen, "video_windowed_fullscreen", "Windowed Fullscreen Mode", windowed_fullscreen, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_UINT(g_settings.video.fullscreen_x, "video_fullscreen_x", "Fullscreen Width", fullscreen_x, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
@ -2508,7 +2419,7 @@ rarch_setting_t *setting_data_get_list(void)
CONFIG_BOOL(g_settings.video.force_aspect, "video_force_aspect", "Force aspect ratio", force_aspect, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_FLOAT(g_settings.video.aspect_ratio, "video_aspect_ratio", "Aspect Ratio", aspect_ratio, "%.2f", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(g_settings.video.aspect_ratio_auto, "video_aspect_ratio_auto", "Use Auto Aspect Ratio", aspect_ratio_auto, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_UINT(g_settings.video.aspect_ratio_idx, "aspect_ratio_index", "Aspect Ratio Index", aspect_ratio_idx, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, LAST_ASPECT_RATIO, 1, true, true)
CONFIG_UINT(g_settings.video.aspect_ratio_idx, "aspect_ratio_index", "Aspect Ratio Index", aspect_ratio_idx, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, LAST_ASPECT_RATIO, 1, true, true) WITH_CMD(RARCH_CMD_VIDEO_SET_ASPECT_RATIO) WITH_FLAGS(SD_FLAG_CMD_APPLY_AUTO)
END_SUB_GROUP()
START_SUB_GROUP("Scaling", GROUP_NAME)
@ -2530,17 +2441,17 @@ rarch_setting_t *setting_data_get_list(void)
#endif
CONFIG_UINT(g_settings.video.rotation, "video_rotation", "Rotation", 0, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 3, 1, true, true)
#if defined(HW_RVL) || defined(_XBOX360)
CONFIG_UINT(g_extern.console.screen.gamma_correction, "video_gamma", "Gamma", 0, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, MAX_GAMMA_SETTING, 1, true, true)
CONFIG_UINT(g_extern.console.screen.gamma_correction, "video_gamma", "Gamma", 0, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, MAX_GAMMA_SETTING, 1, true, true) WITH_CMD(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES) WITH_FLAGS(SD_FLAG_CMD_APPLY_AUTO)
#endif
END_SUB_GROUP()
START_SUB_GROUP("Synchronization", GROUP_NAME)
#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE)
CONFIG_BOOL(g_settings.video.threaded, "video_threaded", "Threaded Video", video_threaded, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(g_settings.video.threaded, "video_threaded", "Threaded Video", video_threaded, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_CMD(RARCH_CMD_REINIT) WITH_FLAGS(SD_FLAG_CMD_APPLY_AUTO)
#endif
CONFIG_BOOL(g_settings.video.vsync, "video_vsync", "VSync", vsync, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_UINT(g_settings.video.swap_interval, "video_swap_interval", "VSync Swap Interval", swap_interval, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(1, 4, 1, true, true)
CONFIG_UINT(g_settings.video.swap_interval, "video_swap_interval", "VSync Swap Interval", swap_interval, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(1, 4, 1, true, true) WITH_CMD(RARCH_CMD_VIDEO_SET_BLOCKING_STATE) WITH_FLAGS(SD_FLAG_CMD_APPLY_AUTO)
CONFIG_BOOL(g_settings.video.hard_sync, "video_hard_sync", "Hard GPU Sync", hard_sync, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_UINT(g_settings.video.hard_sync_frames, "video_hard_sync_frames", "Hard GPU Sync Frames", hard_sync_frames, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 3, 1, true, true)
CONFIG_UINT(g_settings.video.frame_delay, "video_frame_delay", "Frame Delay", frame_delay, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 15, 1, true, true)
@ -2556,10 +2467,10 @@ rarch_setting_t *setting_data_get_list(void)
CONFIG_BOOL(g_settings.video.allow_rotate, "video_allow_rotate", "Allow rotation", allow_rotate, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(g_settings.video.crop_overscan, "video_crop_overscan", "Crop Overscan (reload)", crop_overscan, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
#ifndef HAVE_FILTERS_BUILTIN
CONFIG_PATH(g_settings.video.softfilter_plugin, "video_filter", "Software filter", g_settings.video.filter_dir, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY) WITH_VALUES("filt")
CONFIG_PATH(g_settings.video.softfilter_plugin, "video_filter", "Software filter", g_settings.video.filter_dir, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY) WITH_VALUES("filt") WITH_CMD(RARCH_CMD_REINIT)
#endif
#if defined(_XBOX1) || defined(HW_RVL)
CONFIG_BOOL(g_extern.console.softfilter_enable, "soft_filter", "Soft Filter Enable", false, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_BOOL(g_extern.console.softfilter_enable, "soft_filter", "Soft Filter Enable", false, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_CMD(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES)
#endif
#ifdef _XBOX1
CONFIG_UINT(g_settings.video.swap_interval, "video_filter_flicker", "Flicker filter", 0, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 5, 1, true, true)
@ -2606,7 +2517,7 @@ rarch_setting_t *setting_data_get_list(void)
START_SUB_GROUP("Miscellaneous", GROUP_NAME)
CONFIG_STRING(g_settings.audio.device, "audio_device", "Device", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_INPUT)
CONFIG_UINT(g_settings.audio.out_rate, "audio_out_rate", "Audio Output Rate", out_rate, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_PATH(g_settings.audio.dsp_plugin, "audio_dsp_plugin", "DSP Plugin", g_settings.audio.filter_dir, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY) WITH_VALUES("dsp")
CONFIG_PATH(g_settings.audio.dsp_plugin, "audio_dsp_plugin", "DSP Plugin", g_settings.audio.filter_dir, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY) WITH_VALUES("dsp") WITH_CMD(RARCH_CMD_DSP_FILTER_INIT)
END_SUB_GROUP()
END_GROUP()
@ -2677,9 +2588,9 @@ rarch_setting_t *setting_data_get_list(void)
#ifdef HAVE_OVERLAY
START_GROUP("Overlay Options")
START_SUB_GROUP("State", GROUP_NAME)
CONFIG_PATH(g_settings.input.overlay, "input_overlay", "Overlay Preset", g_extern.overlay_dir, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY) WITH_VALUES("cfg")
CONFIG_FLOAT(g_settings.input.overlay_opacity, "input_overlay_opacity", "Overlay Opacity", 0.7f, "%.2f", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 1, 0.01, true, true)
CONFIG_FLOAT(g_settings.input.overlay_scale, "input_overlay_scale", "Overlay Scale", 1.0f, "%.2f", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 2, 0.01, true, true)
CONFIG_PATH(g_settings.input.overlay, "input_overlay", "Overlay Preset", g_extern.overlay_dir, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY) WITH_VALUES("cfg") WITH_CMD(RARCH_CMD_OVERLAY_REINIT)
CONFIG_FLOAT(g_settings.input.overlay_opacity, "input_overlay_opacity", "Overlay Opacity", 0.7f, "%.2f", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 1, 0.01, true, true) WITH_CMD(RARCH_CMD_OVERLAY_SET_ALPHA_MOD) WITH_FLAGS(SD_FLAG_CMD_APPLY_AUTO)
CONFIG_FLOAT(g_settings.input.overlay_scale, "input_overlay_scale", "Overlay Scale", 1.0f, "%.2f", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 2, 0.01, true, true) WITH_CMD(RARCH_CMD_OVERLAY_SET_SCALE_FACTOR) WITH_FLAGS(SD_FLAG_CMD_APPLY_AUTO)
END_SUB_GROUP()
END_GROUP()
#endif
@ -2722,8 +2633,8 @@ rarch_setting_t *setting_data_get_list(void)
#endif
CONFIG_PATH(g_settings.libretro, "libretro_path", "Libretro Path", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
CONFIG_DIR(g_settings.libretro_directory, "libretro_dir_path", "Core Directory", g_defaults.core_dir, "<None>", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
CONFIG_DIR(g_settings.libretro_info_path, "libretro_info_path", "Core Info Directory", g_defaults.core_info_dir, "<None>", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
CONFIG_DIR(g_settings.libretro_directory, "libretro_dir_path", "Core Directory", g_defaults.core_dir, "<None>", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR) WITH_CMD(RARCH_CMD_CORE_INFO_INIT)
CONFIG_DIR(g_settings.libretro_info_path, "libretro_info_path", "Core Info Directory", g_defaults.core_info_dir, "<None>", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR) WITH_CMD(RARCH_CMD_CORE_INFO_INIT)
CONFIG_PATH(g_settings.core_options_path, "core_options_path", "Core Options Path", "", "Paths", SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
CONFIG_PATH(g_settings.cheat_database, "cheat_database_path", "Cheat Database", "", "Paths", SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
CONFIG_PATH(g_settings.cheat_settings_path, "cheat_settings_path", "Cheat Settings", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY)
@ -2740,6 +2651,7 @@ rarch_setting_t *setting_data_get_list(void)
#endif
CONFIG_DIR(g_settings.screenshot_directory, "screenshot_directory", "Screenshot Directory", "", "<Content dir>", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
CONFIG_DIR(g_settings.input.autoconfig_dir, "joypad_autoconfig_dir", "Joypad Autoconfig Directory", "", "<default>", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
CONFIG_DIR(g_settings.playlist_directory, "playlist_directory", "Playlist Directory", "", "<default>", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR)
CONFIG_DIR(g_extern.savefile_dir, "savefile_directory", "Savefile Directory", "", "<Content dir>", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler);
CONFIG_DIR(g_extern.savestate_dir, "savestate_directory", "Savestate Directory", "", "<Content dir>", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
CONFIG_DIR(g_settings.system_directory, "system_directory", "System Directory", "", "<Content dir>", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)

View File

@ -23,7 +23,7 @@
extern "C" {
#endif
typedef void (*change_handler_t)(const void *data);
typedef void (*change_handler_t)(void *data);
#define BINDFOR(s) (*(&(s))->value.keybind)
@ -47,14 +47,16 @@ enum setting_type
enum setting_flags
{
SD_FLAG_PATH_DIR = (1 << 0),
SD_FLAG_PATH_FILE = (1 << 1),
SD_FLAG_ALLOW_EMPTY = (1 << 2),
SD_FLAG_VALUE_DESC = (1 << 3),
SD_FLAG_HAS_RANGE = (1 << 4),
SD_FLAG_ALLOW_INPUT = (1 << 5),
SD_FLAG_PUSH_ACTION = (1 << 6),
SD_FLAG_IS_DRIVER = (1 << 7),
SD_FLAG_PATH_DIR = (1 << 0),
SD_FLAG_PATH_FILE = (1 << 1),
SD_FLAG_ALLOW_EMPTY = (1 << 2),
SD_FLAG_VALUE_DESC = (1 << 3),
SD_FLAG_HAS_RANGE = (1 << 4),
SD_FLAG_ALLOW_INPUT = (1 << 5),
SD_FLAG_PUSH_ACTION = (1 << 6),
SD_FLAG_IS_DRIVER = (1 << 7),
SD_FLAG_EXIT = (1 << 8),
SD_FLAG_CMD_APPLY_AUTO = (1 << 9),
};
typedef struct rarch_setting_t
@ -104,6 +106,12 @@ typedef struct rarch_setting_t
const char *empty_path;
} dir;
struct
{
unsigned idx;
bool triggered;
} cmd_trigger;
struct
{
const char *off_label;
@ -116,19 +124,19 @@ typedef struct rarch_setting_t
bool enforce_maxrange;
} rarch_setting_t;
void setting_data_reset_setting(const rarch_setting_t* setting);
void setting_data_reset(const rarch_setting_t* settings);
void setting_data_reset_setting(rarch_setting_t* setting);
void setting_data_reset(rarch_setting_t* settings);
bool setting_data_load_config_path(const rarch_setting_t* settings,
bool setting_data_load_config_path(rarch_setting_t* settings,
const char* path);
bool setting_data_save_config(const rarch_setting_t* settings,
bool setting_data_save_config(rarch_setting_t* settings,
config_file_t* config);
rarch_setting_t* setting_data_find_setting(rarch_setting_t* settings,
const char* name);
void setting_data_set_with_string_representation(
const rarch_setting_t* setting, const char* value);
rarch_setting_t* setting, const char* value);
void setting_data_get_string_representation(rarch_setting_t* setting,
char* buf, size_t sizeof_buf);

View File

@ -86,13 +86,16 @@ typedef int pthread_attr_t;
typedef cond_t pthread_cond_t;
typedef cond_t pthread_condattr_t;
static inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
static inline int pthread_create(pthread_t *thread,
const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
{
*thread = 0;
return OSCreateThread(thread, start_routine, 0 /* unused */, arg, 0, STACKSIZE, 64, 0 /* unused */);
return OSCreateThread(thread, start_routine, 0 /* unused */, arg,
0, STACKSIZE, 64, 0 /* unused */);
}
static inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
static inline int pthread_mutex_init(pthread_mutex_t *mutex,
const pthread_mutexattr_t *attr)
{
return OSInitMutex(mutex);
}
@ -135,17 +138,20 @@ static inline int pthread_mutex_trylock(pthread_mutex_t *mutex)
return OSTryLockMutex(*mutex);
}
static inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
static inline int pthread_cond_wait(pthread_cond_t *cond,
pthread_mutex_t *mutex)
{
return OSWaitCond(*cond, *mutex);
}
static inline int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
static inline int pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex, const struct timespec *abstime)
{
return LWP_CondTimedWait(*cond, *mutex, abstime);
}
static inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
static inline int pthread_cond_init(pthread_cond_t *cond,
const pthread_condattr_t *attr)
{
return OSInitCond(cond);
}

View File

@ -33,7 +33,7 @@ typedef int pthread_attr_t;
typedef SceUID pthread_cond_t;
typedef SceUID pthread_condattr_t;
// use pointer values to create unique names for threads/mutexes
/* Use pointer values to create unique names for threads/mutexes */
char name_buffer[256];
typedef void* (*sthreadEntry)(void *argp);
@ -52,11 +52,13 @@ static int psp_thread_wrap(SceSize args, void *argp)
return (int)sthread_args->start_routine(sthread_args->arg);
}
static inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
static inline int pthread_create(pthread_t *thread,
const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
{
sprintf(name_buffer, "0x%08X", (uint32_t) thread);
*thread = sceKernelCreateThread(name_buffer,psp_thread_wrap, 0x20, STACKSIZE, 0, NULL);
*thread = sceKernelCreateThread(name_buffer,
psp_thread_wrap, 0x20, STACKSIZE, 0, NULL);
sthread_args_struct sthread_args;
sthread_args.arg = arg;
@ -65,7 +67,8 @@ static inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
return sceKernelStartThread(*thread, sizeof(sthread_args), &sthread_args);
}
static inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
static inline int pthread_mutex_init(pthread_mutex_t *mutex,
const pthread_mutexattr_t *attr)
{
sprintf(name_buffer, "0x%08X", (uint32_t) mutex);
@ -105,19 +108,22 @@ static inline int pthread_mutex_trylock(pthread_mutex_t *mutex)
return 1;
}
static inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
static inline int pthread_cond_wait(pthread_cond_t *cond,
pthread_mutex_t *mutex)
{
sceKernelDelayThread(10000);
return 1;
}
static inline int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
static inline int pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex, const struct timespec *abstime)
{
//FIXME: stub
return 1;
}
static inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
static inline int pthread_cond_init(pthread_cond_t *cond,
const pthread_condattr_t *attr)
{
//FIXME: stub
return 1;

View File

@ -27,8 +27,10 @@
#include <assert.h>
#include "../compat/posix_string.h"
// Need to be present for build to work, but it's not *really* used.
// Better than having to build special versions of lots of objects with special #ifdefs.
/* Need to be present for build to work, but it's not *really* used.
* Better than having to build special versions of lots of objects
* with special #ifdefs.
*/
struct settings g_settings;
struct global g_extern;
driver_t driver;
@ -100,7 +102,8 @@ static void poll_joypad(const rarch_joypad_driver_t *driver,
}
}
static void get_binds(config_file_t *conf, config_file_t *auto_conf, int player, int joypad)
static void get_binds(config_file_t *conf, config_file_t *auto_conf,
int player, int joypad)
{
int i, timeout_cnt;
const rarch_joypad_driver_t *driver = input_joypad_init_driver(g_driver);
@ -146,9 +149,13 @@ static void get_binds(config_file_t *conf, config_file_t *auto_conf, int player,
if (abs(initial) < 20000)
initial = 0;
// Certain joypads (such as XBox360 controller on Linux) has a default negative axis for shoulder triggers,
// which makes configuration very awkward.
// If default negative, we can't trigger on the negative axis, and similar with defaulted positive axes.
/* Certain joypads (such as XBox360 controller on Linux)
* has a default negative axis for shoulder triggers,
* which makes configuration very awkward.
*
* If default negative, we can't trigger on the negative axis,
* and similar with defaulted positive axes.
*/
if (initial)
fprintf(stderr, "Axis %d is defaulted to %s axis value of %d.\n", i, initial > 0 ? "positive" : "negative", initial);
@ -183,9 +190,10 @@ static void get_binds(config_file_t *conf, config_file_t *auto_conf, int player,
{
old_poll = new_poll;
// To avoid pegging CPU.
// Ideally use an event-based joypad scheme,
// but it adds far more complexity, so, meh.
/* To avoid pegging CPU.
* Ideally use an event-based joypad scheme,
* but it adds far more complexity, so, meh.
*/
rarch_sleep(10);
if (timeout_ticks)
@ -206,7 +214,9 @@ static void get_binds(config_file_t *conf, config_file_t *auto_conf, int player,
fprintf(stderr, "\tJoybutton pressed: %d\n", j);
char key[64];
snprintf(key, sizeof(key), "%s_%s_btn",
input_config_get_prefix(player_index, input_config_bind_map[i].meta), input_config_bind_map[i].base);
input_config_get_prefix(player_index,
input_config_bind_map[i].meta),
input_config_bind_map[i].base);
config_set_int(conf, key, j);
if (auto_conf)
@ -230,7 +240,8 @@ static void get_binds(config_file_t *conf, config_file_t *auto_conf, int player,
bool require_negative = initial_axes[j] > 0;
bool require_positive = initial_axes[j] < 0;
// Block the axis config until we're sure axes have returned to their neutral state.
/* Block the axis config until we're sure
* axes have returned to their neutral state. */
if (same_axis)
{
if (abs(value) < 10000 ||
@ -239,7 +250,8 @@ static void get_binds(config_file_t *conf, config_file_t *auto_conf, int player,
block_axis = false;
}
// If axes are in their neutral state, we can't allow it.
/* If axes are in their neutral state,
* we can't allow it. */
if (require_negative && value >= 0)
continue;
if (require_positive && value <= 0)
@ -251,7 +263,8 @@ static void get_binds(config_file_t *conf, config_file_t *auto_conf, int player,
if (abs(value) > 20000)
{
last_axis = j;
fprintf(stderr, "\tJoyaxis moved: Axis %d, Value %d\n", j, value);
fprintf(stderr, "\tJoyaxis moved: Axis %d, Value %d\n",
j, value);
char buf[8];
snprintf(buf, sizeof(buf),
@ -259,7 +272,9 @@ static void get_binds(config_file_t *conf, config_file_t *auto_conf, int player,
char key[64];
snprintf(key, sizeof(key), "%s_%s_axis",
input_config_get_prefix(player_index, input_config_bind_map[i].meta), input_config_bind_map[i].base);
input_config_get_prefix(player_index,
input_config_bind_map[i].meta),
input_config_bind_map[i].base);
config_set_string(conf, key, buf);
@ -298,7 +313,9 @@ static void get_binds(config_file_t *conf, config_file_t *auto_conf, int player,
char key[64];
snprintf(key, sizeof(key), "%s_%s_btn",
input_config_get_prefix(player_index, input_config_bind_map[i].meta), input_config_bind_map[i].base);
input_config_get_prefix(player_index,
input_config_bind_map[i].meta),
input_config_bind_map[i].base);
config_set_string(conf, key, buf);
@ -394,7 +411,8 @@ static void parse_input(int argc, char *argv[])
}
else if (g_player > MAX_PLAYERS)
{
fprintf(stderr, "Player number must be from 1 to %d.\n", MAX_PLAYERS);
fprintf(stderr, "Player number must be from 1 to %d.\n",
MAX_PLAYERS);
exit(1);
}
break;

View File

@ -73,15 +73,20 @@ bool gx_init_mem2(void)
u32 level;
_CPU_ISR_Disable(level);
// BIG NOTE: MEM2 on the Wii is 64MB, but a portion of that is reserved for
// IOS. libogc by default defines the "safe" area for MEM2 to go from
// 0x90002000 to 0x933E0000. However, from my testing, I've found I need to
// reserve about 256KB for stuff like network and USB to work correctly.
// However, other sources says these functions need at least 0xE0000 bytes,
// 7/8 of a megabyte, of reserved memory to do this. My initial testing
// shows that we can work with only 128KB, but we use 256KB becuse testing
// has shown some stuff being iffy with only 128KB, mainly wiimote stuff.
// If some stuff mysteriously stops working, try fiddling with this size.
/* BIG NOTE: MEM2 on the Wii is 64MB, but a portion
* of that is reserved for IOS.
*
* libogc by default defines the "safe" area for MEM2
* to go from 0x90002000 to 0x933E0000.
*
* However, from my testing, I've found I need to
* reserve about 256KB for stuff like network and USB to work correctly.
* However, other sources says these functions need at least 0xE0000 bytes,
* 7/8 of a megabyte, of reserved memory to do this. My initial testing
* shows that we can work with only 128KB, but we use 256KB becuse testing
* has shown some stuff being iffy with only 128KB, mainly Wiimote stuff.
* If some stuff mysteriously stops working, try fiddling with this size.
*/
u32 size = SYS_GetArena2Size() - 1024 * 256;
void *heap_ptr = (void *) ROUNDUP32(((u32) SYS_GetArena2Hi() - size));
@ -94,17 +99,9 @@ bool gx_init_mem2(void)
void *_mem2_memalign(u8 align, u32 size)
{
void *ptr;
if(size == 0)
return NULL;
ptr = __lwp_heap_allocate(&gx_mem2_heap, size);
if (ptr == NULL)
return NULL;
return ptr;
if(size != 0)
return __lwp_heap_allocate(&gx_mem2_heap, size);
return NULL;
}
void *_mem2_malloc(u32 size)
@ -114,10 +111,8 @@ void *_mem2_malloc(u32 size)
void _mem2_free(void *ptr)
{
if(!ptr)
return;
__lwp_heap_free(&gx_mem2_heap, ptr);
if(ptr)
__lwp_heap_free(&gx_mem2_heap, ptr);
}
void *_mem2_realloc(void *ptr, u32 newsize)
@ -246,7 +241,7 @@ __attribute__ ((used)) void __wrap_free(void *p)
__attribute__ ((used)) void *__wrap_realloc(void *p, size_t size)
{
void *n;
// ptr from mem2
/* ptr from mem2 */
if (((u32) p & 0x10000000) != 0)
{
n = _mem2_realloc(p, size);