diff --git a/database_info.c b/database_info.c index 4a316081d0..3568f02f06 100644 --- a/database_info.c +++ b/database_info.c @@ -210,6 +210,8 @@ static int database_cursor_iterate(libretrodb_cursor_t *cur, db_info->md5 = bin_to_hex_alloc((uint8_t*)val->binary.buff, val->binary.len); } + rmsgpack_dom_value_free(&item); + return 0; } @@ -227,11 +229,23 @@ static int database_cursor_open(libretrodb_t *db, strlen(query), &error); if (error) - return -1; + goto error; if ((libretrodb_cursor_open(db, cur, q)) != 0) - return -1; + goto error; + + if (q) + libretrodb_query_free(q); return 0; + +error: + if (q) + libretrodb_query_free(q); + query = NULL; + libretrodb_close(db); + db = NULL; + + return -1; } static int database_cursor_close(libretrodb_t *db, libretrodb_cursor_t *cur) diff --git a/libretro-db/libretrodb.c b/libretro-db/libretrodb.c index 5651e2bbba..aec1bb5c58 100644 --- a/libretro-db/libretrodb.c +++ b/libretro-db/libretrodb.c @@ -141,6 +141,9 @@ static void libretrodb_write_index_header(int fd, libretrodb_index_t * idx) void libretrodb_close(libretrodb_t *db) { + if (!db) + return; + close(db->fd); db->fd = -1; } @@ -150,7 +153,11 @@ int libretrodb_open(const char *path, libretrodb_t *db) libretrodb_header_t header; libretrodb_metadata_t md; int rv; +#ifdef _WIN32 + int fd = open(path, O_RDWR | O_BINARY); +#else int fd = open(path, O_RDWR); +#endif if (fd == -1) return -errno; diff --git a/libretro-db/rmsgpack_dom.c b/libretro-db/rmsgpack_dom.c index 4887f553fa..1c54b4c5c4 100644 --- a/libretro-db/rmsgpack_dom.c +++ b/libretro-db/rmsgpack_dom.c @@ -25,6 +25,52 @@ static struct rmsgpack_dom_value *dom_reader_state_pop( return v; } +static void puts_i64(int64_t dec) +{ + signed char digits[19 + 1]; /* max i64: 9,223,372,036,854,775,807 */ + uint64_t decimal; + register int i; + + decimal = (dec < 0) ? (uint64_t)-dec : (uint64_t)+dec; + digits[19] = '\0'; + for (i = sizeof(digits) - 2; i >= 0; i--) + { + digits[i] = decimal % 10; + decimal /= 10; + } + + for (i = 0; i < sizeof(digits) - 1; i++) + digits[i] += '0'; + for (i = 0; i < sizeof(digits) - 2; i++) + if (digits[i] != '0') + break; /* Don't print leading zeros to the console. */ + + if (dec < 0) + putchar('-'); + fputs((char *)&digits[i], stdout); +} + +static void puts_u64(uint64_t decimal) +{ + char digits[20 + 1]; /* max u64: 18,446,744,073,709,551,616 */ + register int i; + + digits[20] = '\0'; + for (i = sizeof(digits) - 2; i >= 0; i--) + { + digits[i] = decimal % 10; + decimal /= 10; + } + + for (i = 0; i < sizeof(digits) - 1; i++) + digits[i] += '0'; + for (i = 0; i < sizeof(digits) - 2; i++) + if (digits[i] != '0') + break; /* Don't print leading zeros to the console. */ + + fputs(&digits[i], stdout); +} + static int dom_reader_state_push(struct dom_reader_state *s, struct rmsgpack_dom_value *v) { @@ -295,18 +341,10 @@ void rmsgpack_dom_value_print(struct rmsgpack_dom_value *obj) printf("false"); break; case RDT_INT: -#ifdef _WIN32 - printf("%I64d", (signed long long)obj->int_); -#else - printf("%lld", (signed long long)obj->int_); -#endif + puts_i64(obj -> int_); break; case RDT_UINT: -#ifdef _WIN32 - printf("%I64u", (unsigned long long)obj->uint_); -#else - printf("%llu", (unsigned long long)obj->uint_); -#endif + puts_u64(obj -> uint_); break; case RDT_STRING: printf("\"%s\"", obj->string.buff); diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index 022f213ce8..af4db58788 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -134,18 +134,17 @@ static int action_ok_playlist_entry(const char *path, if (!strcmp(label, "rdb_entry_start_game")) selection_ptr = rdb_entry_start_game_selection_ptr; - content_playlist_get_index(playlist, idx, + content_playlist_get_index(playlist, selection_ptr, &entry_path, &entry_label, &core_path, &core_name, NULL); -#if 1 - RARCH_LOG("path: %s, label: %s, core path: %s, core name: %s\n", entry_path, entry_label, - core_path, core_name); +#if 0 + RARCH_LOG("path: %s, label: %s, core path: %s, core name: %s, idx: %d\n", entry_path, entry_label, + core_path, core_name, selection_ptr); #endif if (core_path && core_path[0] != '\0' && core_name && core_name[0] != '\0' && !strcmp(core_path, "DETECT") && !strcmp(core_name, "DETECT")) - return action_ok_file_load_with_detect_core(entry_path, label, type, idx); - + return action_ok_file_load_with_detect_core(entry_path, label, type, selection_ptr); rarch_playlist_load_content(playlist, selection_ptr); diff --git a/retroarch.cfg b/retroarch.cfg index c80eb6dfb3..bc137801b4 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -406,18 +406,18 @@ # # Keyboard input, Joypad and Joyaxis will all obey the "nul" bind, which disables the bind completely, # rather than relying on a default. -# input_player1_a = x -# input_player1_b = z -# input_player1_y = a -# input_player1_x = s -# input_player1_start = enter -# input_player1_select = rshift -# input_player1_l = q -# input_player1_r = w -# input_player1_left = left -# input_player1_right = right -# input_player1_up = up -# input_player1_down = down +# input_player1_a = "x" +# input_player1_b = "z" +# input_player1_y = "a" +# input_player1_x = "s" +# input_player1_start = "enter" +# input_player1_select = "rshift" +# input_player1_l = "q" +# input_player1_r = "w" +# input_player1_left = "left" +# input_player1_right = "right" +# input_player1_up = "up" +# input_player1_down = "down" # input_player1_l2 = # input_player1_r2 = # input_player1_l3 = diff --git a/settings.c b/settings.c index 67a5414f60..6ac8574e37 100644 --- a/settings.c +++ b/settings.c @@ -2114,7 +2114,7 @@ int setting_get_description(const char *label, char *msg, "for the first time.\n" " \n" "This is only updated in config if\n" - "'Config Save On Exit' is set to true.\n"); + "'Save Configuration on Exit' is enabled.\n"); } else if (!strcmp(label, "config_save_on_exit")) { @@ -2523,8 +2523,8 @@ int setting_get_description(const char *label, char *msg, "end of RetroArch's lifetime.\n" " \n" "RetroArch will automatically load any savestate\n" - "with this path on startup if 'Savestate Auto\n" - "Load' is set."); + "with this path on startup if 'Auto Load State\n" + "is enabled."); } else if (!strcmp(label, "shader_apply_changes")) { @@ -3496,7 +3496,7 @@ static bool setting_append_list_driver_options( CONFIG_STRING_OPTIONS( settings->input.joypad_driver, "input_joypad_driver", - "Input Device Driver", + "Joypad Driver", config_get_default_joypad(), config_get_joypad_driver_options(), group_info.name, @@ -3762,7 +3762,7 @@ static bool setting_append_list_general_options( CONFIG_BOOL(settings->config_save_on_exit, "config_save_on_exit", - "Configuration Save On Exit", + "Save Configuration on Exit", config_save_on_exit, "OFF", "ON", @@ -3826,6 +3826,7 @@ static bool setting_append_list_general_options( subgroup_info.name, general_write_handler, general_read_handler); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); #ifdef HAVE_THREADS CONFIG_UINT( @@ -4200,7 +4201,7 @@ static bool setting_append_list_video_options( CONFIG_BOOL( settings->video.aspect_ratio_auto, "video_aspect_ratio_auto", - "Use Auto Aspect Ratio", + "Auto Aspect Ratio", aspect_ratio_auto, "OFF", "ON", @@ -4336,10 +4337,10 @@ static bool setting_append_list_video_options( CONFIG_BOOL( settings->video.smooth, "video_smooth", - "Use Bilinear Filtering", + "Bilinear Filtering", video_smooth, - "Point filtering", - "Bilinear filtering", + "OFF", + "ON", group_info.name, subgroup_info.name, general_write_handler, @@ -5369,7 +5370,7 @@ static bool setting_append_list_menu_options( CONFIG_BOOL( settings->menu.mouse.enable, "menu_mouse_enable", - "Mouse Enable", + "Mouse Support", false, "OFF", "ON", @@ -5381,7 +5382,7 @@ static bool setting_append_list_menu_options( CONFIG_BOOL( settings->menu.pointer.enable, "menu_pointer_enable", - "Touch Enable", + "Touch Support", pointer_enable, "OFF", "ON", @@ -5405,6 +5406,7 @@ static bool setting_append_list_menu_options( subgroup_info.name, general_write_handler, general_read_handler); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_BOOL( settings->menu.navigation.wraparound.vertical_enable, @@ -5417,6 +5419,7 @@ static bool setting_append_list_menu_options( subgroup_info.name, general_write_handler, general_read_handler); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); END_SUB_GROUP(list, list_info); @@ -5472,6 +5475,7 @@ static bool setting_append_list_menu_options( general_write_handler, general_read_handler); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_HEX( settings->menu.entry_hover_color, @@ -5483,6 +5487,7 @@ static bool setting_append_list_menu_options( general_write_handler, general_read_handler); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_HEX( settings->menu.title_color, @@ -5494,6 +5499,7 @@ static bool setting_append_list_menu_options( general_write_handler, general_read_handler); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); END_SUB_GROUP(list, list_info); @@ -5597,7 +5603,7 @@ static bool setting_append_list_ui_options( CONFIG_BOOL( settings->video.disable_composition, "video_disable_composition", - "Window Compositing Disable Hint", + "Disable Desktop Composition", disable_composition, "OFF", "ON", @@ -5611,7 +5617,7 @@ static bool setting_append_list_ui_options( CONFIG_BOOL( settings->pause_nonactive, "pause_nonactive", - "Window Unfocus Pause Hint", + "Pause on Focus Loss", pause_nonactive, "OFF", "ON", @@ -5631,11 +5637,12 @@ static bool setting_append_list_ui_options( subgroup_info.name, general_write_handler, general_read_handler); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_BOOL( settings->ui.menubar_enable, "ui_menubar_enable", - "Menubar Enable Hint", + "Menubar (Windows)", true, "OFF", "ON", @@ -5647,7 +5654,7 @@ static bool setting_append_list_ui_options( CONFIG_BOOL( settings->ui.suspend_screensaver_enable, "suspend_screensaver_enable", - "Suspend Screensaver Enable Hint", + "Suspend Screensaver", true, "OFF", "ON", diff --git a/tasks/task_database.c b/tasks/task_database.c index d8255a135b..4b62f218f5 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -46,7 +46,12 @@ static int database_info_iterate_start (database_info_handle_t *db, const char *name) { char msg[PATH_MAX_LENGTH]; - snprintf(msg, sizeof(msg), "%zu/%zu: Scanning %s...\n", + snprintf(msg, sizeof(msg), +#ifdef _WIN32 + "%Iu/%Iu: Scanning %s...\n", +#else + "%zu/%zu: Scanning %s...\n", +#endif db->list_ptr, db->list->size, name); if (msg[0] != '\0') @@ -122,6 +127,8 @@ static int database_info_list_iterate_new(database_state_handle_t *db_state) const char *new_database = db_state->list->elems[db_state->list_index].data; RARCH_LOG("Check database [%d/%d] : %s\n", (unsigned)db_state->list_index, (unsigned)db_state->list->size, new_database); + if (db_state->info) + database_info_list_free(db_state->info); db_state->info = database_info_list_new(new_database, NULL); return 0; } @@ -199,7 +206,9 @@ static int database_info_list_iterate_next( { db_state->list_index++; db_state->entry_index = 0; + database_info_list_free(db_state->info); + db_state->info = NULL; return 1; }