GUI: Enable console to stdio on macOS

This commit is contained in:
TellowKrinkle 2021-09-10 20:09:01 -05:00 committed by tellowkrinkle
parent f5f44286bf
commit 0f4f09c597
5 changed files with 12 additions and 12 deletions

View File

@ -99,7 +99,7 @@ const IConsoleWriter ConsoleWriter_Null =
// Console_Stdout // Console_Stdout
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
#if defined(__unix__) #if defined(__POSIX__)
static __fi const char* GetLinuxConsoleColor(ConsoleColors color) static __fi const char* GetLinuxConsoleColor(ConsoleColors color)
{ {
switch (color) switch (color)
@ -176,7 +176,7 @@ static void __concall ConsoleStdout_Newline()
static void __concall ConsoleStdout_DoSetColor(ConsoleColors color) static void __concall ConsoleStdout_DoSetColor(ConsoleColors color)
{ {
#if defined(__unix__) #if defined(__POSIX__)
fprintf(stdout_fp, "\033[0m%s", GetLinuxConsoleColor(color)); fprintf(stdout_fp, "\033[0m%s", GetLinuxConsoleColor(color));
fflush(stdout_fp); fflush(stdout_fp);
#endif #endif
@ -184,7 +184,7 @@ static void __concall ConsoleStdout_DoSetColor(ConsoleColors color)
static void __concall ConsoleStdout_SetTitle(const wxString& title) static void __concall ConsoleStdout_SetTitle(const wxString& title)
{ {
#if defined(__unix__) #if defined(__POSIX__)
fputs("\033]0;", stdout_fp); fputs("\033]0;", stdout_fp);
fputs(title.utf8_str(), stdout_fp); fputs(title.utf8_str(), stdout_fp);
fputs("\007", stdout_fp); fputs("\007", stdout_fp);

View File

@ -234,7 +234,7 @@ public:
extern IConsoleWriter Console; extern IConsoleWriter Console;
#if defined(__unix__) || defined(__APPLE__) #if defined(__POSIX__)
extern void Console_SetStdout(FILE* fp); extern void Console_SetStdout(FILE* fp);
#endif #endif
extern void Console_SetActiveHandler(const IConsoleWriter& writer, FILE* flushfp = NULL); extern void Console_SetActiveHandler(const IConsoleWriter& writer, FILE* flushfp = NULL);

View File

@ -1071,11 +1071,11 @@ void Pcsx2App::ProgramLog_PostEvent( wxEvent& evt )
static void __concall ConsoleToFile_Newline() static void __concall ConsoleToFile_Newline()
{ {
#if defined(__unix__) #if defined(__POSIX__)
if ((g_Conf) && (g_Conf->EmuOptions.ConsoleToStdio)) ConsoleWriter_Stdout.Newline(); if ((g_Conf) && (g_Conf->EmuOptions.ConsoleToStdio)) ConsoleWriter_Stdout.Newline();
#endif #endif
#if defined(__unix__) #if defined(__POSIX__)
fputc( '\n', emuLog ); fputc( '\n', emuLog );
#else #else
fputs( "\r\n", emuLog ); fputs( "\r\n", emuLog );
@ -1084,7 +1084,7 @@ static void __concall ConsoleToFile_Newline()
static void __concall ConsoleToFile_DoWrite( const wxString& fmt ) static void __concall ConsoleToFile_DoWrite( const wxString& fmt )
{ {
#if defined(__unix__) #if defined(__POSIX__)
if ((g_Conf) && (g_Conf->EmuOptions.ConsoleToStdio)) ConsoleWriter_Stdout.WriteRaw(fmt); if ((g_Conf) && (g_Conf->EmuOptions.ConsoleToStdio)) ConsoleWriter_Stdout.WriteRaw(fmt);
#endif #endif

View File

@ -293,7 +293,7 @@ void MainEmuFrame::ConnectMenus()
// Misc // Misc
Bind(wxEVT_MENU, &MainEmuFrame::Menu_ShowConsole, this, MenuId_Console); Bind(wxEVT_MENU, &MainEmuFrame::Menu_ShowConsole, this, MenuId_Console);
#if defined(__unix__) #if defined(__POSIX__)
Bind(wxEVT_MENU, &MainEmuFrame::Menu_ShowConsole_Stdio, this, MenuId_Console_Stdio); Bind(wxEVT_MENU, &MainEmuFrame::Menu_ShowConsole_Stdio, this, MenuId_Console_Stdio);
#endif #endif
@ -475,7 +475,7 @@ void MainEmuFrame::CreateWindowsMenu()
#endif #endif
m_menuWindow.Append(&m_MenuItem_Console); m_menuWindow.Append(&m_MenuItem_Console);
#if defined(__unix__) #if defined(__POSIX__)
m_menuWindow.AppendSeparator(); m_menuWindow.AppendSeparator();
m_menuWindow.Append(&m_MenuItem_Console_Stdio); m_menuWindow.Append(&m_MenuItem_Console_Stdio);
#endif #endif
@ -574,7 +574,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
, m_GameSettingsSubmenu(*new wxMenu()) , m_GameSettingsSubmenu(*new wxMenu())
, m_MenuItem_Console(*new wxMenuItem(&m_menuWindow, MenuId_Console, _("&Show Program Log"), wxEmptyString, wxITEM_CHECK)) , m_MenuItem_Console(*new wxMenuItem(&m_menuWindow, MenuId_Console, _("&Show Program Log"), wxEmptyString, wxITEM_CHECK))
#if defined(__unix__) #if defined(__POSIX__)
, m_MenuItem_Console_Stdio(*new wxMenuItem(&m_menuWindow, MenuId_Console_Stdio, _("&Program Log to Stdio"), wxEmptyString, wxITEM_CHECK)) , m_MenuItem_Console_Stdio(*new wxMenuItem(&m_menuWindow, MenuId_Console_Stdio, _("&Program Log to Stdio"), wxEmptyString, wxITEM_CHECK))
#endif #endif
@ -830,7 +830,7 @@ void MainEmuFrame::ApplyConfigToGui(AppConfig& configToApply, int flags)
#endif #endif
menubar.Check(MenuId_EnableHostFs, configToApply.EmuOptions.HostFs); menubar.Check(MenuId_EnableHostFs, configToApply.EmuOptions.HostFs);
menubar.Check(MenuId_Debug_CreateBlockdump, configToApply.EmuOptions.CdvdDumpBlocks); menubar.Check(MenuId_Debug_CreateBlockdump, configToApply.EmuOptions.CdvdDumpBlocks);
#if defined(__unix__) #if defined(__POSIX__)
menubar.Check(MenuId_Console_Stdio, configToApply.EmuOptions.ConsoleToStdio); menubar.Check(MenuId_Console_Stdio, configToApply.EmuOptions.ConsoleToStdio);
#endif #endif

View File

@ -85,7 +85,7 @@ protected:
wxMenuItem* m_menuItem_RecentIsoMenu; wxMenuItem* m_menuItem_RecentIsoMenu;
wxMenuItem* m_menuItem_DriveListMenu; wxMenuItem* m_menuItem_DriveListMenu;
wxMenuItem& m_MenuItem_Console; wxMenuItem& m_MenuItem_Console;
#if defined(__unix__) #if defined(__POSIX__)
wxMenuItem& m_MenuItem_Console_Stdio; wxMenuItem& m_MenuItem_Console_Stdio;
#endif #endif