mirror of
https://github.com/libretro/RetroArch
synced 2025-02-09 00:40:09 +00:00
Merge branch 'master' of https://github.com/libretro/RetroArch
This commit is contained in:
commit
22d2ed1dc3
@ -391,3 +391,21 @@ void init_audio(void)
|
||||
driver.audio->start(driver.audio_data);
|
||||
}
|
||||
}
|
||||
|
||||
bool audio_driver_mute_toggle(void)
|
||||
{
|
||||
if (!driver.audio_data || !driver.audio_active)
|
||||
return false;
|
||||
|
||||
g_settings.audio.mute_enable = !g_settings.audio.mute_enable;
|
||||
|
||||
if (g_settings.audio.mute_enable)
|
||||
rarch_main_command(RARCH_CMD_AUDIO_STOP);
|
||||
else if (!rarch_main_command(RARCH_CMD_AUDIO_START))
|
||||
{
|
||||
driver.audio_active = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -110,6 +110,8 @@ const void *audio_driver_find_handle(int index);
|
||||
**/
|
||||
const char *audio_driver_find_ident(int index);
|
||||
|
||||
bool audio_driver_mute_toggle(void);
|
||||
|
||||
/**
|
||||
* config_get_audio_driver_options:
|
||||
*
|
||||
|
@ -35,7 +35,7 @@ int database_open_cursor(libretrodb_t *db,
|
||||
libretrodb_query_t *q = NULL;
|
||||
|
||||
if (query)
|
||||
q = (libretrodb_query_t*)libretrodb_query_compile(db, query,
|
||||
q = libretrodb_query_compile(db, query,
|
||||
strlen(query), &error);
|
||||
|
||||
if (error)
|
||||
@ -66,7 +66,7 @@ int database_info_write_rdl(const char *dir)
|
||||
if (g_extern.core_info)
|
||||
exts = core_info_list_get_all_extensions(g_extern.core_info);
|
||||
|
||||
str_list = (struct string_list*)dir_list_new(dir, exts, false);
|
||||
str_list = dir_list_new(dir, exts, false);
|
||||
|
||||
if (!str_list)
|
||||
return -1;
|
||||
@ -147,7 +147,7 @@ database_info_list_t *database_info_list_new(const char *rdb_path, const char *q
|
||||
if (!database_info)
|
||||
goto error;
|
||||
|
||||
db_info = (database_info_t*)&database_info[i];
|
||||
db_info = &database_info[i];
|
||||
|
||||
db_info->name = NULL;
|
||||
db_info->description = NULL;
|
||||
@ -244,6 +244,7 @@ database_info_list_t *database_info_list_new(const char *rdb_path, const char *q
|
||||
|
||||
if (!strcmp(key->string.buff, "crc"))
|
||||
{
|
||||
size_t i;
|
||||
char crc32[PATH_MAX_LENGTH];
|
||||
|
||||
for (i = 0; i < val->binary.len; i++)
|
||||
@ -257,6 +258,7 @@ database_info_list_t *database_info_list_new(const char *rdb_path, const char *q
|
||||
|
||||
if (!strcmp(key->string.buff, "sha1"))
|
||||
{
|
||||
size_t i;
|
||||
char sha1[PATH_MAX_LENGTH];
|
||||
|
||||
for (i = 0; i < val->binary.len; i++)
|
||||
@ -270,6 +272,7 @@ database_info_list_t *database_info_list_new(const char *rdb_path, const char *q
|
||||
|
||||
if (!strcmp(key->string.buff, "md5"))
|
||||
{
|
||||
size_t i;
|
||||
char md5[PATH_MAX_LENGTH];
|
||||
|
||||
for (i = 0; i < val->binary.len; i++)
|
||||
@ -305,7 +308,7 @@ void database_info_list_free(database_info_list_t *database_info_list)
|
||||
|
||||
for (i = 0; i < database_info_list->count; i++)
|
||||
{
|
||||
database_info_t *info = (database_info_t*)&database_info_list->list[i];
|
||||
database_info_t *info = &database_info_list->list[i];
|
||||
|
||||
if (!info)
|
||||
continue;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "input/keyboard_line.h"
|
||||
#include "audio/audio_utils.h"
|
||||
#include "retroarch_logger.h"
|
||||
#include "record/record_driver.h"
|
||||
#include "intl/intl.h"
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
@ -85,8 +86,8 @@ static void video_frame_filter(const void *data,
|
||||
data, width, height, pitch);
|
||||
RARCH_PERFORMANCE_STOP(softfilter_process);
|
||||
|
||||
if (driver.recording_data && g_settings.video.post_filter_record)
|
||||
rarch_recording_dump_frame(g_extern.filter.buffer,
|
||||
if (g_settings.video.post_filter_record)
|
||||
recording_dump_frame(g_extern.filter.buffer,
|
||||
owidth, oheight, opitch);
|
||||
|
||||
data = g_extern.filter.buffer;
|
||||
@ -124,11 +125,11 @@ static void video_frame(const void *data, unsigned width,
|
||||
* but we really need to do processing before blocking on VSync
|
||||
* for best possible scheduling.
|
||||
*/
|
||||
if (driver.recording_data && (!g_extern.filter.filter
|
||||
if ((!g_extern.filter.filter
|
||||
|| !g_settings.video.post_filter_record || !data
|
||||
|| g_extern.record_gpu_buffer)
|
||||
)
|
||||
rarch_recording_dump_frame(data, width, height, pitch);
|
||||
recording_dump_frame(data, width, height, pitch);
|
||||
|
||||
msg = msg_queue_pull(g_extern.msg_queue);
|
||||
driver.current_msg = msg;
|
||||
|
@ -888,7 +888,7 @@ static int deferred_push_rdb_entry_detail(void *data, void *userdata,
|
||||
for (i = 0; i < db_info->count; i++)
|
||||
{
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
database_info_t *db_info_entry = (database_info_t*)&db_info->list[i];
|
||||
database_info_t *db_info_entry = &db_info->list[i];
|
||||
|
||||
if (!db_info_entry)
|
||||
continue;
|
||||
|
@ -335,18 +335,10 @@ end:
|
||||
menu_common_list_clear(list);
|
||||
}
|
||||
|
||||
|
||||
void menu_list_push(file_list_t *list,
|
||||
static void menu_list_insert(file_list_t *list,
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t directory_ptr)
|
||||
{
|
||||
if (!list)
|
||||
return;
|
||||
if (!label)
|
||||
return;
|
||||
|
||||
file_list_push(list, path, label, type, directory_ptr);
|
||||
|
||||
if (!driver.menu_ctx)
|
||||
return;
|
||||
|
||||
@ -356,6 +348,17 @@ void menu_list_push(file_list_t *list,
|
||||
menu_common_list_insert(list, path, label, type, list->size - 1);
|
||||
}
|
||||
|
||||
void menu_list_push(file_list_t *list,
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t directory_ptr)
|
||||
{
|
||||
if (!list || !label)
|
||||
return;
|
||||
|
||||
file_list_push(list, path, label, type, directory_ptr);
|
||||
menu_list_insert(list, path, label, type, directory_ptr);
|
||||
}
|
||||
|
||||
void menu_list_push_refresh(file_list_t *list,
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t directory_ptr)
|
||||
|
@ -17,7 +17,11 @@
|
||||
#include <string.h>
|
||||
#include "record_driver.h"
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../dynamic.h"
|
||||
#include "../general.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../intl/intl.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
@ -81,3 +85,222 @@ bool ffemu_init_first(const ffemu_backend_t **backend, void **data,
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void recording_dump_frame(const void *data, unsigned width,
|
||||
unsigned height, size_t pitch)
|
||||
{
|
||||
struct ffemu_video_data ffemu_data = {0};
|
||||
|
||||
if (!driver.recording_data)
|
||||
return;
|
||||
|
||||
ffemu_data.pitch = pitch;
|
||||
ffemu_data.width = width;
|
||||
ffemu_data.height = height;
|
||||
ffemu_data.data = data;
|
||||
|
||||
if (g_extern.record_gpu_buffer)
|
||||
{
|
||||
struct rarch_viewport vp = {0};
|
||||
|
||||
if (driver.video && driver.video->viewport_info)
|
||||
driver.video->viewport_info(driver.video_data, &vp);
|
||||
|
||||
if (!vp.width || !vp.height)
|
||||
{
|
||||
RARCH_WARN("Viewport size calculation failed! Will continue using raw data. This will probably not work right ...\n");
|
||||
rarch_main_command(RARCH_CMD_GPU_RECORD_DEINIT);
|
||||
|
||||
recording_dump_frame(data, width, height, pitch);
|
||||
return;
|
||||
}
|
||||
|
||||
/* User has resized. We kinda have a problem now. */
|
||||
if (vp.width != g_extern.record_gpu_width ||
|
||||
vp.height != g_extern.record_gpu_height)
|
||||
{
|
||||
static const char msg[] = "Recording terminated due to resize.";
|
||||
RARCH_WARN("%s\n", msg);
|
||||
msg_queue_clear(g_extern.msg_queue);
|
||||
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
|
||||
|
||||
rarch_main_command(RARCH_CMD_RECORD_DEINIT);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Big bottleneck.
|
||||
* Since we might need to do read-backs asynchronously,
|
||||
* it might take 3-4 times before this returns true. */
|
||||
if (driver.video && driver.video->read_viewport)
|
||||
if (!driver.video->read_viewport(driver.video_data,
|
||||
g_extern.record_gpu_buffer))
|
||||
return;
|
||||
|
||||
ffemu_data.pitch = g_extern.record_gpu_width * 3;
|
||||
ffemu_data.width = g_extern.record_gpu_width;
|
||||
ffemu_data.height = g_extern.record_gpu_height;
|
||||
ffemu_data.data = g_extern.record_gpu_buffer +
|
||||
(ffemu_data.height - 1) * ffemu_data.pitch;
|
||||
|
||||
ffemu_data.pitch = -ffemu_data.pitch;
|
||||
}
|
||||
|
||||
if (!g_extern.record_gpu_buffer)
|
||||
ffemu_data.is_dupe = !data;
|
||||
|
||||
if (driver.recording && driver.recording->push_video)
|
||||
driver.recording->push_video(driver.recording_data, &ffemu_data);
|
||||
}
|
||||
|
||||
bool recording_deinit(void)
|
||||
{
|
||||
if (!driver.recording_data || !driver.recording)
|
||||
return false;
|
||||
|
||||
if (driver.recording->finalize)
|
||||
driver.recording->finalize(driver.recording_data);
|
||||
|
||||
if (driver.recording->free)
|
||||
driver.recording->free(driver.recording_data);
|
||||
|
||||
driver.recording_data = NULL;
|
||||
driver.recording = NULL;
|
||||
|
||||
rarch_main_command(RARCH_CMD_GPU_RECORD_DEINIT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* recording_init:
|
||||
*
|
||||
* Initializes recording.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool recording_init(void)
|
||||
{
|
||||
struct ffemu_params params = {0};
|
||||
const struct retro_system_av_info *info = &g_extern.system.av_info;
|
||||
|
||||
if (!g_extern.recording_enable)
|
||||
return false;
|
||||
|
||||
if (g_extern.libretro_dummy)
|
||||
{
|
||||
RARCH_WARN(RETRO_LOG_INIT_RECORDING_SKIPPED);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!g_settings.video.gpu_record
|
||||
&& g_extern.system.hw_render_callback.context_type)
|
||||
{
|
||||
RARCH_WARN("Libretro core is hardware rendered. Must use post-shaded recording as well.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
RARCH_LOG("Custom timing given: FPS: %.4f, Sample rate: %.4f\n",
|
||||
(float)g_extern.system.av_info.timing.fps,
|
||||
(float)g_extern.system.av_info.timing.sample_rate);
|
||||
|
||||
params.out_width = info->geometry.base_width;
|
||||
params.out_height = info->geometry.base_height;
|
||||
params.fb_width = info->geometry.max_width;
|
||||
params.fb_height = info->geometry.max_height;
|
||||
params.channels = 2;
|
||||
params.filename = g_extern.record_path;
|
||||
params.fps = g_extern.system.av_info.timing.fps;
|
||||
params.samplerate = g_extern.system.av_info.timing.sample_rate;
|
||||
params.pix_fmt = (g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888) ?
|
||||
FFEMU_PIX_ARGB8888 : FFEMU_PIX_RGB565;
|
||||
params.config = NULL;
|
||||
|
||||
if (*g_extern.record_config)
|
||||
params.config = g_extern.record_config;
|
||||
|
||||
if (g_settings.video.gpu_record && driver.video->read_viewport)
|
||||
{
|
||||
struct rarch_viewport vp = {0};
|
||||
|
||||
if (driver.video && driver.video->viewport_info)
|
||||
driver.video->viewport_info(driver.video_data, &vp);
|
||||
|
||||
if (!vp.width || !vp.height)
|
||||
{
|
||||
RARCH_ERR("Failed to get viewport information from video driver. "
|
||||
"Cannot start recording ...\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
params.out_width = vp.width;
|
||||
params.out_height = vp.height;
|
||||
params.fb_width = next_pow2(vp.width);
|
||||
params.fb_height = next_pow2(vp.height);
|
||||
|
||||
if (g_settings.video.force_aspect &&
|
||||
(g_extern.system.aspect_ratio > 0.0f))
|
||||
params.aspect_ratio = g_extern.system.aspect_ratio;
|
||||
else
|
||||
params.aspect_ratio = (float)vp.width / vp.height;
|
||||
|
||||
params.pix_fmt = FFEMU_PIX_BGR24;
|
||||
g_extern.record_gpu_width = vp.width;
|
||||
g_extern.record_gpu_height = vp.height;
|
||||
|
||||
RARCH_LOG("Detected viewport of %u x %u\n",
|
||||
vp.width, vp.height);
|
||||
|
||||
g_extern.record_gpu_buffer = (uint8_t*)malloc(vp.width * vp.height * 3);
|
||||
if (!g_extern.record_gpu_buffer)
|
||||
{
|
||||
RARCH_ERR("Failed to allocate GPU record buffer.\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_extern.record_width || g_extern.record_height)
|
||||
{
|
||||
params.out_width = g_extern.record_width;
|
||||
params.out_height = g_extern.record_height;
|
||||
}
|
||||
|
||||
if (g_settings.video.force_aspect &&
|
||||
(g_extern.system.aspect_ratio > 0.0f))
|
||||
params.aspect_ratio = g_extern.system.aspect_ratio;
|
||||
else
|
||||
params.aspect_ratio = (float)params.out_width / params.out_height;
|
||||
|
||||
if (g_settings.video.post_filter_record && g_extern.filter.filter)
|
||||
{
|
||||
unsigned max_width = 0;
|
||||
unsigned max_height = 0;
|
||||
|
||||
if (g_extern.filter.out_rgb32)
|
||||
params.pix_fmt = FFEMU_PIX_ARGB8888;
|
||||
else
|
||||
params.pix_fmt = FFEMU_PIX_RGB565;
|
||||
|
||||
rarch_softfilter_get_max_output_size(g_extern.filter.filter,
|
||||
&max_width, &max_height);
|
||||
params.fb_width = next_pow2(max_width);
|
||||
params.fb_height = next_pow2(max_height);
|
||||
}
|
||||
}
|
||||
|
||||
RARCH_LOG("Recording to %s @ %ux%u. (FB size: %ux%u pix_fmt: %u)\n",
|
||||
g_extern.record_path,
|
||||
params.out_width, params.out_height,
|
||||
params.fb_width, params.fb_height,
|
||||
(unsigned)params.pix_fmt);
|
||||
|
||||
if (!ffemu_init_first(&driver.recording, &driver.recording_data, ¶ms))
|
||||
{
|
||||
RARCH_ERR(RETRO_LOG_INIT_RECORDING_FAILED);
|
||||
rarch_main_command(RARCH_CMD_GPU_RECORD_DEINIT);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -117,6 +117,20 @@ const ffemu_backend_t *ffemu_find_backend(const char *ident);
|
||||
bool ffemu_init_first(const ffemu_backend_t **backend, void **data,
|
||||
const struct ffemu_params *params);
|
||||
|
||||
void recording_dump_frame(const void *data, unsigned width,
|
||||
unsigned height, size_t pitch);
|
||||
|
||||
bool recording_deinit(void);
|
||||
|
||||
/**
|
||||
* recording_init:
|
||||
*
|
||||
* Initializes recording.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool recording_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
230
retroarch.c
230
retroarch.c
@ -40,6 +40,8 @@
|
||||
#include "input/keyboard_line.h"
|
||||
#include "input/input_remapping.h"
|
||||
|
||||
#include "record/record_driver.h"
|
||||
|
||||
#include "git_version.h"
|
||||
#include "intl/intl.h"
|
||||
|
||||
@ -67,203 +69,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void rarch_recording_dump_frame(const void *data, unsigned width,
|
||||
unsigned height, size_t pitch)
|
||||
{
|
||||
struct ffemu_video_data ffemu_data = {0};
|
||||
|
||||
ffemu_data.pitch = pitch;
|
||||
ffemu_data.width = width;
|
||||
ffemu_data.height = height;
|
||||
ffemu_data.data = data;
|
||||
|
||||
if (g_extern.record_gpu_buffer)
|
||||
{
|
||||
struct rarch_viewport vp = {0};
|
||||
|
||||
if (driver.video && driver.video->viewport_info)
|
||||
driver.video->viewport_info(driver.video_data, &vp);
|
||||
|
||||
if (!vp.width || !vp.height)
|
||||
{
|
||||
RARCH_WARN("Viewport size calculation failed! Will continue using raw data. This will probably not work right ...\n");
|
||||
rarch_main_command(RARCH_CMD_GPU_RECORD_DEINIT);
|
||||
|
||||
rarch_recording_dump_frame(data, width, height, pitch);
|
||||
return;
|
||||
}
|
||||
|
||||
/* User has resized. We kinda have a problem now. */
|
||||
if (vp.width != g_extern.record_gpu_width ||
|
||||
vp.height != g_extern.record_gpu_height)
|
||||
{
|
||||
static const char msg[] = "Recording terminated due to resize.";
|
||||
RARCH_WARN("%s\n", msg);
|
||||
msg_queue_clear(g_extern.msg_queue);
|
||||
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
|
||||
|
||||
rarch_main_command(RARCH_CMD_RECORD_DEINIT);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Big bottleneck.
|
||||
* Since we might need to do read-backs asynchronously,
|
||||
* it might take 3-4 times before this returns true. */
|
||||
if (driver.video && driver.video->read_viewport)
|
||||
if (!driver.video->read_viewport(driver.video_data,
|
||||
g_extern.record_gpu_buffer))
|
||||
return;
|
||||
|
||||
ffemu_data.pitch = g_extern.record_gpu_width * 3;
|
||||
ffemu_data.width = g_extern.record_gpu_width;
|
||||
ffemu_data.height = g_extern.record_gpu_height;
|
||||
ffemu_data.data = g_extern.record_gpu_buffer +
|
||||
(ffemu_data.height - 1) * ffemu_data.pitch;
|
||||
|
||||
ffemu_data.pitch = -ffemu_data.pitch;
|
||||
}
|
||||
|
||||
if (!g_extern.record_gpu_buffer)
|
||||
ffemu_data.is_dupe = !data;
|
||||
|
||||
if (driver.recording && driver.recording->push_video)
|
||||
driver.recording->push_video(driver.recording_data, &ffemu_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* init_recording:
|
||||
*
|
||||
* Initializes recording.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
static bool init_recording(void)
|
||||
{
|
||||
struct ffemu_params params = {0};
|
||||
const struct retro_system_av_info *info = &g_extern.system.av_info;
|
||||
|
||||
if (!g_extern.recording_enable)
|
||||
return false;
|
||||
|
||||
if (g_extern.libretro_dummy)
|
||||
{
|
||||
RARCH_WARN(RETRO_LOG_INIT_RECORDING_SKIPPED);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!g_settings.video.gpu_record
|
||||
&& g_extern.system.hw_render_callback.context_type)
|
||||
{
|
||||
RARCH_WARN("Libretro core is hardware rendered. Must use post-shaded recording as well.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
RARCH_LOG("Custom timing given: FPS: %.4f, Sample rate: %.4f\n",
|
||||
(float)g_extern.system.av_info.timing.fps,
|
||||
(float)g_extern.system.av_info.timing.sample_rate);
|
||||
|
||||
params.out_width = info->geometry.base_width;
|
||||
params.out_height = info->geometry.base_height;
|
||||
params.fb_width = info->geometry.max_width;
|
||||
params.fb_height = info->geometry.max_height;
|
||||
params.channels = 2;
|
||||
params.filename = g_extern.record_path;
|
||||
params.fps = g_extern.system.av_info.timing.fps;
|
||||
params.samplerate = g_extern.system.av_info.timing.sample_rate;
|
||||
params.pix_fmt = (g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888) ?
|
||||
FFEMU_PIX_ARGB8888 : FFEMU_PIX_RGB565;
|
||||
params.config = NULL;
|
||||
|
||||
if (*g_extern.record_config)
|
||||
params.config = g_extern.record_config;
|
||||
|
||||
if (g_settings.video.gpu_record && driver.video->read_viewport)
|
||||
{
|
||||
struct rarch_viewport vp = {0};
|
||||
|
||||
if (driver.video && driver.video->viewport_info)
|
||||
driver.video->viewport_info(driver.video_data, &vp);
|
||||
|
||||
if (!vp.width || !vp.height)
|
||||
{
|
||||
RARCH_ERR("Failed to get viewport information from video driver. "
|
||||
"Cannot start recording ...\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
params.out_width = vp.width;
|
||||
params.out_height = vp.height;
|
||||
params.fb_width = next_pow2(vp.width);
|
||||
params.fb_height = next_pow2(vp.height);
|
||||
|
||||
if (g_settings.video.force_aspect &&
|
||||
(g_extern.system.aspect_ratio > 0.0f))
|
||||
params.aspect_ratio = g_extern.system.aspect_ratio;
|
||||
else
|
||||
params.aspect_ratio = (float)vp.width / vp.height;
|
||||
|
||||
params.pix_fmt = FFEMU_PIX_BGR24;
|
||||
g_extern.record_gpu_width = vp.width;
|
||||
g_extern.record_gpu_height = vp.height;
|
||||
|
||||
RARCH_LOG("Detected viewport of %u x %u\n",
|
||||
vp.width, vp.height);
|
||||
|
||||
g_extern.record_gpu_buffer = (uint8_t*)malloc(vp.width * vp.height * 3);
|
||||
if (!g_extern.record_gpu_buffer)
|
||||
{
|
||||
RARCH_ERR("Failed to allocate GPU record buffer.\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_extern.record_width || g_extern.record_height)
|
||||
{
|
||||
params.out_width = g_extern.record_width;
|
||||
params.out_height = g_extern.record_height;
|
||||
}
|
||||
|
||||
if (g_settings.video.force_aspect &&
|
||||
(g_extern.system.aspect_ratio > 0.0f))
|
||||
params.aspect_ratio = g_extern.system.aspect_ratio;
|
||||
else
|
||||
params.aspect_ratio = (float)params.out_width / params.out_height;
|
||||
|
||||
if (g_settings.video.post_filter_record && g_extern.filter.filter)
|
||||
{
|
||||
unsigned max_width = 0;
|
||||
unsigned max_height = 0;
|
||||
|
||||
if (g_extern.filter.out_rgb32)
|
||||
params.pix_fmt = FFEMU_PIX_ARGB8888;
|
||||
else
|
||||
params.pix_fmt = FFEMU_PIX_RGB565;
|
||||
|
||||
rarch_softfilter_get_max_output_size(g_extern.filter.filter,
|
||||
&max_width, &max_height);
|
||||
params.fb_width = next_pow2(max_width);
|
||||
params.fb_height = next_pow2(max_height);
|
||||
}
|
||||
}
|
||||
|
||||
RARCH_LOG("Recording to %s @ %ux%u. (FB size: %ux%u pix_fmt: %u)\n",
|
||||
g_extern.record_path,
|
||||
params.out_width, params.out_height,
|
||||
params.fb_width, params.fb_height,
|
||||
(unsigned)params.pix_fmt);
|
||||
|
||||
if (!ffemu_init_first(&driver.recording, &driver.recording_data, ¶ms))
|
||||
{
|
||||
RARCH_ERR(RETRO_LOG_INIT_RECORDING_FAILED);
|
||||
rarch_main_command(RARCH_CMD_GPU_RECORD_DEINIT);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* rarch_render_cached_frame:
|
||||
*
|
||||
@ -2515,22 +2320,14 @@ bool rarch_main_command(unsigned cmd)
|
||||
const char *msg = !g_settings.audio.mute_enable ?
|
||||
"Audio muted." : "Audio unmuted.";
|
||||
|
||||
if (!driver.audio_data || !driver.audio_active)
|
||||
if (!audio_driver_mute_toggle())
|
||||
{
|
||||
RARCH_ERR("Failed to unmute audio.\n");
|
||||
return false;
|
||||
|
||||
g_settings.audio.mute_enable = !g_settings.audio.mute_enable;
|
||||
}
|
||||
|
||||
msg_queue_clear(g_extern.msg_queue);
|
||||
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
|
||||
|
||||
if (g_settings.audio.mute_enable)
|
||||
rarch_main_command(RARCH_CMD_AUDIO_STOP);
|
||||
else if (!rarch_main_command(RARCH_CMD_AUDIO_START))
|
||||
{
|
||||
RARCH_ERR("Failed to unmute audio.\n");
|
||||
driver.audio_active = false;
|
||||
}
|
||||
|
||||
RARCH_LOG("%s\n", msg);
|
||||
}
|
||||
break;
|
||||
@ -2591,23 +2388,12 @@ bool rarch_main_command(unsigned cmd)
|
||||
g_extern.record_gpu_buffer = NULL;
|
||||
break;
|
||||
case RARCH_CMD_RECORD_DEINIT:
|
||||
if (!driver.recording_data || !driver.recording)
|
||||
if (!recording_deinit())
|
||||
return false;
|
||||
|
||||
if (driver.recording->finalize)
|
||||
driver.recording->finalize(driver.recording_data);
|
||||
|
||||
if (driver.recording->free)
|
||||
driver.recording->free(driver.recording_data);
|
||||
|
||||
driver.recording_data = NULL;
|
||||
driver.recording = NULL;
|
||||
|
||||
rarch_main_command(RARCH_CMD_GPU_RECORD_DEINIT);
|
||||
break;
|
||||
case RARCH_CMD_RECORD_INIT:
|
||||
rarch_main_command(RARCH_CMD_HISTORY_DEINIT);
|
||||
if (!init_recording())
|
||||
if (!recording_init())
|
||||
return false;
|
||||
break;
|
||||
case RARCH_CMD_HISTORY_DEINIT:
|
||||
|
@ -293,9 +293,6 @@ void rarch_disk_control_set_index(unsigned index);
|
||||
**/
|
||||
void rarch_disk_control_append_image(const char *path);
|
||||
|
||||
void rarch_recording_dump_frame(const void *data, unsigned width,
|
||||
unsigned height, size_t pitch);
|
||||
|
||||
/**
|
||||
* rarch_replace_config:
|
||||
* @path : Path to config file to replace
|
||||
|
Loading…
x
Reference in New Issue
Block a user