From efc78f0ee150b1801198d965cf80e5d019fd6e7e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 07:25:25 +0200 Subject: [PATCH 001/120] Turn off logging spam --- menu/menu_entries_cbs_ok.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index 0e700dd8bd..1a7b7cd221 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -1231,7 +1231,9 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs, if (!menu) return; +#if 0 RARCH_LOG("path: %s, label: %s, elem0 : %s, elem1: %s\n", path, label, elem0, elem1); +#endif cbs->action_ok = action_ok_lookup_setting; From 946193446d75de53d4934ac7bee1c2c304fc79ae Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Wed, 15 Apr 2015 07:34:22 +0200 Subject: [PATCH 002/120] (iOS) Move buffer swap to actual buffer swap function --- apple/iOS/platform.m | 14 +++++++------- gfx/drivers_context/apple_cocoa_gl.m | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index 81c8b28531..42e53abbd2 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -55,9 +55,6 @@ static void rarch_draw(CFRunLoopObserverRef observer, CFRunLoopActivity activity if (runloop->is_idle) return; - - if (g_view) - [g_view display]; CFRunLoopWakeUp(CFRunLoopGetMain()); } @@ -354,10 +351,13 @@ enum - (IBAction)showPauseMenu:(id)sender { runloop_t *runloop = rarch_main_get_ptr(); - - runloop->is_paused = true; - runloop->is_idle = true; - runloop->ui_companion_is_on_foreground = true; + + if (runloop) + { + runloop->is_paused = true; + runloop->is_idle = true; + runloop->ui_companion_is_on_foreground = true; + } [[UIApplication sharedApplication] setStatusBarHidden:false withAnimation:UIStatusBarAnimationNone]; [[UIApplication sharedApplication] setIdleTimerDisabled:false]; diff --git a/gfx/drivers_context/apple_cocoa_gl.m b/gfx/drivers_context/apple_cocoa_gl.m index fcd621441d..9a3cdd4d95 100644 --- a/gfx/drivers_context/apple_cocoa_gl.m +++ b/gfx/drivers_context/apple_cocoa_gl.m @@ -427,13 +427,16 @@ static void apple_gfx_ctx_swap_buffers(void *data) if (!(--g_fast_forward_skips < 0)) return; -#ifdef OSX +#if defined(OSX) #ifdef HAVE_NSOPENGL [g_context flushBuffer]; #else if (g_context.CGLContextObj) CGLFlushDrawable(g_context.CGLContextObj); #endif +#elif defined(IOS) + if (g_view) + [g_view display]; #endif g_fast_forward_skips = g_is_syncing ? 0 : 3; From eeb28dc4fbfb84d4e45271138ae3a3e33bf69a0d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 07:37:14 +0200 Subject: [PATCH 003/120] Revert "Don't hide 'Quit RetroArch' for iOS" This reverts commit fdc74d95a81950f2112bb6a5d9bfe9ab711b3f02. --- settings.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/settings.c b/settings.c index 9def82af2f..4e5c276afe 100644 --- a/settings.c +++ b/settings.c @@ -3437,12 +3437,16 @@ static bool setting_append_list_main_menu_options( group_info.name, subgroup_info.name); + +#if !defined(IOS) + /* Apple rejects iOS apps that lets you forcibly quit an application. */ CONFIG_ACTION( "quit_retroarch", "Quit RetroArch", group_info.name, subgroup_info.name); settings_list_current_add_cmd(list, list_info, EVENT_CMD_QUIT_RETROARCH); +#endif END_SUB_GROUP(list, list_info); END_GROUP(list, list_info); From da56cb3071c72219e3e557aeb3d038d450376de1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 15 Apr 2015 03:08:57 -0400 Subject: [PATCH 004/120] dinput: Return NULL instead of false for dinput_get_joypad_driver --- input/drivers/dinput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/input/drivers/dinput.c b/input/drivers/dinput.c index e508b11aff..f1a9b8d41a 100644 --- a/input/drivers/dinput.c +++ b/input/drivers/dinput.c @@ -655,7 +655,7 @@ static const input_device_driver_t *dinput_get_joypad_driver(void *data) { struct dinput_input *di = (struct dinput_input*)data; if (!di) - return false; + return NULL; return di->joypad; } From 9c2193f9154a7a3ddb69c6656606bf06411407e2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 09:18:30 +0200 Subject: [PATCH 005/120] Start adding record_config setting --- menu/menu_entries_cbs_ok.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index 1a7b7cd221..98941fbc7b 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -327,6 +327,21 @@ static int action_ok_remap_file(const char *path, label, type, idx); } +static int action_ok_record_configfile(const char *path, + const char *label, unsigned type, size_t idx) +{ + menu_handle_t *menu = menu_driver_get_ptr(); + global_t *global = global_get_ptr(); + + if (!menu) + return -1; + + return menu_list_push_stack_refresh( + menu->menu_list, + global->recording.config_dir, + label, type, idx); +} + static int action_ok_core_list(const char *path, const char *label, unsigned type, size_t idx) { @@ -1289,6 +1304,8 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs, cbs->action_ok = action_ok_video_filter; else if (!strcmp(label, "remap_file_load")) cbs->action_ok = action_ok_remap_file; + else if (!strcmp(label, "record_config")) + cbs->action_ok = action_ok_record_configfile; else if (!strcmp(label, "core_updater_list")) cbs->action_ok = action_ok_core_updater_list; else if (!strcmp(label, "video_shader_parameters") || From fff8ef3db75795f22342bfce6f01b4cd8d722bae Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 15 Apr 2015 03:22:27 -0400 Subject: [PATCH 006/120] libusb_hid: Fix a potential memory leak --- input/drivers_hid/libusb_hid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/input/drivers_hid/libusb_hid.c b/input/drivers_hid/libusb_hid.c index 33fad45cad..6cb99542a7 100644 --- a/input/drivers_hid/libusb_hid.c +++ b/input/drivers_hid/libusb_hid.c @@ -188,6 +188,7 @@ static int add_adapter(void *data, struct libusb_device *dev) if (!adapter || !hid) { + free(adapter); fprintf(stderr, "Allocation of adapter failed.\n"); return -1; } From c2f659fb68c7945bcc8682e16d913c5810db97cd Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 09:25:09 +0200 Subject: [PATCH 007/120] Add 'Recording Settings' to menu_entries_common_is_settings_entry --- menu/menu_entries_cbs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/menu/menu_entries_cbs.c b/menu/menu_entries_cbs.c index 5280010756..abdcee0574 100644 --- a/menu/menu_entries_cbs.c +++ b/menu/menu_entries_cbs.c @@ -138,6 +138,7 @@ int menu_entries_common_is_settings_entry(const char *label) !strcmp(label, "Driver Settings") || !strcmp(label, "General Settings") || !strcmp(label, "Video Settings") || + !strcmp(label, "Recording Settings") || !strcmp(label, "Shader Settings") || !strcmp(label, "Font Settings") || !strcmp(label, "Audio Settings") || From 7f17f340c0a0e1e4cfee8d77d7107ca57fcd6416 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 09:35:48 +0200 Subject: [PATCH 008/120] (Menu) Cleanup --- menu/menu_entries_cbs.c | 7 ------- menu/menu_entries_cbs_ok.c | 3 ++- menu/menu_input.c | 5 ++++- menu/menu_setting.h | 3 --- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/menu/menu_entries_cbs.c b/menu/menu_entries_cbs.c index abdcee0574..69a174ce9c 100644 --- a/menu/menu_entries_cbs.c +++ b/menu/menu_entries_cbs.c @@ -39,13 +39,6 @@ void menu_entries_common_load_content(bool persist) menu->msg_force = true; } -int menu_action_setting_set_current_string( - rarch_setting_t *setting, const char *str) -{ - strlcpy(setting->value.string, str, setting->size); - return menu_setting_generic(setting); -} - #ifdef HAVE_NETWORKING /* HACK - we have to find some way to pass state inbetween * function pointer callback functions that don't necessarily diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index 98941fbc7b..afdf9c90a5 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -608,7 +608,8 @@ static int action_ok_path_use_directory(const char *path, if (setting->type != ST_DIR) return -1; - menu_action_setting_set_current_string(setting, menu_path); + strlcpy(setting->value.string, menu_path, setting->size); + menu_setting_generic(setting); menu_list_pop_stack_by_needle(menu->menu_list, setting->name); return 0; diff --git a/menu/menu_input.c b/menu/menu_input.c index ff3c3b6a15..0e3111bd52 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -134,7 +134,10 @@ void menu_input_st_string_callback(void *userdata, const char *str) if ((current_setting = (rarch_setting_t*) setting_find_setting( menu->list_settings, menu->keyboard.label_setting))) - menu_action_setting_set_current_string(current_setting, str); + { + strlcpy(current_setting->value.string, str, current_setting->size); + menu_setting_generic(current_setting); + } else { if (!strcmp(menu->keyboard.label_setting, "video_shader_preset_save_as")) diff --git a/menu/menu_setting.h b/menu/menu_setting.h index 3837424e17..874f8f8d3c 100644 --- a/menu/menu_setting.h +++ b/menu/menu_setting.h @@ -27,9 +27,6 @@ int menu_setting_generic(rarch_setting_t *setting); int menu_setting_handler(rarch_setting_t *setting, unsigned action); -int menu_action_setting_set_current_string( - rarch_setting_t *setting, const char *str); - int menu_setting_set(unsigned type, const char *label, unsigned action, bool wraparound); From 5b6030c2c7ab82daec137acd3b6c9e08fc3bdb77 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 09:48:13 +0200 Subject: [PATCH 009/120] (Core Updater) Cleanup global variables --- menu/menu_entries_cbs_deferred_push.c | 6 +----- menu/menu_entries_cbs_ok.c | 8 -------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 2245ce1c91..c3219f2ea5 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -1550,9 +1550,6 @@ static void print_buf_lines(file_list_t *list, char *buf, int buf_size, /* HACK - we have to find some way to pass state inbetween * function pointer callback functions that don't necessarily * call each other. */ -extern char core_updater_list_path[PATH_MAX_LENGTH]; -extern char core_updater_list_label[PATH_MAX_LENGTH]; -extern unsigned core_updater_list_type; static char *core_buf; static size_t core_len; @@ -1590,8 +1587,7 @@ static int deferred_push_core_updater_list(void *data, void *userdata, if (core_buf) free(core_buf); - menu_list_populate_generic(list, core_updater_list_path, - core_updater_list_label, core_updater_list_type); + menu_list_populate_generic(list, path, label, type); return 0; } diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index afdf9c90a5..da16225ac2 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -27,9 +27,6 @@ #include "../input/input_remapping.h" /* FIXME - Global variables, refactor */ -char core_updater_list_path[PATH_MAX_LENGTH]; -char core_updater_list_label[PATH_MAX_LENGTH]; -unsigned core_updater_list_type; unsigned rdb_entry_start_game_selection_ptr; size_t hack_shader_pass = 0; #ifdef HAVE_NETWORKING @@ -288,11 +285,6 @@ static int action_ok_core_updater_list(const char *path, driver->menu->nonblocking_refresh = true; (void)url_path; -#ifdef HAVE_NETWORKING - strlcpy(core_updater_list_path, path, sizeof(core_updater_list_path)); - strlcpy(core_updater_list_label, label, sizeof(core_updater_list_label)); - core_updater_list_type = type; -#endif if (settings->network.buildbot_url[0] == '\0') return -1; From ee3442b9620207a338c7039186692ebf4f931f5e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 09:55:23 +0200 Subject: [PATCH 010/120] Fix crash when toggling menu switch when we're in 'Core Updater' screen --- menu/menu_entries_cbs_deferred_push.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index c3219f2ea5..bb3d39061c 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -1563,6 +1563,9 @@ int cb_core_updater_list(void *data_, size_t len) if (!data) return -1; + if (core_buf) + free(core_buf); + core_buf = (char*)malloc(len * sizeof(char)); if (!core_buf) @@ -1584,9 +1587,6 @@ static int deferred_push_core_updater_list(void *data, void *userdata, print_buf_lines(list, core_buf, core_len, MENU_FILE_DOWNLOAD_CORE); - if (core_buf) - free(core_buf); - menu_list_populate_generic(list, path, label, type); return 0; From 3717414e2e522b8367a9f0f5e344cdb1652c2507 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 10:55:23 +0200 Subject: [PATCH 011/120] Setting recordings from the menu works now --- menu/menu.h | 1 + menu/menu_entries_cbs_deferred_push.c | 9 +++++++++ menu/menu_entries_cbs_ok.c | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/menu/menu.h b/menu/menu.h index a457cd0c7c..81e35cbb4d 100644 --- a/menu/menu.h +++ b/menu/menu.h @@ -87,6 +87,7 @@ typedef enum MENU_FILE_RDB, MENU_FILE_RDB_ENTRY, MENU_FILE_CURSOR, + MENU_FILE_RECORD_CONFIG, MENU_SETTINGS, MENU_SETTING_DRIVER, MENU_SETTING_ACTION, diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index bb3d39061c..768cd2389d 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -1759,6 +1759,13 @@ static int deferred_push_remap_file_load(void *data, void *userdata, MENU_FILE_REMAP, "rmp", NULL); } +static int deferred_push_record_configfile(void *data, void *userdata, + const char *path, const char *label, unsigned type) +{ + return menu_entries_parse_list((file_list_t*)data, (file_list_t*)userdata, path, label, type, + MENU_FILE_RECORD_CONFIG, "cfg", NULL); +} + static int deferred_push_input_overlay(void *data, void *userdata, const char *path, const char *label, unsigned type) { @@ -1871,6 +1878,8 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs, cbs->action_deferred_push = deferred_push_cheat_file_load; else if (!strcmp(label, "remap_file_load")) cbs->action_deferred_push = deferred_push_remap_file_load; + else if (!strcmp(label, "record_config")) + cbs->action_deferred_push = deferred_push_record_configfile; else if (!strcmp(label, "content_actions")) cbs->action_deferred_push = deferred_push_content_actions; else if (!strcmp(label, "shader_options")) diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index da16225ac2..7c78468f15 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -349,6 +349,25 @@ static int action_ok_core_list(const char *path, label, type, idx); } +static int action_ok_record_configfile_load(const char *path, + const char *label, unsigned type, size_t idx) +{ + const char *menu_path = NULL; + char record_configpath[PATH_MAX_LENGTH]; + global_t *global = global_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); + if (!menu || !global) + return -1; + + menu_list_get_last_stack(menu->menu_list, &menu_path, NULL, + NULL); + + fill_pathname_join(global->record.config, menu_path, path, sizeof(global->record.config)); + + menu_list_flush_stack_by_needle(menu->menu_list, "Recording Settings"); + return 0; +} + static int action_ok_remap_file_load(const char *path, const char *label, unsigned type, size_t idx) { @@ -1371,6 +1390,9 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs, case MENU_FILE_CHEAT: cbs->action_ok = action_ok_cheat_file_load; break; + case MENU_FILE_RECORD_CONFIG: + cbs->action_ok = action_ok_record_configfile_load; + break; case MENU_FILE_REMAP: cbs->action_ok = action_ok_remap_file_load; break; From 23b9a3ee47a1df5d83909ff30b9d58aa8c5c5380 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 12:42:36 +0200 Subject: [PATCH 012/120] Add 'use_output_directory' --- configuration.c | 12 ++++++------ menu/menu_entries_cbs_ok.c | 2 +- record/record_driver.c | 11 ++++++++++- runloop.h | 8 +++----- settings.c | 16 ++++++++++++++-- 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/configuration.c b/configuration.c index 4b3fd54712..3099a4375c 100644 --- a/configuration.c +++ b/configuration.c @@ -633,8 +633,8 @@ static void config_set_defaults(void) if (!global->has_set_ips_pref) global->ips_pref = false; - *global->recording.output_dir = '\0'; - *global->recording.config_dir = '\0'; + *global->record.output_dir = '\0'; + *global->record.config_dir = '\0'; *settings->core_options_path = '\0'; *settings->content_history_path = '\0'; @@ -1420,8 +1420,8 @@ static bool config_load_file(const char *path, bool set_defaults) CONFIG_GET_INT_BASE(conf, settings, archive.mode, "archive_mode"); - config_get_path(conf, "recording_output_directory", global->recording.output_dir, sizeof(global->recording.output_dir)); - config_get_path(conf, "recording_config_directory", global->recording.config_dir, sizeof(global->recording.config_dir)); + config_get_path(conf, "recording_output_directory", global->record.output_dir, sizeof(global->record.output_dir)); + config_get_path(conf, "recording_config_directory", global->record.config_dir, sizeof(global->record.config_dir)); #ifdef HAVE_OVERLAY config_get_path(conf, "overlay_directory", global->overlay_dir, sizeof(global->overlay_dir)); @@ -2176,8 +2176,8 @@ bool config_save_file(const char *path) config_set_path(conf, "libretro_path", settings->libretro); config_set_path(conf, "core_options_path", settings->core_options_path); - config_set_path(conf, "recording_output_directory", global->recording.output_dir); - config_set_path(conf, "recording_config_directory", global->recording.config_dir); + config_set_path(conf, "recording_output_directory", global->record.output_dir); + config_set_path(conf, "recording_config_directory", global->record.config_dir); config_set_bool(conf, "suspend_screensaver_enable", settings->ui.suspend_screensaver_enable); config_set_path(conf, "libretro_directory", settings->libretro_directory); diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index 7c78468f15..f1bb220843 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -330,7 +330,7 @@ static int action_ok_record_configfile(const char *path, return menu_list_push_stack_refresh( menu->menu_list, - global->recording.config_dir, + global->record.config_dir, label, type, idx); } diff --git a/record/record_driver.c b/record/record_driver.c index 61c71a5a78..c6083c8e34 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -15,6 +15,7 @@ */ #include +#include #include "record_driver.h" #include "../driver.h" @@ -183,6 +184,7 @@ bool recording_deinit(void) **/ bool recording_init(void) { + char recording_file[PATH_MAX_LENGTH]; struct ffemu_params params = {0}; global_t *global = global_get_ptr(); driver_t *driver = driver_get_ptr(); @@ -209,12 +211,19 @@ bool recording_init(void) (float)global->system.av_info.timing.fps, (float)global->system.av_info.timing.sample_rate); + strlcpy(recording_file, global->record.path, sizeof(recording_file)); + + if (global->record.use_output_dir) + fill_pathname_join(recording_file, + global->record.output_dir, + global->record.path, sizeof(recording_file)); + params.out_width = info->geometry.base_width; params.out_height = info->geometry.base_height; params.fb_width = info->geometry.max_width; params.fb_height = info->geometry.max_height; params.channels = 2; - params.filename = global->record.path; + params.filename = recording_file; params.fps = global->system.av_info.timing.fps; params.samplerate = global->system.av_info.timing.sample_rate; params.pix_fmt = (global->system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888) ? diff --git a/runloop.h b/runloop.h index 0619cf91f7..843d376caa 100644 --- a/runloop.h +++ b/runloop.h @@ -192,11 +192,6 @@ typedef struct global unsigned windowed_scale; } pending; - struct - { - char output_dir[PATH_MAX_LENGTH]; - char config_dir[PATH_MAX_LENGTH]; - } recording; struct { @@ -348,6 +343,9 @@ typedef struct global uint8_t *gpu_buffer; size_t gpu_width; size_t gpu_height; + char output_dir[PATH_MAX_LENGTH]; + char config_dir[PATH_MAX_LENGTH]; + bool use_output_dir; } record; struct diff --git a/settings.c b/settings.c index 4e5c276afe..d8b6a9a0f3 100644 --- a/settings.c +++ b/settings.c @@ -3871,6 +3871,18 @@ static bool setting_append_list_recording_options( general_read_handler); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + CONFIG_BOOL( + global->record.use_output_dir, + "record_use_output_dir", + "Use output directory", + false, + "OFF", + "ON", + group_info.name, + subgroup_info.name, + general_write_handler, + general_read_handler); + END_SUB_GROUP(list, list_info); START_SUB_GROUP(list, list_info, "Miscellaneous", group_info.name, subgroup_info); @@ -6107,7 +6119,7 @@ static bool setting_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - global->recording.output_dir, + global->record.output_dir, "recording_output_directory", "Recording Output Directory", "", @@ -6122,7 +6134,7 @@ static bool setting_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - global->recording.config_dir, + global->record.config_dir, "recording_config_directory", "Recording Config Directory", "", From 94150cef70a377cf94d4524b4634848af8a25251 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 13:37:38 +0200 Subject: [PATCH 013/120] Add 'Record Driver' option --- Makefile.common | 1 + config.def.h | 9 +++ configuration.c | 17 +++++ configuration.h | 7 ++ driver.c | 6 ++ driver.h | 2 +- griffin/griffin.c | 1 + record/drivers/ffmpeg.c | 2 +- record/drivers/record_null.c | 62 ++++++++++++++++++ record/record_driver.c | 122 ++++++++++++++++++++++++++++++++--- record/record_driver.h | 39 +++++++++-- settings.c | 11 ++++ 12 files changed, 261 insertions(+), 18 deletions(-) create mode 100644 record/drivers/record_null.c diff --git a/Makefile.common b/Makefile.common index b6579d75aa..c130add104 100644 --- a/Makefile.common +++ b/Makefile.common @@ -172,6 +172,7 @@ OBJ += frontend/frontend.o \ playlist.o \ movie.o \ record/record_driver.o \ + record/drivers/record_null.o \ performance.o diff --git a/config.def.h b/config.def.h index c0aa4a5a86..8ad7417bd3 100644 --- a/config.def.h +++ b/config.def.h @@ -126,6 +126,9 @@ enum MENU_RMENU_XUI, MENU_GLUI, MENU_XMB, + + RECORD_FFMPEG, + RECORD_NULL, }; #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(__CELLOS_LV2__) @@ -210,6 +213,12 @@ enum #define AUDIO_DEFAULT_RESAMPLER_DRIVER AUDIO_RESAMPLER_SINC #endif +#if defined(HAVE_FFMPEG) +#define RECORD_DEFAULT_DRIVER RECORD_FFMPEG +#else +#define RECORD_DEFAULT_DRIVER RECORD_NULL +#endif + #if defined(XENON) #define INPUT_DEFAULT_DRIVER INPUT_XENON360 #elif defined(_XBOX360) || defined(_XBOX) || defined(HAVE_XINPUT2) || defined(HAVE_XINPUT_XBOX1) diff --git a/configuration.c b/configuration.c index 3099a4375c..68b9f888c7 100644 --- a/configuration.c +++ b/configuration.c @@ -124,6 +124,19 @@ const char *config_get_default_audio(void) return "null"; } +const char *config_get_default_record(void) +{ + switch (RECORD_DEFAULT_DRIVER) + { + case RECORD_FFMPEG: + return "ffmpeg"; + default: + break; + } + + return "null"; +} + /** * config_get_default_audio_resampler: * @@ -397,6 +410,7 @@ static void config_set_defaults(void) #endif const char *def_camera = config_get_default_camera(); const char *def_location = config_get_default_location(); + const char *def_record = config_get_default_record(); if (def_camera) strlcpy(settings->camera.driver, @@ -419,6 +433,9 @@ static void config_set_defaults(void) if (def_joypad) strlcpy(settings->input.joypad_driver, def_joypad, sizeof(settings->input.joypad_driver)); + if (def_record) + strlcpy(settings->record.driver, + def_record, sizeof(settings->record.driver)); #ifdef HAVE_MENU if (def_menu) strlcpy(settings->menu.driver, diff --git a/configuration.h b/configuration.h index 2f6c87513b..76dfb50e5c 100644 --- a/configuration.h +++ b/configuration.h @@ -92,6 +92,11 @@ typedef struct settings bool force_srgb_disable; } video; + struct + { + char driver[32]; + } record; + struct { bool menubar_enable; @@ -393,6 +398,8 @@ const char *config_get_default_joypad(void); const char *config_get_default_menu(void); #endif +const char *config_get_default_record(void); + /** * config_load: * diff --git a/driver.c b/driver.c index f2724047fa..755311e2e7 100644 --- a/driver.c +++ b/driver.c @@ -123,6 +123,12 @@ static const void *find_driver_nonempty(const char *label, int i, if (drv) strlcpy(str, audio_driver_find_ident(i), sizeof_str); } + else if (!strcmp(label, "record_driver")) + { + drv = record_driver_find_handle(i); + if (drv) + strlcpy(str, record_driver_find_ident(i), sizeof_str); + } else if (!strcmp(label, "audio_resampler_driver")) { drv = audio_resampler_driver_find_handle(i); diff --git a/driver.h b/driver.h index d2b8d6ca25..b1c319c53a 100644 --- a/driver.h +++ b/driver.h @@ -199,7 +199,7 @@ typedef struct driver const camera_driver_t *camera; const location_driver_t *location; const rarch_resampler_t *resampler; - const ffemu_backend_t *recording; + const record_driver_t *recording; struct retro_callbacks retro_ctx; void *audio_data; diff --git a/griffin/griffin.c b/griffin/griffin.c index db43a6e9df..26f342f79c 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -645,6 +645,7 @@ RECORDING ============================================================ */ #include "../movie.c" #include "../record/record_driver.c" +#include "../record/drivers/record_null.c" /*============================================================ THREAD diff --git a/record/drivers/ffmpeg.c b/record/drivers/ffmpeg.c index e632d4e22f..585d788468 100644 --- a/record/drivers/ffmpeg.c +++ b/record/drivers/ffmpeg.c @@ -1408,7 +1408,7 @@ static void ffmpeg_thread(void *data) av_free(audio_buf); } -const ffemu_backend_t ffemu_ffmpeg = { +const record_driver_t ffemu_ffmpeg = { ffmpeg_new, ffmpeg_free, ffmpeg_push_video, diff --git a/record/drivers/record_null.c b/record/drivers/record_null.c new file mode 100644 index 0000000000..252752cb80 --- /dev/null +++ b/record/drivers/record_null.c @@ -0,0 +1,62 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include + +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + +#include +#include +#include +#include +#include "../record_driver.h" + +static void record_null_free(void *data) +{ +} + +static void *record_null_new(const struct ffemu_params *params) +{ + return NULL; +} + +static bool record_null_push_video(void *data, + const struct ffemu_video_data *video_data) +{ + return false; +} + +static bool record_null_push_audio(void *data, + const struct ffemu_audio_data *audio_data) +{ + return false; +} + +static bool record_null_finalize(void *data) +{ + return false; +} + +const record_driver_t ffemu_null = { + record_null_new, + record_null_free, + record_null_push_video, + record_null_push_audio, + record_null_finalize, + "null", +}; diff --git a/record/record_driver.c b/record/record_driver.c index c6083c8e34..a0f880a517 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -31,13 +31,114 @@ #include "../config.h" #endif -static const ffemu_backend_t *ffemu_backends[] = { +static const record_driver_t *record_drivers[] = { #ifdef HAVE_FFMPEG &ffemu_ffmpeg, #endif + &ffemu_null, NULL, }; +/** + * record_driver_find_ident: + * @idx : index of driver to get handle to. + * + * Returns: Human-readable identifier of record driver at index. Can be NULL + * if nothing found. + **/ +const char *record_driver_find_ident(int idx) +{ + const record_driver_t *drv = record_drivers[idx]; + if (!drv) + return NULL; + return drv->ident; +} + +/** + * record_driver_find_handle: + * @idx : index of driver to get handle to. + * + * Returns: handle to record driver at index. Can be NULL + * if nothing found. + **/ +const void *record_driver_find_handle(int idx) +{ + const void *drv = record_drivers[idx]; + if (!drv) + return NULL; + return drv; +} + +/** + * config_get_record_driver_options: + * + * Get an enumerated list of all record driver names, separated by '|'. + * + * Returns: string listing of all record driver names, separated by '|'. + **/ +const char* config_get_record_driver_options(void) +{ + union string_list_elem_attr attr; + unsigned i; + char *options = NULL; + int options_len = 0; + struct string_list *options_l = string_list_new(); + + attr.i = 0; + + if (!options_l) + return NULL; + + for (i = 0; record_driver_find_handle(i); i++) + { + const char *opt = record_driver_find_ident(i); + options_len += strlen(opt) + 1; + string_list_append(options_l, opt, attr); + } + + options = (char*)calloc(options_len, sizeof(char)); + + if (!options) + { + string_list_free(options_l); + options_l = NULL; + return NULL; + } + + string_list_join_concat(options, options_len, options_l, "|"); + + string_list_free(options_l); + options_l = NULL; + + return options; +} + +void find_record_driver(void) +{ + driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); + + int i = find_driver_index("record_driver", settings->record.driver); + + if (i >= 0) + driver->recording = (const record_driver_t*)audio_driver_find_handle(i); + else + { + unsigned d; + RARCH_ERR("Couldn't find any audio driver named \"%s\"\n", + settings->audio.driver); + RARCH_LOG_OUTPUT("Available audio drivers are:\n"); + for (d = 0; audio_driver_find_handle(d); d++) + RARCH_LOG_OUTPUT("\t%s\n", record_driver_find_ident(d)); + RARCH_WARN("Going to default to first audio driver...\n"); + + driver->audio = (const audio_driver_t*)audio_driver_find_handle(0); + + if (!driver->audio) + rarch_fail(1, "find_audio_driver()"); + } +} + /** * ffemu_find_backend: * @ident : Identifier of driver to find. @@ -47,19 +148,20 @@ static const ffemu_backend_t *ffemu_backends[] = { * Returns: recording driver handle if successful, otherwise * NULL. **/ -const ffemu_backend_t *ffemu_find_backend(const char *ident) +const record_driver_t *ffemu_find_backend(const char *ident) { unsigned i; - for (i = 0; ffemu_backends[i]; i++) + for (i = 0; record_drivers[i]; i++) { - if (!strcmp(ffemu_backends[i]->ident, ident)) - return ffemu_backends[i]; + if (!strcmp(record_drivers[i]->ident, ident)) + return record_drivers[i]; } return NULL; } + /** * gfx_ctx_init_first: * @backend : Recording backend handle. @@ -70,19 +172,19 @@ const ffemu_backend_t *ffemu_find_backend(const char *ident) * * Returns: true (1) if successful, otherwise false (0). **/ -bool ffemu_init_first(const ffemu_backend_t **backend, void **data, +bool record_driver_init_first(const record_driver_t **backend, void **data, const struct ffemu_params *params) { unsigned i; - for (i = 0; ffemu_backends[i]; i++) + for (i = 0; record_drivers[i]; i++) { - void *handle = ffemu_backends[i]->init(params); + void *handle = record_drivers[i]->init(params); if (!handle) continue; - *backend = ffemu_backends[i]; + *backend = record_drivers[i]; *data = handle; return true; } @@ -308,7 +410,7 @@ bool recording_init(void) params.fb_width, params.fb_height, (unsigned)params.pix_fmt); - if (!ffemu_init_first(&driver->recording, &driver->recording_data, ¶ms)) + if (!record_driver_init_first(&driver->recording, &driver->recording_data, ¶ms)) { RARCH_ERR(RETRO_LOG_INIT_RECORDING_FAILED); event_command(EVENT_CMD_GPU_RECORD_DEINIT); diff --git a/record/record_driver.h b/record/record_driver.h index 86c0caa657..54e5eb0f3f 100644 --- a/record/record_driver.h +++ b/record/record_driver.h @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License along with RetroArch. * If not, see . */ - #ifndef __RECORD_DRIVER_H #define __RECORD_DRIVER_H @@ -81,7 +80,7 @@ struct ffemu_audio_data size_t frames; }; -typedef struct ffemu_backend +typedef struct record_driver { void *(*init)(const struct ffemu_params *params); void (*free)(void *data); @@ -89,9 +88,19 @@ typedef struct ffemu_backend bool (*push_audio)(void *data, const struct ffemu_audio_data *audio_data); bool (*finalize)(void *data); const char *ident; -} ffemu_backend_t; +} record_driver_t; -extern const ffemu_backend_t ffemu_ffmpeg; +extern const record_driver_t ffemu_ffmpeg; +extern const record_driver_t ffemu_null; + +/** + * config_get_record_driver_options: + * + * Get an enumerated list of all record driver names, separated by '|'. + * + * Returns: string listing of all record driver names, separated by '|'. + **/ +const char* config_get_record_driver_options(void); /** * ffemu_find_backend: @@ -102,7 +111,25 @@ extern const ffemu_backend_t ffemu_ffmpeg; * Returns: recording driver handle if successful, otherwise * NULL. **/ -const ffemu_backend_t *ffemu_find_backend(const char *ident); +const record_driver_t *ffemu_find_backend(const char *ident); + +/** + * record_driver_find_handle: + * @idx : index of driver to get handle to. + * + * Returns: handle to record driver at index. Can be NULL + * if nothing found. + **/ +const void *record_driver_find_handle(int idx); + +/** + * record_driver_find_ident: + * @idx : index of driver to get handle to. + * + * Returns: Human-readable identifier of record driver at index. Can be NULL + * if nothing found. + **/ +const char *record_driver_find_ident(int idx); /** * gfx_ctx_init_first: @@ -114,7 +141,7 @@ const ffemu_backend_t *ffemu_find_backend(const char *ident); * * Returns: true (1) if successful, otherwise false (0). **/ -bool ffemu_init_first(const ffemu_backend_t **backend, void **data, +bool record_driver_init_first(const record_driver_t **backend, void **data, const struct ffemu_params *params); void recording_dump_frame(const void *data, unsigned width, diff --git a/settings.c b/settings.c index d8b6a9a0f3..bcf7594b27 100644 --- a/settings.c +++ b/settings.c @@ -3564,6 +3564,17 @@ static bool setting_append_list_driver_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER); #endif + CONFIG_STRING_OPTIONS( + settings->record.driver, + "record_driver", + "Record Driver", + config_get_default_record(), + config_get_record_driver_options(), + group_info.name, + subgroup_info.name, + NULL, + NULL); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER); END_SUB_GROUP(list, list_info); END_GROUP(list, list_info); From 8dd265bbadc3c106ed2519d220b76262628805cd Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Wed, 15 Apr 2015 20:06:48 +0200 Subject: [PATCH 014/120] Remove unused variable --- menu/menu_entries_cbs_ok.c | 1 - 1 file changed, 1 deletion(-) diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index f1bb220843..1230754297 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -353,7 +353,6 @@ static int action_ok_record_configfile_load(const char *path, const char *label, unsigned type, size_t idx) { const char *menu_path = NULL; - char record_configpath[PATH_MAX_LENGTH]; global_t *global = global_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr(); if (!menu || !global) From 683c082d4511e4967e00df6d7cdb971dade31cf2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 15 Apr 2015 20:11:43 +0200 Subject: [PATCH 015/120] Enable threaded data runloop by default when HAVE_THREADS is defined --- config.def.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config.def.h b/config.def.h index 8ad7417bd3..75a98ec87f 100644 --- a/config.def.h +++ b/config.def.h @@ -416,7 +416,11 @@ static unsigned swap_interval = 1; */ static const bool video_threaded = false; +#ifdef HAVE_THREADS +static const bool threaded_data_runloop_enable = true; +#else static const bool threaded_data_runloop_enable = false; +#endif /* Set to true if HW render cores should get their private context. */ static const bool video_shared_context = false; From dbe2243644da4cff411f8ea9751545335ebca67e Mon Sep 17 00:00:00 2001 From: aliaspider Date: Wed, 15 Apr 2015 21:31:24 +0100 Subject: [PATCH 016/120] disable config_file_dump_all. --- configuration.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/configuration.c b/configuration.c index 68b9f888c7..9a187f2401 100644 --- a/configuration.c +++ b/configuration.c @@ -1085,7 +1085,7 @@ static void config_read_keybinds_conf(config_file_t *conf) } /* Also dumps inherited values, useful for logging. */ - +#if 0 static void config_file_dump_all(config_file_t *conf) { struct config_entry_list *list = NULL; @@ -1101,12 +1101,12 @@ static void config_file_dump_all(config_file_t *conf) while (list) { - RARCH_LOG("%s = \"%s\" %s\n", list->key, - list->value, list->readonly ? "(included)" : ""); + RARCH_LOG("%s = \"%s\"%s\n", list->key, + list->value, list->readonly ? " (included)" : ""); list = list->next; } } - +#endif /** * config_load: * @path : path to be read from. @@ -1155,14 +1155,14 @@ static bool config_load_file(const char *path, bool set_defaults) RARCH_ERR("Failed to append config \"%s\"\n", extra_path); extra_path = strtok_r(NULL, "|", &save); } - +#if 0 if (global->verbosity) { RARCH_LOG_OUTPUT("=== Config ===\n"); config_file_dump_all(conf); RARCH_LOG_OUTPUT("=== Config end ===\n"); } - +#endif CONFIG_GET_FLOAT_BASE(conf, settings, video.scale, "video_scale"); CONFIG_GET_INT_BASE (conf, settings, video.fullscreen_x, "video_fullscreen_x"); @@ -1729,7 +1729,7 @@ bool config_load_override(void) if (settings->core_specific_config) { RARCH_LOG("Can't use overrides in conjunction with per-core configs, disabling overrides\n"); - return false; + return false; } RARCH_LOG("Core-specific overrides found at %s. Appending.\n", core_path); strlcpy(global->append_config_path, core_path, sizeof(global->append_config_path)); @@ -1909,7 +1909,7 @@ bool config_load_remap(void) { RARCH_LOG("No core-specific remap found at %s.\n", core_path); *settings->input.remapping_path= '\0'; - input_remapping_set_defaults(); + input_remapping_set_defaults(); } new_conf = NULL; From 128cf327a312599bd04ce97747f11ab83df8617f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sat, 4 Apr 2015 21:26:11 +0200 Subject: [PATCH 017/120] (Menu) Drag to scroll with touch --- menu/drivers/glui.c | 232 ++++++++++++++++++-------------- menu/drivers/rgui.c | 41 ++++-- menu/menu_driver.h | 19 ++- menu/menu_entries_cbs_iterate.c | 1 + menu/menu_input.c | 185 +++++++++++-------------- 5 files changed, 260 insertions(+), 218 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index dd92f05987..543479efb6 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -35,10 +35,8 @@ typedef struct glui_handle { unsigned line_height; - unsigned glyph_width; unsigned margin; - unsigned term_width; - unsigned term_height; + unsigned ticker_limit; char box_message[PATH_MAX_LENGTH]; struct { @@ -81,7 +79,7 @@ static int glui_entry_iterate(unsigned action) return -1; } -static void glui_blit_line(gl_t *gl, float x, float y, const char *message, uint32_t color) +static void glui_blit_line(gl_t *gl, float x, float y, const char *message, uint32_t color, enum text_alignment text_align) { struct font_params params = {0}; @@ -90,6 +88,7 @@ static void glui_blit_line(gl_t *gl, float x, float y, const char *message, uint params.scale = 1.0; params.color = color; params.full_screen = true; + params.text_align = text_align; video_driver_set_osd_msg(message, ¶ms, NULL); } @@ -160,9 +159,9 @@ static void glui_render_background(settings_t *settings, gl->coords.color = gl->white_color_ptr; } -static void glui_draw_cursor(gl_t *gl, float x, float y) +static void glui_render_quad(gl_t *gl, int x, int y, int w, int h, + float r, float g, float b, float a) { - struct gl_coords coords; static const GLfloat vertex[] = { 0, 0, 1, 0, @@ -176,14 +175,17 @@ static void glui_draw_cursor(gl_t *gl, float x, float y) 0, 0, 1, 0, }; + + struct gl_coords coords; + GLfloat color[] = { - 1.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, + r, g, b, a, + r, g, b, a, + r, g, b, a, + r, g, b, a, }; - glViewport(x - 5, gl->win_height - y + 5, 11, 11); + glViewport(x, gl->win_height - y - h, w, h); coords.vertices = 4; coords.vertex = vertex; @@ -204,6 +206,11 @@ static void glui_draw_cursor(gl_t *gl, float x, float y) gl->coords.color = gl->white_color_ptr; } +static void glui_draw_cursor(gl_t *gl, float x, float y) +{ + glui_render_quad(gl, x-5, y-5, 10, 10, 1, 1, 1, 1); +} + static void glui_get_message(const char *message) { glui_handle_t *glui = NULL; @@ -253,8 +260,8 @@ static void glui_render_messagebox(const char *message) if (list->elems == 0) goto end; - x = gl->win_width / 2 - strlen(list->elems[0].data) * glui->glyph_width / 2; - y = gl->win_height / 2 - list->size * glui->line_height / 2; + x = gl->win_width / 2; + y = gl->win_height / 2 - list->size * settings->video.font_size / 2; normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color); @@ -262,7 +269,7 @@ static void glui_render_messagebox(const char *message) { const char *msg = list->elems[i].data; if (msg) - glui_blit_line(gl, x, y + i * glui->line_height, msg, normal_color); + glui_blit_line(gl, x, y + i * settings->video.font_size, msg, normal_color, TEXT_ALIGN_CENTER); } end: @@ -271,6 +278,7 @@ end: static void glui_render(void) { + int bottom; glui_handle_t *glui = NULL; gl_t *gl = NULL; menu_handle_t *menu = menu_driver_get_ptr(); @@ -289,33 +297,48 @@ static void glui_render(void) if (!gl) return; - glui->line_height = settings->video.font_size * 4 / 3; - glui->glyph_width = glui->line_height / 2; - glui->margin = gl->win_width / 20 ; - glui->term_width = (gl->win_width - glui->margin * 2) / glui->glyph_width; - glui->term_height = (gl->win_height - glui->margin * 2) / glui->line_height - 2; - menu->frame_buf.width = gl->win_width; menu->frame_buf.height = gl->win_height; - menu->mouse.ptr = (menu->mouse.y - glui->margin) / - glui->line_height - 2 + menu->begin; + if (settings->menu.pointer.enable) + { + menu->pointer.ptr = + (menu->pointer.y - glui->line_height + menu->scroll_y - 16) + / glui->line_height; - if (menu->mouse.wheeldown && menu->begin - < menu_list_get_size(menu->menu_list) - glui->term_height) - menu->begin++; + if (menu->pointer.dragging) + menu->scroll_y -= menu->pointer.dy; + } - if (menu->mouse.wheelup && menu->begin > 0) - menu->begin--; + if (settings->menu.mouse.enable) + { + if (menu->mouse.scrolldown) + menu->scroll_y += 10; - /* Do not scroll if all items are visible. */ - if (menu_list_get_size(menu->menu_list) <= glui->term_height) - menu->begin = 0; + if (menu->mouse.scrollup) + menu->scroll_y -= 10; + + menu->mouse.ptr = + (menu->mouse.y - glui->line_height + menu->scroll_y - 16) + / glui->line_height; + } + + if (menu->scroll_y < 0) + menu->scroll_y = 0; + + bottom = (menu_list_get_size(menu->menu_list)-1) * glui->line_height + - gl->win_height + menu->header_height * 2; + if (menu->scroll_y > bottom) + menu->scroll_y = bottom; + + if ((menu_list_get_size(menu->menu_list)-1) * glui->line_height + < gl->win_height - menu->header_height*2) + menu->scroll_y = 0; } static void glui_frame(void) { - unsigned x, y; + unsigned y; size_t i; char title[PATH_MAX_LENGTH], title_buf[PATH_MAX_LENGTH], title_msg[PATH_MAX_LENGTH]; @@ -323,7 +346,6 @@ static void glui_frame(void) const char *dir = NULL; const char *label = NULL; unsigned menu_type = 0; - size_t end; gl_t *gl = NULL; glui_handle_t *glui = NULL; const char *core_name = NULL; @@ -375,57 +397,16 @@ static void glui_frame(void) runloop->frames.video.current.menu.label.is_updated = false; runloop->frames.video.current.menu.framebuf.dirty = false; - end = (menu->begin + glui->term_height <= - menu_list_get_size(menu->menu_list)) ? - menu->begin + glui->term_height : - menu_list_get_size(menu->menu_list); - - menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type); get_title(label, dir, menu_type, title, sizeof(title)); - menu_animation_ticker_line(title_buf, glui->term_width - 3, - runloop->frames.video.count / glui->margin, title, true); - glui_blit_line(gl, glui->margin * 2, glui->margin + glui->line_height, - title_buf, title_color); + glui_render_quad(gl, 0, + menu->header_height - menu->scroll_y + glui->line_height * + menu->navigation.selection_ptr - glui->line_height / 2 - 4, + gl->win_width, glui->line_height, 1, 1, 1, 0.1); - core_name = global->menu.info.library_name; - if (!core_name) - core_name = global->system.info.library_name; - if (!core_name) - core_name = "No Core"; - - if (settings->menu.core_enable) - { - core_version = global->menu.info.library_version; - if (!core_version) - core_version = global->system.info.library_version; - if (!core_version) - core_version = ""; - - snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, - core_name, core_version); - - glui_blit_line(gl, - glui->margin * 2, - glui->margin + glui->term_height * glui->line_height - + glui->line_height * 2, title_msg, title_color); - } - - if (settings->menu.timedate_enable) - { - disp_timedate_set_label(timedate, sizeof(timedate), 0); - glui_blit_line(gl, - glui->margin * 14, - glui->margin + glui->term_height * glui->line_height - + glui->line_height * 2, timedate, hover_color); - } - - x = glui->margin; - y = glui->margin + glui->line_height * 2; - - for (i = menu->begin; i < end; i++, y += glui->line_height) + for (i = 0; i < menu_list_get_size(menu->menu_list); i++) { char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH], entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH], @@ -451,17 +432,63 @@ static void glui_frame(void) selected = (i == menu->navigation.selection_ptr); - menu_animation_ticker_line(entry_title_buf, glui->term_width - (w + 1 + 2), - runloop->frames.video.count / glui->margin, path_buf, selected); - menu_animation_ticker_line(type_str_buf, w, - runloop->frames.video.count / glui->margin, type_str, selected); + menu_animation_ticker_line(entry_title_buf, glui->ticker_limit, + runloop->frames.video.count / 100, path_buf, selected); + menu_animation_ticker_line(type_str_buf, glui->ticker_limit, + runloop->frames.video.count / 100, type_str, selected); strlcpy(message, entry_title_buf, sizeof(message)); - glui_blit_line(gl, x, y, message, selected ? hover_color : normal_color); + y = menu->header_height - menu->scroll_y + (glui->line_height * i); - glui_blit_line(gl, gl->win_width - glui->glyph_width * w - glui->margin , - y, type_str_buf, selected ? hover_color : normal_color); + glui_blit_line(gl, glui->margin, y, message, + selected ? hover_color : normal_color, TEXT_ALIGN_LEFT); + + glui_blit_line(gl, gl->win_width - glui->margin, y, type_str_buf, + selected ? hover_color : normal_color, TEXT_ALIGN_RIGHT); + } + + glui_render_quad(gl, 0, 0, gl->win_width, + menu->header_height - glui->line_height/2 - 4, 0.2, 0.2, 0.2, 1); + + menu_animation_ticker_line(title_buf, glui->ticker_limit, + runloop->frames.video.count / 100, title, true); + glui_blit_line(gl, gl->win_width/2, glui->line_height, title_buf, title_color, TEXT_ALIGN_CENTER); + + glui_blit_line(gl, glui->margin, glui->line_height, "BACK", title_color, TEXT_ALIGN_LEFT); + + glui_render_quad(gl, 0, + gl->win_height - (menu->header_height - glui->line_height/2 + 4), + gl->win_width, menu->header_height - glui->line_height/2 + 4, + 0.2, 0.2, 0.2, 1); + + core_name = global->menu.info.library_name; + if (!core_name) + core_name = global->system.info.library_name; + if (!core_name) + core_name = "No Core"; + + if (settings->menu.core_enable) + { + core_version = global->menu.info.library_version; + if (!core_version) + core_version = global->system.info.library_version; + if (!core_version) + core_version = ""; + + snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, + core_name, core_version); + + glui_blit_line(gl, glui->margin, gl->win_height - glui->line_height, title_msg, + title_color, TEXT_ALIGN_LEFT); + } + + if (settings->menu.timedate_enable) + { + disp_timedate_set_label(timedate, sizeof(timedate), 0); + glui_blit_line(gl, gl->win_width - glui->margin, + gl->win_height - glui->line_height, timedate, hover_color, + TEXT_ALIGN_RIGHT); } draw_text: @@ -512,7 +539,7 @@ static void *glui_init(void) } font_driver = (const struct font_renderer*)gl->font_driver; - menu = (menu_handle_t*)calloc(1, sizeof(*menu)); + menu = (menu_handle_t*)calloc(1, sizeof(*menu)); if (!menu) goto error; @@ -522,7 +549,12 @@ static void *glui_init(void) if (!menu->userdata) goto error; - glui = (glui_handle_t*)menu->userdata; + glui = (glui_handle_t*)menu->userdata; + + glui->line_height = 44; + glui->margin = 22; + glui->ticker_limit = 44; + menu->header_height = 88; glui->textures.bg.id = 0; if (font_driver->bind_block && font_driver->flush) @@ -562,8 +594,6 @@ static void glui_free(void *data) free(menu->userdata); } - - static void glui_context_destroy(void) { glui_handle_t *glui = NULL; @@ -606,14 +636,18 @@ static bool glui_load_wallpaper(void *data) static void glui_navigation_clear(bool pending_push) { menu_handle_t *menu = menu_driver_get_ptr(); - if (menu) - menu->begin = 0; + if (!menu) + return; + + menu->begin = 0; + menu->scroll_y = 0; } static void glui_navigation_set(bool scroll) { glui_handle_t *glui = NULL; menu_handle_t *menu = menu_driver_get_ptr(); + gl_t *gl = (gl_t*)video_driver_get_ptr(NULL); if (!menu) return; @@ -625,16 +659,12 @@ static void glui_navigation_set(bool scroll) if (!scroll) return; - if (menu->navigation.selection_ptr < glui->term_height/2) - menu->begin = 0; - else if (menu->navigation.selection_ptr >= glui->term_height/2 - && menu->navigation.selection_ptr < - menu_list_get_size(menu->menu_list) - glui->term_height/2) - menu->begin = menu->navigation.selection_ptr - glui->term_height/2; - else if (menu->navigation.selection_ptr >= - menu_list_get_size(menu->menu_list) - glui->term_height/2) - menu->begin = menu_list_get_size(menu->menu_list) - - glui->term_height; + int half = (gl->win_height / glui->line_height) / 2; + + if (menu->navigation.selection_ptr < half) + menu->scroll_y = 0; + else + menu->scroll_y = ((menu->navigation.selection_ptr + 2 - half) * glui->line_height); } static void glui_navigation_set_last(void) diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 98cbbfc043..fa2b8d3731 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -349,6 +349,7 @@ static void rgui_blit_cursor(menu_handle_t *menu) static void rgui_render(void) { size_t i, end; + int bottom; char title[256], title_buf[256], title_msg[64]; char timedate[PATH_MAX_LENGTH]; unsigned x, y, menu_type = 0; @@ -383,19 +384,39 @@ static void rgui_render(void) runloop->frames.video.current.menu.animation.is_active = false; runloop->frames.video.current.menu.label.is_updated = false; - menu->mouse.ptr = menu->mouse.y / 11 - 2 + menu->begin; + if (settings->menu.pointer.enable) + { + menu->pointer.ptr = menu->pointer.y / 11 - 2 + menu->begin; - if (menu->mouse.scrolldown && menu->begin - < menu_list_get_size(menu->menu_list) - RGUI_TERM_HEIGHT) - menu->begin++; + if (menu->pointer.dragging) + { + menu->scroll_y += menu->pointer.dy; + menu->begin = -menu->scroll_y / 11 + 2; + if (menu->scroll_y > 0) + menu->scroll_y = 0; + } + } + + if (settings->menu.mouse.enable) + { + if (menu->mouse.scrolldown && menu->begin + < menu_list_get_size(menu->menu_list) - RGUI_TERM_HEIGHT) + menu->begin++; - if (menu->mouse.scrollup && menu->begin > 0) - menu->begin--; + if (menu->mouse.scrollup && menu->begin > 0) + menu->begin--; + + menu->mouse.ptr = menu->mouse.y / 11 - 2 + menu->begin; + } /* Do not scroll if all items are visible. */ if (menu_list_get_size(menu->menu_list) <= RGUI_TERM_HEIGHT) menu->begin = 0; + bottom = menu_list_get_size(menu->menu_list) - RGUI_TERM_HEIGHT; + if (menu->begin > bottom) + menu->begin = bottom; + end = (menu->begin + RGUI_TERM_HEIGHT <= menu_list_get_size(menu->menu_list)) ? menu->begin + RGUI_TERM_HEIGHT : @@ -546,6 +567,7 @@ static void *rgui_init(void) menu->frame_buf.width = 320; menu->frame_buf.height = 240; + menu->header_height = 11; menu->begin = 0; menu->frame_buf.pitch = menu->frame_buf.width * sizeof(uint16_t); @@ -608,8 +630,11 @@ static void rgui_set_texture(void) static void rgui_navigation_clear(bool pending_push) { menu_handle_t *menu = menu_driver_get_ptr(); - if (menu) - menu->begin = 0; + if (!menu) + return; + + menu->begin = 0; + menu->scroll_y = 0; } static void rgui_navigation_set(bool scroll) diff --git a/menu/menu_driver.h b/menu/menu_driver.h index ff5ea8ba35..4c4a47e784 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -112,6 +112,8 @@ typedef struct } delay; size_t begin; + unsigned header_height; + int scroll_y; menu_list_t *menu_list; menu_navigation_t navigation; @@ -175,13 +177,20 @@ typedef struct struct { + int16_t x; + int16_t y; + int16_t dx; + int16_t dy; int16_t old_x; int16_t old_y; - bool pressed[2]; - bool oldpressed[2]; - bool back; - bool oldback; - bool cancel; + int16_t start_x; + int16_t start_y; + bool pressed[2]; + bool oldpressed[2]; + bool dragging; + bool back; + bool oldback; + unsigned ptr; } pointer; struct diff --git a/menu/menu_entries_cbs_iterate.c b/menu/menu_entries_cbs_iterate.c index 2bce56e227..9cdcc3844d 100644 --- a/menu/menu_entries_cbs_iterate.c +++ b/menu/menu_entries_cbs_iterate.c @@ -504,6 +504,7 @@ static int action_iterate_main(const char *label, unsigned action) menu_file_list_cbs_t *cbs = NULL; menu_handle_t *menu = menu_driver_get_ptr(); global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); if (!menu) return 0; diff --git a/menu/menu_input.c b/menu/menu_input.c index 0e3111bd52..5eaad925e2 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -667,7 +667,7 @@ static int menu_input_mouse(unsigned *action) static int menu_input_pointer(unsigned *action) { - int pointer_device, pointer_x, pointer_y, screen_x, screen_y; + int pointer_device, pointer_x, pointer_y; const struct retro_keybind *binds[MAX_USERS]; menu_handle_t *menu = menu_driver_get_ptr(); runloop_t *runloop = rarch_main_get_ptr(); @@ -683,11 +683,6 @@ static int menu_input_pointer(unsigned *action) return 0; } -#if defined(HAVE_XMB) - if (driver->menu_ctx == &menu_ctx_xmb) - return 0; -#endif - pointer_device = driver->menu_ctx->set_texture? RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN; @@ -701,65 +696,12 @@ static int menu_input_pointer(unsigned *action) pointer_x = input_driver_state(binds, 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_X); pointer_y = input_driver_state(binds, 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_Y); - /* by multiple presses, the main press will be the one closest to the previous coordinates */ - if(menu->pointer.pressed[1]) - { - int pointer_x2, pointer_y2, dist1, dist2; + menu->pointer.x = ((pointer_x + 0x7fff) * (int)menu->frame_buf.width) / 0xFFFF; + menu->pointer.y = ((pointer_y + 0x7fff) * (int)menu->frame_buf.height) / 0xFFFF; - pointer_x2 = input_driver_state(binds, 0, pointer_device, 1, RETRO_DEVICE_ID_POINTER_X); - pointer_y2 = input_driver_state(binds, 0, pointer_device, 1, RETRO_DEVICE_ID_POINTER_Y); - - dist1 = (pointer_x - menu->pointer.old_x) * (pointer_x - menu->pointer.old_x) + - (pointer_y - menu->pointer.old_y) * (pointer_y - menu->pointer.old_y); - dist2 = (pointer_x2 - menu->pointer.old_x) * (pointer_x2 - menu->pointer.old_x) + - (pointer_y2 - menu->pointer.old_y) * (pointer_y2 - menu->pointer.old_y); - - if (dist2 < dist1) - { - int temp; - pointer_x = pointer_x2; - pointer_y = pointer_y2; - temp = menu->pointer.pressed[0]; - menu->pointer.pressed[0] = menu->pointer.pressed[1]; - menu->pointer.pressed[1] = temp; - } - } - menu->pointer.old_x = pointer_x; - menu->pointer.old_y = pointer_y; - - screen_x = ((pointer_x + 0x7fff) * (int)menu->frame_buf.width) / 0xFFFF; - screen_y = ((pointer_y + 0x7fff) * (int)menu->frame_buf.height) / 0xFFFF; - - if (menu->pointer.pressed[0]) - { - menu->mouse.x = screen_x; - menu->mouse.y = screen_y; - if (menu->mouse.x < 5) - menu->mouse.x = 5; - if (menu->mouse.y < 5) - menu->mouse.y = 5; - if (menu->mouse.x > (int)menu->frame_buf.width - 5) - menu->mouse.x = menu->frame_buf.width - 5; - if (menu->mouse.y > (int)menu->frame_buf.height - 5) - menu->mouse.y = menu->frame_buf.height - 5; - - menu->mouse.scrollup = (menu->mouse.y == 5); - menu->mouse.scrolldown = (menu->mouse.y == (int)menu->frame_buf.height - 5); - - menu->pointer.cancel = false; - - if(menu->pointer.oldpressed[1] && !menu->pointer.pressed[1]) - menu->pointer.back = true; - } - else - menu->pointer.cancel = screen_x < 5 || screen_x > (int)menu->frame_buf.width - 5 - || screen_x < 5 || screen_x > (int)menu->frame_buf.height - 5; - - menu->pointer.oldpressed[1] = menu->pointer.pressed[1]; - - - if (menu->pointer.pressed[0] || menu->pointer.back || menu->mouse.x != screen_x || menu->mouse.y != screen_y) - runloop->frames.video.current.menu.animation.is_active = true; + if (menu->pointer.pressed[0] || menu->pointer.back || menu->pointer.dragging + || menu->pointer.dy != 0 || menu->pointer.dx != 0) + runloop->frames.video.current.menu.animation.is_active = true; return 0; } @@ -842,61 +784,88 @@ static int menu_input_mouse_post_iterate(menu_file_list_cbs_t *cbs, return 0; } +static int pointer_tap(menu_file_list_cbs_t *cbs, const char *path, + const char *label, unsigned type, unsigned action) +{ + menu_handle_t *menu = menu_driver_get_ptr(); + + driver_t *driver = driver_get_ptr(); + rarch_setting_t *setting = + (rarch_setting_t*)setting_find_setting + (driver->menu->list_settings, + driver->menu->menu_list->selection_buf->list[menu->navigation.selection_ptr].label); + + if (menu->pointer.ptr == menu->navigation.selection_ptr + && cbs && cbs->action_toggle && setting && + (setting->type == ST_BOOL || setting->type == ST_UINT + || setting->type == ST_FLOAT || setting->type == ST_STRING)) + return cbs->action_toggle(type, label, MENU_ACTION_RIGHT, true); + else if (menu->pointer.ptr == menu->navigation.selection_ptr) + return cbs->action_ok(path, label, type, menu->navigation.selection_ptr); + else + menu->navigation.selection_ptr = menu->pointer.ptr; + + return 0; +} + static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, unsigned action) { - menu_handle_t *menu = menu_driver_get_ptr(); - settings_t *settings = config_get_ptr(); - driver_t *driver = driver_get_ptr(); + int ret = 0; + menu_handle_t *menu = menu_driver_get_ptr(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; - if (!settings->menu.pointer.enable -#ifdef HAVE_OVERLAY - || (settings->input.overlay_enable && driver && driver->overlay) -#endif - ) + if (!settings->menu.pointer.enable || settings->input.overlay_enable) return 0; -#if defined(HAVE_XMB) - if (driver->menu_ctx == &menu_ctx_xmb) - return 0; -#endif - if (menu->pointer.pressed[0]) { - if (menu->pointer.oldpressed[0]) + if (!menu->pointer.oldpressed[0]) { - if (menu->mouse.ptr <= menu_list_get_size(menu->menu_list)-1) - menu_navigation_set(&menu->navigation, menu->mouse.ptr, false); - } - else + menu->pointer.start_x = menu->pointer.x; + menu->pointer.start_y = menu->pointer.y; + menu->pointer.old_x = menu->pointer.x; + menu->pointer.old_y = menu->pointer.y; menu->pointer.oldpressed[0] = true; + } + else if (menu->pointer.x != menu->pointer.start_x + && menu->pointer.y != menu->pointer.start_y) + { + menu->pointer.dragging = true; + menu->pointer.dx = menu->pointer.x - menu->pointer.old_x; + menu->pointer.dy = menu->pointer.y - menu->pointer.old_y; + menu->pointer.old_x = menu->pointer.x; + menu->pointer.old_y = menu->pointer.y; + } } else { if (menu->pointer.oldpressed[0]) { - rarch_setting_t *setting = NULL; - + if (!menu->pointer.dragging) + { + if (menu->pointer.start_y < menu->header_height) + { + menu_list_pop_stack(menu->menu_list); + } + else if (menu->pointer.ptr <= menu_list_get_size(menu->menu_list)-1) + { + menu->pointer.oldpressed[0] = false; + ret = pointer_tap(cbs, path, label, type, action); + } + } menu->pointer.oldpressed[0] = false; - setting = (rarch_setting_t*)setting_find_setting - (menu->list_settings, - menu->menu_list->selection_buf->list[menu->navigation.selection_ptr].label); - - if (menu->mouse.ptr == menu->navigation.selection_ptr && !menu->pointer.cancel - && cbs && cbs->action_toggle && setting && - (setting->type == ST_BOOL || setting->type == ST_UINT || setting->type == ST_FLOAT - || setting->type == ST_STRING)) - return cbs->action_toggle(type, label, MENU_ACTION_RIGHT, true); - if (menu->mouse.ptr == menu->navigation.selection_ptr && !menu->pointer.cancel - && cbs && cbs->action_ok) - return cbs->action_ok(path, label, type, - menu->navigation.selection_ptr); - else if (menu->mouse.ptr <= menu_list_get_size(menu->menu_list) - 1) - menu_navigation_set(&menu->navigation, menu->mouse.ptr, false); + menu->pointer.start_x = 0; + menu->pointer.start_y = 0; + menu->pointer.old_x = 0; + menu->pointer.old_y = 0; + menu->pointer.dx = 0; + menu->pointer.dy = 0; + menu->pointer.dragging = false; } } @@ -910,14 +879,18 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs, } menu->pointer.oldback = menu->pointer.back; - return 0; + return ret; } void menu_input_post_iterate(int *ret, menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, unsigned action) { - *ret = menu_input_mouse_post_iterate (cbs, path, label, type, action); - *ret |= menu_input_pointer_post_iterate(cbs, path, label, type, action); + settings_t *settings = config_get_ptr(); + + if (settings->menu.mouse.enable) + *ret = menu_input_mouse_post_iterate (cbs, path, label, type, action); + if (settings->menu.pointer.enable) + *ret |= menu_input_pointer_post_iterate(cbs, path, label, type, action); } unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input) @@ -934,6 +907,7 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input) | (1ULL << RETRO_DEVICE_ID_JOYPAD_R); menu_handle_t *menu = menu_driver_get_ptr(); driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); if (!menu || !driver) return 0; @@ -1002,8 +976,11 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input) else ret = MENU_ACTION_NOOP; - menu_input_mouse(&ret); - menu_input_pointer(&ret); + if (settings->menu.mouse.enable) + menu_input_mouse(&ret); + + if (settings->menu.pointer.enable) + menu_input_pointer(&ret); return ret; } From 0a56e3dcaa4db1a174f887576a6f10552784eb15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 15 Apr 2015 14:39:10 +0200 Subject: [PATCH 018/120] (Menu) Fix touch compatibility with the framebuf.dirty optimization --- menu/menu_input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/menu/menu_input.c b/menu/menu_input.c index 5eaad925e2..4455b4f276 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -699,7 +699,8 @@ static int menu_input_pointer(unsigned *action) menu->pointer.x = ((pointer_x + 0x7fff) * (int)menu->frame_buf.width) / 0xFFFF; menu->pointer.y = ((pointer_y + 0x7fff) * (int)menu->frame_buf.height) / 0xFFFF; - if (menu->pointer.pressed[0] || menu->pointer.back || menu->pointer.dragging + if (menu->pointer.pressed[0] || menu->pointer.oldpressed[0] + || menu->pointer.back || menu->pointer.dragging || menu->pointer.dy != 0 || menu->pointer.dx != 0) runloop->frames.video.current.menu.animation.is_active = true; From 625d38a6ddc20f4cd0f52b2b770d6a101b2683d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 15 Apr 2015 21:53:35 +0200 Subject: [PATCH 019/120] (Menu) Fix new glui design compatibility with block text rendering --- menu/drivers/glui.c | 155 ++++++++++++++++++++++---------------------- 1 file changed, 78 insertions(+), 77 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 543479efb6..42a87e2272 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -47,7 +47,7 @@ typedef struct glui_handle } bg; } textures; - gl_font_raster_block_t raster_block; + gl_font_raster_block_t list_block; bool use_blocks; } glui_handle_t; @@ -336,75 +336,20 @@ static void glui_render(void) menu->scroll_y = 0; } -static void glui_frame(void) +static void glui_render_menu_list(runloop_t *runloop, gl_t *gl, glui_handle_t *glui, + menu_handle_t *menu, const char *label, uint32_t normal_color, + uint32_t hover_color) { - unsigned y; - size_t i; - char title[PATH_MAX_LENGTH], title_buf[PATH_MAX_LENGTH], - title_msg[PATH_MAX_LENGTH]; - char timedate[PATH_MAX_LENGTH]; - const char *dir = NULL; - const char *label = NULL; - unsigned menu_type = 0; - gl_t *gl = NULL; - glui_handle_t *glui = NULL; - const char *core_name = NULL; - const char *core_version = NULL; - const struct font_renderer *font_driver = NULL; - menu_handle_t *menu = menu_driver_get_ptr(); - settings_t *settings = config_get_ptr(); - const uint32_t normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color); - const uint32_t hover_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_hover_color); - const uint32_t title_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.title_color); - runloop_t *runloop = rarch_main_get_ptr(); - global_t *global = global_get_ptr(); - - if (!menu) - return; - - gl = (gl_t*)video_driver_get_ptr(NULL); - - if (!gl) - return; - - font_driver = (const struct font_renderer*)gl->font_driver; - - glui = (glui_handle_t*)menu->userdata; - - if (!glui) - return; - - if (menu->need_refresh - && runloop->is_menu - && !menu->msg_force) - return; - - gl_set_viewport(gl, gl->win_width, gl->win_height, true, false); - - glui_render_background(settings, gl, glui, false); + const struct font_renderer *font_driver = (const struct font_renderer *)gl->font_driver; + size_t i = 0; if (glui->use_blocks) - { - font_driver->bind_block(gl->font_handle, &glui->raster_block); + font_driver->bind_block(gl->font_handle, &glui->list_block); - if (!menu_display_update_pending()) - goto draw_text; - } + if (!menu_display_update_pending()) + goto draw_text; - glui->raster_block.carr.coords.vertices = 0; - - runloop->frames.video.current.menu.animation.is_active = false; - runloop->frames.video.current.menu.label.is_updated = false; - runloop->frames.video.current.menu.framebuf.dirty = false; - - menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type); - - get_title(label, dir, menu_type, title, sizeof(title)); - - glui_render_quad(gl, 0, - menu->header_height - menu->scroll_y + glui->line_height * - menu->navigation.selection_ptr - glui->line_height / 2 - 4, - gl->win_width, glui->line_height, 1, 1, 1, 0.1); + glui->list_block.carr.coords.vertices = 0; for (i = 0; i < menu_list_get_size(menu->menu_list); i++) { @@ -420,8 +365,7 @@ static void glui_frame(void) &entry_label, &type); cbs = (menu_file_list_cbs_t*) - menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf, - i); + menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf, i); if (cbs && cbs->action_get_representation) cbs->action_get_representation(menu->menu_list->selection_buf, @@ -439,7 +383,7 @@ static void glui_frame(void) strlcpy(message, entry_title_buf, sizeof(message)); - y = menu->header_height - menu->scroll_y + (glui->line_height * i); + unsigned y = menu->header_height - menu->scroll_y + (glui->line_height * i); glui_blit_line(gl, glui->margin, y, message, selected ? hover_color : normal_color, TEXT_ALIGN_LEFT); @@ -448,6 +392,71 @@ static void glui_frame(void) selected ? hover_color : normal_color, TEXT_ALIGN_RIGHT); } +draw_text: + if (glui->use_blocks) + { + font_driver->flush(gl->font_handle); + font_driver->bind_block(gl->font_handle, NULL); + } +} + +static void glui_frame(void) +{ + char title[PATH_MAX_LENGTH], title_buf[PATH_MAX_LENGTH], + title_msg[PATH_MAX_LENGTH]; + char timedate[PATH_MAX_LENGTH]; + const char *dir = NULL; + const char *label = NULL; + unsigned menu_type = 0; + gl_t *gl = NULL; + glui_handle_t *glui = NULL; + const char *core_name = NULL; + const char *core_version = NULL; + menu_handle_t *menu = menu_driver_get_ptr(); + settings_t *settings = config_get_ptr(); + const uint32_t normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color); + const uint32_t hover_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_hover_color); + const uint32_t title_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.title_color); + runloop_t *runloop = rarch_main_get_ptr(); + global_t *global = global_get_ptr(); + + if (!menu) + return; + + gl = (gl_t*)video_driver_get_ptr(NULL); + + if (!gl) + return; + + glui = (glui_handle_t*)menu->userdata; + + if (!glui) + return; + + if (menu->need_refresh + && runloop->is_menu + && !menu->msg_force) + return; + + gl_set_viewport(gl, gl->win_width, gl->win_height, true, false); + + glui_render_background(settings, gl, glui, false); + + menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type); + + get_title(label, dir, menu_type, title, sizeof(title)); + + glui_render_quad(gl, 0, + menu->header_height - menu->scroll_y + glui->line_height * + menu->navigation.selection_ptr - glui->line_height / 2 - 4, + gl->win_width, glui->line_height, 1, 1, 1, 0.1); + + glui_render_menu_list(runloop, gl, glui, menu, label, normal_color, hover_color); + + runloop->frames.video.current.menu.animation.is_active = false; + runloop->frames.video.current.menu.label.is_updated = false; + runloop->frames.video.current.menu.framebuf.dirty = false; + glui_render_quad(gl, 0, 0, gl->win_width, menu->header_height - glui->line_height/2 - 4, 0.2, 0.2, 0.2, 1); @@ -491,14 +500,6 @@ static void glui_frame(void) TEXT_ALIGN_RIGHT); } -draw_text: - - if (glui->use_blocks) - { - font_driver->flush(gl->font_handle); - font_driver->bind_block(gl->font_handle, NULL); - } - if (menu->keyboard.display) { char msg[PATH_MAX_LENGTH]; @@ -580,7 +581,7 @@ static void glui_free(void *data) if (!glui) return; - gl_coord_array_free(&glui->raster_block.carr); + gl_coord_array_free(&glui->list_block.carr); font_driver = (const struct font_renderer*)gl->font_driver; From ba99edb8476f9a70ba92e74f524631664e3e1663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 16 Apr 2015 17:39:40 +0200 Subject: [PATCH 020/120] (XMB) Basic touch support, no drag yet --- menu/drivers/xmb.c | 25 +++++++++++++++++++++---- menu/menu_input.c | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index ac9f70282e..54e6bbc799 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1211,6 +1211,8 @@ static void xmb_render(void) { unsigned i, current, end; runloop_t *runloop = rarch_main_get_ptr(); + settings_t *settings = config_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); if (!menu) @@ -1226,12 +1228,26 @@ static void xmb_render(void) current = menu->navigation.selection_ptr; end = menu_list_get_size(menu->menu_list); - for (i = 0; i < end; i++) + if (settings->menu.pointer.enable) { - float item_y = xmb->margins.screen.top + xmb_item_y(xmb, i, current); + for (i = 0; i < end; i++) + { + float item_y = xmb->margins.screen.top + xmb_item_y(xmb, i, current); - if (menu->mouse.y > item_y && menu->mouse.y < item_y + xmb->icon.size) - menu->mouse.ptr = i; + if (menu->pointer.y > item_y && menu->pointer.y < item_y + xmb->icon.size) + menu->pointer.ptr = i; + } + } + + if (settings->menu.mouse.enable) + { + for (i = 0; i < end; i++) + { + float item_y = xmb->margins.screen.top + xmb_item_y(xmb, i, current); + + if (menu->mouse.y > item_y && menu->mouse.y < item_y + xmb->icon.size) + menu->mouse.ptr = i; + } } runloop->frames.video.current.menu.animation.is_active = false; @@ -1498,6 +1514,7 @@ static void *xmb_init(void) xmb->margins.setting.left = 600.0 * scale_factor; menu->categories.size = 1; + menu->header_height = xmb->icon.size; if (global->core_info) menu->categories.size = global->core_info->count + 1; diff --git a/menu/menu_input.c b/menu/menu_input.c index 4455b4f276..98dccd21f3 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -804,7 +804,7 @@ static int pointer_tap(menu_file_list_cbs_t *cbs, const char *path, else if (menu->pointer.ptr == menu->navigation.selection_ptr) return cbs->action_ok(path, label, type, menu->navigation.selection_ptr); else - menu->navigation.selection_ptr = menu->pointer.ptr; + menu_navigation_set(&menu->navigation, menu->pointer.ptr, false); return 0; } From 7f50f44ddb43d456df6bd3e434f334dcff658c34 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 19:36:34 +0200 Subject: [PATCH 021/120] Start adding 'System Information' --- menu/drivers/shared.h | 2 + menu/menu_entries_cbs_deferred_push.c | 60 +++++++++++++++++++++++++++ menu/menu_entries_cbs_ok.c | 1 + settings.c | 6 +++ 4 files changed, 69 insertions(+) diff --git a/menu/drivers/shared.h b/menu/drivers/shared.h index 365eb90321..bb75e48139 100644 --- a/menu/drivers/shared.h +++ b/menu/drivers/shared.h @@ -283,6 +283,8 @@ static INLINE void get_title(const char *label, const char *dir, strlcpy(title, "CORE INPUT REMAPPING OPTIONS", sizeof_title); else if (!strcmp(label, "core_information")) strlcpy(title, "CORE INFO", sizeof_title); + else if (!strcmp(label, "system_information")) + strlcpy(title, "SYSTEM INFO", sizeof_title); else if (!strcmp(elem0, "Privacy Settings")) { strlcpy(title, "PRIVACY SETTINGS", sizeof_title); diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 768cd2389d..e2bd4beac7 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -30,6 +30,7 @@ #include "menu_database.h" #include "../gfx/video_shader_driver.h" +#include "../git_version.h" #ifdef HAVE_LIBRETRODB static int create_string_list_rdb_entry_string(const char *desc, const char *label, @@ -268,6 +269,63 @@ static int deferred_push_core_information(void *data, void *userdata, return 0; } +static int deferred_push_system_information(void *data, void *userdata, + const char *path, const char *label, unsigned type) +{ + unsigned i; + file_list_t *list = (file_list_t*)data; + file_list_t *menu_list = (file_list_t*)userdata; + settings_t *settings = config_get_ptr(); + driver_t *driver = driver_get_ptr(); + global_t *global = global_get_ptr(); + + if (!list || !menu_list) + return -1; + + menu_list_clear(list); + + { + char tmp[PATH_MAX_LENGTH]; + char tmp2[PATH_MAX_LENGTH]; + const frontend_ctx_driver_t *frontend = frontend_get_ptr(); + + snprintf(tmp, sizeof(tmp), "Build date: %s", __DATE__); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + +#ifdef HAVE_GIT_VERSION + snprintf(tmp, sizeof(tmp), "Git version: %s", rarch_git_version); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); +#endif + + if (frontend) + { + + snprintf(tmp, sizeof(tmp), "Frontend identifier: %s", + frontend->ident); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + if (frontend->get_name) + frontend->get_name(tmp2, sizeof(tmp2)); + snprintf(tmp, sizeof(tmp), "Frontend name: %s", + frontend->get_name ? tmp2 : "N/A"); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(tmp, sizeof(tmp), "RetroRating level: %d", + frontend->get_rating ? frontend->get_rating() : -1); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } + } + + menu_driver_populate_entries(path, label, type); + + return 0; +} + static int deferred_push_rdb_entry_detail(void *data, void *userdata, const char *path, const char *label, unsigned type) { @@ -1921,6 +1979,8 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs, cbs->action_deferred_push = deferred_push_cursor_manager_list_deferred_query_subsearch; else if (!strcmp(label, "core_information")) cbs->action_deferred_push = deferred_push_core_information; + else if (!strcmp(label, "system_information")) + cbs->action_deferred_push = deferred_push_system_information; else if (!strcmp(label, "performance_counters")) cbs->action_deferred_push = deferred_push_performance_counters; else if (!strcmp(label, "core_counters")) diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index 1230754297..b3e96dfd16 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -1331,6 +1331,7 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs, !strcmp(label, "core_cheat_options") || !strcmp(label, "core_input_remapping_options") || !strcmp(label, "core_information") || + !strcmp(label, "system_information") || !strcmp(label, "disk_options") || !strcmp(label, "settings") || !strcmp(label, "performance_counters") || diff --git a/settings.c b/settings.c index bcf7594b27..9b07e33a3a 100644 --- a/settings.c +++ b/settings.c @@ -3353,6 +3353,12 @@ static bool setting_append_list_main_menu_options( group_info.name, subgroup_info.name); + CONFIG_ACTION( + "system_information", + "System Information", + group_info.name, + subgroup_info.name); + if (global->perfcnt_enable) { CONFIG_ACTION( From 7bfca052726193ba0185e38c16e0bed95040a88e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 19:41:07 +0200 Subject: [PATCH 022/120] System Information - show Display Metrics --- menu/menu_entries_cbs_deferred_push.c | 28 ++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index e2bd4beac7..214f8026b3 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -301,7 +301,6 @@ static int deferred_push_system_information(void *data, void *userdata, if (frontend) { - snprintf(tmp, sizeof(tmp), "Frontend identifier: %s", frontend->ident); menu_list_push(list, tmp, "", @@ -319,6 +318,33 @@ static int deferred_push_system_information(void *data, void *userdata, menu_list_push(list, tmp, "", MENU_SETTINGS_CORE_INFO_NONE, 0); } + + { + float val = 0.0f; + if (gfx_ctx_get_metrics(DISPLAY_METRIC_MM_WIDTH, &val)) + { + snprintf(tmp, sizeof(tmp), "Display metric width (mm): %.2f", + val); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } + + if (gfx_ctx_get_metrics(DISPLAY_METRIC_MM_HEIGHT, &val)) + { + snprintf(tmp, sizeof(tmp), "Display metric height (mm): %.2f", + val); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } + + if (gfx_ctx_get_metrics(DISPLAY_METRIC_DPI, &val)) + { + snprintf(tmp, sizeof(tmp), "Display metric DPI: %.2f", + val); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } + } } menu_driver_populate_entries(path, label, type); From b818038314611bf08c73efdfafc82bd748987899 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 19:42:27 +0200 Subject: [PATCH 023/120] Prevent segfault in gfx_ctx_get_metrics --- gfx/video_context_driver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 02369ddcd9..8d50fc5de8 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -174,6 +174,8 @@ bool gfx_ctx_get_metrics(enum display_metric_types type, float *value) const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr(); if (!ctx || !driver) return false; + if (!ctx->get_metrics) + return false; return ctx->get_metrics(driver->video_context_data, type, value); } From cd76c3f975305ac2708711ed62c75d19d641238a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 20:00:10 +0200 Subject: [PATCH 024/120] Add gfx_ctx_get_ident --- gfx/video_context_driver.c | 9 +++++++++ gfx/video_context_driver.h | 2 ++ menu/menu_entries_cbs_deferred_push.c | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 8d50fc5de8..2d8758b7d6 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -91,6 +91,15 @@ void gfx_ctx_free(void *data) ctx = NULL; } +const char *gfx_ctx_get_ident(void) +{ + const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr(); + + if (!ctx) + return NULL; + return ctx->ident; +} + void gfx_ctx_update_window_title(void *data) { const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr(); diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index 8b3995f508..cf00136f01 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -243,6 +243,8 @@ void gfx_ctx_get_video_output_prev(void *data); void gfx_ctx_get_video_output_next(void *data); +const char *gfx_ctx_get_ident(void); + void gfx_ctx_free(void *data); void gfx_ctx_input_driver(void *data, diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 214f8026b3..05a849f5e8 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -286,6 +286,7 @@ static int deferred_push_system_information(void *data, void *userdata, { char tmp[PATH_MAX_LENGTH]; + const char *tmp_string; char tmp2[PATH_MAX_LENGTH]; const frontend_ctx_driver_t *frontend = frontend_get_ptr(); @@ -319,6 +320,13 @@ static int deferred_push_system_information(void *data, void *userdata, MENU_SETTINGS_CORE_INFO_NONE, 0); } + tmp_string = gfx_ctx_get_ident(); + + snprintf(tmp, sizeof(tmp), "Video context driver: %s", + tmp_string ? tmp_string : "N/A"); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + { float val = 0.0f; if (gfx_ctx_get_metrics(DISPLAY_METRIC_MM_WIDTH, &val)) From 83e3231fddd8d2fb68ec11be8f6237f8e4bc513e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 20:07:54 +0200 Subject: [PATCH 025/120] (System Information) Add frontend->get_os --- menu/menu_entries_cbs_deferred_push.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 05a849f5e8..54bd04cf7c 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -302,6 +302,8 @@ static int deferred_push_system_information(void *data, void *userdata, if (frontend) { + int major = 0, minor = 0; + snprintf(tmp, sizeof(tmp), "Frontend identifier: %s", frontend->ident); menu_list_push(list, tmp, "", @@ -314,6 +316,13 @@ static int deferred_push_system_information(void *data, void *userdata, menu_list_push(list, tmp, "", MENU_SETTINGS_CORE_INFO_NONE, 0); + if (frontend->get_os) + frontend->get_os(tmp2, sizeof(tmp2), &major, &minor); + snprintf(tmp, sizeof(tmp), "Frontend OS: %s %d.%d", + frontend->get_os ? tmp2 : "N/A", major, minor); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(tmp, sizeof(tmp), "RetroRating level: %d", frontend->get_rating ? frontend->get_rating() : -1); menu_list_push(list, tmp, "", From 6c8fb8977305987bff1a25efcb577e542028e2e2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 20:17:05 +0200 Subject: [PATCH 026/120] Refactor print_compiler --- menu/menu_entries_cbs_deferred_push.c | 4 ++++ retroarch.c | 30 ++++++++++++++++----------- retroarch.h | 7 +++++++ 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 54bd04cf7c..4e04345a5c 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -300,6 +300,10 @@ static int deferred_push_system_information(void *data, void *userdata, MENU_SETTINGS_CORE_INFO_NONE, 0); #endif + rarch_print_compiler(tmp, sizeof(tmp)); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + if (frontend) { int major = 0, minor = 0; diff --git a/retroarch.c b/retroarch.c index 1e0f6460bb..1c74d6ce4f 100644 --- a/retroarch.c +++ b/retroarch.c @@ -127,35 +127,33 @@ static void print_features(void) #undef _PSUPP /** - * print_compiler: + * rarch_print_compiler: * * Prints compiler that was used for compiling RetroArch. **/ -static void print_compiler(FILE *file) +void rarch_print_compiler(char *str, size_t sizeof_str) { - fprintf(file, "\nCompiler: "); #if defined(_MSC_VER) - fprintf(file, "MSVC (%d) %u-bit\n", _MSC_VER, (unsigned) + snprintf(str, sizeof_str, "Compiler: MSVC (%d) %u-bit", _MSC_VER, (unsigned) (CHAR_BIT * sizeof(size_t))); #elif defined(__SNC__) - fprintf(file, "SNC (%d) %u-bit\n", + snprintf(str, sizeof_str, "Compiler: SNC (%d) %u-bit", __SN_VER__, (unsigned)(CHAR_BIT * sizeof(size_t))); #elif defined(_WIN32) && defined(__GNUC__) - fprintf(file, "MinGW (%d.%d.%d) %u-bit\n", + snprintf(str, sizeof_str, "Compiler: MinGW (%d.%d.%d) %u-bit", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, (unsigned) (CHAR_BIT * sizeof(size_t))); #elif defined(__clang__) - fprintf(file, "Clang/LLVM (%s) %u-bit\n", + snprintf(str, sizeof_str, "Compiler: Clang/LLVM (%s) %u-bit", __clang_version__, (unsigned)(CHAR_BIT * sizeof(size_t))); #elif defined(__GNUC__) - fprintf(file, "GCC (%d.%d.%d) %u-bit\n", + snprintf(str, sizeof_str, "Compiler: GCC (%d.%d.%d) %u-bit", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, (unsigned) (CHAR_BIT * sizeof(size_t))); #else - fprintf(file, "Unknown compiler %u-bit\n", + snprintf(str, sizeof_str, "Unknown compiler %u-bit", (unsigned)(CHAR_BIT * sizeof(size_t))); #endif - fprintf(file, "Built: %s\n", __DATE__); } /** @@ -165,13 +163,17 @@ static void print_compiler(FILE *file) **/ static void print_help(void) { + char str[PATH_MAX_LENGTH]; + puts("==================================================================="); #ifdef HAVE_GIT_VERSION printf(RETRO_FRONTEND ": Frontend for libretro -- v" PACKAGE_VERSION " -- %s --\n", rarch_git_version); #else puts(RETRO_FRONTEND ": Frontend for libretro -- v" PACKAGE_VERSION " --"); #endif - print_compiler(stdout); + rarch_print_compiler(str, sizeof(str)); + fprintf(stdout, str); + fprintf(stdout, "Built: %s\n", __DATE__); puts("==================================================================="); puts("Usage: retroarch [content file] [options...]"); puts("\t-h/--help: Show this help message."); @@ -1097,8 +1099,12 @@ int rarch_main_init(int argc, char *argv[]) if (global->verbosity) { + char str[PATH_MAX_LENGTH]; + RARCH_LOG_OUTPUT("=== Build ======================================="); - print_compiler(stderr); + rarch_print_compiler(str, sizeof(str)); + fprintf(stderr, str); + fprintf(stderr, "Built: %s\n", __DATE__); RARCH_LOG_OUTPUT("Version: %s\n", PACKAGE_VERSION); #ifdef HAVE_GIT_VERSION RARCH_LOG_OUTPUT("Git: %s\n", rarch_git_version); diff --git a/retroarch.h b/retroarch.h index 402497f576..6367f0d769 100644 --- a/retroarch.h +++ b/retroarch.h @@ -167,6 +167,13 @@ void rarch_init_system_av_info(void); void rarch_set_paths(const char *path); +/** + * rarch_print_compiler: + * + * Prints compiler that was used for compiling RetroArch. + **/ +void rarch_print_compiler(char *str, size_t sizeof_str); + #ifdef __cplusplus } #endif From cb03dcc58f4002267afb92b37370227fd23c5375 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Thu, 16 Apr 2015 20:19:53 +0200 Subject: [PATCH 027/120] Cleanups --- menu/menu_entries_cbs_deferred_push.c | 4 ---- menu/menu_entries_cbs_iterate.c | 1 - retroarch.c | 4 ++-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 4e04345a5c..89b701424e 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -272,12 +272,8 @@ static int deferred_push_core_information(void *data, void *userdata, static int deferred_push_system_information(void *data, void *userdata, const char *path, const char *label, unsigned type) { - unsigned i; file_list_t *list = (file_list_t*)data; file_list_t *menu_list = (file_list_t*)userdata; - settings_t *settings = config_get_ptr(); - driver_t *driver = driver_get_ptr(); - global_t *global = global_get_ptr(); if (!list || !menu_list) return -1; diff --git a/menu/menu_entries_cbs_iterate.c b/menu/menu_entries_cbs_iterate.c index 9cdcc3844d..2bce56e227 100644 --- a/menu/menu_entries_cbs_iterate.c +++ b/menu/menu_entries_cbs_iterate.c @@ -504,7 +504,6 @@ static int action_iterate_main(const char *label, unsigned action) menu_file_list_cbs_t *cbs = NULL; menu_handle_t *menu = menu_driver_get_ptr(); global_t *global = global_get_ptr(); - settings_t *settings = config_get_ptr(); if (!menu) return 0; diff --git a/retroarch.c b/retroarch.c index 1c74d6ce4f..e9893a3f75 100644 --- a/retroarch.c +++ b/retroarch.c @@ -172,7 +172,7 @@ static void print_help(void) puts(RETRO_FRONTEND ": Frontend for libretro -- v" PACKAGE_VERSION " --"); #endif rarch_print_compiler(str, sizeof(str)); - fprintf(stdout, str); + fprintf(stdout, "%s", str); fprintf(stdout, "Built: %s\n", __DATE__); puts("==================================================================="); puts("Usage: retroarch [content file] [options...]"); @@ -1103,7 +1103,7 @@ int rarch_main_init(int argc, char *argv[]) RARCH_LOG_OUTPUT("=== Build ======================================="); rarch_print_compiler(str, sizeof(str)); - fprintf(stderr, str); + fprintf(stderr, "%s", str); fprintf(stderr, "Built: %s\n", __DATE__); RARCH_LOG_OUTPUT("Version: %s\n", PACKAGE_VERSION); #ifdef HAVE_GIT_VERSION From 0f956fd217e1e9b77ea4cb6130ebd8cb34d4d63b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 20:21:58 +0200 Subject: [PATCH 028/120] (OSX) Add HAVE_GIT_VERSION --- apple/RetroArch_OSX.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apple/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/RetroArch_OSX.xcodeproj/project.pbxproj index 764eee0b83..34367884d2 100644 --- a/apple/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/RetroArch_OSX.xcodeproj/project.pbxproj @@ -332,6 +332,7 @@ "-DHAVE_OPENGL", "-DHAVE_FBO", "-DHAVE_GLSL", + "-DHAVE_GIT_VERSION", "-DINLINE=inline", "-D__LIBRETRO__", "-DWANT_RPNG", @@ -386,6 +387,7 @@ "-DHAVE_OPENGL", "-DHAVE_FBO", "-DHAVE_GLSL", + "-DHAVE_GIT_VERSION", "-DINLINE=inline", "-D__LIBRETRO__", "-DWANT_RPNG", From 7a5ca10c7e8d65ff870b792a4ac942d44392a9a5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 20:23:06 +0200 Subject: [PATCH 029/120] Add git_version.c to Griffin --- griffin/griffin.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/griffin/griffin.c b/griffin/griffin.c index 26f342f79c..d308cfbf3f 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -632,6 +632,14 @@ MAIN #include "../frontend/frontend.c" #endif +/*============================================================ +GIT +============================================================ */ + +#ifdef HAVE_GIT_VERSION +#include "../git_version.c" +#endif + /*============================================================ RETROARCH ============================================================ */ @@ -818,6 +826,7 @@ XML #include "../database_info.c" #endif + #ifdef __cplusplus } #endif From d266a45b7c34dae15dde83ce2317551c891f2864 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 20:24:37 +0200 Subject: [PATCH 030/120] (OSX) Take out HAVE_GIT_VERSION again --- apple/RetroArch_OSX.xcodeproj/project.pbxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/apple/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/RetroArch_OSX.xcodeproj/project.pbxproj index 34367884d2..764eee0b83 100644 --- a/apple/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/RetroArch_OSX.xcodeproj/project.pbxproj @@ -332,7 +332,6 @@ "-DHAVE_OPENGL", "-DHAVE_FBO", "-DHAVE_GLSL", - "-DHAVE_GIT_VERSION", "-DINLINE=inline", "-D__LIBRETRO__", "-DWANT_RPNG", @@ -387,7 +386,6 @@ "-DHAVE_OPENGL", "-DHAVE_FBO", "-DHAVE_GLSL", - "-DHAVE_GIT_VERSION", "-DINLINE=inline", "-D__LIBRETRO__", "-DWANT_RPNG", From 686c453681aeb329bf3edebd278b565f71ffc34d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 20:37:21 +0200 Subject: [PATCH 031/120] (System Information) Add CPU features information --- menu/menu_entries_cbs_deferred_push.c | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 89b701424e..ee6f71d252 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -300,6 +300,48 @@ static int deferred_push_system_information(void *data, void *userdata, menu_list_push(list, tmp, "", MENU_SETTINGS_CORE_INFO_NONE, 0); + { + char cpu_str[PATH_MAX_LENGTH]; + uint64_t cpu = rarch_get_cpu_features(); + + snprintf(cpu_str, sizeof(cpu_str), "CPU Features: "); + + if (cpu & RETRO_SIMD_MMX) + strlcat(cpu_str, "MMX ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_MMXEXT) + strlcat(cpu_str, "MMXEXT ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_SSE) + strlcat(cpu_str, "SSE1 ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_SSE2) + strlcat(cpu_str, "SSE2 ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_SSE3) + strlcat(cpu_str, "SSE3 ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_SSSE3) + strlcat(cpu_str, "SSSE3 ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_SSE4) + strlcat(cpu_str, "SSE4 ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_SSE42) + strlcat(cpu_str, "SSE4.2 ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_AVX) + strlcat(cpu_str, "AVX ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_AVX2) + strlcat(cpu_str, "AVX2 ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_VFPU) + strlcat(cpu_str, "VFPU ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_NEON) + strlcat(cpu_str, "NEON ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_PS) + strlcat(cpu_str, "PS ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_AES) + strlcat(cpu_str, "AES ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_VMX) + strlcat(cpu_str, "VMX ", sizeof(cpu_str)); + if (cpu & RETRO_SIMD_VMX128) + strlcat(cpu_str, "VMX128 ", sizeof(cpu_str)); + menu_list_push(list, cpu_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } + if (frontend) { int major = 0, minor = 0; From aded842d4f3731f03ad397922de5a38fe865a285 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 20:56:06 +0200 Subject: [PATCH 032/120] Start adding config.features to system information --- menu/menu_entries_cbs_deferred_push.c | 156 ++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index ee6f71d252..5611e0d837 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -31,6 +31,7 @@ #include "../gfx/video_shader_driver.h" #include "../git_version.h" +#include "../config.features.h" #ifdef HAVE_LIBRETRODB static int create_string_list_rdb_entry_string(const char *desc, const char *label, @@ -406,6 +407,161 @@ static int deferred_push_system_information(void *data, void *userdata, } } + { + char feat_str[PATH_MAX_LENGTH]; + + snprintf(feat_str, sizeof(feat_str), + "SDL1.2 support: %s", _sdl_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "SDL2 support: %s", _sdl2_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + + snprintf(feat_str, sizeof(feat_str), + "OpenGL support: %s", _opengl_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Threading support: %s", _thread_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "KMS/EGL support: %s", _kms_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Udev support: %s", _udev_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "OpenVG support: %s", _vg_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "EGL support: %s", _egl_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "X11 support: %s", _x11_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Wayland support: %s", _wayland_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "XVideo support: %s", _xvideo_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "ALSA support: %s", _alsa_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "OSS support: %s", _oss_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "OpenAL support: %s", _al_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "RSound support: %s", _rsound_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "RoarAudio support: %s", _roar_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "JACK support: %s", _jack_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "PulseAudio support: %s", _pulse_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "DirectSound support: %s", _dsound_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "XAudio2 support: %s", _xaudio_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Zlib support: %s", _zlib_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Dynamic library support: %s", _dylib_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Cg library support: %s", _cg_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "libxml2 XML parsing support: %s", _libxml2_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "SDL image support: %s", _sdl_image_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "OpenGL/Direct3D render-to-texture (multi-pass shaders) support: %s", _fbo_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "FFmpeg support: %s", _ffmpeg_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "FreeType support: %s", _freetype_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Netplay (peer-to-peer) support: %s", _netplay_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Python (script support in shaders) support: %s", _python_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } + menu_driver_populate_entries(path, label, type); return 0; From 3c498eb505ebfbcc844901dca71fc3a6112bac31 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 20:59:55 +0200 Subject: [PATCH 033/120] Add HAVE_GLSL/HAVE_HLSL to config.features.h --- config.features.h | 12 ++++++++++++ menu/menu_entries_cbs_deferred_push.c | 12 +++++++++++- retroarch.c | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/config.features.h b/config.features.h index 5c27f4dd90..d7888fbd45 100644 --- a/config.features.h +++ b/config.features.h @@ -146,6 +146,18 @@ static const bool _cg_supp = true; static const bool _cg_supp = false; #endif +#ifdef HAVE_GLSL +static const bool _glsl_supp = true; +#else +static const bool _glsl_supp = false; +#endif + +#ifdef HAVE_HLSL +static const bool _hlsl_supp = true; +#else +static const bool _hlsl_supp = false; +#endif + #ifdef HAVE_LIBXML2 static const bool _libxml2_supp = true; #else diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 5611e0d837..d995a821bf 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -522,7 +522,17 @@ static int deferred_push_system_information(void *data, void *userdata, MENU_SETTINGS_CORE_INFO_NONE, 0); snprintf(feat_str, sizeof(feat_str), - "Cg library support: %s", _cg_supp ? "true" : "false"); + "Cg support: %s", _cg_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "GLSL support: %s", _glsl_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "HLSL support: %s", _hlsl_supp ? "true" : "false"); menu_list_push(list, feat_str, "", MENU_SETTINGS_CORE_INFO_NONE, 0); diff --git a/retroarch.c b/retroarch.c index e9893a3f75..d9f12aded3 100644 --- a/retroarch.c +++ b/retroarch.c @@ -115,6 +115,8 @@ static void print_features(void) _PSUPP(al, "OpenAL", "audio driver"); _PSUPP(dylib, "External", "External filter and plugin support"); _PSUPP(cg, "Cg", "Cg pixel shaders"); + _PSUPP(glsl, "GLSL", "GLSL pixel shaders"); + _PSUPP(glsl, "HLSL", "HLSL pixel shaders"); _PSUPP(libxml2, "libxml2", "libxml2 XML parsing"); _PSUPP(sdl_image, "SDL_image", "SDL_image image loading"); _PSUPP(fbo, "FBO", "OpenGL render-to-texture (multi-pass shaders)"); From d9f5f7c457c5c2ccf89fe67c0285e493501fa635 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 21:58:19 +0200 Subject: [PATCH 034/120] Add more entries to System Information --- config.features.h | 48 +++++++++++++++++++++++++++ menu/menu_entries_cbs_deferred_push.c | 40 ++++++++++++++++++++++ retroarch.c | 6 ++++ 3 files changed, 94 insertions(+) diff --git a/config.features.h b/config.features.h index d7888fbd45..4b93a4f629 100644 --- a/config.features.h +++ b/config.features.h @@ -8,6 +8,36 @@ #include "config.h" #endif +#ifdef HAVE_OVERLAY +static const bool _overlay_supp = true; +#else +static const bool _overlay_supp = false; +#endif + +#ifdef HAVE_V4L2 +static const bool _v4l2_supp = true; +#else +static const bool _v4l2_supp = false; +#endif + +#ifdef HAVE_COMMAND +static const bool _command_supp = true; +#else +static const bool _command_supp = false; +#endif + +#ifdef HAVE_NETWORK_CMD +static const bool _network_command_supp = true; +#else +static const bool _network_command_supp = false; +#endif + +#ifdef HAVE_LIBUSB +static const bool _libusb_supp = true; +#else +static const bool _libusb_supp = false; +#endif + #ifdef HAVE_SDL static const bool _sdl_supp = true; #else @@ -92,6 +122,18 @@ static const bool _al_supp = true; static const bool _al_supp = false; #endif +#ifdef HAVE_SL +static const bool _sl_supp = true; +#else +static const bool _sl_supp = false; +#endif + +#ifdef HAVE_LIBRETRODB +static const bool _libretrodb_supp = true; +#else +static const bool _libretrodb_supp = false; +#endif + #ifdef HAVE_RSOUND static const bool _rsound_supp = true; #else @@ -134,6 +176,12 @@ static const bool _zlib_supp = true; static const bool _zlib_supp = false; #endif +#ifdef HAVE_7ZIP +static const bool _7zip_supp = true; +#else +static const bool _7zip_supp = false; +#endif + #ifdef HAVE_DYLIB static const bool _dylib_supp = true; #else diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index d995a821bf..df42c052ae 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -410,6 +410,26 @@ static int deferred_push_system_information(void *data, void *userdata, { char feat_str[PATH_MAX_LENGTH]; + snprintf(feat_str, sizeof(feat_str), + "LibretroDB support: %s", _libretrodb_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Overlay support: %s", _overlay_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Command interface support: %s", _command_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Network Command interface support: %s", _network_command_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(feat_str, sizeof(feat_str), "SDL1.2 support: %s", _sdl_supp ? "true" : "false"); menu_list_push(list, feat_str, "", @@ -481,6 +501,11 @@ static int deferred_push_system_information(void *data, void *userdata, menu_list_push(list, feat_str, "", MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(feat_str, sizeof(feat_str), + "OpenSL support: %s", _sl_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(feat_str, sizeof(feat_str), "RSound support: %s", _rsound_supp ? "true" : "false"); menu_list_push(list, feat_str, "", @@ -516,6 +541,11 @@ static int deferred_push_system_information(void *data, void *userdata, menu_list_push(list, feat_str, "", MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(feat_str, sizeof(feat_str), + "7zip support: %s", _7zip_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(feat_str, sizeof(feat_str), "Dynamic library support: %s", _dylib_supp ? "true" : "false"); menu_list_push(list, feat_str, "", @@ -570,6 +600,16 @@ static int deferred_push_system_information(void *data, void *userdata, "Python (script support in shaders) support: %s", _python_supp ? "true" : "false"); menu_list_push(list, feat_str, "", MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Video4Linux2 support: %s", _v4l2_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Libusb support: %s", _libusb_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); } menu_driver_populate_entries(path, label, type); diff --git a/retroarch.c b/retroarch.c index d9f12aded3..d84a235abb 100644 --- a/retroarch.c +++ b/retroarch.c @@ -92,6 +92,9 @@ static void print_features(void) { puts(""); puts("Features:"); + _PSUPP(libretrodb, "LibretroDB", "LibretroDB support"); + _PSUPP(command, "Command", "Command interface support"); + _PSUPP(network_command, "Network Command", "Network Command interface support"); _PSUPP(sdl, "SDL", "SDL drivers"); _PSUPP(sdl2, "SDL2", "SDL2 drivers"); _PSUPP(x11, "X11", "X11 drivers"); @@ -111,8 +114,10 @@ static void print_features(void) _PSUPP(pulse, "PulseAudio", "audio driver"); _PSUPP(dsound, "DirectSound", "audio driver"); _PSUPP(xaudio, "XAudio2", "audio driver"); + _PSUPP(7zip, "7zip", "7zip support"); _PSUPP(zlib, "zlib", "PNG encode/decode and .zip extraction"); _PSUPP(al, "OpenAL", "audio driver"); + _PSUPP(sl, "OpenSL", "audio driver"); _PSUPP(dylib, "External", "External filter and plugin support"); _PSUPP(cg, "Cg", "Cg pixel shaders"); _PSUPP(glsl, "GLSL", "GLSL pixel shaders"); @@ -125,6 +130,7 @@ static void print_features(void) _PSUPP(freetype, "FreeType", "TTF font rendering with FreeType"); _PSUPP(netplay, "Netplay", "Peer-to-peer netplay"); _PSUPP(python, "Python", "Script support in shaders"); + _PSUPP(libusb, "Libusb", "Libusb support"); } #undef _PSUPP From 182c4e5e37df5af58dbef3be6a9121ccc7f93e9f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 22:13:16 +0200 Subject: [PATCH 035/120] Add _opengles_supp to config.features.h --- config.features.h | 6 ++++++ menu/menu_entries_cbs_deferred_push.c | 5 +++++ retroarch.c | 1 + 3 files changed, 12 insertions(+) diff --git a/config.features.h b/config.features.h index 4b93a4f629..0677142006 100644 --- a/config.features.h +++ b/config.features.h @@ -62,6 +62,12 @@ static const bool _opengl_supp = true; static const bool _opengl_supp = false; #endif +#if defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES2) || defined(HAVE_OPENGLES3) +static const bool _opengles_supp = true; +#else +static const bool _opengles_supp = false; +#endif + #ifdef HAVE_KMS static const bool _kms_supp = true; #else diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index df42c052ae..4885522890 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -446,6 +446,11 @@ static int deferred_push_system_information(void *data, void *userdata, menu_list_push(list, feat_str, "", MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(feat_str, sizeof(feat_str), + "OpenGL ES support: %s", _opengles_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(feat_str, sizeof(feat_str), "Threading support: %s", _thread_supp ? "true" : "false"); menu_list_push(list, feat_str, "", diff --git a/retroarch.c b/retroarch.c index d84a235abb..49eca90f29 100644 --- a/retroarch.c +++ b/retroarch.c @@ -101,6 +101,7 @@ static void print_features(void) _PSUPP(wayland, "wayland", "Wayland drivers"); _PSUPP(thread, "Threads", "Threading support"); _PSUPP(opengl, "OpenGL", "OpenGL driver"); + _PSUPP(opengles, "OpenGL ES", "OpenGL ES driver"); _PSUPP(kms, "KMS", "KMS/EGL context support"); _PSUPP(udev, "UDEV", "UDEV/EVDEV input driver support"); _PSUPP(egl, "EGL", "EGL context support"); From 27661c8087256a6583897a64529d9ad483d4a404 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 22:39:28 +0200 Subject: [PATCH 036/120] Refactor some HAVE_X11/HAVE_EGL code --- gfx/drivers/gl.c | 2 +- griffin/griffin.c | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 0d3d92db88..3eb3a1cbe5 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1197,7 +1197,7 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video) (void)texture_fmt; #if defined(HAVE_EGL) && defined(HAVE_OPENGLES2) - // Use regular textures if we use HW render. + /* Use regular textures if we use HW render. */ gl->egl_images = !gl->hw_render_use && gl_check_eglimage_proc() && gfx_ctx_image_buffer_init(gl, video); #else diff --git a/griffin/griffin.c b/griffin/griffin.c index d308cfbf3f..c6e16e0ffa 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -116,13 +116,7 @@ VIDEO CONTEXT #if defined(HAVE_VIDEOCORE) #include "../gfx/drivers_context/vc_egl_ctx.c" #endif -#if defined(HAVE_X11) && !defined(HAVE_OPENGLES) -#include "../gfx/drivers_context/glx_ctx.c" -#endif -#if defined(HAVE_EGL) -#include "../gfx/drivers_context/xegl_ctx.c" -#endif #if defined(_WIN32) && !defined(_XBOX) #include "../gfx/drivers_context/wgl_ctx.c" @@ -131,8 +125,17 @@ VIDEO CONTEXT #endif -#ifdef HAVE_X11 +#if defined(HAVE_X11) #include "../gfx/common/x11_common.c" + +#ifndef HAVE_OPENGLES +#include "../gfx/drivers_context/glx_ctx.c" +#endif + +#ifdef HAVE_EGL +#include "../gfx/drivers_context/xegl_ctx.c" +#endif + #endif From 20e167e00fa0e4761b7294682579514049716fc5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 22:40:24 +0200 Subject: [PATCH 037/120] (xegl_ctx.c) Remove some unused X11 headers --- gfx/drivers_context/xegl_ctx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index b3153b270a..7b9ecad6e5 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -28,8 +28,6 @@ #include #include #include -#include -#include #ifndef EGL_OPENGL_ES3_BIT_KHR #define EGL_OPENGL_ES3_BIT_KHR 0x0040 From 590e315bd1c5d2bb2781cab21849afee52e654ed Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 22:41:17 +0200 Subject: [PATCH 038/120] (glx) Remove header includes here too --- gfx/drivers_context/glx_ctx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/gfx/drivers_context/glx_ctx.c b/gfx/drivers_context/glx_ctx.c index 9de508fbf3..93899e7e9a 100644 --- a/gfx/drivers_context/glx_ctx.c +++ b/gfx/drivers_context/glx_ctx.c @@ -22,8 +22,6 @@ #include #include -#include -#include #include static int (*g_pglSwapInterval)(int); From 3a6e369516159960813be5d2705876389962fae3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 23:03:55 +0200 Subject: [PATCH 039/120] (Context drivers) Cleanups --- gfx/drivers_context/emscriptenegl_ctx.c | 4 +++- gfx/drivers_context/vc_egl_ctx.c | 4 +++- gfx/drivers_context/wayland_ctx.c | 4 +++- gfx/drivers_context/xegl_ctx.c | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gfx/drivers_context/emscriptenegl_ctx.c b/gfx/drivers_context/emscriptenegl_ctx.c index 5534376ee3..0ae0d6e3ef 100644 --- a/gfx/drivers_context/emscriptenegl_ctx.c +++ b/gfx/drivers_context/emscriptenegl_ctx.c @@ -200,8 +200,10 @@ static bool gfx_ctx_emscripten_bind_api(void *data, case GFX_CTX_OPENGL_ES_API: return eglBindAPI(EGL_OPENGL_ES_API); default: - return false; + break; } + + return false; } static void gfx_ctx_emscripten_destroy(void *data) diff --git a/gfx/drivers_context/vc_egl_ctx.c b/gfx/drivers_context/vc_egl_ctx.c index 38a3996e2e..238d72b9b1 100644 --- a/gfx/drivers_context/vc_egl_ctx.c +++ b/gfx/drivers_context/vc_egl_ctx.c @@ -368,8 +368,10 @@ static bool gfx_ctx_vc_bind_api(void *data, case GFX_CTX_OPENVG_API: return eglBindAPI(EGL_OPENVG_API); default: - return false; + break; } + + return false; } static void gfx_ctx_vc_destroy(void *data) diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index b268846caa..20d4b1b451 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -721,8 +721,10 @@ static bool gfx_ctx_wl_bind_api(void *data, case GFX_CTX_OPENVG_API: return eglBindAPI(EGL_OPENVG_API); default: - return false; + break; } + + return false; } static void gfx_ctx_wl_bind_hw_render(void *data, bool enable) diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index 7b9ecad6e5..0f56588182 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -781,8 +781,10 @@ static bool gfx_ctx_xegl_bind_api(void *data, case GFX_CTX_OPENVG_API: return eglBindAPI(EGL_OPENVG_API); default: - return false; + break; } + + return false; } static void gfx_ctx_xegl_show_mouse(void *data, bool state) From 94b1f2f54f3930ae9ee41fafd67d994862bb431d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 23:04:22 +0200 Subject: [PATCH 040/120] (drm_egl_ctx.c) Cleanup --- gfx/drivers_context/drm_egl_ctx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/drivers_context/drm_egl_ctx.c b/gfx/drivers_context/drm_egl_ctx.c index fb6c4011a3..5ec08db509 100644 --- a/gfx/drivers_context/drm_egl_ctx.c +++ b/gfx/drivers_context/drm_egl_ctx.c @@ -933,7 +933,7 @@ static bool gfx_ctx_drm_egl_bind_api(void *data, case GFX_CTX_OPENVG_API: return eglBindAPI(EGL_OPENVG_API); default: - return false; + break; } return false; From 4468f768a65ec71ad365df811afd709a1959eb99 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 23:22:29 +0200 Subject: [PATCH 041/120] Cleanups --- menu/menu_entries_cbs_deferred_push.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 4885522890..7958cdcb69 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -353,18 +353,22 @@ static int deferred_push_system_information(void *data, void *userdata, MENU_SETTINGS_CORE_INFO_NONE, 0); if (frontend->get_name) + { frontend->get_name(tmp2, sizeof(tmp2)); - snprintf(tmp, sizeof(tmp), "Frontend name: %s", - frontend->get_name ? tmp2 : "N/A"); - menu_list_push(list, tmp, "", - MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(tmp, sizeof(tmp), "Frontend name: %s", + frontend->get_name ? tmp2 : "N/A"); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } if (frontend->get_os) + { frontend->get_os(tmp2, sizeof(tmp2), &major, &minor); - snprintf(tmp, sizeof(tmp), "Frontend OS: %s %d.%d", - frontend->get_os ? tmp2 : "N/A", major, minor); - menu_list_push(list, tmp, "", - MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(tmp, sizeof(tmp), "Frontend OS: %s %d.%d", + frontend->get_os ? tmp2 : "N/A", major, minor); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } snprintf(tmp, sizeof(tmp), "RetroRating level: %d", frontend->get_rating ? frontend->get_rating() : -1); From 4c5a009f434b2851c03754f0b1c2997091fe9441 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 16 Apr 2015 23:40:55 +0200 Subject: [PATCH 042/120] Cleanups --- command_event.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/command_event.c b/command_event.c index 0000667b87..d3637e1397 100644 --- a/command_event.c +++ b/command_event.c @@ -622,12 +622,13 @@ static void event_set_savestate_auto_index(void) static bool event_init_content(void) { + driver_t *driver = driver_get_ptr(); global_t *global = global_get_ptr(); /* No content to be loaded for dummy core, * just successfully exit. */ if (global->libretro_dummy) - return true; + goto end; if (!global->libretro_no_content) rarch_fill_pathnames(); @@ -647,12 +648,15 @@ static bool event_init_content(void) event_command(EVENT_CMD_BSV_MOVIE_INIT); event_command(EVENT_CMD_NETPLAY_INIT); +end: + retro_init_libretro_cbs(&driver->retro_ctx); + rarch_init_system_av_info(); + return true; } static bool event_init_core(void) { - driver_t *driver = driver_get_ptr(); global_t *global = global_get_ptr(); if (config_load_override()) @@ -673,9 +677,6 @@ static bool event_init_core(void) if (!event_init_content()) return false; - retro_init_libretro_cbs(&driver->retro_ctx); - rarch_init_system_av_info(); - return true; } From 2c2fa0ce30c6b59b7e37acf71a89291cd81e4ed6 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 17 Apr 2015 10:54:03 +0200 Subject: [PATCH 043/120] (CoreAudio) Use straight pthread again --- audio/drivers/coreaudio.c | 96 ++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 53 deletions(-) diff --git a/audio/drivers/coreaudio.c b/audio/drivers/coreaudio.c index 3debd7ce02..fd025f171e 100644 --- a/audio/drivers/coreaudio.c +++ b/audio/drivers/coreaudio.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #ifdef OSX #include @@ -33,8 +33,8 @@ typedef struct coreaudio { - slock_t *lock; - scond_t *cond; + pthread_mutex_t lock; + pthread_cond_t cond; #ifdef OSX_PPC ComponentInstance dev; @@ -71,8 +71,8 @@ static void coreaudio_free(void *data) if (dev->buffer) fifo_free(dev->buffer); - slock_free(dev->lock); - scond_free(dev->cond); + pthread_mutex_destroy(&dev->lock); + pthread_cond_destroy(&dev->cond); free(dev); } @@ -82,8 +82,8 @@ static OSStatus audio_write_cb(void *userdata, const AudioTimeStamp *time_stamp, UInt32 bus_number, UInt32 number_frames, AudioBufferList *io_data) { + void *outbuf; unsigned write_avail; - void *outbuf = NULL; coreaudio_t *dev = (coreaudio_t*)userdata; (void)time_stamp; @@ -96,9 +96,9 @@ static OSStatus audio_write_cb(void *userdata, return noErr; write_avail = io_data->mBuffers[0].mDataByteSize; - outbuf = io_data->mBuffers[0].mData; + outbuf = io_data->mBuffers[0].mData; - slock_lock(dev->lock); + pthread_mutex_lock(&dev->lock); if (fifo_read_avail(dev->buffer) < write_avail) { @@ -107,15 +107,16 @@ static OSStatus audio_write_cb(void *userdata, /* Seems to be needed. */ memset(outbuf, 0, write_avail); - goto end; + pthread_mutex_unlock(&dev->lock); + + /* Technically possible to deadlock without. */ + pthread_cond_signal(&dev->cond); + return noErr; } fifo_read(dev->buffer, outbuf, write_avail); - -end: - slock_unlock(dev->lock); - scond_signal(dev->cond); - + pthread_mutex_unlock(&dev->lock); + pthread_cond_signal(&dev->cond); return noErr; } @@ -123,8 +124,7 @@ end: static void choose_output_device(coreaudio_t *dev, const char* device) { unsigned i; - UInt32 size = 0, deviceCount; - AudioDeviceID *devices = NULL; + AudioDeviceID *devices; AudioObjectPropertyAddress propaddr = { kAudioHardwarePropertyDevices, @@ -132,23 +132,22 @@ static void choose_output_device(coreaudio_t *dev, const char* device) kAudioObjectPropertyElementMaster }; + UInt32 size = 0, deviceCount; + if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propaddr, 0, 0, &size) != noErr) return; - deviceCount = size / sizeof(AudioDeviceID); - devices = (AudioDeviceID*)malloc(size); + deviceCount = size / sizeof(AudioDeviceID); + devices = (AudioDeviceID*)malloc(size); - if (!devices) - goto done; - - if (AudioObjectGetPropertyData(kAudioObjectSystemObject, + if (!devices || AudioObjectGetPropertyData(kAudioObjectSystemObject, &propaddr, 0, 0, &size, devices) != noErr) goto done; - propaddr.mScope = kAudioDevicePropertyScopeOutput; + propaddr.mScope = kAudioDevicePropertyScopeOutput; propaddr.mSelector = kAudioDevicePropertyDeviceName; - size = 1024; + size = 1024; for (i = 0; i < deviceCount; i ++) { @@ -196,12 +195,12 @@ static void *coreaudio_init(const char *device, AudioStreamBasicDescription stream_desc = {0}; static bool session_initialized = false; coreaudio_t *dev = NULL; - settings_t *settings = config_get_ptr(); #ifdef OSX_PPC ComponentDescription desc = {0}; #else AudioComponentDescription desc = {0}; #endif + settings_t *settings = config_get_ptr(); (void)session_initialized; (void)device; @@ -210,22 +209,8 @@ static void *coreaudio_init(const char *device, if (!dev) return NULL; - dev->lock = slock_new(); - - if (!dev->lock) - { - free(dev); - return NULL; - } - - dev->cond = scond_new(); - - if (!dev->cond) - { - free(dev->lock); - free(dev); - return NULL; - } + pthread_mutex_init(&dev->lock, NULL); + pthread_cond_init(&dev->cond, NULL); #ifdef IOS if (!session_initialized) @@ -284,8 +269,7 @@ static void *coreaudio_init(const char *device, goto error; /* Check returned audio format. */ - i_size = sizeof(real_desc); - + i_size = sizeof(real_desc); if (AudioUnitGetProperty(dev->dev, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &real_desc, &i_size) != noErr) goto error; @@ -351,40 +335,46 @@ static ssize_t coreaudio_write(void *data, const void *buf_, size_t size) size_t written = 0; #ifdef IOS + struct timespec timeout; struct timeval time; + gettimeofday(&time, 0); + + memset(&timeout, 0, sizeof(timeout)); + timeout.tv_sec = time.tv_sec + 3; + timeout.tv_nsec = time.tv_usec * 1000; #endif while (!g_interrupted && size > 0) { size_t write_avail; - slock_lock(dev->lock); + pthread_mutex_lock(&dev->lock); write_avail = fifo_write_avail(dev->buffer); if (write_avail > size) write_avail = size; fifo_write(dev->buffer, buf, write_avail); - buf += write_avail; + buf += write_avail; written += write_avail; - size -= write_avail; + size -= write_avail; if (dev->nonblock) { - slock_unlock(dev->lock); + pthread_mutex_unlock(&dev->lock); break; } #ifdef IOS - if (write_avail == 0 && !scond_wait_timeout( - dev->cond, dev->lock, time.tv_usec)) + if (write_avail == 0 && pthread_cond_timedwait( + &dev->cond, &dev->lock, &timeout) == ETIMEDOUT) g_interrupted = true; #else if (write_avail == 0) - scond_wait(dev->cond, dev->lock); + pthread_cond_wait(&dev->cond, &dev->lock); #endif - slock_unlock(dev->lock); + pthread_mutex_unlock(&dev->lock); } return written; @@ -434,9 +424,9 @@ static size_t coreaudio_write_avail(void *data) size_t avail; coreaudio_t *dev = (coreaudio_t*)data; - slock_lock(dev->lock); + pthread_mutex_lock(&dev->lock); avail = fifo_write_avail(dev->buffer); - slock_unlock(dev->lock); + pthread_mutex_unlock(&dev->lock); return avail; } From 2076846a5c272fcf9e8e150772e5300b37186059 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Fri, 17 Apr 2015 19:45:07 +0100 Subject: [PATCH 044/120] (CTR/3DS) disable v-sync blocking after a missed vblank-start event. will prevent cores running under 60fps from slowing down even more. --- gfx/drivers/ctr_gfx.c | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index a92bc5a408..8aa241e751 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -228,28 +228,37 @@ static bool ctr_frame(void* data, const void* frame, extern bool select_pressed; - RARCH_PERFORMANCE_INIT(ctrframe_f); - RARCH_PERFORMANCE_START(ctrframe_f); - if (!width || !height) { gspWaitForEvent(GSPEVENT_VBlank0, true); - goto end; + return true; } if(!aptMainLoop()) { event_command(EVENT_CMD_QUIT); - goto end; + return true; } if (select_pressed) { event_command(EVENT_CMD_QUIT); - goto end; + return true; } + svcWaitSynchronization(gspEvents[GSPEVENT_P3D], 20000000); + svcClearEvent(gspEvents[GSPEVENT_P3D]); + svcWaitSynchronization(gspEvents[GSPEVENT_PPF], 20000000); + svcClearEvent(gspEvents[GSPEVENT_PPF]); + + gfxSwapBuffersGpu(); frames++; + + if (ctr->vsync) + svcWaitSynchronization(gspEvents[GSPEVENT_VBlank0], U64_MAX); + + svcClearEvent(gspEvents[GSPEVENT_VBlank0]); + currentTick = svcGetSystemTick(); uint32_t diff = currentTick - lastTick; if(diff > CTR_CPU_TICKS_PER_SECOND) @@ -260,23 +269,10 @@ static bool ctr_frame(void* data, const void* frame, } printf("fps: %8.4f frames: %i\r", fps, total_frames++); -// fflush(stdout); + fflush(stdout); - /* enable this to profile the core without video output */ -#if 0 - if (!ctr->menu_texture_enable) - goto end; -#endif - - svcWaitSynchronization(gspEvents[GSPEVENT_P3D], 20000000); - svcClearEvent(gspEvents[GSPEVENT_P3D]); - svcWaitSynchronization(gspEvents[GSPEVENT_PPF], 20000000); - svcClearEvent(gspEvents[GSPEVENT_PPF]); - - gfxSwapBuffersGpu(); - - if (ctr->vsync) - gspWaitForEvent(GSPEVENT_VBlank0, true); + RARCH_PERFORMANCE_INIT(ctrframe_f); + RARCH_PERFORMANCE_START(ctrframe_f); ctrGuSetMemoryFill(true, (u32*)CTR_GPU_FRAMEBUFFER, 0x00000000, (u32*)(CTR_GPU_FRAMEBUFFER + CTR_TOP_FRAMEBUFFER_WIDTH * CTR_TOP_FRAMEBUFFER_HEIGHT * sizeof(uint32_t)), @@ -363,9 +359,6 @@ static bool ctr_frame(void* data, const void* frame, ctrGuDisplayTransfer(true, CTR_GPU_FRAMEBUFFER, 240,400, CTRGU_RGBA8, gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), 240,400,CTRGU_RGB8, CTRGU_MULTISAMPLE_NONE); - -end: -// gspWaitForEvent(GSPEVENT_VBlank0, true); RARCH_PERFORMANCE_STOP(ctrframe_f); return true; } From 1575b7e87f955291f55aaff6f1aa9695fde4556e Mon Sep 17 00:00:00 2001 From: aliaspider Date: Fri, 17 Apr 2015 19:50:36 +0100 Subject: [PATCH 045/120] (CTR/3DS) audio driver: use cpu tick count instead of csndGetState to determine the playback position. fixes a random lockup that can happen when calling csndGetState, and also removes the need to rely on samplePAddr since it doesn't seem to available on all systems. --- audio/drivers/ctr_audio.c | 123 +++++++++++++++++++++----------------- 1 file changed, 69 insertions(+), 54 deletions(-) diff --git a/audio/drivers/ctr_audio.c b/audio/drivers/ctr_audio.c index a82f15561c..3c3ba73333 100644 --- a/audio/drivers/ctr_audio.c +++ b/audio/drivers/ctr_audio.c @@ -21,20 +21,24 @@ typedef struct { bool nonblocking; + bool playing; int16_t* l; int16_t* r; - int16_t* silence; uint32_t l_paddr; uint32_t r_paddr; - uint32_t silence_paddr; uint32_t pos; + + uint32_t playpos; + uint32_t cpu_ticks_per_sample; + uint64_t cpu_ticks_last; + int rate; } ctr_audio_t; -#define CTR_AUDIO_COUNT (1u << 12u) +#define CTR_AUDIO_COUNT (1u << 11u) #define CTR_AUDIO_COUNT_MASK (CTR_AUDIO_COUNT - 1u) #define CTR_AUDIO_SIZE (CTR_AUDIO_COUNT * sizeof(int16_t)) #define CTR_AUDIO_SIZE_MASK (CTR_AUDIO_SIZE - 1u) @@ -52,31 +56,30 @@ static void *ctr_audio_init(const char *device, unsigned rate, unsigned latency) ctr_audio_t *ctr = (ctr_audio_t*)calloc(1, sizeof(ctr_audio_t)); - ctr->l = linearAlloc(CTR_AUDIO_SIZE); - ctr->r = linearAlloc(CTR_AUDIO_SIZE); - ctr->silence = linearAlloc(CTR_AUDIO_SIZE); + ctr->l = linearAlloc(CTR_AUDIO_SIZE); + ctr->r = linearAlloc(CTR_AUDIO_SIZE); - memset(ctr->l, 0, CTR_AUDIO_SIZE); - memset(ctr->r, 0, CTR_AUDIO_SIZE); - memset(ctr->silence, 0, CTR_AUDIO_SIZE); + memset(ctr->l, 0, CTR_AUDIO_SIZE); + memset(ctr->r, 0, CTR_AUDIO_SIZE); - ctr->l_paddr = osConvertVirtToPhys((u32)ctr->l); - ctr->r_paddr = osConvertVirtToPhys((u32)ctr->r); - ctr->silence_paddr = osConvertVirtToPhys((u32)ctr->silence); + ctr->l_paddr = osConvertVirtToPhys((u32)ctr->l); + ctr->r_paddr = osConvertVirtToPhys((u32)ctr->r); ctr->pos = 0; ctr->rate = rate; + ctr->cpu_ticks_per_sample = CSND_TIMER(rate) * 4; - GSPGPU_FlushDataCache(NULL, (u8*)ctr->silence, CTR_AUDIO_SIZE); + GSPGPU_FlushDataCache(NULL, (u8*)ctr->l_paddr, CTR_AUDIO_SIZE); + GSPGPU_FlushDataCache(NULL, (u8*)ctr->r_paddr, CTR_AUDIO_SIZE); csndPlaySound(0x8, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16), - rate, ctr->silence, ctr->silence, CTR_AUDIO_SIZE); + rate, 1.0, -1.0, ctr->l, ctr->l, CTR_AUDIO_SIZE); csndPlaySound(0x9, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16), - rate, ctr->silence, ctr->silence, CTR_AUDIO_SIZE); + rate, 1.0, 1.0, ctr->r, ctr->r, CTR_AUDIO_SIZE); - CSND_SetVol(0x8, 0xFFFF, 0); - CSND_SetVol(0x9, 0, 0xFFFF); - csndExecCmds(false); + ctr->playpos = 0; + ctr->cpu_ticks_last = svcGetSystemTick(); + ctr->playing = true; return ctr; } @@ -92,7 +95,6 @@ static void ctr_audio_free(void *data) linearFree(ctr->l); linearFree(ctr->r); - linearFree(ctr->silence); free(ctr); } @@ -107,45 +109,35 @@ static ssize_t ctr_audio_write(void *data, const void *buf, size_t size) int i; const uint16_t* src = buf; - RARCH_PERFORMANCE_INIT(ctraudio_f); + RARCH_PERFORMANCE_INIT(ctraudio_f); RARCH_PERFORMANCE_START(ctraudio_f); - CSND_ChnInfo channel_info; - csndGetState(0x8, &channel_info); + uint64_t current_tick = svcGetSystemTick(); + uint32_t samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample; + ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK; + ctr->cpu_ticks_last += samples_played * ctr->cpu_ticks_per_sample; - uint32_t playpos; - if((channel_info.samplePAddr >= (ctr->l_paddr)) && - (channel_info.samplePAddr < (ctr->l_paddr + CTR_AUDIO_SIZE))) - { - playpos = (channel_info.samplePAddr - ctr->l_paddr) / sizeof(uint16_t); - } - else - { - CSND_SetBlock(0x8, 1, ctr->l_paddr, CTR_AUDIO_SIZE); - CSND_SetBlock(0x9, 1, ctr->r_paddr, CTR_AUDIO_SIZE); - csndExecCmds(false); - playpos = 0; - } - if((((playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 2)) || - (((ctr->pos - playpos ) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 4)) || - (((playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (size >> 2))) + if((((ctr->playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 2)) || + (((ctr->pos - ctr->playpos ) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 4)) || + (((ctr->playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (size >> 2))) { if (ctr->nonblocking) - ctr->pos = (playpos + (CTR_AUDIO_COUNT >> 1)) & CTR_AUDIO_COUNT_MASK; + ctr->pos = (ctr->playpos + (CTR_AUDIO_COUNT >> 1)) & CTR_AUDIO_COUNT_MASK; else { do{ + /* todo: compute the correct sleep period */ svcSleepThread(100000); -// svcSleepThread(((s64)(CTR_AUDIO_COUNT >> 8) * 1000000000) / ctr->rate); - csndGetState(0x8, &channel_info); - playpos = (channel_info.samplePAddr - ctr->l_paddr) / sizeof(uint16_t); - }while (((playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 1) - || (((ctr->pos - playpos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 4))); + current_tick = svcGetSystemTick(); + samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample; + ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK; + ctr->cpu_ticks_last += samples_played * ctr->cpu_ticks_per_sample; + }while (((ctr->playpos - ctr->pos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 1) + || (((ctr->pos - ctr->playpos) & CTR_AUDIO_COUNT_MASK) < (CTR_AUDIO_COUNT >> 4))); } } - for (i = 0; i < (size >> 1); i += 2) { ctr->l[ctr->pos] = src[i]; @@ -153,6 +145,9 @@ static ssize_t ctr_audio_write(void *data, const void *buf, size_t size) ctr->pos++; ctr->pos &= CTR_AUDIO_COUNT_MASK; } + GSPGPU_FlushDataCache(NULL, (u8*)ctr->l, CTR_AUDIO_SIZE); + GSPGPU_FlushDataCache(NULL, (u8*)ctr->r, CTR_AUDIO_SIZE); + RARCH_PERFORMANCE_STOP(ctraudio_f); @@ -163,31 +158,51 @@ static bool ctr_audio_stop(void *data) { ctr_audio_t* ctr = (ctr_audio_t*)data; - CSND_SetBlock(0x8, 1, ctr->silence_paddr, CTR_AUDIO_SIZE); - CSND_SetBlock(0x9, 1, ctr->silence_paddr, CTR_AUDIO_SIZE); + /* using SetPlayState would make tracking the playback + * position more difficult */ + +// CSND_SetPlayState(0x8, 0); +// CSND_SetPlayState(0x9, 0); + + /* setting the channel volume to 0 seems to make it + * impossible to set it back to full volume later */ + + CSND_SetVol(0x8, 0x00000001, 0); + CSND_SetVol(0x9, 0x00010000, 0); csndExecCmds(false); + ctr->playing = false; + return true; } static bool ctr_audio_alive(void *data) { - (void)data; - return true; + ctr_audio_t* ctr = (ctr_audio_t*)data; + return ctr->playing; } static bool ctr_audio_start(void *data) { ctr_audio_t* ctr = (ctr_audio_t*)data; + global_t *global = global_get_ptr(); -// csndPlaySound(0x8, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16), -// ctr->rate, ctr->l_paddr + ((ctr->pos + (CTR_AUDIO_SIZE / 2)) & CTR_AUDIO_SIZE_MASK), -// (u32*)ctr->silence_paddr, CTR_AUDIO_SIZE); + /* prevents restarting audio when the menu + * is toggled off on shutdown */ + + if (global->system.shutdown) + return true; + +// CSND_SetPlayState(0x8, 1); +// CSND_SetPlayState(0x9, 1); + + CSND_SetVol(0x8, 0x00008000, 0); + CSND_SetVol(0x9, 0x80000000, 0); - CSND_SetBlock(0x8, 1, ctr->l_paddr, CTR_AUDIO_SIZE); - CSND_SetBlock(0x9, 1, ctr->r_paddr, CTR_AUDIO_SIZE); csndExecCmds(false); + ctr->playing = true; + return true; } From 3ef7d0f4de00ab0c30ce4450fa2a092fed0256cb Mon Sep 17 00:00:00 2001 From: radius Date: Fri, 17 Apr 2015 18:52:10 -0500 Subject: [PATCH 046/120] allow saving manually when overrides are active --- command_event.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/command_event.c b/command_event.c index d3637e1397..888f3487d2 100644 --- a/command_event.c +++ b/command_event.c @@ -725,6 +725,7 @@ static bool event_save_core_config(void) config_path[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH]; bool ret = false; bool found_path = false; + bool overrides_active = false; settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); @@ -786,6 +787,13 @@ static bool event_save_core_config(void) sizeof(config_path)); } + /* Overrides block config file saving, make it appear as overrides weren't enabled for a manual save */ + if (global->overrides_active) + { + global->overrides_active = false; + overrides_active = true; + } + if ((ret = config_save_file(config_path))) { strlcpy(global->config_path, config_path, @@ -802,7 +810,7 @@ static bool event_save_core_config(void) } rarch_main_msg_queue_push(msg, 1, 180, true); - + global->overrides_active = overrides_active; return ret; } From bb48ebfb990887b6a9335430e23ecd8d21d4b7b7 Mon Sep 17 00:00:00 2001 From: radius Date: Fri, 17 Apr 2015 20:07:15 -0500 Subject: [PATCH 047/120] add setting to enable/disable autoload of config overrides --- command_event.c | 16 ++++++++++------ config.def.h | 2 ++ configuration.c | 4 ++++ configuration.h | 1 + settings.c | 12 ++++++++++++ 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/command_event.c b/command_event.c index 888f3487d2..5e49b81a84 100644 --- a/command_event.c +++ b/command_event.c @@ -657,12 +657,16 @@ end: static bool event_init_core(void) { - global_t *global = global_get_ptr(); - - if (config_load_override()) - global->overrides_active = true; - else - global->overrides_active = false; + global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); + + if(settings->auto_overrides_enable) + { + if (config_load_override()) + global->overrides_active = true; + else + global->overrides_active = false; + } pretro_set_environment(rarch_environment_cb); diff --git a/config.def.h b/config.def.h index 75a98ec87f..c5c6467942 100644 --- a/config.def.h +++ b/config.def.h @@ -491,6 +491,8 @@ static bool default_core_specific_config = true; static bool default_core_specific_config = false; #endif +static bool default_auto_overrides_enable = false; + /* Crop overscanned frames. */ static const bool crop_overscan = true; diff --git a/configuration.c b/configuration.c index 9a187f2401..f017328fff 100644 --- a/configuration.c +++ b/configuration.c @@ -681,6 +681,7 @@ static void config_set_defaults(void) *settings->menu_config_directory = '\0'; #endif settings->core_specific_config = default_core_specific_config; + settings->auto_overrides_enable = default_auto_overrides_enable; settings->user_language = 0; global->console.sound.system_bgm_enable = false; @@ -1595,6 +1596,7 @@ static bool config_load_file(const char *path, bool set_defaults) config_read_keybinds_conf(conf); CONFIG_GET_BOOL_BASE(conf, settings, core_specific_config, "core_specific_config"); + CONFIG_GET_BOOL_BASE(conf, settings, auto_overrides_enable, "auto_overrides_enable"); config_file_free(conf); return true; @@ -2467,6 +2469,8 @@ bool config_save_file(const char *path) config_set_bool(conf, "core_specific_config", settings->core_specific_config); + config_set_bool(conf, "auto_overrides_enable", + settings->auto_overrides_enable); config_set_int(conf, "libretro_log_level", settings->libretro_log_level); config_set_bool(conf, "log_verbosity", global->verbosity); config_set_bool(conf, "perfcnt_enable", global->perfcnt_enable); diff --git a/configuration.h b/configuration.h index 76dfb50e5c..e05eb94e0a 100644 --- a/configuration.h +++ b/configuration.h @@ -308,6 +308,7 @@ typedef struct settings bool load_dummy_on_core_shutdown; bool core_specific_config; + bool auto_overrides_enable; char username[32]; unsigned int user_language; diff --git a/settings.c b/settings.c index 9b07e33a3a..d90cc93d4f 100644 --- a/settings.c +++ b/settings.c @@ -3626,6 +3626,18 @@ static bool setting_append_list_general_options( general_write_handler, general_read_handler); + CONFIG_BOOL( + settings->auto_overrides_enable, + "auto_overrides_enable", + "Load Overrides Automatically", + default_auto_overrides_enable, + "OFF", + "ON", + group_info.name, + subgroup_info.name, + general_write_handler, + general_read_handler); + END_SUB_GROUP(list, list_info); From e2479ade31a88ae3299aac3eee96072d9f167934 Mon Sep 17 00:00:00 2001 From: radius Date: Fri, 17 Apr 2015 20:10:26 -0500 Subject: [PATCH 048/120] add setting to enable/disable autoload of remap files --- command_event.c | 3 ++- config.def.h | 1 + configuration.c | 4 ++++ configuration.h | 1 + settings.c | 13 ++++++++++++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/command_event.c b/command_event.c index 5e49b81a84..04afd06280 100644 --- a/command_event.c +++ b/command_event.c @@ -670,7 +670,8 @@ static bool event_init_core(void) pretro_set_environment(rarch_environment_cb); - config_load_remap(); + if(settings->auto_remaps_enable) + config_load_remap(); rarch_verify_api_version(); pretro_init(); diff --git a/config.def.h b/config.def.h index c5c6467942..0fce8c2839 100644 --- a/config.def.h +++ b/config.def.h @@ -492,6 +492,7 @@ static bool default_core_specific_config = false; #endif static bool default_auto_overrides_enable = false; +static bool default_auto_remaps_enable = false; /* Crop overscanned frames. */ static const bool crop_overscan = true; diff --git a/configuration.c b/configuration.c index f017328fff..f62fb83af1 100644 --- a/configuration.c +++ b/configuration.c @@ -682,6 +682,7 @@ static void config_set_defaults(void) #endif settings->core_specific_config = default_core_specific_config; settings->auto_overrides_enable = default_auto_overrides_enable; + settings->auto_remaps_enable = default_auto_remaps_enable; settings->user_language = 0; global->console.sound.system_bgm_enable = false; @@ -1597,6 +1598,7 @@ static bool config_load_file(const char *path, bool set_defaults) CONFIG_GET_BOOL_BASE(conf, settings, core_specific_config, "core_specific_config"); CONFIG_GET_BOOL_BASE(conf, settings, auto_overrides_enable, "auto_overrides_enable"); + CONFIG_GET_BOOL_BASE(conf, settings, auto_remaps_enable, "auto_remaps_enable"); config_file_free(conf); return true; @@ -2471,6 +2473,8 @@ bool config_save_file(const char *path) settings->core_specific_config); config_set_bool(conf, "auto_overrides_enable", settings->auto_overrides_enable); + config_set_bool(conf, "auto_remaps_enable", + settings->auto_remaps_enable); config_set_int(conf, "libretro_log_level", settings->libretro_log_level); config_set_bool(conf, "log_verbosity", global->verbosity); config_set_bool(conf, "perfcnt_enable", global->perfcnt_enable); diff --git a/configuration.h b/configuration.h index e05eb94e0a..cb82a7c52e 100644 --- a/configuration.h +++ b/configuration.h @@ -309,6 +309,7 @@ typedef struct settings bool core_specific_config; bool auto_overrides_enable; + bool auto_remaps_enable; char username[32]; unsigned int user_language; diff --git a/settings.c b/settings.c index d90cc93d4f..4634c18369 100644 --- a/settings.c +++ b/settings.c @@ -3629,7 +3629,7 @@ static bool setting_append_list_general_options( CONFIG_BOOL( settings->auto_overrides_enable, "auto_overrides_enable", - "Load Overrides Automatically", + "Load Override Files Automatically", default_auto_overrides_enable, "OFF", "ON", @@ -3638,6 +3638,17 @@ static bool setting_append_list_general_options( general_write_handler, general_read_handler); + CONFIG_BOOL( + settings->auto_remaps_enable, + "auto_remaps_enable", + "Load Remap Files Automatically", + default_auto_remaps_enable, + "OFF", + "ON", + group_info.name, + subgroup_info.name, + general_write_handler, + general_read_handler); END_SUB_GROUP(list, list_info); From b721389234e3042deac32f8f95a920c0950dcf88 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 13:56:26 +0200 Subject: [PATCH 049/120] Create 'get_powerstate' function for frontend driver --- frontend/drivers/platform_android.c | 1 + frontend/drivers/platform_apple.c | 1 + frontend/drivers/platform_ctr.c | 1 + frontend/drivers/platform_gx.c | 1 + frontend/drivers/platform_null.c | 1 + frontend/drivers/platform_ps3.c | 1 + frontend/drivers/platform_psp.c | 1 + frontend/drivers/platform_qnx.c | 1 + frontend/drivers/platform_win32.c | 1 + frontend/drivers/platform_xdk.c | 1 + frontend/frontend_driver.h | 10 ++++++++++ 11 files changed, 20 insertions(+) diff --git a/frontend/drivers/platform_android.c b/frontend/drivers/platform_android.c index 0936e6a639..113d36a0bf 100644 --- a/frontend/drivers/platform_android.c +++ b/frontend/drivers/platform_android.c @@ -869,5 +869,6 @@ const frontend_ctx_driver_t frontend_ctx_android = { NULL, /* get_os */ frontend_android_get_rating, /* get_rating */ NULL, /* load_content */ + NULL, /* get_powerstate */ "android", }; diff --git a/frontend/drivers/platform_apple.c b/frontend/drivers/platform_apple.c index d58d33010b..20ff00aca6 100644 --- a/frontend/drivers/platform_apple.c +++ b/frontend/drivers/platform_apple.c @@ -312,5 +312,6 @@ const frontend_ctx_driver_t frontend_ctx_apple = { frontend_apple_get_os, /* get_os */ frontend_apple_get_rating, /* get_rating */ frontend_apple_load_content, /* load_content */ + NULL, /* get_powerstate */ "apple", }; diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index e5aea45e7f..fc22163b74 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -199,5 +199,6 @@ const frontend_ctx_driver_t frontend_ctx_ctr = { NULL, /* get_os */ frontend_ctr_get_rating, /* get_rating */ NULL, /* load_content */ + NULL, /* get_powerstate */ "ctr", }; diff --git a/frontend/drivers/platform_gx.c b/frontend/drivers/platform_gx.c index a3a5da4f1d..80b7f0796f 100644 --- a/frontend/drivers/platform_gx.c +++ b/frontend/drivers/platform_gx.c @@ -389,5 +389,6 @@ const frontend_ctx_driver_t frontend_ctx_gx = { NULL, /* get_os */ frontend_gx_get_rating, /* get_rating */ NULL, /* load_content */ + NULL, /* get_powerstate */ "gx", }; diff --git a/frontend/drivers/platform_null.c b/frontend/drivers/platform_null.c index 07368acebc..e0ffcb4ba8 100644 --- a/frontend/drivers/platform_null.c +++ b/frontend/drivers/platform_null.c @@ -34,5 +34,6 @@ const frontend_ctx_driver_t frontend_ctx_null = { NULL, /* get_os */ NULL, /* get_rating */ NULL, /* load_content */ + NULL, /* get_powerstate */ "null", }; diff --git a/frontend/drivers/platform_ps3.c b/frontend/drivers/platform_ps3.c index 3e439031fc..3d6f6da3fa 100644 --- a/frontend/drivers/platform_ps3.c +++ b/frontend/drivers/platform_ps3.c @@ -452,5 +452,6 @@ const frontend_ctx_driver_t frontend_ctx_ps3 = { NULL, /* get_os */ frontend_ps3_get_rating, /* get_rating */ NULL, /* load_content */ + NULL, /* get_powerstate */ "ps3", }; diff --git a/frontend/drivers/platform_psp.c b/frontend/drivers/platform_psp.c index 35d3469e54..4937ac1c5a 100644 --- a/frontend/drivers/platform_psp.c +++ b/frontend/drivers/platform_psp.c @@ -249,5 +249,6 @@ const frontend_ctx_driver_t frontend_ctx_psp = { NULL, /* get_os */ frontend_psp_get_rating, /* get_rating */ NULL, /* load_content */ + NULL, /* get_powerstate */ "psp", }; diff --git a/frontend/drivers/platform_qnx.c b/frontend/drivers/platform_qnx.c index 02b56d68d2..e45305c6c7 100644 --- a/frontend/drivers/platform_qnx.c +++ b/frontend/drivers/platform_qnx.c @@ -72,5 +72,6 @@ const frontend_ctx_driver_t frontend_ctx_qnx = { NULL, /* get_os */ frontend_qnx_get_rating, /* get_rating */ NULL, /* load_content */ + NULL, /* get_powerstate */ "qnx", }; diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 862cc3498e..2cc493170a 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -138,5 +138,6 @@ const frontend_ctx_driver_t frontend_ctx_win32 = { frontend_win32_get_os, /* get_os */ NULL, /* get_rating */ NULL, /* load_content */ + NULL, /* get_powerstate */ "win32", }; diff --git a/frontend/drivers/platform_xdk.c b/frontend/drivers/platform_xdk.c index e8ecd06e8e..1797443364 100644 --- a/frontend/drivers/platform_xdk.c +++ b/frontend/drivers/platform_xdk.c @@ -380,5 +380,6 @@ const frontend_ctx_driver_t frontend_ctx_xdk = { NULL, /* get_os */ frontend_xdk_get_rating, /* get_rating */ NULL, /* load_content */ + NULL, /* get_powerstate */ "xdk", }; diff --git a/frontend/frontend_driver.h b/frontend/frontend_driver.h index 96e7f6a5dc..2d6a43325d 100644 --- a/frontend/frontend_driver.h +++ b/frontend/frontend_driver.h @@ -28,6 +28,15 @@ extern "C" { #endif +enum frontend_powerstate +{ + FRONTEND_POWERSTATE_NONE = 0, + FRONTEND_POWERSTATE_NO_SOURCE, + FRONTEND_POWERSTATE_CHARGING, + FRONTEND_POWERSTATE_CHARGED, + FRONTEND_POWERSTATE_ON_POWER_SOURCE, +}; + typedef void (*environment_get_t)(int *argc, char *argv[], void *args, void *params_data); typedef void (*process_args_t)(int *argc, char *argv[]); @@ -47,6 +56,7 @@ typedef struct frontend_ctx_driver void (*get_os)(char *, size_t, int *major, int *minor); int (*get_rating)(void); void (*content_loaded)(void); + enum frontend_powerstate (*get_powerstate)(int *seconds, int *percent); const char *ident; From 9b4d2769f3793f5e0230e18e9c880b2c2aa28d6e Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sat, 18 Apr 2015 15:07:04 +0200 Subject: [PATCH 050/120] (OSX) Start implementing get_powerstate - based on SDL implementation --- frontend/drivers/platform_apple.c | 167 +++++++++++++++++++++++++++++- 1 file changed, 165 insertions(+), 2 deletions(-) diff --git a/frontend/drivers/platform_apple.c b/frontend/drivers/platform_apple.c index 20ff00aca6..3976cfbf78 100644 --- a/frontend/drivers/platform_apple.c +++ b/frontend/drivers/platform_apple.c @@ -25,10 +25,121 @@ #include #include -#ifdef IOS +#if defined(OSX) +#include +#include +#include +#endif + +#if defined(IOS) void get_ios_version(int *major, int *minor); #endif +#if defined(OSX) +/* Carbon is so verbose... */ +#define PMGMT_STRMATCH(a,b) (CFStringCompare(a, b, 0) == kCFCompareEqualTo) +#define PMGMT_GETVAL(k,v) CFDictionaryGetValueIfPresent(dict, CFSTR(k), (const void **) v) + +/* Note that AC power sources also include a laptop battery it is charging. */ +static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery, + bool * charging, int *seconds, int *percent) +{ + CFStringRef strval; /* don't CFRelease() this. */ + CFBooleanRef bval; + CFNumberRef numval; + bool charge = false; + bool choose = false; + bool is_ac = false; + int secs = -1; + int maxpct = -1; + int pct = -1; + + if ((PMGMT_GETVAL(kIOPSIsPresentKey, &bval)) && (bval == kCFBooleanFalse)) + return; /* nothing to see here. */ + + if (!PMGMT_GETVAL(kIOPSPowerSourceStateKey, &strval)) + return; + + if (PMGMT_STRMATCH(strval, CFSTR(kIOPSACPowerValue))) + is_ac = *have_ac = true; + else if (!PMGMT_STRMATCH(strval, CFSTR(kIOPSBatteryPowerValue))) + return; /* not a battery? */ + + if ((PMGMT_GETVAL(kIOPSIsChargingKey, &bval)) && (bval == kCFBooleanTrue)) + charge = true; + + if (PMGMT_GETVAL(kIOPSMaxCapacityKey, &numval)) + { + SInt32 val = -1; + CFNumberGetValue(numval, kCFNumberSInt32Type, &val); + if (val > 0) + { + *have_battery = true; + maxpct = (int) val; + } + } + + if (PMGMT_GETVAL(kIOPSMaxCapacityKey, &numval)) + { + SInt32 val = -1; + CFNumberGetValue(numval, kCFNumberSInt32Type, &val); + if (val > 0) + { + *have_battery = true; + maxpct = (int) val; + } + } + + if (PMGMT_GETVAL(kIOPSTimeToEmptyKey, &numval)) + { + SInt32 val = -1; + CFNumberGetValue(numval, kCFNumberSInt32Type, &val); + + /* Mac OS X reports 0 minutes until empty if you're plugged in. :( */ + if ((val == 0) && (is_ac)) + val = -1; /* !!! FIXME: calc from timeToFull and capacity? */ + + secs = (int) val; + if (secs > 0) + secs *= 60; /* value is in minutes, so convert to seconds. */ + } + + if (PMGMT_GETVAL(kIOPSCurrentCapacityKey, &numval)) + { + SInt32 val = -1; + CFNumberGetValue(numval, kCFNumberSInt32Type, &val); + pct = (int) val; + } + + if ((pct > 0) && (maxpct > 0)) + pct = (int) ((((double) pct) / ((double) maxpct)) * 100.0); + + if (pct > 100) + pct = 100; + + /* + * We pick the battery that claims to have the most minutes left. + * (failing a report of minutes, we'll take the highest percent.) + */ + if ((secs < 0) && (*seconds < 0)) + { + if ((pct < 0) && (*percent < 0)) + choose = true; /* at least we know there's a battery. */ + if (pct > *percent) + choose = true; + } + else if (secs > *seconds) + choose = true; + + if (choose) + { + *seconds = secs; + *percent = pct; + *charging = charge; + } +} +#endif + static bool CopyModel(char** model, uint32_t *majorRev, uint32_t *minorRev) { #ifdef OSX @@ -297,6 +408,58 @@ static int frontend_apple_get_rating(void) return -1; } +static enum frontend_powerstate frontend_apple_get_powerstate(int *seconds, int *percent) +{ + enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE; +#if defined(OSX) + CFIndex i, total; + CFArrayRef list; + bool have_ac, have_battery, charging; + CFTypeRef blob = IOPSCopyPowerSourcesInfo(); + + *seconds = -1; + *percent = -1; + + if (!blob) + goto end; + + list = IOPSCopyPowerSourcesList(blob); + + if (!list) + goto end; + + /* don't CFRelease() the list items, or dictionaries! */ + have_ac = false; + have_battery = false; + charging = false; + total = CFArrayGetCount(list); + + for (i = 0; i < total; i++) + { + CFTypeRef ps = (CFTypeRef)CFArrayGetValueAtIndex(list, i); + CFDictionaryRef dict = IOPSGetPowerSourceDescription(blob, ps); + if (dict) + checkps(dict, &have_ac, &have_battery, &charging, + seconds, percent); + } + + if (!have_battery) + ret = FRONTEND_POWERSTATE_NO_SOURCE; + else if (charging) + ret = FRONTEND_POWERSTATE_CHARGING; + else if (have_ac) + ret = FRONTEND_POWERSTATE_CHARGED; + else + ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE; + + CFRelease(list); + end: + if (blob) + CFRelease(blob); + +#endif + return ret; +} const frontend_ctx_driver_t frontend_ctx_apple = { @@ -312,6 +475,6 @@ const frontend_ctx_driver_t frontend_ctx_apple = { frontend_apple_get_os, /* get_os */ frontend_apple_get_rating, /* get_rating */ frontend_apple_load_content, /* load_content */ - NULL, /* get_powerstate */ + frontend_apple_get_powerstate, "apple", }; From ba69d2ba599f536eb3984fb5d27d75468bfa78eb Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 15:09:03 +0200 Subject: [PATCH 051/120] (Apple) Style nits --- frontend/drivers/platform_apple.c | 102 +++++++++++++++--------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/frontend/drivers/platform_apple.c b/frontend/drivers/platform_apple.c index 3976cfbf78..c75f5bca9f 100644 --- a/frontend/drivers/platform_apple.c +++ b/frontend/drivers/platform_apple.c @@ -410,71 +410,71 @@ static int frontend_apple_get_rating(void) static enum frontend_powerstate frontend_apple_get_powerstate(int *seconds, int *percent) { - enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE; + enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE; #if defined(OSX) - CFIndex i, total; - CFArrayRef list; - bool have_ac, have_battery, charging; - CFTypeRef blob = IOPSCopyPowerSourcesInfo(); - - *seconds = -1; - *percent = -1; - - if (!blob) - goto end; - - list = IOPSCopyPowerSourcesList(blob); - - if (!list) - goto end; - - /* don't CFRelease() the list items, or dictionaries! */ - have_ac = false; - have_battery = false; - charging = false; - total = CFArrayGetCount(list); + CFIndex i, total; + CFArrayRef list; + bool have_ac, have_battery, charging; + CFTypeRef blob = IOPSCopyPowerSourcesInfo(); + + *seconds = -1; + *percent = -1; + + if (!blob) + goto end; + + list = IOPSCopyPowerSourcesList(blob); + + if (!list) + goto end; + + /* don't CFRelease() the list items, or dictionaries! */ + have_ac = false; + have_battery = false; + charging = false; + total = CFArrayGetCount(list); + + for (i = 0; i < total; i++) + { + CFTypeRef ps = (CFTypeRef)CFArrayGetValueAtIndex(list, i); + CFDictionaryRef dict = IOPSGetPowerSourceDescription(blob, ps); + if (dict) + checkps(dict, &have_ac, &have_battery, &charging, + seconds, percent); + } + + if (!have_battery) + ret = FRONTEND_POWERSTATE_NO_SOURCE; + else if (charging) + ret = FRONTEND_POWERSTATE_CHARGING; + else if (have_ac) + ret = FRONTEND_POWERSTATE_CHARGED; + else + ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE; + + CFRelease(list); +end: + if (blob) + CFRelease(blob); - for (i = 0; i < total; i++) - { - CFTypeRef ps = (CFTypeRef)CFArrayGetValueAtIndex(list, i); - CFDictionaryRef dict = IOPSGetPowerSourceDescription(blob, ps); - if (dict) - checkps(dict, &have_ac, &have_battery, &charging, - seconds, percent); - } - - if (!have_battery) - ret = FRONTEND_POWERSTATE_NO_SOURCE; - else if (charging) - ret = FRONTEND_POWERSTATE_CHARGING; - else if (have_ac) - ret = FRONTEND_POWERSTATE_CHARGED; - else - ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE; - - CFRelease(list); - end: - if (blob) - CFRelease(blob); - #endif return ret; } const frontend_ctx_driver_t frontend_ctx_apple = { - frontend_apple_get_environment_settings, /* environment_get */ + frontend_apple_get_environment_settings, NULL, /* init */ NULL, /* deinit */ NULL, /* exitspawn */ NULL, /* process_args */ NULL, /* exec */ NULL, /* set_fork */ - frontend_apple_shutdown, /* shutdown */ - frontend_apple_get_name, /* get_name */ - frontend_apple_get_os, /* get_os */ - frontend_apple_get_rating, /* get_rating */ - frontend_apple_load_content, /* load_content */ + frontend_apple_shutdown, + frontend_apple_get_name, + frontend_apple_get_os, + frontend_apple_get_rating, + frontend_apple_load_content, frontend_apple_get_powerstate, "apple", }; From 7e0395970e2c65dbdf8794444c34ec6997fe9ec2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 15:17:27 +0200 Subject: [PATCH 052/120] Add Power Source to System Information --- menu/menu_entries_cbs_deferred_push.c | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 7958cdcb69..eb6b991f86 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -374,6 +374,41 @@ static int deferred_push_system_information(void *data, void *userdata, frontend->get_rating ? frontend->get_rating() : -1); menu_list_push(list, tmp, "", MENU_SETTINGS_CORE_INFO_NONE, 0); + + if (frontend->get_powerstate) + { + int seconds = 0, percent = 0; + enum frontend_powerstate state = frontend->get_powerstate(&seconds, &percent); + + tmp2[0] = '\0'; + + if (percent != 0) + snprintf(tmp2, sizeof(tmp2), "%d%%", percent); + + switch (state) + { + case FRONTEND_POWERSTATE_NONE: + strlcat(tmp2, " N/A", sizeof(tmp)); + break; + case FRONTEND_POWERSTATE_NO_SOURCE: + strlcat(tmp2, " (No source)", sizeof(tmp)); + break; + case FRONTEND_POWERSTATE_CHARGING: + strlcat(tmp2, " (Charging)", sizeof(tmp)); + break; + case FRONTEND_POWERSTATE_CHARGED: + strlcat(tmp2, " (Charged)", sizeof(tmp)); + break; + case FRONTEND_POWERSTATE_ON_POWER_SOURCE: + strlcat(tmp2, " (Using power)", sizeof(tmp)); + break; + } + + snprintf(tmp, sizeof(tmp), "Power source : %s", + tmp2); + menu_list_push(list, tmp, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + } } tmp_string = gfx_ctx_get_ident(); From b810f7579d27914262aa2b3de45b0fbb6465b3fe Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 15:28:06 +0200 Subject: [PATCH 053/120] (PSP) Implement get_powerstate --- Makefile.psp1.salamander | 2 +- frontend/drivers/platform_psp.c | 44 ++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/Makefile.psp1.salamander b/Makefile.psp1.salamander index a5a01061f7..829aa38ec3 100644 --- a/Makefile.psp1.salamander +++ b/Makefile.psp1.salamander @@ -18,7 +18,7 @@ RARCH_DEFINES = -DPSP -DIS_SALAMANDER -DRARCH_CONSOLE LIBDIR = LDFLAGS = -LIBS = -lstdc++ -lm +LIBS = -lstdc++ -lm -lpsppower ifeq ($(HAVE_FILE_LOGGER), 1) CFLAGS += -DHAVE_FILE_LOGGER diff --git a/frontend/drivers/platform_psp.c b/frontend/drivers/platform_psp.c index 4937ac1c5a..f891c77458 100644 --- a/frontend/drivers/platform_psp.c +++ b/frontend/drivers/platform_psp.c @@ -236,19 +236,45 @@ static int frontend_psp_get_rating(void) return 4; } +static enum frontend_powerstate frontend_psp_get_powerstate(int *seconds, int *percent) +{ + enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE; + int battery = scePowerIsBatteryExist(); + int plugged = scePowerIsPowerOnline(); + int charging = scePowerIsBatteryCharging(); + + *percent = scePowerGetBatteryLifePercent(); + *seconds = scePowerGetBatteryLifeTime() * 60; + + if (!battery) + { + ret = FRONTEND_POWERSTATE_NO_SOURCE; + *seconds = -1; + *percent = -1; + } + else if (charging) + ret = FRONTEND_POWERSTATE_CHARGING; + else if (plugged) + ret = FRONTEND_POWERSTATE_CHARGED; + else + ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE; + + return ret; +} + const frontend_ctx_driver_t frontend_ctx_psp = { - frontend_psp_get_environment_settings, /* get_environment_settings */ - frontend_psp_init, /* init */ - frontend_psp_deinit, /* deinit */ - frontend_psp_exitspawn, /* exitspawn */ + frontend_psp_get_environment_settings, + frontend_psp_init, + frontend_psp_deinit, + frontend_psp_exitspawn, NULL, /* process_args */ - frontend_psp_exec, /* exec */ - frontend_psp_set_fork, /* set_fork */ - frontend_psp_shutdown, /* shutdown */ + frontend_psp_exec, + frontend_psp_set_fork, + frontend_psp_shutdown, NULL, /* get_name */ NULL, /* get_os */ - frontend_psp_get_rating, /* get_rating */ + frontend_psp_get_rating, NULL, /* load_content */ - NULL, /* get_powerstate */ + frontend_psp_get_powerstate, "psp", }; From 99894c831ec0ed8cf1258d94439d55d6c665d1ae Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sat, 18 Apr 2015 16:42:49 +0200 Subject: [PATCH 054/120] (iOS) Implement get_powerstate --- apple/iOS/platform.m | 35 +++++++++++++++++++++++++++++++ frontend/drivers/platform_apple.c | 7 +++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index 42e53abbd2..75d336d072 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -65,6 +65,41 @@ void apple_rarch_exited(void) apple_frontend_settings_t apple_frontend_settings; +enum frontend_powerstate ios_get_powerstate(int *seconds, int *percent) +{ + float level; + enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE; + UIDevice *uidev = [UIDevice currentDevice]; + + if (!uidev) + return ret; + + [uidev setBatteryMonitoringEnabled:true]; + + switch (uidev.batteryState) + { + case UIDeviceBatteryStateCharging: + ret = FRONTEND_POWERSTATE_CHARGING; + break; + case UIDeviceBatteryStateFull: + ret = FRONTEND_POWERSTATE_CHARGED; + break; + case UIDeviceBatteryStateUnplugged: + ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE; + break; + case UIDeviceBatteryStateUnknown: + break; + } + + level = uidev.batteryLevel; + + *percent = ((level < 0.0f) ? -1 : ((int)((level * 100) + 0.5f))); + + [uidev setBatteryMonitoringEnabled:false]; + + return ret; +} + void get_ios_version(int *major, int *minor) { NSArray *decomposed_os_version = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."]; diff --git a/frontend/drivers/platform_apple.c b/frontend/drivers/platform_apple.c index c75f5bca9f..2b927da629 100644 --- a/frontend/drivers/platform_apple.c +++ b/frontend/drivers/platform_apple.c @@ -33,10 +33,12 @@ #if defined(IOS) void get_ios_version(int *major, int *minor); + +enum frontend_powerstate ios_get_powerstate(int *seconds, int *percent); #endif #if defined(OSX) -/* Carbon is so verbose... */ + #define PMGMT_STRMATCH(a,b) (CFStringCompare(a, b, 0) == kCFCompareEqualTo) #define PMGMT_GETVAL(k,v) CFDictionaryGetValueIfPresent(dict, CFSTR(k), (const void **) v) @@ -456,7 +458,8 @@ static enum frontend_powerstate frontend_apple_get_powerstate(int *seconds, int end: if (blob) CFRelease(blob); - +#elif defined(IOS) + ret = ios_get_powerstate(seconds, percent); #endif return ret; } From 8d4f6a172cef575fbd248b203e09917e5ef4b3e4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 17:16:55 +0200 Subject: [PATCH 055/120] (Win32) Implement get_powerstate --- frontend/drivers/platform_win32.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 2cc493170a..8ba26310b0 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -125,9 +125,34 @@ static void frontend_win32_init(void *data) gfx_set_dwm(); } +enum frontend_powerstate frontend_win32_get_powerstate(int *seconds, int *percent) +{ + SYSTEM_POWER_STATUS status; + enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE; + + if (!GetSystemPowerStatus(&status)) + return ret; + + if (status.BatteryFlag == 0xFF) + ret = FRONTEND_POWERSTATE_NONE; + if (status.BatteryFlag & (1 << 7)) + ret = FRONTEND_POWERSTATE_NO_SOURCE; + else if (status.BatteryFlag & (1 << 3)) + ret = FRONTEND_POWERSTATE_CHARGING; + else if (status.ACLineStatus == 1) + ret = FRONTEND_POWERSTATE_CHARGED; + else + ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE; + + *percent = (int)status.BatteryLifePercent; + *seconds = (int)status.BatteryLifeTime; + + return ret; +} + const frontend_ctx_driver_t frontend_ctx_win32 = { NULL, /* environment_get */ - frontend_win32_init, /* init */ + frontend_win32_init, NULL, /* deinit */ NULL, /* exitspawn */ NULL, /* process_args */ @@ -135,9 +160,9 @@ const frontend_ctx_driver_t frontend_ctx_win32 = { NULL, /* set_fork */ NULL, /* shutdown */ NULL, /* get_name */ - frontend_win32_get_os, /* get_os */ + frontend_win32_get_os, NULL, /* get_rating */ NULL, /* load_content */ - NULL, /* get_powerstate */ + frontend_win32_get_powerstate, "win32", }; From 88692cbb07f69e54582487b94317c462d44e9ff5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 17:34:14 +0200 Subject: [PATCH 056/120] (CTR) Use rarch_sleep and some style nits --- audio/drivers/ctr_audio.c | 2 +- frontend/drivers/platform_ctr.c | 101 +++++++++++++++++--------------- 2 files changed, 56 insertions(+), 47 deletions(-) diff --git a/audio/drivers/ctr_audio.c b/audio/drivers/ctr_audio.c index 3c3ba73333..e9b26d2d4b 100644 --- a/audio/drivers/ctr_audio.c +++ b/audio/drivers/ctr_audio.c @@ -128,7 +128,7 @@ static ssize_t ctr_audio_write(void *data, const void *buf, size_t size) { do{ /* todo: compute the correct sleep period */ - svcSleepThread(100000); + rarch_sleep(1); current_tick = svcGetSystemTick(); samples_played = (current_tick - ctr->cpu_ticks_last) / ctr->cpu_ticks_per_sample; ctr->playpos = (ctr->playpos + samples_played) & CTR_AUDIO_COUNT_MASK; diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index fc22163b74..3bd1d72fa8 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -29,12 +29,11 @@ int __stacksize__ = 1*1024*1024; -//char elf_path[512]; const char* elf_path_cst = "sdmc:/retroarch/test.3dsx"; - void wait_for_input(void); + #define DEBUG_HOLD() do{printf("%s@%s:%d.\n",__FUNCTION__, __FILE__, __LINE__);fflush(stdout);wait_for_input();}while(0) static void frontend_ctr_get_environment_settings(int *argc, char *argv[], @@ -42,7 +41,6 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[], { (void)args; -// return; #ifndef IS_SALAMANDER #if defined(HAVE_LOGGER) logger_init(); @@ -52,9 +50,6 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[], #endif #endif -// strlcpy(elf_path, argv[0], sizeof(elf_path)); - -// fill_pathname_basedir(g_defaults.port_dir, argv[0], sizeof(g_defaults.port_dir)); fill_pathname_basedir(g_defaults.port_dir, elf_path_cst, sizeof(g_defaults.port_dir)); RARCH_LOG("port dir: [%s]\n", g_defaults.port_dir); @@ -76,34 +71,36 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[], "retroarch.cfg", sizeof(g_defaults.config_path)); #ifndef IS_SALAMANDER -// if (argv[1] && (argv[1][0] != '\0')) -// { -// static char path[PATH_MAX_LENGTH]; -// struct rarch_main_wrap *args = NULL; +#if 0 + if (argv[1] && (argv[1][0] != '\0')) + { + static char path[PATH_MAX_LENGTH]; + struct rarch_main_wrap *args = NULL; -// *path = '\0'; -// args = (struct rarch_main_wrap*)params_data; + *path = '\0'; + args = (struct rarch_main_wrap*)params_data; -// if (args) -// { -// strlcpy(path, argv[1], sizeof(path)); + if (args) + { + strlcpy(path, argv[1], sizeof(path)); -// args->touched = true; -// args->no_content = false; -// args->verbose = false; -// args->config_path = NULL; -// args->sram_path = NULL; -// args->state_path = NULL; -// args->content_path = path; -// args->libretro_path = NULL; + args->touched = true; + args->no_content = false; + args->verbose = false; + args->config_path = NULL; + args->sram_path = NULL; + args->state_path = NULL; + args->content_path = path; + args->libretro_path = NULL; -// RARCH_LOG("argv[0]: %s\n", argv[0]); -// RARCH_LOG("argv[1]: %s\n", argv[1]); -// RARCH_LOG("argv[2]: %s\n", argv[2]); + RARCH_LOG("argv[0]: %s\n", argv[0]); + RARCH_LOG("argv[1]: %s\n", argv[1]); + RARCH_LOG("argv[2]: %s\n", argv[2]); -// RARCH_LOG("Auto-start game %s.\n", argv[1]); -// } -// } + RARCH_LOG("Auto-start game %s.\n", argv[1]); + } + } +#endif #endif } @@ -125,11 +122,13 @@ static void frontend_ctr_deinit(void *data) csndExit(); gfxExit(); -// sdmcExit(); -// fsExit(); -// hidExit(); -// aptExit(); -// srvExit(); +#if 0 + sdmcExit(); + fsExit(); + hidExit(); + aptExit(); + srvExit(); +#endif #endif } @@ -140,6 +139,7 @@ static void frontend_ctr_shutdown(bool unused) #define PRINTFPOS(X,Y) "\x1b["#X";"#Y"H" #define PRINTFPOS_STR(X,Y) "\x1b["X";"Y"H" + static void frontend_ctr_init(void *data) { #ifndef IS_SALAMANDER @@ -147,20 +147,21 @@ static void frontend_ctr_init(void *data) global_t *global = global_get_ptr(); global->verbosity = true; -// srvInit(); -// aptInit(); -// hidInit(); -// fsInit(); -// sdmcInit(); +#if 0 + srvInit(); + aptInit(); + hidInit(); + fsInit(); + sdmcInit(); -// APT_SetAppCpuTimeLimit(NULL, 80); -// gfxInitDefault(); + APT_SetAppCpuTimeLimit(NULL, 80); + gfxInitDefault(); +#endif gfxInit(GSP_BGR8_OES,GSP_RGB565_OES,false); csndInit(); gfxSet3D(false); consoleInit(GFX_BOTTOM, NULL); #endif - } @@ -168,21 +169,29 @@ static int frontend_ctr_get_rating(void) { return 3; } + bool select_pressed = false; -void wait_for_input() + +void wait_for_input(void) { - printf("\n\nPress Start.\n\n");fflush(stdout); + printf("\n\nPress Start.\n\n"); + fflush(stdout); + while(aptMainLoop()) { + u32 kDown; + hidScanInput(); - u32 kDown = hidKeysDown(); + + kDown = hidKeysDown(); + if (kDown & KEY_START) break; if (kDown & KEY_SELECT) select_pressed = true; - svcSleepThread(1000000); + rarch_sleep(1); } } From ac2743b842fdf732c8dfa043bb57bf9a1f00ea6f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 19:12:14 +0200 Subject: [PATCH 057/120] Create stub frontend/drivers/platform_linux.c --- Makefile.common | 3 ++- frontend/drivers/platform_linux.c | 39 +++++++++++++++++++++++++++++++ frontend/frontend_driver.c | 3 +++ frontend/frontend_driver.h | 1 + griffin/griffin.c | 2 ++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 frontend/drivers/platform_linux.c diff --git a/Makefile.common b/Makefile.common index c130add104..dab94a7efa 100644 --- a/Makefile.common +++ b/Makefile.common @@ -64,7 +64,8 @@ ifneq ($(findstring Linux,$(OS)),) LIBS += -lrt JOYCONFIG_LIBS += -lrt -lpthread OBJ += input/drivers/linuxraw_input.o \ - input/drivers_joypad/linuxraw_joypad.o + input/drivers_joypad/linuxraw_joypad.o \ + frontend/drivers/platform_linux.o endif ifeq ($(findstring Haiku,$(OS)),) diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c new file mode 100644 index 0000000000..c521fb7e7d --- /dev/null +++ b/frontend/drivers/platform_linux.c @@ -0,0 +1,39 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2015 - Daniel De Matteis + * Copyright (C) 2012-2015 - Jason Fetters + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "../frontend_driver.h" + +#include +#include +#include +#include + +const frontend_ctx_driver_t frontend_ctx_linux = { + NULL, /* environment_get */ + NULL, /* init */ + NULL, /* deinit */ + NULL, /* exitspawn */ + NULL, /* process_args */ + NULL, /* exec */ + NULL, /* set_fork */ + NULL, /* shutdown */ + NULL, /* get_name */ + NULL, /* get_os */ + NULL, /* get_rating */ + NULL, /* load_content */ + NULL, /* get_powerstate */ + "linux", +}; diff --git a/frontend/frontend_driver.c b/frontend/frontend_driver.c index c5538ce8c2..fd92ad8696 100644 --- a/frontend/frontend_driver.c +++ b/frontend/frontend_driver.c @@ -41,6 +41,9 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = { #if defined(ANDROID) &frontend_ctx_android, #endif +#if defined(__linux__) && !defined(ANDROID) + &frontend_ctx_linux, +#endif #if defined(PSP) &frontend_ctx_psp, #endif diff --git a/frontend/frontend_driver.h b/frontend/frontend_driver.h index 2d6a43325d..8b199ef8f4 100644 --- a/frontend/frontend_driver.h +++ b/frontend/frontend_driver.h @@ -69,6 +69,7 @@ extern const frontend_ctx_driver_t frontend_ctx_xdk; extern const frontend_ctx_driver_t frontend_ctx_qnx; extern const frontend_ctx_driver_t frontend_ctx_apple; extern const frontend_ctx_driver_t frontend_ctx_android; +extern const frontend_ctx_driver_t frontend_ctx_linux; extern const frontend_ctx_driver_t frontend_ctx_psp; extern const frontend_ctx_driver_t frontend_ctx_ctr; extern const frontend_ctx_driver_t frontend_ctx_win32; diff --git a/griffin/griffin.c b/griffin/griffin.c index c6e16e0ffa..f369a8000a 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -610,6 +610,8 @@ FRONTEND #include "../frontend/drivers/platform_apple.c" #elif defined(ANDROID) #include "../frontend/drivers/platform_android.c" +#elif defined(__linux__) && !defined(ANDROID) +#include "../frontend/drivers/platform_linux.c" #endif #include "../frontend/drivers/platform_null.c" From b83a03bad614a537d99fed46d49c5e73ff91c53b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 19:43:48 +0200 Subject: [PATCH 058/120] (Linux) Start implementing get_powerstate --- frontend/drivers/platform_linux.c | 366 +++++++++++++++++++++++++++++- 1 file changed, 365 insertions(+), 1 deletion(-) diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index c521fb7e7d..284fd4f734 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -16,11 +16,375 @@ #include "../frontend_driver.h" +#include #include #include #include +#include #include +#include +#include +#include + +static const char *proc_apm_path = "/proc/apm"; +static const char *proc_acpi_battery_path = "/proc/acpi/battery"; +static const char *proc_acpi_ac_adapter_path = "/proc/acpi/ac_adapter"; + +static int open_acpi_file(const char *base, const char *node, const char *key) +{ + const size_t pathlen = strlen(base) + strlen(node) + strlen(key) + 3; + char *path = (char *)alloca(pathlen); + if (!path) + return -1; + + snprintf(path, pathlen, "%s/%s/%s", base, node, key); + return open(path, O_RDONLY); +} + +static bool load_acpi_file(const char *base, const char *node, const char *key, + char *buf, size_t buflen) +{ + ssize_t br = 0; + const int fd = open_acpi_file(base, node, key); + if (fd == -1) + return false; + br = read(fd, buf, buflen-1); + close(fd); + if (br < 0) + return false; + buf[br] = '\0'; /* null-terminate the string. */ + + return true; +} + +static bool make_proc_acpi_key_val(char **_ptr, char **_key, char **_val) +{ + char *ptr = *_ptr; + + while (*ptr == ' ') + ptr++; /* skip whitespace. */ + + if (*ptr == '\0') + return false; /* EOF. */ + + *_key = ptr; + + while ((*ptr != ':') && (*ptr != '\0')) + ptr++; + + if (*ptr == '\0') + return false; /* (unexpected) EOF. */ + + *(ptr++) = '\0'; /* terminate the key. */ + + while ((*ptr == ' ') && (*ptr != '\0')) + ptr++; /* skip whitespace. */ + + if (*ptr == '\0') + return false; /* (unexpected) EOF. */ + + *_val = ptr; + + while ((*ptr != '\n') && (*ptr != '\0')) + ptr++; + + if (*ptr != '\0') + *(ptr++) = '\0'; /* terminate the value. */ + + *_ptr = ptr; /* store for next time. */ + return true; +} + +static void +check_proc_acpi_battery(const char * node, bool * have_battery, + bool * charging, int *seconds, int *percent) +{ + const char *base = proc_acpi_battery_path; + char info[1024]; + char state[1024]; + char *ptr = NULL; + char *key = NULL; + char *val = NULL; + bool charge = false; + bool choose = false; + int maximum = -1; + int remaining = -1; + int secs = -1; + int pct = -1; + + if (!load_acpi_file(base, node, "state", state, sizeof (state))) + return; + else if (!load_acpi_file(base, node, "info", info, sizeof (info))) + return; + + ptr = &state[0]; + while (make_proc_acpi_key_val(&ptr, &key, &val)) + { + if (!strcmp(key, "present")) + { + if (!strcmp(val, "yes")) + *have_battery = true; + } + else if (!strcmp(key, "charging state")) + { + /* !!! FIXME: what exactly _does_ charging/discharging mean? */ + if (!strcmp(val, "charging/discharging")) + charge = true; + else if (!strcmp(val, "charging")) + charge = true; + } + else if (!strcmp(key, "remaining capacity")) + { + char *endptr = NULL; + const int cvt = (int) strtol(val, &endptr, 10); + if (*endptr == ' ') + remaining = cvt; + } + } + + ptr = &info[0]; + while (make_proc_acpi_key_val(&ptr, &key, &val)) + { + if (!strcmp(key, "design capacity")) + { + char *endptr = NULL; + const int cvt = (int) strtol(val, &endptr, 10); + if (*endptr == ' ') + maximum = cvt; + } + } + + if ((maximum >= 0) && (remaining >= 0)) + { + pct = (int) ((((float) remaining) / ((float) maximum)) * 100.0f); + if (pct < 0) + pct = 0; + else if (pct > 100) + pct = 100; + } + + /* !!! FIXME: calculate (secs). */ + + /* + * We pick the battery that claims to have the most minutes left. + * (failing a report of minutes, we'll take the highest percent.) + */ + if ((secs < 0) && (*seconds < 0)) + { + if ((pct < 0) && (*percent < 0)) + choose = true; /* at least we know there's a battery. */ + if (pct > *percent) + choose = true; + } + else if (secs > *seconds) + choose = true; + + if (choose) + { + *seconds = secs; + *percent = pct; + *charging = charge; + } +} + +static void +check_proc_acpi_ac_adapter(const char * node, bool *have_ac) +{ + const char *base = proc_acpi_ac_adapter_path; + char state[256]; + char *ptr = NULL; + char *key = NULL; + char *val = NULL; + + if (!load_acpi_file(base, node, "state", state, sizeof (state))) + return; + + ptr = &state[0]; + while (make_proc_acpi_key_val(&ptr, &key, &val)) + { + if (!strcmp(key, "state")) + { + if (!strcmp(val, "on-line")) + *have_ac = true; + } + } +} + +static bool next_string(char **_ptr, char **_str) +{ + char *ptr = *_ptr; + char *str = *_str; + + while (*ptr == ' ') /* skip any spaces... */ + ptr++; + + if (*ptr == '\0') + return false; + + str = ptr; + while ((*ptr != ' ') && (*ptr != '\n') && (*ptr != '\0')) + ptr++; + + if (*ptr != '\0') + *(ptr++) = '\0'; + + *_str = str; + *_ptr = ptr; + return true; +} + +static bool int_string(char *str, int *val) +{ + char *endptr = NULL; + *val = (int) strtol(str, &endptr, 0); + return ((*str != '\0') && (*endptr == '\0')); +} + +bool frontend_linux_powerstate_check_apm(enum frontend_powerstate *state, + int *seconds, int *percent) +{ + int ac_status = 0; + int battery_status = 0; + int battery_flag = 0; + int battery_percent = 0; + int battery_time = 0; + const int fd = open(proc_apm_path, O_RDONLY); + char buf[128]; + char *ptr = &buf[0]; + char *str = NULL; + ssize_t br; + + if (fd == -1) + return false; /* can't use this interface. */ + + br = read(fd, buf, sizeof (buf) - 1); + close(fd); + + if (br < 0) + return false; + + buf[br] = '\0'; /* null-terminate the string. */ + if (!next_string(&ptr, &str)) /* driver version */ + return false; + if (!next_string(&ptr, &str)) /* BIOS version */ + return false; + if (!next_string(&ptr, &str)) /* APM flags */ + return false; + + if (!next_string(&ptr, &str)) /* AC line status */ + return false; + else if (!int_string(str, &ac_status)) + return false; + + if (!next_string(&ptr, &str)) /* battery status */ + return false; + else if (!int_string(str, &battery_status)) + return false; + + if (!next_string(&ptr, &str)) /* battery flag */ + return false; + else if (!int_string(str, &battery_flag)) + return false; + if (!next_string(&ptr, &str)) /* remaining battery life percent */ + return false; + if (str[strlen(str) - 1] == '%') + str[strlen(str) - 1] = '\0'; + if (!int_string(str, &battery_percent)) + return false; + + if (!next_string(&ptr, &str)) /* remaining battery life time */ + return false; + else if (!int_string(str, &battery_time)) + return false; + + if (!next_string(&ptr, &str)) /* remaining battery life time units */ + return false; + else if (!strcmp(str, "min")) + battery_time *= 60; + + if (battery_flag == 0xFF) /* unknown state */ + *state = FRONTEND_POWERSTATE_NONE; + else if (battery_flag & (1 << 7)) /* no battery */ + *state = FRONTEND_POWERSTATE_NO_SOURCE; + else if (battery_flag & (1 << 3)) /* charging */ + *state = FRONTEND_POWERSTATE_CHARGING; + else if (ac_status == 1) + *state = FRONTEND_POWERSTATE_CHARGED; /* on AC, not charging. */ + else + *state = FRONTEND_POWERSTATE_ON_POWER_SOURCE; + + const int pct = battery_percent; + const int secs = battery_time; + + if (pct >= 0) /* -1 == unknown */ + *percent = (pct > 100) ? 100 : pct; /* clamp between 0%, 100% */ + if (secs >= 0) /* -1 == unknown */ + *seconds = secs; + + return true; +} + +bool frontend_linux_powerstate_check_acpi(enum frontend_powerstate *state, + int *seconds, int *percent) +{ + struct dirent *dent = NULL; + DIR *dirp = NULL; + bool have_battery = false; + bool have_ac = false; + bool charging = false; + + *state = FRONTEND_POWERSTATE_NONE; + + dirp = opendir(proc_acpi_battery_path); + if (dirp == NULL) + return false; /* can't use this interface. */ + + while ((dent = readdir(dirp)) != NULL) + { + const char *node = dent->d_name; + check_proc_acpi_battery(node, &have_battery, &charging, + seconds, percent); + } + closedir(dirp); + + dirp = opendir(proc_acpi_ac_adapter_path); + if (dirp == NULL) + return false; /* can't use this interface. */ + + while ((dent = readdir(dirp)) != NULL) + { + const char *node = dent->d_name; + check_proc_acpi_ac_adapter(node, &have_ac); + } + closedir(dirp); + + if (!have_battery) + *state = FRONTEND_POWERSTATE_NO_SOURCE; + else if (charging) + *state = FRONTEND_POWERSTATE_CHARGING; + else if (have_ac) + *state = FRONTEND_POWERSTATE_CHARGED; + else + *state = FRONTEND_POWERSTATE_ON_POWER_SOURCE; + + return true; /* definitive answer. */ +} + +static enum frontend_powerstate +frontend_linux_get_powerstate(int *seconds, int *percent) +{ + enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE; + + if (frontend_linux_powerstate_check_apm(&ret, seconds, percent)) + return ret; + + if (frontend_linux_powerstate_check_acpi(&ret, seconds, percent)) + return ret; + + return FRONTEND_POWERSTATE_NONE; +} + const frontend_ctx_driver_t frontend_ctx_linux = { NULL, /* environment_get */ NULL, /* init */ @@ -34,6 +398,6 @@ const frontend_ctx_driver_t frontend_ctx_linux = { NULL, /* get_os */ NULL, /* get_rating */ NULL, /* load_content */ - NULL, /* get_powerstate */ + frontend_linux_get_powerstate, "linux", }; From a2195e8cdf8e38513bfb216f3de162fa223ca3a9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 20:03:59 +0200 Subject: [PATCH 059/120] Create frontend get_architecture function callback --- frontend/drivers/platform_apple.c | 6 ++++++ frontend/drivers/platform_ctr.c | 16 +++++++++++----- frontend/drivers/platform_gx.c | 20 +++++++++++++------- frontend/drivers/platform_linux.c | 17 +++++++++++++++++ frontend/drivers/platform_null.c | 1 + frontend/drivers/platform_ps3.c | 20 +++++++++++++------- frontend/drivers/platform_psp.c | 6 ++++++ frontend/drivers/platform_qnx.c | 14 ++++++++++---- frontend/drivers/platform_win32.c | 7 +++++++ frontend/drivers/platform_xdk.c | 24 ++++++++++++++++++------ frontend/frontend_driver.h | 11 +++++++++++ 11 files changed, 113 insertions(+), 29 deletions(-) diff --git a/frontend/drivers/platform_apple.c b/frontend/drivers/platform_apple.c index 2b927da629..6a2d49c39c 100644 --- a/frontend/drivers/platform_apple.c +++ b/frontend/drivers/platform_apple.c @@ -464,6 +464,11 @@ end: return ret; } +enum frontend_architecture frontend_apple_get_architecture(void) +{ + /* stub */ + return FRONTEND_ARCH_NONE; +} const frontend_ctx_driver_t frontend_ctx_apple = { frontend_apple_get_environment_settings, @@ -478,6 +483,7 @@ const frontend_ctx_driver_t frontend_ctx_apple = { frontend_apple_get_os, frontend_apple_get_rating, frontend_apple_load_content, + frontend_apple_get_architecture, frontend_apple_get_powerstate, "apple", }; diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index 3bd1d72fa8..4ad802bc1d 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -195,19 +195,25 @@ void wait_for_input(void) } } +enum frontend_architecture frontend_ctr_get_architecture(void) +{ + return FRONTEND_ARCH_ARM; +} + const frontend_ctx_driver_t frontend_ctx_ctr = { - frontend_ctr_get_environment_settings, /* get_environment_settings */ - frontend_ctr_init, /* init */ - frontend_ctr_deinit, /* deinit */ + frontend_ctr_get_environment_settings, + frontend_ctr_init, + frontend_ctr_deinit, NULL, /* exitspawn */ NULL, /* process_args */ NULL, /* exec */ NULL, /* set_fork */ - frontend_ctr_shutdown, /* shutdown */ + frontend_ctr_shutdown, NULL, /* get_name */ NULL, /* get_os */ - frontend_ctr_get_rating, /* get_rating */ + frontend_ctr_get_rating, NULL, /* load_content */ + frontend_ctr_get_architecture, NULL, /* get_powerstate */ "ctr", }; diff --git a/frontend/drivers/platform_gx.c b/frontend/drivers/platform_gx.c index 80b7f0796f..fe5b51c4d7 100644 --- a/frontend/drivers/platform_gx.c +++ b/frontend/drivers/platform_gx.c @@ -376,19 +376,25 @@ static int frontend_gx_get_rating(void) #endif } +static enum frontend_architecture frontend_gx_get_architecture(void) +{ + return FRONTEND_ARCH_PPC; +} + const frontend_ctx_driver_t frontend_ctx_gx = { - frontend_gx_get_environment_settings, /* get_environment_settings */ - frontend_gx_init, /* init */ + frontend_gx_get_environment_settings, + frontend_gx_init, NULL, /* deinit */ - frontend_gx_exitspawn, /* exitspawn */ - frontend_gx_process_args, /* process_args */ - frontend_gx_exec, /* exec */ - frontend_gx_set_fork, /* set_fork */ + frontend_gx_exitspawn, + frontend_gx_process_args, + frontend_gx_exec, + frontend_gx_set_fork, NULL, /* shutdown */ NULL, /* get_name */ NULL, /* get_os */ - frontend_gx_get_rating, /* get_rating */ + frontend_gx_get_rating, NULL, /* load_content */ + frontend_gx_get_architecture, NULL, /* get_powerstate */ "gx", }; diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index 284fd4f734..e2a6985005 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -26,6 +26,7 @@ #include #include #include +#include static const char *proc_apm_path = "/proc/apm"; static const char *proc_acpi_battery_path = "/proc/acpi/battery"; @@ -385,6 +386,21 @@ frontend_linux_get_powerstate(int *seconds, int *percent) return FRONTEND_POWERSTATE_NONE; } +enum frontend_architecture frontend_linux_get_architecture(void) +{ + struct utsname buffer; + + if (uname(&buffer) != 0) + return FRONTEND_ARCH_NONE; + + if (!strcmp(buffer.machine, "x86_64")) + return FRONTEND_ARCH_X86_64; + if (!strcmp(buffer.machine, "x86")) + return FRONTEND_ARCH_X86; + + return FRONTEND_ARCH_NONE; +} + const frontend_ctx_driver_t frontend_ctx_linux = { NULL, /* environment_get */ NULL, /* init */ @@ -398,6 +414,7 @@ const frontend_ctx_driver_t frontend_ctx_linux = { NULL, /* get_os */ NULL, /* get_rating */ NULL, /* load_content */ + frontend_linux_get_architecture, frontend_linux_get_powerstate, "linux", }; diff --git a/frontend/drivers/platform_null.c b/frontend/drivers/platform_null.c index e0ffcb4ba8..711ee5748b 100644 --- a/frontend/drivers/platform_null.c +++ b/frontend/drivers/platform_null.c @@ -34,6 +34,7 @@ const frontend_ctx_driver_t frontend_ctx_null = { NULL, /* get_os */ NULL, /* get_rating */ NULL, /* load_content */ + NULL, /* get_architecture */ NULL, /* get_powerstate */ "null", }; diff --git a/frontend/drivers/platform_ps3.c b/frontend/drivers/platform_ps3.c index 3d6f6da3fa..3e07b19674 100644 --- a/frontend/drivers/platform_ps3.c +++ b/frontend/drivers/platform_ps3.c @@ -439,19 +439,25 @@ static int frontend_ps3_get_rating(void) return 10; } +enum frontend_architecture frontend_ps3_get_architecture(void) +{ + return FRONTEND_ARCH_PPC; +} + const frontend_ctx_driver_t frontend_ctx_ps3 = { - frontend_ps3_get_environment_settings, /* get_environment_settings */ - frontend_ps3_init, /* init */ - frontend_ps3_deinit, /* deinit */ - frontend_ps3_exitspawn, /* exitspawn */ + frontend_ps3_get_environment_settings, + frontend_ps3_init, + frontend_ps3_deinit, + frontend_ps3_exitspawn, NULL, /* process_args */ - frontend_ps3_exec, /* exec */ - frontend_ps3_set_fork, /* set_fork */ + frontend_ps3_exec, + frontend_ps3_set_fork, NULL, /* shutdown */ NULL, /* get_name */ NULL, /* get_os */ - frontend_ps3_get_rating, /* get_rating */ + frontend_ps3_get_rating, NULL, /* load_content */ + frontend_ps3_get_architecture, NULL, /* get_powerstate */ "ps3", }; diff --git a/frontend/drivers/platform_psp.c b/frontend/drivers/platform_psp.c index f891c77458..ef739ff863 100644 --- a/frontend/drivers/platform_psp.c +++ b/frontend/drivers/platform_psp.c @@ -262,6 +262,11 @@ static enum frontend_powerstate frontend_psp_get_powerstate(int *seconds, int *p return ret; } +enum frontend_architecture frontend_psp_get_architecture(void) +{ + return FRONTEND_ARCH_MIPS; +} + const frontend_ctx_driver_t frontend_ctx_psp = { frontend_psp_get_environment_settings, frontend_psp_init, @@ -275,6 +280,7 @@ const frontend_ctx_driver_t frontend_ctx_psp = { NULL, /* get_os */ frontend_psp_get_rating, NULL, /* load_content */ + frontend_psp_get_architecture, frontend_psp_get_powerstate, "psp", }; diff --git a/frontend/drivers/platform_qnx.c b/frontend/drivers/platform_qnx.c index e45305c6c7..e56124e589 100644 --- a/frontend/drivers/platform_qnx.c +++ b/frontend/drivers/platform_qnx.c @@ -59,19 +59,25 @@ static void frontend_qnx_get_environment_settings(int *argc, char *argv[], "playlists", sizeof(g_defaults.playlist_dir)); } +enum frontend_architecture frontend_qnx_get_architecture(void) +{ + return FRONTEND_ARCH_ARM; +} + const frontend_ctx_driver_t frontend_ctx_qnx = { - frontend_qnx_get_environment_settings, /* get_environment_settings */ - frontend_qnx_init, /* init */ + frontend_qnx_get_environment_settings, + frontend_qnx_init, NULL, /* deinit */ NULL, /* exitspawn */ NULL, /* process_args */ NULL, /* exec */ NULL, /* set_fork */ - frontend_qnx_shutdown, /* shutdown */ + frontend_qnx_shutdown, NULL, /* get_name */ NULL, /* get_os */ - frontend_qnx_get_rating, /* get_rating */ + frontend_qnx_get_rating, NULL, /* load_content */ + frontend_qnx_get_architecture, NULL, /* get_powerstate */ "qnx", }; diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 8ba26310b0..780280ec51 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -150,6 +150,12 @@ enum frontend_powerstate frontend_win32_get_powerstate(int *seconds, int *percen return ret; } +enum frontend_architecture frontend_win32_get_architecture(void) +{ + /* stub */ + return FRONTEND_ARCH_NONE; +} + const frontend_ctx_driver_t frontend_ctx_win32 = { NULL, /* environment_get */ frontend_win32_init, @@ -163,6 +169,7 @@ const frontend_ctx_driver_t frontend_ctx_win32 = { frontend_win32_get_os, NULL, /* get_rating */ NULL, /* load_content */ + frontend_win32_get_architecture, frontend_win32_get_powerstate, "win32", }; diff --git a/frontend/drivers/platform_xdk.c b/frontend/drivers/platform_xdk.c index 1797443364..0cfa233006 100644 --- a/frontend/drivers/platform_xdk.c +++ b/frontend/drivers/platform_xdk.c @@ -367,19 +367,31 @@ static int frontend_xdk_get_rating(void) #endif } +enum frontend_architecture frontend_xdk_get_architecture(void) +{ +#if defined(_XBOX360) + return FRONTEND_ARCH_PPC; +#elif defined(_XBOX1) + return FRONTEND_ARCH_X86; +#else + return FRONTEND_ARCH_NONE; +#endif +} + const frontend_ctx_driver_t frontend_ctx_xdk = { - frontend_xdk_get_environment_settings, /* get_environment_settings */ - frontend_xdk_init, /* init */ + frontend_xdk_get_environment_settings, + frontend_xdk_init, NULL, /* deinit */ - frontend_xdk_exitspawn, /* exitspawn */ + frontend_xdk_exitspawn, NULL, /* process_args */ - frontend_xdk_exec, /* exec */ - frontend_xdk_set_fork, /* set_fork */ + frontend_xdk_exec, + frontend_xdk_set_fork, NULL, /* shutdown */ NULL, /* get_name */ NULL, /* get_os */ - frontend_xdk_get_rating, /* get_rating */ + frontend_xdk_get_rating, NULL, /* load_content */ + frontend_xdk_get_architecture, NULL, /* get_powerstate */ "xdk", }; diff --git a/frontend/frontend_driver.h b/frontend/frontend_driver.h index 8b199ef8f4..cce61caecc 100644 --- a/frontend/frontend_driver.h +++ b/frontend/frontend_driver.h @@ -37,6 +37,16 @@ enum frontend_powerstate FRONTEND_POWERSTATE_ON_POWER_SOURCE, }; +enum frontend_architecture +{ + FRONTEND_ARCH_NONE = 0, + FRONTEND_ARCH_X86, + FRONTEND_ARCH_X86_64, + FRONTEND_ARCH_PPC, + FRONTEND_ARCH_ARM, + FRONTEND_ARCH_MIPS, +}; + typedef void (*environment_get_t)(int *argc, char *argv[], void *args, void *params_data); typedef void (*process_args_t)(int *argc, char *argv[]); @@ -56,6 +66,7 @@ typedef struct frontend_ctx_driver void (*get_os)(char *, size_t, int *major, int *minor); int (*get_rating)(void); void (*content_loaded)(void); + enum frontend_architecture (*get_architecture)(void); enum frontend_powerstate (*get_powerstate)(int *seconds, int *percent); const char *ident; From 5cfc0bb7233b77cf84c360d37641a34811e28f88 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 20:08:47 +0200 Subject: [PATCH 060/120] (Linux) Implement frontend_linux_get_os - still needs major/minor set --- frontend/drivers/platform_linux.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index e2a6985005..d1f74d92a1 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -27,6 +27,7 @@ #include #include #include +#include static const char *proc_apm_path = "/proc/apm"; static const char *proc_acpi_battery_path = "/proc/acpi/battery"; @@ -401,6 +402,16 @@ enum frontend_architecture frontend_linux_get_architecture(void) return FRONTEND_ARCH_NONE; } +static void frontend_linux_get_os(char *name, size_t sizeof_name, int *major, int *minor) +{ + struct utsname buffer; + + if (uname(&buffer) != 0) + return; + + strlcpy(name, buffer.release, sizeof_name); +} + const frontend_ctx_driver_t frontend_ctx_linux = { NULL, /* environment_get */ NULL, /* init */ @@ -411,7 +422,7 @@ const frontend_ctx_driver_t frontend_ctx_linux = { NULL, /* set_fork */ NULL, /* shutdown */ NULL, /* get_name */ - NULL, /* get_os */ + frontend_linux_get_os, NULL, /* get_rating */ NULL, /* load_content */ frontend_linux_get_architecture, From b4549d4bf41405bb7981d4a50ffbb39138542135 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 20:16:59 +0200 Subject: [PATCH 061/120] Expand frontend_linux_get_architecture some more --- frontend/drivers/platform_linux.c | 8 ++++++++ frontend/frontend_driver.h | 1 + 2 files changed, 9 insertions(+) diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index d1f74d92a1..3b921ad32b 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -398,6 +398,14 @@ enum frontend_architecture frontend_linux_get_architecture(void) return FRONTEND_ARCH_X86_64; if (!strcmp(buffer.machine, "x86")) return FRONTEND_ARCH_X86; + if (!strcmp(buffer.machine, "arm")) + return FRONTEND_ARCH_ARM; + if (!strcmp(buffer.machine, "ppc64")) + return FRONTEND_ARCH_PPC; + if (!strcmp(buffer.machine, "mips")) + return FRONTEND_ARCH_MIPS; + if (!strcmp(buffer.machine, "tile")) + return FRONTEND_ARCH_TILE; return FRONTEND_ARCH_NONE; } diff --git a/frontend/frontend_driver.h b/frontend/frontend_driver.h index cce61caecc..df0ecef935 100644 --- a/frontend/frontend_driver.h +++ b/frontend/frontend_driver.h @@ -45,6 +45,7 @@ enum frontend_architecture FRONTEND_ARCH_PPC, FRONTEND_ARCH_ARM, FRONTEND_ARCH_MIPS, + FRONTEND_ARCH_TILE, }; typedef void (*environment_get_t)(int *argc, char *argv[], void *args, From f9adf6ee9db541cabce49f730f0b2b8ce6adbc30 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 20:41:17 +0200 Subject: [PATCH 062/120] (Win32) Implement OS name --- frontend/drivers/platform_win32.c | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 780280ec51..e7f475135b 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -103,6 +103,61 @@ static void frontend_win32_get_os(char *name, size_t sizeof_name, int *major, in *major = (DWORD)(LOBYTE(LOWORD(version))); *minor = (DWORD)(HIBYTE(LOWORD(version))); + + switch (*major) + { + case 6: + switch (*minor) + { + case 3: + strlcpy(name, "Windows 8.1", sizeof_name); + break; + case 2: + strlcpy(name, "Windows 8", sizeof_name); + break; + case 1: + strlcpy(name, "Windows 7/2008 R2", sizeof_name); + break; + case 0: + strlcpy(name, "Windows Vista/2008", sizeof_name); + break; + default: + break; + } + break; + case 5: + switch (*minor) + { + case 2: + strlcpy(name, "Windows 2003", sizeof_name); + break; + case 1: + strlcpy(name, "Windows XP", sizeof_name); + break; + case 0: + strlcpy(name, "Windows 2000", sizeof_name); + break; + } + break; + case 4: + switch (*minor) + { + case 0: + strlcpy(name, "Windows NT 4.0", sizeof_name); + break; + case 90: + strlcpy(name, "Windows ME", sizeof_name); + break; + case 10: + strlcpy(name, "Windows 98", sizeof_name); + break; + case 0: + strlcpy(name, "Windows 95", sizeof_name); + } + break; + default: + break; + } } static void frontend_win32_init(void *data) From 5bc364c1fb8f80f64439d25e6b9eb798791d130d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 20:44:28 +0200 Subject: [PATCH 063/120] (Win32) Buildfix --- frontend/drivers/platform_win32.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index e7f475135b..641cb779c8 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -151,8 +151,6 @@ static void frontend_win32_get_os(char *name, size_t sizeof_name, int *major, in case 10: strlcpy(name, "Windows 98", sizeof_name); break; - case 0: - strlcpy(name, "Windows 95", sizeof_name); } break; default: From 0608ea17b8c0002766ee625257242d4cd0f09935 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 20:49:05 +0200 Subject: [PATCH 064/120] (Linux) Frontend OS - major/minor now gets properly set --- frontend/drivers/platform_linux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index 3b921ad32b..b31b3a169f 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -412,12 +412,14 @@ enum frontend_architecture frontend_linux_get_architecture(void) static void frontend_linux_get_os(char *name, size_t sizeof_name, int *major, int *minor) { + unsigned krel; struct utsname buffer; if (uname(&buffer) != 0) return; - strlcpy(name, buffer.release, sizeof_name); + sscanf(buffer.release, "%u.%u.%u", major, minor, &krel); + strlcpy(name, "Linux", sizeof_name); } const frontend_ctx_driver_t frontend_ctx_linux = { From c03f61152ba7e1ed936169a374db6cfcc081fa2f Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sat, 18 Apr 2015 21:14:30 +0200 Subject: [PATCH 065/120] (Apple) Fixup get_os --- frontend/drivers/platform_apple.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/frontend/drivers/platform_apple.c b/frontend/drivers/platform_apple.c index 6a2d49c39c..25342e016b 100644 --- a/frontend/drivers/platform_apple.c +++ b/frontend/drivers/platform_apple.c @@ -25,6 +25,8 @@ #include #include +#include + #if defined(OSX) #include #include @@ -256,7 +258,7 @@ static void frontend_apple_get_os(char *name, size_t sizeof_name, int *major, in #ifdef IOS get_ios_version(major, minor); - snprintf(name, sizeof_name, "iOS %d.%d", *major, *minor); + strlcpy(name, "iOS", sizeof_name); #endif } @@ -466,7 +468,20 @@ end: enum frontend_architecture frontend_apple_get_architecture(void) { - /* stub */ + struct utsname buffer; + + if (uname(&buffer) != 0) + return FRONTEND_ARCH_NONE; + +#ifdef OSX + if (!strcmp(buffer.machine, "x86_64")) + return FRONTEND_ARCH_X86_64; + if (!strcmp(buffer.machine, "x86")) + return FRONTEND_ARCH_X86; + if (!strcmp(buffer.machine, "Power Macintosh")) + return FRONTEND_ARCH_PPC; +#endif + return FRONTEND_ARCH_NONE; } From a642092cb52eea4c0d1565b521bb5eddd703294b Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sat, 18 Apr 2015 21:20:04 +0200 Subject: [PATCH 066/120] (iOS) Fixup frontend_apple_get_name --- frontend/drivers/platform_apple.c | 109 +++--------------------------- 1 file changed, 8 insertions(+), 101 deletions(-) diff --git a/frontend/drivers/platform_apple.c b/frontend/drivers/platform_apple.c index 25342e016b..0784abe181 100644 --- a/frontend/drivers/platform_apple.c +++ b/frontend/drivers/platform_apple.c @@ -144,109 +144,16 @@ static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery, } #endif -static bool CopyModel(char** model, uint32_t *majorRev, uint32_t *minorRev) -{ -#ifdef OSX - int mib[2]; - int count; - unsigned long modelLen; - char *revStr; -#endif - char *machineModel; - bool success = true; - size_t length = 1024; - - if (!model || !majorRev || !minorRev) - { - RARCH_ERR("CopyModel: Passing NULL arguments\n"); - return false; - } - -#ifdef IOS - sysctlbyname("hw.machine", NULL, &length, NULL, 0); -#endif - - machineModel = malloc(length); - - if (!machineModel) - { - success = false; - goto exit; - } -#ifdef IOS - sysctlbyname("hw.machine", machineModel, &length, NULL, 0); - *model = strndup(machineModel, length); -#else - mib[0] = CTL_HW; - mib[1] = HW_MODEL; - - if (sysctl(mib, 2, machineModel, &length, NULL, 0)) - { - printf("CopyModel: sysctl (error %d)\n", errno); - success = false; - goto exit; - } - - modelLen = strcspn(machineModel, "0123456789"); - - if (modelLen == 0) - { - RARCH_ERR("CopyModel: Could not find machine model name\n"); - success = false; - goto exit; - } - - *model = strndup(machineModel, modelLen); - - if (*model == NULL) - { - RARCH_ERR("CopyModel: Could not find machine model name\n"); - success = false; - goto exit; - } - - *majorRev = 0; - *minorRev = 0; - revStr = strpbrk(machineModel, "0123456789"); - - if (!revStr) - { - RARCH_ERR("CopyModel: Could not find machine version number, inferred value is 0,0\n"); - success = true; - goto exit; - } - - count = sscanf(revStr, "%d,%d", majorRev, minorRev); - - if (count < 2) - { - RARCH_ERR("CopyModel: Could not find machine version number\n"); - if (count < 1) - *majorRev = 0; - *minorRev = 0; - success = true; - goto exit; - } -#endif - -exit: - if (machineModel) - free(machineModel); - if (!success) - { - if (*model) - free(*model); - *model = NULL; - *majorRev = 0; - *minorRev = 0; - } - return success; -} - static void frontend_apple_get_name(char *name, size_t sizeof_name) { - uint32_t major_rev, minor_rev; - CopyModel(&name, &major_rev, &minor_rev); +#ifdef IOS + struct utsname buffer; + + if (uname(&buffer) != 0) + return; + + strlcpy(name, buffer.machine, sizeof_name); +#endif } static void frontend_apple_get_os(char *name, size_t sizeof_name, int *major, int *minor) From 6bbe6203a6cdc1148450d761dfe6cf344c8cc56a Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sat, 18 Apr 2015 21:52:45 +0200 Subject: [PATCH 067/120] (Apple) Cleanups --- frontend/drivers/platform_apple.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/drivers/platform_apple.c b/frontend/drivers/platform_apple.c index 0784abe181..5d1b9aea06 100644 --- a/frontend/drivers/platform_apple.c +++ b/frontend/drivers/platform_apple.c @@ -146,13 +146,16 @@ static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery, static void frontend_apple_get_name(char *name, size_t sizeof_name) { -#ifdef IOS +#if defined(IOS) struct utsname buffer; if (uname(&buffer) != 0) return; strlcpy(name, buffer.machine, sizeof_name); +#elif defined(OSX) + size_t length = 0; + sysctlbyname("hw.model", name, &length, NULL, 0); #endif } @@ -163,9 +166,11 @@ static void frontend_apple_get_os(char *name, size_t sizeof_name, int *major, in (void)major; (void)minor; -#ifdef IOS +#if defined(IOS) get_ios_version(major, minor); strlcpy(name, "iOS", sizeof_name); +#elif defined(OSX) + strlcpy(name, "OSX", sizeof_name); #endif } From 33254862a6f182d98b4d5254557455a314625de7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 18 Apr 2015 22:04:09 +0200 Subject: [PATCH 068/120] Change 'Using Power' to 'Discharging' --- menu/menu_entries_cbs_deferred_push.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index eb6b991f86..ea53a16814 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -400,7 +400,7 @@ static int deferred_push_system_information(void *data, void *userdata, strlcat(tmp2, " (Charged)", sizeof(tmp)); break; case FRONTEND_POWERSTATE_ON_POWER_SOURCE: - strlcat(tmp2, " (Using power)", sizeof(tmp)); + strlcat(tmp2, " (Discharging)", sizeof(tmp)); break; } From a016de0bdc78b4fbe1effa79d09712f85aae605a Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Sat, 18 Apr 2015 23:12:00 +0200 Subject: [PATCH 069/120] Consistently use HAVE_NEON to include NEON-specific fragments. While GCC only defines __ARM_NEON__ when NEON is explicitly requested, Clang provides it for all CPUs known/expected to have NEON. --- audio/audio_utils.c | 4 ++-- audio/audio_utils.h | 2 +- audio/drivers_resampler/cc_resampler.c | 2 +- audio/drivers_resampler/sinc.c | 6 +++--- performance.c | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/audio/audio_utils.c b/audio/audio_utils.c index 99bcd48638..47818164f4 100644 --- a/audio/audio_utils.c +++ b/audio/audio_utils.c @@ -218,7 +218,7 @@ void audio_convert_float_to_s16_altivec(int16_t *out, } audio_convert_float_to_s16_C(out, in, samples_in); } -#elif defined(__ARM_NEON__) +#elif defined(HAVE_NEON) /* Avoid potential hard-float/soft-float ABI issues. */ void audio_convert_s16_float_asm(float *out, const int16_t *in, size_t samples, const float *gain); @@ -429,7 +429,7 @@ void audio_convert_init_simd(void) unsigned cpu = audio_convert_get_cpu_features(); (void)cpu; -#if defined(__ARM_NEON__) +#if defined(HAVE_NEON) audio_convert_s16_to_float_arm = cpu & RETRO_SIMD_NEON ? audio_convert_s16_to_float_neon : audio_convert_s16_to_float_C; audio_convert_float_to_s16_arm = cpu & RETRO_SIMD_NEON ? diff --git a/audio/audio_utils.h b/audio/audio_utils.h index 915f44881a..1fed0fe6b9 100644 --- a/audio/audio_utils.h +++ b/audio/audio_utils.h @@ -93,7 +93,7 @@ void audio_convert_s16_to_float_altivec(float *out, void audio_convert_float_to_s16_altivec(int16_t *out, const float *in, size_t samples); -#elif defined(__ARM_NEON__) +#elif defined(HAVE_NEON) #define audio_convert_s16_to_float audio_convert_s16_to_float_arm #define audio_convert_float_to_s16 audio_convert_float_to_s16_arm diff --git a/audio/drivers_resampler/cc_resampler.c b/audio/drivers_resampler/cc_resampler.c index 1c57dd97b8..b1162b8394 100644 --- a/audio/drivers_resampler/cc_resampler.c +++ b/audio/drivers_resampler/cc_resampler.c @@ -380,7 +380,7 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data) } -#elif defined (__ARM_NEON__) +#elif defined (HAVE_NEON) #define CC_RESAMPLER_IDENT "NEON" diff --git a/audio/drivers_resampler/sinc.c b/audio/drivers_resampler/sinc.c index 5e9f1676fa..16325977c8 100644 --- a/audio/drivers_resampler/sinc.c +++ b/audio/drivers_resampler/sinc.c @@ -393,7 +393,7 @@ static void process_sinc(rarch_sinc_resampler_t *resamp, float *out_buffer) /* movehl { X, R, X, L } == { X, R, X, R } */ _mm_store_ss(out_buffer + 1, _mm_movehl_ps(sum, sum)); } -#elif defined(__ARM_NEON__) +#elif defined(HAVE_NEON) #if SINC_COEFF_LERP #error "NEON asm does not support SINC lerp." @@ -498,7 +498,7 @@ static void *resampler_sinc_new(const struct resampler_config *config, } /* Be SIMD-friendly. */ -#if (defined(__AVX__) && ENABLE_AVX) || defined(__ARM_NEON__) +#if (defined(__AVX__) && ENABLE_AVX) || defined(HAVE_NEON) re->taps = (re->taps + 7) & ~7; #else re->taps = (re->taps + 3) & ~3; @@ -522,7 +522,7 @@ static void *resampler_sinc_new(const struct resampler_config *config, init_sinc_table(re, cutoff, re->phase_table, 1 << PHASE_BITS, re->taps, SINC_COEFF_LERP); -#if defined(__ARM_NEON__) +#if defined(HAVE_NEON) process_sinc_func = mask & RESAMPLER_SIMD_NEON ? process_sinc_neon : process_sinc_C; #endif diff --git a/performance.c b/performance.c index 06b9647113..d62fc3be9d 100644 --- a/performance.c +++ b/performance.c @@ -323,7 +323,7 @@ static uint64_t xgetbv_x86(uint32_t idx) } #endif -#if defined(__ARM_NEON__) +#if defined(HAVE_NEON) static void arm_enable_runfast_mode(void) { /* RunFast mode. Enables flush-to-zero and some @@ -486,7 +486,7 @@ uint64_t rarch_get_cpu_features(void) uint64_t cpu_flags = android_getCpuFeatures(); (void)cpu_flags; -#ifdef __ARM_NEON__ +#ifdef HAVE_NEON if (cpu_flags & ANDROID_CPU_ARM_FEATURE_NEON) { cpu |= RETRO_SIMD_NEON; @@ -494,7 +494,7 @@ uint64_t rarch_get_cpu_features(void) } #endif -#elif defined(__ARM_NEON__) +#elif defined(HAVE_NEON) cpu |= RETRO_SIMD_NEON; arm_enable_runfast_mode(); #elif defined(__ALTIVEC__) From 8d6594cb0830b1dbd325d89d280a8cb8e75f9100 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sat, 18 Apr 2015 23:40:28 +0200 Subject: [PATCH 070/120] Revert "Consistently use HAVE_NEON to include NEON-specific fragments." --- audio/audio_utils.c | 4 ++-- audio/audio_utils.h | 2 +- audio/drivers_resampler/cc_resampler.c | 2 +- audio/drivers_resampler/sinc.c | 6 +++--- performance.c | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/audio/audio_utils.c b/audio/audio_utils.c index 47818164f4..99bcd48638 100644 --- a/audio/audio_utils.c +++ b/audio/audio_utils.c @@ -218,7 +218,7 @@ void audio_convert_float_to_s16_altivec(int16_t *out, } audio_convert_float_to_s16_C(out, in, samples_in); } -#elif defined(HAVE_NEON) +#elif defined(__ARM_NEON__) /* Avoid potential hard-float/soft-float ABI issues. */ void audio_convert_s16_float_asm(float *out, const int16_t *in, size_t samples, const float *gain); @@ -429,7 +429,7 @@ void audio_convert_init_simd(void) unsigned cpu = audio_convert_get_cpu_features(); (void)cpu; -#if defined(HAVE_NEON) +#if defined(__ARM_NEON__) audio_convert_s16_to_float_arm = cpu & RETRO_SIMD_NEON ? audio_convert_s16_to_float_neon : audio_convert_s16_to_float_C; audio_convert_float_to_s16_arm = cpu & RETRO_SIMD_NEON ? diff --git a/audio/audio_utils.h b/audio/audio_utils.h index 1fed0fe6b9..915f44881a 100644 --- a/audio/audio_utils.h +++ b/audio/audio_utils.h @@ -93,7 +93,7 @@ void audio_convert_s16_to_float_altivec(float *out, void audio_convert_float_to_s16_altivec(int16_t *out, const float *in, size_t samples); -#elif defined(HAVE_NEON) +#elif defined(__ARM_NEON__) #define audio_convert_s16_to_float audio_convert_s16_to_float_arm #define audio_convert_float_to_s16 audio_convert_float_to_s16_arm diff --git a/audio/drivers_resampler/cc_resampler.c b/audio/drivers_resampler/cc_resampler.c index b1162b8394..1c57dd97b8 100644 --- a/audio/drivers_resampler/cc_resampler.c +++ b/audio/drivers_resampler/cc_resampler.c @@ -380,7 +380,7 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data) } -#elif defined (HAVE_NEON) +#elif defined (__ARM_NEON__) #define CC_RESAMPLER_IDENT "NEON" diff --git a/audio/drivers_resampler/sinc.c b/audio/drivers_resampler/sinc.c index 16325977c8..5e9f1676fa 100644 --- a/audio/drivers_resampler/sinc.c +++ b/audio/drivers_resampler/sinc.c @@ -393,7 +393,7 @@ static void process_sinc(rarch_sinc_resampler_t *resamp, float *out_buffer) /* movehl { X, R, X, L } == { X, R, X, R } */ _mm_store_ss(out_buffer + 1, _mm_movehl_ps(sum, sum)); } -#elif defined(HAVE_NEON) +#elif defined(__ARM_NEON__) #if SINC_COEFF_LERP #error "NEON asm does not support SINC lerp." @@ -498,7 +498,7 @@ static void *resampler_sinc_new(const struct resampler_config *config, } /* Be SIMD-friendly. */ -#if (defined(__AVX__) && ENABLE_AVX) || defined(HAVE_NEON) +#if (defined(__AVX__) && ENABLE_AVX) || defined(__ARM_NEON__) re->taps = (re->taps + 7) & ~7; #else re->taps = (re->taps + 3) & ~3; @@ -522,7 +522,7 @@ static void *resampler_sinc_new(const struct resampler_config *config, init_sinc_table(re, cutoff, re->phase_table, 1 << PHASE_BITS, re->taps, SINC_COEFF_LERP); -#if defined(HAVE_NEON) +#if defined(__ARM_NEON__) process_sinc_func = mask & RESAMPLER_SIMD_NEON ? process_sinc_neon : process_sinc_C; #endif diff --git a/performance.c b/performance.c index d62fc3be9d..06b9647113 100644 --- a/performance.c +++ b/performance.c @@ -323,7 +323,7 @@ static uint64_t xgetbv_x86(uint32_t idx) } #endif -#if defined(HAVE_NEON) +#if defined(__ARM_NEON__) static void arm_enable_runfast_mode(void) { /* RunFast mode. Enables flush-to-zero and some @@ -486,7 +486,7 @@ uint64_t rarch_get_cpu_features(void) uint64_t cpu_flags = android_getCpuFeatures(); (void)cpu_flags; -#ifdef HAVE_NEON +#ifdef __ARM_NEON__ if (cpu_flags & ANDROID_CPU_ARM_FEATURE_NEON) { cpu |= RETRO_SIMD_NEON; @@ -494,7 +494,7 @@ uint64_t rarch_get_cpu_features(void) } #endif -#elif defined(HAVE_NEON) +#elif defined(__ARM_NEON__) cpu |= RETRO_SIMD_NEON; arm_enable_runfast_mode(); #elif defined(__ALTIVEC__) From 51920f9e5f4a8bb7770b7b7a72c7790b67b980b3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 12:14:20 +0200 Subject: [PATCH 071/120] Simplify 'get_title' --- libretro-common/include/string/stdstring.h | 2 + libretro-common/string/stdstring.c | 8 + menu/drivers/shared.h | 163 ++++----------------- 3 files changed, 37 insertions(+), 136 deletions(-) diff --git a/libretro-common/include/string/stdstring.h b/libretro-common/include/string/stdstring.h index 2b40080d42..1217de9b4b 100644 --- a/libretro-common/include/string/stdstring.h +++ b/libretro-common/include/string/stdstring.h @@ -34,6 +34,8 @@ extern "C" { bool string_is_empty(const char *data); +char *string_to_upper(char *s); + char *string_replace_substring(const char *in, const char *pattern, const char *by); diff --git a/libretro-common/string/stdstring.c b/libretro-common/string/stdstring.c index 706ceefb93..06474cd5c8 100644 --- a/libretro-common/string/stdstring.c +++ b/libretro-common/string/stdstring.c @@ -35,6 +35,14 @@ bool string_is_empty(const char *data) return false; } +char *string_to_upper(char *s) +{ + unsigned char *ucs = (unsigned char *)s; + for ( ; *ucs != '\0'; ucs++) + *ucs = toupper(*ucs); + return s; +} + char *string_replace_substring(const char *in, const char *pattern, const char *replacement) { char *needle = NULL; diff --git a/menu/drivers/shared.h b/menu/drivers/shared.h index bb75e48139..a4060af6ab 100644 --- a/menu/drivers/shared.h +++ b/menu/drivers/shared.h @@ -18,6 +18,7 @@ #include "../../settings.h" #include +#include #include static INLINE void get_title(const char *label, const char *dir, @@ -103,23 +104,33 @@ static INLINE void get_title(const char *label, const char *dir, snprintf(title, sizeof_title, "CONFIG %s", dir); else if (!strcmp(label, "disk_image_append")) snprintf(title, sizeof_title, "DISK APPEND %s", dir); - else if (!strcmp(elem0, "Recording Settings")) - strlcpy(title, "RECORDING SETTINGS", sizeof_title); - else if (!strcmp(elem0, "Video Settings")) + else if (!strcmp(elem0, "Video Settings") + || !strcmp(elem0, "Overlay Settings") + || !strcmp(elem0, "Recording Settings") + || !strcmp(elem0, "Menu Settings") + || !strcmp(elem0, "General Settings") + || !strcmp(elem0, "Patch Settings") + || !strcmp(elem0, "UI Settings") + || !strcmp(elem0, "Playlist Settings") + || !strcmp(elem0, "Network Settings") + || !strcmp(elem0, "Core Updater Settings") + || !strcmp(elem0, "User Settings") + || !strcmp(elem0, "Path Settings") + || !strcmp(elem0, "Driver Settings") + || !strcmp(elem0, "Privacy Settings") + || !strcmp(elem0, "Onscreen Keyboard Overlay Settings") + || !strcmp(elem0, "Audio Settings") + || !strcmp(elem0, "Font Settings") + || !strcmp(elem0, "Shader Settings") + || !strcmp(elem0, "Archive Settings") + ) { - strlcpy(title, "VIDEO SETTINGS", sizeof_title); - if (!strcmp(elem1, "Monitor")) - strlcat(title, " - MONITOR", sizeof_title); - else if (!strcmp(elem1, "Aspect")) - strlcat(title, " - ASPECT", sizeof_title); - else if (!strcmp(elem1, "Scaling")) - strlcat(title, " - SCALING", sizeof_title); - else if (!strcmp(elem1, "Synchronization")) - strlcat(title, " - SYNCHRONIZATION", sizeof_title); - else if (!strcmp(elem1, "Miscellaneous")) - strlcat(title, " - MISCELLANEOUS", sizeof_title); - else if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); + strlcpy(title, string_to_upper(elem0), sizeof_title); + if (elem1[0] != '\0') + { + strlcat(title, " - ", sizeof_title); + strlcat(title, string_to_upper(elem1), sizeof_title); + } } else if (!strcmp(elem0, "Input Settings") || menu_type == MENU_SETTINGS_CUSTOM_BIND || @@ -139,136 +150,22 @@ static INLINE void get_title(const char *label, const char *dir, else if (!strcmp(elem1, "Miscellaneous")) strlcat(title, " - MISCELLANEOUS", sizeof_title); } - else if (!strcmp(elem0, "Overlay Settings")) - { - strlcpy(title, "OVERLAY SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - } - else if (!strcmp(elem0, "Menu Settings")) - { - strlcpy(title, "MENU SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - else if (!strcmp(elem1, "Navigation")) - strlcat(title, " - NAVIGATION", sizeof_title); - else if (!strcmp(elem1, "Settings View")) - strlcat(title, " - SETTINGS VIEW", sizeof_title); - else if (!strcmp(elem1, "Browser")) - strlcat(title, " - BROWSER", sizeof_title); - } - else if (!strcmp(elem0, "Onscreen Keyboard Overlay Settings")) - { - strlcpy(title, "ONSCREEN KEYBOARD OVERLAY SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - } - else if (!strcmp(elem0, "Patch Settings")) - { - strlcpy(title, "PATCH SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - } - else if (!strcmp(elem0, "UI Settings")) - { - strlcpy(title, "UI SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - } - else if (!strcmp(elem0, "Playlist Settings")) - { - strlcpy(title, "PLAYLIST SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - if (!strcmp(elem1, "History")) - strlcat(title, " - HISTORY", sizeof_title); - } - else if (!strcmp(elem0, "Network Settings")) - { - strlcpy(title, "NETWORK SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - if (!strcmp(elem1, "Netplay")) - strlcat(title, " - NETPLAY", sizeof_title); - if (!strcmp(elem1, "Miscellaneous")) - strlcat(title, " - MISCELLANEOUS", sizeof_title); - } - else if (!strcmp(elem0, "Core Updater Settings")) - { - strlcpy(title, "CORE UPDATER SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - } - else if (!strcmp(elem0, "User Settings")) - { - strlcpy(title, "USER SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - } - else if (!strcmp(elem0, "Path Settings")) - { - strlcpy(title, "PATH SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - if (!strcmp(elem1, "Paths")) - strlcat(title, " - PATHS", sizeof_title); - } else if (!strcmp(label, "management")) strlcpy(title, "MANAGEMENT", sizeof_title); else if (!strcmp(label, "options")) strlcpy(title, "OPTIONS", sizeof_title); else if (!strcmp(label, "settings")) strlcpy(title, "SETTINGS", sizeof_title); - else if (!strcmp(elem0, "Driver Settings")) - { - strlcpy(title, "DRIVER SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - } else if (!strcmp(label, "performance_counters")) strlcpy(title, "PERFORMANCE COUNTERS", sizeof_title); else if (!strcmp(label, "frontend_counters")) strlcpy(title, "FRONTEND PERFORMANCE COUNTERS", sizeof_title); else if (!strcmp(label, "core_counters")) strlcpy(title, "CORE PERFORMANCE COUNTERS", sizeof_title); - else if (!strcmp(elem0, "Shader Settings")) - { - strlcpy(title, "SHADER SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - } - else if (!strcmp(elem0, "Archive Settings")) - { - strlcpy(title, "ARCHIVE SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - } else if (!strcmp(label, "video_shader_parameters")) strlcpy(title, "SHADER PARAMETERS (CURRENT)", sizeof_title); else if (!strcmp(label, "video_shader_preset_parameters")) strlcpy(title, "SHADER PARAMETERS (MENU PRESET)", sizeof_title); - else if (!strcmp(elem0, "Font Settings")) - { - strlcpy(title, "FONT SETTINGS", sizeof_title); - if (!strcmp(elem1, "Messages")) - strlcat(title, " - MESSAGES", sizeof_title); - } - else if (!strcmp(elem0, "General Settings")) - { - strlcpy(title, "GENERAL SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - } - else if (!strcmp(elem0, "Audio Settings")) - { - strlcpy(title, "AUDIO SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - else if (!strcmp(elem1, "Synchronization")) - strlcat(title, " - SYNCHRONIZATION", sizeof_title); - else if (!strcmp(elem1, "Miscellaneous")) - strlcat(title, " - MISCELLANEOUS", sizeof_title); - } else if (!strcmp(label, "disk_options")) strlcpy(title, "DISK OPTIONS", sizeof_title); else if (!strcmp(label, "core_options")) @@ -285,12 +182,6 @@ static INLINE void get_title(const char *label, const char *dir, strlcpy(title, "CORE INFO", sizeof_title); else if (!strcmp(label, "system_information")) strlcpy(title, "SYSTEM INFO", sizeof_title); - else if (!strcmp(elem0, "Privacy Settings")) - { - strlcpy(title, "PRIVACY SETTINGS", sizeof_title); - if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - } else if (!strcmp(label, "video_shader_pass")) snprintf(title, sizeof_title, "SHADER %s", dir); else if (!strcmp(label, "video_shader_preset")) From 304ac04e1dad1961eb15d4a2d7a1843f7509010e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 12:17:18 +0200 Subject: [PATCH 072/120] (shared.h) Some more cleanups --- menu/drivers/shared.h | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/menu/drivers/shared.h b/menu/drivers/shared.h index a4060af6ab..588fccb8e6 100644 --- a/menu/drivers/shared.h +++ b/menu/drivers/shared.h @@ -58,8 +58,8 @@ static INLINE void get_title(const char *label, const char *dir, #endif if (!strcmp(label, "core_list")) snprintf(title, sizeof_title, "CORE SELECTION %s", dir); - else if (!strcmp(label, "core_updater_list")) - snprintf(title, sizeof_title, "CORE UPDATER %s", dir); + else if (!strcmp(label, "deferred_core_updater_list")) + strlcpy(title, "CORE UPDATER", sizeof_title); else if (!strcmp(label, "deferred_database_manager_list")) snprintf(title, sizeof_title, "DATABASE SELECTION - %s", (elem0_path[0] != '\0') ? path_basename(elem0_path) : ""); else if (!strcmp(label, "database_manager_list")) @@ -137,18 +137,11 @@ static INLINE void get_title(const char *label, const char *dir, menu_type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD) { strlcpy(title, "INPUT SETTINGS", sizeof_title); - if (strstr(elem1, "User")) - strlcat(title, " - USER", sizeof_title); - else if (!strcmp(elem1, "Meta Keys")) - strlcat(title, " - META KEYS", sizeof_title); - else if (!strcmp(elem1, "Turbo/Deadzone")) - strlcat(title, " - TURBO / DEADZONE", sizeof_title); - else if (!strcmp(elem1, "Input Device Mapping")) - strlcat(title, " - INPUT DEVICE MAPPING", sizeof_title); - else if (!strcmp(elem1, "State")) - strlcat(title, " - STATE", sizeof_title); - else if (!strcmp(elem1, "Miscellaneous")) - strlcat(title, " - MISCELLANEOUS", sizeof_title); + if (elem1[0] != '\0') + { + strlcat(title, " - ", sizeof_title); + strlcat(title, string_to_upper(elem1), sizeof_title); + } } else if (!strcmp(label, "management")) strlcpy(title, "MANAGEMENT", sizeof_title); From aaf89ce5982aa3b4ddc1e18964500b7c20acfea8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 12:24:35 +0200 Subject: [PATCH 073/120] Cut down on some more code --- menu/drivers/shared.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/menu/drivers/shared.h b/menu/drivers/shared.h index 588fccb8e6..8435974d29 100644 --- a/menu/drivers/shared.h +++ b/menu/drivers/shared.h @@ -123,6 +123,7 @@ static INLINE void get_title(const char *label, const char *dir, || !strcmp(elem0, "Font Settings") || !strcmp(elem0, "Shader Settings") || !strcmp(elem0, "Archive Settings") + || !strcmp(elem0, "Input Settings") ) { strlcpy(title, string_to_upper(elem0), sizeof_title); @@ -132,8 +133,7 @@ static INLINE void get_title(const char *label, const char *dir, strlcat(title, string_to_upper(elem1), sizeof_title); } } - else if (!strcmp(elem0, "Input Settings") || - menu_type == MENU_SETTINGS_CUSTOM_BIND || + else if (menu_type == MENU_SETTINGS_CUSTOM_BIND || menu_type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD) { strlcpy(title, "INPUT SETTINGS", sizeof_title); @@ -143,12 +143,15 @@ static INLINE void get_title(const char *label, const char *dir, strlcat(title, string_to_upper(elem1), sizeof_title); } } - else if (!strcmp(label, "management")) - strlcpy(title, "MANAGEMENT", sizeof_title); - else if (!strcmp(label, "options")) - strlcpy(title, "OPTIONS", sizeof_title); - else if (!strcmp(label, "settings")) - strlcpy(title, "SETTINGS", sizeof_title); + else if (!strcmp(label, "management") + || !strcmp(label, "options") + || !strcmp(label, "settings") + ) + { + char upper_label[PATH_MAX_LENGTH]; + strlcpy(upper_label, label, sizeof(upper_label)); + strlcpy(title, string_to_upper(upper_label), sizeof_title); + } else if (!strcmp(label, "performance_counters")) strlcpy(title, "PERFORMANCE COUNTERS", sizeof_title); else if (!strcmp(label, "frontend_counters")) From ed593b5b1de292974411a49b8a400f034e5f03a8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 12:58:36 +0200 Subject: [PATCH 074/120] Improve menu_input_pointer_post_iterate early return --- menu/menu_input.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/menu/menu_input.c b/menu/menu_input.c index 98dccd21f3..1cd2459fa9 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -814,13 +814,18 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs, const char *label, unsigned type, unsigned action) { int ret = 0; - menu_handle_t *menu = menu_driver_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); + driver_t *driver = driver_get_ptr(); settings_t *settings = config_get_ptr(); if (!menu) return -1; - if (!settings->menu.pointer.enable || settings->input.overlay_enable) + if (!settings->menu.pointer.enable +#ifdef HAVE_OVERLAY + || (settings->input.overlay_enable && driver && driver->overlay) +#endif + ) return 0; if (menu->pointer.pressed[0]) From ac91f46c3e6913303b7b50692e0a1c1bcd3668d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Sun, 19 Apr 2015 08:34:37 -0300 Subject: [PATCH 075/120] (qb) Display pkg-config module version --- qb/qb.libs.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qb/qb.libs.sh b/qb/qb.libs.sh index f73ebca7a2..1f5312e458 100644 --- a/qb/qb.libs.sh +++ b/qb/qb.libs.sh @@ -113,16 +113,19 @@ check_pkgconf() #$1 = HAVE_$1 $2 = package $3 = version $4 = critical error mess } ECHOBUF="Checking presence of package $2" - [ "$3" ] && ECHOBUF="$ECHOBUF with minimum version $3" + [ "$3" ] && ECHOBUF="$ECHOBUF >= $3" # echo -n "$ECHOBUF ... " answer='no' + version='no' $PKG_CONF_PATH --atleast-version="${3:-0.0}" "$2" && { answer='yes' + version=$($PKG_CONF_PATH --modversion "$2") eval $1_CFLAGS=\"$($PKG_CONF_PATH $2 --cflags)\" eval $1_LIBS=\"$($PKG_CONF_PATH $2 --libs)\" } - eval HAVE_$1="$answer"; echo "$ECHOBUF ... $answer" + eval HAVE_$1="$answer"; + echo "$ECHOBUF ... $version" PKG_CONF_USED="$PKG_CONF_USED $1" [ "$answer" = 'no' ] && { [ "$4" ] && { echo "$4"; exit 1;} From 6b3421b9712cbf306968018d2c32812b343d7d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sun, 19 Apr 2015 18:48:05 +0700 Subject: [PATCH 076/120] (RGUI) Center the title, and display a BACK button --- menu/drivers/glui.c | 3 ++- menu/drivers/rgui.c | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 42a87e2272..46a1abe26b 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -464,7 +464,8 @@ static void glui_frame(void) runloop->frames.video.count / 100, title, true); glui_blit_line(gl, gl->win_width/2, glui->line_height, title_buf, title_color, TEXT_ALIGN_CENTER); - glui_blit_line(gl, glui->margin, glui->line_height, "BACK", title_color, TEXT_ALIGN_LEFT); + if (file_list_get_size(menu->menu_list->menu_stack) > 1) + glui_blit_line(gl, glui->margin, glui->line_height, "BACK", title_color, TEXT_ALIGN_LEFT); glui_render_quad(gl, 0, gl->win_height - (menu->header_height - glui->line_height/2 + 4), diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index fa2b8d3731..87f9b610e0 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -433,13 +433,20 @@ static void rgui_render(void) get_title(label, dir, menu_type, title, sizeof(title)); - menu_animation_ticker_line(title_buf, RGUI_TERM_WIDTH - 3, + menu_animation_ticker_line(title_buf, RGUI_TERM_WIDTH - 10, runloop->frames.video.count / RGUI_TERM_START_X, title, true); hover_color = HOVER_COLOR(settings); normal_color = NORMAL_COLOR(settings); - blit_line(menu, RGUI_TERM_START_X + RGUI_TERM_START_X, RGUI_TERM_START_X, title_buf, TITLE_COLOR(settings)); + if (file_list_get_size(menu->menu_list->menu_stack) > 1) + blit_line(menu, + RGUI_TERM_START_X, RGUI_TERM_START_X, + "BACK", TITLE_COLOR(settings)); + + blit_line(menu, + RGUI_TERM_START_X + (RGUI_TERM_WIDTH - strlen(title_buf)) * FONT_WIDTH_STRIDE / 2, + RGUI_TERM_START_X, title_buf, TITLE_COLOR(settings)); core_name = global->menu.info.library_name; if (!core_name) @@ -455,11 +462,10 @@ static void rgui_render(void) if (!core_version) core_version = ""; - snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, core_name, core_version); blit_line(menu, - RGUI_TERM_START_X + RGUI_TERM_START_X, + RGUI_TERM_START_X, (RGUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) + RGUI_TERM_START_Y + 2, title_msg, hover_color); } @@ -469,12 +475,11 @@ static void rgui_render(void) disp_timedate_set_label(timedate, sizeof(timedate), 3); blit_line(menu, - (RGUI_TERM_WIDTH * FONT_HEIGHT_STRIDE) + (60), + RGUI_TERM_WIDTH * FONT_WIDTH_STRIDE - RGUI_TERM_START_X, (RGUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) + RGUI_TERM_START_Y + 2, timedate, hover_color); } - x = RGUI_TERM_START_X; y = RGUI_TERM_START_Y; @@ -567,7 +572,7 @@ static void *rgui_init(void) menu->frame_buf.width = 320; menu->frame_buf.height = 240; - menu->header_height = 11; + menu->header_height = FONT_HEIGHT_STRIDE * 2; menu->begin = 0; menu->frame_buf.pitch = menu->frame_buf.width * sizeof(uint16_t); From 729b32a579c19ea276e970ee1b25ef029262af53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Sun, 19 Apr 2015 08:53:09 -0300 Subject: [PATCH 077/120] (qb) Display user distribution --- qb/qb.comp.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qb/qb.comp.sh b/qb/qb.comp.sh index 6fa7110f83..c396be5347 100644 --- a/qb/qb.comp.sh +++ b/qb/qb.comp.sh @@ -26,7 +26,13 @@ if [ -z "$CROSS_COMPILE" ] || [ -z "$OS" ]; then esac fi -echo "$ECHOBUF ... $OS" +DISTRO='' +if [ -e /etc/lsb-release ]; then + . /etc/lsb-release + DISTRO="(${DISTRIB_DESCRIPTION} ${DISTRIB_RELEASE})" +fi + +echo "$ECHOBUF ... $OS ${DISTRO}" # Checking for working C compiler if [ "$USE_LANG_C" = 'yes' ]; then @@ -37,7 +43,7 @@ if [ "$USE_LANG_C" = 'yes' ]; then int main(void) { puts("Hai world!"); return 0; } EOF if [ -z "$CC" ]; then - for CC in ${CC:=$(which ${CROSS_COMPILE}gcc ${CROSS_COMPILE}cc ${CROSS_COMPILE}clang)} ''; do + for CC in ${CC:=$(which ${CROSS_COMPILE}gcc ${CROSS_COMPILE}cc ${CROSS_COMPILE}clang 2>/dev/null)} ''; do "$CC" -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && break done fi @@ -55,7 +61,7 @@ if [ "$USE_LANG_CXX" = 'yes' ]; then int main() { std::cout << "Hai guise" << std::endl; return 0; } EOF if [ -z "$CXX" ]; then - for CXX in ${CXX:=$(which ${CROSS_COMPILE}g++ ${CROSS_COMPILE}c++ ${CROSS_COMPILE}clang++)} ''; do + for CXX in ${CXX:=$(which ${CROSS_COMPILE}g++ ${CROSS_COMPILE}c++ ${CROSS_COMPILE}clang++ 2>/dev/null)} ''; do "$CXX" -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && break done fi From 7ebc824122f528f3e18742096cbbaa0bf2b02a25 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 14:32:58 +0200 Subject: [PATCH 078/120] (stdstring.c) Fix implicit declaration warning --- libretro-common/string/stdstring.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libretro-common/string/stdstring.c b/libretro-common/string/stdstring.c index 06474cd5c8..75aa149542 100644 --- a/libretro-common/string/stdstring.c +++ b/libretro-common/string/stdstring.c @@ -21,6 +21,7 @@ */ #include +#include bool string_is_empty(const char *data) { From 7c9154c181a994e3eec4ca16ffa336b00893e14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Sun, 19 Apr 2015 09:31:08 -0300 Subject: [PATCH 079/120] (qb) Do not abort on missing pkg-config under Darwin --- qb/qb.comp.sh | 17 +++++++++++++++++ qb/qb.libs.sh | 15 ++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/qb/qb.comp.sh b/qb/qb.comp.sh index c396be5347..8231db141a 100644 --- a/qb/qb.comp.sh +++ b/qb/qb.comp.sh @@ -78,3 +78,20 @@ if [ "$OS" = "Win32" ]; then fi echo "$ECHOBUF ... $WINDRES" fi + +[ "$PKG_CONF_PATH" ] && [ "$PKG_CONF_PATH" != "none" ] || { + ECHOBUF="Checking for pkg-config" + PKG_CONF_PATH="none" + + for path in $(which "${CROSS_COMPILE}pkg-config" 2>/dev/null) ''; do + [ -n "$path" ] && { + PKG_CONF_PATH=$path; + break; + } + done + + echo "$ECHOBUF ... $PKG_CONF_PATH" + if [ "$PKG_CONF_PATH" = "none" ] && [ "$OS" != "Darwin" ]; then + echo "Warning: pkg-config not found, package checks will fail." + fi +} diff --git a/qb/qb.libs.sh b/qb/qb.libs.sh index 1f5312e458..54f2753f5e 100644 --- a/qb/qb.libs.sh +++ b/qb/qb.libs.sh @@ -104,17 +104,14 @@ check_pkgconf() #$1 = HAVE_$1 $2 = package $3 = version $4 = critical error mess { tmpval="$(eval echo \$HAVE_$1)" [ "$tmpval" = 'no' ] && return 0 - [ "$PKG_CONF_PATH" ] || { - ECHOBUF="Checking for pkg-config" -# echo -n "Checking for pkg-config" - for PKG_CONF_PATH in $(which "${CROSS_COMPILE}pkg-config") ''; do [ "$PKG_CONF_PATH" ] && break; done - [ "$PKG_CONF_PATH" ] || { echo "pkg-config not found. Exiting ..."; exit 1;} - echo "$ECHOBUF ... $PKG_CONF_PATH" - } - ECHOBUF="Checking presence of package $2" [ "$3" ] && ECHOBUF="$ECHOBUF >= $3" -# echo -n "$ECHOBUF ... " + + [ "$PKG_CONF_PATH" = "none" ] && { + echo "$ECHOBUF ... no" + return 0 + } + answer='no' version='no' $PKG_CONF_PATH --atleast-version="${3:-0.0}" "$2" && { From e2b182befbb5b0e618568be106057e0da539a2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Sun, 19 Apr 2015 09:52:18 -0300 Subject: [PATCH 080/120] (qb) Always warn about missing pkg-config --- qb/qb.comp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qb/qb.comp.sh b/qb/qb.comp.sh index 8231db141a..0283dff953 100644 --- a/qb/qb.comp.sh +++ b/qb/qb.comp.sh @@ -91,7 +91,7 @@ fi done echo "$ECHOBUF ... $PKG_CONF_PATH" - if [ "$PKG_CONF_PATH" = "none" ] && [ "$OS" != "Darwin" ]; then + if [ "$PKG_CONF_PATH" = "none" ]; then echo "Warning: pkg-config not found, package checks will fail." fi } From 1af60e6995f2ef3d2e7631ab5b9ebede49f91c01 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 19 Apr 2015 15:34:52 +0200 Subject: [PATCH 081/120] (file_path_special.c) Add missing CoreFoundation.h header include --- file_path_special.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/file_path_special.c b/file_path_special.c index 66e42566e1..bed8cfa8c7 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -66,6 +66,10 @@ #include #endif +#ifdef __APPLE__ +#include +#endif + void fill_pathname_expand_special(char *out_path, const char *in_path, size_t size) { From 1970e8005a31098e3b261fc754fbcd7a5df5c7b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Sun, 19 Apr 2015 10:46:42 -0300 Subject: [PATCH 082/120] (qb) Fix ffmpeg detection --- qb/config.libs.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qb/config.libs.sh b/qb/config.libs.sh index dcd5745691..3f95252ea7 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -258,7 +258,12 @@ if [ "$HAVE_THREADS" != 'no' ]; then check_pkgconf AVUTIL libavutil 51 check_pkgconf SWSCALE libswscale 2.1 check_header AV_CHANNEL_LAYOUT libavutil/channel_layout.h - ( [ "$HAVE_FFMPEG" = 'auto' ] && ( [ "$HAVE_AVCODEC" = 'no' ] || [ "$HAVE_AVFORMAT" = 'no' ] || [ "$HAVE_AVUTIL" = 'no' ] || [ "$HAVE_SWSCALE" = 'no' ] ) && HAVE_FFMPEG='no' ) || HAVE_FFMPEG='yes' + + HAVE_FFMPEG='yes' + if [ "$HAVE_AVCODEC" = 'no' ] || [ "$HAVE_AVFORMAT" = 'no' ] || [ "$HAVE_AVUTIL" = 'no' ] || [ "$HAVE_SWSCALE" = 'no' ]; then + HAVE_FFMPEG='no' + echo "Notice: FFmpeg recording disabled due to missing or unsuitable packages." + fi fi else echo "Notice: Not building with threading support. Will skip FFmpeg." From 0681849aaf026bb8f8312daaf982ad2cc138bb6a Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 19 Apr 2015 15:53:59 +0200 Subject: [PATCH 083/120] (retroarch-joyconfig) Link against CoreFoundation(retroarch-joyconfig) Link against CoreFoundation(retroarch-joyconfig) Link against CoreFoundation(retroarch-joyconfig) Link against CoreFoundation(retroarch-joyconfig) Link against CoreFoundation(retroarch-joyconfig) Link against CoreFoundation(retroarch-joyconfig) Link against CoreFoundation(retroarch-joyconfig) Link against CoreFoundation(retroarch-joyconfig) Link against CoreFoundation --- Makefile.common | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.common b/Makefile.common index dab94a7efa..b37781d733 100644 --- a/Makefile.common +++ b/Makefile.common @@ -56,6 +56,7 @@ endif ifneq ($(findstring Darwin,$(OS)),) OSX := 1 LIBS += -framework AppKit + JOYCONFIG_LIBS += -framework CoreFoundation else OSX := 0 endif From d3abc809c7a9417e8540c0f640f83614be42439d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Sun, 19 Apr 2015 10:56:57 -0300 Subject: [PATCH 084/120] (qb) Fix for PKG_CONF_PATH=none --- qb/qb.comp.sh | 15 +++++++++------ qb/qb.libs.sh | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/qb/qb.comp.sh b/qb/qb.comp.sh index 0283dff953..e695d6d938 100644 --- a/qb/qb.comp.sh +++ b/qb/qb.comp.sh @@ -79,8 +79,9 @@ if [ "$OS" = "Win32" ]; then echo "$ECHOBUF ... $WINDRES" fi -[ "$PKG_CONF_PATH" ] && [ "$PKG_CONF_PATH" != "none" ] || { - ECHOBUF="Checking for pkg-config" +ECHOBUF="Checking for pkg-config" + +[ -n "$PKG_CONF_PATH" ] || { PKG_CONF_PATH="none" for path in $(which "${CROSS_COMPILE}pkg-config" 2>/dev/null) ''; do @@ -90,8 +91,10 @@ fi } done - echo "$ECHOBUF ... $PKG_CONF_PATH" - if [ "$PKG_CONF_PATH" = "none" ]; then - echo "Warning: pkg-config not found, package checks will fail." - fi } + +echo "$ECHOBUF ... $PKG_CONF_PATH" + +if [ "$PKG_CONF_PATH" = "none" ]; then + echo "Warning: pkg-config not found, package checks will fail." +fi diff --git a/qb/qb.libs.sh b/qb/qb.libs.sh index 54f2753f5e..e56d9b7eea 100644 --- a/qb/qb.libs.sh +++ b/qb/qb.libs.sh @@ -108,6 +108,7 @@ check_pkgconf() #$1 = HAVE_$1 $2 = package $3 = version $4 = critical error mess [ "$3" ] && ECHOBUF="$ECHOBUF >= $3" [ "$PKG_CONF_PATH" = "none" ] && { + eval HAVE_$1="no" echo "$ECHOBUF ... no" return 0 } From 723b9ba7167a2c606b0e54a2d87953a925606d86 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 15:59:20 +0200 Subject: [PATCH 085/120] Add HAVE_IOHIDMANAGER --- apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj | 2 ++ apple/RetroArch_OSX.xcodeproj/project.pbxproj | 2 ++ griffin/griffin.c | 2 +- input/input_hid_driver.c | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj index 879add6b9b..88fd44c44f 100644 --- a/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj @@ -282,6 +282,7 @@ ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( "-DHAVE_GRIFFIN", + "-DHAVE_IOHIDMANAGER", "-DHAVE_RGUI", "-DHAVE_MENU", "-DOSX", @@ -343,6 +344,7 @@ "-DNS_BLOCK_ASSERTIONS=1", "-DNDEBUG", "-DHAVE_GRIFFIN", + "-DHAVE_IOHIDMANAGER", "-DHAVE_RGUI", "-DHAVE_MENU", "-DOSX", diff --git a/apple/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/RetroArch_OSX.xcodeproj/project.pbxproj index 764eee0b83..85d62f9459 100644 --- a/apple/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/RetroArch_OSX.xcodeproj/project.pbxproj @@ -325,6 +325,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.5; OTHER_CFLAGS = ( "-DHAVE_GRIFFIN", + "-DHAVE_IOHIDMANAGER", "-DHAVE_LOCATION", "-DHAVE_RGUI", "-DHAVE_MENU", @@ -379,6 +380,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.5; OTHER_CFLAGS = ( "-DHAVE_GRIFFIN", + "-DHAVE_IOHIDMANAGER", "-DHAVE_LOCATION", "-DHAVE_RGUI", "-DHAVE_MENU", diff --git a/griffin/griffin.c b/griffin/griffin.c index f369a8000a..53aa5d8daa 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -362,7 +362,7 @@ INPUT (HID) #if defined(__APPLE__) && defined(IOS) #include "../input/drivers_hid/btstack_hid.c" -#elif defined(__APPLE__) && !defined(IOS) +#elif defined(__APPLE__) && defined(HAVE_IOHIDMANAGER) #include "../input/drivers_hid/apple_hid.c" #endif diff --git a/input/input_hid_driver.c b/input/input_hid_driver.c index 60bb6c5077..2912384e85 100644 --- a/input/input_hid_driver.c +++ b/input/input_hid_driver.c @@ -26,7 +26,7 @@ static hid_driver_t *hid_drivers[] = { #if defined(__APPLE__) && defined(IOS) &btstack_hid, #endif -#if defined(__APPLE__) && !defined(IOS) +#if defined(__APPLE__) && defined(HAVE_IOHIDMANAGER) &apple_hid, #endif #ifdef HAVE_LIBUSB From 147a9f85ff0199eaafce70726eb111efc75f9a8c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 16:18:58 +0200 Subject: [PATCH 086/120] (CoreText) Add HAVE_CORETEXT define --- apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj | 1 + apple/RetroArch_OSX.xcodeproj/project.pbxproj | 1 + apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj | 1 + gfx/font_renderer_driver.c | 2 +- griffin/griffin.c | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj index 88fd44c44f..1e18dd14b8 100644 --- a/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj @@ -282,6 +282,7 @@ ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( "-DHAVE_GRIFFIN", + "-DHAVE_CORETEXT", "-DHAVE_IOHIDMANAGER", "-DHAVE_RGUI", "-DHAVE_MENU", diff --git a/apple/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/RetroArch_OSX.xcodeproj/project.pbxproj index 85d62f9459..aba32fb544 100644 --- a/apple/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/RetroArch_OSX.xcodeproj/project.pbxproj @@ -325,6 +325,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.5; OTHER_CFLAGS = ( "-DHAVE_GRIFFIN", + "-DHAVE_CORETEXT", "-DHAVE_IOHIDMANAGER", "-DHAVE_LOCATION", "-DHAVE_RGUI", diff --git a/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj b/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj index 38b11ae32f..b89c9ee861 100644 --- a/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj +++ b/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj @@ -494,6 +494,7 @@ "-DHAVE_NETWORKING", "-DHAVE_CAMERA", "-DHAVE_GRIFFIN", + "-DHAVE_CORETEXT", "-DHAVE_LOCATION", "-DHAVE_RGUI", "-DHAVE_MENU", diff --git a/gfx/font_renderer_driver.c b/gfx/font_renderer_driver.c index 78bc700703..f65f76e18a 100644 --- a/gfx/font_renderer_driver.c +++ b/gfx/font_renderer_driver.c @@ -25,7 +25,7 @@ static const font_renderer_driver_t *font_backends[] = { #ifdef HAVE_FREETYPE &freetype_font_renderer, #endif -#ifdef __APPLE__ +#if defined(__APPLE__) && defined(HAVE_CORETEXT) &coretext_font_renderer, #endif &bitmap_font_renderer, diff --git a/griffin/griffin.c b/griffin/griffin.c index 53aa5d8daa..0382f75b55 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -247,7 +247,7 @@ FONTS #include "../gfx/drivers_font_renderer/freetype.c" #endif -#if defined(__APPLE__) +#if defined(__APPLE__) && defined(HAVE_CORETEXT) #include "../gfx/drivers_font_renderer/coretext.c" #endif From f18e1d0d5dca1df7be0ee680902c98f7aef00294 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 16:24:51 +0200 Subject: [PATCH 087/120] Add HAVE_COCOATOUCH --- apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj | 8 ++++++++ griffin/griffin_objc.m | 2 ++ ui/ui_companion_driver.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj b/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj index b89c9ee861..7c64d2a5c5 100644 --- a/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj +++ b/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj @@ -513,6 +513,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", "-DRARCH_INTERNAL", @@ -576,6 +577,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", "-DRARCH_INTERNAL", @@ -613,6 +615,7 @@ "-DRARCH_INTERNAL", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", "-DHAVE_THREADS", @@ -682,6 +685,7 @@ "-DHAVE_FBO", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", ); @@ -740,6 +744,7 @@ "-DHAVE_FBO", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", ); @@ -797,6 +802,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", "-DRARCH_INTERNAL", @@ -861,6 +867,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", "-DRARCH_INTERNAL", @@ -899,6 +906,7 @@ "-DRARCH_INTERNAL", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", "-DHAVE_THREADS", diff --git a/griffin/griffin_objc.m b/griffin/griffin_objc.m index b0fe28c0ff..87a7379b8d 100644 --- a/griffin/griffin_objc.m +++ b/griffin/griffin_objc.m @@ -30,7 +30,9 @@ #include "../apple/iOS/platform.m" #include "../apple/iOS/menu.m" #include "../apple/iOS/browser.m" +#ifdef HAVE_COCOATOUCH #include "../ui/drivers/ui_cocoatouch.m" +#endif #else #include "../apple/OSX/platform.m" #include "../apple/OSX/settings.m" diff --git a/ui/ui_companion_driver.c b/ui/ui_companion_driver.c index 4e5d141a80..010f1c0922 100644 --- a/ui/ui_companion_driver.c +++ b/ui/ui_companion_driver.c @@ -22,7 +22,7 @@ #endif static const ui_companion_driver_t *ui_companion_drivers[] = { -#ifdef IOS +#ifdef HAVE_COCOATOUCH &ui_companion_cocoatouch, #endif #ifdef HAVE_QT From 31de846279a4b91c2c44cd39c3ce61c2779e77d5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 16:29:53 +0200 Subject: [PATCH 088/120] Add HAVE_COCOA define - refactor griffin_objc.m --- apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj | 2 ++ apple/RetroArch_OSX.xcodeproj/project.pbxproj | 2 ++ griffin/griffin_objc.m | 12 +++++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj index 1e18dd14b8..8b646d7d71 100644 --- a/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj @@ -298,6 +298,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOA", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", "-DHAVE_NETPLAY", @@ -360,6 +361,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOA", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", "-DHAVE_NETPLAY", diff --git a/apple/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/RetroArch_OSX.xcodeproj/project.pbxproj index aba32fb544..4e704cc107 100644 --- a/apple/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/RetroArch_OSX.xcodeproj/project.pbxproj @@ -341,6 +341,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOA", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", "-DHAVE_NETPLAY", @@ -396,6 +397,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_COCOA", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", "-DHAVE_NETPLAY", diff --git a/griffin/griffin_objc.m b/griffin/griffin_objc.m index 87a7379b8d..6dc595db5a 100644 --- a/griffin/griffin_objc.m +++ b/griffin/griffin_objc.m @@ -23,21 +23,27 @@ #define __IPHONE_OS_VERSION_MAX_ALLOWED 00000 #endif +#if defined(HAVE_COCOATOUCH) || defined(HAVE_COCOA) #include "../gfx/drivers_context/apple_cocoa_gl.m" #include "../apple/common/apple_cocoa_common.m" +#if defined(HAVE_COCOATOUCH) + #if TARGET_OS_IPHONE -#include "../apple/iOS/platform.m" #include "../apple/iOS/menu.m" #include "../apple/iOS/browser.m" -#ifdef HAVE_COCOATOUCH +#include "../apple/iOS/platform.m" #include "../ui/drivers/ui_cocoatouch.m" #endif -#else + +#elif defined(HAVE_COCOA) + #include "../apple/OSX/platform.m" #include "../apple/OSX/settings.m" #endif +#endif + #ifdef HAVE_MFI #include "../input/drivers_hid/mfi_hid.m" #endif From 4e5bf65e23e973533f550d8d5be44ac0a301a6f8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 16:55:03 +0200 Subject: [PATCH 089/120] Create HAVE_RPNG define --- Makefile.common | 18 ++++++++++++----- Makefile.ctr | 2 +- Makefile.griffin | 6 ++++++ Makefile.ps3 | 2 +- Makefile.ps3.cobra | 2 +- Makefile.psl1ght | 2 +- Makefile.psp1 | 2 +- android/phoenix/jni/Android.mk | 2 +- .../RetroArch_OSX.xcodeproj/project.pbxproj | 2 ++ apple/RetroArch_OSX.xcodeproj/project.pbxproj | 2 ++ .../RetroArch_iOS.xcodeproj/project.pbxproj | 8 ++++++++ gfx/image/image.c | 10 +++++++--- griffin/griffin.c | 3 +++ runloop_data.c | 20 +++++++++++++++++-- screenshot.c | 5 ++--- 15 files changed, 67 insertions(+), 19 deletions(-) diff --git a/Makefile.common b/Makefile.common index b37781d733..a98648e5a7 100644 --- a/Makefile.common +++ b/Makefile.common @@ -643,13 +643,10 @@ endif ifeq ($(HAVE_ZLIB), 1) ZLIB_OBJS = decompress/zip_support.o - OBJ += libretro-common/formats/png/rpng_nbio.o \ - libretro-common/formats/png/rpng_fbio.o \ - libretro-common/formats/png/rpng_decode.o \ - libretro-common/formats/png/rpng_encode.o \ - libretro-common/file/file_extract.o + OBJ += libretro-common/file/file_extract.o OBJ += $(ZLIB_OBJS) DEFINES += -DHAVE_ZLIB + #HAVE_RPNG = 1 HAVE_COMPRESSION = 1 ifeq ($(WANT_ZLIB), 1) DEFINES += -DWANT_ZLIB @@ -659,6 +656,17 @@ ifeq ($(HAVE_ZLIB), 1) endif endif +ifdef HAVE_RPNG + DEFINES += -DHAVE_RPNG +endif + +ifeq ($(HAVE_RPNG), 1) + OBJ += libretro-common/formats/png/rpng_nbio.o \ + libretro-common/formats/png/rpng_fbio.o \ + libretro-common/formats/png/rpng_decode.o \ + libretro-common/formats/png/rpng_encode.o +endif + ifdef HAVE_COMPRESSION DEFINES += -DHAVE_COMPRESSION endif diff --git a/Makefile.ctr b/Makefile.ctr index b54c29d1e6..44cb99611f 100644 --- a/Makefile.ctr +++ b/Makefile.ctr @@ -39,7 +39,7 @@ CFLAGS += -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY CFLAGS += -DHAVE_GRIFFIN=1 -DHAVE_FILTERS_BUILTIN -DHAVE_MENU -DHAVE_RGUI -CFLAGS += -DHAVE_ZLIB -DWANT_ZLIB -DHAVE_BUILTIN_AUTOCONFIG +CFLAGS += -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_BUILTIN_AUTOCONFIG #-DHAVE_LIBRETRO_MANAGEMENT -DWANT_RPNG -DHAVE_7ZIP diff --git a/Makefile.griffin b/Makefile.griffin index 25543252c3..f893cd9350 100644 --- a/Makefile.griffin +++ b/Makefile.griffin @@ -76,6 +76,7 @@ endif HAVE_FILTERS_BUILTIN := 1 HAVE_THREADS := 1 HAVE_ZLIB := 1 + HAVE_RPNG := 1 HAVE_7ZIP := 1 HAVE_RPNG := 1 HAVE_OVERLAY := 1 @@ -119,6 +120,7 @@ HAVE_7ZIP := 1 HAVE_LIBRETRO_MANAGEMENT := 1 HAVE_ZLIB := 1 HAVE_RPNG := 1 + HAVE_RPNG := 1 HAVE_OVERLAY := 1 HAVE_LIBSICKSAXIS := 0 HAVE_BUILTIN_AUTOCONFIG := 1 @@ -172,6 +174,10 @@ ifeq ($(HAVE_ZLIB), 1) CFLAGS += -DHAVE_ZLIB -DWANT_ZLIB endif +ifeq ($(HAVE_RPNG), 1) +CFLAGS += -DHAVE_RPNG +endif + ifeq ($(HAVE_7ZIP), 1) CFLAGS += -DHAVE_7ZIP endif diff --git a/Makefile.ps3 b/Makefile.ps3 index 47d2186b4f..5cfe5a2773 100644 --- a/Makefile.ps3 +++ b/Makefile.ps3 @@ -106,7 +106,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe -DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_7Z -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_FILTERS_BUILTIN -DHAVE_BUILTIN_AUTOCONFIG +DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_7Z -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_FILTERS_BUILTIN -DHAVE_BUILTIN_AUTOCONFIG ifeq ($(DEBUG), 1) PPU_OPTIMIZE_LV := -O0 -g diff --git a/Makefile.ps3.cobra b/Makefile.ps3.cobra index 1d708570c2..c542425989 100644 --- a/Makefile.ps3.cobra +++ b/Makefile.ps3.cobra @@ -106,7 +106,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe -DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) +DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) ifeq ($(DEBUG), 1) PPU_OPTIMIZE_LV := -O0 -g diff --git a/Makefile.psl1ght b/Makefile.psl1ght index 88db64d0d7..85ddec7938 100644 --- a/Makefile.psl1ght +++ b/Makefile.psl1ght @@ -90,7 +90,7 @@ ifeq ($(HAVE_FILE_LOGGER), 1) CFLAGS += -DHAVE_FILE_LOGGER endif -SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts +SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts CFLAGS += -std=gnu99 $(SHARED_FLAGS) CXXFLAGS += $(SHARED_FLAGS) diff --git a/Makefile.psp1 b/Makefile.psp1 index 2b7491db07..d4d43ebafa 100644 --- a/Makefile.psp1 +++ b/Makefile.psp1 @@ -23,7 +23,7 @@ INCDIR = deps/zlib deps/7zip libretro-common/include CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math ASFLAGS = $(CFLAGS) -RARCH_DEFINES = -DPSP -D_MIPS_ARCH_ALLEGREX -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_ZLIB -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DWANT_RPNG -DSINC_LOWEST_QUALITY -DHAVE_BUILTIN_AUTOCONFIG -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP +RARCH_DEFINES = -DPSP -D_MIPS_ARCH_ALLEGREX -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DWANT_RPNG -DSINC_LOWEST_QUALITY -DHAVE_BUILTIN_AUTOCONFIG -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP LIBDIR = LDFLAGS = diff --git a/android/phoenix/jni/Android.mk b/android/phoenix/jni/Android.mk index 757d41bc1b..c73f73f532 100644 --- a/android/phoenix/jni/Android.mk +++ b/android/phoenix/jni/Android.mk @@ -58,7 +58,7 @@ else endif -LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -fno-stack-protector -funroll-loops -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETPLAY -DHAVE_NETWORKING -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_GLUI -DHAVE_XMB -std=gnu99 -DHAVE_LIBRETRODB +LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -fno-stack-protector -funroll-loops -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DHAVE_RPNG -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETPLAY -DHAVE_NETWORKING -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_GLUI -DHAVE_XMB -std=gnu99 -DHAVE_LIBRETRODB LOCAL_CFLAGS += -DHAVE_7ZIP ifeq ($(NDK_DEBUG),1) diff --git a/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj index 8b646d7d71..a5d901bac6 100644 --- a/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/OSXPPC/RetroArch_OSX.xcodeproj/project.pbxproj @@ -298,6 +298,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOA", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", @@ -361,6 +362,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOA", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", diff --git a/apple/RetroArch_OSX.xcodeproj/project.pbxproj b/apple/RetroArch_OSX.xcodeproj/project.pbxproj index 4e704cc107..8aeb1f9a3f 100644 --- a/apple/RetroArch_OSX.xcodeproj/project.pbxproj +++ b/apple/RetroArch_OSX.xcodeproj/project.pbxproj @@ -341,6 +341,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOA", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", @@ -397,6 +398,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOA", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", diff --git a/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj b/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj index 7c64d2a5c5..ea3673caa0 100644 --- a/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj +++ b/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj @@ -513,6 +513,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", @@ -577,6 +578,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", @@ -615,6 +617,7 @@ "-DRARCH_INTERNAL", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", @@ -685,6 +688,7 @@ "-DHAVE_FBO", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", @@ -744,6 +748,7 @@ "-DHAVE_FBO", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", @@ -802,6 +807,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", @@ -867,6 +873,7 @@ "-DHAVE_DYNAMIC", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", @@ -906,6 +913,7 @@ "-DRARCH_INTERNAL", "-DHAVE_OVERLAY", "-DHAVE_ZLIB", + "-DHAVE_RPNG", "-DHAVE_COCOATOUCH", "-DWANT_ZLIB", "-DSINC_LOWER_QUALITY", diff --git a/gfx/image/image.c b/gfx/image/image.c index 18b9402122..08b2ad9cb3 100644 --- a/gfx/image/image.c +++ b/gfx/image/image.c @@ -19,7 +19,9 @@ #endif #include +#ifdef HAVE_RPNG #include +#endif #include #ifdef _XBOX1 #include "../d3d/d3d_wrapper.h" @@ -46,7 +48,7 @@ #endif -#ifdef HAVE_ZLIB +#ifdef HAVE_RPNG static bool rpng_image_load_argb_shift(const char *path, struct texture_image *out_img, unsigned a_shift, unsigned r_shift, @@ -397,13 +399,12 @@ bool texture_image_load(struct texture_image *out_img, const char *path) if (buf) free(buf); } -#ifdef HAVE_ZLIB +#ifdef HAVE_RPNG else if (strstr(path, ".png")) { ret = rpng_image_load_argb_shift(path, out_img, a_shift, r_shift, g_shift, b_shift); } -#endif #ifdef GEKKO if (ret) @@ -416,6 +417,9 @@ bool texture_image_load(struct texture_image *out_img, const char *path) } #endif +#endif + + return ret; } #endif diff --git a/griffin/griffin.c b/griffin/griffin.c index 0382f75b55..1fd9f15096 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -173,10 +173,13 @@ VIDEO IMAGE #include "../gfx/video_texture.c" #include "../libretro-common/formats/tga/tga_decode.c" + +#ifdef HAVE_RPNG #include "../libretro-common/formats/png/rpng_fbio.c" #include "../libretro-common/formats/png/rpng_nbio.c" #include "../libretro-common/formats/png/rpng_decode.c" #include "../libretro-common/formats/png/rpng_encode.c" +#endif /*============================================================ VIDEO DRIVER diff --git a/runloop_data.c b/runloop_data.c index 23b3275ad7..8ca11842ea 100644 --- a/runloop_data.c +++ b/runloop_data.c @@ -59,7 +59,9 @@ typedef struct nbio_image_handle bool is_blocking_on_processing; bool is_finished; transfer_cb_t cb; +#ifdef HAVE_RPNG struct rpng_t *handle; +#endif unsigned processing_pos_increment; unsigned pos_increment; uint64_t frame_count; @@ -301,6 +303,8 @@ static int rarch_main_data_http_iterate_poll(http_handle_t *http) #endif #ifdef HAVE_MENU + +#ifdef HAVE_RPNG static int cb_image_menu_wallpaper_upload(void *data, size_t len) { nbio_handle_t *nbio = (nbio_handle_t*)data; @@ -395,7 +399,6 @@ static int cb_nbio_image_menu_wallpaper(void *data, size_t len) return 0; } -#endif static int rarch_main_data_image_iterate_poll(nbio_handle_t *nbio) { @@ -511,6 +514,9 @@ static int rarch_main_data_image_iterate_transfer_parse(nbio_handle_t *nbio) return 0; } +#endif + +#endif static int cb_nbio_default(void *data, size_t len) { @@ -569,7 +575,7 @@ static int rarch_main_data_nbio_iterate_poll(nbio_handle_t *nbio) if (elem1[0] != '\0') { -#ifdef HAVE_MENU +#if defined(HAVE_MENU) && defined(HAVE_RPNG) if (!strcmp(elem1, "cb_menu_wallpaper")) nbio->cb = &cb_nbio_image_menu_wallpaper; #endif @@ -648,6 +654,7 @@ static int rarch_main_data_nbio_iterate_parse(nbio_handle_t *nbio) #ifdef HAVE_LIBRETRODB #ifdef HAVE_MENU + static void rarch_main_data_db_iterate(bool is_thread, data_runloop_t *runloop) { @@ -670,10 +677,12 @@ static void rarch_main_data_db_iterate(bool is_thread, break; } } + #endif #endif +#ifdef HAVE_RPNG static void rarch_main_data_nbio_image_iterate(bool is_thread, data_runloop_t *runloop) { @@ -708,6 +717,7 @@ static void rarch_main_data_nbio_image_iterate(bool is_thread, break; } } +#endif static void rarch_main_data_nbio_iterate(bool is_thread, data_runloop_t *runloop) { @@ -893,7 +903,9 @@ void rarch_main_data_free(void) static void data_runloop_iterate(bool is_thread, data_runloop_t *runloop) { rarch_main_data_nbio_iterate (is_thread, runloop); +#ifdef HAVE_RPNG rarch_main_data_nbio_image_iterate (is_thread, runloop); +#endif #ifdef HAVE_OVERLAY rarch_main_data_overlay_iterate (is_thread, runloop); #endif @@ -970,6 +982,7 @@ error: } #endif +#ifdef HAVE_RPNG static void rarch_main_data_nbio_image_upload_iterate(bool is_thread, data_runloop_t *runloop) { @@ -994,6 +1007,7 @@ static void rarch_main_data_nbio_image_upload_iterate(bool is_thread, break; } } +#endif void rarch_main_data_iterate(void) { @@ -1019,7 +1033,9 @@ void rarch_main_data_iterate(void) #ifdef HAVE_OVERLAY rarch_main_data_overlay_image_upload_iterate(false, runloop); #endif +#ifdef HAVE_RPNG rarch_main_data_nbio_image_upload_iterate(false, runloop); +#endif if (data_runloop_msg[0] != '\0') { diff --git a/screenshot.c b/screenshot.c index cc2b7315cc..4ad81d25be 100644 --- a/screenshot.c +++ b/screenshot.c @@ -41,8 +41,7 @@ #include #endif -#ifdef HAVE_ZLIB_DEFLATE - +#if defined(HAVE_ZLIB_DEFLATE) && defined(HAVE_RPNG) #include #define IMG_EXT "png" @@ -379,7 +378,7 @@ bool screenshot_dump(const char *folder, const void *frame, } ret = false; -#elif defined(HAVE_ZLIB_DEFLATE) +#elif defined(HAVE_ZLIB_DEFLATE) && defined(HAVE_RPNG) out_buffer = (uint8_t*)malloc(width * height * 3); if (!out_buffer) return false; From e116ef72daed35b01e9d676baef0734d7a6d82d8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 16:59:11 +0200 Subject: [PATCH 090/120] Add HAVE_ZLIB ifdefs around zlib-specific code --- content.c | 2 ++ database_info.c | 2 ++ patch.c | 15 +++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/content.c b/content.c index 060aafd42e..f1315e6e4c 100644 --- a/content.c +++ b/content.c @@ -73,9 +73,11 @@ static bool read_content_file(unsigned i, const char *path, void **buf, if (!global->block_patch) patch_content(&ret_buf, length); +#ifdef HAVE_ZLIB global->content_crc = zlib_crc32_calculate(ret_buf, *length); RARCH_LOG("CRC32: 0x%x .\n", (unsigned)global->content_crc); +#endif *buf = ret_buf; return true; diff --git a/database_info.c b/database_info.c index e9e16a3f2e..7214ef7895 100644 --- a/database_info.c +++ b/database_info.c @@ -141,9 +141,11 @@ static int database_info_iterate_rdl_write( rarch_main_msg_queue_push(msg, 1, 180, true); +#ifdef HAVE_ZLIB crc = zlib_crc32_calculate(ret_buf, ret); RARCH_LOG("CRC32: 0x%x .\n", (unsigned)crc); +#endif if (ret_buf) free(ret_buf); diff --git a/patch.c b/patch.c index e0ea5de493..321998be4b 100644 --- a/patch.c +++ b/patch.c @@ -50,7 +50,9 @@ struct bps_data static uint8_t bps_read(struct bps_data *bps) { uint8_t data = bps->modify_data[bps->modify_offset++]; +#ifdef HAVE_ZLIB bps->modify_checksum = zlib_crc32_adjust(bps->modify_checksum, data); +#endif return data; } @@ -77,7 +79,9 @@ static void bps_write(struct bps_data *bps, uint8_t data) return; bps->target_data[bps->output_offset++] = data; +#ifdef HAVE_ZLIB bps->target_checksum = zlib_crc32_adjust(bps->target_checksum, data); +#endif } patch_error_t bps_apply_patch( @@ -175,7 +179,12 @@ patch_error_t bps_apply_patch( for (i = 0; i < 32; i += 8) modify_modify_checksum |= bps_read(&bps) << i; +#ifdef HAVE_ZLIB bps.source_checksum = zlib_crc32_calculate(bps.source_data, bps.source_length); +#else + return PATCH_PATCH_CHECKSUM_INVALID; +#endif + bps.target_checksum = ~bps.target_checksum; if (bps.source_checksum != modify_source_checksum) @@ -204,7 +213,9 @@ static uint8_t ups_patch_read(struct ups_data *data) if (data && data->patch_offset < data->patch_length) { uint8_t n = data->patch_data[data->patch_offset++]; +#ifdef HAVE_ZLIB data->patch_checksum = zlib_crc32_adjust(data->patch_checksum, n); +#endif return n; } return 0x00; @@ -215,7 +226,9 @@ static uint8_t ups_source_read(struct ups_data *data) if (data && data->source_offset < data->source_length) { uint8_t n = data->source_data[data->source_offset++]; +#ifdef HAVE_ZLIB data->source_checksum = zlib_crc32_adjust(data->source_checksum, n); +#endif return n; } return 0x00; @@ -226,7 +239,9 @@ static void ups_target_write(struct ups_data *data, uint8_t n) if (data && data->target_offset < data->target_length) { data->target_data[data->target_offset] = n; +#ifdef HAVE_ZLIB data->target_checksum = zlib_crc32_adjust(data->target_checksum, n); +#endif } if (data) From a1eb9314553e3eea74afc04c94782783495cee6d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 17:02:36 +0200 Subject: [PATCH 091/120] (OSX/Apple) Create main() function if HAVE_COCOA and HAVE_COCOATOUCH are not defined --- frontend/drivers/platform_apple.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/drivers/platform_apple.c b/frontend/drivers/platform_apple.c index 5d1b9aea06..54f75ef213 100644 --- a/frontend/drivers/platform_apple.c +++ b/frontend/drivers/platform_apple.c @@ -414,3 +414,10 @@ const frontend_ctx_driver_t frontend_ctx_apple = { frontend_apple_get_powerstate, "apple", }; + +#if !defined(HAVE_COCOA) && !defined(HAVE_COCOATOUCH) +int main(int argc, char *argv[]) +{ + return rarch_main(argc, argv); +} +#endif From 9d26a321df01e2ffd2eaf9ef181d79f990374cd6 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 17:08:13 +0200 Subject: [PATCH 092/120] (OSX) Add platform_apple.c to Makefile.common --- Makefile.common | 4 ++++ frontend/frontend_driver.c | 2 +- griffin/griffin.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile.common b/Makefile.common index a98648e5a7..5db41bf3ab 100644 --- a/Makefile.common +++ b/Makefile.common @@ -255,6 +255,10 @@ ifeq ($(HAVE_AL), 1) endif endif +ifeq ($(OSX), 1) + OBJ += frontend/drivers/platform_apple.o +endif + ifeq ($(HAVE_JACK),1) OBJ += audio/drivers/jack.o LIBS += $(JACK_LIBS) diff --git a/frontend/frontend_driver.c b/frontend/frontend_driver.c index fd92ad8696..1733964533 100644 --- a/frontend/frontend_driver.c +++ b/frontend/frontend_driver.c @@ -35,7 +35,7 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = { #if defined(__QNX__) &frontend_ctx_qnx, #endif -#if defined(IOS) || defined(OSX) +#if defined(__APPLE__) &frontend_ctx_apple, #endif #if defined(ANDROID) diff --git a/griffin/griffin.c b/griffin/griffin.c index 1fd9f15096..cfe5ee7d21 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -609,7 +609,7 @@ FRONTEND #include "../frontend/drivers/platform_ctr.c" #elif defined(__QNX__) #include "../frontend/drivers/platform_qnx.c" -#elif defined(OSX) || defined(IOS) +#elif defined(__APPLE__) #include "../frontend/drivers/platform_apple.c" #elif defined(ANDROID) #include "../frontend/drivers/platform_android.c" From 425783672ed363e6367a5cda7e2a9b5324650f26 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 19 Apr 2015 17:12:20 +0200 Subject: [PATCH 093/120] (platform_apple.c) Add some more defines so that it can compile and link without HAVE_COCOA or HAVE_COCOATOUCH --- frontend/drivers/platform_apple.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/drivers/platform_apple.c b/frontend/drivers/platform_apple.c index 54f75ef213..812e1ce5e2 100644 --- a/frontend/drivers/platform_apple.c +++ b/frontend/drivers/platform_apple.c @@ -15,10 +15,14 @@ * If not, see . */ +#include +#include +#include #include "../../apple/common/CFExtensions.h" #include "../frontend_driver.h" #include "../../ui/ui_companion_driver.h" +#include "../../general.h" #include #include @@ -177,6 +181,7 @@ static void frontend_apple_get_os(char *name, size_t sizeof_name, int *major, in static void frontend_apple_get_environment_settings(int *argc, char *argv[], void *args, void *params_data) { +#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) char temp_dir[PATH_MAX_LENGTH]; char bundle_path_buf[PATH_MAX_LENGTH], home_dir_buf[PATH_MAX_LENGTH]; CFURLRef bundle_url; @@ -241,9 +246,12 @@ static void frontend_apple_get_environment_settings(int *argc, char *argv[], CFRelease(bundle_path); CFRelease(bundle_url); +#endif } +#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) extern void apple_rarch_exited(void); +#endif static void frontend_apple_load_content(void) { @@ -256,7 +264,9 @@ static void frontend_apple_load_content(void) static void frontend_apple_shutdown(bool unused) { +#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) apple_rarch_exited(); +#endif } static int frontend_apple_get_rating(void) From 8818eb8ccacf056f795d78a41136495e1230f0e3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 17:27:51 +0200 Subject: [PATCH 094/120] (Video context driver) gfx_ctx_apple should become gfx_ctx_cocoa --- gfx/video_context_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 2d8758b7d6..6b6d17f2bc 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -59,8 +59,7 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { #if defined(__QNX__) &gfx_ctx_bbqnx, #endif -#if defined(IOS) || defined(OSX) - /* Don't use __APPLE__ as it breaks basic SDL builds. */ +#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) &gfx_ctx_apple, #endif #if (defined(HAVE_SDL) || defined(HAVE_SDL2)) && defined(HAVE_OPENGL) From d74f5ad3aa88a9fe38f1d777181520bf5293902d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 17:40:10 +0200 Subject: [PATCH 095/120] (Apple/Cocoa) Rename gfx_ctx_apple to gfx_ctx_cocoa --- apple/common/apple_cocoa_common.m | 4 +- apple/iOS/platform.m | 4 +- gfx/drivers_context/apple_cocoa_gl.m | 86 ++++++++++++++-------------- gfx/video_context_driver.c | 2 +- gfx/video_context_driver.h | 2 +- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/apple/common/apple_cocoa_common.m b/apple/common/apple_cocoa_common.m index f2c87cb597..0ea57dd7ec 100644 --- a/apple/common/apple_cocoa_common.m +++ b/apple/common/apple_cocoa_common.m @@ -200,7 +200,7 @@ void *nsview_get_ptr(void) #endif /* forward declarations */ -void apple_gfx_ctx_update(void); +void cocoagl_gfx_ctx_update(void); void *glkitview_init(void); @implementation RAGameView @@ -232,7 +232,7 @@ void *glkitview_init(void); { [super setFrame:frameRect]; - apple_gfx_ctx_update(); + cocoagl_gfx_ctx_update(); } /* Stop the annoying sound when pressing a key. */ diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index 75d336d072..99ead1962f 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -110,7 +110,7 @@ void get_ios_version(int *major, int *minor) *minor = [decomposed_os_version[1] integerValue]; } -extern float apple_gfx_ctx_get_native_scale(void); +extern float cocoagl_gfx_ctx_get_native_scale(void); /* Input helpers: This is kept here because it needs ObjC */ static void handle_touch_event(NSArray* touches) @@ -118,7 +118,7 @@ static void handle_touch_event(NSArray* touches) unsigned i; driver_t *driver = driver_get_ptr(); apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; - float scale = apple_gfx_ctx_get_native_scale(); + float scale = cocoagl_gfx_ctx_get_native_scale(); if (!apple) return; diff --git a/gfx/drivers_context/apple_cocoa_gl.m b/gfx/drivers_context/apple_cocoa_gl.m index 9a3cdd4d95..57ae502035 100644 --- a/gfx/drivers_context/apple_cocoa_gl.m +++ b/gfx/drivers_context/apple_cocoa_gl.m @@ -109,7 +109,7 @@ void *glkitview_init(void) } #ifdef IOS -void apple_bind_game_view_fbo(void) +void cocoagl_bind_game_view_fbo(void) { if (g_context) [g_view bindDrawable]; @@ -133,7 +133,7 @@ static RAScreen* get_chosen_screen(void) #endif } -void apple_gfx_ctx_update(void) +void cocoagl_gfx_ctx_update(void) { #ifdef OSX #if MAC_OS_X_VERSION_10_7 && !defined(HAVE_NSOPENGL) @@ -144,7 +144,7 @@ void apple_gfx_ctx_update(void) #endif } -static bool apple_gfx_ctx_init(void *data) +static bool cocoagl_gfx_ctx_init(void *data) { (void)data; @@ -192,7 +192,7 @@ static bool apple_gfx_ctx_init(void *data) return true; } -static void apple_gfx_ctx_destroy(void *data) +static void cocoagl_gfx_ctx_destroy(void *data) { (void)data; @@ -216,7 +216,7 @@ static void apple_gfx_ctx_destroy(void *data) g_context = nil; } -static bool apple_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor) +static bool cocoagl_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor) { (void)data; #if defined(IOS) @@ -233,7 +233,7 @@ static bool apple_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned ma return true; } -static void apple_gfx_ctx_swap_interval(void *data, unsigned interval) +static void cocoagl_gfx_ctx_swap_interval(void *data, unsigned interval) { (void)data; #ifdef IOS // < No way to disable Vsync on iOS? @@ -251,7 +251,7 @@ static void apple_gfx_ctx_swap_interval(void *data, unsigned interval) #endif } -static bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) +static bool cocoagl_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) { #ifdef OSX RAGameView *g_view = (RAGameView*)nsview_get_ptr(); @@ -276,12 +276,12 @@ static bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned he (void)data; - // TODO: Maybe iOS users should be apple to show/hide the status bar here? + // TODO: Maybe iOS users should be able to show/hide the status bar here? return true; } -float apple_gfx_ctx_get_native_scale(void) +float cocoagl_gfx_ctx_get_native_scale(void) { static float ret = 0.0f; SEL selector = NSSelectorFromString(BOXSTRING("nativeScale")); @@ -309,11 +309,11 @@ float apple_gfx_ctx_get_native_scale(void) return ret; } -static void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height) +static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height) { RAScreen *screen = (RAScreen*)get_chosen_screen(); CGRect size = screen.bounds; - float screenscale = apple_gfx_ctx_get_native_scale(); + float screenscale = cocoagl_gfx_ctx_get_native_scale(); #if defined(OSX) RAGameView *g_view = (RAGameView*)nsview_get_ptr(); @@ -327,7 +327,7 @@ static void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* *height = CGRectGetHeight(size) * screenscale; } -static void apple_gfx_ctx_update_window_title(void *data) +static void cocoagl_gfx_ctx_update_window_title(void *data) { static char buf[128], buf_fps[128]; bool got_text = video_monitor_get_fps(buf, sizeof(buf), @@ -346,7 +346,7 @@ static void apple_gfx_ctx_update_window_title(void *data) rarch_main_msg_queue_push(buf_fps, 1, 1, false); } -static bool apple_gfx_ctx_get_metrics(void *data, enum display_metric_types type, +static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types type, float *value) { #ifdef OSX @@ -361,7 +361,7 @@ static bool apple_gfx_ctx_get_metrics(void *data, enum display_metric_types type float physical_width = display_physical_size.width; float physical_height = display_physical_size.height; #elif defined(IOS) - float scale = apple_gfx_ctx_get_native_scale(); + float scale = cocoagl_gfx_ctx_get_native_scale(); CGRect screen_rect = [[UIScreen mainScreen] bounds]; float display_width = screen_rect.size.width; @@ -393,7 +393,7 @@ static bool apple_gfx_ctx_get_metrics(void *data, enum display_metric_types type return true; } -static bool apple_gfx_ctx_has_focus(void *data) +static bool cocoagl_gfx_ctx_has_focus(void *data) { (void)data; #ifdef IOS @@ -403,7 +403,7 @@ static bool apple_gfx_ctx_has_focus(void *data) #endif } -static bool apple_gfx_ctx_suppress_screensaver(void *data, bool enable) +static bool cocoagl_gfx_ctx_suppress_screensaver(void *data, bool enable) { (void)data; (void)enable; @@ -411,7 +411,7 @@ static bool apple_gfx_ctx_suppress_screensaver(void *data, bool enable) return false; } -static bool apple_gfx_ctx_has_windowed(void *data) +static bool cocoagl_gfx_ctx_has_windowed(void *data) { (void)data; @@ -422,7 +422,7 @@ static bool apple_gfx_ctx_has_windowed(void *data) #endif } -static void apple_gfx_ctx_swap_buffers(void *data) +static void cocoagl_gfx_ctx_swap_buffers(void *data) { if (!(--g_fast_forward_skips < 0)) return; @@ -442,7 +442,7 @@ static void apple_gfx_ctx_swap_buffers(void *data) g_fast_forward_skips = g_is_syncing ? 0 : 3; } -static gfx_ctx_proc_t apple_gfx_ctx_get_proc_address(const char *symbol_name) +static gfx_ctx_proc_t cocoagl_gfx_ctx_get_proc_address(const char *symbol_name) { return (gfx_ctx_proc_t)CFBundleGetFunctionPointerForName(CFBundleGetBundleWithIdentifier(GLFrameworkID), ( @@ -455,7 +455,7 @@ CFStringRef)BOXSTRING(symbol_name) ); } -static void apple_gfx_ctx_check_window(void *data, bool *quit, +static void cocoagl_gfx_ctx_check_window(void *data, bool *quit, bool *resize, unsigned *width, unsigned *height, unsigned frame_count) { unsigned new_width, new_height; @@ -463,7 +463,7 @@ static void apple_gfx_ctx_check_window(void *data, bool *quit, *quit = false; - apple_gfx_ctx_get_video_size(data, &new_width, &new_height); + cocoagl_gfx_ctx_get_video_size(data, &new_width, &new_height); if (new_width != *width || new_height != *height) { *width = new_width; @@ -472,21 +472,21 @@ static void apple_gfx_ctx_check_window(void *data, bool *quit, } } -static void apple_gfx_ctx_set_resize(void *data, unsigned width, unsigned height) +static void cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned height) { (void)data; (void)width; (void)height; } -static void apple_gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data) +static void cocoagl_gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data) { (void)data; *input = NULL; *input_data = NULL; } -static void apple_gfx_ctx_bind_hw_render(void *data, bool enable) +static void cocoagl_gfx_ctx_bind_hw_render(void *data, bool enable) { (void)data; g_use_hw_ctx = enable; @@ -497,30 +497,30 @@ static void apple_gfx_ctx_bind_hw_render(void *data, bool enable) [g_context makeCurrentContext]; } -const gfx_ctx_driver_t gfx_ctx_apple = { - apple_gfx_ctx_init, - apple_gfx_ctx_destroy, - apple_gfx_ctx_bind_api, - apple_gfx_ctx_swap_interval, - apple_gfx_ctx_set_video_mode, - apple_gfx_ctx_get_video_size, +const gfx_ctx_driver_t gfx_ctx_cocoagl = { + cocoagl_gfx_ctx_init, + cocoagl_gfx_ctx_destroy, + cocoagl_gfx_ctx_bind_api, + cocoagl_gfx_ctx_swap_interval, + cocoagl_gfx_ctx_set_video_mode, + cocoagl_gfx_ctx_get_video_size, NULL, /* get_video_output_size */ NULL, /* get_video_output_prev */ NULL, /* get_video_output_next */ - apple_gfx_ctx_get_metrics, + cocoagl_gfx_ctx_get_metrics, NULL, - apple_gfx_ctx_update_window_title, - apple_gfx_ctx_check_window, - apple_gfx_ctx_set_resize, - apple_gfx_ctx_has_focus, - apple_gfx_ctx_suppress_screensaver, - apple_gfx_ctx_has_windowed, - apple_gfx_ctx_swap_buffers, - apple_gfx_ctx_input_driver, - apple_gfx_ctx_get_proc_address, + cocoagl_gfx_ctx_update_window_title, + cocoagl_gfx_ctx_check_window, + cocoagl_gfx_ctx_set_resize, + cocoagl_gfx_ctx_has_focus, + cocoagl_gfx_ctx_suppress_screensaver, + cocoagl_gfx_ctx_has_windowed, + cocoagl_gfx_ctx_swap_buffers, + cocoagl_gfx_ctx_input_driver, + cocoagl_gfx_ctx_get_proc_address, NULL, NULL, NULL, - "apple", - apple_gfx_ctx_bind_hw_render, + "cocoagl", + cocoagl_gfx_ctx_bind_hw_render, }; diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 6b6d17f2bc..c3f8998556 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -60,7 +60,7 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { &gfx_ctx_bbqnx, #endif #if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) - &gfx_ctx_apple, + &gfx_ctx_cocoagl, #endif #if (defined(HAVE_SDL) || defined(HAVE_SDL2)) && defined(HAVE_OPENGL) &gfx_ctx_sdl_gl, diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index cf00136f01..2dab64fca5 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -163,7 +163,7 @@ extern const gfx_ctx_driver_t gfx_ctx_ps3; extern const gfx_ctx_driver_t gfx_ctx_wgl; extern const gfx_ctx_driver_t gfx_ctx_videocore; extern const gfx_ctx_driver_t gfx_ctx_bbqnx; -extern const gfx_ctx_driver_t gfx_ctx_apple; +extern const gfx_ctx_driver_t gfx_ctx_cocoagl; extern const gfx_ctx_driver_t gfx_ctx_emscripten; extern const gfx_ctx_driver_t gfx_ctx_null; From 8c528bb79a3d98849c8103e4ea8523a8f51f7006 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 17:42:04 +0200 Subject: [PATCH 096/120] Rename apple_bind_game_view_fbo to cocoagl_bind_game_view_fbo --- gfx/drivers/gl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 3eb3a1cbe5..4653c9e5d1 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -304,8 +304,8 @@ static void gl_disable_client_arrays(gl_t *gl) #ifdef IOS /* There is no default frame buffer on iOS. */ -void apple_bind_game_view_fbo(void); -#define gl_bind_backbuffer() apple_bind_game_view_fbo() +void cocoagl_bind_game_view_fbo(void); +#define gl_bind_backbuffer() cocoagl_bind_game_view_fbo() #else #define gl_bind_backbuffer() glBindFramebuffer(RARCH_GL_FRAMEBUFFER, 0) #endif From 8702141d906accf6cb3dd169fbd778d8667ae29b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 17:58:15 +0200 Subject: [PATCH 097/120] (Cocoa) Start renaming input_apple to input_cocoa --- apple/OSX/platform.m | 8 +- apple/OSX/settings.m | 8 +- apple/iOS/menu.m | 10 +- apple/iOS/platform.m | 10 +- config.def.h | 6 +- configuration.c | 4 +- griffin/griffin.c | 4 +- .../drivers/{apple_input.c => cocoa_input.c} | 100 +++++++++--------- .../drivers/{apple_input.h => cocoa_input.h} | 24 ++--- input/drivers_hid/apple_hid.c | 6 +- input/drivers_hid/mfi_hid.m | 6 +- input/drivers_keyboard/keyboard_event_apple.c | 8 +- input/input_driver.c | 5 +- input/input_driver.h | 2 +- 14 files changed, 100 insertions(+), 101 deletions(-) rename input/drivers/{apple_input.c => cocoa_input.c} (78%) rename input/drivers/{apple_input.h => cocoa_input.h} (75%) diff --git a/apple/OSX/platform.m b/apple/OSX/platform.m index b79992e563..7b91d37d85 100644 --- a/apple/OSX/platform.m +++ b/apple/OSX/platform.m @@ -17,7 +17,7 @@ #include #import "../common/RetroArch_Apple.h" -#include "../../input/drivers/apple_input.h" +#include "../../input/drivers/cocoa_input.h" #include "../../frontend/frontend.h" #include "../../menu/menu.h" #include "../../retroarch.h" @@ -42,11 +42,11 @@ void apple_rarch_exited(void) - (void)sendEvent:(NSEvent *)event { NSEventType event_type; - apple_input_data_t *apple = NULL; + cocoa_input_data_t *apple = NULL; driver_t *driver = driver_get_ptr(); [super sendEvent:event]; - apple = (apple_input_data_t*)driver->input_data; + apple = (cocoa_input_data_t*)driver->input_data; event_type = event.type; if (!apple) @@ -195,7 +195,7 @@ static void poll_iteration(void) { NSEvent *event = NULL; driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; if (!apple) return; diff --git a/apple/OSX/settings.m b/apple/OSX/settings.m index 6f6cd0ac0a..58e1975506 100644 --- a/apple/OSX/settings.m +++ b/apple/OSX/settings.m @@ -17,7 +17,7 @@ #import "../common/RetroArch_Apple.h" #include #include "../../settings.h" -#include "../../input/drivers/apple_input.h" +#include "../../input/drivers/cocoa_input.h" #include "../../driver.h" #include "../../input/input_common.h" @@ -76,11 +76,11 @@ static void* const associated_name_tag = (void*)&associated_name_tag; if (self.setting->index) idx = self.setting->index - 1; - if ((value = apple_input_find_any_key())) + if ((value = cocoa_input_find_any_key())) BINDFOR(*[self setting]).key = input_keymaps_translate_keysym_to_rk(value); - else if ((value = apple_input_find_any_button(idx)) >= 0) + else if ((value = cocoa_input_find_any_button(idx)) >= 0) BINDFOR(*[self setting]).joykey = value; - else if ((value = apple_input_find_any_axis(idx))) + else if ((value = cocoa_input_find_any_axis(idx))) BINDFOR(*[self setting]).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1); else return; diff --git a/apple/iOS/menu.m b/apple/iOS/menu.m index 74f5ec3197..48349224ae 100644 --- a/apple/iOS/menu.m +++ b/apple/iOS/menu.m @@ -17,7 +17,7 @@ #include "../common/RetroArch_Apple.h" #include "../../input/input_common.h" #include "../../input/input_keymaps.h" -#include "../../input/drivers/apple_input.h" +#include "../../input/drivers/cocoa_input.h" #include #include #include "menu.h" @@ -543,7 +543,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U [self.bindTimer invalidate]; self.bindTimer = nil; - apple_input_reset_icade_buttons(); + cocoa_input_reset_icade_buttons(); } - (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex @@ -566,11 +566,11 @@ static void RunActionSheet(const char* title, const struct string_list* items, U if (self.setting->index) idx = self.setting->index - 1; - if ((value = apple_input_find_any_key())) + if ((value = cocoa_input_find_any_key())) BINDFOR(*self.setting).key = input_keymaps_translate_keysym_to_rk(value); - else if ((value = apple_input_find_any_button(idx)) >= 0) + else if ((value = cocoa_input_find_any_button(idx)) >= 0) BINDFOR(*self.setting).joykey = value; - else if ((value = apple_input_find_any_axis(idx))) + else if ((value = cocoa_input_find_any_axis(idx))) BINDFOR(*self.setting).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1); else return; diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index 99ead1962f..e9a061f0e5 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -17,7 +17,7 @@ #include #include "../common/RetroArch_Apple.h" -#include "../../input/drivers/apple_input.h" +#include "../../input/drivers/cocoa_input.h" #include "../../settings.h" #ifdef HAVE_MFI #include "../../input/drivers_hid/mfi_hid.h" @@ -117,7 +117,7 @@ static void handle_touch_event(NSArray* touches) { unsigned i; driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; float scale = cocoagl_gfx_ctx_get_native_scale(); if (!apple) @@ -361,7 +361,7 @@ enum - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { - apple_input_reset_icade_buttons(); + cocoa_input_reset_icade_buttons(); [self setToolbarHidden:![[viewController toolbarItems] count] animated:YES]; // Workaround to keep frontend settings fresh @@ -444,8 +444,8 @@ enum is_icade = !(strcmp(apple_frontend_settings.bluetooth_mode, "icade")); is_btstack = !(strcmp(apple_frontend_settings.bluetooth_mode, "btstack")); - apple_input_enable_small_keyboard(small_keyboard); - apple_input_enable_icade(is_icade); + cocoa_input_enable_small_keyboard(small_keyboard); + cocoa_input_enable_icade(is_icade); btstack_set_poweron(is_btstack); } diff --git a/config.def.h b/config.def.h index 0fce8c2839..c6d6cc9a17 100644 --- a/config.def.h +++ b/config.def.h @@ -88,7 +88,7 @@ enum INPUT_XINPUT, INPUT_UDEV, INPUT_LINUXRAW, - INPUT_APPLE, + INPUT_COCOA, INPUT_QNX, INPUT_RWEBINPUT, INPUT_NULL, @@ -245,8 +245,8 @@ enum #define INPUT_DEFAULT_DRIVER INPUT_X #elif defined(HAVE_WAYLAND) #define INPUT_DEFAULT_DRIVER INPUT_WAYLAND -#elif defined(IOS) || defined(OSX) -#define INPUT_DEFAULT_DRIVER INPUT_APPLE +#elif defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) +#define INPUT_DEFAULT_DRIVER INPUT_COCOA #elif defined(__QNX__) #define INPUT_DEFAULT_DRIVER INPUT_QNX #elif defined(HAVE_SDL) diff --git a/configuration.c b/configuration.c index f62fb83af1..fa4bbd63e9 100644 --- a/configuration.c +++ b/configuration.c @@ -251,8 +251,8 @@ const char *config_get_default_input(void) return "linuxraw"; case INPUT_UDEV: return "udev"; - case INPUT_APPLE: - return "apple_input"; + case INPUT_COCOA: + return "cocoa"; case INPUT_QNX: return "qnx_input"; case INPUT_RWEBINPUT: diff --git a/griffin/griffin.c b/griffin/griffin.c index cfe5ee7d21..01fe51289a 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -317,8 +317,8 @@ INPUT #elif defined(ANDROID) #include "../input/drivers/android_input.c" #include "../input/drivers_joypad/android_joypad.c" -#elif defined(__APPLE__) -#include "../input/drivers/apple_input.c" +#elif defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) +#include "../input/drivers/cocoa_input.c" #elif defined(__QNX__) #include "../input/drivers/qnx_input.c" #include "../input/drivers_joypad/qnx_joypad.c" diff --git a/input/drivers/apple_input.c b/input/drivers/cocoa_input.c similarity index 78% rename from input/drivers/apple_input.c rename to input/drivers/cocoa_input.c index f405ced392..693d847e40 100644 --- a/input/drivers/apple_input.c +++ b/input/drivers/cocoa_input.c @@ -20,7 +20,7 @@ #include "../input_common.h" #include "../input_joypad.h" #include "../input_keymaps.h" -#include "apple_input.h" +#include "cocoainput.h" #include "../../general.h" #include "../../driver.h" @@ -125,18 +125,18 @@ const struct apple_key_name_map_entry apple_key_name_map[] = { "nul", 0x00}, }; -void apple_input_enable_small_keyboard(bool on) +void cocoa_input_enable_small_keyboard(bool on) { driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; if (apple) apple->small_keyboard_enabled = on; } -void apple_input_enable_icade(bool on) +void cocoa_input_enable_icade(bool on) { driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; if (!apple) return; @@ -145,20 +145,20 @@ void apple_input_enable_icade(bool on) apple->icade_buttons = 0; } -void apple_input_reset_icade_buttons(void) +void cocoa_input_reset_icade_buttons(void) { driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; if (apple) apple->icade_buttons = 0; } -int32_t apple_input_find_any_key(void) +int32_t cocoa_input_find_any_key(void) { unsigned i; driver_t *driver =driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; if (!apple) return 0; @@ -173,11 +173,11 @@ int32_t apple_input_find_any_key(void) return 0; } -int32_t apple_input_find_any_button(uint32_t port) +int32_t cocoa_input_find_any_button(uint32_t port) { unsigned i, buttons = 0; driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; if (!apple) return -1; @@ -197,11 +197,11 @@ int32_t apple_input_find_any_button(uint32_t port) return -1; } -int32_t apple_input_find_any_axis(uint32_t port) +int32_t cocoa_input_find_any_axis(uint32_t port) { int i; driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; if (apple && apple->joypad) apple->joypad->poll(); @@ -217,7 +217,7 @@ int32_t apple_input_find_any_axis(uint32_t port) return 0; } -static int16_t apple_input_is_pressed(apple_input_data_t *apple, unsigned port_num, +static int16_t cocoa_input_is_pressed(cocoa_input_data_t *apple, unsigned port_num, const struct retro_keybind *binds, unsigned id) { if (id < RARCH_BIND_LIST_END) @@ -229,10 +229,10 @@ static int16_t apple_input_is_pressed(apple_input_data_t *apple, unsigned port_n return 0; } -static void *apple_input_init(void) +static void *cocoa_input_init(void) { settings_t *settings = config_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)calloc(1, sizeof(*apple)); + cocoa_input_data_t *apple = (cocoa_input_data_t*)calloc(1, sizeof(*apple)); if (!apple) return NULL; @@ -243,10 +243,10 @@ static void *apple_input_init(void) return apple; } -static void apple_input_poll(void *data) +static void cocoa_input_poll(void *data) { uint32_t i; - apple_input_data_t *apple = (apple_input_data_t*)data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)data; if (!apple) return; @@ -267,7 +267,7 @@ static void apple_input_poll(void *data) BIT32_SET(apple->buttons[0], apple->icade_buttons); } -static int16_t apple_mouse_state(apple_input_data_t *apple, +static int16_t cocoa_mouse_state(cocoa_input_data_t *apple, unsigned id) { switch (id) @@ -289,7 +289,7 @@ static int16_t apple_mouse_state(apple_input_data_t *apple, return 0; } -static int16_t apple_pointer_state(apple_input_data_t *apple, +static int16_t cocoa_pointer_state(cocoa_input_data_t *apple, unsigned device, unsigned idx, unsigned id) { const bool want_full = (device == RARCH_DEVICE_POINTER_SCREEN); @@ -297,7 +297,7 @@ static int16_t apple_pointer_state(apple_input_data_t *apple, if (idx < apple->touch_count && (idx < MAX_TOUCHES)) { int16_t x, y; - const apple_touch_data_t *touch = (const apple_touch_data_t *) + const cocoa_touch_data_t *touch = (const cocoa_touch_data_t *) &apple->touches[idx]; if (!touch) @@ -326,17 +326,17 @@ static int16_t apple_pointer_state(apple_input_data_t *apple, return 0; } -static int16_t apple_keyboard_state(apple_input_data_t *apple, unsigned id) +static int16_t cocoa_keyboard_state(cocoa_input_data_t *apple, unsigned id) { unsigned bit = input_keymaps_translate_rk_to_keysym((enum retro_key)id); return (id < RETROK_LAST) && apple->key_state[bit]; } -static int16_t apple_input_state(void *data, +static int16_t cocoa_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned idx, unsigned id) { - apple_input_data_t *apple = (apple_input_data_t*)data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)data; if (!apple || !apple->joypad) return 0; @@ -344,36 +344,36 @@ static int16_t apple_input_state(void *data, switch (device) { case RETRO_DEVICE_JOYPAD: - return apple_input_is_pressed(apple, port, binds[port], id) || + return cocoa_input_is_pressed(apple, port, binds[port], id) || input_joypad_pressed(apple->joypad, port, binds[port], id); case RETRO_DEVICE_ANALOG: return input_joypad_analog(apple->joypad, port, idx, id, binds[port]); case RETRO_DEVICE_KEYBOARD: - return apple_keyboard_state(apple, id); + return cocoa_keyboard_state(apple, id); case RETRO_DEVICE_MOUSE: - return apple_mouse_state(apple, id); + return cocoa_mouse_state(apple, id); case RETRO_DEVICE_POINTER: case RARCH_DEVICE_POINTER_SCREEN: - return apple_pointer_state(apple, device, idx, id); + return cocoa_pointer_state(apple, device, idx, id); } return 0; } -static bool apple_input_bind_button_pressed(void *data, int key) +static bool cocoa_input_bind_button_pressed(void *data, int key) { - apple_input_data_t *apple = (apple_input_data_t*)data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)data; settings_t *settings = config_get_ptr(); if (apple && apple->joypad) - return apple_input_is_pressed(apple, 0, settings->input.binds[0], key) || + return cocoa_input_is_pressed(apple, 0, settings->input.binds[0], key) || input_joypad_pressed(apple->joypad, 0, settings->input.binds[0], key); return false; } -static void apple_input_free(void *data) +static void cocoa_input_free(void *data) { - apple_input_data_t *apple = (apple_input_data_t*)data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)data; if (!apple || !data) return; @@ -384,10 +384,10 @@ static void apple_input_free(void *data) free(apple); } -static bool apple_input_set_rumble(void *data, +static bool cocoa_input_set_rumble(void *data, unsigned port, enum retro_rumble_effect effect, uint16_t strength) { - apple_input_data_t *apple = (apple_input_data_t*)data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)data; if (apple && apple->joypad) return input_joypad_set_rumble(apple->joypad, @@ -395,7 +395,7 @@ static bool apple_input_set_rumble(void *data, return false; } -static uint64_t apple_input_get_capabilities(void *data) +static uint64_t cocoa_input_get_capabilities(void *data) { (void)data; @@ -407,33 +407,33 @@ static uint64_t apple_input_get_capabilities(void *data) (1 << RETRO_DEVICE_ANALOG); } -static void apple_input_grab_mouse(void *data, bool state) +static void cocoa_input_grab_mouse(void *data, bool state) { /* Dummy for now. Might be useful in the future. */ (void)data; (void)state; } -static const input_device_driver_t *apple_input_get_joypad_driver(void *data) +static const input_device_driver_t *cocoa_input_get_joypad_driver(void *data) { - apple_input_data_t *apple = (apple_input_data_t*)data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)data; if (apple && apple->joypad) return apple->joypad; return NULL; } -input_driver_t input_apple = { - apple_input_init, - apple_input_poll, - apple_input_state, - apple_input_bind_button_pressed, - apple_input_free, +input_driver_t input_cocoa = { + cocoa_input_init, + cocoa_input_poll, + cocoa_input_state, + cocoa_input_bind_button_pressed, + cocoa_input_free, NULL, NULL, - apple_input_get_capabilities, - "apple_input", - apple_input_grab_mouse, - apple_input_set_rumble, - apple_input_get_joypad_driver + cocoa_input_get_capabilities, + "cocoa", + cocoa_input_grab_mouse, + cocoa_input_set_rumble, + cocoa_input_get_joypad_driver }; diff --git a/input/drivers/apple_input.h b/input/drivers/cocoa_input.h similarity index 75% rename from input/drivers/apple_input.h rename to input/drivers/cocoa_input.h index 702cb99817..911dfd86c5 100644 --- a/input/drivers/apple_input.h +++ b/input/drivers/cocoa_input.h @@ -14,8 +14,8 @@ * If not, see . */ -#ifndef __APPLE_RARCH_INPUT_H__ -#define __APPLE_RARCH_INPUT_H__ +#ifndef __COCOA_INPUT_H__ +#define __COCOA_INPUT_H__ #include #include "../../general.h" @@ -33,11 +33,11 @@ typedef struct int16_t screen_x, screen_y; int16_t fixed_x, fixed_y; int16_t full_x, full_y; -} apple_touch_data_t; +} cocoa_touch_data_t; typedef struct { - apple_touch_data_t touches[MAX_TOUCHES]; + cocoa_touch_data_t touches[MAX_TOUCHES]; uint32_t touch_count; uint32_t mouse_buttons; @@ -58,21 +58,21 @@ typedef struct uint32_t icade_buttons; const input_device_driver_t *joypad; -} apple_input_data_t; +} cocoa_input_data_t; -void apple_input_enable_icade(bool on); +void cocoa_input_enable_icade(bool on); -void apple_input_enable_small_keyboard(bool on); +void cocoa_input_enable_small_keyboard(bool on); -void apple_input_reset_icade_buttons(void); +void cocoa_input_reset_icade_buttons(void); -void apple_input_keyboard_event(bool down, unsigned code, +void cocoa_input_keyboard_event(bool down, unsigned code, uint32_t character, uint32_t mod, unsigned device); -extern int32_t apple_input_find_any_key(void); +extern int32_t cocoa_input_find_any_key(void); -extern int32_t apple_input_find_any_button(uint32_t port); +extern int32_t cocoa_input_find_any_button(uint32_t port); -extern int32_t apple_input_find_any_axis(uint32_t port); +extern int32_t cocoa_input_find_any_axis(uint32_t port); #endif diff --git a/input/drivers_hid/apple_hid.c b/input/drivers_hid/apple_hid.c index 219ee8535c..6291b8f382 100644 --- a/input/drivers_hid/apple_hid.c +++ b/input/drivers_hid/apple_hid.c @@ -17,7 +17,7 @@ #include #include #include "../connect/joypad_connection.h" -#include "../drivers/apple_input.h" +#include "../drivers/cocoa_input.h" #include "../input_hid_driver.h" typedef struct apple_hid @@ -139,7 +139,7 @@ static void apple_hid_device_input_callback(void *data, IOReturn result, void* sender, IOHIDValueRef value) { driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; struct apple_hid_adapter *adapter = (struct apple_hid_adapter*)data; IOHIDElementRef element = IOHIDValueGetElement(value); uint32_t type = IOHIDElementGetType(element); @@ -210,7 +210,7 @@ static void apple_hid_device_input_callback(void *data, IOReturn result, static void apple_hid_device_remove(void *data, IOReturn result, void* sender) { driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; struct apple_hid_adapter *adapter = (struct apple_hid_adapter*)data; apple_hid_t *hid = driver ? (apple_hid_t*)driver->hid_data : NULL; diff --git a/input/drivers_hid/mfi_hid.m b/input/drivers_hid/mfi_hid.m index 94a8282e56..255b1eff7c 100644 --- a/input/drivers_hid/mfi_hid.m +++ b/input/drivers_hid/mfi_hid.m @@ -17,7 +17,7 @@ #import #include #include "mfi_hid.h" -#include "../../input/drivers/apple_input.h" +#include "../../input/drivers/cocoa_input.h" enum { @@ -44,7 +44,7 @@ static void apple_gamecontroller_poll(GCController *controller) { uint32_t slot, pause; driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; if (!apple || !controller || controller.playerIndex == MAX_USERS) return; @@ -105,7 +105,7 @@ void apple_gamecontroller_poll_all(void) static void apple_gamecontroller_register(GCGamepad *gamepad) { driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; gamepad.valueChangedHandler = ^(GCGamepad *updateGamepad, GCControllerElement *element) { apple_gamecontroller_poll(updateGamepad.controller); }; diff --git a/input/drivers_keyboard/keyboard_event_apple.c b/input/drivers_keyboard/keyboard_event_apple.c index f7e92aa2dd..4c37d8175b 100644 --- a/input/drivers_keyboard/keyboard_event_apple.c +++ b/input/drivers_keyboard/keyboard_event_apple.c @@ -19,7 +19,7 @@ #include "../input_common.h" #include "../input_keymaps.h" -#include "../drivers/apple_input.h" +#include "../drivers/cocoa_input.h" #include "../../general.h" #include "../../driver.h" @@ -70,7 +70,7 @@ static bool handle_small_keyboard(unsigned* code, bool down) { 0 } }; driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; unsigned translated_code = 0; if (!map_initialized) @@ -122,7 +122,7 @@ static void handle_icade_event(unsigned keycode) { false, 4 }, { true , 1 }, { false, -1 }, { false, -1 } // C }; driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; if (apple->icade_enabled && (keycode < 0x20) && (icade_map[keycode].button >= 0)) @@ -140,7 +140,7 @@ void apple_input_keyboard_event(bool down, unsigned code, uint32_t character, uint32_t mod, unsigned device) { driver_t *driver = driver_get_ptr(); - apple_input_data_t *apple = (apple_input_data_t*)driver->input_data; + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; if (!apple) return; diff --git a/input/input_driver.c b/input/input_driver.c index c5807204f1..bbc1882686 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -59,9 +59,8 @@ static const input_driver_t *input_drivers[] = { #if defined(__linux__) && !defined(ANDROID) &input_linuxraw, #endif -#if defined(IOS) || defined(OSX) - /* Don't use __APPLE__ as it breaks basic SDL builds */ - &input_apple, +#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) + &input_cocoa, #endif #ifdef __QNX__ &input_qnx, diff --git a/input/input_driver.h b/input/input_driver.h index f20478ae0a..374d158548 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -90,7 +90,7 @@ extern input_driver_t input_gx; extern input_driver_t input_xinput; extern input_driver_t input_linuxraw; extern input_driver_t input_udev; -extern input_driver_t input_apple; +extern input_driver_t input_cocoa; extern input_driver_t input_qnx; extern input_driver_t input_rwebinput; extern input_driver_t input_null; From 134289c4968d986e3eb306fad1da4f7f3d6a141c Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 19 Apr 2015 17:59:45 +0200 Subject: [PATCH 098/120] (Apple) Buildfixes --- input/drivers/cocoa_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/input/drivers/cocoa_input.c b/input/drivers/cocoa_input.c index 693d847e40..4a2c4cc1f7 100644 --- a/input/drivers/cocoa_input.c +++ b/input/drivers/cocoa_input.c @@ -20,7 +20,7 @@ #include "../input_common.h" #include "../input_joypad.h" #include "../input_keymaps.h" -#include "cocoainput.h" +#include "cocoa_input.h" #include "../../general.h" #include "../../driver.h" From ee7ce9659b956b276ddc4d53de2be82adf0f0baf Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 18:30:49 +0200 Subject: [PATCH 099/120] Create more features --- Makefile.common | 2 +- config.features.h | 18 ++++++++++++++++++ menu/menu_entries_cbs_deferred_push.c | 15 +++++++++++++++ retroarch.c | 2 ++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Makefile.common b/Makefile.common index 5db41bf3ab..9397a25df5 100644 --- a/Makefile.common +++ b/Makefile.common @@ -650,7 +650,7 @@ ifeq ($(HAVE_ZLIB), 1) OBJ += libretro-common/file/file_extract.o OBJ += $(ZLIB_OBJS) DEFINES += -DHAVE_ZLIB - #HAVE_RPNG = 1 + HAVE_RPNG = 1 HAVE_COMPRESSION = 1 ifeq ($(WANT_ZLIB), 1) DEFINES += -DWANT_ZLIB diff --git a/config.features.h b/config.features.h index 0677142006..ae262ff93b 100644 --- a/config.features.h +++ b/config.features.h @@ -260,6 +260,24 @@ static const bool _python_supp = true; static const bool _python_supp = false; #endif +#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH) +static const bool _cocoa_supp = true; +#else +static const bool _cocoa_supp = false; +#endif + +#ifdef HAVE_RPNG +static const bool _rpng_supp = true; +#else +static const bool _rpng_supp = false; +#endif + +#ifdef HAVE_CORETEXT +static const bool _coretext_supp = true; +#else +static const bool _coretext_supp = false; +#endif + #if !defined(_WIN32) && !defined(GLOBAL_CONFIG_DIR) #if defined(__HAIKU__) #define GLOBAL_CONFIG_DIR "/system/settings" diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index ea53a16814..d57123e59c 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -468,6 +468,16 @@ static int deferred_push_system_information(void *data, void *userdata, "Network Command interface support: %s", _network_command_supp ? "true" : "false"); menu_list_push(list, feat_str, "", MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "Cocoa support: %s", _cocoa_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + + snprintf(feat_str, sizeof(feat_str), + "PNG support (RPNG): %s", _rpng_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); snprintf(feat_str, sizeof(feat_str), "SDL1.2 support: %s", _sdl_supp ? "true" : "false"); @@ -630,6 +640,11 @@ static int deferred_push_system_information(void *data, void *userdata, menu_list_push(list, feat_str, "", MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(feat_str, sizeof(feat_str), + "CoreText support: %s", _coretext_supp ? "true" : "false"); + menu_list_push(list, feat_str, "", + MENU_SETTINGS_CORE_INFO_NONE, 0); + snprintf(feat_str, sizeof(feat_str), "FreeType support: %s", _freetype_supp ? "true" : "false"); menu_list_push(list, feat_str, "", diff --git a/retroarch.c b/retroarch.c index 49eca90f29..2930c6b308 100644 --- a/retroarch.c +++ b/retroarch.c @@ -129,9 +129,11 @@ static void print_features(void) _PSUPP(dynamic, "Dynamic", "Dynamic run-time loading of libretro library"); _PSUPP(ffmpeg, "FFmpeg", "On-the-fly recording of gameplay with libavcodec"); _PSUPP(freetype, "FreeType", "TTF font rendering with FreeType"); + _PSUPP(coretext, "CoreText", "TTF font rendering with Apple CoreText"); _PSUPP(netplay, "Netplay", "Peer-to-peer netplay"); _PSUPP(python, "Python", "Script support in shaders"); _PSUPP(libusb, "Libusb", "Libusb support"); + _PSUPP(cocoa, "Cocoa", "Cocoa UI companion support (for OSX and/or iOS)."); } #undef _PSUPP From 5105519d8d7438b345ba37b9e5c22b71f4b96f22 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 18:32:26 +0200 Subject: [PATCH 100/120] HAVE_ZLIB is now divorced from HAVE_RPNG --- retroarch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/retroarch.c b/retroarch.c index 2930c6b308..256a44021c 100644 --- a/retroarch.c +++ b/retroarch.c @@ -116,7 +116,8 @@ static void print_features(void) _PSUPP(dsound, "DirectSound", "audio driver"); _PSUPP(xaudio, "XAudio2", "audio driver"); _PSUPP(7zip, "7zip", "7zip support"); - _PSUPP(zlib, "zlib", "PNG encode/decode and .zip extraction"); + _PSUPP(zlib, "zlib", ".zip extraction"); + _PSUPP(rpng, "rpng", "PNG encode/decode"); _PSUPP(al, "OpenAL", "audio driver"); _PSUPP(sl, "OpenSL", "audio driver"); _PSUPP(dylib, "External", "External filter and plugin support"); From 79d57de207c2e2940643dd7d0a49cceaa7f6d064 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 18:41:11 +0200 Subject: [PATCH 101/120] Cleanups to 'features' --- config.features.h | 12 ++++++++++++ retroarch.c | 28 +++++++++++++++------------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/config.features.h b/config.features.h index ae262ff93b..3f9f5a4a10 100644 --- a/config.features.h +++ b/config.features.h @@ -116,6 +116,12 @@ static const bool _alsa_supp = true; static const bool _alsa_supp = false; #endif +#ifdef HAVE_COREAUDIO +static const bool _coreaudio_supp = true; +#else +static const bool _coreaudio_supp = false; +#endif + #if defined(HAVE_OSS) || defined(HAVE_OSS_BSD) static const bool _oss_supp = true; #else @@ -266,6 +272,12 @@ static const bool _cocoa_supp = true; static const bool _cocoa_supp = false; #endif +#ifdef HAVE_QT +static const bool _qt_supp = true; +#else +static const bool _qt_supp = false; +#endif + #ifdef HAVE_RPNG static const bool _rpng_supp = true; #else diff --git a/retroarch.c b/retroarch.c index 256a44021c..330559512b 100644 --- a/retroarch.c +++ b/retroarch.c @@ -95,18 +95,19 @@ static void print_features(void) _PSUPP(libretrodb, "LibretroDB", "LibretroDB support"); _PSUPP(command, "Command", "Command interface support"); _PSUPP(network_command, "Network Command", "Network Command interface support"); - _PSUPP(sdl, "SDL", "SDL drivers"); - _PSUPP(sdl2, "SDL2", "SDL2 drivers"); - _PSUPP(x11, "X11", "X11 drivers"); - _PSUPP(wayland, "wayland", "Wayland drivers"); + _PSUPP(sdl, "SDL", "SDL input/audio/video drivers"); + _PSUPP(sdl2, "SDL2", "SDL2 input/audio/video drivers"); + _PSUPP(x11, "X11", "X11 input/video drivers"); + _PSUPP(wayland, "wayland", "Wayland input/video drivers"); _PSUPP(thread, "Threads", "Threading support"); _PSUPP(opengl, "OpenGL", "OpenGL driver"); _PSUPP(opengles, "OpenGL ES", "OpenGL ES driver"); - _PSUPP(kms, "KMS", "KMS/EGL context support"); + _PSUPP(xvideo, "XVideo", "XVideo video driver"); _PSUPP(udev, "UDEV", "UDEV/EVDEV input driver support"); - _PSUPP(egl, "EGL", "EGL context support"); - _PSUPP(vg, "OpenVG", "OpenVG output support"); - _PSUPP(xvideo, "XVideo", "XVideo output"); + _PSUPP(egl, "EGL", "context driver"); + _PSUPP(kms, "KMS", "context driver"); + _PSUPP(vg, "OpenVG", "context driver"); + _PSUPP(coreaudio, "CoreAudio", "audio driver"); _PSUPP(alsa, "ALSA", "audio driver"); _PSUPP(oss, "OSS", "audio driver"); _PSUPP(jack, "Jack", "audio driver"); @@ -115,26 +116,27 @@ static void print_features(void) _PSUPP(pulse, "PulseAudio", "audio driver"); _PSUPP(dsound, "DirectSound", "audio driver"); _PSUPP(xaudio, "XAudio2", "audio driver"); - _PSUPP(7zip, "7zip", "7zip support"); - _PSUPP(zlib, "zlib", ".zip extraction"); - _PSUPP(rpng, "rpng", "PNG encode/decode"); _PSUPP(al, "OpenAL", "audio driver"); _PSUPP(sl, "OpenSL", "audio driver"); + _PSUPP(7zip, "7zip", "7zip support"); + _PSUPP(zlib, "zlib", ".zip extraction"); _PSUPP(dylib, "External", "External filter and plugin support"); _PSUPP(cg, "Cg", "Cg pixel shaders"); _PSUPP(glsl, "GLSL", "GLSL pixel shaders"); _PSUPP(glsl, "HLSL", "HLSL pixel shaders"); _PSUPP(libxml2, "libxml2", "libxml2 XML parsing"); _PSUPP(sdl_image, "SDL_image", "SDL_image image loading"); + _PSUPP(rpng, "rpng", "PNG image loading/encoding"); _PSUPP(fbo, "FBO", "OpenGL render-to-texture (multi-pass shaders)"); _PSUPP(dynamic, "Dynamic", "Dynamic run-time loading of libretro library"); _PSUPP(ffmpeg, "FFmpeg", "On-the-fly recording of gameplay with libavcodec"); _PSUPP(freetype, "FreeType", "TTF font rendering with FreeType"); - _PSUPP(coretext, "CoreText", "TTF font rendering with Apple CoreText"); + _PSUPP(coretext, "CoreText", "TTF font rendering (for OSX and/or iOS)"); _PSUPP(netplay, "Netplay", "Peer-to-peer netplay"); _PSUPP(python, "Python", "Script support in shaders"); _PSUPP(libusb, "Libusb", "Libusb support"); - _PSUPP(cocoa, "Cocoa", "Cocoa UI companion support (for OSX and/or iOS)."); + _PSUPP(cocoa, "Cocoa", "Cocoa UI companion support (for OSX and/or iOS)"); + _PSUPP(qt, "QT", "QT UI companion support"); } #undef _PSUPP From 455005454cc21fc8339e9dc72f9e060923cbbb4f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 18:44:28 +0200 Subject: [PATCH 102/120] Cleanup some feature descriptors --- retroarch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/retroarch.c b/retroarch.c index 330559512b..d2dbe663e2 100644 --- a/retroarch.c +++ b/retroarch.c @@ -104,9 +104,9 @@ static void print_features(void) _PSUPP(opengles, "OpenGL ES", "OpenGL ES driver"); _PSUPP(xvideo, "XVideo", "XVideo video driver"); _PSUPP(udev, "UDEV", "UDEV/EVDEV input driver support"); - _PSUPP(egl, "EGL", "context driver"); - _PSUPP(kms, "KMS", "context driver"); - _PSUPP(vg, "OpenVG", "context driver"); + _PSUPP(egl, "EGL", "video context driver"); + _PSUPP(kms, "KMS", "video context driver"); + _PSUPP(vg, "OpenVG", "video context driver"); _PSUPP(coreaudio, "CoreAudio", "audio driver"); _PSUPP(alsa, "ALSA", "audio driver"); _PSUPP(oss, "OSS", "audio driver"); From 1cb9f651ab6d6a0cbd386e5599eada4152cf2a4a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 18:45:29 +0200 Subject: [PATCH 103/120] zlib_extract_core_callback - compile it in only when HAVE_ZLIB is defined --- menu/menu_entries_cbs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/menu/menu_entries_cbs.c b/menu/menu_entries_cbs.c index 69a174ce9c..2a76d12d65 100644 --- a/menu/menu_entries_cbs.c +++ b/menu/menu_entries_cbs.c @@ -44,6 +44,7 @@ void menu_entries_common_load_content(bool persist) * function pointer callback functions that don't necessarily * call each other. */ +#ifdef HAVE_ZLIB static int zlib_extract_core_callback(const char *name, const char *valid_exts, const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size, uint32_t crc32, void *userdata) @@ -85,6 +86,7 @@ error: RARCH_ERR("Failed to deflate to: %s.\n", path); return 0; } +#endif int cb_core_updater_download(void *data, size_t len) { From 1739259ddee7bb2babb2a2abe27d1c845754668c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 18:46:53 +0200 Subject: [PATCH 104/120] Remove shader_manager_get_current_shader - no longer used --- menu/menu_entries_cbs_iterate.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/menu/menu_entries_cbs_iterate.c b/menu/menu_entries_cbs_iterate.c index 2bce56e227..f7e9995a57 100644 --- a/menu/menu_entries_cbs_iterate.c +++ b/menu/menu_entries_cbs_iterate.c @@ -137,19 +137,6 @@ static int load_or_open_zip_iterate(unsigned action) return 0; } -static INLINE struct video_shader *shader_manager_get_current_shader(const char *label, unsigned type) -{ - menu_handle_t *menu = menu_driver_get_ptr(); - if (!menu) - return NULL; - - if (!strcmp(label, "video_shader_preset_parameters")) - return menu->shader; - else if (!strcmp(label, "video_shader_parameters")) - return video_shader_driver_get_current_shader(); - return NULL; -} - static int action_iterate_help(const char *label, unsigned action) { unsigned i; From 79280258c7c849cb595bf99dad6f7eba244c5dd5 Mon Sep 17 00:00:00 2001 From: Alcaro Date: Sun, 19 Apr 2015 18:58:27 +0200 Subject: [PATCH 105/120] (D3D) Do use new/delete --- gfx/d3d/d3d.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 60dea99791..24e515f7f4 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -759,7 +759,7 @@ static void *d3d_init(const video_info_t *info, } #endif - vid = (d3d_video_t*)calloc(1, sizeof(*vid)); + vid = new d3d_video_t(); if (!vid) goto error; @@ -800,7 +800,7 @@ static void *d3d_init(const video_info_t *info, error: if (vid) - free(vid); + delete vid; if (driver) driver->video_context = NULL; return NULL; @@ -839,7 +839,7 @@ static void d3d_free(void *data) #endif if (d3d) - free(d3d); + delete d3d; #ifndef _XBOX UnregisterClass("RetroArch", GetModuleHandle(NULL)); From 0ecdceb74480af898d89d71163514f0fac05cc10 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 19:02:56 +0200 Subject: [PATCH 106/120] Always compile in video_context_driver.c and null stub context driver --- Makefile.common | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.common b/Makefile.common index 9397a25df5..5f81c8618c 100644 --- a/Makefile.common +++ b/Makefile.common @@ -437,14 +437,15 @@ ifeq ($(HAVE_PARPORT), 1) OBJ += input/drivers_joypad/parport_joypad.o endif +OBJ += gfx/video_context_driver.o \ + gfx/drivers_context/gfx_null_ctx.o + # Video # ifeq ($(HAVE_OPENGL), 1) DEFINES += -DHAVE_OPENGL -DHAVE_GLSL OBJ += gfx/drivers/gl.o \ gfx/drivers/gl_common.o \ - gfx/video_context_driver.o \ - gfx/drivers_context/gfx_null_ctx.o \ gfx/drivers_font/gl_raster_font.o \ libretro-common/gfx/math/matrix_4x4.o \ gfx/video_state_tracker.o \ From 3c569cdda2ab00fa6790d9cc0c6f35e0b4d5404f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 19:50:29 +0200 Subject: [PATCH 107/120] (Apple) Combine some header files --- apple/OSX/platform.h | 57 -------------------------- apple/OSX/platform.m | 2 - apple/common/RetroArch_Apple.h | 74 +++++++++++++++++++++++++++++++++- apple/iOS/platform.h | 54 ------------------------- apple/iOS/platform.m | 1 - 5 files changed, 72 insertions(+), 116 deletions(-) delete mode 100644 apple/OSX/platform.h delete mode 100644 apple/iOS/platform.h diff --git a/apple/OSX/platform.h b/apple/OSX/platform.h deleted file mode 100644 index 3b98b3fc90..0000000000 --- a/apple/OSX/platform.h +++ /dev/null @@ -1,57 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2015 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef __RARCH_OSX_PLATFORM_H -#define __RARCH_OSX_PLATFORM_H - -#include -#ifdef HAVE_LOCATION -#include -#endif - -#include "../common/CFExtensions.h" - -@interface RAGameView : NSView -#ifdef HAVE_LOCATION - -#endif - -+ (RAGameView*)get; -#ifndef OSX -- (void)display; -#endif - -@end - -@interface RetroArch_OSX : NSObject -{ - NSWindow* _window; - NSWindowController* _settingsWindow; - NSWindow* _coreSelectSheet; - NSString* _file; - NSString* _core; -} - -@property (nonatomic, retain) NSWindow IBOutlet* window; - -+ (RetroArch_OSX*)get; - -- (void)loadingCore:(NSString*)core withFile:(const char*)file; -- (void)unloadingCore; - -@end - -#endif diff --git a/apple/OSX/platform.m b/apple/OSX/platform.m index 7b91d37d85..d8a91fc3ca 100644 --- a/apple/OSX/platform.m +++ b/apple/OSX/platform.m @@ -353,7 +353,6 @@ static void poll_iteration(void) event_command(EVENT_CMD_QUIT); } -#pragma mark RetroArch_Platform - (void)loadingCore:(const NSString*)core withFile:(const char*)file { if (file) @@ -365,7 +364,6 @@ static void poll_iteration(void) [[NSApplication sharedApplication] terminate:nil]; } -#pragma mark Menus - (IBAction)showCoresDirectory:(id)sender { settings_t *settings = config_get_ptr(); diff --git a/apple/common/RetroArch_Apple.h b/apple/common/RetroArch_Apple.h index c22f41f8e9..ca972d0635 100644 --- a/apple/common/RetroArch_Apple.h +++ b/apple/common/RetroArch_Apple.h @@ -30,9 +30,79 @@ #ifdef IOS #include -#import "../iOS/platform.h" + +#include +#import +#include "views.h" + +typedef struct +{ + char orientations[32]; + unsigned orientation_flags; + char bluetooth_mode[64]; +} apple_frontend_settings_t; +extern apple_frontend_settings_t apple_frontend_settings; + +@interface RAGameView : UIViewController ++ (RAGameView*)get; +@end + +@interface RetroArch_iOS : UINavigationController + +@property (nonatomic) UIWindow* window; +@property (nonatomic) NSString* documentsDirectory; // e.g. /var/mobile/Documents + ++ (RetroArch_iOS*)get; + +- (void)showGameView; +- (void)toggleUI; + +- (void)loadingCore:(NSString*)core withFile:(const char*)file; +- (void)unloadingCore; + +- (void)refreshSystemConfig; +@end + +void get_ios_version(int *major, int *minor); + #elif defined(OSX) -#import "../OSX/platform.h" +#include +#ifdef HAVE_LOCATION +#include +#endif + +#include "../common/CFExtensions.h" + +@interface RAGameView : NSView +#ifdef HAVE_LOCATION + +#endif + ++ (RAGameView*)get; +#ifndef OSX +- (void)display; +#endif + +@end + +@interface RetroArch_OSX : NSObject +{ + NSWindow* _window; + NSWindowController* _settingsWindow; + NSWindow* _coreSelectSheet; + NSString* _file; + NSString* _core; +} + +@property (nonatomic, retain) NSWindow IBOutlet* window; + ++ (RetroArch_OSX*)get; + +- (void)loadingCore:(NSString*)core withFile:(const char*)file; +- (void)unloadingCore; + +@end + #endif extern id apple_platform; diff --git a/apple/iOS/platform.h b/apple/iOS/platform.h deleted file mode 100644 index c8f167a48a..0000000000 --- a/apple/iOS/platform.h +++ /dev/null @@ -1,54 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2015 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef __RARCH_IOS_PLATFORM_H -#define __RARCH_IOS_PLATFORM_H - -#include -#import -#include "views.h" - -typedef struct -{ - char orientations[32]; - unsigned orientation_flags; - char bluetooth_mode[64]; -} apple_frontend_settings_t; -extern apple_frontend_settings_t apple_frontend_settings; - -@interface RAGameView : UIViewController -+ (RAGameView*)get; -@end - -@interface RetroArch_iOS : UINavigationController - -@property (nonatomic) UIWindow* window; -@property (nonatomic) NSString* documentsDirectory; // e.g. /var/mobile/Documents - -+ (RetroArch_iOS*)get; - -- (void)showGameView; -- (void)toggleUI; - -- (void)loadingCore:(NSString*)core withFile:(const char*)file; -- (void)unloadingCore; - -- (void)refreshSystemConfig; -@end - -void get_ios_version(int *major, int *minor); - -#endif diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index e9a061f0e5..dfd50eab33 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -364,7 +364,6 @@ enum cocoa_input_reset_icade_buttons(); [self setToolbarHidden:![[viewController toolbarItems] count] animated:YES]; - // Workaround to keep frontend settings fresh [self refreshSystemConfig]; } From 1f5ede2c480df50d6f551e125cc663c769d9e92b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 19:54:28 +0200 Subject: [PATCH 108/120] Cleanup OSX/platform.m --- apple/OSX/platform.m | 9 --------- 1 file changed, 9 deletions(-) diff --git a/apple/OSX/platform.m b/apple/OSX/platform.m index d8a91fc3ca..9b42fd38fa 100644 --- a/apple/OSX/platform.m +++ b/apple/OSX/platform.m @@ -24,7 +24,6 @@ #include -static void* const associated_core_key = (void*)&associated_core_key; id apple_platform; void apple_rarch_exited(void); @@ -335,14 +334,6 @@ static void poll_iteration(void) if (global && global->system.shutdown) return; - /* TODO - rewrite this. */ - - cb = (NSComboBox*)[[self.coreSelectSheet contentView] viewWithTag:1]; -#if defined(MAC_OS_X_VERSION_10_6) - /* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */ - self.core = objc_getAssociatedObject(cb.objectValueOfSelectedItem, associated_core_key); -#endif - if (global && !global->main_is_init) { /* TODO/FIXME: Set core/content here. */ From eba518f50a7038ddbde3245697568ad37b14ccef Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 19 Apr 2015 19:55:41 +0200 Subject: [PATCH 109/120] Remove unused NSComboBox variable --- apple/OSX/platform.m | 1 - 1 file changed, 1 deletion(-) diff --git a/apple/OSX/platform.m b/apple/OSX/platform.m index 9b42fd38fa..3319f1a0b1 100644 --- a/apple/OSX/platform.m +++ b/apple/OSX/platform.m @@ -324,7 +324,6 @@ static void poll_iteration(void) - (IBAction)coreWasChosen:(id)sender { - NSComboBox* cb = NULL; global_t *global = global_get_ptr(); [[NSApplication sharedApplication] stopModal]; From c58355775c9bd979b5952e7f857e6188237f699a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 20:02:00 +0200 Subject: [PATCH 110/120] Rename apple_input_keyboard_event to cocoa_input_keyboard_event --- apple/OSX/platform.m | 6 +++--- apple/iOS/platform.m | 8 ++++---- input/drivers_keyboard/keyboard_event_apple.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apple/OSX/platform.m b/apple/OSX/platform.m index 3319f1a0b1..36b6a9f87d 100644 --- a/apple/OSX/platform.m +++ b/apple/OSX/platform.m @@ -79,11 +79,11 @@ void apple_rarch_exited(void) mod |= RETROKMOD_NUMLOCK; for (i = 1; i < ch.length; i++) - apple_input_keyboard_event(event_type == NSKeyDown, + cocoa_input_keyboard_event(event_type == NSKeyDown, 0, [ch characterAtIndex:i], mod, RETRO_DEVICE_KEYBOARD); } - apple_input_keyboard_event(event_type == NSKeyDown, + cocoa_input_keyboard_event(event_type == NSKeyDown, event.keyCode, character, mod, RETRO_DEVICE_KEYBOARD); } break; @@ -94,7 +94,7 @@ void apple_rarch_exited(void) bool down = (new_flags & old_flags) == old_flags; old_flags = new_flags; - apple_input_keyboard_event(down, event.keyCode, + cocoa_input_keyboard_event(down, event.keyCode, 0, event.modifierFlags, RETRO_DEVICE_KEYBOARD); } break; diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index dfd50eab33..12694c504f 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -209,17 +209,17 @@ enum unsigned i; character = [ch characterAtIndex:0]; - apple_input_keyboard_event(event._isKeyDown, + cocoa_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, 0, mod, RETRO_DEVICE_KEYBOARD); for (i = 1; i < ch.length; i++) - apple_input_keyboard_event(event._isKeyDown, + cocoa_input_keyboard_event(event._isKeyDown, 0, [ch characterAtIndex:i], mod, RETRO_DEVICE_KEYBOARD); } - apple_input_keyboard_event(event._isKeyDown, + cocoa_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, character, mod, RETRO_DEVICE_KEYBOARD); } @@ -254,7 +254,7 @@ enum { case GSEVENT_TYPE_KEYDOWN: case GSEVENT_TYPE_KEYUP: - apple_input_keyboard_event(eventType == GSEVENT_TYPE_KEYDOWN, + cocoa_input_keyboard_event(eventType == GSEVENT_TYPE_KEYDOWN, *(uint16_t*)&eventMem[0x3C], 0, 0, RETRO_DEVICE_KEYBOARD); break; } diff --git a/input/drivers_keyboard/keyboard_event_apple.c b/input/drivers_keyboard/keyboard_event_apple.c index 4c37d8175b..15607acf45 100644 --- a/input/drivers_keyboard/keyboard_event_apple.c +++ b/input/drivers_keyboard/keyboard_event_apple.c @@ -136,7 +136,7 @@ static void handle_icade_event(unsigned keycode) } } -void apple_input_keyboard_event(bool down, +void cocoa_input_keyboard_event(bool down, unsigned code, uint32_t character, uint32_t mod, unsigned device) { driver_t *driver = driver_get_ptr(); From b3a0a470d033cb74df5ef679a9e3179502b8e942 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 20:06:25 +0200 Subject: [PATCH 111/120] (iOS) Cut down on header includes --- apple/iOS/browser.m | 4 +--- apple/iOS/menu.h | 1 - apple/iOS/platform.m | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/apple/iOS/browser.m b/apple/iOS/browser.m index 208aad2383..ec3cf7b840 100644 --- a/apple/iOS/browser.m +++ b/apple/iOS/browser.m @@ -16,9 +16,7 @@ #include -#import "../common/RetroArch_Apple.h" -#import "views.h" - +#include "../common/RetroArch_Apple.h" #include "../../content.h" #include "../../general.h" #include diff --git a/apple/iOS/menu.h b/apple/iOS/menu.h index c1286b8326..83b3a0606c 100644 --- a/apple/iOS/menu.h +++ b/apple/iOS/menu.h @@ -18,7 +18,6 @@ #define __APPLE_RARCH_IOS_MENU_H__ #include "../../playlist.h" -#include "views.h" #include "../../settings.h" @protocol RAMenuItemBase diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index 12694c504f..c5f2619fc8 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -25,7 +25,6 @@ #include "menu.h" #include "../../menu/menu.h" -#import "views.h" #include "../../input/drivers_hid/btstack_hid.h" id apple_platform; From 499b00d1128dd40fae8f4ef33c0237559ff8db41 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 19 Apr 2015 20:07:04 +0200 Subject: [PATCH 112/120] (iOS) Buildfix --- apple/common/RetroArch_Apple.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apple/common/RetroArch_Apple.h b/apple/common/RetroArch_Apple.h index ca972d0635..e80e635fa9 100644 --- a/apple/common/RetroArch_Apple.h +++ b/apple/common/RetroArch_Apple.h @@ -33,7 +33,7 @@ #include #import -#include "views.h" +#include "../iOS/views.h" typedef struct { From 9d731f94ec952bf79a982ef17ef7402b7df440d5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 20:09:17 +0200 Subject: [PATCH 113/120] Include CFExtensions.h in one common file --- apple/common/RetroArch_Apple.h | 2 +- apple/common/apple_cocoa_common.m | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/apple/common/RetroArch_Apple.h b/apple/common/RetroArch_Apple.h index e80e635fa9..ca75bc3460 100644 --- a/apple/common/RetroArch_Apple.h +++ b/apple/common/RetroArch_Apple.h @@ -20,6 +20,7 @@ #include #import +#include "../common/CFExtensions.h" #include "../../core_info.h" #include "../../settings.h" @@ -71,7 +72,6 @@ void get_ios_version(int *major, int *minor); #include #endif -#include "../common/CFExtensions.h" @interface RAGameView : NSView #ifdef HAVE_LOCATION diff --git a/apple/common/apple_cocoa_common.m b/apple/common/apple_cocoa_common.m index 0ea57dd7ec..227825010f 100644 --- a/apple/common/apple_cocoa_common.m +++ b/apple/common/apple_cocoa_common.m @@ -19,7 +19,6 @@ #include #include #import -#include "CFExtensions.h" #import "RetroArch_Apple.h" #include "../../general.h" #include "../../runloop.h" From 0a7e6959886646ef87425ee544e59dab4eed8178 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 20:14:39 +0200 Subject: [PATCH 114/120] Remove CFExtensions.h - include it in RetroArch_Apple.h --- apple/common/CFExtensions.h | 68 ---------------------------------- apple/common/RetroArch_Apple.h | 49 +++++++++++++++++++++++- 2 files changed, 48 insertions(+), 69 deletions(-) delete mode 100644 apple/common/CFExtensions.h diff --git a/apple/common/CFExtensions.h b/apple/common/CFExtensions.h deleted file mode 100644 index e75e3e9f8b..0000000000 --- a/apple/common/CFExtensions.h +++ /dev/null @@ -1,68 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2015 - Daniel De Matteis - * Copyright (C) 2014-2015 - Jay McCarthy - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef _CFEXTENSIONS_H -#define _CFEXTENSIONS_H - -#include - -typedef enum -{ - CFApplicationDirectory = 1, // supported applications (Applications) - CFDemoApplicationDirectory, // unsupported applications, demonstration versions (Demos) - CFDeveloperApplicationDirectory, // developer applications (Developer/Applications). DEPRECATED - there is no one single Developer directory. - CFAdminApplicationDirectory, // system and network administration applications (Administration) - CFLibraryDirectory, // various documentation, support, and configuration files, resources (Library) - CFDeveloperDirectory, // developer resources (Developer) DEPRECATED - there is no one single Developer directory. - CFUserDirectory, // user home directories (Users) - CFDocumentationDirectory, // documentation (Documentation) - CFDocumentDirectory, // documents (Documents) - CFCoreServiceDirectory, // location of CoreServices directory (System/Library/CoreServices) - CFAutosavedInformationDirectory = 11, // location of autosaved documents (Documents/Autosaved) - CFDesktopDirectory = 12, // location of user's desktop - CFCachesDirectory = 13, // location of discardable cache files (Library/Caches) - CFApplicationSupportDirectory = 14, // location of application support files (plug-ins, etc) (Library/Application Support) - CFDownloadsDirectory = 15, // location of the user's "Downloads" directory - CFInputMethodsDirectory = 16, // input methods (Library/Input Methods) - CFMoviesDirectory = 17, // location of user's Movies directory (~/Movies) - CFMusicDirectory = 18, // location of user's Music directory (~/Music) - CFPicturesDirectory = 19, // location of user's Pictures directory (~/Pictures) - CFPrinterDescriptionDirectory = 20, // location of system's PPDs directory (Library/Printers/PPDs) - CFSharedPublicDirectory = 21, // location of user's Public sharing directory (~/Public) - CFPreferencePanesDirectory = 22, // location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes) - CFApplicationScriptsDirectory = 23, // location of the user scripts folder for the calling application (~/Library/Application Scripts/code-signing-id) - CFItemReplacementDirectory = 99, // For use with NSFileManager's URLForDirectory:inDomain:appropriateForURL:create:error: - CFAllApplicationsDirectory = 100, // all directories where applications can occur - CFAllLibrariesDirectory = 101, // all directories where resources can occur - CFTrashDirectory = 102 // location of Trash directory - -} CFSearchPathDirectory; - -typedef enum -{ - CFUserDomainMask = 1, // user's home directory --- place to install user's personal items (~) - CFLocalDomainMask = 2, // local to the current machine --- place to install items available to everyone on this machine (/Library) - CFNetworkDomainMask = 4, // publically available location in the local area network --- place to install items available on the network (/Network) - CFSystemDomainMask = 8, // provided by Apple, unmodifiable (/System) - CFAllDomainsMask = 0x0ffff // all domains: all of the above and future items -} CFDomainMask; - -void CFSearchPathForDirectoriesInDomains(unsigned flags, - unsigned domain_mask, unsigned expand_tilde, char *buf, size_t sizeof_buf); - -void CFTemporaryDirectory(char *buf, size_t sizeof_buf); - -#endif diff --git a/apple/common/RetroArch_Apple.h b/apple/common/RetroArch_Apple.h index ca75bc3460..3af736e912 100644 --- a/apple/common/RetroArch_Apple.h +++ b/apple/common/RetroArch_Apple.h @@ -20,7 +20,54 @@ #include #import -#include "../common/CFExtensions.h" +#include + +typedef enum +{ + CFApplicationDirectory = 1, // supported applications (Applications) + CFDemoApplicationDirectory, // unsupported applications, demonstration versions (Demos) + CFDeveloperApplicationDirectory, // developer applications (Developer/Applications). DEPRECATED - there is no one single Developer directory. + CFAdminApplicationDirectory, // system and network administration applications (Administration) + CFLibraryDirectory, // various documentation, support, and configuration files, resources (Library) + CFDeveloperDirectory, // developer resources (Developer) DEPRECATED - there is no one single Developer directory. + CFUserDirectory, // user home directories (Users) + CFDocumentationDirectory, // documentation (Documentation) + CFDocumentDirectory, // documents (Documents) + CFCoreServiceDirectory, // location of CoreServices directory (System/Library/CoreServices) + CFAutosavedInformationDirectory = 11, // location of autosaved documents (Documents/Autosaved) + CFDesktopDirectory = 12, // location of user's desktop + CFCachesDirectory = 13, // location of discardable cache files (Library/Caches) + CFApplicationSupportDirectory = 14, // location of application support files (plug-ins, etc) (Library/Application Support) + CFDownloadsDirectory = 15, // location of the user's "Downloads" directory + CFInputMethodsDirectory = 16, // input methods (Library/Input Methods) + CFMoviesDirectory = 17, // location of user's Movies directory (~/Movies) + CFMusicDirectory = 18, // location of user's Music directory (~/Music) + CFPicturesDirectory = 19, // location of user's Pictures directory (~/Pictures) + CFPrinterDescriptionDirectory = 20, // location of system's PPDs directory (Library/Printers/PPDs) + CFSharedPublicDirectory = 21, // location of user's Public sharing directory (~/Public) + CFPreferencePanesDirectory = 22, // location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes) + CFApplicationScriptsDirectory = 23, // location of the user scripts folder for the calling application (~/Library/Application Scripts/code-signing-id) + CFItemReplacementDirectory = 99, // For use with NSFileManager's URLForDirectory:inDomain:appropriateForURL:create:error: + CFAllApplicationsDirectory = 100, // all directories where applications can occur + CFAllLibrariesDirectory = 101, // all directories where resources can occur + CFTrashDirectory = 102 // location of Trash directory + +} CFSearchPathDirectory; + +typedef enum +{ + CFUserDomainMask = 1, // user's home directory --- place to install user's personal items (~) + CFLocalDomainMask = 2, // local to the current machine --- place to install items available to everyone on this machine (/Library) + CFNetworkDomainMask = 4, // publically available location in the local area network --- place to install items available on the network (/Network) + CFSystemDomainMask = 8, // provided by Apple, unmodifiable (/System) + CFAllDomainsMask = 0x0ffff // all domains: all of the above and future items +} CFDomainMask; + +void CFSearchPathForDirectoriesInDomains(unsigned flags, + unsigned domain_mask, unsigned expand_tilde, char *buf, size_t sizeof_buf); + +void CFTemporaryDirectory(char *buf, size_t sizeof_buf); + #include "../../core_info.h" #include "../../settings.h" From c56d3cf2e427da84ac87383a4d6fbce710b9d6b3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 20:18:03 +0200 Subject: [PATCH 115/120] (Apple) Cleanup header includes --- apple/OSX/platform.m | 1 - apple/common/RetroArch_Apple.h | 27 +++++++++++++++++- apple/iOS/menu.m | 2 -- apple/iOS/platform.m | 2 -- apple/iOS/views.h | 51 ---------------------------------- 5 files changed, 26 insertions(+), 57 deletions(-) delete mode 100644 apple/iOS/views.h diff --git a/apple/OSX/platform.m b/apple/OSX/platform.m index 36b6a9f87d..87c8281a86 100644 --- a/apple/OSX/platform.m +++ b/apple/OSX/platform.m @@ -19,7 +19,6 @@ #import "../common/RetroArch_Apple.h" #include "../../input/drivers/cocoa_input.h" #include "../../frontend/frontend.h" -#include "../../menu/menu.h" #include "../../retroarch.h" #include diff --git a/apple/common/RetroArch_Apple.h b/apple/common/RetroArch_Apple.h index 3af736e912..1b2d44cd37 100644 --- a/apple/common/RetroArch_Apple.h +++ b/apple/common/RetroArch_Apple.h @@ -70,6 +70,7 @@ void CFTemporaryDirectory(char *buf, size_t sizeof_buf); #include "../../core_info.h" #include "../../settings.h" +#include "../../menu/menu.h" @protocol RetroArch_Platform - (void)loadingCore:(NSString*)core withFile:(const char*)file; @@ -81,7 +82,31 @@ void CFTemporaryDirectory(char *buf, size_t sizeof_buf); #include #import -#include "../iOS/views.h" +#include "../iOS/menu.h" + +@interface RADirectoryItem : NSObject +@property (nonatomic) NSString* path; +@property (nonatomic) bool isDirectory; +@end + +@interface RADirectoryList : RAMenuBase +@property (nonatomic, weak) RADirectoryItem* selectedItem; + +@property (nonatomic, copy) void (^chooseAction)(RADirectoryList* list, RADirectoryItem* item); +@property (nonatomic, copy) NSString* path; +@property (nonatomic, copy) NSString* extensions; + +@property (nonatomic) bool allowBlank; +@property (nonatomic) bool forDirectory; + +- (id)initWithPath:(NSString*)path extensions:(const char*)extensions action:(void (^)(RADirectoryList* list, RADirectoryItem* item))action; +- (void)browseTo:(NSString*)path; +@end + +// browser.m +@interface RAFoldersList : RAMenuBase +- (id) initWithFilePath:(NSString*)path; +@end typedef struct { diff --git a/apple/iOS/menu.m b/apple/iOS/menu.m index 48349224ae..7fd8d3901c 100644 --- a/apple/iOS/menu.m +++ b/apple/iOS/menu.m @@ -20,11 +20,9 @@ #include "../../input/drivers/cocoa_input.h" #include #include -#include "menu.h" #include -#include "../../menu/menu.h" #include "../../menu/menu_entries.h" #include "../../menu/drivers/shared.h" diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index c5f2619fc8..617c07fb9e 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -22,8 +22,6 @@ #ifdef HAVE_MFI #include "../../input/drivers_hid/mfi_hid.h" #endif -#include "menu.h" -#include "../../menu/menu.h" #include "../../input/drivers_hid/btstack_hid.h" diff --git a/apple/iOS/views.h b/apple/iOS/views.h deleted file mode 100644 index 521aebac89..0000000000 --- a/apple/iOS/views.h +++ /dev/null @@ -1,51 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2011-2015 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef _RARCH_APPLE_VIEWS_H -#define _RARCH_APPLE_VIEWS_H - -#include -#include "../../core_info.h" - - -#include "menu.h" - -// browser.m -@interface RADirectoryItem : NSObject -@property (nonatomic) NSString* path; -@property (nonatomic) bool isDirectory; -@end - -@interface RADirectoryList : RAMenuBase -@property (nonatomic, weak) RADirectoryItem* selectedItem; - -@property (nonatomic, copy) void (^chooseAction)(RADirectoryList* list, RADirectoryItem* item); -@property (nonatomic, copy) NSString* path; -@property (nonatomic, copy) NSString* extensions; - -@property (nonatomic) bool allowBlank; -@property (nonatomic) bool forDirectory; - -- (id)initWithPath:(NSString*)path extensions:(const char*)extensions action:(void (^)(RADirectoryList* list, RADirectoryItem* item))action; -- (void)browseTo:(NSString*)path; -@end - -// browser.m -@interface RAFoldersList : RAMenuBase -- (id) initWithFilePath:(NSString*)path; -@end - -#endif From 04fbedfcddb5b41d1556bbd534ac8a04345a215b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 20:19:49 +0200 Subject: [PATCH 116/120] Remove more header files - include more of it inside RetroArch_Apple.h --- apple/common/RetroArch_Apple.h | 97 ++++++++++++++++++++++++++- apple/iOS/menu.h | 117 --------------------------------- 2 files changed, 95 insertions(+), 119 deletions(-) delete mode 100644 apple/iOS/menu.h diff --git a/apple/common/RetroArch_Apple.h b/apple/common/RetroArch_Apple.h index 1b2d44cd37..66c814b635 100644 --- a/apple/common/RetroArch_Apple.h +++ b/apple/common/RetroArch_Apple.h @@ -69,6 +69,7 @@ void CFSearchPathForDirectoriesInDomains(unsigned flags, void CFTemporaryDirectory(char *buf, size_t sizeof_buf); #include "../../core_info.h" +#include "../../playlist.h" #include "../../settings.h" #include "../../menu/menu.h" @@ -82,7 +83,100 @@ void CFTemporaryDirectory(char *buf, size_t sizeof_buf); #include #import -#include "../iOS/menu.h" + +@protocol RAMenuItemBase +- (UITableViewCell*)cellForTableView:(UITableView*)tableView; +- (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller; +@end + +/*********************************************/ +/* RAMenuBase */ +/* A menu class that displays RAMenuItemBase */ +/* objects. */ +/*********************************************/ +@interface RAMenuBase : UITableViewController +@property (nonatomic) NSMutableArray* sections; +@property (nonatomic) BOOL hidesHeaders; + +- (id)initWithStyle:(UITableViewStyle)style; +- (id)itemForIndexPath:(NSIndexPath*)indexPath; + +@end + +/*********************************************/ +/* RAMenuItemBasic */ +/* A simple menu item that displays a text */ +/* description and calls a block object when */ +/* selected. */ +/*********************************************/ +@interface RAMenuItemBasic : NSObject +@property (nonatomic) NSString* description; +@property (nonatomic) id userdata; +@property (copy) void (^action)(id userdata); +@property (copy) NSString* (^detail)(id userdata); + ++ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action; ++ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action detail:(NSString* (^)())detail; ++ (RAMenuItemBasic*)itemWithDescription:(NSString*)description association:(id)userdata action:(void (^)())action detail:(NSString* (^)())detail; + +@end + +/*********************************************/ +/* RAMenuItemGeneralSetting */ +/* A simple menu item that displays the */ +/* state, and allows editing, of a string or */ +/* numeric setting. */ +/*********************************************/ +@interface RAMenuItemGeneralSetting : NSObject +@property (nonatomic) rarch_setting_t* setting; +@property (copy) void (^action)(); +@property (nonatomic, weak) UITableView* parentTable; ++ (id)itemForSetting:(rarch_setting_t*)setting action:(void (^)())action; +- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action; +@end + +/*********************************************/ +/* RAMenuItemBooleanSetting */ +/* A simple menu item that displays the */ +/* state, and allows editing, of a boolean */ +/* setting. */ +/*********************************************/ +@interface RAMenuItemBooleanSetting : NSObject +@property (nonatomic) rarch_setting_t* setting; +@property (copy) void (^action)(); +- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action; +@end + +/*********************************************/ +/* RAMenuItemPathSetting */ +/* A menu item that displays and allows */ +/* browsing for a path setting. */ +/*********************************************/ +@interface RAMenuItemPathSetting : RAMenuItemGeneralSetting @end + +/*********************************************/ +/* RAMenuItemEnumSetting */ +/* A menu item that displays and allows */ +/* a setting to be set from a list of */ +/* allowed choices. */ +/*********************************************/ +@interface RAMenuItemEnumSetting : RAMenuItemGeneralSetting @end + +/*********************************************/ +/* RAMenuItemBindSetting */ +/* A menu item that displays and allows */ +/* mapping of a keybinding. */ +/*********************************************/ +@interface RAMenuItemBindSetting : RAMenuItemGeneralSetting @end + +/*********************************************/ +/* RAMainMenu */ +/* Menu object that is displayed immediately */ +/* after startup. */ +/*********************************************/ +@interface RAMainMenu : RAMenuBase +@property (nonatomic) NSString* core; +@end @interface RADirectoryItem : NSObject @property (nonatomic) NSString* path; @@ -103,7 +197,6 @@ void CFTemporaryDirectory(char *buf, size_t sizeof_buf); - (void)browseTo:(NSString*)path; @end -// browser.m @interface RAFoldersList : RAMenuBase - (id) initWithFilePath:(NSString*)path; @end diff --git a/apple/iOS/menu.h b/apple/iOS/menu.h deleted file mode 100644 index 83b3a0606c..0000000000 --- a/apple/iOS/menu.h +++ /dev/null @@ -1,117 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2013-2014 - Jason Fetters - * Copyright (C) 2014-2015 - Jay McCarthy - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef __APPLE_RARCH_IOS_MENU_H__ -#define __APPLE_RARCH_IOS_MENU_H__ - -#include "../../playlist.h" -#include "../../settings.h" - -@protocol RAMenuItemBase -- (UITableViewCell*)cellForTableView:(UITableView*)tableView; -- (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller; -@end - -/*********************************************/ -/* RAMenuBase */ -/* A menu class that displays RAMenuItemBase */ -/* objects. */ -/*********************************************/ -@interface RAMenuBase : UITableViewController -@property (nonatomic) NSMutableArray* sections; -@property (nonatomic) BOOL hidesHeaders; - -- (id)initWithStyle:(UITableViewStyle)style; -- (id)itemForIndexPath:(NSIndexPath*)indexPath; - -@end - -/*********************************************/ -/* RAMenuItemBasic */ -/* A simple menu item that displays a text */ -/* description and calls a block object when */ -/* selected. */ -/*********************************************/ -@interface RAMenuItemBasic : NSObject -@property (nonatomic) NSString* description; -@property (nonatomic) id userdata; -@property (copy) void (^action)(id userdata); -@property (copy) NSString* (^detail)(id userdata); - -+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action; -+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action detail:(NSString* (^)())detail; -+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description association:(id)userdata action:(void (^)())action detail:(NSString* (^)())detail; - -@end - -/*********************************************/ -/* RAMenuItemGeneralSetting */ -/* A simple menu item that displays the */ -/* state, and allows editing, of a string or */ -/* numeric setting. */ -/*********************************************/ -@interface RAMenuItemGeneralSetting : NSObject -@property (nonatomic) rarch_setting_t* setting; -@property (copy) void (^action)(); -@property (nonatomic, weak) UITableView* parentTable; -+ (id)itemForSetting:(rarch_setting_t*)setting action:(void (^)())action; -- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action; -@end - -/*********************************************/ -/* RAMenuItemBooleanSetting */ -/* A simple menu item that displays the */ -/* state, and allows editing, of a boolean */ -/* setting. */ -/*********************************************/ -@interface RAMenuItemBooleanSetting : NSObject -@property (nonatomic) rarch_setting_t* setting; -@property (copy) void (^action)(); -- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action; -@end - -/*********************************************/ -/* RAMenuItemPathSetting */ -/* A menu item that displays and allows */ -/* browsing for a path setting. */ -/*********************************************/ -@interface RAMenuItemPathSetting : RAMenuItemGeneralSetting @end - -/*********************************************/ -/* RAMenuItemEnumSetting */ -/* A menu item that displays and allows */ -/* a setting to be set from a list of */ -/* allowed choices. */ -/*********************************************/ -@interface RAMenuItemEnumSetting : RAMenuItemGeneralSetting @end - -/*********************************************/ -/* RAMenuItemBindSetting */ -/* A menu item that displays and allows */ -/* mapping of a keybinding. */ -/*********************************************/ -@interface RAMenuItemBindSetting : RAMenuItemGeneralSetting @end - -/*********************************************/ -/* RAMainMenu */ -/* Menu object that is displayed immediately */ -/* after startup. */ -/*********************************************/ -@interface RAMainMenu : RAMenuBase -@property (nonatomic) NSString* core; -@end - -#endif From cbee4c3c038239d4e00a2122e8c114fca0d472c8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 20:26:17 +0200 Subject: [PATCH 117/120] Create CFExtensions.h --- apple/common/CFExtensions.h | 69 ++++++++++++++++++++++++++++++++++ apple/common/RetroArch_Apple.h | 50 +----------------------- 2 files changed, 70 insertions(+), 49 deletions(-) create mode 100644 apple/common/CFExtensions.h diff --git a/apple/common/CFExtensions.h b/apple/common/CFExtensions.h new file mode 100644 index 0000000000..dda7fba7e6 --- /dev/null +++ b/apple/common/CFExtensions.h @@ -0,0 +1,69 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2013-2014 - Jason Fetters + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef __CFEXTENSIONS_H +#define __CFEXTENSIONS_H + +#import +#include + +typedef enum +{ + CFApplicationDirectory = 1, // supported applications (Applications) + CFDemoApplicationDirectory, // unsupported applications, demonstration versions (Demos) + CFDeveloperApplicationDirectory, // developer applications (Developer/Applications). DEPRECATED - there is no one single Developer directory. + CFAdminApplicationDirectory, // system and network administration applications (Administration) + CFLibraryDirectory, // various documentation, support, and configuration files, resources (Library) + CFDeveloperDirectory, // developer resources (Developer) DEPRECATED - there is no one single Developer directory. + CFUserDirectory, // user home directories (Users) + CFDocumentationDirectory, // documentation (Documentation) + CFDocumentDirectory, // documents (Documents) + CFCoreServiceDirectory, // location of CoreServices directory (System/Library/CoreServices) + CFAutosavedInformationDirectory = 11, // location of autosaved documents (Documents/Autosaved) + CFDesktopDirectory = 12, // location of user's desktop + CFCachesDirectory = 13, // location of discardable cache files (Library/Caches) + CFApplicationSupportDirectory = 14, // location of application support files (plug-ins, etc) (Library/Application Support) + CFDownloadsDirectory = 15, // location of the user's "Downloads" directory + CFInputMethodsDirectory = 16, // input methods (Library/Input Methods) + CFMoviesDirectory = 17, // location of user's Movies directory (~/Movies) + CFMusicDirectory = 18, // location of user's Music directory (~/Music) + CFPicturesDirectory = 19, // location of user's Pictures directory (~/Pictures) + CFPrinterDescriptionDirectory = 20, // location of system's PPDs directory (Library/Printers/PPDs) + CFSharedPublicDirectory = 21, // location of user's Public sharing directory (~/Public) + CFPreferencePanesDirectory = 22, // location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes) + CFApplicationScriptsDirectory = 23, // location of the user scripts folder for the calling application (~/Library/Application Scripts/code-signing-id) + CFItemReplacementDirectory = 99, // For use with NSFileManager's URLForDirectory:inDomain:appropriateForURL:create:error: + CFAllApplicationsDirectory = 100, // all directories where applications can occur + CFAllLibrariesDirectory = 101, // all directories where resources can occur + CFTrashDirectory = 102 // location of Trash directory + +} CFSearchPathDirectory; + +typedef enum +{ + CFUserDomainMask = 1, // user's home directory --- place to install user's personal items (~) + CFLocalDomainMask = 2, // local to the current machine --- place to install items available to everyone on this machine (/Library) + CFNetworkDomainMask = 4, // publically available location in the local area network --- place to install items available on the network (/Network) + CFSystemDomainMask = 8, // provided by Apple, unmodifiable (/System) + CFAllDomainsMask = 0x0ffff // all domains: all of the above and future items +} CFDomainMask; + +void CFSearchPathForDirectoriesInDomains(unsigned flags, + unsigned domain_mask, unsigned expand_tilde, char *buf, size_t sizeof_buf); + +void CFTemporaryDirectory(char *buf, size_t sizeof_buf); + +#endif diff --git a/apple/common/RetroArch_Apple.h b/apple/common/RetroArch_Apple.h index 66c814b635..186cb2da6a 100644 --- a/apple/common/RetroArch_Apple.h +++ b/apple/common/RetroArch_Apple.h @@ -18,56 +18,8 @@ #define __RARCH_APPLE_H #include -#import - -#include - -typedef enum -{ - CFApplicationDirectory = 1, // supported applications (Applications) - CFDemoApplicationDirectory, // unsupported applications, demonstration versions (Demos) - CFDeveloperApplicationDirectory, // developer applications (Developer/Applications). DEPRECATED - there is no one single Developer directory. - CFAdminApplicationDirectory, // system and network administration applications (Administration) - CFLibraryDirectory, // various documentation, support, and configuration files, resources (Library) - CFDeveloperDirectory, // developer resources (Developer) DEPRECATED - there is no one single Developer directory. - CFUserDirectory, // user home directories (Users) - CFDocumentationDirectory, // documentation (Documentation) - CFDocumentDirectory, // documents (Documents) - CFCoreServiceDirectory, // location of CoreServices directory (System/Library/CoreServices) - CFAutosavedInformationDirectory = 11, // location of autosaved documents (Documents/Autosaved) - CFDesktopDirectory = 12, // location of user's desktop - CFCachesDirectory = 13, // location of discardable cache files (Library/Caches) - CFApplicationSupportDirectory = 14, // location of application support files (plug-ins, etc) (Library/Application Support) - CFDownloadsDirectory = 15, // location of the user's "Downloads" directory - CFInputMethodsDirectory = 16, // input methods (Library/Input Methods) - CFMoviesDirectory = 17, // location of user's Movies directory (~/Movies) - CFMusicDirectory = 18, // location of user's Music directory (~/Music) - CFPicturesDirectory = 19, // location of user's Pictures directory (~/Pictures) - CFPrinterDescriptionDirectory = 20, // location of system's PPDs directory (Library/Printers/PPDs) - CFSharedPublicDirectory = 21, // location of user's Public sharing directory (~/Public) - CFPreferencePanesDirectory = 22, // location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes) - CFApplicationScriptsDirectory = 23, // location of the user scripts folder for the calling application (~/Library/Application Scripts/code-signing-id) - CFItemReplacementDirectory = 99, // For use with NSFileManager's URLForDirectory:inDomain:appropriateForURL:create:error: - CFAllApplicationsDirectory = 100, // all directories where applications can occur - CFAllLibrariesDirectory = 101, // all directories where resources can occur - CFTrashDirectory = 102 // location of Trash directory - -} CFSearchPathDirectory; - -typedef enum -{ - CFUserDomainMask = 1, // user's home directory --- place to install user's personal items (~) - CFLocalDomainMask = 2, // local to the current machine --- place to install items available to everyone on this machine (/Library) - CFNetworkDomainMask = 4, // publically available location in the local area network --- place to install items available on the network (/Network) - CFSystemDomainMask = 8, // provided by Apple, unmodifiable (/System) - CFAllDomainsMask = 0x0ffff // all domains: all of the above and future items -} CFDomainMask; - -void CFSearchPathForDirectoriesInDomains(unsigned flags, - unsigned domain_mask, unsigned expand_tilde, char *buf, size_t sizeof_buf); - -void CFTemporaryDirectory(char *buf, size_t sizeof_buf); +#include "CFExtensions.h" #include "../../core_info.h" #include "../../playlist.h" #include "../../settings.h" From 4e912dbae8d7a0b797cbb30a040c51da03ff7ae5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 20:38:40 +0200 Subject: [PATCH 118/120] Create HAVE_AVFOUNDATION define --- apple/common/apple_cocoa_common.m | 5 ----- apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj | 3 +++ camera/camera_driver.c | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apple/common/apple_cocoa_common.m b/apple/common/apple_cocoa_common.m index 227825010f..2ff6fe9627 100644 --- a/apple/common/apple_cocoa_common.m +++ b/apple/common/apple_cocoa_common.m @@ -171,11 +171,6 @@ void apple_display_alert(const char *message, const char *title) /* Define compatibility symbols and categories. */ -//#if defined(MAC_OS_X_VERSION_10_7) || defined(__IPHONE_4_0) -#if defined(__IPHONE_4_0) && defined(IOS) -#define HAVE_AVFOUNDATION -#endif - #ifdef HAVE_AVFOUNDATION #include #include diff --git a/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj b/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj index ea3673caa0..44af0f46f0 100644 --- a/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj +++ b/apple/iOS/RetroArch_iOS.xcodeproj/project.pbxproj @@ -818,6 +818,7 @@ "-DHAVE_XMB", "-D_LZMA_UINT32_IS_ULONG", "-DHAVE_MFI", + "-DHAVE_AVFOUNDATION", ); PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; @@ -885,6 +886,7 @@ "-DHAVE_XMB", "-D_LZMA_UINT32_IS_ULONG", "-DHAVE_MFI", + "-DHAVE_AVFOUNDATION", ); "OTHER_CFLAGS[arch=*]" = ( "-DNS_BLOCK_ASSERTIONS=1", @@ -924,6 +926,7 @@ "-DHAVE_XMB", "-D_LZMA_UINT32_IS_ULONG", "-DHAVE_MFI", + "-DHAVE_AVFOUNDATION", ); PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; diff --git a/camera/camera_driver.c b/camera/camera_driver.c index f0204cafa7..d99fd60200 100644 --- a/camera/camera_driver.c +++ b/camera/camera_driver.c @@ -31,7 +31,7 @@ static const camera_driver_t *camera_drivers[] = { #ifdef ANDROID &camera_android, #endif -#if defined(__IPHONE_4_0) && defined(IOS) +#ifdef HAVE_AVFOUNDATION &camera_apple, #endif &camera_null, From 2580a2676a8431c218005d131e0981c91b3f706e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 20:42:54 +0200 Subject: [PATCH 119/120] Add features --- config.features.h | 6 ++++++ retroarch.c | 36 +++++++++++++++++++----------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/config.features.h b/config.features.h index 3f9f5a4a10..140833311f 100644 --- a/config.features.h +++ b/config.features.h @@ -290,6 +290,12 @@ static const bool _coretext_supp = true; static const bool _coretext_supp = false; #endif +#ifdef HAVE_AVFOUNDATION +static const bool _avfoundation_supp = true; +#else +static const bool _avfoundation_supp = false; +#endif + #if !defined(_WIN32) && !defined(GLOBAL_CONFIG_DIR) #if defined(__HAIKU__) #define GLOBAL_CONFIG_DIR "/system/settings" diff --git a/retroarch.c b/retroarch.c index d2dbe663e2..a70e5eefab 100644 --- a/retroarch.c +++ b/retroarch.c @@ -102,41 +102,43 @@ static void print_features(void) _PSUPP(thread, "Threads", "Threading support"); _PSUPP(opengl, "OpenGL", "OpenGL driver"); _PSUPP(opengles, "OpenGL ES", "OpenGL ES driver"); - _PSUPP(xvideo, "XVideo", "XVideo video driver"); + _PSUPP(xvideo, "XVideo", "Video driver"); _PSUPP(udev, "UDEV", "UDEV/EVDEV input driver support"); _PSUPP(egl, "EGL", "video context driver"); _PSUPP(kms, "KMS", "video context driver"); _PSUPP(vg, "OpenVG", "video context driver"); - _PSUPP(coreaudio, "CoreAudio", "audio driver"); - _PSUPP(alsa, "ALSA", "audio driver"); - _PSUPP(oss, "OSS", "audio driver"); - _PSUPP(jack, "Jack", "audio driver"); - _PSUPP(rsound, "RSound", "audio driver"); - _PSUPP(roar, "RoarAudio", "audio driver"); - _PSUPP(pulse, "PulseAudio", "audio driver"); - _PSUPP(dsound, "DirectSound", "audio driver"); - _PSUPP(xaudio, "XAudio2", "audio driver"); - _PSUPP(al, "OpenAL", "audio driver"); - _PSUPP(sl, "OpenSL", "audio driver"); + _PSUPP(coreaudio, "CoreAudio", "Audio driver"); + _PSUPP(alsa, "ALSA", "Audio driver"); + _PSUPP(oss, "OSS", "Audio driver"); + _PSUPP(jack, "Jack", "Audio driver"); + _PSUPP(rsound, "RSound", "Audio driver"); + _PSUPP(roar, "RoarAudio", "Audio driver"); + _PSUPP(pulse, "PulseAudio", "Audio driver"); + _PSUPP(dsound, "DirectSound", "Audio driver"); + _PSUPP(xaudio, "XAudio2", "Audio driver"); + _PSUPP(al, "OpenAL", "Audio driver"); + _PSUPP(sl, "OpenSL", "Audio driver"); _PSUPP(7zip, "7zip", "7zip support"); _PSUPP(zlib, "zlib", ".zip extraction"); _PSUPP(dylib, "External", "External filter and plugin support"); - _PSUPP(cg, "Cg", "Cg pixel shaders"); - _PSUPP(glsl, "GLSL", "GLSL pixel shaders"); - _PSUPP(glsl, "HLSL", "HLSL pixel shaders"); + _PSUPP(cg, "Cg", "Fragment/vertex shader driver"); + _PSUPP(glsl, "GLSL", "Fragment/vertex shader driver"); + _PSUPP(glsl, "HLSL", "Fragment/vertex shader driver"); _PSUPP(libxml2, "libxml2", "libxml2 XML parsing"); _PSUPP(sdl_image, "SDL_image", "SDL_image image loading"); _PSUPP(rpng, "rpng", "PNG image loading/encoding"); _PSUPP(fbo, "FBO", "OpenGL render-to-texture (multi-pass shaders)"); _PSUPP(dynamic, "Dynamic", "Dynamic run-time loading of libretro library"); _PSUPP(ffmpeg, "FFmpeg", "On-the-fly recording of gameplay with libavcodec"); - _PSUPP(freetype, "FreeType", "TTF font rendering with FreeType"); - _PSUPP(coretext, "CoreText", "TTF font rendering (for OSX and/or iOS)"); + _PSUPP(freetype, "FreeType", "TTF font rendering driver"); + _PSUPP(coretext, "CoreText", "TTF font rendering driver (for OSX and/or iOS)"); _PSUPP(netplay, "Netplay", "Peer-to-peer netplay"); _PSUPP(python, "Python", "Script support in shaders"); _PSUPP(libusb, "Libusb", "Libusb support"); _PSUPP(cocoa, "Cocoa", "Cocoa UI companion support (for OSX and/or iOS)"); _PSUPP(qt, "QT", "QT UI companion support"); + _PSUPP(avfoundation, "AVFoundation", "Camera driver"); + _PSUPP(v4l2, "Video4Linux2", "Camera driver"); } #undef _PSUPP From d63774e51ff562e401733f6825e264b245cd1f4a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Apr 2015 20:46:49 +0200 Subject: [PATCH 120/120] (AVFoundation) Update --- apple/common/apple_cocoa_common.m | 2 +- config.def.h | 6 +++--- configuration.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apple/common/apple_cocoa_common.m b/apple/common/apple_cocoa_common.m index 2ff6fe9627..22d376025e 100644 --- a/apple/common/apple_cocoa_common.m +++ b/apple/common/apple_cocoa_common.m @@ -630,7 +630,7 @@ camera_driver_t camera_apple = { apple_camera_start, apple_camera_stop, apple_camera_poll, - "apple", + "avfoundation", }; #endif diff --git a/config.def.h b/config.def.h index c6d6cc9a17..b275755c84 100644 --- a/config.def.h +++ b/config.def.h @@ -111,7 +111,7 @@ enum CAMERA_V4L2, CAMERA_RWEBCAM, CAMERA_ANDROID, - CAMERA_APPLE, + CAMERA_AVFOUNDATION, CAMERA_NULL, LOCATION_ANDROID, @@ -293,8 +293,8 @@ enum #define CAMERA_DEFAULT_DRIVER CAMERA_RWEBCAM #elif defined(ANDROID) #define CAMERA_DEFAULT_DRIVER CAMERA_ANDROID -#elif defined(MAC_OS_X_VERSION_10_7) || defined(__IPHONE_4_0) -#define CAMERA_DEFAULT_DRIVER CAMERA_APPLE +#elif defined(HAVE_AVFOUNDATION) +#define CAMERA_DEFAULT_DRIVER CAMERA_AVFOUNDATION #else #define CAMERA_DEFAULT_DRIVER CAMERA_NULL #endif diff --git a/configuration.c b/configuration.c index fa4bbd63e9..be7b4e907a 100644 --- a/configuration.c +++ b/configuration.c @@ -359,8 +359,8 @@ const char *config_get_default_camera(void) return "rwebcam"; case CAMERA_ANDROID: return "android"; - case CAMERA_APPLE: - return "apple"; + case CAMERA_AVFOUNDATION: + return "avfoundation"; default: break; }