mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Refactor video_driver_cached_frame_has_valid_framebuffer
This commit is contained in:
parent
3737b99b05
commit
e70eb9ded2
@ -376,6 +376,7 @@ void rcheevos_award_achievement(rcheevos_locals_t* locals,
|
||||
|
||||
if (shotname)
|
||||
{
|
||||
video_driver_state_t *video_st = video_state_get_ptr();;
|
||||
snprintf(shotname, shotname_len, "%s/%s-cheevo-%u",
|
||||
settings->paths.directory_screenshot,
|
||||
path_basename(path_get(RARCH_PATH_BASENAME)),
|
||||
@ -383,9 +384,11 @@ void rcheevos_award_achievement(rcheevos_locals_t* locals,
|
||||
shotname[shotname_len - 1] = '\0';
|
||||
|
||||
if (take_screenshot(settings->paths.directory_screenshot,
|
||||
shotname, true,
|
||||
video_driver_cached_frame_has_valid_framebuffer(),
|
||||
false, true))
|
||||
shotname,
|
||||
true,
|
||||
video_st->frame_cache_data && (video_st->frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID),
|
||||
false,
|
||||
true))
|
||||
CHEEVOS_LOG(RCHEEVOS_TAG
|
||||
"Captured screenshot for achievement %u\n",
|
||||
cheevo->id);
|
||||
|
@ -551,17 +551,17 @@ static void bottom_menu_control(void* data, bool lcd_bottom)
|
||||
BIT64_SET(lifecycle_state, RARCH_MENU_TOGGLE);
|
||||
break;
|
||||
case CTR_BOTTOM_MENU_SELECT:
|
||||
if (state_tmp_touch.px > 8 &&
|
||||
state_tmp_touch.px < 164 &&
|
||||
state_tmp_touch.py > 9 &&
|
||||
state_tmp_touch.py < 86)
|
||||
if ( (state_tmp_touch.px > 8)
|
||||
&& (state_tmp_touch.px < 164)
|
||||
&& (state_tmp_touch.py > 9)
|
||||
&& (state_tmp_touch.py < 86))
|
||||
{
|
||||
BIT64_SET(lifecycle_state, RARCH_MENU_TOGGLE);
|
||||
}
|
||||
else if (state_tmp_touch.px > 8 &&
|
||||
state_tmp_touch.px < 164 &&
|
||||
state_tmp_touch.py > 99 &&
|
||||
state_tmp_touch.py < 230)
|
||||
else if ((state_tmp_touch.px > 8)
|
||||
&& (state_tmp_touch.px < 164)
|
||||
&& (state_tmp_touch.py > 99)
|
||||
&& (state_tmp_touch.py < 230))
|
||||
{
|
||||
|
||||
struct ctr_bottom_texture_data *o =
|
||||
@ -604,23 +604,27 @@ static void bottom_menu_control(void* data, bool lcd_bottom)
|
||||
if (settings->bools.savestate_thumbnail_enable)
|
||||
{
|
||||
char screenshot_full_path[PATH_MAX_LENGTH];
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
fill_pathname_join_special(screenshot_full_path,
|
||||
dir_get_ptr(RARCH_DIR_SAVESTATE),
|
||||
ctr_texture_path(CTR_TEXTURE_STATE_THUMBNAIL),
|
||||
sizeof(screenshot_full_path));
|
||||
|
||||
take_screenshot(NULL, screenshot_full_path, true,
|
||||
video_driver_cached_frame_has_valid_framebuffer(),
|
||||
true, true);
|
||||
take_screenshot(NULL,
|
||||
screenshot_full_path,
|
||||
true,
|
||||
video_st->frame_cache_data && (video_st->frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID),
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
BIT64_SET(lifecycle_state, RARCH_MENU_TOGGLE);
|
||||
}
|
||||
else if (
|
||||
state_tmp_touch.px > 176
|
||||
&& state_tmp_touch.px < 311
|
||||
&& state_tmp_touch.py > 9
|
||||
&& state_tmp_touch.py < 230
|
||||
(state_tmp_touch.px > 176)
|
||||
&& (state_tmp_touch.px < 311)
|
||||
&& (state_tmp_touch.py > 9)
|
||||
&& (state_tmp_touch.py < 230)
|
||||
&& ctr->state_data_exist)
|
||||
{
|
||||
if (!command_event(CMD_EVENT_LOAD_STATE_FROM_RAM, NULL))
|
||||
|
@ -2838,9 +2838,9 @@ bool video_context_driver_set_flags(gfx_ctx_flags_t *flags)
|
||||
enum gfx_ctx_api video_context_driver_get_api(void)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
enum gfx_ctx_api ctx_api = video_st->context_data ?
|
||||
video_st->current_video_context.get_api(
|
||||
video_st->context_data) : GFX_CTX_NONE;
|
||||
enum gfx_ctx_api ctx_api = video_st->context_data
|
||||
? video_st->current_video_context.get_api(video_st->context_data)
|
||||
: GFX_CTX_NONE;
|
||||
|
||||
if (ctx_api == GFX_CTX_NONE)
|
||||
{
|
||||
@ -2890,15 +2890,6 @@ bool video_driver_has_windowed(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool video_driver_cached_frame_has_valid_framebuffer(void)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
if (video_st->frame_cache_data)
|
||||
return (video_st->frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool video_shader_driver_get_current_shader(video_shader_ctx_t *shader)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
|
@ -898,8 +898,6 @@ bool video_driver_has_windowed(void);
|
||||
|
||||
bool video_driver_has_focus(void);
|
||||
|
||||
bool video_driver_cached_frame_has_valid_framebuffer(void);
|
||||
|
||||
void video_driver_set_stub_frame(void);
|
||||
|
||||
void video_driver_unset_stub_frame(void);
|
||||
|
10
retroarch.c
10
retroarch.c
@ -2624,10 +2624,14 @@ bool command_event(enum event_command cmd, void *data)
|
||||
case CMD_EVENT_TAKE_SCREENSHOT:
|
||||
#ifdef HAVE_SCREENSHOTS
|
||||
{
|
||||
const char *dir_screenshot = settings->paths.directory_screenshot;
|
||||
const char *dir_screenshot = settings->paths.directory_screenshot;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
if (!take_screenshot(dir_screenshot,
|
||||
path_get(RARCH_PATH_BASENAME), false,
|
||||
video_driver_cached_frame_has_valid_framebuffer(), false, true))
|
||||
path_get(RARCH_PATH_BASENAME),
|
||||
false,
|
||||
video_st->frame_cache_data && (video_st->frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID),
|
||||
false,
|
||||
true))
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -5573,8 +5573,11 @@ static enum runloop_state_enum runloop_check_state(
|
||||
|
||||
/* Take a screenshot before we exit. */
|
||||
if (!take_screenshot(settings->paths.directory_screenshot,
|
||||
screenshot_path, false,
|
||||
video_driver_cached_frame_has_valid_framebuffer(), fullpath, false))
|
||||
screenshot_path,
|
||||
false,
|
||||
video_st->frame_cache_data && (video_st->frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID),
|
||||
fullpath,
|
||||
false))
|
||||
{
|
||||
RARCH_ERR("Could not take a screenshot before exiting.\n");
|
||||
}
|
||||
|
@ -882,6 +882,7 @@ static bool task_push_undo_save_state(const char *path, void *data, size_t size)
|
||||
{
|
||||
settings_t *settings;
|
||||
retro_task_t *task = task_init();
|
||||
video_driver_state_t *video_st= video_state_get_ptr();
|
||||
save_task_state_t *state = (save_task_state_t*)
|
||||
calloc(1, sizeof(*state));
|
||||
|
||||
@ -895,7 +896,7 @@ static bool task_push_undo_save_state(const char *path, void *data, size_t size)
|
||||
state->size = size;
|
||||
state->flags |= SAVE_TASK_FLAG_UNDO_SAVE;
|
||||
state->state_slot = settings->ints.state_slot;
|
||||
if (video_driver_cached_frame_has_valid_framebuffer())
|
||||
if (video_st->frame_cache_data && (video_st->frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID))
|
||||
state->flags |= SAVE_TASK_FLAG_HAS_VALID_FB;
|
||||
#if defined(HAVE_ZLIB)
|
||||
if (settings->bools.savestate_file_compression)
|
||||
@ -1437,6 +1438,7 @@ static void task_push_save_state(const char *path, void *data, size_t size, bool
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
retro_task_t *task = task_init();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
save_task_state_t *state = (save_task_state_t*)calloc(1, sizeof(*state));
|
||||
|
||||
if (!task || !state)
|
||||
@ -1458,7 +1460,7 @@ static void task_push_save_state(const char *path, void *data, size_t size, bool
|
||||
state->flags |= SAVE_TASK_FLAG_THUMBNAIL_ENABLE;
|
||||
}
|
||||
state->state_slot = settings->ints.state_slot;
|
||||
if (video_driver_cached_frame_has_valid_framebuffer())
|
||||
if (video_st->frame_cache_data && (video_st->frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID))
|
||||
state->flags |= SAVE_TASK_FLAG_HAS_VALID_FB;
|
||||
#if defined(HAVE_ZLIB)
|
||||
if (settings->bools.savestate_file_compression)
|
||||
@ -1534,9 +1536,10 @@ static void content_load_and_save_state_cb(retro_task_t *task,
|
||||
static void task_push_load_and_save_state(const char *path, void *data,
|
||||
size_t size, bool load_to_backup_buffer, bool autosave)
|
||||
{
|
||||
retro_task_t *task = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
save_task_state_t *state = (save_task_state_t*)
|
||||
retro_task_t *task = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
save_task_state_t *state = (save_task_state_t*)
|
||||
calloc(1, sizeof(*state));
|
||||
|
||||
if (!state)
|
||||
@ -1561,7 +1564,7 @@ static void task_push_load_and_save_state(const char *path, void *data,
|
||||
if (load_to_backup_buffer)
|
||||
state->flags |= SAVE_TASK_FLAG_MUTE;
|
||||
state->state_slot = settings->ints.state_slot;
|
||||
if (video_driver_cached_frame_has_valid_framebuffer())
|
||||
if (video_st->frame_cache_data && (video_st->frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID))
|
||||
state->flags |= SAVE_TASK_FLAG_HAS_VALID_FB;
|
||||
#if defined(HAVE_ZLIB)
|
||||
if (settings->bools.savestate_file_compression)
|
||||
@ -1748,9 +1751,10 @@ void content_wait_for_load_state_task(void)
|
||||
bool content_load_state(const char *path,
|
||||
bool load_to_backup_buffer, bool autoload)
|
||||
{
|
||||
retro_task_t *task = NULL;
|
||||
save_task_state_t *state = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
retro_task_t *task = NULL;
|
||||
save_task_state_t *state = NULL;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!core_info_current_supports_savestate())
|
||||
{
|
||||
@ -1771,7 +1775,7 @@ bool content_load_state(const char *path,
|
||||
if (autoload)
|
||||
state->flags |= SAVE_TASK_FLAG_AUTOLOAD;
|
||||
state->state_slot = settings->ints.state_slot;
|
||||
if (video_driver_cached_frame_has_valid_framebuffer())
|
||||
if (video_st->frame_cache_data && (video_st->frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID))
|
||||
state->flags |= SAVE_TASK_FLAG_HAS_VALID_FB;
|
||||
#if defined(HAVE_ZLIB)
|
||||
if (settings->bools.savestate_file_compression)
|
||||
|
Loading…
x
Reference in New Issue
Block a user