mirror of https://github.com/PCSX2/pcsx2.git
wxGui branch: major progress on many fronts!
* Added new files AppConfig.cpp and StringUtils.cpp, and removed memzero.h (we'll use the win/linux platform dependent implementations) * Enabled wxWidgets memory tracing since we don't use a memory trace util of our own. * Switched many instances of std::string to wxString. * Added preliminary support for configuration settings and ini file creation. * Added a set of parsing and splitting tools to StringUtils. * Set it up so that the Console log is attachable to the main window, when dragging (fun!) * Main window and console log window record and restore window positions between runs (only partially implemented yet) git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@881 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
cf0c53f152
commit
2c3c5401e8
|
@ -43,7 +43,7 @@
|
|||
// in the version after it completely.
|
||||
//
|
||||
// Recommended setting: 0 (please update your code)
|
||||
#define WXWIN_COMPATIBILITY_2_6 1
|
||||
#define WXWIN_COMPATIBILITY_2_6 0
|
||||
|
||||
// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when
|
||||
// default system font is used for wxWindow::GetCharWidth/Height() instead of
|
||||
|
@ -86,7 +86,7 @@
|
|||
// Default is 0
|
||||
//
|
||||
// Recommended setting: 1 if you are not using a memory debugging tool, else 0
|
||||
#define wxUSE_MEMORY_TRACING 0
|
||||
#define wxUSE_MEMORY_TRACING 1
|
||||
|
||||
// In debug mode, cause new and delete to be redefined globally.
|
||||
// If this causes problems (e.g. link errors which is a common problem
|
||||
|
|
|
@ -1287,7 +1287,7 @@ static uint cdvdStartSeek( uint newsector, CDVD_MODE_TYPE mode )
|
|||
{
|
||||
cdvd.SeekToSector = newsector;
|
||||
|
||||
uint delta = abs(cdvd.SeekToSector - cdvd.Sector);
|
||||
uint delta = abs((int)cdvd.SeekToSector - (int)cdvd.Sector);
|
||||
uint seektime;
|
||||
|
||||
cdvd.Ready = 0;
|
||||
|
@ -2045,13 +2045,18 @@ void cdvdWrite16(u8 rt) // SCOMMAND
|
|||
if (cdvd.mg_maxsize != cdvd.mg_size) goto fail_pol_cal;
|
||||
if (cdvd.mg_size < 0x20) goto fail_pol_cal;
|
||||
if (cdvd.mg_size != *(u16*)&cdvd.mg_buffer[0x14]) goto fail_pol_cal;
|
||||
SysPrintf("[MG] ELF_size=0x%X Hdr_size=0x%X unk=0x%X flags=0x%X count=%d zones=",
|
||||
Console::Write("[MG] ELF_size=0x%X Hdr_size=0x%X unk=0x%X flags=0x%X count=%d zones=", params
|
||||
*(u32*)&cdvd.mg_buffer[0x10], *(u16*)&cdvd.mg_buffer[0x14], *(u16*)&cdvd.mg_buffer[0x16],
|
||||
*(u16*)&cdvd.mg_buffer[0x18], *(u16*)&cdvd.mg_buffer[0x1A]);
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
if (cdvd.mg_buffer[0x1C] & (1<<i))
|
||||
SysPrintf("%s ", mg_zones[i]);
|
||||
SysPrintf("\n");
|
||||
{
|
||||
Console::Write( mg_zones[i] );
|
||||
Console::Write( " " );
|
||||
}
|
||||
}
|
||||
Console::Newline();
|
||||
bit_ofs = mg_BIToffset(cdvd.mg_buffer);
|
||||
psrc = (u64*)&cdvd.mg_buffer[bit_ofs-0x20];
|
||||
pdst = (u64*)cdvd.mg_kbit;
|
||||
|
|
|
@ -513,7 +513,7 @@ void cdrReadInterrupt() {
|
|||
cdr.StatP|= 0x22;
|
||||
cdr.Result[0] = cdr.StatP;
|
||||
|
||||
SysPrintf("Reading From CDR");
|
||||
Console::Status( "Reading From CDR" );
|
||||
buf = CDVDgetBuffer();
|
||||
if (buf == NULL) cdr.RErr = -1;
|
||||
|
||||
|
|
|
@ -17,10 +17,12 @@
|
|||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "System.h"
|
||||
#include "DebugTools/Debug.h"
|
||||
#include "NewGUI/App.h"
|
||||
|
||||
|
||||
using namespace Threading;
|
||||
using namespace std;
|
||||
|
||||
const _VARG_PARAM va_arg_dummy = { 0 };
|
||||
|
@ -30,11 +32,125 @@ const _VARG_PARAM va_arg_dummy = { 0 };
|
|||
|
||||
namespace Console
|
||||
{
|
||||
ConsoleLogFrame* FrameHandle = NULL;
|
||||
MutexLock m_writelock;
|
||||
std::string m_format_buffer;
|
||||
|
||||
void __fastcall SetTitle( const wxString& title )
|
||||
{
|
||||
ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame();
|
||||
if( FrameHandle != NULL )
|
||||
FrameHandle->SetTitle( title );
|
||||
}
|
||||
|
||||
void __fastcall SetColor( Colors color )
|
||||
{
|
||||
ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame();
|
||||
if( FrameHandle != NULL )
|
||||
FrameHandle->SetColor( color );
|
||||
}
|
||||
|
||||
void ClearColor()
|
||||
{
|
||||
ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame();
|
||||
if( FrameHandle != NULL )
|
||||
FrameHandle->ClearColor();
|
||||
}
|
||||
|
||||
bool Newline()
|
||||
{
|
||||
ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame();
|
||||
if( FrameHandle != NULL )
|
||||
FrameHandle->Newline();
|
||||
|
||||
fputs( "", emuLog );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool __fastcall Write( const char* fmt )
|
||||
{
|
||||
ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame();
|
||||
if( FrameHandle != NULL )
|
||||
FrameHandle->Write( fmt );
|
||||
|
||||
fwrite( fmt, 1, strlen( fmt ), emuLog );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool __fastcall Write( Colors color, const char* fmt )
|
||||
{
|
||||
ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame();
|
||||
if( FrameHandle != NULL )
|
||||
{
|
||||
FrameHandle->SetColor( color );
|
||||
FrameHandle->Write( fmt );
|
||||
FrameHandle->ClearColor();
|
||||
}
|
||||
|
||||
fwrite( fmt, 1, strlen( fmt ), emuLog );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Writes an unformatted string of text to the console (fast!)
|
||||
// A newline is automatically appended.
|
||||
bool __fastcall WriteLn( const char* fmt )
|
||||
{
|
||||
ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame();
|
||||
if( FrameHandle != NULL )
|
||||
{
|
||||
FrameHandle->Write( fmt );
|
||||
FrameHandle->Newline();
|
||||
}
|
||||
|
||||
fputs( fmt, emuLog );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Writes an unformatted string of text to the console (fast!)
|
||||
// A newline is automatically appended.
|
||||
bool __fastcall WriteLn( Colors color, const char* fmt )
|
||||
{
|
||||
ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame();
|
||||
if( FrameHandle != NULL )
|
||||
{
|
||||
FrameHandle->SetColor( color );
|
||||
FrameHandle->Write( fmt );
|
||||
FrameHandle->Newline();
|
||||
FrameHandle->ClearColor();
|
||||
}
|
||||
|
||||
fputs( fmt, emuLog );
|
||||
return false;
|
||||
}
|
||||
|
||||
__forceinline void __fastcall _WriteLn( Colors color, const char* fmt, va_list args )
|
||||
{
|
||||
SetColor( color );
|
||||
WriteLn( vfmt_string( fmt, args ).c_str() );
|
||||
ClearColor();
|
||||
ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame();
|
||||
|
||||
ScopedLock locker( m_writelock );
|
||||
vssprintf( m_format_buffer, fmt, args );
|
||||
const char* cstr = m_format_buffer.c_str();
|
||||
if( FrameHandle != NULL )
|
||||
{
|
||||
FrameHandle->SetColor( color );
|
||||
FrameHandle->Write( cstr );
|
||||
FrameHandle->Newline();
|
||||
FrameHandle->ClearColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The logging system hasn't been initialized, so log to stderr which at least
|
||||
// has a chance of being visible, and then assert (really there shouldn't be logs
|
||||
// being attempted prior to log/console initialization anyway, and the programmer
|
||||
// should replace these with MessageBoxes or something).
|
||||
|
||||
if( color == Color_Red || color == Color_Yellow )
|
||||
fputs( cstr, stderr ); // log notices and errors to stderr
|
||||
|
||||
wxASSERT_MSG( 0, cstr );
|
||||
}
|
||||
|
||||
fputs( cstr, emuLog );
|
||||
}
|
||||
|
||||
bool Write( const char* fmt, VARG_PARAM dummy, ... )
|
||||
|
@ -43,59 +159,42 @@ namespace Console
|
|||
|
||||
va_list list;
|
||||
va_start(list,dummy);
|
||||
WriteLn( vfmt_string( fmt, list ).c_str() );
|
||||
|
||||
ScopedLock locker( m_writelock );
|
||||
vssprintf( m_format_buffer, fmt, list );
|
||||
Write( m_format_buffer.c_str() );
|
||||
|
||||
va_end(list);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Write( Colors color, const char* fmt )
|
||||
{
|
||||
SetColor( color );
|
||||
Write( fmt );
|
||||
ClearColor();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Write( Colors color, const char* fmt, VARG_PARAM dummy, ... )
|
||||
{
|
||||
varg_assert();
|
||||
|
||||
va_list list;
|
||||
va_start(list,dummy);
|
||||
Write( vfmt_string( fmt, list ).c_str() );
|
||||
va_end(list);
|
||||
|
||||
ScopedLock locker( m_writelock );
|
||||
vssprintf( m_format_buffer, fmt, list );
|
||||
Write( color, m_format_buffer.c_str() );
|
||||
|
||||
va_end(list);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WriteLn( const char* fmt, VARG_PARAM dummy, ... )
|
||||
{
|
||||
varg_assert();
|
||||
|
||||
va_list list;
|
||||
va_start(list,dummy);
|
||||
WriteLn( vfmt_string( fmt, list).c_str() );
|
||||
|
||||
ScopedLock locker( m_writelock );
|
||||
vssprintf( m_format_buffer, fmt, list );
|
||||
WriteLn( m_format_buffer.c_str() );
|
||||
|
||||
va_end(list);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Writes an unformatted string of text to the console (fast!)
|
||||
// A newline is automatically appended.
|
||||
__forceinline bool __fastcall WriteLn( const char* fmt )
|
||||
{
|
||||
Write( fmt );
|
||||
Newline();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Writes an unformatted string of text to the console (fast!)
|
||||
// A newline is automatically appended.
|
||||
__forceinline bool __fastcall WriteLn( Colors color, const char* fmt )
|
||||
{
|
||||
Write( color, fmt );
|
||||
Newline();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -131,7 +230,6 @@ namespace Console
|
|||
varg_assert();
|
||||
|
||||
va_list list;
|
||||
|
||||
va_start(list,dummy);
|
||||
_WriteLn( Color_Yellow, fmt, list );
|
||||
va_end(list);
|
||||
|
@ -153,7 +251,7 @@ namespace Console
|
|||
|
||||
// Displays a message in the console with red emphasis.
|
||||
// Newline is automatically appended.
|
||||
bool Error( const char* fmt )
|
||||
bool __fastcall Error( const char* fmt )
|
||||
{
|
||||
WriteLn( Color_Red, fmt );
|
||||
return false;
|
||||
|
@ -161,7 +259,7 @@ namespace Console
|
|||
|
||||
// Displays a message in the console with yellow emphasis.
|
||||
// Newline is automatically appended.
|
||||
bool Notice( const char* fmt )
|
||||
bool __fastcall Notice( const char* fmt )
|
||||
{
|
||||
WriteLn( Color_Yellow, fmt );
|
||||
return false;
|
||||
|
@ -169,7 +267,7 @@ namespace Console
|
|||
|
||||
// Displays a message in the console with green emphasis.
|
||||
// Newline is automatically appended.
|
||||
bool Status( const char* fmt )
|
||||
bool __fastcall Status( const char* fmt )
|
||||
{
|
||||
WriteLn( Color_Green, fmt );
|
||||
return false;
|
||||
|
@ -177,3 +275,31 @@ namespace Console
|
|||
|
||||
}
|
||||
|
||||
namespace Msgbox
|
||||
{
|
||||
bool Alert(const char* text)
|
||||
{
|
||||
wxMessageBox( text, "Pcsx2 Message", wxOK, wxGetApp().GetTopWindow() );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Alert(const char* fmt, VARG_PARAM dummy, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, dummy);
|
||||
Alert( vfmt_string( fmt, list ).c_str() );
|
||||
va_end(list);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OkCancel( const char* fmt, VARG_PARAM dummy, ... )
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, dummy);
|
||||
int result = wxMessageBox( vfmt_string( fmt, list ), "Pcsx2 Message", wxOK | wxCANCEL, wxGetApp().GetTopWindow() );
|
||||
va_end(list);
|
||||
|
||||
return result == wxOK;
|
||||
}
|
||||
}
|
|
@ -68,11 +68,11 @@ namespace Exception
|
|||
class BaseException
|
||||
{
|
||||
protected:
|
||||
const std::string m_message; // a "detailed" message of what disasterous thing has occured!
|
||||
const wxString m_message; // a "detailed" message of what disasterous thing has occured!
|
||||
|
||||
public:
|
||||
virtual ~BaseException() throw()=0; // the =0; syntax forces this class into "abstract" mode.
|
||||
explicit BaseException( const std::string& msg="Unhandled exception." ) :
|
||||
explicit BaseException( const wxString& msg="Unhandled exception." ) :
|
||||
m_message( msg )
|
||||
{
|
||||
// Major hack. After a couple of tries, I'm still not managing to get Linux to catch these exceptions, so that the user actually
|
||||
|
@ -86,7 +86,7 @@ namespace Exception
|
|||
#endif
|
||||
}
|
||||
|
||||
const std::string& Message() const { return m_message; }
|
||||
const wxString& Message() const { return m_message; }
|
||||
const char* cMessage() const { return m_message.c_str(); }
|
||||
};
|
||||
|
||||
|
@ -96,7 +96,7 @@ namespace Exception
|
|||
public:
|
||||
virtual ~Ps2Generic() throw() {}
|
||||
|
||||
explicit Ps2Generic( const std::string& msg="The Ps2/MIPS state encountered a general exception." ) :
|
||||
explicit Ps2Generic( const wxString& msg="The Ps2/MIPS state encountered a general exception." ) :
|
||||
Exception::BaseException( msg )
|
||||
{
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ namespace Exception
|
|||
{
|
||||
public:
|
||||
virtual ~RuntimeError() throw() {}
|
||||
explicit RuntimeError( const std::string& msg="An unhandled runtime error has occurred, somewhere in the depths of Pcsx2's cluttered brain-matter." ) :
|
||||
explicit RuntimeError( const wxString& msg="An unhandled runtime error has occurred, somewhere in the depths of Pcsx2's cluttered brain-matter." ) :
|
||||
BaseException( msg )
|
||||
{}
|
||||
};
|
||||
|
@ -120,7 +120,7 @@ namespace Exception
|
|||
{
|
||||
public:
|
||||
virtual ~LogicError() throw() {}
|
||||
explicit LogicError( const std::string& msg="An unhandled logic error has occured." ) :
|
||||
explicit LogicError( const wxString& msg="An unhandled logic error has occured." ) :
|
||||
BaseException( msg )
|
||||
{}
|
||||
};
|
||||
|
@ -130,7 +130,7 @@ namespace Exception
|
|||
class OutOfMemory : public RuntimeError
|
||||
{
|
||||
public:
|
||||
explicit OutOfMemory( const std::string& msg="Out of memory!" ) :
|
||||
explicit OutOfMemory( const wxString& msg="Out of memory!" ) :
|
||||
RuntimeError( msg ) {}
|
||||
virtual ~OutOfMemory() throw() {}
|
||||
};
|
||||
|
@ -141,7 +141,7 @@ namespace Exception
|
|||
{
|
||||
public:
|
||||
virtual ~InvalidOperation() throw() {}
|
||||
explicit InvalidOperation( const std::string& msg="Attempted method call is invalid for the current object or program state." ) :
|
||||
explicit InvalidOperation( const wxString& msg="Attempted method call is invalid for the current object or program state." ) :
|
||||
LogicError( msg ) {}
|
||||
};
|
||||
|
||||
|
@ -151,7 +151,7 @@ namespace Exception
|
|||
{
|
||||
public:
|
||||
virtual ~InvalidArgument() throw() {}
|
||||
explicit InvalidArgument( const std::string& msg="Invalid argument passed to a function." ) :
|
||||
explicit InvalidArgument( const wxString& msg="Invalid argument passed to a function." ) :
|
||||
LogicError( msg ) {}
|
||||
};
|
||||
|
||||
|
@ -161,16 +161,24 @@ namespace Exception
|
|||
{
|
||||
public:
|
||||
virtual ~IndexBoundsFault() throw() {}
|
||||
explicit IndexBoundsFault( const std::string& msg="Array index is outsides the bounds of an array." ) :
|
||||
explicit IndexBoundsFault( const wxString& msg="Array index is outsides the bounds of an array." ) :
|
||||
LogicError( msg ) {}
|
||||
};
|
||||
|
||||
class ParseError : public RuntimeError
|
||||
{
|
||||
public:
|
||||
virtual ~ParseError() throw() {}
|
||||
explicit ParseError( const wxString& msg="Parse error" ) :
|
||||
RuntimeError( msg ) {}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class HardwareDeficiency : public RuntimeError
|
||||
{
|
||||
public:
|
||||
explicit HardwareDeficiency( const std::string& msg="Your machine's hardware is incapable of running Pcsx2. Sorry dood." ) :
|
||||
explicit HardwareDeficiency( const wxString& msg="Your machine's hardware is incapable of running Pcsx2. Sorry dood." ) :
|
||||
RuntimeError( msg ) {}
|
||||
virtual ~HardwareDeficiency() throw() {}
|
||||
};
|
||||
|
@ -182,17 +190,17 @@ namespace Exception
|
|||
{
|
||||
public:
|
||||
virtual ~CpuStateShutdown() throw() {}
|
||||
explicit CpuStateShutdown( const std::string& msg="The PS2 emulated state was shut down unexpectedly." ) :
|
||||
explicit CpuStateShutdown( const wxString& msg="The PS2 emulated state was shut down unexpectedly." ) :
|
||||
RuntimeError( msg ) {}
|
||||
};
|
||||
|
||||
class PluginFailure : public RuntimeError
|
||||
{
|
||||
public:
|
||||
std::string plugin_name; // name of the plugin
|
||||
wxString plugin_name; // name of the plugin
|
||||
|
||||
virtual ~PluginFailure() throw() {}
|
||||
explicit PluginFailure( const std::string& plugin, const std::string& msg = "A plugin encountered a critical error." ) :
|
||||
explicit PluginFailure( const wxString& plugin, const wxString& msg = "A plugin encountered a critical error." ) :
|
||||
RuntimeError( msg )
|
||||
, plugin_name( plugin ) {}
|
||||
};
|
||||
|
@ -201,7 +209,7 @@ namespace Exception
|
|||
{
|
||||
public:
|
||||
virtual ~ThreadCreationError() throw() {}
|
||||
explicit ThreadCreationError( const std::string& msg="Thread could not be created." ) :
|
||||
explicit ThreadCreationError( const wxString& msg="Thread could not be created." ) :
|
||||
RuntimeError( msg ) {}
|
||||
};
|
||||
|
||||
|
@ -212,7 +220,7 @@ namespace Exception
|
|||
{
|
||||
public:
|
||||
virtual ~PathTooLong() throw() {}
|
||||
explicit PathTooLong( const std::string& msg=
|
||||
explicit PathTooLong( const wxString& msg=
|
||||
"A Pcsx2 pathname was too long for the system. Please move or reinstall Pcsx2 to\n"
|
||||
"a location on your hard drive that has a shorter path." ) :
|
||||
RuntimeError( msg ) {}
|
||||
|
@ -226,7 +234,7 @@ namespace Exception
|
|||
class Stream : public RuntimeError
|
||||
{
|
||||
public:
|
||||
std::string stream_name; // name of the stream (if applicable)
|
||||
wxString stream_name; // name of the stream (if applicable)
|
||||
|
||||
virtual ~Stream() throw() {}
|
||||
|
||||
|
@ -236,8 +244,8 @@ namespace Exception
|
|||
, stream_name( src.stream_name ) {}
|
||||
|
||||
explicit Stream(
|
||||
const std::string& objname=std::string(),
|
||||
const std::string& msg="Invalid stream object" ) :
|
||||
const wxString& objname=wxString(),
|
||||
const wxString& msg="Invalid stream object" ) :
|
||||
RuntimeError( msg + "\n\tFilename: " + objname )
|
||||
, stream_name( objname ) {}
|
||||
};
|
||||
|
@ -250,8 +258,8 @@ namespace Exception
|
|||
public:
|
||||
virtual ~BadStream() throw() {}
|
||||
explicit BadStream(
|
||||
const std::string& objname=std::string(),
|
||||
const std::string& msg="Stream data is corrupted or incomplete, or the stream connection closed unexpectedly" ) :
|
||||
const wxString& objname=wxString(),
|
||||
const wxString& msg="Stream data is corrupted or incomplete, or the stream connection closed unexpectedly" ) :
|
||||
Stream( objname, msg ) {}
|
||||
};
|
||||
|
||||
|
@ -261,8 +269,8 @@ namespace Exception
|
|||
public:
|
||||
virtual ~CreateStream() throw() {}
|
||||
explicit CreateStream(
|
||||
const std::string& objname=std::string(),
|
||||
const std::string& msg="Stream could not be created or opened" ) :
|
||||
const wxString& objname=wxString(),
|
||||
const wxString& msg="Stream could not be created or opened" ) :
|
||||
Stream( objname, msg ) {}
|
||||
};
|
||||
|
||||
|
@ -273,8 +281,8 @@ namespace Exception
|
|||
public:
|
||||
virtual ~FileNotFound() throw() {}
|
||||
explicit FileNotFound(
|
||||
const std::string& objname=std::string(),
|
||||
const std::string& msg="File not found" ) :
|
||||
const wxString& objname=wxString(),
|
||||
const wxString& msg="File not found" ) :
|
||||
CreateStream( objname, msg ) {}
|
||||
};
|
||||
|
||||
|
@ -283,8 +291,8 @@ namespace Exception
|
|||
public:
|
||||
virtual ~AccessDenied() throw() {}
|
||||
explicit AccessDenied(
|
||||
const std::string& objname=std::string(),
|
||||
const std::string& msg="Permission denied to file or stream" ) :
|
||||
const wxString& objname=wxString(),
|
||||
const wxString& msg="Permission denied to file or stream" ) :
|
||||
CreateStream( objname, msg ) {}
|
||||
};
|
||||
|
||||
|
@ -294,7 +302,7 @@ namespace Exception
|
|||
{
|
||||
public:
|
||||
virtual ~EndOfStream() throw() {}
|
||||
explicit EndOfStream( const std::string& objname=std::string(), const std::string& msg="End of stream was encountered" ) :
|
||||
explicit EndOfStream( const wxString& objname=wxString(), const wxString& msg="End of stream was encountered" ) :
|
||||
Stream( objname, msg ) {}
|
||||
};
|
||||
|
||||
|
@ -307,8 +315,8 @@ namespace Exception
|
|||
public:
|
||||
virtual ~BadSavedState() throw() {}
|
||||
explicit BadSavedState(
|
||||
const std::string& objname=std::string(),
|
||||
const std::string& msg="Savestate data is corrupted or incomplete" ) :
|
||||
const wxString& objname=wxString(),
|
||||
const wxString& msg="Savestate data is corrupted or incomplete" ) :
|
||||
BadStream( objname, msg ) {}
|
||||
};
|
||||
|
||||
|
@ -316,11 +324,11 @@ namespace Exception
|
|||
class FreezePluginFailure : public RuntimeError
|
||||
{
|
||||
public:
|
||||
std::string plugin_name; // name of the plugin
|
||||
std::string freeze_action;
|
||||
wxString plugin_name; // name of the plugin
|
||||
wxString freeze_action;
|
||||
|
||||
virtual ~FreezePluginFailure() throw() {}
|
||||
explicit FreezePluginFailure( const std::string& plugin, const std::string& action ) :
|
||||
explicit FreezePluginFailure( const wxString& plugin, const wxString& action ) :
|
||||
RuntimeError( plugin + " plugin returned an error while " + action + " the state." )
|
||||
, plugin_name( plugin )
|
||||
, freeze_action( action ){}
|
||||
|
@ -333,7 +341,7 @@ namespace Exception
|
|||
{
|
||||
public:
|
||||
virtual ~StateLoadError_Recoverable() throw() {}
|
||||
explicit StateLoadError_Recoverable( const std::string& msg="Recoverable error while loading savestate (existing emulation state is still intact)." ) :
|
||||
explicit StateLoadError_Recoverable( const wxString& msg="Recoverable error while loading savestate (existing emulation state is still intact)." ) :
|
||||
RuntimeError( msg ) {}
|
||||
};
|
||||
|
||||
|
@ -349,7 +357,7 @@ namespace Exception
|
|||
StateLoadError_Recoverable( fmt_string( "Unknown or unsupported savestate version: 0x%x", version ) )
|
||||
{}
|
||||
|
||||
explicit UnsupportedStateVersion( int version, const std::string& msg ) :
|
||||
explicit UnsupportedStateVersion( int version, const wxString& msg ) :
|
||||
StateLoadError_Recoverable( msg ) {}
|
||||
};
|
||||
|
||||
|
@ -373,7 +381,7 @@ namespace Exception
|
|||
, Crc_Cdvd( crc_cdvd )
|
||||
{}
|
||||
|
||||
explicit StateCrcMismatch( u32 crc_save, u32 crc_cdvd, const std::string& msg )
|
||||
explicit StateCrcMismatch( u32 crc_save, u32 crc_cdvd, const wxString& msg )
|
||||
: StateLoadError_Recoverable( msg )
|
||||
, Crc_Savestate( crc_save )
|
||||
, Crc_Cdvd( crc_cdvd )
|
||||
|
|
|
@ -53,8 +53,8 @@ extern StartupParams g_Startup;
|
|||
//
|
||||
// Most of these are implemented in SystemGui.cpp
|
||||
|
||||
extern void States_Load( const string& file );
|
||||
extern void States_Save( const string& file );
|
||||
extern void States_Load( const wxString& file );
|
||||
extern void States_Save( const wxString& file );
|
||||
extern void States_Load( int num );
|
||||
extern void States_Save( int num );
|
||||
extern bool States_isSlotUsed(int num);
|
||||
|
|
|
@ -177,8 +177,10 @@ void bios_write() { // 0x35/0x03
|
|||
if (a0 == 1) { // stdout
|
||||
const char *ptr = Ra1;
|
||||
|
||||
// fixme: This should use %s with a length parameter (but I forget the exact syntax
|
||||
// offhand, so maybe do it later).
|
||||
while (a2 > 0) {
|
||||
SysPrintf("%c", *ptr++); a2--;
|
||||
Console::Write("%c", params *ptr++); a2--;
|
||||
}
|
||||
pc0 = ra; return;
|
||||
}
|
||||
|
@ -203,7 +205,7 @@ void bios_printf() { // 3f
|
|||
iopMemWrite32(sp + 12, a3);
|
||||
|
||||
|
||||
// old code used phys... is tlb more correct?
|
||||
// old code used phys... is iopMemRead32 more correct?
|
||||
//psxMu32(sp) = a0;
|
||||
//psxMu32(sp + 4) = a1;
|
||||
//psxMu32(sp + 8) = a2;
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __MEMCPY_FAST_H__
|
||||
#define __MEMCPY_FAST_H__
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include "windows/memzero.h"
|
||||
|
@ -42,7 +41,5 @@
|
|||
extern void memxor_mmx(void* dst, const void* src1, int cmpsize);
|
||||
#endif
|
||||
|
||||
#define memcpy_fast memcpy_amd_
|
||||
#define memcpy_aligned memcpy_amd_
|
||||
|
||||
#endif //Header
|
||||
#define memcpy_fast memcpy_amd_
|
||||
#define memcpy_aligned memcpy_amd_
|
||||
|
|
|
@ -53,7 +53,7 @@ bool renderswitch = 0;
|
|||
|
||||
#define NUM_STATES 10
|
||||
int StatesC = 0;
|
||||
extern char strgametitle[256];
|
||||
extern wxString strgametitle;
|
||||
|
||||
|
||||
const char *LabelAuthors = {
|
||||
|
@ -148,7 +148,7 @@ int IsBIOS(const char *filename, char *description)
|
|||
unsigned int fileOffset=0, found=FALSE;
|
||||
struct romdir rd;
|
||||
|
||||
string Bios( Path::Combine( Config.BiosDir, filename ) );
|
||||
wxString Bios( Path::Combine( Config.BiosDir, filename ) );
|
||||
|
||||
int biosFileSize = Path::getFileSize( Bios );
|
||||
if( biosFileSize <= 0) return FALSE;
|
||||
|
@ -302,7 +302,7 @@ int GetPS2ElfName(char *name){
|
|||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
|
||||
void SaveGSState(const string& file)
|
||||
void SaveGSState(const wxString& file)
|
||||
{
|
||||
if( g_SaveGSStream ) return;
|
||||
|
||||
|
@ -317,7 +317,7 @@ void SaveGSState(const string& file)
|
|||
g_fGSSave->Freeze( g_nLeftGSFrames );
|
||||
}
|
||||
|
||||
void LoadGSState(const string& file)
|
||||
void LoadGSState(const wxString& file)
|
||||
{
|
||||
int ret;
|
||||
gzLoadingState* f;
|
||||
|
@ -333,8 +333,7 @@ void LoadGSState(const string& file)
|
|||
// file not found? try prefixing with sstates folder:
|
||||
if( !Path::isRooted( file ) )
|
||||
{
|
||||
string strfile( Path::Combine( SSTATES_DIR, file ) );
|
||||
f = new gzLoadingState( strfile.c_str() );
|
||||
f = new gzLoadingState( Path::Combine( SSTATES_DIR, file ).c_str() );
|
||||
|
||||
// If this load attempt fails, then let the exception bubble up to
|
||||
// the caller to deal with...
|
||||
|
@ -375,10 +374,10 @@ char* mystrlwr( char* string )
|
|||
return string;
|
||||
}
|
||||
|
||||
static string GetGSStateFilename()
|
||||
static wxString GetGSStateFilename()
|
||||
{
|
||||
string gsText;
|
||||
ssprintf( gsText, "/%8.8X.%d.gs", ElfCRC, StatesC);
|
||||
wxString gsText;
|
||||
gsText.Printf( "/%8.8X.%d.gs", ElfCRC, StatesC );
|
||||
return Path::Combine( SSTATES_DIR, gsText );
|
||||
}
|
||||
|
||||
|
@ -545,18 +544,21 @@ void ProcessFKeys(int fkey, int shift)
|
|||
}
|
||||
else
|
||||
{
|
||||
string Text;
|
||||
if( strgametitle[0] != 0 ) {
|
||||
wxString Text;
|
||||
if( strgametitle[0] != 0 )
|
||||
{
|
||||
// only take the first two words
|
||||
char name[256], *tok;
|
||||
string gsText;
|
||||
wxString gsText;
|
||||
|
||||
tok = strtok(strgametitle, " ");
|
||||
sprintf(name, "%s_", mystrlwr(tok));
|
||||
tok = strtok(NULL, " ");
|
||||
if( tok != NULL ) strcat(name, tok);
|
||||
wxStringTokenizer parts( strgametitle, " " );
|
||||
|
||||
ssprintf( gsText, "%s.%d.gs", name, StatesC);
|
||||
wxString name( parts.GetNextToken() ); // first part
|
||||
wxString part2( parts.GetNextToken() );
|
||||
|
||||
if( !!part2 )
|
||||
name += "_" + part2;
|
||||
|
||||
gsText.Printf( "%s.%d.gs", name.c_str(), StatesC );
|
||||
Text = Path::Combine( SSTATES_DIR, gsText );
|
||||
}
|
||||
else
|
||||
|
|
19
pcsx2/Misc.h
19
pcsx2/Misc.h
|
@ -22,21 +22,6 @@
|
|||
#include "System.h"
|
||||
#include "Pcsx2Config.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Pcsx2 Custom Translation System
|
||||
// Work-in-progress!
|
||||
//
|
||||
static const char* _t( const char* translate_me_please )
|
||||
{
|
||||
return translate_me_please;
|
||||
}
|
||||
|
||||
// Temporary placebo?
|
||||
static const char* _( const char* translate_me_please )
|
||||
{
|
||||
return translate_me_please;
|
||||
}
|
||||
|
||||
// what the hell is this unused piece of crap passed to every plugin for? (air)
|
||||
// Agreed. It ought to get removed in the next version of the plugin api. (arcum42)
|
||||
extern uptr pDsp; //Used in GS, MTGS, Plugins, Misc
|
||||
|
@ -80,8 +65,8 @@ extern const char *LabelAuthors;
|
|||
extern const char *LabelGreets;
|
||||
void CycleFrameLimit(int dir);
|
||||
|
||||
void SaveGSState(const string& file);
|
||||
void LoadGSState(const string& file);
|
||||
void SaveGSState(const wxString& file);
|
||||
void LoadGSState(const wxString& file);
|
||||
|
||||
#endif /* __MISC_H__ */
|
||||
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/fileconf.h>
|
||||
|
||||
#include "System.h"
|
||||
|
||||
struct ConsoleLogOptions
|
||||
{
|
||||
bool Show;
|
||||
// if true, DisplayPos is ignored and the console is automatically docked to the main window.
|
||||
bool AutoDock;
|
||||
// Display position used if AutoDock is false (ignored otherwise)
|
||||
wxPoint DisplayPos;
|
||||
wxSize DisplaySize;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class AppConfig : public wxFileConfig
|
||||
{
|
||||
public:
|
||||
ConsoleLogOptions ConLogBox;
|
||||
wxPoint MainGuiPosition;
|
||||
|
||||
public:
|
||||
AppConfig( const wxString& filename );
|
||||
void LoadSettings();
|
||||
void SaveSettings();
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class ConsoleLogFrame : public wxFrame, public NoncopyableObject
|
||||
{
|
||||
protected:
|
||||
wxTextCtrl& m_TextCtrl;
|
||||
|
||||
public:
|
||||
// ctor & dtor
|
||||
ConsoleLogFrame(wxWindow *pParent, const wxString& szTitle);
|
||||
virtual ~ConsoleLogFrame();
|
||||
|
||||
// menu callbacks
|
||||
virtual void OnClose(wxCommandEvent& event);
|
||||
virtual void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
virtual void OnSave (wxCommandEvent& event);
|
||||
virtual void OnClear(wxCommandEvent& event);
|
||||
|
||||
virtual void Write( const wxChar* text );
|
||||
void Newline();
|
||||
|
||||
void SetColor( Console::Colors color );
|
||||
void ClearColor();
|
||||
|
||||
protected:
|
||||
// use standard ids for our commands!
|
||||
enum
|
||||
{
|
||||
Menu_Close = wxID_CLOSE,
|
||||
Menu_Save = wxID_SAVE,
|
||||
Menu_Clear = wxID_CLEAR
|
||||
};
|
||||
|
||||
// common part of OnClose() and OnCloseWindow()
|
||||
virtual void DoClose();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
void OnMoveAround( wxMoveEvent& evt );
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class Pcsx2App : public wxApp
|
||||
{
|
||||
protected:
|
||||
ConsoleLogFrame* m_ConsoleFrame;
|
||||
AppConfig* m_GlobalConfig;
|
||||
|
||||
public:
|
||||
Pcsx2App();
|
||||
|
||||
bool OnInit();
|
||||
int OnExit();
|
||||
|
||||
ConsoleLogFrame* GetConsoleFrame() const { return m_ConsoleFrame; }
|
||||
void SetConsoleFrame( ConsoleLogFrame& frame ) { m_ConsoleFrame = &frame; }
|
||||
|
||||
AppConfig& GetActiveConfig() const;
|
||||
};
|
||||
|
||||
DECLARE_APP(Pcsx2App)
|
||||
|
||||
static AppConfig& Conf() { return wxGetApp().GetActiveConfig(); }
|
|
@ -0,0 +1,51 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2009 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "App.h"
|
||||
|
||||
static const wxSize DefaultConsoleSize( 540, 540 );
|
||||
|
||||
AppConfig::AppConfig( const wxString& filename ) :
|
||||
wxFileConfig( wxEmptyString, wxEmptyString, filename, wxEmptyString, wxCONFIG_USE_RELATIVE_PATH )
|
||||
{
|
||||
SetRecordDefaults();
|
||||
wxConfigBase::Set( this );
|
||||
}
|
||||
|
||||
void AppConfig::LoadSettings()
|
||||
{
|
||||
wxString spos( Read( wxT("ConLogDisplayPosition"), "docked" ) );
|
||||
|
||||
if( spos == "docked" )
|
||||
ConLogBox.AutoDock = true;
|
||||
else
|
||||
ConLogBox.AutoDock = !TryParse( ConLogBox.DisplayPos, spos );
|
||||
|
||||
TryParse( ConLogBox.DisplaySize, Read( wxT("ConLogDisplaySize"), ToString( DefaultConsoleSize ) ), DefaultConsoleSize );
|
||||
Read( wxT( "ConLogVisible" ), &ConLogBox.Show, IsDevBuild );
|
||||
|
||||
TryParse( MainGuiPosition, Read( wxT("MainWindowPosition"), ToString( wxDefaultPosition ) ), wxDefaultPosition );
|
||||
|
||||
Flush();
|
||||
}
|
||||
|
||||
void AppConfig::SaveSettings()
|
||||
{
|
||||
Write( wxT("ConLogDisplayPosition"), ConLogBox.AutoDock ? "docked" : ToString( ConLogBox.DisplayPos ) );
|
||||
}
|
|
@ -17,8 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "Misc.h"
|
||||
#include "ConsoleLogger.h"
|
||||
#include "App.h"
|
||||
|
||||
#include <wx/file.h>
|
||||
#include <wx/textfile.h>
|
||||
|
@ -84,18 +83,9 @@ END_EVENT_TABLE()
|
|||
ConsoleLogFrame::ConsoleLogFrame(wxWindow *parent, const wxString& title) :
|
||||
wxFrame(parent, wxID_ANY, title),
|
||||
m_TextCtrl( *new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE |
|
||||
wxHSCROLL |
|
||||
#if !wxUSE_UNICODE
|
||||
wxTE_RICH |
|
||||
#endif
|
||||
wxTE_READONLY ) )
|
||||
wxTE_MULTILINE | wxHSCROLL | wxTE_READONLY | wxTE_RICH2 ) )
|
||||
{
|
||||
// wxTE_RICH note:
|
||||
// needed for Win32 to avoid 65Kb limit but it doesn't work well
|
||||
// when using RichEdit 2.0 which we always do in the Unicode build
|
||||
|
||||
m_TextCtrl.SetBackgroundColour( wxColor( 48, 48, 64 ) );
|
||||
m_TextCtrl.SetBackgroundColour( wxColor( 238, 240, 248 ) ); //wxColor( 48, 48, 64 ) );
|
||||
|
||||
// create menu
|
||||
wxMenuBar *pMenuBar = new wxMenuBar;
|
||||
|
@ -110,10 +100,25 @@ ConsoleLogFrame::ConsoleLogFrame(wxWindow *parent, const wxString& title) :
|
|||
|
||||
// status bar for menu prompts
|
||||
CreateStatusBar();
|
||||
ClearColor();
|
||||
|
||||
Connect( wxEVT_MOVE, wxMoveEventHandler(ConsoleLogFrame::OnMoveAround) );
|
||||
}
|
||||
|
||||
ConsoleLogFrame::~ConsoleLogFrame() { }
|
||||
|
||||
void ConsoleLogFrame::OnMoveAround( wxMoveEvent& evt )
|
||||
{
|
||||
// Docking check! If the window position is within some amount
|
||||
// of the main window, enable docking.
|
||||
|
||||
wxPoint topright( GetParent()->GetRect().GetTopRight() );
|
||||
wxRect snapzone( topright - wxSize( 8,8 ), wxSize( 16,16 ) );
|
||||
|
||||
if( snapzone.Contains( GetPosition() ) )
|
||||
SetPosition( topright + wxSize( 1,0 ) );
|
||||
}
|
||||
|
||||
void ConsoleLogFrame::DoClose()
|
||||
{
|
||||
// instead of closing just hide the window to be able to Show() it later
|
||||
|
@ -167,6 +172,8 @@ static const wxTextAttr tbl_color_codes[] =
|
|||
|
||||
static const wxTextAttr color_default( wxColor( 192, 192, 192 ) );
|
||||
|
||||
// Note: SetColor currently does not work on Win32, but I suspect it *should* work when
|
||||
// we enable unicode compilation. (I really hope!)
|
||||
void ConsoleLogFrame::SetColor( Console::Colors color )
|
||||
{
|
||||
m_TextCtrl.SetDefaultStyle( tbl_color_codes[(int)color] );
|
||||
|
@ -177,19 +184,18 @@ void ConsoleLogFrame::ClearColor()
|
|||
m_TextCtrl.SetDefaultStyle( color_default );
|
||||
}
|
||||
|
||||
void ConsoleLogFrame::Newline()
|
||||
{
|
||||
Write( wxT("\n") );
|
||||
}
|
||||
|
||||
void ConsoleLogFrame::Write( const wxChar* text )
|
||||
{
|
||||
// remove selection (WriteText is in fact ReplaceSelection)
|
||||
#ifdef __WXMSW__
|
||||
wxTextPos nLen = m_TextCtrl.GetLastPosition();
|
||||
m_TextCtrl.SetSelection(nLen, nLen);
|
||||
#endif // Windows
|
||||
#endif
|
||||
|
||||
m_TextCtrl.AppendText( text );
|
||||
}
|
||||
|
||||
void ConsoleLogFrame::WriteLn( const wxChar* text )
|
||||
{
|
||||
Write( text );
|
||||
Write( "\n" );
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2009 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include "Misc.h"
|
||||
|
||||
class ConsoleLogFrame : public wxFrame, public NoncopyableObject
|
||||
{
|
||||
protected:
|
||||
wxTextCtrl& m_TextCtrl;
|
||||
|
||||
public:
|
||||
// ctor & dtor
|
||||
ConsoleLogFrame(wxWindow *pParent, const wxString& szTitle);
|
||||
virtual ~ConsoleLogFrame();
|
||||
|
||||
// menu callbacks
|
||||
virtual void OnClose(wxCommandEvent& event);
|
||||
virtual void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
virtual void OnSave (wxCommandEvent& event);
|
||||
virtual void OnClear(wxCommandEvent& event);
|
||||
|
||||
virtual void Write( const wxChar* text );
|
||||
virtual void WriteLn( const wxChar* text );
|
||||
|
||||
virtual void SetColor( Console::Colors color );
|
||||
virtual void ClearColor();
|
||||
|
||||
protected:
|
||||
// use standard ids for our commands!
|
||||
enum
|
||||
{
|
||||
Menu_Close = wxID_CLOSE,
|
||||
Menu_Save = wxID_SAVE,
|
||||
Menu_Clear = wxID_CLEAR
|
||||
};
|
||||
|
||||
// common part of OnClose() and OnCloseWindow()
|
||||
virtual void DoClose();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
|
@ -86,8 +86,18 @@ void frmMain::PopulatePadMenu()
|
|||
#define ConnectMenu( id, handler ) \
|
||||
Connect( id, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::handler) )
|
||||
|
||||
void frmMain::OnMoveAround( wxMoveEvent& evt )
|
||||
{
|
||||
if( Conf().ConLogBox.AutoDock )
|
||||
m_logbox.SetPosition( Conf().ConLogBox.DisplayPos = GetPosition() + wxSize( GetSize().x, 0 ) );
|
||||
|
||||
//evt.Skip();
|
||||
}
|
||||
|
||||
void frmMain::ConnectMenus()
|
||||
{
|
||||
Connect( wxEVT_MOVE, wxMoveEventHandler(frmMain::OnMoveAround) );
|
||||
|
||||
// This just seems a bit more flexible & intuitive to me, if overly verbose.
|
||||
|
||||
ConnectMenu( Menu_QuickBootCD, Menu_QuickBootCD_Click );
|
||||
|
@ -115,13 +125,13 @@ void frmMain::ConnectMenus()
|
|||
|
||||
void frmMain::OnLogBoxShown()
|
||||
{
|
||||
newConfig.ConLogBox.Show = true;
|
||||
Conf().ConLogBox.Show = true;
|
||||
m_MenuItem_Console.Check( true );
|
||||
}
|
||||
|
||||
void frmMain::OnLogBoxHidden()
|
||||
{
|
||||
newConfig.ConLogBox.Show = false;
|
||||
Conf().ConLogBox.Show = false;
|
||||
m_MenuItem_Console.Check( false );
|
||||
}
|
||||
|
||||
|
@ -149,6 +159,8 @@ frmMain::frmMain(wxWindow* parent, int id, const wxString& title, const wxPoint&
|
|||
m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, Menu_Console, _T("Show Console"), wxEmptyString, wxITEM_CHECK ) )
|
||||
{
|
||||
|
||||
wxGetApp().SetConsoleFrame( m_logbox );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Initial menubar setup. This needs to be done first so that the menu bar's visible size
|
||||
// can be factored into the window size (which ends up being background+status+menus)
|
||||
|
@ -176,22 +188,40 @@ frmMain::frmMain(wxWindow* parent, int id, const wxString& title, const wxPoint&
|
|||
wxBoxSizer& joe( *new wxBoxSizer( wxVERTICAL ) );
|
||||
joe.Add( &m_background );
|
||||
SetSizerAndFit( &joe );
|
||||
|
||||
// Valid zone for window positioning.
|
||||
// Top/Left boundaries are fairly strict, since any more offscreen and the window titlebar
|
||||
// would be obscured from being grabbable.
|
||||
|
||||
if( newConfig.MainGuiPosition == wxDefaultPosition )
|
||||
newConfig.MainGuiPosition = GetPosition();
|
||||
wxRect screenzone( wxPoint(), wxGetDisplaySize() );
|
||||
|
||||
// Use default window position if the configured windowpos is invalid (partially offscreen)
|
||||
if( Conf().MainGuiPosition == wxDefaultPosition || !screenzone.Contains( wxRect( Conf().MainGuiPosition, GetSize() ) ) )
|
||||
Conf().MainGuiPosition = GetPosition();
|
||||
else
|
||||
SetPosition( newConfig.MainGuiPosition );
|
||||
SetPosition( Conf().MainGuiPosition );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Sort out the console log window position (must be done after fitting the window
|
||||
// sizer, to ensure correct 'docked mode' positioning).
|
||||
|
||||
if( newConfig.ConLogBox.DisplayArea == wxRectUnspecified )
|
||||
newConfig.ConLogBox.DisplayArea =
|
||||
wxRect( GetPosition() + wxSize( GetSize().x, 0 ), wxSize( 540, 540 ) );
|
||||
|
||||
m_logbox.SetSize( newConfig.ConLogBox.DisplayArea );
|
||||
m_logbox.Show( newConfig.ConLogBox.Show );
|
||||
Conf().ConLogBox.DisplaySize.Set(
|
||||
std::min( std::max( Conf().ConLogBox.DisplaySize.GetWidth(), 160 ), screenzone.GetWidth() ),
|
||||
std::min( std::max( Conf().ConLogBox.DisplaySize.GetHeight(), 160 ), screenzone.GetHeight() )
|
||||
);
|
||||
|
||||
if( Conf().ConLogBox.AutoDock )
|
||||
{
|
||||
Conf().ConLogBox.DisplayPos = GetPosition() + wxSize( GetSize().x, 0 );
|
||||
}
|
||||
else if( Conf().ConLogBox.DisplayPos != wxDefaultPosition )
|
||||
{
|
||||
if( !screenzone.Contains( wxRect( Conf().ConLogBox.DisplayPos, wxSize( 75, 150 ) ) ) )
|
||||
Conf().ConLogBox.DisplayPos = wxDefaultPosition;
|
||||
}
|
||||
|
||||
m_logbox.SetSize( wxRect( Conf().ConLogBox.DisplayPos, Conf().ConLogBox.DisplaySize ) );
|
||||
m_logbox.Show( Conf().ConLogBox.Show );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
@ -257,7 +287,7 @@ frmMain::frmMain(wxWindow* parent, int id, const wxString& title, const wxPoint&
|
|||
|
||||
ConnectMenus();
|
||||
|
||||
m_MenuItem_Console.Check( newConfig.ConLogBox.Show );
|
||||
m_MenuItem_Console.Check( Conf().ConLogBox.Show );
|
||||
}
|
||||
|
||||
void frmMain::Menu_QuickBootCD_Click(wxCommandEvent &event)
|
||||
|
|
|
@ -21,40 +21,7 @@
|
|||
#include <wx/wx.h>
|
||||
#include <wx/image.h>
|
||||
|
||||
#include "Misc.h"
|
||||
#include "ConsoleLogger.h"
|
||||
|
||||
struct wxPcsx2Config
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool Show;
|
||||
wxRect DisplayArea;
|
||||
} ConLogBox;
|
||||
|
||||
wxPoint MainGuiPosition;
|
||||
};
|
||||
|
||||
extern wxPcsx2Config newConfig;
|
||||
|
||||
extern const wxRect wxRectUnspecified;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class LogWindow : public wxLogWindow
|
||||
{
|
||||
public:
|
||||
LogWindow(wxWindow *pParent, const wxChar *szTitle );
|
||||
|
||||
protected:
|
||||
// Implemented to ensure that the parent's menu option for log visibility is consistent with
|
||||
// the current status of the log window.
|
||||
virtual void OnFrameCreate(wxFrame *frame);
|
||||
|
||||
// Implemented to ensure that the parent's menu option for log visibility is consistent with
|
||||
// the current status of the log window.
|
||||
virtual bool OnFrameClose(wxFrame *frame);
|
||||
};
|
||||
#include "App.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -180,6 +147,8 @@ protected:
|
|||
// Menu Options for the Main Window! :D
|
||||
|
||||
protected:
|
||||
void OnMoveAround( wxMoveEvent& evt );
|
||||
|
||||
void Menu_QuickBootCD_Click(wxCommandEvent &event);
|
||||
void Menu_BootCD_Click(wxCommandEvent &event);
|
||||
void Menu_BootNoCD_Click(wxCommandEvent &event);
|
||||
|
|
|
@ -17,33 +17,121 @@
|
|||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include <wx/wx.h>
|
||||
#include <wx/image.h>
|
||||
#include "frmMain.h"
|
||||
|
||||
#include <wx/image.h>
|
||||
|
||||
#include <ShlObj.h>
|
||||
|
||||
|
||||
class Pcsx2GUI: public wxApp
|
||||
IMPLEMENT_APP(Pcsx2App)
|
||||
|
||||
const wxRect wxDefaultRect( wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord );
|
||||
|
||||
namespace PathDefs
|
||||
{
|
||||
public:
|
||||
bool OnInit();
|
||||
const wxString Screenshots( "snaps" );
|
||||
const wxString Savestates( "sstates" );
|
||||
const wxString MemoryCards( "memcards" );
|
||||
const wxString Configs( "inis" );
|
||||
const wxString Plugins( "plugins" );
|
||||
|
||||
wxString Working;
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
char temp[g_MaxPath];
|
||||
_getcwd( temp, g_MaxPath );
|
||||
Working = temp;
|
||||
}
|
||||
|
||||
// Fetches the path location for user-consumable documents -- stuff users are likely to want to
|
||||
// share with other programs: screenshots, memory cards, and savestates.
|
||||
// [TODO] : Ideally this should be optional, configurable, or conditional such that the Pcsx2
|
||||
// executable working directory can be used. I'm not entirely sure yet the best way to go
|
||||
// about implementating that toggle, though.
|
||||
wxString GetDocuments()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
wxChar path[MAX_PATH];
|
||||
SHGetFolderPath( NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, path );
|
||||
return Path::Combine( path, wxGetApp().GetAppName().c_str() );
|
||||
#else
|
||||
return wxGetHomeDir();
|
||||
#endif
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
wxString GetScreenshots()
|
||||
{
|
||||
return Path::Combine( GetDocuments(), Screenshots );
|
||||
}
|
||||
|
||||
wxString GetBios()
|
||||
{
|
||||
return "bios";
|
||||
}
|
||||
|
||||
wxString GetSavestates()
|
||||
{
|
||||
return Path::Combine( GetDocuments(), Savestates );
|
||||
}
|
||||
|
||||
wxString GetMemoryCards()
|
||||
{
|
||||
return Path::Combine( GetDocuments(), MemoryCards );
|
||||
}
|
||||
|
||||
wxString GetConfigs()
|
||||
{
|
||||
return Path::Combine( GetDocuments(), Configs );
|
||||
}
|
||||
|
||||
wxString GetPlugins()
|
||||
{
|
||||
return Plugins;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_APP(Pcsx2GUI)
|
||||
Pcsx2App::Pcsx2App() :
|
||||
m_ConsoleFrame( NULL ),
|
||||
m_GlobalConfig( NULL )
|
||||
{
|
||||
SetAppName( "Pcsx2" );
|
||||
}
|
||||
|
||||
const wxRect wxRectUnspecified( wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord );
|
||||
wxPcsx2Config newConfig;
|
||||
|
||||
bool Pcsx2GUI::OnInit()
|
||||
bool Pcsx2App::OnInit()
|
||||
{
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
newConfig.ConLogBox.Show = true;
|
||||
newConfig.ConLogBox.DisplayArea = wxRectUnspecified;
|
||||
newConfig.MainGuiPosition = wxDefaultPosition;
|
||||
|
||||
|
||||
// wxWidgets fails badly on Windows, when it comes to picking "default" locations for ini files.
|
||||
// So for now I have to specify the ini file location manually.
|
||||
|
||||
Path::CreateDirectory( PathDefs::GetDocuments() );
|
||||
Path::CreateDirectory( PathDefs::GetConfigs() );
|
||||
|
||||
// FIXME: I think that linux might adhere to a different extension standard than .ini -- I forget which tho.
|
||||
m_GlobalConfig = new AppConfig( Path::Combine( PathDefs::GetConfigs(), GetAppName() ) + ".ini" );
|
||||
m_GlobalConfig->LoadSettings();
|
||||
|
||||
// Allow wx to use our config, and enforces auto-cleanup as well
|
||||
|
||||
frmMain* frameMain = new frmMain( NULL, wxID_ANY, wxEmptyString );
|
||||
SetTopWindow( frameMain );
|
||||
frameMain->Show();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int Pcsx2App::OnExit()
|
||||
{
|
||||
m_GlobalConfig->SaveSettings();
|
||||
return wxApp::OnExit();
|
||||
}
|
||||
|
||||
AppConfig& Pcsx2App::GetActiveConfig() const
|
||||
{
|
||||
wxASSERT( m_GlobalConfig != NULL );
|
||||
return *m_GlobalConfig;
|
||||
}
|
||||
|
|
|
@ -1,185 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2009 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _LNX_MEMZERO_H_
|
||||
#define _LNX_MEMZERO_H_
|
||||
|
||||
// To-do: either create a combined Linux/Windows version of this file, or create somewhere to put Linux/Windows
|
||||
// Specific versions of files.
|
||||
|
||||
// This header contains non-optimized implementation of memzero_ptr and memset8_obj,
|
||||
// memset16_obj, etc.
|
||||
|
||||
template< u32 data, typename T >
|
||||
static __forceinline void memset32_obj( T& obj )
|
||||
{
|
||||
// this function works on 32-bit aligned lengths of data only.
|
||||
// If the data length is not a factor of 32 bits, the C++ optimizing compiler will
|
||||
// probably just generate mysteriously broken code in Release builds. ;)
|
||||
|
||||
jASSUME( (sizeof(T) & 0x3) == 0 );
|
||||
|
||||
u32* dest = (u32*)&obj;
|
||||
for( int i=sizeof(T)>>2; i; --i, ++dest )
|
||||
*dest = data;
|
||||
}
|
||||
|
||||
template< uint size >
|
||||
static __forceinline void memzero_ptr( void* dest )
|
||||
{
|
||||
memset( dest, 0, size );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
static __forceinline void memzero_obj( T& obj )
|
||||
{
|
||||
memset( &obj, 0, sizeof( T ) );
|
||||
}
|
||||
|
||||
template< u8 data, typename T >
|
||||
static __forceinline void memset8_obj( T& obj )
|
||||
{
|
||||
// Aligned sizes use the optimized 32 bit inline memset. Unaligned sizes use memset.
|
||||
if( (sizeof(T) & 0x3) != 0 )
|
||||
memset( &obj, data, sizeof( T ) );
|
||||
else
|
||||
memset32_obj<data + (data<<8) + (data<<16) + (data<<24)>( obj );
|
||||
}
|
||||
|
||||
template< u16 data, typename T >
|
||||
static __forceinline void memset16_obj( T& obj )
|
||||
{
|
||||
if( (sizeof(T) & 0x3) != 0 )
|
||||
_memset_16_unaligned( &obj, data, sizeof( T ) );
|
||||
else
|
||||
memset32_obj<data + (data<<16)>( obj );
|
||||
}
|
||||
|
||||
|
||||
// An optimized memset for 8 bit destination data.
|
||||
template< u8 data, size_t bytes >
|
||||
static __forceinline void memset_8( void *dest )
|
||||
{
|
||||
if( bytes == 0 ) return;
|
||||
|
||||
if( (bytes & 0x3) != 0 )
|
||||
{
|
||||
// unaligned data length. No point in doing an optimized inline version (too complicated!)
|
||||
// So fall back on the compiler implementation:
|
||||
|
||||
memset( dest, data, bytes );
|
||||
return;
|
||||
}
|
||||
|
||||
// This function only works on 32-bit alignments of data copied.
|
||||
jASSUME( (bytes & 0x3) == 0 );
|
||||
|
||||
enum
|
||||
{
|
||||
remdat = bytes>>2,
|
||||
data32 = data + (data<<8) + (data<<16) + (data<<24)
|
||||
};
|
||||
|
||||
// macro to execute the x86/32 "stosd" copies.
|
||||
switch( remdat )
|
||||
{
|
||||
case 1:
|
||||
*(u32*)dest = data32;
|
||||
return;
|
||||
|
||||
case 2:
|
||||
((u32*)dest)[0] = data32;
|
||||
((u32*)dest)[1] = data32;
|
||||
return;
|
||||
|
||||
case 3:
|
||||
__asm__
|
||||
(
|
||||
".intel_syntax noprefix\n"
|
||||
"cld\n"
|
||||
// "mov edi, %0\n"
|
||||
// "mov eax, %1\n"
|
||||
"stosd\n"
|
||||
"stosd\n"
|
||||
"stosd\n"
|
||||
".att_syntax\n"
|
||||
:
|
||||
: "D"(dest), "a"(data32)
|
||||
// D - edi, a -- eax, c ecx
|
||||
:
|
||||
);
|
||||
return;
|
||||
|
||||
case 4:
|
||||
__asm__
|
||||
(
|
||||
".intel_syntax noprefix\n"
|
||||
"cld\n"
|
||||
// "mov edi, %0\n"
|
||||
// "mov eax, %1\n"
|
||||
"stosd\n"
|
||||
"stosd\n"
|
||||
"stosd\n"
|
||||
"stosd\n"
|
||||
".att_syntax\n"
|
||||
:
|
||||
: "D"(dest), "a"(data32)
|
||||
:
|
||||
|
||||
);
|
||||
return;
|
||||
|
||||
case 5:
|
||||
__asm__
|
||||
(
|
||||
".intel_syntax noprefix\n"
|
||||
"cld\n"
|
||||
// "mov edi, %0\n"
|
||||
// "mov eax, %1\n"
|
||||
"stosd\n"
|
||||
"stosd\n"
|
||||
"stosd\n"
|
||||
"stosd\n"
|
||||
"stosd\n"
|
||||
".att_syntax\n"
|
||||
:
|
||||
: "D"(dest), "a"(data32)
|
||||
:
|
||||
|
||||
);
|
||||
return;
|
||||
|
||||
default:
|
||||
__asm__
|
||||
(
|
||||
".intel_syntax noprefix\n"
|
||||
"cld\n"
|
||||
// "mov ecx, %0\n"
|
||||
// "mov edi, %1\n"
|
||||
// "mov eax, %2\n"
|
||||
"rep stosd\n"
|
||||
".att_syntax\n"
|
||||
:
|
||||
: "c"(remdat), "D"(dest), "a"(data32)
|
||||
:
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -40,7 +40,7 @@ u32 PrevCheatType=0, PrevCheataddr = 0,LastType = 0;
|
|||
|
||||
int g_ZeroGSOptions=0, patchnumber;
|
||||
|
||||
char strgametitle[256]= {0};
|
||||
wxString strgametitle;
|
||||
|
||||
//
|
||||
// Variables
|
||||
|
@ -462,7 +462,7 @@ void patchFunc_comment( char * text1, char * text2 )
|
|||
void patchFunc_gametitle( char * text1, char * text2 )
|
||||
{
|
||||
Console::WriteLn( "gametitle: %s", params text2 );
|
||||
sprintf(strgametitle,"%s",text2);
|
||||
strgametitle = text2;
|
||||
Console::SetTitle(strgametitle);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,13 +38,13 @@ namespace Path
|
|||
// Path Separator used when creating new paths.
|
||||
static const char Separator( '\\' );
|
||||
// Path separators used when breaking existing paths into parts and pieces.
|
||||
static const string Delimiters( "\\/" );
|
||||
static const wxString Delimiters( "\\/" );
|
||||
#else
|
||||
static const char Separator = '/';
|
||||
static const char Delimiters( '/' );
|
||||
#endif
|
||||
|
||||
bool Exists( const string& path )
|
||||
bool Exists( const wxString& path )
|
||||
{
|
||||
struct stat sbuf;
|
||||
return stat( path.c_str(), &sbuf ) == 0;
|
||||
|
@ -52,7 +52,7 @@ bool Exists( const string& path )
|
|||
|
||||
// This function returns false if the path does not exist, or if the path exists and
|
||||
// is a file.
|
||||
bool isDirectory( const string& path )
|
||||
bool isDirectory( const wxString& path )
|
||||
{
|
||||
struct stat sbuf;
|
||||
if( stat( path.c_str(), &sbuf ) == -1 ) return false;
|
||||
|
@ -61,7 +61,7 @@ bool isDirectory( const string& path )
|
|||
|
||||
// This function returns false if the path does not exist, or if the path exists and
|
||||
// is a directory.
|
||||
bool isFile( const string& path )
|
||||
bool isFile( const wxString& path )
|
||||
{
|
||||
struct stat sbuf;
|
||||
if( stat( path.c_str(), &sbuf ) == -1 ) return false;
|
||||
|
@ -70,14 +70,14 @@ bool isFile( const string& path )
|
|||
|
||||
// Returns the length of the file.
|
||||
// returns -1 if the file is not found.
|
||||
int getFileSize( const string& path )
|
||||
int getFileSize( const wxString& path )
|
||||
{
|
||||
struct stat sbuf;
|
||||
if( stat( path.c_str(), &sbuf ) == -1 ) return -1;
|
||||
return sbuf.st_size;
|
||||
}
|
||||
|
||||
bool isRooted( const string& path )
|
||||
bool isRooted( const wxString& path )
|
||||
{
|
||||
// if the first character is a backslash or period, or the second character
|
||||
// a colon, it's a safe bet we're rooted.
|
||||
|
@ -92,7 +92,7 @@ bool isRooted( const string& path )
|
|||
|
||||
// Concatenates two pathnames together, inserting delimiters (backslash on win32)
|
||||
// as needed! Assumes the 'dest' is allocated to at least g_MaxPath length.
|
||||
string Combine( const string& srcPath, const string& srcFile )
|
||||
wxString Combine( const wxString& srcPath, const wxString& srcFile )
|
||||
{
|
||||
int pathlen, guesslen;
|
||||
|
||||
|
@ -125,19 +125,19 @@ string Combine( const string& srcPath, const string& srcFile )
|
|||
|
||||
// Concatenate!
|
||||
|
||||
string dest( srcPath.begin(), srcPath.begin()+pathlen );
|
||||
wxString dest( srcPath.begin(), srcPath.begin()+pathlen );
|
||||
dest += Separator;
|
||||
dest += srcFile;
|
||||
return dest;
|
||||
}
|
||||
|
||||
// Replaces the extension of the file with the one given.
|
||||
string ReplaceExtension( const string& src, const string& ext )
|
||||
wxString ReplaceExtension( const wxString& src, const wxString& ext )
|
||||
{
|
||||
string dest;
|
||||
wxString dest;
|
||||
|
||||
int pos = src.find_last_of( '.' );
|
||||
if( pos == string::npos || pos == 0 )
|
||||
if( pos == wxString::npos || pos == 0 )
|
||||
dest = src;
|
||||
else
|
||||
dest.assign( src.begin(), src.begin()+pos );
|
||||
|
@ -152,20 +152,20 @@ string ReplaceExtension( const string& src, const string& ext )
|
|||
}
|
||||
|
||||
// finds the starting character position of a filename for the given source path.
|
||||
static int _findFilenamePosition( const string& src)
|
||||
static int _findFilenamePosition( const wxString& src)
|
||||
{
|
||||
// note: the source path could have multiple trailing slashes. We want to ignore those.
|
||||
|
||||
unsigned int startpos = src.find_last_not_of( Delimiters );
|
||||
|
||||
if(startpos == string::npos )
|
||||
if(startpos == wxString::npos )
|
||||
return 0;
|
||||
|
||||
int pos;
|
||||
|
||||
if( startpos < src.length() )
|
||||
{
|
||||
string trimmed( src.begin(), src.begin()+startpos );
|
||||
wxString trimmed( src.begin(), src.begin()+startpos );
|
||||
pos = trimmed.find_last_of( Delimiters );
|
||||
}
|
||||
else
|
||||
|
@ -173,15 +173,15 @@ static int _findFilenamePosition( const string& src)
|
|||
pos = src.find_last_of( Delimiters );
|
||||
}
|
||||
|
||||
if( pos == string::npos )
|
||||
if( pos == wxString::npos )
|
||||
return 0;
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
string ReplaceFilename( const string& src, const string& newfilename )
|
||||
wxString ReplaceFilename( const wxString& src, const wxString& newfilename )
|
||||
{
|
||||
string dest;
|
||||
wxString dest;
|
||||
int pos = _findFilenamePosition( src );
|
||||
|
||||
if( pos == 0 )
|
||||
|
@ -197,35 +197,35 @@ string ReplaceFilename( const string& src, const string& newfilename )
|
|||
return dest;
|
||||
}
|
||||
|
||||
string GetFilename( const string& src )
|
||||
wxString GetFilename( const wxString& src )
|
||||
{
|
||||
int pos = _findFilenamePosition( src );
|
||||
return string( src.begin()+pos, src.end() );
|
||||
return wxString( src.begin()+pos, src.end() );
|
||||
}
|
||||
|
||||
string GetFilenameWithoutExt( const string& src )
|
||||
wxString GetFilenameWithoutExt( const wxString& src )
|
||||
{
|
||||
string fname( GetFilename( src ) );
|
||||
wxString fname( GetFilename( src ) );
|
||||
|
||||
int pos = fname.find_last_of( '.' );
|
||||
if( pos == string::npos || pos == 0 )
|
||||
if( pos == wxString::npos || pos == 0 )
|
||||
return fname;
|
||||
else
|
||||
return string( fname.begin(), fname.begin()+pos );
|
||||
return wxString( fname.begin(), fname.begin()+pos );
|
||||
}
|
||||
|
||||
string GetDirectory( const string& src )
|
||||
wxString GetDirectory( const wxString& src )
|
||||
{
|
||||
int pos = _findFilenamePosition( src );
|
||||
if( pos == 0 )
|
||||
return string();
|
||||
return wxString();
|
||||
else
|
||||
return string( src.begin(), src.begin()+pos );
|
||||
return wxString( src.begin(), src.begin()+pos );
|
||||
}
|
||||
|
||||
// This function mimics the old ANSI C splitpath function. It's more or less superceeded
|
||||
// by one of the many other Path utility functions, but someone might find it useful.
|
||||
void Split( const string& src, string& destpath, string& destfile )
|
||||
void Split( const wxString& src, wxString& destpath, wxString& destfile )
|
||||
{
|
||||
int pos = _findFilenamePosition( src );
|
||||
|
||||
|
@ -243,16 +243,16 @@ void Split( const string& src, string& destpath, string& destfile )
|
|||
|
||||
// Assigns the base/root directory of the given path into dest.
|
||||
// Example /this/that/something.txt -> dest == "/"
|
||||
string GetRootDirectory( const string& src )
|
||||
wxString GetRootDirectory( const wxString& src )
|
||||
{
|
||||
int pos = src.find_first_of( Delimiters );
|
||||
if( pos == string::npos )
|
||||
return string();
|
||||
if( pos == wxString::npos )
|
||||
return wxString();
|
||||
else
|
||||
return string( src.begin(), src.begin()+pos );
|
||||
return wxString( src.begin(), src.begin()+pos );
|
||||
}
|
||||
|
||||
void CreateDirectory( const string& src )
|
||||
void CreateDirectory( const wxString& src )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_mkdir( src.c_str() );
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef _PCSX2_PATHS_H_
|
||||
#define _PCSX2_PATHS_H_
|
||||
|
||||
|
||||
#define g_MaxPath 255 // 255 is safer with antiquated Win32 ASCII APIs.
|
||||
|
||||
#ifdef __LINUX__
|
||||
|
@ -23,24 +22,27 @@ extern char MAIN_DIR[g_MaxPath];
|
|||
#define DEFAULT_MEMCARD1 "Mcd001.ps2"
|
||||
#define DEFAULT_MEMCARD2 "Mcd002.ps2"
|
||||
|
||||
// Windows.h namespace pollution!
|
||||
#undef CreateDirectory
|
||||
|
||||
namespace Path
|
||||
{
|
||||
extern bool isRooted( const std::string& path );
|
||||
extern bool isDirectory( const std::string& path );
|
||||
extern bool isFile( const std::string& path );
|
||||
extern bool Exists( const std::string& path );
|
||||
extern int getFileSize( const std::string& path );
|
||||
extern bool isRooted( const wxString& path );
|
||||
extern bool isDirectory( const wxString& path );
|
||||
extern bool isFile( const wxString& path );
|
||||
extern bool Exists( const wxString& path );
|
||||
extern int getFileSize( const wxString& path );
|
||||
|
||||
extern std::string Combine( const std::string& srcPath, const std::string& srcFile );
|
||||
extern std::string ReplaceExtension( const std::string& src, const std::string& ext );
|
||||
extern std::string ReplaceFilename( const std::string& src, const std::string& newfilename );
|
||||
extern std::string GetFilename( const std::string& src );
|
||||
extern std::string GetDirectory( const std::string& src );
|
||||
extern std::string GetFilenameWithoutExt( const string& src );
|
||||
extern std::string GetRootDirectory( const std::string& src );
|
||||
extern void Split( const std::string& src, std::string& destpath, std::string& destfile );
|
||||
extern wxString Combine( const wxString& srcPath, const wxString& srcFile );
|
||||
extern wxString ReplaceExtension( const wxString& src, const wxString& ext );
|
||||
extern wxString ReplaceFilename( const wxString& src, const wxString& newfilename );
|
||||
extern wxString GetFilename( const wxString& src );
|
||||
extern wxString GetDirectory( const wxString& src );
|
||||
extern wxString GetFilenameWithoutExt( const string& src );
|
||||
extern wxString GetRootDirectory( const wxString& src );
|
||||
extern void Split( const wxString& src, wxString& destpath, wxString& destfile );
|
||||
|
||||
extern void CreateDirectory( const std::string& src );
|
||||
extern void CreateDirectory( const wxString& src );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ USBhandler usbHandler;
|
|||
|
||||
#define TestPS2Esyms(type) if(_TestPS2Esyms(drv,PS2E_LT_##type,PS2E_##type##_VERSION,filename) < 0) return -1;
|
||||
|
||||
int _TestPS2Esyms(void* drv, int type, int expected_version, const string& filename)
|
||||
int _TestPS2Esyms(void* drv, int type, int expected_version, const wxString& filename)
|
||||
{
|
||||
_PS2EgetLibType PS2EgetLibType;
|
||||
_PS2EgetLibVersion2 PS2EgetLibVersion2;
|
||||
|
@ -253,7 +253,7 @@ int _TestPS2Esyms(void* drv, int type, int expected_version, const string& filen
|
|||
int actual_version = ((PS2EgetLibVersion2(type) >> 16)&0xff);
|
||||
|
||||
if( actual_version != expected_version) {
|
||||
Msgbox::Alert("Can't load '%hs', wrong PS2E version (%x != %x)", params &filename, actual_version, expected_version);
|
||||
Msgbox::Alert("Can't load '%s', wrong PS2E version (%x != %x)", params filename.c_str(), actual_version, expected_version);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ void CALLBACK GS_configure() {}
|
|||
void CALLBACK GS_about() {}
|
||||
s32 CALLBACK GS_test() { return 0; }
|
||||
|
||||
int LoadGSplugin(const string& filename)
|
||||
int LoadGSplugin(const wxString& filename)
|
||||
{
|
||||
void *drv;
|
||||
|
||||
|
@ -340,7 +340,7 @@ s32 CALLBACK PAD1_freeze(int mode, freezeData *data) { if (mode == FREEZE_SIZE)
|
|||
s32 CALLBACK PAD1_setSlot(u8 port, u8 slot) { return slot == 1; }
|
||||
s32 CALLBACK PAD1_queryMtap(u8 port) { return 0; }
|
||||
|
||||
int LoadPAD1plugin(const string& filename) {
|
||||
int LoadPAD1plugin(const wxString& filename) {
|
||||
void *drv;
|
||||
|
||||
PAD1plugin = SysLoadLibrary(filename.c_str());
|
||||
|
@ -377,7 +377,7 @@ s32 CALLBACK PAD2_freeze(int mode, freezeData *data) { if (mode == FREEZE_SIZE)
|
|||
s32 CALLBACK PAD2_setSlot(u8 port, u8 slot) { return slot == 1; }
|
||||
s32 CALLBACK PAD2_queryMtap(u8 port) { return 0; }
|
||||
|
||||
int LoadPAD2plugin(const string& filename) {
|
||||
int LoadPAD2plugin(const wxString& filename) {
|
||||
void *drv;
|
||||
|
||||
PAD2plugin = SysLoadLibrary(filename.c_str());
|
||||
|
@ -412,7 +412,7 @@ void CALLBACK SPU2_configure() {}
|
|||
void CALLBACK SPU2_about() {}
|
||||
s32 CALLBACK SPU2_test() { return 0; }
|
||||
|
||||
int LoadSPU2plugin(const string& filename) {
|
||||
int LoadSPU2plugin(const wxString& filename) {
|
||||
void *drv;
|
||||
|
||||
SPU2plugin = SysLoadLibrary(filename.c_str());
|
||||
|
@ -455,7 +455,7 @@ void CALLBACK CDVD_configure() {}
|
|||
void CALLBACK CDVD_about() {}
|
||||
s32 CALLBACK CDVD_test() { return 0; }
|
||||
|
||||
int LoadCDVDplugin(const string& filename) {
|
||||
int LoadCDVDplugin(const wxString& filename) {
|
||||
void *drv;
|
||||
|
||||
CDVDplugin = SysLoadLibrary(filename.c_str());
|
||||
|
@ -492,7 +492,7 @@ void CALLBACK DEV9_configure() {}
|
|||
void CALLBACK DEV9_about() {}
|
||||
s32 CALLBACK DEV9_test() { return 0; }
|
||||
|
||||
int LoadDEV9plugin(const string& filename) {
|
||||
int LoadDEV9plugin(const wxString& filename) {
|
||||
void *drv;
|
||||
|
||||
DEV9plugin = SysLoadLibrary(filename.c_str());
|
||||
|
@ -529,7 +529,7 @@ void CALLBACK USB_configure() {}
|
|||
void CALLBACK USB_about() {}
|
||||
s32 CALLBACK USB_test() { return 0; }
|
||||
|
||||
int LoadUSBplugin(const string& filename) {
|
||||
int LoadUSBplugin(const wxString& filename) {
|
||||
void *drv;
|
||||
|
||||
USBplugin = SysLoadLibrary(filename.c_str());
|
||||
|
@ -566,7 +566,7 @@ void CALLBACK FW_configure() {}
|
|||
void CALLBACK FW_about() {}
|
||||
s32 CALLBACK FW_test() { return 0; }
|
||||
|
||||
int LoadFWplugin(const string& filename) {
|
||||
int LoadFWplugin(const wxString& filename) {
|
||||
void *drv;
|
||||
|
||||
FWplugin = SysLoadLibrary(filename.c_str());
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
# include <unistd.h> // Non-Windows platforms need this
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Welcome wxWidgets to the party!
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <wx/gdicmn.h> // for wxPoint/wxRect stuff
|
||||
|
||||
extern const wxRect wxDefaultRect; // wxWidgets lacks one of its own.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Include the STL junk that's actually handy.
|
||||
|
||||
|
@ -65,11 +74,15 @@ typedef int BOOL;
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Begin Pcsx2 Includes: Add items here that are local to Pcsx2 but stay relatively
|
||||
// unchanged for long periods of time.
|
||||
// unchanged for long periods of time, or happen to be used by almost everything, so they
|
||||
// need a full recompile anyway, when modified (etc)
|
||||
|
||||
#include "zlib/zlib.h"
|
||||
#include "PS2Etypes.h"
|
||||
#include "StringUtils.h"
|
||||
#include "Exceptions.h"
|
||||
#include "MemcpyFast.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Compiler/OS specific macros and defines -- Begin Section
|
||||
|
|
|
@ -52,7 +52,7 @@ class RecoveryZipSavingState : public gzSavingState, Sealed
|
|||
{
|
||||
public:
|
||||
virtual ~RecoveryZipSavingState() { }
|
||||
RecoveryZipSavingState( const string& filename );
|
||||
RecoveryZipSavingState( const wxString& filename );
|
||||
|
||||
void gsFreeze();
|
||||
void FreezePlugin( const char* name, s32 (CALLBACK* freezer)(int mode, freezeData *data) );
|
||||
|
@ -112,7 +112,7 @@ namespace StateRecovery {
|
|||
// (if one exists) and no recovery data was found. This is needed because when a recovery
|
||||
// state is made, the emulation state is usually reset so the only persisting state is
|
||||
// the one in the memory save. :)
|
||||
void SaveToFile( const string& file )
|
||||
void SaveToFile( const wxString& file )
|
||||
{
|
||||
if( g_RecoveryState != NULL )
|
||||
{
|
||||
|
@ -236,7 +236,7 @@ void RecoveryMemSavingState::FreezePlugin( const char* name, s32 (CALLBACK* free
|
|||
memSavingState::FreezePlugin( name, freezer );
|
||||
}
|
||||
|
||||
RecoveryZipSavingState::RecoveryZipSavingState( const string& filename ) : gzSavingState( filename )
|
||||
RecoveryZipSavingState::RecoveryZipSavingState( const wxString& filename ) : gzSavingState( filename )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ protected:
|
|||
return (T*)realloc( m_ptr, newsize * sizeof(T) );
|
||||
}
|
||||
|
||||
void _boundsCheck( uint i )
|
||||
void _boundsCheck( uint i ) const
|
||||
{
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
if( i >= (uint)m_length )
|
||||
|
@ -316,7 +316,7 @@ public:
|
|||
virtual SafeList<T>* Clone() const
|
||||
{
|
||||
SafeList<T>* retval = new SafeList<T>( m_length );
|
||||
memcpy_fast( retval->GetPtr(), m_ptr, sizeof(T) * m_length );
|
||||
memcpy_fast( retval->m_ptr, m_ptr, sizeof(T) * m_length );
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,12 +48,14 @@ static void PostLoadPrep()
|
|||
for(int i=0; i<48; i++) MapTLB(i);
|
||||
}
|
||||
|
||||
string SaveState::GetFilename( int slot )
|
||||
wxString SaveState::GetFilename( int slot )
|
||||
{
|
||||
return Path::Combine( SSTATES_DIR, fmt_string( "%8.8X.%3.3d", ElfCRC, slot ) );
|
||||
wxString arrgh;
|
||||
arrgh.Printf( "%8.8X.%3.3d", ElfCRC, slot );
|
||||
return Path::Combine( SSTATES_DIR, arrgh );
|
||||
}
|
||||
|
||||
SaveState::SaveState( const char* msg, const string& destination ) :
|
||||
SaveState::SaveState( const char* msg, const wxString& destination ) :
|
||||
m_version( g_SaveVersion )
|
||||
, m_tagspace( 128 )
|
||||
{
|
||||
|
@ -183,7 +185,7 @@ void SaveState::FreezeAll()
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// gzipped to/from disk state saves implementation
|
||||
|
||||
gzBaseStateInfo::gzBaseStateInfo( const char* msg, const string& filename ) :
|
||||
gzBaseStateInfo::gzBaseStateInfo( const char* msg, const wxString& filename ) :
|
||||
SaveState( msg, filename )
|
||||
, m_filename( filename )
|
||||
, m_file( NULL )
|
||||
|
@ -200,7 +202,7 @@ gzBaseStateInfo::~gzBaseStateInfo()
|
|||
}
|
||||
|
||||
|
||||
gzSavingState::gzSavingState( const string& filename ) :
|
||||
gzSavingState::gzSavingState( const wxString& filename ) :
|
||||
gzBaseStateInfo( "Saving state to: ", filename )
|
||||
{
|
||||
m_file = gzopen(filename.c_str(), "wb");
|
||||
|
@ -212,7 +214,7 @@ gzSavingState::gzSavingState( const string& filename ) :
|
|||
}
|
||||
|
||||
|
||||
gzLoadingState::gzLoadingState( const string& filename ) :
|
||||
gzLoadingState::gzLoadingState( const wxString& filename ) :
|
||||
gzBaseStateInfo( "Loading state from: ", filename )
|
||||
{
|
||||
m_file = gzopen(filename.c_str(), "rb");
|
||||
|
|
|
@ -48,10 +48,10 @@ protected:
|
|||
SafeArray<char> m_tagspace;
|
||||
|
||||
public:
|
||||
SaveState( const char* msg, const string& destination );
|
||||
SaveState( const char* msg, const wxString& destination );
|
||||
virtual ~SaveState() { }
|
||||
|
||||
static string GetFilename( int slot );
|
||||
static wxString GetFilename( int slot );
|
||||
|
||||
// Gets the version of savestate that this object is acting on.
|
||||
// The version refers to the low 16 bits only (high 16 bits classifies Pcsx2 build types)
|
||||
|
@ -134,11 +134,11 @@ protected:
|
|||
class gzBaseStateInfo : public SaveState
|
||||
{
|
||||
protected:
|
||||
const string m_filename;
|
||||
const wxString m_filename;
|
||||
gzFile m_file; // used for reading/writing disk saves
|
||||
|
||||
public:
|
||||
gzBaseStateInfo( const char* msg, const string& filename );
|
||||
gzBaseStateInfo( const char* msg, const wxString& filename );
|
||||
|
||||
virtual ~gzBaseStateInfo();
|
||||
};
|
||||
|
@ -147,7 +147,7 @@ class gzSavingState : public gzBaseStateInfo
|
|||
{
|
||||
public:
|
||||
virtual ~gzSavingState() {}
|
||||
gzSavingState( const string& filename ) ;
|
||||
gzSavingState( const wxString& filename ) ;
|
||||
void FreezePlugin( const char* name, s32(CALLBACK *freezer)(int mode, freezeData *data) );
|
||||
void FreezeMem( void* data, int size );
|
||||
bool IsSaving() const { return true; }
|
||||
|
@ -157,7 +157,7 @@ class gzLoadingState : public gzBaseStateInfo
|
|||
{
|
||||
public:
|
||||
virtual ~gzLoadingState();
|
||||
gzLoadingState( const string& filename );
|
||||
gzLoadingState( const wxString& filename );
|
||||
|
||||
void FreezePlugin( const char* name, s32(CALLBACK *freezer)(int mode, freezeData *data) );
|
||||
void FreezeMem( void* data, int size );
|
||||
|
@ -210,7 +210,7 @@ namespace StateRecovery
|
|||
{
|
||||
extern bool HasState();
|
||||
extern void Recover();
|
||||
extern void SaveToFile( const string& file );
|
||||
extern void SaveToFile( const wxString& file );
|
||||
extern void SaveToSlot( uint num );
|
||||
extern void MakeGsOnly();
|
||||
extern void MakeFull();
|
||||
|
|
|
@ -41,8 +41,8 @@ bool States_isSlotUsed(int num)
|
|||
// Save state load-from-file (or slot) helpers.
|
||||
|
||||
// Internal use state loading function which does not trap exceptions.
|
||||
// The calling function should trap ahnd handle exceptions as needed.
|
||||
static void _loadStateOrExcept( const string& file )
|
||||
// The calling function should trap and handle exceptions as needed.
|
||||
static void _loadStateOrExcept( const wxString& file )
|
||||
{
|
||||
gzLoadingState joe( file ); // this'll throw an StateLoadError_Recoverable.
|
||||
|
||||
|
@ -57,12 +57,12 @@ static void _loadStateOrExcept( const string& file )
|
|||
}
|
||||
|
||||
// returns true if the new state was loaded, or false if nothing happened.
|
||||
void States_Load( const string& file )
|
||||
void States_Load( const wxString& file )
|
||||
{
|
||||
try
|
||||
{
|
||||
_loadStateOrExcept( file );
|
||||
HostGui::Notice( fmt_string( "*PCSX2*: Loaded State %hs", &file) );
|
||||
HostGui::Notice( fmt_string( "*PCSX2*: Loaded State %s", file.c_str() ) );
|
||||
}
|
||||
catch( Exception::StateLoadError_Recoverable& ex)
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ void States_Load( const string& file )
|
|||
// The emulation state is ruined. Might as well give them a popup and start the gui.
|
||||
|
||||
string message( fmt_string(
|
||||
"Encountered an error while loading savestate from file: %hs.\n", &file ) );
|
||||
"Encountered an error while loading savestate from file: %s.\n", file.c_str() ) );
|
||||
|
||||
if( g_EmulationInProgress )
|
||||
message += "Since the savestate load was incomplete, the emulator must reset.\n";
|
||||
|
@ -139,17 +139,17 @@ void States_Load(int num)
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Save state save-to-file (or slot) helpers.
|
||||
|
||||
void States_Save( const string& file )
|
||||
void States_Save( const wxString& file )
|
||||
{
|
||||
try
|
||||
{
|
||||
StateRecovery::SaveToFile( file );
|
||||
HostGui::Notice( fmt_string( "State saved to file: %hs", &file ) );
|
||||
HostGui::Notice( fmt_string( "State saved to file: %s", file.c_str() ) );
|
||||
}
|
||||
catch( Exception::BaseException& ex )
|
||||
{
|
||||
Console::Error( (fmt_string(
|
||||
"An error occurred while trying to save to file %hs\n", &file ) +
|
||||
"An error occurred while trying to save to file %s\n", file.c_str() ) +
|
||||
"Your emulation state has not been saved!\n\nError: " + ex.Message()).c_str()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2009 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "SafeArray.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Splits a string into parts and adds the parts into the given SafeList.
|
||||
// This list is not cleared, so concatenating many splits into a single large list is
|
||||
// the 'default' behavior, unless you manually clear the SafeList prior to subsequent calls.
|
||||
//
|
||||
// Note: wxWidgets 2.9 / 3.0 has a wxSplit function, but we're using 2.8 so I had to make
|
||||
// my own.
|
||||
void SplitString( SafeList<wxString>& dest, const wxString& src, const wxString& delims )
|
||||
{
|
||||
wxStringTokenizer parts( src, delims );
|
||||
while( parts.HasMoreTokens() )
|
||||
dest.Add( parts.GetNextToken() );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Joins a list of strings into one larger string, using the given string concatenation
|
||||
// character as a separator. If you want to be able to split the string later then the
|
||||
// concatenation string needs to be a single character.
|
||||
//
|
||||
// Note: wxWidgets 2.9 / 3.0 has a wxJoin function, but we're using 2.8 so I had to make
|
||||
// my own.
|
||||
void JoinString( wxString& dest, const SafeList<wxString>& src, const wxString& separator )
|
||||
{
|
||||
for( int i=0, len=src.GetLength(); i<len; ++i )
|
||||
{
|
||||
if( i != 0 )
|
||||
dest += separator;
|
||||
dest += src[i];
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Attempts to parse and return a value for the given template type, and throws a ParseError
|
||||
// exception if the parse fails. The template type can be anything that is supported/
|
||||
// implemented via one of the TryParse() method overloads.
|
||||
//
|
||||
// This, so far, include types such as wxPoint, wxRect, and wxSize.
|
||||
//
|
||||
template< typename T >
|
||||
T Parse( const wxString& src, const wxString& separators=wxT(",") )
|
||||
{
|
||||
T retval;
|
||||
if( !TryParse( retval, src, separators ) )
|
||||
throw Exception::ParseError( "Parse failure on call to " + wxString::FromAscii(__WXFUNCTION__) + ": " + src );
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ToString helpers for wxString!
|
||||
//
|
||||
|
||||
// Converts a wxPoint into a comma-delimited string!
|
||||
wxString ToString( const wxPoint& src, const wxString& separator )
|
||||
{
|
||||
return wxString() << src.x << separator << src.y;
|
||||
}
|
||||
|
||||
wxString ToString( const wxSize& src, const wxString& separator )
|
||||
{
|
||||
return wxString() << src.GetWidth() << separator << src.GetHeight();
|
||||
}
|
||||
|
||||
// Converts a wxRect into a comma-delimited string!
|
||||
// Example: 32,64,128,5
|
||||
wxString ToString( const wxRect& src, const wxString& separator )
|
||||
{
|
||||
return ToString( src.GetLeftTop(), separator ) << separator << ToString( src.GetSize(), separator );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Parse helpers for wxString!
|
||||
//
|
||||
|
||||
bool TryParse( wxPoint& dest, wxStringTokenizer& parts )
|
||||
{
|
||||
long result[2];
|
||||
|
||||
if( !parts.HasMoreTokens() || !parts.GetNextToken().ToLong( &result[0] ) ) return false;
|
||||
if( !parts.HasMoreTokens() || !parts.GetNextToken().ToLong( &result[1] ) ) return false;
|
||||
dest.x = result[0];
|
||||
dest.y = result[1];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TryParse( wxSize& dest, wxStringTokenizer& parts )
|
||||
{
|
||||
long result[2];
|
||||
|
||||
if( !parts.HasMoreTokens() || !parts.GetNextToken().ToLong( &result[0] ) ) return false;
|
||||
if( !parts.HasMoreTokens() || !parts.GetNextToken().ToLong( &result[1] ) ) return false;
|
||||
dest.SetWidth( result[0] );
|
||||
dest.SetHeight( result[1] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Tries to parse the given string into a wxPoint value at 'dest.' If the parse fails, the
|
||||
// method aborts and returns false.
|
||||
bool TryParse( wxPoint& dest, const wxString& src, const wxPoint& defval, const wxString& separators )
|
||||
{
|
||||
dest = defval;
|
||||
wxStringTokenizer parts( src, separators );
|
||||
return TryParse( dest, parts );
|
||||
}
|
||||
|
||||
bool TryParse( wxSize& dest, const wxString& src, const wxSize& defval, const wxString& separators )
|
||||
{
|
||||
dest = defval;
|
||||
wxStringTokenizer parts( src, separators );
|
||||
return TryParse( dest, parts );
|
||||
}
|
||||
|
||||
bool TryParse( wxRect& dest, const wxString& src, const wxRect& defval, const wxString& separators )
|
||||
{
|
||||
dest = defval;
|
||||
|
||||
wxStringTokenizer parts( src, separators );
|
||||
|
||||
wxPoint point;
|
||||
wxSize size;
|
||||
|
||||
if( !TryParse( point, parts ) ) return false;
|
||||
if( !TryParse( size, parts ) ) return false;
|
||||
|
||||
dest = wxRect( point, size );
|
||||
return true;
|
||||
}
|
|
@ -26,6 +26,7 @@
|
|||
// to_string: A utility template for quick and easy inline string type conversion.
|
||||
// Use to_string(intval), or to_string(float), etc. Anything that the STL itself
|
||||
// would support should be supported here. :)
|
||||
// Notice: Obsolete, use wxString features instead.
|
||||
template< typename T >
|
||||
std::string to_string(const T& value)
|
||||
{
|
||||
|
@ -34,6 +35,20 @@ std::string to_string(const T& value)
|
|||
return oss.str();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
extern wxString ToString( const wxPoint& src, const wxString& separator=wxT(",") );
|
||||
extern wxString ToString( const wxRect& src, const wxString& separator=wxT(",") );
|
||||
|
||||
extern bool TryParse( wxPoint& dest, const wxStringTokenizer& parts );
|
||||
extern bool TryParse( wxSize& dest, const wxStringTokenizer& parts );
|
||||
|
||||
extern bool TryParse( wxPoint& dest, const wxString& src, const wxPoint& defval=wxDefaultPosition, const wxString& separators=wxT(",") );
|
||||
extern bool TryParse( wxSize& dest, const wxString& src, const wxSize& defval=wxDefaultSize, const wxString& separators=wxT(",") );
|
||||
extern bool TryParse( wxRect& dest, const wxString& src, const wxRect& defval=wxDefaultRect, const wxString& separators=wxT(",") );
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// dummy structure used to type-guard the dummy parameter that's been inserted to
|
||||
// allow us to use the va_list feature on references.
|
||||
struct _VARG_PARAM
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
|
||||
#include "PS2Etypes.h"
|
||||
#include "Pcsx2Config.h"
|
||||
#include "Exceptions.h"
|
||||
#include "Paths.h"
|
||||
#include "MemcpyFast.h"
|
||||
#include "SafeArray.h"
|
||||
#include "Misc.h"
|
||||
#include "Threading.h" // to use threading stuff, include the Threading namespace in your file.
|
||||
|
@ -103,10 +101,23 @@ extern u8 *SysMmapEx(uptr base, u32 size, uptr bounds, const char *caller="Unnam
|
|||
|
||||
extern void vSyncDebugStuff( uint frame );
|
||||
|
||||
// Writes text to the console.
|
||||
// *DEPRECIATED* Use Console namespace methods instead.
|
||||
void SysPrintf(const char *fmt, ...); // *DEPRECIATED*
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Pcsx2 Custom Translation System
|
||||
// Work-in-progress!
|
||||
//
|
||||
static const char* _t( const char* translate_me_please )
|
||||
{
|
||||
return translate_me_please;
|
||||
}
|
||||
|
||||
// Temporary placebo?
|
||||
static const char* _( const char* translate_me_please )
|
||||
{
|
||||
return translate_me_please;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Console Namespace -- Replacements for SysPrintf.
|
||||
// SysPrintf is depreciated -- We should phase these in over time.
|
||||
namespace Console
|
||||
|
@ -126,9 +137,7 @@ namespace Console
|
|||
// va_args version of WriteLn, mostly for internal use only.
|
||||
extern void __fastcall _WriteLn( Colors color, const char* fmt, va_list args );
|
||||
|
||||
extern void Open();
|
||||
extern void Close();
|
||||
extern void SetTitle( const std::string& title );
|
||||
extern void __fastcall SetTitle( const wxString& title );
|
||||
|
||||
// Changes the active console color.
|
||||
// This color will be unset by calls to colored text methods
|
||||
|
@ -142,49 +151,54 @@ namespace Console
|
|||
// them from different build types. The return values are always zero.
|
||||
|
||||
// Writes a newline to the console.
|
||||
extern bool __fastcall Newline();
|
||||
extern bool Newline();
|
||||
|
||||
// Writes an unformatted string of text to the console (fast!)
|
||||
// No newline is appended.
|
||||
extern bool __fastcall Write( const char* fmt );
|
||||
extern bool __fastcall Write( const char* text );
|
||||
|
||||
// Writes an unformatted string of text to the console (fast!)
|
||||
// A newline is automatically appended, and the console color reset to default
|
||||
// after the log is written.
|
||||
extern bool __fastcall Write( Colors color, const char* text );
|
||||
|
||||
// Writes an unformatted string of text to the console (fast!)
|
||||
// A newline is automatically appended.
|
||||
extern bool __fastcall WriteLn( const char* fmt );
|
||||
extern bool __fastcall WriteLn( const char* text );
|
||||
|
||||
// Writes an unformatted string of text to the console (fast!)
|
||||
// A newline is automatically appended, and the console color reset to default.
|
||||
extern bool __fastcall WriteLn( Colors color, const char* fmt );
|
||||
// A newline is automatically appended, and the console color reset to default
|
||||
// after the log is written.
|
||||
extern bool __fastcall WriteLn( Colors color, const char* text );
|
||||
|
||||
// Writes a line of colored text to the console, with automatic newline appendage.
|
||||
// The console color is reset to default when the operation is complete.
|
||||
extern bool WriteLn( Colors color, const char* fmt, VARG_PARAM dummy, ... );
|
||||
|
||||
// Writes a formatted message to the console, with appended newline.
|
||||
extern bool WriteLn( const char* fmt, VARG_PARAM dummy, ... );
|
||||
|
||||
// Writes a line of colored text to the console (no newline).
|
||||
// The console color is reset to default when the operation is complete.
|
||||
extern bool Write( Colors color, const char* fmt, VARG_PARAM dummy, ... );
|
||||
extern bool Write( Colors color, const char* fmt );
|
||||
|
||||
// Writes a formatted message to the console (no newline)
|
||||
extern bool Write( const char* fmt, VARG_PARAM dummy, ... );
|
||||
|
||||
// Writes a formatted message to the console, with appended newline.
|
||||
extern bool WriteLn( const char* fmt, VARG_PARAM dummy, ... );
|
||||
|
||||
// Displays a message in the console with red emphasis.
|
||||
// Newline is automatically appended.
|
||||
extern bool Error( const char* fmt, VARG_PARAM dummy, ... );
|
||||
extern bool Error( const char* fmt );
|
||||
extern bool __fastcall Error( const char* text );
|
||||
|
||||
// Displays a message in the console with yellow emphasis.
|
||||
// Newline is automatically appended.
|
||||
extern bool Notice( const char* fmt, VARG_PARAM dummy, ... );
|
||||
extern bool Notice( const char* fmt );
|
||||
extern bool __fastcall Notice( const char* text );
|
||||
|
||||
// Displays a message in the console with yellow emphasis.
|
||||
// Newline is automatically appended.
|
||||
extern bool Status( const char* fmt, VARG_PARAM dummy, ... );
|
||||
extern bool Status( const char* fmt );
|
||||
extern bool __fastcall Status( const char* text );
|
||||
}
|
||||
|
||||
// Different types of message boxes that the emulator can employ from the friendly confines
|
||||
|
@ -196,7 +210,7 @@ namespace Msgbox
|
|||
// Pops up an alert Dialog Box with a singular "OK" button.
|
||||
// Always returns false. Replacement for SysMessage.
|
||||
extern bool Alert( const char* fmt, VARG_PARAM dummy, ... );
|
||||
extern bool Alert( const char* fmt );
|
||||
extern bool Alert( const char* text );
|
||||
|
||||
// Pops up a dialog box with Ok/Cancel buttons. Returns the result of the inquiry,
|
||||
// true if OK, false if cancel.
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <semaphore.h>
|
||||
|
||||
#include "PS2Etypes.h"
|
||||
#include "Exceptions.h"
|
||||
|
||||
namespace Threading
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ HWND mcdDlg;
|
|||
#define HANDLE_CHECK(idc,hvar) case idc: (hvar) = !(hvar); SendMessage(GetDlgItem(hWnd,idc),BM_SETCHECK,(hvar)?BST_CHECKED:BST_UNCHECKED,0); break
|
||||
#define HANDLE_CHECKNB(idc,hvar) case idc: (hvar) = !(hvar); SendMessage(GetDlgItem(hWnd,idc),BM_SETCHECK,(hvar)?BST_CHECKED:BST_UNCHECKED,0)
|
||||
|
||||
void DlgItem_GetText( HWND hwnd, int dlgId, string& dest )
|
||||
void DlgItem_GetText( HWND hwnd, int dlgId, wxString& dest )
|
||||
{
|
||||
HWND dlg = GetDlgItem( hwnd, dlgId );
|
||||
int length = GetWindowTextLength( dlg );
|
||||
|
@ -119,7 +119,7 @@ void MemcardConfig::Open_Mcd_Proc(HWND hW, int mcd)
|
|||
}
|
||||
}
|
||||
|
||||
static string m_Default_MemcardsDir[2] =
|
||||
static wxString m_Default_MemcardsDir[2] =
|
||||
{
|
||||
Path::Combine( MEMCARDS_DIR, DEFAULT_MEMCARD1 ),
|
||||
Path::Combine( MEMCARDS_DIR, DEFAULT_MEMCARD2 )
|
||||
|
@ -190,7 +190,7 @@ BOOL CALLBACK MemcardConfig::DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
|
|||
//DlgItem_GetText( hWnd, IDC_MCD_FILE1, Config.Mcd[0].Filename );
|
||||
//DlgItem_GetText( hWnd, IDC_MCD_FILE2, Config.Mcd[1].Filename );
|
||||
|
||||
string oldone( Config.Mcd[0].Filename ), oldtwo( Config.Mcd[1].Filename );
|
||||
wxString oldone( Config.Mcd[0].Filename ), oldtwo( Config.Mcd[1].Filename );
|
||||
|
||||
GetWindowText( GetDlgItem( hWnd, IDC_MCD_FILE1 ), Config.Mcd[0].Filename, g_MaxPath );
|
||||
GetWindowText( GetDlgItem( hWnd, IDC_MCD_FILE2 ), Config.Mcd[1].Filename, g_MaxPath );
|
||||
|
|
|
@ -230,7 +230,7 @@ int __stdcall ProfilerThread(void* nada)
|
|||
rv+=lst[i].ToString(tick_count);
|
||||
}
|
||||
|
||||
SysPrintf("+Sampling Profiler Results-\n%s\n+>\n",rv.c_str());
|
||||
Console::WriteLn("+Sampling Profiler Results-\n%s\n+>", params rv.c_str());
|
||||
|
||||
tick_count=0;
|
||||
|
||||
|
|
|
@ -494,28 +494,6 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\WinConsole.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PrecompiledHeaderThrough="Win32.h"
|
||||
PrecompiledHeaderFile="$(IntDir)\win32.pch"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Devel|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PrecompiledHeaderThrough="Win32.h"
|
||||
PrecompiledHeaderFile="$(IntDir)\win32.pch"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\WindowsPCH.cpp"
|
||||
>
|
||||
|
@ -831,6 +809,10 @@
|
|||
RelativePath="..\..\SourceLog.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\StringUtils.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\StringUtils.h"
|
||||
>
|
||||
|
@ -2904,6 +2886,14 @@
|
|||
<Filter
|
||||
Name="NewGUI"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\NewGUI\App.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\NewGUI\AppConfig.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\NewGUI\CheckedStaticBox.cpp"
|
||||
>
|
||||
|
@ -2916,10 +2906,6 @@
|
|||
RelativePath="..\..\NewGUI\ConsoleLogger.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\NewGUI\ConsoleLogger.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\NewGUI\frmGameFixes.cpp"
|
||||
>
|
||||
|
|
|
@ -70,21 +70,21 @@ struct AppData
|
|||
class IniFile
|
||||
{
|
||||
protected:
|
||||
string m_filename;
|
||||
string m_section;
|
||||
wxString m_filename;
|
||||
wxString m_section;
|
||||
|
||||
public:
|
||||
virtual ~IniFile();
|
||||
IniFile();
|
||||
|
||||
void SetCurrentSection( const string& newsection );
|
||||
void SetCurrentSection( const wxString& newsection );
|
||||
|
||||
virtual void Entry( const string& var, string& value, const string& defvalue=string() )=0;
|
||||
virtual void Entry( const string& var, char (&value)[g_MaxPath], const string& defvalue=string() )=0;
|
||||
virtual void Entry( const string& var, int& value, const int defvalue=0 )=0;
|
||||
virtual void Entry( const string& var, uint& value, const uint defvalue=0 )=0;
|
||||
virtual void Entry( const string& var, bool& value, const bool defvalue=0 )=0;
|
||||
virtual void EnumEntry( const string& var, int& value, const char* const* enumArray, const int defvalue=0 )=0;
|
||||
virtual void Entry( const wxString& var, wxString& value, const wxString& defvalue=wxString() )=0;
|
||||
virtual void Entry( const wxString& var, char (&value)[g_MaxPath], const wxString& defvalue=wxString() )=0;
|
||||
virtual void Entry( const wxString& var, int& value, const int defvalue=0 )=0;
|
||||
virtual void Entry( const wxString& var, uint& value, const uint defvalue=0 )=0;
|
||||
virtual void Entry( const wxString& var, bool& value, const bool defvalue=0 )=0;
|
||||
virtual void EnumEntry( const wxString& var, int& value, const char* const* enumArray, const int defvalue=0 )=0;
|
||||
|
||||
void DoConfig( PcsxConfig& Conf );
|
||||
void MemcardSettings( PcsxConfig& Conf );
|
||||
|
@ -99,12 +99,12 @@ public:
|
|||
virtual ~IniFileLoader();
|
||||
IniFileLoader();
|
||||
|
||||
void Entry( const string& var, string& value, const string& defvalue=string() );
|
||||
void Entry( const string& var, char (&value)[g_MaxPath], const string& defvalue=string() );
|
||||
void Entry( const string& var, int& value, const int defvalue=0 );
|
||||
void Entry( const string& var, uint& value, const uint defvalue=0 );
|
||||
void Entry( const string& var, bool& value, const bool defvalue=false );
|
||||
void EnumEntry( const string& var, int& value, const char* const* enumArray, const int defvalue=0 );
|
||||
void Entry( const wxString& var, wxString& value, const wxString& defvalue=wxString() );
|
||||
void Entry( const wxString& var, char (&value)[g_MaxPath], const wxString& defvalue=wxString() );
|
||||
void Entry( const wxString& var, int& value, const int defvalue=0 );
|
||||
void Entry( const wxString& var, uint& value, const uint defvalue=0 );
|
||||
void Entry( const wxString& var, bool& value, const bool defvalue=false );
|
||||
void EnumEntry( const wxString& var, int& value, const char* const* enumArray, const int defvalue=0 );
|
||||
};
|
||||
|
||||
class IniFileSaver : public IniFile
|
||||
|
@ -113,13 +113,13 @@ public:
|
|||
virtual ~IniFileSaver();
|
||||
IniFileSaver();
|
||||
|
||||
void Entry( const string& var, const string& value, const string& defvalue=string() );
|
||||
void Entry( const string& var, string& value, const string& defvalue=string() );
|
||||
void Entry( const string& var, char (&value)[g_MaxPath], const string& defvalue=string() );
|
||||
void Entry( const string& var, int& value, const int defvalue=0 );
|
||||
void Entry( const string& var, uint& value, const uint defvalue=0 );
|
||||
void Entry( const string& var, bool& value, const bool defvalue=false );
|
||||
void EnumEntry( const string& var, int& value, const char* const* enumArray, const int defvalue=0 );
|
||||
void Entry( const wxString& var, const wxString& value, const wxString& defvalue=wxString() );
|
||||
void Entry( const wxString& var, wxString& value, const wxString& defvalue=wxString() );
|
||||
void Entry( const wxString& var, char (&value)[g_MaxPath], const wxString& defvalue=wxString() );
|
||||
void Entry( const wxString& var, int& value, const int defvalue=0 );
|
||||
void Entry( const wxString& var, uint& value, const uint defvalue=0 );
|
||||
void Entry( const wxString& var, bool& value, const bool defvalue=false );
|
||||
void EnumEntry( const wxString& var, int& value, const char* const* enumArray, const int defvalue=0 );
|
||||
};
|
||||
|
||||
extern LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
|
|
@ -169,7 +169,7 @@ void WinClose()
|
|||
ProfilerTerm();
|
||||
|
||||
ReleasePlugins();
|
||||
Console::Close();
|
||||
//Console::Close();
|
||||
|
||||
pthread_win32_process_detach_np();
|
||||
|
||||
|
@ -776,12 +776,12 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
if(Config.PsxOut)
|
||||
{
|
||||
CheckMenuItem(gApp.hMenu,ID_CONSOLE,MF_CHECKED);
|
||||
Console::Open();
|
||||
//Console::Open();
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckMenuItem(gApp.hMenu, ID_CONSOLE, MF_UNCHECKED);
|
||||
Console::Close();
|
||||
//Console::Close();
|
||||
}
|
||||
SaveConfig();
|
||||
break;
|
||||
|
|
|
@ -221,14 +221,19 @@ void OnStates_SaveOther()
|
|||
States_Save( szFileName );
|
||||
}
|
||||
|
||||
static void CreateDirs()
|
||||
{
|
||||
Path::CreateDirectory(MEMCARDS_DIR);
|
||||
Path::CreateDirectory(SSTATES_DIR);
|
||||
Path::CreateDirectory(SNAPSHOTS_DIR);
|
||||
}
|
||||
|
||||
bool HostGuiInit()
|
||||
{
|
||||
if( sinit ) return true;
|
||||
sinit = true;
|
||||
|
||||
CreateDirectory(MEMCARDS_DIR, NULL);
|
||||
CreateDirectory(SSTATES_DIR, NULL);
|
||||
CreateDirectory(SNAPSHOTS_DIR, NULL);
|
||||
CreateDirs();
|
||||
|
||||
// Set the compression attribute on the Memcards folder.
|
||||
// Memcards generally compress very well via NTFS compression.
|
||||
|
|
|
@ -33,7 +33,7 @@ static bool hasCustomConfig()
|
|||
}
|
||||
|
||||
// Returns the FULL (absolute) path and filename of the configuration file.
|
||||
static string GetConfigFilename()
|
||||
static wxString GetConfigFilename()
|
||||
{
|
||||
// Load a user-specified configuration, or use the ini relative to the application's working directory.
|
||||
// (Our current working directory can change, so we use the one we detected at startup)
|
||||
|
@ -50,7 +50,7 @@ IniFileLoader::IniFileLoader() : IniFile(),
|
|||
{
|
||||
}
|
||||
|
||||
void IniFileLoader::Entry( const string& var, string& value, const string& defvalue )
|
||||
void IniFileLoader::Entry( const wxString& var, wxString& value, const wxString& defvalue )
|
||||
{
|
||||
int retval = GetPrivateProfileString(
|
||||
m_section.c_str(), var.c_str(), defvalue.c_str(), m_workspace.GetPtr(), m_workspace.GetLength(), m_filename.c_str()
|
||||
|
@ -62,7 +62,7 @@ void IniFileLoader::Entry( const string& var, string& value, const string& defva
|
|||
value = m_workspace.GetPtr();
|
||||
}
|
||||
|
||||
void IniFileLoader::Entry( const string& var, char (&value)[g_MaxPath], const string& defvalue )
|
||||
void IniFileLoader::Entry( const wxString& var, char (&value)[g_MaxPath], const wxString& defvalue )
|
||||
{
|
||||
int retval = GetPrivateProfileString(
|
||||
m_section.c_str(), var.c_str(), defvalue.c_str(), value, sizeof( value ), m_filename.c_str()
|
||||
|
@ -72,30 +72,30 @@ void IniFileLoader::Entry( const string& var, char (&value)[g_MaxPath], const st
|
|||
Console::Notice( "Loadini Warning > Possible truncated value on key '%hs'", params &var );
|
||||
}
|
||||
|
||||
void IniFileLoader::Entry( const string& var, int& value, const int defvalue )
|
||||
void IniFileLoader::Entry( const wxString& var, int& value, const int defvalue )
|
||||
{
|
||||
string retval;
|
||||
wxString retval;
|
||||
Entry( var, retval, to_string( defvalue ) );
|
||||
value = atoi( retval.c_str() );
|
||||
}
|
||||
|
||||
void IniFileLoader::Entry( const string& var, uint& value, const uint defvalue )
|
||||
void IniFileLoader::Entry( const wxString& var, uint& value, const uint defvalue )
|
||||
{
|
||||
string retval;
|
||||
wxString retval;
|
||||
Entry( var, retval, to_string( defvalue ) );
|
||||
value = atoi( retval.c_str() );
|
||||
}
|
||||
|
||||
void IniFileLoader::Entry( const string& var, bool& value, const bool defvalue )
|
||||
void IniFileLoader::Entry( const wxString& var, bool& value, const bool defvalue )
|
||||
{
|
||||
string retval;
|
||||
wxString retval;
|
||||
Entry( var, retval, defvalue ? "enabled" : "disabled" );
|
||||
value = (retval == "enabled");
|
||||
}
|
||||
|
||||
void IniFileLoader::EnumEntry( const string& var, int& value, const char* const* enumArray, const int defvalue )
|
||||
void IniFileLoader::EnumEntry( const wxString& var, int& value, const char* const* enumArray, const int defvalue )
|
||||
{
|
||||
string retval;
|
||||
wxString retval;
|
||||
Entry( var, retval, enumArray[defvalue] );
|
||||
|
||||
int i=0;
|
||||
|
@ -123,37 +123,37 @@ IniFileSaver::IniFileSaver() : IniFile()
|
|||
WritePrivateProfileString( "Misc", "IniVersion", versionStr, m_filename.c_str() );
|
||||
}
|
||||
|
||||
void IniFileSaver::Entry( const string& var, const string& value, const string& defvalue )
|
||||
void IniFileSaver::Entry( const wxString& var, const wxString& value, const wxString& defvalue )
|
||||
{
|
||||
WritePrivateProfileString( m_section.c_str(), var.c_str(), value.c_str(), m_filename.c_str() );
|
||||
}
|
||||
|
||||
void IniFileSaver::Entry( const string& var, string& value, const string& defvalue )
|
||||
void IniFileSaver::Entry( const wxString& var, wxString& value, const wxString& defvalue )
|
||||
{
|
||||
WritePrivateProfileString( m_section.c_str(), var.c_str(), value.c_str(), m_filename.c_str() );
|
||||
}
|
||||
|
||||
void IniFileSaver::Entry( const string& var, char (&value)[g_MaxPath], const string& defvalue )
|
||||
void IniFileSaver::Entry( const wxString& var, char (&value)[g_MaxPath], const wxString& defvalue )
|
||||
{
|
||||
WritePrivateProfileString( m_section.c_str(), var.c_str(), value, m_filename.c_str() );
|
||||
}
|
||||
|
||||
void IniFileSaver::Entry( const string& var, int& value, const int defvalue )
|
||||
void IniFileSaver::Entry( const wxString& var, int& value, const int defvalue )
|
||||
{
|
||||
Entry( var, to_string( value ) );
|
||||
}
|
||||
|
||||
void IniFileSaver::Entry( const string& var, uint& value, const uint defvalue )
|
||||
void IniFileSaver::Entry( const wxString& var, uint& value, const uint defvalue )
|
||||
{
|
||||
Entry( var, to_string( value ) );
|
||||
}
|
||||
|
||||
void IniFileSaver::Entry( const string& var, bool& value, const bool defvalue )
|
||||
void IniFileSaver::Entry( const wxString& var, bool& value, const bool defvalue )
|
||||
{
|
||||
Entry( var, value ? "enabled" : "disabled" );
|
||||
}
|
||||
|
||||
void IniFileSaver::EnumEntry( const string& var, int& value, const char* const* enumArray, const int defvalue )
|
||||
void IniFileSaver::EnumEntry( const wxString& var, int& value, const char* const* enumArray, const int defvalue )
|
||||
{
|
||||
Entry( var, enumArray[value] );
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ IniFile::IniFile() : m_filename( GetConfigFilename() ), m_section("Misc")
|
|||
{
|
||||
}
|
||||
|
||||
void IniFile::SetCurrentSection( const string& newsection )
|
||||
void IniFile::SetCurrentSection( const wxString& newsection )
|
||||
{
|
||||
m_section = newsection;
|
||||
}
|
||||
|
@ -186,9 +186,9 @@ void IniFile::DoConfig( PcsxConfig& Conf )
|
|||
SetCurrentSection( "Interface" );
|
||||
Entry( "Bios", Conf.Bios );
|
||||
Entry( "Language", Conf.Lang );
|
||||
string plug = DEFAULT_PLUGINS_DIR;
|
||||
wxString plug = DEFAULT_PLUGINS_DIR;
|
||||
Entry( "PluginsDir", Conf.PluginsDir, plug );
|
||||
string bios = DEFAULT_BIOS_DIR;
|
||||
wxString bios = DEFAULT_BIOS_DIR;
|
||||
Entry( "BiosDir", Conf.BiosDir, bios );
|
||||
Entry( "CloseGsOnEscape", Conf.closeGSonEsc, true );
|
||||
|
||||
|
@ -233,7 +233,7 @@ bool LoadConfig()
|
|||
{
|
||||
bool status = true;
|
||||
|
||||
string szIniFile( GetConfigFilename() );
|
||||
wxString szIniFile( GetConfigFilename() );
|
||||
|
||||
if( !Path::Exists( szIniFile ) )
|
||||
{
|
||||
|
@ -246,7 +246,7 @@ bool LoadConfig()
|
|||
}
|
||||
|
||||
// standard mode operation. Create the directory.
|
||||
CreateDirectory( "inis", NULL );
|
||||
Path::CreateDirectory( "inis" );
|
||||
status = false; // inform caller that we're not configured.
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue