mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-26 05:16:18 +00:00
Use common rarch_take_screenshot in RGUI.
Adds GPU screenshot support from RGUI by rendering a clean frame then taking screenshot. Should also fix screenshot crash when using GL cores. Always uses g_settings.screenshot_directory path. I didn't see the purpose of the RARCH_CONSOLE #ifdef. Probably a Wii hack from way back ...
This commit is contained in:
parent
a58eddae65
commit
312154d110
@ -993,25 +993,15 @@ static int rgui_settings_toggle_setting(rgui_handle_t *rgui, unsigned setting, r
|
||||
case RGUI_SETTINGS_SCREENSHOT:
|
||||
if (action == RGUI_ACTION_OK)
|
||||
{
|
||||
const void *data = g_extern.frame_cache.data;
|
||||
unsigned width = g_extern.frame_cache.width;
|
||||
unsigned height = g_extern.frame_cache.height;
|
||||
int pitch = g_extern.frame_cache.pitch;
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
const char *screenshot_dir = default_paths.port_dir;
|
||||
#else
|
||||
const char *screenshot_dir = g_settings.screenshot_directory;
|
||||
#endif
|
||||
|
||||
// Negative pitch is needed as screenshot takes bottom-up,
|
||||
// but we use top-down.
|
||||
bool r = screenshot_dump(screenshot_dir,
|
||||
(const uint8_t*)data + (height - 1) * pitch,
|
||||
width, height, -pitch, false);
|
||||
|
||||
msg_queue_push(g_extern.msg_queue,
|
||||
r ? "Screenshot saved." : "Screenshot failed to save.", 1, 90);
|
||||
// Render a clean frame to avoid taking screnshot of RGUI.
|
||||
if (g_settings.video.gpu_screenshot)
|
||||
{
|
||||
if (driver.video_poke && driver.video_poke->set_texture_enable)
|
||||
driver.video_poke->set_texture_enable(driver.video_data, false, false);
|
||||
if (driver.video)
|
||||
rarch_render_cached_frame();
|
||||
}
|
||||
rarch_take_screenshot();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
@ -680,6 +680,7 @@ void rarch_disk_control_set_index(unsigned index);
|
||||
void rarch_disk_control_append_image(const char *path);
|
||||
void rarch_init_autosave(void);
|
||||
void rarch_deinit_autosave(void);
|
||||
void rarch_take_screenshot(void);
|
||||
|
||||
void rarch_load_state(void);
|
||||
void rarch_save_state(void);
|
||||
|
@ -119,7 +119,7 @@ static bool take_screenshot_raw(void)
|
||||
width, height, -pitch, false);
|
||||
}
|
||||
|
||||
static void take_screenshot(void)
|
||||
void rarch_take_screenshot(void)
|
||||
{
|
||||
if (!(*g_settings.screenshot_directory))
|
||||
return;
|
||||
@ -2540,7 +2540,7 @@ static void check_screenshot(void)
|
||||
static bool old_pressed;
|
||||
bool pressed = input_key_pressed_func(RARCH_SCREENSHOT);
|
||||
if (pressed && !old_pressed)
|
||||
take_screenshot();
|
||||
rarch_take_screenshot();
|
||||
|
||||
old_pressed = pressed;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user