diff --git a/src/citra_meta/common_strings.h b/src/citra_meta/common_strings.h index 6f1a98772..a809f5e4f 100644 --- a/src/citra_meta/common_strings.h +++ b/src/citra_meta/common_strings.h @@ -10,22 +10,24 @@ namespace Common { constexpr char help_string[] = "Usage: {} [options] \n" - "-d, --dump-video [path] Dump video recording of emulator playback to the given file path\n" - "-f, --fullscreen Start in fullscreen mode\n" - "-g, --gdbport [port] Enable gdb stub on the given port\n" - "-h, --help Display this help and exit\n" - "-i, --install [path] Install a CIA file at the given path\n" - "-c, --compress [path] Compress the cci/3ds/cxi/app/3dsx/cia file at the given path\n" - "-x, --decompress [path] Decompress zcci/zcxi/z3dsx/zcia file at the given path\n" - "-p, --movie-play [path] Play a TAS movie located at the given path\n" - "-r, --movie-record [path] Record a TAS movie to the given file path\n" + "-d, --dump-video [path] Dump video recording of emulator playback to the given file path\n" + "-f, --fullscreen Start in fullscreen mode\n" + "-g, --gdbport [port] Enable gdb stub on the given port\n" + "-h, --help Display this help and exit\n" + "-i, --install [path] Install a CIA file at the given path\n" + "-c, --compress [path]... -o [path] Compress the cci/3ds/cxi/app/3dsx/cia files at the given path\n" + " If \'-o [path]\' isnt used, it compresses in place\n" + "-x, --decompress [path]... -o [path] Decompress zcci/zcxi/z3dsx/zcia files at the given path\n" + " If \'-o [path]\' isnt used, it decompresses in place\n" + "-p, --movie-play [path] Play a TAS movie located at the given path\n" + "-r, --movie-record [path] Record a TAS movie to the given file path\n" "-a, --movie-record-author [author] Set the author for the recorded TAS movie (to be used " "alongside --movie-record)\n" #ifdef ENABLE_ROOM - " --room Utilize dedicated multiplayer room functionality (equivalent to " + " --room Utilize dedicated multiplayer room functionality (equivalent to " "the old citra-room executable)\n" #endif - "-v, --version Output version information and exit\n" - "-w, --windowed Start in windowed mode"; + "-v, --version Output version information and exit\n" + "-w, --windowed Start in windowed mode"; } // namespace Common diff --git a/src/citra_qt/citra_qt.cpp b/src/citra_qt/citra_qt.cpp index 769c45d1a..02bcc1672 100644 --- a/src/citra_qt/citra_qt.cpp +++ b/src/citra_qt/citra_qt.cpp @@ -247,7 +247,12 @@ GMainWindow::GMainWindow(Core::System& system_) } if (args[i] == QStringLiteral("--help") || args[i] == QStringLiteral("-h")) { - ShowCommandOutput("Help", fmt::format(Common::help_string, args[0].toStdString())); + UISettings::values.show_console = true; + Debugger::ToggleConsole(); + Common::Log::Filter filter; + filter.ParseFilterString("*:Error"); + QFileInfo azaharFile(args[0]); + QTextStream(stdout) << QString::fromStdString(fmt::format(Common::help_string, azaharFile.fileName().toStdString())); exit(0); } @@ -350,6 +355,17 @@ GMainWindow::GMainWindow(Core::System& system_) Common::Log::SetGlobalFilter(filter); i++; for (; i < args.size(); i++){ + if (args[i] == QStringLiteral("-o") || args[i] == QStringLiteral("--output")){ + i++; + QFileInfo outputPath(args[i]); + if (outputPath.isDir()){ + cli_out_path = args[i]; + } else { + QTextStream(stderr) << "Error: " << args[i] << " is not a directory!\n"; + exit(1); + } + break; + } QFileInfo currPath(args[i]); if (currPath.isFile()){ compress_paths.append(args[i]); @@ -375,6 +391,17 @@ GMainWindow::GMainWindow(Core::System& system_) Common::Log::SetGlobalFilter(filter); i++; for (; i < args.size(); i++){ + if (args[i] == QStringLiteral("-o") || args[i] == QStringLiteral("--output")){ + i++; + QFileInfo outputPath(args[i]); + if (outputPath.isDir()){ + cli_out_path = args[i]; + } else { + QTextStream(stderr) << "Error: " << args[i] << " is not a directory!\n"; + exit(1); + } + break; + } QFileInfo currPath(args[i]); if (currPath.isFile()){ decompress_paths.append(args[i]); @@ -3340,7 +3367,7 @@ void GMainWindow::OnCompressFileCLI() { // // This is enforced using the loaders as they already return an error on encryption. - QString out_path; + QString out_path = cli_out_path; QStringList filepaths = compress_paths; if (compress_paths.isEmpty()) { return; @@ -3348,13 +3375,6 @@ void GMainWindow::OnCompressFileCLI() { bool single_file = filepaths.size() == 1; - // Set the output directory based on the starting file - QFileInfo startFileInfo(filepaths[0]); - out_path = startFileInfo.absolutePath(); - if (out_path.isEmpty()) { - return; - } - compression_future = QtConcurrent::run([&, filepaths, out_path] { bool single_file = filepaths.size() == 1; QString out_filepath; @@ -3373,7 +3393,13 @@ void GMainWindow::OnCompressFileCLI() { } QFileInfo fileinfo(filepath); - out_filepath = out_path + QStringLiteral(DIR_SEP) + fileinfo.completeBaseName() + + if (out_path.isEmpty()){ + out_filepath = fileinfo.absolutePath(); + } else { + out_filepath = out_path; + } + + out_filepath = out_filepath + QStringLiteral(DIR_SEP) + fileinfo.completeBaseName() + QStringLiteral(".") + QString::fromStdString( compress_info.value().first.recommended_compressed_extension); @@ -3493,15 +3519,13 @@ void GMainWindow::OnDecompressFile() { void GMainWindow::OnDecompressFileCLI() { QStringList filepaths = decompress_paths; - QString out_path; + QString out_path = cli_out_path; if (filepaths.isEmpty()) { return; } bool single_file = filepaths.size() == 1; - QFileInfo startFileInfo(filepaths[0]); - out_path = startFileInfo.absolutePath(); compression_future = QtConcurrent::run([&, filepaths, out_path] { bool single_file = filepaths.size() == 1; @@ -3522,7 +3546,12 @@ void GMainWindow::OnDecompressFileCLI() { QFileInfo fileinfo(filepath); - out_filepath = out_path + QStringLiteral(DIR_SEP) + fileinfo.completeBaseName() + + if (out_path.isEmpty()){ + out_filepath = fileinfo.absolutePath(); + } else { + out_filepath = out_path; + } + out_filepath = out_filepath + QStringLiteral(DIR_SEP) + fileinfo.completeBaseName() + QStringLiteral(".") + QString::fromStdString( compress_info.value().first.recommended_uncompressed_extension); diff --git a/src/citra_qt/citra_qt.h b/src/citra_qt/citra_qt.h index 593c9c569..dbbbb3ed2 100644 --- a/src/citra_qt/citra_qt.h +++ b/src/citra_qt/citra_qt.h @@ -404,6 +404,7 @@ private: // Compress/Decompress Paths and Future QStringList compress_paths; QStringList decompress_paths; + QString cli_out_path; QFuture compression_future; // Whether game shutdown is delayed due to video dumping