mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12:00
GUI/CLI: Add setting to attach command line (Win32)
This commit is contained in:
parent
103b2fe5fd
commit
965ec8ec81
3 changed files with 45 additions and 0 deletions
|
@ -323,6 +323,8 @@ constexpr auto arg_timer = "high-res-timer";
|
||||||
constexpr auto arg_verbose_curl = "verbose-curl";
|
constexpr auto arg_verbose_curl = "verbose-curl";
|
||||||
constexpr auto arg_any_location = "allow-any-location";
|
constexpr auto arg_any_location = "allow-any-location";
|
||||||
constexpr auto arg_codecs = "codecs";
|
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[])
|
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"));
|
parser.addOption(QCommandLineOption(arg_any_location, "Allow RPCS3 to be run from any location. Dangerous"));
|
||||||
const QCommandLineOption codec_option(arg_codecs, "List ffmpeg codecs");
|
const QCommandLineOption codec_option(arg_codecs, "List ffmpeg codecs");
|
||||||
parser.addOption(codec_option);
|
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());
|
parser.process(app->arguments());
|
||||||
|
|
||||||
// Don't start up the full rpcs3 gui if we just want the version or help.
|
// 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;
|
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
|
// Set curl to verbose if needed
|
||||||
rpcs3::curl::g_curl_verbose = parser.isSet(arg_verbose_curl);
|
rpcs3::curl::g_curl_verbose = parser.isSet(arg_verbose_curl);
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,10 @@
|
||||||
#include "Emu/RSX/VK/VKGSRender.h"
|
#include "Emu/RSX/VK/VKGSRender.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "Windows.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG_CHANNEL(gui_log, "GUI");
|
LOG_CHANNEL(gui_log, "GUI");
|
||||||
|
|
||||||
[[noreturn]] void report_fatal_error(std::string_view text, bool is_html = false, bool include_help_text = true);
|
[[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;
|
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.
|
// The user might be set by cli arg. If not, set another user.
|
||||||
if (m_active_user.empty())
|
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_currentStylesheet = gui_save(meta, "currentStylesheet", DefaultStylesheet);
|
||||||
const gui_save m_showDebugTab = gui_save(meta, "showDebugTab", false);
|
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_enableUIColors = gui_save(meta, "enableUIColors", false);
|
||||||
const gui_save m_richPresence = gui_save(meta, "useRichPresence", true);
|
const gui_save m_richPresence = gui_save(meta, "useRichPresence", true);
|
||||||
const gui_save m_discordState = gui_save(meta, "discordState", "");
|
const gui_save m_discordState = gui_save(meta, "discordState", "");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue