mirror of https://github.com/PCSX2/pcsx2.git
UI:
* Major bugfix to the startup/user path settings code (should fix issues some people were having when trying to run multiple copies of pcsx2 from different folders). * Various bugfixes to panel appearances * Win32: "stdio" console output now redirects to theVisual Studio Debug Output window, since Stdout is generally useless on windows. Emulation: * Removed the IOP SIF hack since it never did what I was hoping it would do anyway. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3176 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
6632f857bd
commit
6fdb282c81
|
@ -17,6 +17,8 @@
|
|||
#include "Threading.h"
|
||||
#include "TlsVariable.inl"
|
||||
|
||||
#include "RedtapeWindows.h"
|
||||
|
||||
using namespace Threading;
|
||||
|
||||
// thread-local console indentation setting.
|
||||
|
@ -135,18 +137,30 @@ static __forceinline const wxChar* GetLinuxConsoleColor(ConsoleColors color)
|
|||
// One possible default write action at startup and shutdown is to use the stdout.
|
||||
static void __concall ConsoleStdout_DoWrite( const wxString& fmt )
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
OutputDebugString( fmt );
|
||||
#else
|
||||
wxPrintf( fmt );
|
||||
#endif
|
||||
}
|
||||
|
||||
// Default write action at startup and shutdown is to use the stdout.
|
||||
static void __concall ConsoleStdout_DoWriteLn( const wxString& fmt )
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
OutputDebugString( fmt + L"\n" );
|
||||
#else
|
||||
wxPrintf( fmt + L"\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __concall ConsoleStdout_Newline()
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
OutputDebugString( L"\n" );
|
||||
#else
|
||||
wxPrintf( L"\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __concall ConsoleStdout_DoSetColor( ConsoleColors color )
|
||||
|
@ -170,10 +184,9 @@ const IConsoleWriter ConsoleWriter_Stdout =
|
|||
ConsoleStdout_DoWriteLn,
|
||||
ConsoleStdout_DoSetColor,
|
||||
|
||||
ConsoleNull_DoWrite, // writes from stdout are ignored here, lest we create infinite loop hell >_<
|
||||
ConsoleNull_DoWrite, // writes from re-piped stdout are ignored here, lest we create infinite loop hell >_<
|
||||
ConsoleStdout_Newline,
|
||||
ConsoleStdout_SetTitle,
|
||||
|
||||
0, // instance-level indentation (should always be 0)
|
||||
};
|
||||
|
||||
|
@ -531,7 +544,7 @@ bool IConsoleWriter::WriteFromStdout( ConsoleColors color, const char* fmt, ...
|
|||
va_list args;
|
||||
va_start(args,fmt);
|
||||
ConsoleColorScope cs( color );
|
||||
DoWrite( FastFormatString_Ascii(fmt, args) );
|
||||
DoWriteFromStdout( FastFormatString_Ascii(fmt, args) );
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
|
@ -541,16 +554,8 @@ bool IConsoleWriter::WriteFromStdout( ConsoleColors color, const char* fmt, ...
|
|||
// --------------------------------------------------------------------------------------
|
||||
// Default Writer for C++ init / startup:
|
||||
// --------------------------------------------------------------------------------------
|
||||
// In GUI modes under Windows I default to Assert, because windows lacks a qualified universal
|
||||
// program console. In console mode I use Stdio instead, since the program is pretty well
|
||||
// promised a valid console in any platform (except maybe Macs, which probably consider consoles
|
||||
// a fundamental design flaw or something).
|
||||
|
||||
#if wxUSE_GUI && defined(__WXMSW__)
|
||||
# define _DefaultWriter_ ConsoleWriter_Assert
|
||||
#else
|
||||
# define _DefaultWriter_ ConsoleWriter_Stdout
|
||||
#endif
|
||||
#define _DefaultWriter_ ConsoleWriter_Stdout
|
||||
|
||||
// Important! Only Assert and Null console loggers are allowed for initial console targeting.
|
||||
// Other log targets rely on the static buffer and a threaded mutex lock, which are only valid
|
||||
|
|
|
@ -80,7 +80,7 @@ void pxRadioPanel::Realize()
|
|||
{
|
||||
m_objects[i].SubTextObj = NULL;
|
||||
if( m_buttonStrings[i].SubText.IsEmpty() ) continue;
|
||||
m_objects[i].SubTextObj = new pxStaticText( this, m_buttonStrings[i].SubText );
|
||||
m_objects[i].SubTextObj = new pxStaticText( this, m_buttonStrings[i].SubText, wxALIGN_LEFT );
|
||||
}
|
||||
|
||||
pxAssert( GetSizer() != NULL );
|
||||
|
|
|
@ -159,10 +159,10 @@ wxSize pxStaticText::GetBestWrappedSize( const wxClientDC& dc ) const
|
|||
|
||||
if( idealWidth <= 0 )
|
||||
{
|
||||
// FIXME: The minimum size of this control is unknown, so let's just pick a guess based on some
|
||||
// heuristics of the string content.. maybe? For now I just return 360. It's round. And happy.
|
||||
// FIXME: The minimum size of this control is unknown, so let's just pick a guess based on
|
||||
// the size of the user's display area.
|
||||
|
||||
idealWidth = 360;
|
||||
idealWidth = (int)(wxGetDisplaySize().GetWidth() * 0.66) - (parentalAdjust*2);
|
||||
}
|
||||
|
||||
wxString label(GetLabel());
|
||||
|
|
|
@ -621,8 +621,5 @@ TraceLogFilters& SetTraceConfig();
|
|||
// commented, so this is for development purposes only.
|
||||
#define ENABLE_LOADING_PS1_GAMES 0
|
||||
|
||||
// Change to 1 to enable SIF wakeup hack:
|
||||
#define IOP_ENABLE_SIF_HACK 0
|
||||
|
||||
// Change to 1 to cause all logs to be written to the console. (Very slow)
|
||||
#define LOG_TO_CONSOLE 0
|
||||
|
|
|
@ -195,10 +195,6 @@ static __forceinline void _psxTestInterrupts()
|
|||
#endif
|
||||
IopTestEvent(IopEvt_CdvdRead, cdvdReadInterrupt);
|
||||
|
||||
#if IOP_ENABLE_SIF_HACK
|
||||
IopTestEvent(IopEvt_SIFhack, sifHackInterrupt);
|
||||
#endif
|
||||
|
||||
// Profile-guided Optimization (sorta)
|
||||
// The following ints are rarely called. Encasing them in a conditional
|
||||
// as follows helps speed up most games.
|
||||
|
@ -250,20 +246,6 @@ __releaseinline void psxBranchTest()
|
|||
psxRegs.interrupt &= ~IopEvt_SIFhack;
|
||||
}
|
||||
}
|
||||
|
||||
if( IOP_ENABLE_SIF_HACK && !iopBranchAction && !(psxRegs.interrupt & IopEvt_SIFhack) )
|
||||
{
|
||||
// Safeguard: since we're not executing an exception vector, we should schedule a SIF wakeup
|
||||
// just in case. (and don't reschedule it if it's already scheduled, since that would just
|
||||
// delay the previously scheduled one, and we don't want that)
|
||||
|
||||
// (TODO: The endless loop in question is a branch instruction that branches to itself endlessly,
|
||||
// waiting for SIF to wake it up via any cpuException. We could check for that instruction
|
||||
// location and only schedule a SIF fix when it's detected... But for now this is easy and gives
|
||||
// us good control over testing parameters...)
|
||||
|
||||
PSX_INT( IopEvt_SIFhack, 96 );
|
||||
}
|
||||
}
|
||||
|
||||
void iopTestIntc()
|
||||
|
|
|
@ -107,7 +107,7 @@ TraceLogFilters& SetTraceConfig()
|
|||
// This function should be called once during program execution.
|
||||
void SysLogMachineCaps()
|
||||
{
|
||||
Console.WriteLn( Color_StrongGreen, "PCSX2 %d.%d.%d.r%d %s - compiled on " __DATE__, PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
|
||||
Console.WriteLn( Color_StrongGreen, "PCSX2 %u.%u.%u.r%d %s - compiled on " __DATE__, PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
|
||||
SVN_REV, SVN_MODS ? "(modded)" : ""
|
||||
);
|
||||
|
||||
|
|
|
@ -557,7 +557,7 @@ public:
|
|||
ConsoleLogFrame* GetProgramLog();
|
||||
const ConsoleLogFrame* GetProgramLog() const;
|
||||
void ProgramLog_PostEvent( wxEvent& evt );
|
||||
void EnableAllLogging() const;
|
||||
void EnableAllLogging();
|
||||
void DisableWindowLogging() const;
|
||||
void DisableDiskLogging() const;
|
||||
void OnProgramLogClosed( wxWindowID id );
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <wx/intl.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
using namespace pxSizerFlags;
|
||||
|
||||
static bool m_ForceWizard = false;
|
||||
|
||||
static void CpuCheckSSE2()
|
||||
|
@ -59,7 +61,7 @@ void Pcsx2App::WipeUserModeSettings()
|
|||
if( !usrlocaldir.Exists() ) return;
|
||||
|
||||
wxString cwd( Path::Normalize( wxGetCwd() ) );
|
||||
u32 hashres = HashTools::Hash( (char*)cwd.c_str(), cwd.Length() );
|
||||
u32 hashres = HashTools::Hash( (char*)cwd.c_str(), cwd.Length()*sizeof(wxChar) );
|
||||
|
||||
wxFileName usermodefile( FilenameDefs::GetUsermodeConfig() );
|
||||
usermodefile.SetPath( usrlocaldir.ToString() );
|
||||
|
@ -89,7 +91,7 @@ void Pcsx2App::ReadUserModeSettings()
|
|||
}
|
||||
|
||||
wxString cwd( Path::Normalize( wxGetCwd() ) );
|
||||
u32 hashres = HashTools::Hash( (char*)cwd.c_str(), cwd.Length() );
|
||||
u32 hashres = HashTools::Hash( (char*)cwd.c_str(), cwd.Length()*sizeof(wxChar) );
|
||||
|
||||
wxFileName usermodefile( FilenameDefs::GetUsermodeConfig() );
|
||||
usermodefile.SetPath( usrlocaldir.ToString() );
|
||||
|
@ -97,20 +99,6 @@ void Pcsx2App::ReadUserModeSettings()
|
|||
|
||||
wxString groupname( wxsFormat( L"CWD.%08x", hashres ) );
|
||||
|
||||
if (IOP_ENABLE_SIF_HACK == 1)
|
||||
{
|
||||
wxDialogWithHelpers hackedVersion( NULL, _("It will devour your young! - PCSX2 Shub-Niggurath edition") );
|
||||
hackedVersion.SetMinWidth( 520 );
|
||||
hackedVersion += hackedVersion.Text(
|
||||
L"NOTICE!! This is a version of Pcsx2 with hacks enabled meant for developers only. "
|
||||
L"It will likely crash on all games, devour your young, and make you an object of shame and disgrace among your family and friends. "
|
||||
L"Do not report any bugs with this version if you received this popup. \n\nYou have been warned. "
|
||||
);
|
||||
|
||||
hackedVersion += new wxButton( &hackedVersion, wxID_OK ) | pxSizerFlags::StdCenter();
|
||||
hackedVersion.ShowModal();
|
||||
}
|
||||
|
||||
bool hasGroup = conf_usermode->HasGroup( groupname );
|
||||
bool forceWiz = m_ForceWizard || !hasGroup;
|
||||
|
||||
|
@ -124,20 +112,21 @@ void Pcsx2App::ReadUserModeSettings()
|
|||
if( forceWiz )
|
||||
{
|
||||
// Beta Warning!
|
||||
|
||||
#if 0
|
||||
if( !hasGroup )
|
||||
{
|
||||
wxDialogWithHelpers beta( NULL, _("PCSX2 0.9.7 Beta") );
|
||||
wxDialogWithHelpers beta( NULL, wxsFormat(_("Welcome to PCSX2 %u.%u.%u (r%u)")), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, SVN_REV );
|
||||
beta.SetMinWidth(480);
|
||||
|
||||
beta += new pxStaticText( &beta,
|
||||
L"This is a *Beta* build of PCSX2 0.9.7. We are in the middle of major rewrites of the "
|
||||
L"user interface, and some parts of the program have *NOT* been implemented yet. Options will be missing. "
|
||||
L"Some things may crash or hang without warning.", wxALIGN_CENTER
|
||||
);
|
||||
beta += beta.Heading(
|
||||
L"a work-in-progress. We are in the middle of major rewrites of the user interface, and some parts "
|
||||
L"of the program have *NOT* been re-implemented yet. Options will be missing or disabled. Horrible crashes might be present. Enjoy!"
|
||||
) | StdExpand();
|
||||
|
||||
beta += new wxButton( &beta, wxID_OK ) | pxSizerFlags::StdCenter();
|
||||
beta += new wxButton( &beta, wxID_OK ) | StdCenter();
|
||||
beta.ShowModal();
|
||||
}
|
||||
#endif
|
||||
|
||||
// first time startup, so give the user the choice of user mode:
|
||||
FirstTimeWizard wiz( NULL );
|
||||
|
@ -200,10 +189,6 @@ void Pcsx2App::DetectCpuAndUserMode()
|
|||
|
||||
ReadUserModeSettings();
|
||||
AppConfig_OnChangedSettingsFolder();
|
||||
|
||||
PostAppMethod( &Pcsx2App::OpenMainFrame );
|
||||
PostAppMethod( &Pcsx2App::OpenProgramLog );
|
||||
PostAppMethod( &Pcsx2App::AllocateCoreStuffs );
|
||||
}
|
||||
|
||||
void Pcsx2App::OpenMainFrame()
|
||||
|
@ -411,25 +396,24 @@ typedef void (wxEvtHandler::*pxStuckThreadEventHandler)(pxMessageBoxEvent&);
|
|||
|
||||
bool Pcsx2App::OnInit()
|
||||
{
|
||||
EnableAllLogging();
|
||||
Console.WriteLn("Interface is initializing. Entering Pcsx2App::OnInit!");
|
||||
|
||||
InitCPUTicks();
|
||||
|
||||
pxDoAssert = AppDoAssert;
|
||||
g_Conf = new AppConfig();
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
Console.WriteLn("Begin parsing commandline...");
|
||||
if( !_parent::OnInit() ) return false;
|
||||
|
||||
wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() );
|
||||
|
||||
#define pxAppMethodEventHandler(func) \
|
||||
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(pxInvokeAppMethodEventFunction, &func )
|
||||
|
||||
pxDoAssert = AppDoAssert;
|
||||
|
||||
g_Conf = new AppConfig();
|
||||
EnableAllLogging();
|
||||
|
||||
wxInitAllImageHandlers();
|
||||
if( !_parent::OnInit() ) return false;
|
||||
|
||||
m_StdoutRedirHandle = NewPipeRedir(stdout);
|
||||
m_StderrRedirHandle = NewPipeRedir(stderr);
|
||||
wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() );
|
||||
|
||||
Connect( pxID_PadHandler_Keydown, wxEVT_KEY_DOWN, wxKeyEventHandler (Pcsx2App::OnEmuKeyDown) );
|
||||
|
||||
Connect( wxEVT_DESTROY, wxWindowDestroyEventHandler (Pcsx2App::OnDestroyWindow) );
|
||||
|
||||
// User/Admin Mode Dual Setup:
|
||||
|
@ -453,9 +437,12 @@ bool Pcsx2App::OnInit()
|
|||
#ifdef __WXMSW__
|
||||
pxDwm_Load();
|
||||
#endif
|
||||
|
||||
SysExecutorThread.Start();
|
||||
DetectCpuAndUserMode();
|
||||
|
||||
PostAppMethod( &Pcsx2App::OpenMainFrame );
|
||||
PostAppMethod( &Pcsx2App::OpenProgramLog );
|
||||
PostAppMethod( &Pcsx2App::AllocateCoreStuffs );
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
catch( Exception::StartupAborted& ex ) // user-aborted, no popups needed.
|
||||
|
|
|
@ -821,13 +821,13 @@ typedef void __concall DoWriteFn(const wxString&);
|
|||
|
||||
static const IConsoleWriter ConsoleWriter_Window =
|
||||
{
|
||||
ConsoleToWindow_DoWrite<ConsoleWriter_Null>,
|
||||
ConsoleToWindow_DoWriteLn<ConsoleWriter_Null>,
|
||||
ConsoleToWindow_DoSetColor<ConsoleWriter_Null>,
|
||||
ConsoleToWindow_DoWrite<ConsoleWriter_Stdout>,
|
||||
ConsoleToWindow_DoWriteLn<ConsoleWriter_Stdout>,
|
||||
ConsoleToWindow_DoSetColor<ConsoleWriter_Stdout>,
|
||||
|
||||
ConsoleToWindow_DoWrite<ConsoleWriter_Null>,
|
||||
ConsoleToWindow_Newline<ConsoleWriter_Null>,
|
||||
ConsoleToWindow_SetTitle<ConsoleWriter_Null>,
|
||||
ConsoleToWindow_DoWrite<ConsoleWriter_Stdout>,
|
||||
ConsoleToWindow_Newline<ConsoleWriter_Stdout>,
|
||||
ConsoleToWindow_SetTitle<ConsoleWriter_Stdout>,
|
||||
};
|
||||
|
||||
static const IConsoleWriter ConsoleWriter_WindowAndFile =
|
||||
|
@ -841,14 +841,29 @@ static const IConsoleWriter ConsoleWriter_WindowAndFile =
|
|||
ConsoleToWindow_SetTitle<ConsoleWriter_File>,
|
||||
};
|
||||
|
||||
void Pcsx2App::EnableAllLogging() const
|
||||
void Pcsx2App::EnableAllLogging()
|
||||
{
|
||||
const bool logBoxOpen = (GetProgramLog() != NULL);
|
||||
const IConsoleWriter* newHandler = NULL;
|
||||
|
||||
if( emuLog )
|
||||
Console_SetActiveHandler( logBoxOpen ? (IConsoleWriter&)ConsoleWriter_WindowAndFile : (IConsoleWriter&)ConsoleWriter_File );
|
||||
{
|
||||
if( !m_StdoutRedirHandle ) m_StdoutRedirHandle = NewPipeRedir(stdout);
|
||||
if( !m_StderrRedirHandle ) m_StderrRedirHandle = NewPipeRedir(stderr);
|
||||
newHandler = logBoxOpen ? (IConsoleWriter*)&ConsoleWriter_WindowAndFile : (IConsoleWriter*)&ConsoleWriter_File;
|
||||
}
|
||||
else
|
||||
Console_SetActiveHandler( logBoxOpen ? (IConsoleWriter&)ConsoleWriter_Window : (IConsoleWriter&)ConsoleWriter_Stdout );
|
||||
{
|
||||
if( logBoxOpen )
|
||||
{
|
||||
if( !m_StdoutRedirHandle ) m_StdoutRedirHandle = NewPipeRedir(stdout);
|
||||
if( !m_StderrRedirHandle ) m_StderrRedirHandle = NewPipeRedir(stderr);
|
||||
newHandler = &ConsoleWriter_Window;
|
||||
}
|
||||
else
|
||||
newHandler = &ConsoleWriter_Stdout;
|
||||
}
|
||||
Console_SetActiveHandler( *newHandler );
|
||||
}
|
||||
|
||||
// Used to disable the emuLog disk logger, typically used when disabling or re-initializing the
|
||||
|
|
|
@ -61,6 +61,7 @@ Panels::DocsFolderPickerPanel::DocsFolderPickerPanel( wxWindow* parent, bool isF
|
|||
m_radio_UserMode = new pxRadioPanel( this, UsermodeOptions );
|
||||
m_radio_UserMode->SetPaddingHoriz( m_radio_UserMode->GetPaddingVert() + 4 );
|
||||
m_radio_UserMode->Realize();
|
||||
if( pxStaticText* woot = m_radio_UserMode->GetSubText(0) ) woot->Unwrapped(); // wrapping sucks for path names!
|
||||
|
||||
m_dirpicker_custom = new DirPickerPanel( this, FolderId_Documents, _("Select a document root for PCSX2") );
|
||||
|
||||
|
@ -97,6 +98,9 @@ void Panels::DocsFolderPickerPanel::OnRadioChanged( wxCommandEvent& evt )
|
|||
|
||||
if( m_dirpicker_custom )
|
||||
m_dirpicker_custom->Enable( m_radio_UserMode->GetSelection() == (int)DocsFolder_Custom );
|
||||
|
||||
if( pxStaticText* woot = m_radio_UserMode->GetSubText(0) )
|
||||
woot->Enable( m_radio_UserMode->GetSelection() == (int)DocsFolder_User );
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue