mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 18:53:28 +01:00
GUI/CLI: Add setting to attach command line (Win32)
This commit is contained in:
parent
103b2fe5fd
commit
965ec8ec81
@ -323,6 +323,8 @@ constexpr auto arg_timer = "high-res-timer";
|
||||
constexpr auto arg_verbose_curl = "verbose-curl";
|
||||
constexpr auto arg_any_location = "allow-any-location";
|
||||
constexpr auto arg_codecs = "codecs";
|
||||
constexpr auto arg_stdout = "stdout";
|
||||
constexpr auto arg_stderr = "stderr";
|
||||
|
||||
int find_arg(std::string arg, int& argc, char* argv[])
|
||||
{
|
||||
@ -705,6 +707,12 @@ int main(int argc, char** argv)
|
||||
parser.addOption(QCommandLineOption(arg_any_location, "Allow RPCS3 to be run from any location. Dangerous"));
|
||||
const QCommandLineOption codec_option(arg_codecs, "List ffmpeg codecs");
|
||||
parser.addOption(codec_option);
|
||||
|
||||
#ifdef _WIN32
|
||||
parser.addOption(QCommandLineOption(arg_stdout, "Attach the console window and listen to standard output stream. (STDOUT)"));
|
||||
parser.addOption(QCommandLineOption(arg_stderr, "Attach the console window and listen to error output stream. (STDERR)"));
|
||||
#endif
|
||||
|
||||
parser.process(app->arguments());
|
||||
|
||||
// Don't start up the full rpcs3 gui if we just want the version or help.
|
||||
@ -733,6 +741,24 @@ int main(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (parser.isSet(arg_stdout) || parser.isSet(arg_stderr))
|
||||
{
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())
|
||||
{
|
||||
if (parser.isSet(arg_stdout))
|
||||
{
|
||||
[[maybe_unused]] const auto con_out = freopen("CONOUT$", "w", stdout);
|
||||
}
|
||||
|
||||
if (parser.isSet(arg_stderr))
|
||||
{
|
||||
[[maybe_unused]] const auto con_err = freopen("CONOUT$", "w", stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set curl to verbose if needed
|
||||
rpcs3::curl::g_curl_verbose = parser.isSet(arg_verbose_curl);
|
||||
|
||||
|
@ -51,6 +51,10 @@
|
||||
#include "Emu/RSX/VK/VKGSRender.h"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Windows.h"
|
||||
#endif
|
||||
|
||||
LOG_CHANNEL(gui_log, "GUI");
|
||||
|
||||
[[noreturn]] void report_fatal_error(std::string_view text, bool is_html = false, bool include_help_text = true);
|
||||
@ -112,6 +116,20 @@ bool gui_application::Init()
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (m_gui_settings->GetValue(gui::m_attachCommandLine).toBool())
|
||||
{
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())
|
||||
{
|
||||
[[maybe_unused]] const auto con_out = freopen("CONOUT$", "w", stderr);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
m_gui_settings->SetValue(gui::m_attachCommandLine, false);
|
||||
}
|
||||
|
||||
// The user might be set by cli arg. If not, set another user.
|
||||
if (m_active_user.empty())
|
||||
{
|
||||
|
@ -215,6 +215,7 @@ namespace gui
|
||||
|
||||
const gui_save m_currentStylesheet = gui_save(meta, "currentStylesheet", DefaultStylesheet);
|
||||
const gui_save m_showDebugTab = gui_save(meta, "showDebugTab", false);
|
||||
const gui_save m_attachCommandLine = gui_save(meta, "attachCommandLine", false);
|
||||
const gui_save m_enableUIColors = gui_save(meta, "enableUIColors", false);
|
||||
const gui_save m_richPresence = gui_save(meta, "useRichPresence", true);
|
||||
const gui_save m_discordState = gui_save(meta, "discordState", "");
|
||||
|
Loading…
Reference in New Issue
Block a user