From 07eddd7229eaede458a585fa904deac03405f663 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Sun, 23 Apr 2023 16:09:24 +0200 Subject: [PATCH] Cleanups --- input/drivers/dinput.c | 51 +++++++++++++++++++---------------- menu/cbs/menu_cbs_get_value.c | 3 --- menu/cbs/menu_cbs_ok.c | 46 ------------------------------- menu/cbs/menu_cbs_sublabel.c | 17 ------------ menu/drivers/xmb.c | 40 +-------------------------- menu/menu_driver.c | 20 -------------- retroarch.c | 11 -------- tasks/task_database.c | 23 +--------------- tasks/task_movie.c | 8 +++--- tasks/task_overlay.c | 4 +-- ui/drivers/ui_qt.cpp | 26 ------------------ 11 files changed, 35 insertions(+), 214 deletions(-) diff --git a/input/drivers/dinput.c b/input/drivers/dinput.c index 1ab5dc3106..651abf3f4f 100644 --- a/input/drivers/dinput.c +++ b/input/drivers/dinput.c @@ -562,7 +562,6 @@ static int16_t dinput_input_state( unsigned id) { settings_t *settings; - int16_t ret = 0; struct dinput_input *di = (struct dinput_input*)data; if (port < MAX_USERS) @@ -571,7 +570,8 @@ static int16_t dinput_input_state( { case RETRO_DEVICE_JOYPAD: { - settings = config_get_ptr(); + int16_t ret = 0; + settings = config_get_ptr(); if (id == RETRO_DEVICE_ID_JOYPAD_MASK) { @@ -633,6 +633,7 @@ static int16_t dinput_input_state( di->state[rarch_keysym_lut[(enum retro_key)id]] & 0x80; case RETRO_DEVICE_ANALOG: { + int16_t ret = 0; int id_minus_key = 0; int id_plus_key = 0; unsigned id_minus = 0; @@ -659,8 +660,9 @@ static int16_t dinput_input_state( if (di->state[sym] & 0x80) ret += -0x7fff; } + return ret; } - return ret; + break; case RARCH_DEVICE_MOUSE_SCREEN: settings = config_get_ptr(); if (settings->uints.input_mouse_index[ port ] != 0) @@ -680,8 +682,6 @@ static int16_t dinput_input_state( settings = config_get_ptr(); if (settings->uints.input_mouse_index[port] == 0) { - int16_t state = 0; - switch (id) { case RETRO_DEVICE_ID_MOUSE_X: @@ -694,24 +694,36 @@ static int16_t dinput_input_state( return (di->flags & DINP_FLAG_MOUSE_R_BTN); case RETRO_DEVICE_ID_MOUSE_WHEELUP: if (di->flags & DINP_FLAG_MOUSE_WU_BTN) - state = 1; + { + di->flags &= ~DINP_FLAG_MOUSE_WU_BTN; + return 1; + } di->flags &= ~DINP_FLAG_MOUSE_WU_BTN; - return state; + break; case RETRO_DEVICE_ID_MOUSE_WHEELDOWN: if (di->flags & DINP_FLAG_MOUSE_WD_BTN) - state = 1; + { + di->flags &= ~DINP_FLAG_MOUSE_WD_BTN; + return 1; + } di->flags &= ~DINP_FLAG_MOUSE_WD_BTN; - return state; + break; case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP: if (di->flags & DINP_FLAG_MOUSE_HWU_BTN) - state = 1; + { + di->flags &= ~DINP_FLAG_MOUSE_HWU_BTN; + return 1; + } di->flags &= ~DINP_FLAG_MOUSE_HWU_BTN; - return state; + break; case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN: if (di->flags & DINP_FLAG_MOUSE_HWD_BTN) - state = 1; + { + di->flags &= ~DINP_FLAG_MOUSE_HWD_BTN; + return 1; + } di->flags &= ~DINP_FLAG_MOUSE_HWD_BTN; - return state; + break; case RETRO_DEVICE_ID_MOUSE_MIDDLE: return (di->flags & DINP_FLAG_MOUSE_M_BTN); case RETRO_DEVICE_ID_MOUSE_BUTTON_4: @@ -778,7 +790,7 @@ static int16_t dinput_input_state( case RETRO_DEVICE_ID_POINTER_Y: return res_y; case RETRO_DEVICE_ID_POINTER_PRESSED: - return check_pos ? true : (di->flags & DINP_FLAG_MOUSE_L_BTN); + return check_pos ? 1 : (di->flags & DINP_FLAG_MOUSE_L_BTN); default: break; } @@ -1004,17 +1016,10 @@ bool dinput_handle_message(void *data, wParam == DBT_DEVICEREMOVECOMPLETE) { PDEV_BROADCAST_HDR pHdr = (PDEV_BROADCAST_HDR)lParam; + /* TODO/FIXME: Don't destroy everything, let's just + * handle new devices gracefully */ if (pHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) - { -#if 0 - PDEV_BROADCAST_DEVICEINTERFACE pDevInf = - (PDEV_BROADCAST_DEVICEINTERFACE)pHdr; -#endif - - /* TODO/FIXME: Don't destroy everything, let's just - * handle new devices gracefully */ joypad_driver_reinit(di, di->joypad_drv_name); - } } #endif break; diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index ab8051c21e..31a7034f04 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -2255,9 +2255,6 @@ static int menu_cbs_init_bind_get_string_representation_compare_type( BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_entry); break; default: -#if 0 - RARCH_LOG("type: %d\n", type); -#endif BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label); break; } diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index bdd5f27186..937e315ba8 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1771,13 +1771,7 @@ static bool menu_content_find_first_core(menu_content_ctx_defer_info_t *def_info { core_info_get_current_core((core_info_t**)&info); if (info) - { -#if 0 - RARCH_LOG("[lobby] use the current core (%s) to load this content...\n", - info->path); -#endif supported = 1; - } } /* There are multiple deferred cores and a @@ -4661,38 +4655,6 @@ static void cb_net_generic_subdir(retro_task_t *task, void *task_data, void *user_data, const char *err) { http_transfer_data_t *data = (http_transfer_data_t*)task_data; -#if 0 - char subdir_path[PATH_MAX_LENGTH]; - file_transfer_t *state = (file_transfer_t*)user_data; - subdir_path[0] = '\0'; -#endif - - if (!data || err) - goto finish; - -#if 0 - if (!string_is_empty(data->data)) - memcpy(subdir_path, data->data, data->len * sizeof(char)); - subdir_path[data->len] = '\0'; -#endif - -finish: - /* TODO/FIXME - unimplemented/unfinished code */ -#if 0 - if (!err && !string_ends_with_size(subdir_path, - FILE_PATH_INDEX_DIRS_URL, - strlen(subdir_path), - STRLEN_CONST(FILE_PATH_INDEX_DIRS_URL) - )) - { - char parent_dir[PATH_MAX_LENGTH]; - fill_pathname_parent_dir(parent_dir, - state->path, sizeof(parent_dir)); - /*generic_action_ok_displaylist_push(parent_dir, NULL, - subdir_path, 0, 0, 0, ACTION_OK_DL_CORE_CONTENT_DIRS_SUBDIR_LIST);*/ - } -#endif - if (user_data) free(user_data); } @@ -6491,14 +6453,6 @@ static int action_ok_push_dropdown_setting(const char *path, static int action_ok_push_dropdown_item(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { -#if 0 - RARCH_LOG("dropdown: \n"); - RARCH_LOG("path: %s \n", path); - RARCH_LOG("label: %s \n", label); - RARCH_LOG("type: %d \n", type); - RARCH_LOG("idx: %d \n", idx); - RARCH_LOG("entry_idx: %d \n", entry_idx); -#endif return 0; } diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index d5d05a5d72..d8090df6e8 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -452,12 +452,6 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_netplay_game_watch, ME DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_netplay_player_chat, MENU_ENUM_SUBLABEL_INPUT_META_NETPLAY_PLAYER_CHAT) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_netplay_fade_chat_toggle, MENU_ENUM_SUBLABEL_INPUT_META_NETPLAY_FADE_CHAT_TOGGLE) -#if 0 -/* Hidden in displaylist */ -DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_osk, MENU_ENUM_SUBLABEL_INPUT_META_OSK) -DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_overlay_next, MENU_ENUM_SUBLABEL_INPUT_META_OVERLAY_NEXT) -#endif - DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_hotkey_block_delay, MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BLOCK_DELAY) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_device_type, MENU_ENUM_SUBLABEL_INPUT_DEVICE_TYPE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_adc_type, MENU_ENUM_SUBLABEL_INPUT_ADC_TYPE) @@ -2314,17 +2308,6 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case RARCH_NETPLAY_FADE_CHAT_TOGGLE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_meta_netplay_fade_chat_toggle); return 0; - -#if 0 - /* Hidden in displaylist */ - case RARCH_OSK: - BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_meta_osk); - return 0; - case RARCH_OVERLAY_NEXT: - BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_meta_overlay_next); - return 0; -#endif - default: break; } diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index fb01809920..3bbafae0bb 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -3979,32 +3979,9 @@ static int xmb_draw_item( xmb->entry_idx_enabled && !string_is_empty(xmb->entry_index_str)) { - float entry_idx_margin = 12 * xmb->last_scale_factor; - -#if 0 - /* Disabled due to overlap with arrow image - * and previous selection icon when enough items */ - - /* Calculate position depending on the current - * list and if Thumbnail Vertical Disposition - * is enabled (branchless version) */ - float x_position = ( - video_width - entry_idx_margin) * - !menu_xmb_vertical_thumbnails + - (node->x + xmb->margins_screen_left + - xmb->icon_spacing_horizontal - - xmb->margins_label_left) * - menu_xmb_vertical_thumbnails; - float y_position = ( - video_height - entry_idx_margin) * - !menu_xmb_vertical_thumbnails + - (xmb->margins_screen_top + xmb->margins_label_top + - xmb->icon_spacing_vertical * xmb->active_item_factor) * - menu_xmb_vertical_thumbnails; -#else + float entry_idx_margin = 12 * xmb->last_scale_factor; float x_position = video_width - entry_idx_margin; float y_position = video_height - entry_idx_margin; -#endif xmb_draw_text(xmb_shadows_enable, xmb, settings, xmb->entry_index_str, x_position, y_position, @@ -5734,26 +5711,11 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) /* Configure shadow effect */ if (xmb_shadows_enable) { -#if 0 - /* Drop shadow for thumbnails needs to be larger - * than for text/icons, and also needs to scale - * with screen dimensions */ - float shadow_offset = xmb->shadow_offset * 1.5f - * xmb->last_scale_factor; - if (shadow_offset <= xmb->shadow_offset) - shadow_offset = xmb->shadow_offset; - - thumbnail_shadow.type = GFX_THUMBNAIL_SHADOW_DROP; - thumbnail_shadow.alpha = GFX_SHADOW_ALPHA; - thumbnail_shadow.drop.x_offset = shadow_offset; - thumbnail_shadow.drop.y_offset = shadow_offset; -#else thumbnail_shadow.type = GFX_THUMBNAIL_SHADOW_OUTLINE; thumbnail_shadow.alpha = 0.50f; thumbnail_shadow.outline.width = 2 * xmb->last_scale_factor; if (thumbnail_shadow.outline.width < 1) thumbnail_shadow.outline.width = 1; -#endif } else thumbnail_shadow.type = GFX_THUMBNAIL_SHADOW_NONE; diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 77d799f132..8a8513fcb9 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -2385,18 +2385,6 @@ static bool menu_driver_displaylist_push_internal( menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); -#if 0 -#ifdef HAVE_SCREENSHOTS - if (!retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) - menu_entries_append(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_TAKE_SCREENSHOT), - msg_hash_to_str(MENU_ENUM_LABEL_TAKE_SCREENSHOT), - MENU_ENUM_LABEL_TAKE_SCREENSHOT, - MENU_SETTING_ACTION_SCREENSHOT, 0, 0, NULL); - else - info->flags |= MD_FLAG_NEED_PUSH_NO_PLAYLIST_ENTRIES; -#endif -#endif menu_displaylist_ctl(DISPLAYLIST_IMAGES_HISTORY, info, settings); return true; } @@ -3591,14 +3579,6 @@ bool rarch_menu_init( } #endif -#if 0 - /* TODO: No reason to do this here since shaders need - * content, and this is called in content_load() */ -#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) - menu_shader_manager_init(); -#endif -#endif - return true; } diff --git a/retroarch.c b/retroarch.c index bacf7ab314..44ec096c11 100644 --- a/retroarch.c +++ b/retroarch.c @@ -6407,17 +6407,6 @@ error: return false; } -#if 0 -static bool retroarch_is_on_main_thread(shtread_tls_t *tls) -{ -#ifdef HAVE_THREAD_STORAGE - return sthread_tls_get(tls) == MAGIC_POINTER; -#else - return true; -#endif -} -#endif - void retroarch_init_task_queue(void) { #ifdef HAVE_THREADS diff --git a/tasks/task_database.c b/tasks/task_database.c index 6a30ffde72..e31dc4569f 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -754,19 +754,7 @@ static int database_info_list_iterate_found_match( (hash = strchr(entry_path_str, '#'))) *hash = '\0'; -#if defined(RARCH_INTERNAL) -#if 0 - RARCH_LOG("Found match in database !\n"); - - RARCH_LOG("Path: %s\n", db_path); - RARCH_LOG("CRC : %s\n", db_crc); - RARCH_LOG("Playlist Path: %s\n", db_playlist_path); - RARCH_LOG("Entry Path: %s\n", entry_path); - RARCH_LOG("Playlist not NULL: %d\n", playlist != NULL); - RARCH_LOG("ZIP entry: %s\n", archive_name); - RARCH_LOG("entry path str: %s\n", entry_path_str); -#endif -#else +#if !defined(RARCH_INTERNAL) fprintf(stderr, "Found match in database !\n"); fprintf(stderr, "Path: %s\n", db_path); @@ -915,10 +903,6 @@ static int task_database_iterate_crc_lookup( if (db_info_entry && db_info_entry->crc32) { -#if 0 - RARCH_LOG("CRC32: 0x%08X , entry CRC32: 0x%08X (%s).\n", - db_state->crc, db_info_entry->crc32, db_info_entry->name); -#endif if (db_state->archive_crc == db_info_entry->crc32) return database_info_list_iterate_found_match( _db, @@ -1051,11 +1035,6 @@ static int task_database_iterate_serial_lookup( if (db_info_entry && db_info_entry->serial) { -#if 0 - RARCH_LOG("serial: %s , entry serial: %s (%s).\n", - db_state->serial, db_info_entry->serial, - db_info_entry->name); -#endif if (string_is_equal(db_state->serial, db_info_entry->serial)) return database_info_list_iterate_found_match(_db, db_state, db, NULL); diff --git a/tasks/task_movie.c b/tasks/task_movie.c index dd26b2f495..c890b73927 100644 --- a/tasks/task_movie.c +++ b/tasks/task_movie.c @@ -84,16 +84,16 @@ static bool bsv_movie_init_playback( RARCH_ERR("%s\n", msg_hash_to_str(MSG_MOVIE_FILE_IS_NOT_A_VALID_REPLAY_FILE)); return false; } - /* +#if 0 if (swap_if_big32(header[VERSION_INDEX]) > REPLAY_FORMAT_VERSION) { RARCH_ERR("%s\n", msg_hash_to_str(MSG_MOVIE_FILE_IS_NOT_A_VALID_REPLAY_FILE)); return false; } - */ +#endif - state_size = swap_if_big32(header[STATE_SIZE_INDEX]); - identifier_loc = (int64_t *)(header+IDENTIFIER_INDEX); + state_size = swap_if_big32(header[STATE_SIZE_INDEX]); + identifier_loc = (int64_t *)(header+IDENTIFIER_INDEX); handle->identifier = swap_if_big64(*identifier_loc); #if 0 diff --git a/tasks/task_overlay.c b/tasks/task_overlay.c index e6c778af98..06fd00a74d 100644 --- a/tasks/task_overlay.c +++ b/tasks/task_overlay.c @@ -592,9 +592,7 @@ static void task_overlay_deferred_loading(retro_task_t *task) case OVERLAY_IMAGE_TRANSFER_NONE: case OVERLAY_IMAGE_TRANSFER_BUSY: loader->loading_status = OVERLAY_IMAGE_TRANSFER_DONE; -#if 0 - break; -#endif + /* fall-through */ case OVERLAY_IMAGE_TRANSFER_DONE: task_overlay_image_done(&loader->overlays[loader->pos]); loader->loading_status = OVERLAY_IMAGE_TRANSFER_DESC_IMAGE_ITERATE; diff --git a/ui/drivers/ui_qt.cpp b/ui/drivers/ui_qt.cpp index 9b370e74b6..3711d4c36e 100644 --- a/ui/drivers/ui_qt.cpp +++ b/ui/drivers/ui_qt.cpp @@ -4005,22 +4005,11 @@ static void* ui_window_qt_init(void) static void ui_window_qt_destroy(void *data) { /* TODO/FIXME - implement? */ -#if 0 - ui_window_qt_t *window = (ui_window_qt_t*)data; - - delete window->qtWindow; -#endif } static void ui_window_qt_set_focused(void *data) { /* TODO/FIXME - implement */ -#if 0 - ui_window_qt_t *window = (ui_window_qt_t*)data; - - window->qtWindow->raise(); - window->qtWindow->activateWindow(); -#endif } static void ui_window_qt_set_visible(void *data, @@ -4032,32 +4021,17 @@ static void ui_window_qt_set_visible(void *data, static void ui_window_qt_set_title(void *data, char *buf) { /* TODO/FIXME - implement? */ -#if 0 - ui_window_qt_t *window = (ui_window_qt_t*)data; - - window->qtWindow->setWindowTitle(QString::fromUtf8(buf)); -#endif } static void ui_window_qt_set_droppable(void *data, bool droppable) { /* TODO/FIXME - implement */ -#if 0 - ui_window_qt_t *window = (ui_window_qt_t*)data; - - window->qtWindow->setAcceptDrops(droppable); -#endif } static bool ui_window_qt_focused(void *data) { /* TODO/FIXME - implement? */ -#if 0 - ui_window_qt_t *window = (ui_window_qt_t*)data; - return window->qtWindow->isActiveWindow() && !window->qtWindow->isMinimized(); -#else return true; -#endif } static ui_window_t ui_window_qt = {