static bool runloop_check_pause_state(event_cmd_state_t *cmd) { bool check_is_oneshot = false; if (!cmd) return false; check_is_oneshot = runloop_cmd_triggered(cmd, RARCH_FRAMEADVANCE) || runloop_cmd_press(cmd, RARCH_REWIND); if (!runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL)) return true; if (runloop_cmd_triggered(cmd, RARCH_FULLSCREEN_TOGGLE_KEY)) { command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL); video_driver_cached_frame_render(); } if (!check_is_oneshot) return false; return true; }
static bool take_screenshot_choice(const char *global_name_base) { settings_t *settings = config_get_ptr(); /* No way to infer screenshot directory. */ if (string_is_empty(settings->directory.screenshot) && (!*global_name_base)) return false; if (video_driver_supports_viewport_read()) { /* Avoid taking screenshot of GUI overlays. */ video_driver_set_texture_enable(false, false); video_driver_cached_frame_render(); return take_screenshot_viewport(global_name_base); } if (!video_driver_cached_frame_has_valid_framebuffer()) return take_screenshot_raw(global_name_base); if (video_driver_supports_read_frame_raw()) { unsigned old_width, old_height; size_t old_pitch; bool ret = false; void *frame_data = NULL; const void* old_data = NULL; video_driver_cached_frame_get(&old_data, &old_width, &old_height, &old_pitch); frame_data = video_driver_read_frame_raw( &old_width, &old_height, &old_pitch); video_driver_cached_frame_set(old_data, old_width, old_height, old_pitch); if (frame_data) { video_driver_set_cached_frame_ptr(frame_data); if (take_screenshot_raw(global_name_base)) ret = true; free(frame_data); } return ret; } return false; }
bool menu_display_libretro(void) { video_driver_set_texture_enable(true, false); if (menu_display_libretro_running()) { if (!input_driver_is_libretro_input_blocked()) input_driver_set_libretro_input_blocked(); core_run(); input_driver_unset_libretro_input_blocked(); return true; } return video_driver_cached_frame_render(); }
/* Checks if slowmotion toggle/hold was being pressed and/or held. */ static bool runloop_check_slowmotion(bool *ptr) { settings_t *settings = config_get_ptr(); if (!ptr) return false; runloop_slowmotion = *ptr; if (!runloop_slowmotion) return false; if (settings->video.black_frame_insertion) video_driver_cached_frame_render(); if (state_manager_frame_is_reversed()) runloop_msg_queue_push(msg_hash_to_str(MSG_SLOW_MOTION_REWIND), 2, 30, true); else runloop_msg_queue_push(msg_hash_to_str(MSG_SLOW_MOTION), 2, 30, true); return true; }
/** * take_screenshot: * * Returns: true (1) if successful, otherwise false (0). **/ bool take_screenshot(void) { global_t *global = global_get_ptr(); char *name_base = strdup(global->name.base); bool is_paused = runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL); bool ret = take_screenshot_choice(name_base); const char *msg_screenshot = ret ? msg_hash_to_str(MSG_TAKING_SCREENSHOT) : msg_hash_to_str(MSG_FAILED_TO_TAKE_SCREENSHOT); const char *msg = msg_screenshot; free(name_base); runloop_msg_queue_push(msg, 1, is_paused ? 1 : 180, true); if (is_paused) video_driver_cached_frame_render(); return ret; }