mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 13:20:30 +00:00
(record_driver.c/screenshot.c) Updates
This commit is contained in:
parent
1d7c1ec23b
commit
25466ea19f
@ -83,10 +83,6 @@
|
||||
|
||||
#define TERM_STR "\n"
|
||||
|
||||
#define RETRO_MSG_INIT_RECORDING_SKIPPED "Using libretro dummy core. Skipping recording."
|
||||
#define RETRO_MSG_INIT_RECORDING_FAILED "Failed to start recording."
|
||||
#define RETRO_MSG_TAKE_SCREENSHOT "Taking screenshot."
|
||||
#define RETRO_MSG_TAKE_SCREENSHOT_FAILED "Failed to take screenshot."
|
||||
#define RETRO_MSG_TAKE_SCREENSHOT_ERROR "Cannot take screenshot. GPU rendering is used and read_viewport is not supported."
|
||||
#define RETRO_MSG_AUDIO_WRITE_FAILED "Audio backend failed to write. Will continue without sound."
|
||||
#define RETRO_MSG_MOVIE_STARTED_INIT_NETPLAY_FAILED "Movie playback has started. Cannot start netplay."
|
||||
@ -101,7 +97,6 @@
|
||||
#define RETRO_MSG_REWIND_INIT_FAILED_NO_SAVESTATES "Implementation does not support save states. Cannot use rewind."
|
||||
#define RETRO_MSG_REWIND_INIT_FAILED_THREADED_AUDIO "Implementation uses threaded audio. Cannot use rewind."
|
||||
|
||||
#define RETRO_LOG_INIT_RECORDING_SKIPPED RETRO_MSG_INIT_RECORDING_SKIPPED TERM_STR
|
||||
#define RETRO_LOG_INIT_RECORDING_FAILED RETRO_MSG_INIT_RECORDING_FAILED TERM_STR
|
||||
#define RETRO_LOG_TAKE_SCREENSHOT RETRO_MSG_TAKE_SCREENSHOT TERM_STR
|
||||
#define RETRO_LOG_TAKE_SCREENSHOT_FAILED RETRO_MSG_TAKE_SCREENSHOT_FAILED TERM_STR
|
||||
|
@ -20,6 +20,26 @@ const char *msg_hash_to_str_us(uint32_t hash)
|
||||
{
|
||||
switch (hash)
|
||||
{
|
||||
case MSG_CUSTOM_TIMING_GIVEN:
|
||||
return "Custom timing given";
|
||||
case MSG_VIEWPORT_SIZE_CALCULATION_FAILED:
|
||||
return "Viewport size calculation failed! Will continue using raw data. This will probably not work right ...";
|
||||
case MSG_HW_RENDERED_MUST_USE_POSTSHADED_RECORDING:
|
||||
return "Libretro core is hardware rendered. Must use post-shaded recording as well.";
|
||||
case MSG_RECORDING_TO:
|
||||
return "Recording to";
|
||||
case MSG_DETECTED_VIEWPORT_OF:
|
||||
return "Detected viewport of";
|
||||
case MSG_TAKING_SCREENSHOT:
|
||||
return "Taking screenshot.";
|
||||
case MSG_FAILED_TO_TAKE_SCREENSHOT:
|
||||
return "Failed to take screenshot.";
|
||||
case MSG_FAILED_TO_START_RECORDING:
|
||||
return "Failed to start recording.";
|
||||
case MSG_RECORDING_TERMINATED_DUE_TO_RESIZE:
|
||||
return "Recording terminated due to resize.";
|
||||
case MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED:
|
||||
return "Using libretro dummy core. Skipping recording.";
|
||||
case MSG_UNKNOWN:
|
||||
return "Unknown";
|
||||
case MSG_LOADING_CONTENT_FILE:
|
||||
|
14
msg_hash.h
14
msg_hash.h
@ -27,6 +27,20 @@
|
||||
|
||||
#define MSG_LOADING_CONTENT_FILE 0x236398dcU
|
||||
|
||||
#define MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED 0x9e8a1febU
|
||||
#define MSG_RECORDING_TERMINATED_DUE_TO_RESIZE 0x361a07feU
|
||||
#define MSG_FAILED_TO_START_RECORDING 0x90c3e2d5U
|
||||
|
||||
#define MSG_DETECTED_VIEWPORT_OF 0xdf7002baU
|
||||
#define MSG_RECORDING_TO 0x189fd324U
|
||||
#define MSG_HW_RENDERED_MUST_USE_POSTSHADED_RECORDING 0x7f9f7659U
|
||||
#define MSG_VIEWPORT_SIZE_CALCULATION_FAILED 0x9da84911U
|
||||
|
||||
#define MSG_TAKING_SCREENSHOT 0xdcfda0e0U
|
||||
#define MSG_FAILED_TO_TAKE_SCREENSHOT 0x7a480a2dU
|
||||
|
||||
#define MSG_CUSTOM_TIMING_GIVEN 0x259c95dfU
|
||||
|
||||
#define MSG_SAVING_STATE 0xe4f3eb4dU
|
||||
#define MSG_LOADING_STATE 0x68d8d483U
|
||||
#define MSG_FAILED_TO_SAVE_STATE_TO 0xcc005f3cU
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "../intl/intl.h"
|
||||
#include "../gfx/video_driver.h"
|
||||
#include "../gfx/video_viewport.h"
|
||||
#include "../msg_hash.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
@ -121,22 +122,22 @@ void find_record_driver(void)
|
||||
int i = find_driver_index("record_driver", settings->record.driver);
|
||||
|
||||
if (i >= 0)
|
||||
driver->recording = (const record_driver_t*)audio_driver_find_handle(i);
|
||||
driver->recording = (const record_driver_t*)record_driver_find_handle(i);
|
||||
else
|
||||
{
|
||||
unsigned d;
|
||||
|
||||
RARCH_ERR("Couldn't find any audio driver named \"%s\"\n",
|
||||
RARCH_ERR("Couldn't find any record driver named \"%s\"\n",
|
||||
settings->audio.driver);
|
||||
RARCH_LOG_OUTPUT("Available audio drivers are:\n");
|
||||
for (d = 0; audio_driver_find_handle(d); d++)
|
||||
RARCH_LOG_OUTPUT("Available record drivers are:\n");
|
||||
for (d = 0; record_driver_find_handle(d); d++)
|
||||
RARCH_LOG_OUTPUT("\t%s\n", record_driver_find_ident(d));
|
||||
RARCH_WARN("Going to default to first audio driver...\n");
|
||||
RARCH_WARN("Going to default to first record driver...\n");
|
||||
|
||||
driver->audio = (const audio_driver_t*)audio_driver_find_handle(0);
|
||||
driver->recording = (const record_driver_t*)record_driver_find_handle(0);
|
||||
|
||||
if (!driver->audio)
|
||||
rarch_fail(1, "find_audio_driver()");
|
||||
if (!driver->recording)
|
||||
rarch_fail(1, "find_record_driver()");
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,7 +217,8 @@ void recording_dump_frame(const void *data, unsigned width,
|
||||
|
||||
if (!vp.width || !vp.height)
|
||||
{
|
||||
RARCH_WARN("Viewport size calculation failed! Will continue using raw data. This will probably not work right ...\n");
|
||||
RARCH_WARN("%s \n",
|
||||
msg_hash_to_str(MSG_VIEWPORT_SIZE_CALCULATION_FAILED));
|
||||
event_command(EVENT_CMD_GPU_RECORD_DEINIT);
|
||||
|
||||
recording_dump_frame(data, width, height, pitch);
|
||||
@ -227,10 +229,9 @@ void recording_dump_frame(const void *data, unsigned width,
|
||||
if (vp.width != global->record.gpu_width ||
|
||||
vp.height != global->record.gpu_height)
|
||||
{
|
||||
static const char msg[] = "Recording terminated due to resize.";
|
||||
RARCH_WARN("%s\n", msg);
|
||||
RARCH_WARN("%s\n", msg_hash_to_str(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE));
|
||||
|
||||
rarch_main_msg_queue_push(msg, 1, 180, true);
|
||||
rarch_main_msg_queue_push_new(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE, 1, 180, true);
|
||||
event_command(EVENT_CMD_RECORD_DEINIT);
|
||||
return;
|
||||
}
|
||||
@ -301,17 +302,18 @@ bool recording_init(void)
|
||||
|
||||
if (global->core_type == CORE_TYPE_DUMMY)
|
||||
{
|
||||
RARCH_WARN(RETRO_LOG_INIT_RECORDING_SKIPPED);
|
||||
RARCH_WARN(msg_hash_to_str(MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!settings->video.gpu_record && hw_render->context_type)
|
||||
{
|
||||
RARCH_WARN("Libretro core is hardware rendered. Must use post-shaded recording as well.\n");
|
||||
RARCH_WARN("%s.\n", msg_hash_to_str(MSG_HW_RENDERED_MUST_USE_POSTSHADED_RECORDING));
|
||||
return false;
|
||||
}
|
||||
|
||||
RARCH_LOG("Custom timing given: FPS: %.4f, Sample rate: %.4f\n",
|
||||
RARCH_LOG("%s: FPS: %.4f, Sample rate: %.4f\n",
|
||||
msg_hash_to_str(MSG_CUSTOM_TIMING_GIVEN),
|
||||
(float)av_info->timing.fps,
|
||||
(float)av_info->timing.sample_rate);
|
||||
|
||||
@ -365,15 +367,12 @@ bool recording_init(void)
|
||||
global->record.gpu_width = vp.width;
|
||||
global->record.gpu_height = vp.height;
|
||||
|
||||
RARCH_LOG("Detected viewport of %u x %u\n",
|
||||
RARCH_LOG("%s %u x %u\n", msg_hash_to_str(MSG_DETECTED_VIEWPORT_OF),
|
||||
vp.width, vp.height);
|
||||
|
||||
global->record.gpu_buffer = (uint8_t*)malloc(vp.width * vp.height * 3);
|
||||
if (!global->record.gpu_buffer)
|
||||
{
|
||||
RARCH_ERR("Failed to allocate GPU record buffer.\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -407,7 +406,8 @@ bool recording_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
RARCH_LOG("Recording to %s @ %ux%u. (FB size: %ux%u pix_fmt: %u)\n",
|
||||
RARCH_LOG("%s %s @ %ux%u. (FB size: %ux%u pix_fmt: %u)\n",
|
||||
msg_hash_to_str(MSG_RECORDING_TO),
|
||||
global->record.path,
|
||||
params.out_width, params.out_height,
|
||||
params.fb_width, params.fb_height,
|
||||
@ -415,7 +415,7 @@ bool recording_init(void)
|
||||
|
||||
if (!record_driver_init_first(&driver->recording, &driver->recording_data, ¶ms))
|
||||
{
|
||||
RARCH_ERR(RETRO_LOG_INIT_RECORDING_FAILED);
|
||||
RARCH_ERR(msg_hash_to_str(MSG_FAILED_TO_START_RECORDING));
|
||||
event_command(EVENT_CMD_GPU_RECORD_DEINIT);
|
||||
|
||||
return false;
|
||||
|
12
screenshot.c
12
screenshot.c
@ -35,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
#include "general.h"
|
||||
#include "intl/intl.h"
|
||||
#include "msg_hash.h"
|
||||
#include "gfx/scaler/scaler.h"
|
||||
#include "retroarch.h"
|
||||
#include "runloop.h"
|
||||
@ -316,20 +316,20 @@ bool take_screenshot(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_ERR(RETRO_LOG_TAKE_SCREENSHOT_ERROR);
|
||||
RARCH_ERR("%s.\n", msg_hash_to_str(MSG_FAILED_TO_TAKE_SCREENSHOT));
|
||||
ret = false;
|
||||
}
|
||||
|
||||
|
||||
if (ret)
|
||||
{
|
||||
RARCH_LOG(RETRO_LOG_TAKE_SCREENSHOT);
|
||||
msg = RETRO_MSG_TAKE_SCREENSHOT;
|
||||
RARCH_LOG("%s.\n", msg_hash_to_str(MSG_TAKING_SCREENSHOT));
|
||||
msg = msg_hash_to_str(MSG_TAKING_SCREENSHOT);
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_WARN(RETRO_LOG_TAKE_SCREENSHOT_FAILED);
|
||||
msg = RETRO_MSG_TAKE_SCREENSHOT_FAILED;
|
||||
RARCH_WARN("%s.\n", msg_hash_to_str(MSG_FAILED_TO_TAKE_SCREENSHOT));
|
||||
msg = msg_hash_to_str(MSG_FAILED_TO_TAKE_SCREENSHOT);
|
||||
}
|
||||
|
||||
rarch_main_msg_queue_push(msg, 1, runloop->is_paused ? 1 : 180, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user