citra: Add --dump-video argument

This commit is contained in:
zhupengfei 2019-01-26 22:42:00 +08:00
parent 399a660faa
commit 526d53af99
No known key found for this signature in database
GPG key ID: DD129E108BD09378

View file

@ -30,8 +30,10 @@
#include "common/scope_exit.h"
#include "common/string_util.h"
#include "core/core.h"
#include "core/dumping/backend.h"
#include "core/file_sys/cia_container.h"
#include "core/frontend/applets/default_applets.h"
#include "core/frontend/framebuffer_layout.h"
#include "core/gdbstub/gdbstub.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/cfg/cfg.h"
@ -39,6 +41,7 @@
#include "core/movie.h"
#include "core/settings.h"
#include "network/network.h"
#include "video_core/video_core.h"
#undef _UNICODE
#include <getopt.h>
@ -62,6 +65,7 @@ static void PrintHelp(const char* argv0) {
" Nickname, password, address and port for multiplayer\n"
"-r, --movie-record=[file] Record a movie (game inputs) to the given file\n"
"-p, --movie-play=[file] Playback the movie (game inputs) from the given file\n"
"-d, --dump-video=[file] Dumps audio and video to the given video file\n"
"-f, --fullscreen Start in fullscreen mode\n"
"-h, --help Display this help and exit\n"
"-v, --version Output version information and exit\n";
@ -187,6 +191,7 @@ int main(int argc, char** argv) {
u32 gdb_port = static_cast<u32>(Settings::values.gdbstub_port);
std::string movie_record;
std::string movie_play;
std::string dump_video;
InitializeLogging();
@ -210,15 +215,11 @@ int main(int argc, char** argv) {
u16 port = Network::DefaultRoomPort;
static struct option long_options[] = {
{"gdbport", required_argument, 0, 'g'},
{"install", required_argument, 0, 'i'},
{"multiplayer", required_argument, 0, 'm'},
{"movie-record", required_argument, 0, 'r'},
{"movie-play", required_argument, 0, 'p'},
{"fullscreen", no_argument, 0, 'f'},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'v'},
{0, 0, 0, 0},
{"gdbport", required_argument, 0, 'g'}, {"install", required_argument, 0, 'i'},
{"multiplayer", required_argument, 0, 'm'}, {"movie-record", required_argument, 0, 'r'},
{"movie-play", required_argument, 0, 'p'}, {"dump-video", required_argument, 0, 'd'},
{"fullscreen", no_argument, 0, 'f'}, {"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'v'}, {0, 0, 0, 0},
};
while (optind < argc) {
@ -285,6 +286,9 @@ int main(int argc, char** argv) {
case 'p':
movie_play = optarg;
break;
case 'd':
dump_video = optarg;
break;
case 'f':
fullscreen = true;
LOG_INFO(Frontend, "Starting in fullscreen mode...");
@ -399,12 +403,20 @@ int main(int argc, char** argv) {
if (!movie_record.empty()) {
Core::Movie::GetInstance().StartRecording(movie_record);
}
if (!dump_video.empty()) {
Layout::FramebufferLayout layout{
Layout::FrameLayoutFromResolutionScale(VideoCore::GetResolutionScaleFactor())};
system.VideoDumper().StartDumping(dump_video, "webm", layout);
}
while (emu_window->IsOpen()) {
system.RunLoop();
}
Core::Movie::GetInstance().Shutdown();
if (system.VideoDumper().IsDumping()) {
system.VideoDumper().StopDumping();
}
detached_tasks.WaitForAllTasks();
return 0;