wxgui: Fixed crash-on-exit problem in Release builds and made the console logger thread-safe (uses messages instead of direct wxFrame method invocations).

git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1529 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-07-16 09:58:17 +00:00
parent 94a4897624
commit 657660371c
42 changed files with 474 additions and 354 deletions

View File

@ -8,6 +8,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;__WXMSW__;_LIB;wxUSE_UNICODE=1" PreprocessorDefinitions="WIN32;__WXMSW__;_LIB;wxUSE_UNICODE=1"
ExceptionHandling="2"
CompileAs="0" CompileAs="0"
/> />
</VisualStudioPropertySheet> </VisualStudioPropertySheet>

View File

@ -40,7 +40,6 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHsc "
AdditionalIncludeDirectories="&quot;$(ProjectRootDir)\include&quot;;&quot;$(ProjectRootDir)\include\msvc&quot;;&quot;$(SvnRootDir)\3rdparty\zlib&quot;;&quot;$(ProjectRootDir)\src\png&quot;" AdditionalIncludeDirectories="&quot;$(ProjectRootDir)\include&quot;;&quot;$(ProjectRootDir)\include\msvc&quot;;&quot;$(SvnRootDir)\3rdparty\zlib&quot;;&quot;$(ProjectRootDir)\src\png&quot;"
PreprocessorDefinitions="_DEBUG;__WXDEBUG__;wxUSE_BASE=0;wxUSE_GUI=1" PreprocessorDefinitions="_DEBUG;__WXDEBUG__;wxUSE_BASE=0;wxUSE_GUI=1"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
@ -107,7 +106,6 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHsc "
AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib;..\..\src\png" AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib;..\..\src\png"
PreprocessorDefinitions="wxUSE_BASE=0;wxUSE_GUI=1" PreprocessorDefinitions="wxUSE_BASE=0;wxUSE_GUI=1"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
@ -171,7 +169,6 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHsc "
AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib;..\..\src\png" AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib;..\..\src\png"
PreprocessorDefinitions="wxUSE_BASE=0;wxUSE_GUI=1" PreprocessorDefinitions="wxUSE_BASE=0;wxUSE_GUI=1"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"

View File

@ -41,7 +41,6 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHsc "
AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib" AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib"
PreprocessorDefinitions="wxUSE_GUI=0;wxUSE_BASE=1;NDEBUG" PreprocessorDefinitions="wxUSE_GUI=0;wxUSE_BASE=1;NDEBUG"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
@ -105,7 +104,6 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHsc "
AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib" AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib"
PreprocessorDefinitions="_DEBUG;__WXDEBUG__;wxUSE_BASE=1;wxUSE_GUI=0" PreprocessorDefinitions="_DEBUG;__WXDEBUG__;wxUSE_BASE=1;wxUSE_GUI=0"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
@ -170,7 +168,6 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHsc "
Optimization="3" Optimization="3"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
FavorSizeOrSpeed="2" FavorSizeOrSpeed="2"

View File

@ -40,7 +40,6 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHsc "
AdditionalIncludeDirectories="&quot;$(ProjectRootDir)\include&quot;;&quot;$(ProjectRootDir)\include\msvc&quot;;&quot;$(SvnRootDir)\3rdparty\zlib&quot;;&quot;$(ProjectRootDir)\src\png&quot;" AdditionalIncludeDirectories="&quot;$(ProjectRootDir)\include&quot;;&quot;$(ProjectRootDir)\include\msvc&quot;;&quot;$(SvnRootDir)\3rdparty\zlib&quot;;&quot;$(ProjectRootDir)\src\png&quot;"
PreprocessorDefinitions="_DEBUG;__WXDEBUG__;wxUSE_BASE=0;wxUSE_GUI=1" PreprocessorDefinitions="_DEBUG;__WXDEBUG__;wxUSE_BASE=0;wxUSE_GUI=1"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
@ -104,7 +103,6 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHsc "
AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib;..\..\src\png" AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib;..\..\src\png"
PreprocessorDefinitions="wxUSE_BASE=0;wxUSE_GUI=1" PreprocessorDefinitions="wxUSE_BASE=0;wxUSE_GUI=1"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
@ -168,7 +166,6 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHsc "
AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib;..\..\src\png" AdditionalIncludeDirectories="..\..\Include;..\..\Include\msvc;..\..\..\zlib;..\..\src\png"
PreprocessorDefinitions="wxUSE_BASE=0;wxUSE_GUI=1" PreprocessorDefinitions="wxUSE_BASE=0;wxUSE_GUI=1"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"

View File

@ -29,25 +29,6 @@
#include "Pcsx2Types.h" #include "Pcsx2Types.h"
//////////////////////////////////////////////////////////////////////////////////////////
// Microsoft specific STL extensions for bounds checking and stuff: Enabled in devbuilds,
// disabled in release builds. :)
//
#ifdef _MSC_VER
# pragma warning(disable:4244) // disable warning C4244: '=' : conversion from 'big' to 'small', possible loss of data
# ifdef PCSX2_DEVBUILD
# undef _SECURE_SCL
# define _SECURE_SCL 1
# undef _SECURE_SCL_THROWS
# define _SECURE_SCL_THROWS 1
# else
# undef _SECURE_SCL
# define _SECURE_SCL 0
# undef _SECURE_SCL_THROWS
# define _SECURE_SCL_THROWS 0
# endif
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
# include <intrin.h> # include <intrin.h>
#else #else
@ -200,6 +181,7 @@
# define __naked __declspec(naked) # define __naked __declspec(naked)
# define __unused /*unused*/ # define __unused /*unused*/
# define __noinline __declspec(noinline) # define __noinline __declspec(noinline)
# define __threadlocal __declspec(thread)
// Don't know if there are Visual C++ equivalents of these. // Don't know if there are Visual C++ equivalents of these.
# define __hot # define __hot
@ -252,6 +234,7 @@ This theoretically unoptimizes. Not having much luck so far.
# define __noinline __attribute__((noinline)) # define __noinline __attribute__((noinline))
# define __hot __attribute__((hot)) # define __hot __attribute__((hot))
# define __cold __attribute__((cold)) # define __cold __attribute__((cold))
# define __threadlocal __thread
# define likely(x) __builtin_expect(!!(x), 1) # define likely(x) __builtin_expect(!!(x), 1)
# define unlikely(x) __builtin_expect(!!(x), 0) # define unlikely(x) __builtin_expect(!!(x), 0)
#endif #endif

View File

@ -116,6 +116,7 @@ namespace Console
extern bool __fastcall Status( const wxString& text ); extern bool __fastcall Status( const wxString& text );
} }
using Console::Color_Black;
using Console::Color_Red; using Console::Color_Red;
using Console::Color_Green; using Console::Color_Green;
using Console::Color_Blue; using Console::Color_Blue;

View File

@ -18,6 +18,8 @@
#pragma once #pragma once
#include "MemcpyFast.h"
extern void* __fastcall pcsx2_aligned_malloc(size_t size, size_t align); extern void* __fastcall pcsx2_aligned_malloc(size_t size, size_t align);
extern void* __fastcall pcsx2_aligned_realloc(void* handle, size_t size, size_t align); extern void* __fastcall pcsx2_aligned_realloc(void* handle, size_t size, size_t align);
extern void pcsx2_aligned_free(void* pmem); extern void pcsx2_aligned_free(void* pmem);

View File

@ -18,13 +18,6 @@
#pragma once #pragma once
//------------------------------------------------------------------
#ifdef _MSC_VER
#define __threadlocal __declspec(thread)
#else
#define __threadlocal __thread
#endif
// Register counts for x86/32 mode: // Register counts for x86/32 mode:
static const uint iREGCNT_XMM = 8; static const uint iREGCNT_XMM = 8;
static const uint iREGCNT_GPR = 8; static const uint iREGCNT_GPR = 8;

View File

@ -7,7 +7,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
PreprocessorDefinitions="PCSX2_DEBUG" PreprocessorDefinitions="PCSX2_DEBUG;_SECURE_SCL_=1;_SECURE_SCL_THROWS=1"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
/> />

View File

@ -11,7 +11,7 @@
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
EnableFiberSafeOptimizations="true" EnableFiberSafeOptimizations="true"
PreprocessorDefinitions="PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG" PreprocessorDefinitions="PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG;_SECURE_SCL_=1;_SECURE_SCL_THROWS=1"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"
/> />

View File

@ -13,7 +13,7 @@
OmitFramePointers="true" OmitFramePointers="true"
EnableFiberSafeOptimizations="true" EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true" WholeProgramOptimization="true"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG;_SECURE_SCL_=0;_SECURE_SCL_THROWS=0"
StringPooling="true" StringPooling="true"
MinimalRebuild="true" MinimalRebuild="true"
RuntimeLibrary="2" RuntimeLibrary="2"

View File

@ -80,7 +80,7 @@ FILE *_cdvdOpenMechaVer() {
// use the bios filename to get the name of the mecha ver file // use the bios filename to get the name of the mecha ver file
// [TODO] : Upgrade this to use std::string! // [TODO] : Upgrade this to use std::string!
strcpy(file, g_Conf.FullpathToBios().ToAscii().data() ); strcpy(file, g_Conf->FullpathToBios().ToAscii().data() );
ptr = file; ptr = file;
i = (int)strlen(file); i = (int)strlen(file);
@ -131,7 +131,7 @@ FILE *_cdvdOpenNVM() {
// use the bios filename to get the name of the nvm file // use the bios filename to get the name of the nvm file
// [TODO] : Upgrade this to use std::string! // [TODO] : Upgrade this to use std::string!
strcpy( file, g_Conf.FullpathToBios().ToAscii().data() ); strcpy( file, g_Conf->FullpathToBios().ToAscii().data() );
ptr = file; ptr = file;
i = (int)strlen(file); i = (int)strlen(file);

View File

@ -222,4 +222,4 @@ protected:
void LoadSave( IniInterface& ini ); void LoadSave( IniInterface& ini );
}; };
extern AppConfig g_Conf; extern AppConfig* g_Conf;

View File

@ -211,9 +211,9 @@ void iDumpBlock( int startpc, u8 * ptr )
Console::Status( "dump1 %x:%x, %x", params startpc, pc, cpuRegs.cycle ); Console::Status( "dump1 %x:%x, %x", params startpc, pc, cpuRegs.cycle );
g_Conf.Folders.Logs.Mkdir(); g_Conf->Folders.Logs.Mkdir();
AsciiFile eff( AsciiFile eff(
Path::Combine( g_Conf.Folders.Logs, wxsFormat(L"R5900dump%.8X.txt", startpc) ), Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"R5900dump%.8X.txt", startpc) ),
wxFile::write wxFile::write
); );

View File

@ -92,7 +92,7 @@ void loadBiosRom( const wxChar *ext, u8 *dest, long maxSize )
long filesize; long filesize;
// Try first a basic extension concatenation (normally results in something like name.bin.rom1) // Try first a basic extension concatenation (normally results in something like name.bin.rom1)
const wxString Bios( g_Conf.FullpathToBios() ); const wxString Bios( g_Conf->FullpathToBios() );
Bios1.Printf( L"%s.%s", Bios.c_str(), ext); Bios1.Printf( L"%s.%s", Bios.c_str(), ext);
if( (filesize=Path::GetFileSize( Bios1 ) ) <= 0 ) if( (filesize=Path::GetFileSize( Bios1 ) ) <= 0 )
@ -102,7 +102,7 @@ void loadBiosRom( const wxChar *ext, u8 *dest, long maxSize )
if( (filesize=Path::GetFileSize( Bios1 ) ) <= 0 ) if( (filesize=Path::GetFileSize( Bios1 ) ) <= 0 )
{ {
// Try for the old-style method (rom1.bin) // Try for the old-style method (rom1.bin)
Bios1 = Path::Combine( g_Conf.Folders.Bios, (wxString)ext ) + L".bin"; Bios1 = Path::Combine( g_Conf->Folders.Bios, (wxString)ext ) + L".bin";
if( (filesize=Path::GetFileSize( Bios1 ) ) <= 0 ) if( (filesize=Path::GetFileSize( Bios1 ) ) <= 0 )
{ {
Console::Notice( "Load Bios Warning: %s not found (this is not an error!)", params wxString(ext).ToAscii().data() ); Console::Notice( "Load Bios Warning: %s not found (this is not an error!)", params wxString(ext).ToAscii().data() );
@ -801,7 +801,7 @@ void memReset()
vtlb_VMap(0x00000000,0x00000000,0x20000000); vtlb_VMap(0x00000000,0x00000000,0x20000000);
vtlb_VMapUnmap(0x20000000,0x60000000); vtlb_VMapUnmap(0x20000000,0x60000000);
wxString Bios( g_Conf.FullpathToBios() ); wxString Bios( g_Conf->FullpathToBios() );
long filesize = Path::GetFileSize( Bios ); long filesize = Path::GetFileSize( Bios );
if( filesize <= 0 ) if( filesize <= 0 )

View File

@ -61,7 +61,7 @@ bool MemoryCard::IsPresent( uint mcd )
void MemoryCard::Load( uint mcd ) void MemoryCard::Load( uint mcd )
{ {
jASSUME( mcd < 2 ); jASSUME( mcd < 2 );
wxFileName fname( g_Conf.FullpathToMcd( mcd ) ); wxFileName fname( g_Conf->FullpathToMcd( mcd ) );
wxString str( fname.GetFullPath() ); wxString str( fname.GetFullPath() );
if( !fname.FileExists() ) if( !fname.FileExists() )

View File

@ -155,7 +155,7 @@ bool IsBIOS(const wxString& filename, wxString& description)
uint fileOffset=0; uint fileOffset=0;
romdir rd; romdir rd;
wxFileName Bios( g_Conf.Folders.Bios + filename ); wxFileName Bios( g_Conf->Folders.Bios + filename );
wxFile fp( Bios.GetFullPath().c_str() ); wxFile fp( Bios.GetFullPath().c_str() );
if( !fp.IsOpened() ) return FALSE; if( !fp.IsOpened() ) return FALSE;
@ -343,7 +343,7 @@ void LoadGSState(const wxString& file)
// file not found? try prefixing with sstates folder: // file not found? try prefixing with sstates folder:
if( !Path::IsRooted( file ) ) if( !Path::IsRooted( file ) )
{ {
f = new gzLoadingState( Path::Combine( g_Conf.Folders.Savestates, file ) ); f = new gzLoadingState( Path::Combine( g_Conf->Folders.Savestates, file ) );
// If this load attempt fails, then let the exception bubble up to // If this load attempt fails, then let the exception bubble up to
// the caller to deal with... // the caller to deal with...
@ -386,7 +386,7 @@ char* mystrlwr( char* string )
static wxString GetGSStateFilename() static wxString GetGSStateFilename()
{ {
return Path::Combine( g_Conf.Folders.Savestates, wxsFormat( L"/%8.8X.%d.gs", ElfCRC, StatesC ) ); return Path::Combine( g_Conf->Folders.Savestates, wxsFormat( L"/%8.8X.%d.gs", ElfCRC, StatesC ) );
} }
void CycleFrameLimit(int dir) void CycleFrameLimit(int dir)
@ -530,7 +530,7 @@ void ProcessFKeys(int fkey, struct KeyModifiers *keymod)
// note: VK_F5-VK_F7 are reserved for GS // note: VK_F5-VK_F7 are reserved for GS
case 8: case 8:
GSmakeSnapshot( g_Conf.Folders.Snapshots.ToAscii().data() ); GSmakeSnapshot( g_Conf->Folders.Snapshots.ToAscii().data() );
break; break;
case 9: //gsdx "on the fly" renderer switching case 9: //gsdx "on the fly" renderer switching
@ -588,7 +588,7 @@ void ProcessFKeys(int fkey, struct KeyModifiers *keymod)
name += L"_" + part2; name += L"_" + part2;
gsText.Printf( L"%s.%d.gs", name.c_str(), StatesC ); gsText.Printf( L"%s.%d.gs", name.c_str(), StatesC );
Text = Path::Combine( g_Conf.Folders.Savestates, gsText ); Text = Path::Combine( g_Conf->Folders.Savestates, gsText );
} }
else else
{ {

View File

@ -627,9 +627,9 @@ void inifile_read( const char * name )
patchnumber = 0; patchnumber = 0;
#ifdef _WIN32 #ifdef _WIN32
sprintf( buffer, PATCHES_DIR "\\%s.pnach", name ); sprintf( buffer, "patches\\%s.pnach", name );
#else #else
sprintf( buffer, PATCHES_DIR "/%s.pnach", name ); sprintf( buffer, "patches/%s.pnach", name );
#endif #endif
f1 = fopen( buffer, "rt" ); f1 = fopen( buffer, "rt" );

View File

@ -34,26 +34,12 @@
namespace Path namespace Path
{ {
#ifdef WIN32
// Path Separator used when creating new paths.
static const wxChar Separator( L'\\' );
// Path separators used when breaking existing paths into parts and pieces.
static const wxString Delimiters( L"\\/" );
static const wxChar SeparatorExt( L'.' );
#else
static const wxChar Separator( '/');
static const wxChar Delimiters( '/' );
static const wxChar SeparatorExt( L'.' );
#endif
static bool IsPathSeparator( wxChar src ) static bool IsPathSeparator( wxChar src )
{ {
#ifdef WIN32 #ifdef WIN32
return (src == Separator) || (src == L'/'); return (src == wxFileName::GetPathSeparator()) || (src == L'/');
#else #else
return src == Separator; return src == wxFileName::GetPathSeparator();
#endif #endif
} }
@ -169,7 +155,7 @@ wxString ReplaceExtension( const wxString& src, const wxString& ext )
{ {
wxString dest; wxString dest;
int pos = src.find_last_of( SeparatorExt ); int pos = src.find_last_of( L'.' );
if( pos == wxString::npos || pos == 0 ) if( pos == wxString::npos || pos == 0 )
dest = src; dest = src;
else else
@ -213,7 +199,7 @@ wxString GetDirectory( const wxString& src )
// Example /this/that/something.txt -> dest == "/" // Example /this/that/something.txt -> dest == "/"
wxString GetRootDirectory( const wxString& src ) wxString GetRootDirectory( const wxString& src )
{ {
int pos = src.find_first_of( Delimiters ); int pos = src.find_first_of( wxFileName::GetPathSeparators() );
if( pos == wxString::npos ) if( pos == wxString::npos )
return wxString(); return wxString();
else else

View File

@ -7,26 +7,6 @@
extern char MAIN_DIR[g_MaxPath]; extern char MAIN_DIR[g_MaxPath];
#endif #endif
//////////////////////////////////////////////////////////////////////////////////////////
// Obsolete Values in wxWidgets Branch!
// The following set of macros has been superceeded by the PathDefs and FilenameDefs namespaces,
// and furethermore by a set of user-configurable paths in g_Conf.
//
#define DEFAULT_INIS_DIR "inis"
#define DEFAULT_BIOS_DIR "bios"
#define DEFAULT_PLUGINS_DIR "plugins"
#define MEMCARDS_DIR "memcards"
#define PATCHES_DIR "patches"
#define SSTATES_DIR "sstates"
#define LANGS_DIR "Langs"
#define LOGS_DIR "logs"
#define SNAPSHOTS_DIR "snaps"
#define DEFAULT_MEMCARD1 "Mcd001.ps2"
#define DEFAULT_MEMCARD2 "Mcd002.ps2"
// Windows.h namespace pollution! // Windows.h namespace pollution!
#undef CreateDirectory #undef CreateDirectory
@ -163,12 +143,8 @@ namespace Path
// //
namespace PathDefs namespace PathDefs
{ {
extern const wxDirName Snapshots; // complete pathnames are returned by these functions
extern const wxDirName Savestates; // For 99% of all code, you should use these.
extern const wxDirName MemoryCards;
extern const wxDirName Settings;
extern const wxDirName Plugins;
extern const wxDirName Themes;
extern wxDirName GetDocuments(); extern wxDirName GetDocuments();
extern wxDirName GetSnapshots(); extern wxDirName GetSnapshots();
@ -180,12 +156,24 @@ namespace PathDefs
extern wxDirName GetSettings(); extern wxDirName GetSettings();
extern wxDirName GetLogs(); extern wxDirName GetLogs();
extern wxDirName GetThemes(); extern wxDirName GetThemes();
// Base folder names used to extend out the documents/approot folder base into a complete
// path. These are typically for internal AppConfig use only, barring a few special cases.
namespace Base
{
extern const wxDirName& Snapshots();
extern const wxDirName& Savestates();
extern const wxDirName& MemoryCards();
extern const wxDirName& Settings();
extern const wxDirName& Plugins();
extern const wxDirName& Themes();
}
} }
namespace FilenameDefs namespace FilenameDefs
{ {
extern wxFileName GetConfig(); extern wxFileName GetConfig();
extern const wxFileName Memcard[2]; extern const wxFileName& Memcard( int slot );
}; };
#endif #endif

View File

@ -50,7 +50,7 @@ static void PostLoadPrep()
wxString SaveState::GetFilename( int slot ) wxString SaveState::GetFilename( int slot )
{ {
return (g_Conf.Folders.Savestates + return (g_Conf->Folders.Savestates +
wxsFormat( L"%8.8X.%3.3d", ElfCRC, slot )).GetFullPath(); wxsFormat( L"%8.8X.%3.3d", ElfCRC, slot )).GetFullPath();
} }
@ -109,7 +109,7 @@ void SaveState::FreezeAll()
char descin[128]; char descin[128];
wxString descout; wxString descout;
IsBIOS( g_Conf.FullpathToBios(), descout ); IsBIOS( g_Conf->FullpathToBios(), descout );
memcpy_fast( descin, descout.ToAscii().data(), 128 ); memcpy_fast( descin, descout.ToAscii().data(), 128 );
Freeze( descin ); Freeze( descin );

View File

@ -33,6 +33,7 @@ void statsOpen() {
} }
void statsClose() { void statsClose() {
/*
time_t t; time_t t;
FILE *f; FILE *f;
@ -53,6 +54,7 @@ void statsClose() {
else fprintf(f, "Recompiler Mode: VUrec1 %s, VUrec0 %s\n", else fprintf(f, "Recompiler Mode: VUrec1 %s, VUrec0 %s\n",
CHECK_VU1REC ? "Enabled" : "Disabled", CHECK_VU0REC ? "Enabled" : "Disabled"); CHECK_VU1REC ? "Enabled" : "Disabled", CHECK_VU0REC ? "Enabled" : "Disabled");
fclose(f); fclose(f);
*/
} }
void statsVSync() { void statsVSync() {

View File

@ -30,46 +30,66 @@ class IniInterface;
extern wxFileHistory* g_RecentIsoList; extern wxFileHistory* g_RecentIsoList;
class LogWriteEvent;
DECLARE_EVENT_TYPE(wxEVT_DockConsole, -1)
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// //
class ConsoleLogFrame : public wxFrame, public NoncopyableObject class ConsoleLogFrame : public wxFrame, public NoncopyableObject
{ {
protected:
class ColorArray : public NoncopyableObject
{
protected:
SafeArray<wxTextAttr> m_table;
wxTextAttr m_color_default;
public:
ColorArray();
const wxTextAttr& operator[]( Console::Colors coloridx ) const
{
return m_table[(int)coloridx];
}
void SetFont( const wxFont& font );
const wxTextAttr& Default() { return m_table[0]; }
};
protected: protected:
wxTextCtrl& m_TextCtrl; wxTextCtrl& m_TextCtrl;
ColorArray m_ColorTable;
Console::Colors m_curcolor;
public: public:
// ctor & dtor // ctor & dtor
ConsoleLogFrame(MainEmuFrame *pParent, const wxString& szTitle); ConsoleLogFrame(MainEmuFrame *pParent, const wxString& szTitle);
virtual ~ConsoleLogFrame(); virtual ~ConsoleLogFrame();
virtual void OnCloseWindow(wxCloseEvent& event);
protected:
// menu callbacks // menu callbacks
virtual void OnOpen (wxMenuEvent& event);
virtual void OnClose(wxMenuEvent& event); virtual void OnClose(wxMenuEvent& event);
virtual void OnSave (wxMenuEvent& event); virtual void OnSave (wxMenuEvent& event);
virtual void OnClear(wxMenuEvent& event); virtual void OnClear(wxMenuEvent& event);
virtual void OnCloseWindow(wxCloseEvent& event); void OnWrite( wxCommandEvent& event );
void OnNewline( wxCommandEvent& event );
virtual void Write( const wxChar* text ); void OnSetTitle( wxCommandEvent& event );
virtual void Write( const char* text ); void OnDockedMove( wxCommandEvent& event );
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() // common part of OnClose() and OnCloseWindow()
virtual void DoClose(); virtual void DoClose();
void OnMoveAround( wxMoveEvent& evt ); void OnMoveAround( wxMoveEvent& evt );
void OnResize( wxSizeEvent& evt ); void OnResize( wxSizeEvent& evt );
virtual void Write( const wxString& text );
void SetColor( Console::Colors color );
void ClearColor();
}; };
@ -121,7 +141,8 @@ class Pcsx2App : public wxApp
{ {
protected: protected:
MainEmuFrame* m_MainFrame; MainEmuFrame* m_MainFrame;
ConsoleLogFrame* m_ConsoleFrame; ConsoleLogFrame* m_ProgramLogBox;
ConsoleLogFrame* m_Ps2ConLogBox;
wxBitmap* m_Bitmap_Logo; wxBitmap* m_Bitmap_Logo;
wxImageList m_ConfigImages; wxImageList m_ConfigImages;
@ -152,8 +173,20 @@ public:
return *m_MainFrame; return *m_MainFrame;
} }
ConsoleLogFrame* GetConsoleFrame() const { return m_ConsoleFrame; } void ProgramLog_PostEvent( wxEvent& evt )
void SetConsoleFrame( ConsoleLogFrame& frame ) { m_ConsoleFrame = &frame; } {
if( m_ProgramLogBox == NULL ) return;
m_ProgramLogBox->GetEventHandler()->AddPendingEvent( evt );
}
void ConsoleLog_PostEvent( wxEvent& evt )
{
if( m_Ps2ConLogBox == NULL ) return;
m_Ps2ConLogBox->GetEventHandler()->AddPendingEvent( evt );
}
//ConsoleLogFrame* GetConsoleFrame() const { return m_ProgramLogBox; }
//void SetConsoleFrame( ConsoleLogFrame& frame ) { m_ProgramLogBox = &frame; }
protected: protected:
void ReadUserModeSettings(); void ReadUserModeSettings();

View File

@ -31,25 +31,72 @@
// //
namespace PathDefs namespace PathDefs
{ {
const wxDirName Snapshots ( L"snaps" ); namespace Base
const wxDirName Savestates ( L"sstates" ); {
const wxDirName MemoryCards ( L"memcards" ); const wxDirName& Snapshots()
const wxDirName Settings ( L"inis" ); {
const wxDirName Plugins ( L"plugins" ); static const wxDirName retval( L"snaps" );
const wxDirName Logs ( L"logs" ); return retval;
const wxDirName Dumps ( L"dumps" ); }
const wxDirName Themes ( L"themes" );
const wxDirName& Savestates()
{
static const wxDirName retval( L"sstates" );
return retval;
}
const wxDirName& MemoryCards()
{
static const wxDirName retval( L"memcards" );
return retval;
}
const wxDirName& Settings()
{
static const wxDirName retval( L"inis" );
return retval;
}
const wxDirName& Plugins()
{
static const wxDirName retval( L"plugins" );
return retval;
}
const wxDirName& Logs()
{
static const wxDirName retval( L"logs" );
return retval;
}
const wxDirName& Dumps()
{
static const wxDirName retval( L"dumps" );
return retval;
}
const wxDirName& Themes()
{
static const wxDirName retval( L"themes" );
return retval;
}
};
// Specifies the root folder for the application install. // Specifies the root folder for the application install.
// (currently it's the CWD, but in the future I intend to move all binaries to a "bin" // (currently it's the CWD, but in the future I intend to move all binaries to a "bin"
// sub folder, in which case the approot will become "..") // sub folder, in which case the approot will become "..")
const wxDirName AppRoot( "." ); // L".." ); const wxDirName& AppRoot()
{
static const wxDirName retval( L"." );
return retval;
}
// Fetches the path location for user-consumable documents -- stuff users are likely to want to // Fetches the path location for user-consumable documents -- stuff users are likely to want to
// share with other programs: screenshots, memory cards, and savestates. // share with other programs: screenshots, memory cards, and savestates.
wxDirName GetDocuments() wxDirName GetDocuments()
{ {
if( g_Conf.UseAdminMode ) if( g_Conf->UseAdminMode )
return (wxDirName)wxGetCwd(); return (wxDirName)wxGetCwd();
else else
return (wxDirName)wxStandardPaths::Get().GetDocumentsDir() + (wxDirName)wxGetApp().GetAppName(); return (wxDirName)wxStandardPaths::Get().GetDocumentsDir() + (wxDirName)wxGetApp().GetAppName();
@ -57,7 +104,7 @@ namespace PathDefs
wxDirName GetSnapshots() wxDirName GetSnapshots()
{ {
return GetDocuments() + Snapshots; return GetDocuments() + Base::Snapshots();
} }
wxDirName GetBios() wxDirName GetBios()
@ -67,32 +114,32 @@ namespace PathDefs
wxDirName GetSavestates() wxDirName GetSavestates()
{ {
return GetDocuments() + Savestates; return GetDocuments() + Base::Savestates();
} }
wxDirName GetMemoryCards() wxDirName GetMemoryCards()
{ {
return GetDocuments() + MemoryCards; return GetDocuments() + Base::MemoryCards();
} }
wxDirName GetPlugins() wxDirName GetPlugins()
{ {
return AppRoot + Plugins; return AppRoot() + Base::Plugins();
} }
wxDirName GetSettings() wxDirName GetSettings()
{ {
return GetDocuments() + Settings; return GetDocuments() + Base::Settings();
} }
wxDirName GetThemes() wxDirName GetThemes()
{ {
return AppRoot + Themes; return AppRoot() + Base::Themes();
} }
wxDirName GetLogs() wxDirName GetLogs()
{ {
return GetDocuments() + Logs; return GetDocuments() + Base::Logs();
} }
}; };
@ -108,11 +155,19 @@ namespace FilenameDefs
return wxGetApp().GetAppName() + L".ini"; return wxGetApp().GetAppName() + L".ini";
} }
const wxFileName Memcard[2] = const wxFileName& Memcard( int slot )
{
static const wxFileName retval[2] =
{ {
wxFileName( L"Mcd001.ps2" ), wxFileName( L"Mcd001.ps2" ),
wxFileName( L"Mcd002.ps2" ) wxFileName( L"Mcd002.ps2" )
}; };
if( IsDevBuild && ((uint)slot) < 2 )
throw Exception::IndexBoundsFault( L"FilenameDefs::Memcard", slot, 2 );
return retval[slot];
}
}; };
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -314,18 +369,6 @@ void AppConfig::FolderOptions::LoadSave( IniInterface& ini )
ini.SetPath( L".." ); ini.SetPath( L".." );
} }
const wxString g_PluginNames[] =
{
L"CDVD",
L"GS",
L"PAD1",
L"PAD2",
L"SPU2",
L"USB",
L"FW",
L"DEV9"
};
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
const wxFileName& AppConfig::FilenameOptions::operator[]( PluginsEnum_t pluginidx ) const const wxFileName& AppConfig::FilenameOptions::operator[]( PluginsEnum_t pluginidx ) const
{ {
@ -339,7 +382,18 @@ void AppConfig::FilenameOptions::LoadSave( IniInterface& ini )
{ {
ini.SetPath( L"Filenames" ); ini.SetPath( L"Filenames" );
const wxFileName pc( L"Please Configure" ); static const wxFileName pc( L"Please Configure" );
static const wxString g_PluginNames[] =
{
L"CDVD",
L"GS",
L"PAD1",
L"PAD2",
L"SPU2",
L"USB",
L"FW",
L"DEV9"
};
for( int i=0; i<PluginId_Count; ++i ) for( int i=0; i<PluginId_Count; ++i )
{ {

View File

@ -19,15 +19,28 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "App.h" #include "App.h"
#include "MainFrame.h" #include "MainFrame.h"
#include "Utilities/Console.h"
#include "DebugTools/Debug.h" #include "DebugTools/Debug.h"
#include <wx/file.h> #include <wx/file.h>
#include <wx/textfile.h> #include <wx/textfile.h>
// This code was 'borrowed' from wxWidgets and then heavily modified to suite // This code was 'borrowed' from wxWidgets built in console log class and then heavily
// our needs. I would have used some crafty subclassing instead except who // modified to suite our needs. I would have used some crafty subclassing instead except
// ever wrote the code of wxWidgets had a peculiar love of the 'private' keyword, // who ever wrote the code of wxWidgets had a peculiar love of the 'private' keyword,
// thus killing any possibility of subclassing in a useful manner. // thus killing any possibility of subclassing in a useful manner. (sigh)
DECLARE_EVENT_TYPE(wxEVT_LOG_Write, -1)
DECLARE_EVENT_TYPE(wxEVT_LOG_Newline, -1)
DECLARE_EVENT_TYPE(wxEVT_SetTitleText, -1)
DEFINE_EVENT_TYPE(wxEVT_LOG_Write)
DEFINE_EVENT_TYPE(wxEVT_LOG_Newline)
DEFINE_EVENT_TYPE(wxEVT_SetTitleText)
DEFINE_EVENT_TYPE(wxEVT_DockConsole)
using Console::Colors;
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// pass an uninitialized file object, the function will ask the user for the // pass an uninitialized file object, the function will ask the user for the
@ -72,22 +85,44 @@ static bool OpenLogFile(wxFile& file, wxString& filename, wxWindow *parent)
return file.Create(filename); return file.Create(filename);
} }
////////////////////////////////////////////////////////////////////////////////////////// // ------------------------------------------------------------------------
// ConsoleLogFrame::ColorArray::ColorArray() :
m_table( 8 )
{
// Standard R, G, B format:
new (&m_table[Color_Black]) wxTextAttr( wxColor( 0, 0, 0 ) );
new (&m_table[Color_Red]) wxTextAttr( wxColor( 128, 0, 0 ) );
new (&m_table[Color_Green]) wxTextAttr( wxColor( 0, 128, 0 ) );
new (&m_table[Color_Blue]) wxTextAttr( wxColor( 0, 0, 128 ) );
new (&m_table[Color_Yellow])wxTextAttr( wxColor( 180, 180, 0 ) );
new (&m_table[Color_Cyan]) wxTextAttr( wxColor( 0, 160, 160 ) );
new (&m_table[Color_Magenta])wxTextAttr( wxColor( 160, 0, 160 ) );
new (&m_table[Color_White]) wxTextAttr( wxColor( 160, 160, 160 ) );
}
void ConsoleLogFrame::ColorArray::SetFont( const wxFont& font )
{
for( int i=0; i<8; ++i )
m_table[i].SetFont( font );
}
// ------------------------------------------------------------------------
ConsoleLogFrame::ConsoleLogFrame(MainEmuFrame *parent, const wxString& title) : ConsoleLogFrame::ConsoleLogFrame(MainEmuFrame *parent, const wxString& title) :
wxFrame(parent, wxID_ANY, title), wxFrame(parent, wxID_ANY, title)
m_TextCtrl( *new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, , m_TextCtrl( *new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxHSCROLL | wxTE_READONLY | wxTE_RICH2 ) ) wxTE_MULTILINE | wxHSCROLL | wxTE_READONLY | wxTE_RICH2 ) )
, m_ColorTable()
, m_curcolor( Color_Black )
{ {
m_TextCtrl.SetBackgroundColour( wxColor( 238, 240, 248 ) ); //wxColor( 48, 48, 64 ) ); m_TextCtrl.SetBackgroundColour( wxColor( 238, 240, 248 ) ); //wxColor( 48, 48, 64 ) );
// create menu // create menu
wxMenuBar *pMenuBar = new wxMenuBar; wxMenuBar *pMenuBar = new wxMenuBar;
wxMenu *pMenu = new wxMenu; wxMenu *pMenu = new wxMenu;
pMenu->Append(Menu_Save, L"&Save...", L"Save log contents to file"); pMenu->Append(wxID_SAVE, L"&Save...", _("Save log contents to file"));
pMenu->Append(Menu_Clear, L"C&lear", L"Clear the log contents"); pMenu->Append(wxID_CLEAR, L"C&lear", _("Clear the log contents"));
pMenu->AppendSeparator(); pMenu->AppendSeparator();
pMenu->Append(Menu_Close, L"&Close",L"Close this window"); pMenu->Append(wxID_CLOSE, L"&Close", _("Close this window"));
pMenuBar->Append(pMenu, L"&Log"); pMenuBar->Append(pMenu, L"&Log");
SetMenuBar(pMenuBar); SetMenuBar(pMenuBar);
@ -96,13 +131,30 @@ ConsoleLogFrame::ConsoleLogFrame(MainEmuFrame *parent, const wxString& title) :
CreateStatusBar(); CreateStatusBar();
ClearColor(); ClearColor();
Connect( Menu_Close, wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( ConsoleLogFrame::OnClose ) ); // Sync with configuration settings:
Connect( Menu_Save, wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( ConsoleLogFrame::OnSave ) );
Connect( Menu_Clear, wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( ConsoleLogFrame::OnClear ) ); wxASSERT_MSG( g_Conf != NULL, L"Console Log Frames must be created AFTER the configuration has been loaded" );
if( g_Conf != NULL )
{
SetSize( wxRect( g_Conf->ConLogBox.DisplayPosition, g_Conf->ConLogBox.DisplaySize ) );
Show( g_Conf->ConLogBox.Visible );
}
// Bind Events:
Connect( wxID_OPEN, wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( ConsoleLogFrame::OnOpen ) );
Connect( wxID_CLOSE, wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( ConsoleLogFrame::OnClose ) );
Connect( wxID_SAVE, wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( ConsoleLogFrame::OnSave ) );
Connect( wxID_CLEAR, wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( ConsoleLogFrame::OnClear ) );
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler(ConsoleLogFrame::OnCloseWindow) ); Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler(ConsoleLogFrame::OnCloseWindow) );
Connect( wxEVT_MOVE, wxMoveEventHandler(ConsoleLogFrame::OnMoveAround) ); Connect( wxEVT_MOVE, wxMoveEventHandler(ConsoleLogFrame::OnMoveAround) );
Connect( wxEVT_SIZE, wxSizeEventHandler(ConsoleLogFrame::OnResize) ); Connect( wxEVT_SIZE, wxSizeEventHandler(ConsoleLogFrame::OnResize) );
Connect( wxEVT_LOG_Write, wxCommandEventHandler(ConsoleLogFrame::OnWrite) );
Connect( wxEVT_LOG_Newline, wxCommandEventHandler(ConsoleLogFrame::OnNewline) );
Connect( wxEVT_SetTitleText, wxCommandEventHandler(ConsoleLogFrame::OnSetTitle) );
Connect( wxEVT_DockConsole, wxCommandEventHandler(ConsoleLogFrame::OnDockedMove) );
} }
ConsoleLogFrame::~ConsoleLogFrame() { } ConsoleLogFrame::~ConsoleLogFrame() { }
@ -112,18 +164,24 @@ void ConsoleLogFrame::OnMoveAround( wxMoveEvent& evt )
// Docking check! If the window position is within some amount // Docking check! If the window position is within some amount
// of the main window, enable docking. // of the main window, enable docking.
wxPoint topright( GetParent()->GetRect().GetTopRight() ); if( wxFrame* main = wxGetApp().GetMainWindow() )
{
wxPoint topright( main->GetRect().GetTopRight() );
wxRect snapzone( topright - wxSize( 8,8 ), wxSize( 16,16 ) ); wxRect snapzone( topright - wxSize( 8,8 ), wxSize( 16,16 ) );
if( snapzone.Contains( GetPosition() ) ) g_Conf->ConLogBox.AutoDock = snapzone.Contains( GetPosition() );
if( g_Conf->ConLogBox.AutoDock )
{
SetPosition( topright + wxSize( 1,0 ) ); SetPosition( topright + wxSize( 1,0 ) );
g_Conf->ConLogBox.AutoDock = true;
}
}
evt.Skip(); evt.Skip();
} }
void ConsoleLogFrame::OnResize( wxSizeEvent& evt ) void ConsoleLogFrame::OnResize( wxSizeEvent& evt )
{ {
g_Conf.ConLogBox.DisplaySize = GetSize(); g_Conf->ConLogBox.DisplaySize = GetSize();
evt.Skip(); evt.Skip();
} }
@ -131,12 +189,27 @@ void ConsoleLogFrame::DoClose()
{ {
// instead of closing just hide the window to be able to Show() it later // instead of closing just hide the window to be able to Show() it later
Show(false); Show(false);
if( GetParent() != NULL ) if( wxFrame* main = wxGetApp().GetMainWindow() )
wxStaticCast( GetParent(), MainEmuFrame )->OnLogBoxHidden(); wxStaticCast( main, MainEmuFrame )->OnLogBoxHidden();
} }
void ConsoleLogFrame::OnClose(wxMenuEvent& WXUNUSED(event)) { DoClose(); } void ConsoleLogFrame::OnOpen(wxMenuEvent& WXUNUSED(event))
void ConsoleLogFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { DoClose(); } {
Show(true);
}
void ConsoleLogFrame::OnClose( wxMenuEvent& event )
{
DoClose();
}
void ConsoleLogFrame::OnCloseWindow(wxCloseEvent& event)
{
if( event.CanVeto() )
DoClose();
else
event.Skip();
}
void ConsoleLogFrame::OnSave(wxMenuEvent& WXUNUSED(event)) void ConsoleLogFrame::OnSave(wxMenuEvent& WXUNUSED(event))
{ {
@ -169,38 +242,43 @@ void ConsoleLogFrame::OnClear(wxMenuEvent& WXUNUSED(event))
m_TextCtrl.Clear(); m_TextCtrl.Clear();
} }
static const wxTextAttr tbl_color_codes[] = void ConsoleLogFrame::SetColor( Colors color )
{ {
// Standard R, G, B format: m_TextCtrl.SetDefaultStyle( m_ColorTable[color] );
wxTextAttr( wxColor( 0, 0, 0 ) ),
wxTextAttr( wxColor( 128, 0, 0 ) ),
wxTextAttr( wxColor( 0,128, 0 ) ),
wxTextAttr( wxColor( 180,180, 0 ) ),
wxTextAttr( wxColor( 0, 0,128 ) ),
wxTextAttr( wxColor( 0,160,160 ) ),
wxTextAttr( wxColor( 160,160,160 ) )
};
static const wxTextAttr color_default( wxColor( 0, 0, 0 ) );
// 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] );
} }
void ConsoleLogFrame::ClearColor() void ConsoleLogFrame::ClearColor()
{ {
m_TextCtrl.SetDefaultStyle( color_default ); m_TextCtrl.SetDefaultStyle( m_ColorTable.Default() );
} }
void ConsoleLogFrame::Newline() void ConsoleLogFrame::OnWrite( wxCommandEvent& event )
{ {
Write( L"\n"); Colors color = (Colors)event.GetExtraLong();
if( color != m_curcolor )
m_TextCtrl.SetDefaultStyle( m_ColorTable[m_curcolor=color] );
Write( event.GetString() );
} }
void ConsoleLogFrame::Write( const wxChar* text ) void ConsoleLogFrame::OnNewline( wxCommandEvent& event )
{
Write( L"\n" );
}
void ConsoleLogFrame::OnSetTitle( wxCommandEvent& event )
{
SetTitle( event.GetString() );
}
void ConsoleLogFrame::OnDockedMove( wxCommandEvent& event )
{
if( g_Conf != NULL )
SetPosition( g_Conf->ConLogBox.DisplayPosition );
}
void ConsoleLogFrame::Write( const wxString& text )
{ {
// remove selection (WriteText is in fact ReplaceSelection) // remove selection (WriteText is in fact ReplaceSelection)
#ifdef __WXMSW__ #ifdef __WXMSW__
@ -211,70 +289,67 @@ void ConsoleLogFrame::Write( const wxChar* text )
m_TextCtrl.AppendText( text ); m_TextCtrl.AppendText( text );
} }
void ConsoleLogFrame::Write( const char* text )
{
// remove selection (WriteText is in fact ReplaceSelection)
#ifdef __WXMSW__
wxTextPos nLen = m_TextCtrl.GetLastPosition();
m_TextCtrl.SetSelection(nLen, nLen);
#endif
m_TextCtrl.AppendText( wxString::FromAscii(text) );
}
namespace Console namespace Console
{ {
__threadlocal Colors th_CurrentColor = Color_Black;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void __fastcall SetTitle( const wxString& title ) void __fastcall SetTitle( const wxString& title )
{ {
if( ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame() ) wxCommandEvent evt( wxEVT_SetTitleText );
FrameHandle->SetTitle( title ); evt.SetString( title );
wxGetApp().ProgramLog_PostEvent( evt );
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void __fastcall SetColor( Colors color ) void __fastcall SetColor( Colors color )
{ {
if( ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame() ) th_CurrentColor = color;
FrameHandle->SetColor( color );
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void ClearColor() void ClearColor()
{ {
if( ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame() ) th_CurrentColor = Color_Black;
FrameHandle->ClearColor();
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
bool Newline() bool Newline()
{ {
if( ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame() )
FrameHandle->Newline();
if( emuLog != NULL ) if( emuLog != NULL )
fputs( "\n", emuLog ); fputs( "\n", emuLog );
wxCommandEvent evt( wxEVT_LOG_Newline );
wxGetApp().ProgramLog_PostEvent( evt );
return false; return false;
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
bool __fastcall Write( const char* fmt ) bool __fastcall Write( const char* fmt )
{ {
if( ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame() )
FrameHandle->Write( fmt );
if( emuLog != NULL ) if( emuLog != NULL )
fputs( fmt, emuLog ); fputs( fmt, emuLog );
wxCommandEvent evt( wxEVT_LOG_Write );
evt.SetString( wxString::FromAscii( fmt ) );
evt.SetExtraLong( th_CurrentColor );
wxGetApp().ProgramLog_PostEvent( evt );
return false; return false;
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
bool __fastcall Write( const wxString& fmt ) bool __fastcall Write( const wxString& fmt )
{ {
if( ConsoleLogFrame* FrameHandle = wxGetApp().GetConsoleFrame() )
FrameHandle->Write( fmt );
if( emuLog != NULL ) if( emuLog != NULL )
fputs( fmt.ToAscii().data(), emuLog ); fputs( fmt.ToAscii().data(), emuLog );
wxCommandEvent evt( wxEVT_LOG_Write );
evt.SetString( fmt );
evt.SetExtraLong( th_CurrentColor );
wxGetApp().ProgramLog_PostEvent( evt );
return false; return false;
} }
} }

View File

@ -70,7 +70,7 @@ Dialogs::ConfigurationDialog::~ConfigurationDialog()
bool Dialogs::ConfigurationDialog::ApplySettings() bool Dialogs::ConfigurationDialog::ApplySettings()
{ {
AppConfig confcopy( g_Conf ); AppConfig confcopy( *g_Conf );
int pagecount = m_listbook.GetPageCount(); int pagecount = m_listbook.GetPageCount();
for( int i=0; i<pagecount; ++i ) for( int i=0; i<pagecount; ++i )
@ -79,9 +79,9 @@ bool Dialogs::ConfigurationDialog::ApplySettings()
if( !panel->Apply( confcopy ) ) return false; if( !panel->Apply( confcopy ) ) return false;
} }
g_Conf = confcopy; *g_Conf = confcopy;
g_Conf.Apply(); g_Conf->Apply();
g_Conf.Save(); g_Conf->Save();
return true; return true;
} }

View File

@ -82,7 +82,7 @@ wxMenu* MainEmuFrame::MakeIsoMenu()
// Add in the recent files! // Add in the recent files!
/*const StringListNode* cruise = g_Conf.RecentIsos; /*const StringListNode* cruise = g_Conf->RecentIsos;
int i = 0; int i = 0;
int threshold = 15; int threshold = 15;
@ -117,8 +117,11 @@ wxMenu* MainEmuFrame::MakeIsoMenu()
mnuIso->Append( Menu_Iso_Recent+i, Path::GetFilename( ellipsized ), *cruise->item ); mnuIso->Append( Menu_Iso_Recent+i, Path::GetFilename( ellipsized ), *cruise->item );
}*/ }*/
if( g_RecentIsoList != NULL )
{
g_RecentIsoList->UseMenu( mnuIso ); g_RecentIsoList->UseMenu( mnuIso );
g_RecentIsoList->AddFilesToMenu( mnuIso ); g_RecentIsoList->AddFilesToMenu( mnuIso );
}
return mnuIso; return mnuIso;
} }
@ -156,22 +159,45 @@ void MainEmuFrame::PopulatePadMenu()
m_menuPad.Append( Menu_Pad_Advanced, _T("Advanced..."), wxEmptyString, wxITEM_NORMAL ); m_menuPad.Append( Menu_Pad_Advanced, _T("Advanced..."), wxEmptyString, wxITEM_NORMAL );
} }
#define ConnectMenu( id, handler ) \
Connect( id, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) )
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Close out the console log windows along with the main emu window.
// Note: This event only happens after a close event has occured and was *not* veto'd. Ie,
// it means it's time to provide an unconditional closure of said window.
//
void MainEmuFrame::OnCloseWindow(wxCloseEvent& evt)
{
wxCloseEvent conevt( wxEVT_CLOSE_WINDOW );
conevt.SetCanVeto( false ); // tells the console to close rather than hide
wxGetApp().ProgramLog_PostEvent( conevt );
evt.Skip();
}
void MainEmuFrame::OnMoveAround( wxMoveEvent& evt ) void MainEmuFrame::OnMoveAround( wxMoveEvent& evt )
{ {
if( g_Conf.ConLogBox.AutoDock ) if( g_Conf->ConLogBox.AutoDock )
m_logbox.SetPosition( g_Conf.ConLogBox.DisplayPosition = GetPosition() + wxSize( GetSize().x, 0 ) ); {
g_Conf->ConLogBox.DisplayPosition = GetPosition() + wxSize( GetSize().x, 0 );
// Send the move event our window ID, which allows the logbox to know that this
// move event comes from us, and needs a special handler.
wxCommandEvent evt( wxEVT_DockConsole );
wxGetApp().ConsoleLog_PostEvent( evt );
}
//evt.Skip(); //evt.Skip();
} }
void MainEmuFrame::OnLogBoxHidden()
{
g_Conf->ConLogBox.Visible = false;
m_MenuItem_Console.Check( false );
}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void MainEmuFrame::ConnectMenus() void MainEmuFrame::ConnectMenus()
{ {
Connect( wxEVT_MOVE, wxMoveEventHandler(MainEmuFrame::OnMoveAround) ); #define ConnectMenu( id, handler ) \
Connect( id, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) )
ConnectMenu( Menu_Config_Settings, Menu_ConfigSettings_Click ); ConnectMenu( Menu_Config_Settings, Menu_ConfigSettings_Click );
ConnectMenu( Menu_RunWithoutDisc, Menu_RunWithoutDisc_Click ); ConnectMenu( Menu_RunWithoutDisc, Menu_RunWithoutDisc_Click );
@ -191,7 +217,7 @@ void MainEmuFrame::ConnectMenus()
ConnectMenu( Menu_State_SaveOther, Menu_SaveStateOther_Click ); ConnectMenu( Menu_State_SaveOther, Menu_SaveStateOther_Click );
ConnectMenu( Menu_Config_Gamefixes, Menu_Gamefixes_Click ); ConnectMenu( Menu_Config_Gamefixes, Menu_Gamefixes_Click );
ConnectMenu( Menu_Config_SpeedHacks, Menu_Speedhacks_Click ); ConnectMenu( Menu_Config_SpeedHacks,Menu_Speedhacks_Click );
ConnectMenu( Menu_Debug_Open, Menu_Debug_Open_Click ); ConnectMenu( Menu_Debug_Open, Menu_Debug_Open_Click );
@ -203,19 +229,10 @@ void MainEmuFrame::ConnectMenus()
ConnectMenu( Menu_About, Menu_ShowAboutBox ); ConnectMenu( Menu_About, Menu_ShowAboutBox );
} }
// ------------------------------------------------------------------------
void MainEmuFrame::OnLogBoxHidden()
{
g_Conf.ConLogBox.Visible = false;
m_MenuItem_Console.Check( false );
}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
MainEmuFrame::MainEmuFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): MainEmuFrame::MainEmuFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER) ), wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER) ),
m_logbox( this, L"PCSX2 Log" ),
m_statusbar( *CreateStatusBar(2, 0) ), m_statusbar( *CreateStatusBar(2, 0) ),
m_background( this, wxID_ANY, wxGetApp().GetLogoBitmap() ), m_background( this, wxID_ANY, wxGetApp().GetLogoBitmap() ),
@ -237,9 +254,6 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, int id, const wxString& title, cons
m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, Menu_Console, L"Show Console", wxEmptyString, wxITEM_CHECK ) ) m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, Menu_Console, L"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 // 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) // can be factored into the window size (which ends up being background+status+menus)
@ -279,33 +293,30 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, int id, const wxString& title, cons
wxRect screenzone( wxPoint(), wxGetDisplaySize() ); wxRect screenzone( wxPoint(), wxGetDisplaySize() );
// Use default window position if the configured windowpos is invalid (partially offscreen) // Use default window position if the configured windowpos is invalid (partially offscreen)
if( g_Conf.MainGuiPosition == wxDefaultPosition || !screenzone.Contains( wxRect( g_Conf.MainGuiPosition, GetSize() ) ) ) if( g_Conf->MainGuiPosition == wxDefaultPosition || !screenzone.Contains( wxRect( g_Conf->MainGuiPosition, GetSize() ) ) )
g_Conf.MainGuiPosition = GetPosition(); g_Conf->MainGuiPosition = GetPosition();
else else
SetPosition( g_Conf.MainGuiPosition ); SetPosition( g_Conf->MainGuiPosition );
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Sort out the console log window position (must be done after fitting the window // Sort out the console log window position (must be done after fitting the window
// sizer, to ensure correct 'docked mode' positioning). // sizer, to ensure correct 'docked mode' positioning).
g_Conf.ConLogBox.DisplaySize.Set( g_Conf->ConLogBox.DisplaySize.Set(
std::min( std::max( g_Conf.ConLogBox.DisplaySize.GetWidth(), 160 ), screenzone.GetWidth() ), std::min( std::max( g_Conf->ConLogBox.DisplaySize.GetWidth(), 160 ), screenzone.GetWidth() ),
std::min( std::max( g_Conf.ConLogBox.DisplaySize.GetHeight(), 160 ), screenzone.GetHeight() ) std::min( std::max( g_Conf->ConLogBox.DisplaySize.GetHeight(), 160 ), screenzone.GetHeight() )
); );
if( g_Conf.ConLogBox.AutoDock ) if( g_Conf->ConLogBox.AutoDock )
{ {
g_Conf.ConLogBox.DisplayPosition = GetPosition() + wxSize( GetSize().x, 0 ); g_Conf->ConLogBox.DisplayPosition = GetPosition() + wxSize( GetSize().x, 0 );
} }
else if( g_Conf.ConLogBox.DisplayPosition != wxDefaultPosition ) else if( g_Conf->ConLogBox.DisplayPosition != wxDefaultPosition )
{ {
if( !screenzone.Contains( wxRect( g_Conf.ConLogBox.DisplayPosition, wxSize( 75, 150 ) ) ) ) if( !screenzone.Contains( wxRect( g_Conf->ConLogBox.DisplayPosition, wxSize( 75, 150 ) ) ) )
g_Conf.ConLogBox.DisplayPosition = wxDefaultPosition; g_Conf->ConLogBox.DisplayPosition = wxDefaultPosition;
} }
m_logbox.SetSize( wxRect( g_Conf.ConLogBox.DisplayPosition, g_Conf.ConLogBox.DisplaySize ) );
m_logbox.Show( g_Conf.ConLogBox.Visible );
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
m_menuRun.Append(Menu_BootIso, _("Run ISO"), MakeIsoMenu(), _("Performs a complete bootup sequence (recommended for best compat)")); m_menuRun.Append(Menu_BootIso, _("Run ISO"), MakeIsoMenu(), _("Performs a complete bootup sequence (recommended for best compat)"));
@ -376,11 +387,11 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, int id, const wxString& title, cons
m_menuDebug.Append(Menu_Debug_MemoryDump, _T("Memory Dump..."), wxEmptyString, wxITEM_NORMAL); m_menuDebug.Append(Menu_Debug_MemoryDump, _T("Memory Dump..."), wxEmptyString, wxITEM_NORMAL);
m_menuDebug.Append(Menu_Debug_Logging, _T("Logging..."), wxEmptyString, wxITEM_NORMAL); m_menuDebug.Append(Menu_Debug_Logging, _T("Logging..."), wxEmptyString, wxITEM_NORMAL);
m_MenuItem_Console.Check( g_Conf->ConLogBox.Visible );
ConnectMenus(); ConnectMenus();
Connect( wxEVT_MOVE, wxMoveEventHandler (MainEmuFrame::OnMoveAround) );
m_MenuItem_Console.Check( g_Conf.ConLogBox.Visible ); Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler(MainEmuFrame::OnCloseWindow) );
//g_RecentIsoList->AddFileToHistory( L"fail.iso" );
} }
void MainEmuFrame::Menu_ConfigSettings_Click(wxCommandEvent &event) void MainEmuFrame::Menu_ConfigSettings_Click(wxCommandEvent &event)
@ -451,15 +462,19 @@ void MainEmuFrame::Menu_Debug_MemoryDump_Click(wxCommandEvent &event)
void MainEmuFrame::Menu_Debug_Logging_Click(wxCommandEvent &event) void MainEmuFrame::Menu_Debug_Logging_Click(wxCommandEvent &event)
{ {
LogOptionsDialog( this, wxID_ANY ).ShowModal(); //LogOptionsDialog( this, wxID_ANY ).ShowModal();
} }
void MainEmuFrame::Menu_ShowConsole(wxCommandEvent &event) void MainEmuFrame::Menu_ShowConsole(wxCommandEvent &event)
{ {
m_logbox.Show( g_Conf.ConLogBox.Visible = event.IsChecked() ); // Use messages to relay open/close commands (thread-safe)
g_Conf->ConLogBox.Visible = event.IsChecked();
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, g_Conf->ConLogBox.Visible ? wxID_OPEN : wxID_CLOSE );
wxGetApp().ProgramLog_PostEvent( evt );
} }
void MainEmuFrame::Menu_ShowAboutBox(wxCommandEvent &event) void MainEmuFrame::Menu_ShowAboutBox(wxCommandEvent &event)
{ {
AboutBoxDialog( this, wxID_ANY ).ShowModal(); //AboutBoxDialog( this, wxID_ANY ).ShowModal();
} }

View File

@ -130,7 +130,6 @@ protected:
void ConnectMenus(); void ConnectMenus();
protected: protected:
ConsoleLogFrame m_logbox;
wxStatusBar& m_statusbar; wxStatusBar& m_statusbar;
wxStaticBitmap m_background; wxStaticBitmap m_background;
@ -154,6 +153,7 @@ protected:
// Menu Options for the Main Window! :D // Menu Options for the Main Window! :D
protected: protected:
void OnCloseWindow(wxCloseEvent& evt);
void OnMoveAround( wxMoveEvent& evt ); void OnMoveAround( wxMoveEvent& evt );
void Menu_ConfigSettings_Click(wxCommandEvent &event); void Menu_ConfigSettings_Click(wxCommandEvent &event);

View File

@ -76,23 +76,23 @@ void Panels::PathsPanel::MyBasePanel::AddDirPicker( wxBoxSizer& sizer, const wxD
Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent, int id ) : Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent, int id ) :
MyBasePanel( parent, id ) MyBasePanel( parent, id )
{ {
AddDirPicker( s_main, g_Conf.Folders.Bios, PathDefs::GetBios, AddDirPicker( s_main, g_Conf->Folders.Bios, PathDefs::GetBios,
_("Bios:"), _("Select folder with PS2 Bios"), Msg_Tooltips_Bios ); _("Bios:"), _("Select folder with PS2 Bios"), Msg_Tooltips_Bios );
s_main.AddSpacer( BetweenFolderSpace ); s_main.AddSpacer( BetweenFolderSpace );
AddDirPicker( s_main, g_Conf.Folders.Savestates, PathDefs::GetSavestates, AddDirPicker( s_main, g_Conf->Folders.Savestates, PathDefs::GetSavestates,
_("Savestates:"), _("Select folder for Savestates"), Msg_Tooltips_Savestates ); _("Savestates:"), _("Select folder for Savestates"), Msg_Tooltips_Savestates );
s_main.AddSpacer( BetweenFolderSpace ); s_main.AddSpacer( BetweenFolderSpace );
AddDirPicker( s_main, g_Conf.Folders.Snapshots, PathDefs::GetSnapshots, AddDirPicker( s_main, g_Conf->Folders.Snapshots, PathDefs::GetSnapshots,
_("Snapshots:"), _("Select a folder for Snapshots"), Msg_Tooltips_Snapshots ); _("Snapshots:"), _("Select a folder for Snapshots"), Msg_Tooltips_Snapshots );
s_main.AddSpacer( BetweenFolderSpace ); s_main.AddSpacer( BetweenFolderSpace );
AddDirPicker( s_main, g_Conf.Folders.Logs, PathDefs::GetLogs, AddDirPicker( s_main, g_Conf->Folders.Logs, PathDefs::GetLogs,
_("Logs/Dumps:" ), _("Select a folder for logs/dumps"), Msg_Tooltips_Logs ); _("Logs/Dumps:" ), _("Select a folder for logs/dumps"), Msg_Tooltips_Logs );
s_main.AddSpacer( BetweenFolderSpace ); s_main.AddSpacer( BetweenFolderSpace );
AddDirPicker( s_main, g_Conf.Folders.MemoryCards, PathDefs::GetMemoryCards, AddDirPicker( s_main, g_Conf->Folders.MemoryCards, PathDefs::GetMemoryCards,
_("Memorycards:"), _("Select a default Memorycards folder"), Msg_Tooltips_Memorycards ); _("Memorycards:"), _("Select a default Memorycards folder"), Msg_Tooltips_Memorycards );
s_main.AddSpacer( 5 ); s_main.AddSpacer( 5 );
@ -107,11 +107,11 @@ Panels::PathsPanel::AdvancedPanel::AdvancedPanel( wxWindow& parent, int id ) :
wxStaticBoxSizer& advanced = *new wxStaticBoxSizer( wxVERTICAL, this, _("Advanced") ); wxStaticBoxSizer& advanced = *new wxStaticBoxSizer( wxVERTICAL, this, _("Advanced") );
AddStaticText( advanced, pxE(Msg_Dialog_AdvancedPaths), 420, wxALIGN_CENTRE ); AddStaticText( advanced, pxE(Msg_Dialog_AdvancedPaths), 420, wxALIGN_CENTRE );
AddDirPicker( advanced, g_Conf.Folders.Plugins, PathDefs::GetPlugins, AddDirPicker( advanced, g_Conf->Folders.Plugins, PathDefs::GetPlugins,
_("Plugins:"), _("Select folder for PCSX2 plugins"), Msg_Tooltips_PluginsPath ); _("Plugins:"), _("Select folder for PCSX2 plugins"), Msg_Tooltips_PluginsPath );
advanced.AddSpacer( BetweenFolderSpace ); advanced.AddSpacer( BetweenFolderSpace );
AddDirPicker( advanced, g_Conf.Folders.Settings, PathDefs::GetSettings, AddDirPicker( advanced, g_Conf->Folders.Settings, PathDefs::GetSettings,
_("Settings:"), _("Select a folder for PCSX2 settings/inis"), Msg_Tooltips_SettingsPath ); _("Settings:"), _("Select a folder for PCSX2 settings/inis"), Msg_Tooltips_SettingsPath );
wxStaticBoxSizer& s_diag = *new wxStaticBoxSizer( wxVERTICAL, this, _("Default folder mode") ); wxStaticBoxSizer& s_diag = *new wxStaticBoxSizer( wxVERTICAL, this, _("Default folder mode") );

View File

@ -212,7 +212,7 @@ Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow& parent ) :
BaseApplicableConfigPanel( &parent ) BaseApplicableConfigPanel( &parent )
, m_FileList() , m_FileList()
, m_StatusPanel( *new StatusPanel( this, , m_StatusPanel( *new StatusPanel( this,
wxDir::GetAllFiles( g_Conf.Folders.Plugins.ToString(), &m_FileList, wxsFormat( L"*%s", wxDynamicLibrary::GetDllExt()), wxDIR_FILES ) wxDir::GetAllFiles( g_Conf->Folders.Plugins.ToString(), &m_FileList, wxsFormat( L"*%s", wxDynamicLibrary::GetDllExt()), wxDIR_FILES )
) ) ) )
, m_ComboBoxes( *new ComboBoxPanel( this ) ) , m_ComboBoxes( *new ComboBoxPanel( this ) )
, m_Uninitialized( true ) , m_Uninitialized( true )
@ -259,7 +259,7 @@ bool Panels::PluginSelectorPanel::Apply( AppConfig& conf )
if( sel == wxNOT_FOUND ) continue; if( sel == wxNOT_FOUND ) continue;
wxFileName relative( m_FileList[(int)m_ComboBoxes.Get(i).GetClientData(sel)] ); wxFileName relative( m_FileList[(int)m_ComboBoxes.Get(i).GetClientData(sel)] );
relative.MakeRelativeTo( g_Conf.Folders.Plugins.ToString() ); relative.MakeRelativeTo( g_Conf->Folders.Plugins.ToString() );
conf.BaseFilenames.Plugins[tbl_PluginInfo[i].id] = relative.GetFullPath(); conf.BaseFilenames.Plugins[tbl_PluginInfo[i].id] = relative.GetFullPath();
} }
@ -353,10 +353,10 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
); );
wxFileName left( m_FileList[evtidx] ); wxFileName left( m_FileList[evtidx] );
wxFileName right( g_Conf.FullpathTo(tbl_PluginInfo[i].id) ); wxFileName right( g_Conf->FullpathTo(tbl_PluginInfo[i].id) );
left.MakeRelativeTo( g_Conf.Folders.Plugins.ToString() ); left.MakeRelativeTo( g_Conf->Folders.Plugins.ToString() );
right.MakeRelativeTo( g_Conf.Folders.Plugins.ToString() ); right.MakeRelativeTo( g_Conf->Folders.Plugins.ToString() );
if( left == right ) if( left == right )
m_ComboBoxes.Get(i).SetSelection( sel ); m_ComboBoxes.Get(i).SetSelection( sel );

View File

@ -178,7 +178,7 @@ const wxChar* __fastcall pxExpandMsg( ExpandedMsgEnum key )
{ {
const HashedExpansionPair& data( m_EnglishExpansions[key] ); const HashedExpansionPair& data( m_EnglishExpansions[key] );
int curlangid = wxLocale::GetLanguageInfo( g_Conf.LanguageId )->Language; int curlangid = wxLocale::GetLanguageInfo( g_Conf->LanguageId )->Language;
if( IsEnglish( curlangid ) ) if( IsEnglish( curlangid ) )
return data.Expanded; return data.Expanded;

View File

@ -28,11 +28,12 @@
IMPLEMENT_APP(Pcsx2App) IMPLEMENT_APP(Pcsx2App)
AppConfig g_Conf; AppConfig* g_Conf = NULL;
wxFileHistory* g_RecentIsoList = NULL; wxFileHistory* g_RecentIsoList = NULL;
Pcsx2App::Pcsx2App() : Pcsx2App::Pcsx2App() :
m_ConsoleFrame( NULL ) m_ProgramLogBox( NULL )
, m_Ps2ConLogBox( NULL )
, m_ConfigImages( 32, 32 ) , m_ConfigImages( 32, 32 )
, m_ConfigImagesAreLoaded( false ) , m_ConfigImagesAreLoaded( false )
, m_ToolbarImages( NULL ) , m_ToolbarImages( NULL )
@ -62,7 +63,7 @@ void Pcsx2App::ReadUserModeSettings()
// Ensure proper scoping (IniLoader gets closed prior to delete) // Ensure proper scoping (IniLoader gets closed prior to delete)
{ {
IniLoader loader( *conf_usermode ); IniLoader loader( *conf_usermode );
g_Conf.LoadSaveUserMode( loader ); g_Conf->LoadSaveUserMode( loader );
} }
delete conf_usermode; delete conf_usermode;
@ -74,7 +75,7 @@ void Pcsx2App::ReadUserModeSettings()
// //
bool Pcsx2App::TryOpenConfigCwd() bool Pcsx2App::TryOpenConfigCwd()
{ {
wxDirName inipath_cwd( (wxDirName)wxGetCwd() + PathDefs::Settings ); wxDirName inipath_cwd( (wxDirName)wxGetCwd() + PathDefs::Base::Settings() );
if( !inipath_cwd.IsReadable() ) return false; if( !inipath_cwd.IsReadable() ) return false;
wxString inifile_cwd( Path::Combine( inipath_cwd, FilenameDefs::GetConfig() ) ); wxString inifile_cwd( Path::Combine( inipath_cwd, FilenameDefs::GetConfig() ) );
@ -128,9 +129,10 @@ bool Pcsx2App::OnCmdLineParsed(wxCmdLineParser& parser)
bool Pcsx2App::OnInit() bool Pcsx2App::OnInit()
{ {
wxInitAllImageHandlers(); wxInitAllImageHandlers();
wxApp::OnInit(); wxApp::OnInit();
g_Conf = new AppConfig();
i18n_InitPlainEnglish(); i18n_InitPlainEnglish();
wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() ); wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() );
@ -156,20 +158,26 @@ bool Pcsx2App::OnInit()
wxConfigBase::Get()->SetRecordDefaults(); wxConfigBase::Get()->SetRecordDefaults();
} }
g_Conf.Load(); g_Conf->Load();
g_Conf.Apply(); g_Conf->Apply();
m_ProgramLogBox = new ConsoleLogFrame( NULL, L"PCSX2 Program Log" );
m_Ps2ConLogBox = m_ProgramLogBox;
//m_Ps2ConLogBox = new ConsoleLogFrame( NULL, L"PS2 Console Log" );
m_MainFrame = new MainEmuFrame( NULL, wxID_ANY, wxEmptyString ); m_MainFrame = new MainEmuFrame( NULL, wxID_ANY, wxEmptyString );
SetTopWindow( m_MainFrame ); SetTopWindow( m_MainFrame );
SetExitOnFrameDelete( true );
m_MainFrame->Show(); m_MainFrame->Show();
// Check to see if the user needs to perform initial setup: // Check to see if the user needs to perform initial setup:
/*bool needsConfigured = false; /*bool needsConfigured = false;
const wxString pc( L"Please Configure" ); const wxString pc( L"Please Configure" );
for( int pidx=0; pidx<Plugin_Count; ++pidx ) for( int pidx=0; pidx<Plugin_Count; ++pidx )
{ {
if( g_Conf.BaseFilenames[(PluginsEnum_t)pidx] == pc ) if( g_Conf->BaseFilenames[(PluginsEnum_t)pidx] == pc )
{ {
needsConfigured = true; needsConfigured = true;
break; break;
@ -186,7 +194,7 @@ bool Pcsx2App::OnInit()
int Pcsx2App::OnExit() int Pcsx2App::OnExit()
{ {
g_Conf.Save(); g_Conf->Save();
return wxApp::OnExit(); return wxApp::OnExit();
} }
@ -230,11 +238,11 @@ const wxBitmap& Pcsx2App::GetLogoBitmap()
return *m_Bitmap_Logo; return *m_Bitmap_Logo;
wxFileName mess; wxFileName mess;
bool useTheme = (g_Conf.DeskTheme != L"default"); bool useTheme = (g_Conf->DeskTheme != L"default");
if( useTheme ) if( useTheme )
{ {
wxDirName theme( PathDefs::GetThemes() + g_Conf.DeskTheme ); wxDirName theme( PathDefs::GetThemes() + g_Conf->DeskTheme );
wxFileName zipped( theme.GetFilename() ); wxFileName zipped( theme.GetFilename() );
zipped.SetExt( L"zip" ); zipped.SetExt( L"zip" );
@ -272,11 +280,11 @@ wxImageList& Pcsx2App::GetImgList_Config()
if( !m_ConfigImagesAreLoaded ) if( !m_ConfigImagesAreLoaded )
{ {
wxFileName mess; wxFileName mess;
bool useTheme = (g_Conf.DeskTheme != L"default"); bool useTheme = (g_Conf->DeskTheme != L"default");
if( useTheme ) if( useTheme )
{ {
wxDirName theme( PathDefs::GetThemes() + g_Conf.DeskTheme ); wxDirName theme( PathDefs::GetThemes() + g_Conf->DeskTheme );
mess = theme.ToString(); mess = theme.ToString();
} }
@ -288,7 +296,7 @@ wxImageList& Pcsx2App::GetImgList_Config()
#undef FancyLoadMacro #undef FancyLoadMacro
#define FancyLoadMacro( name ) \ #define FancyLoadMacro( name ) \
{ \ { \
EmbeddedImage<png_ConfigIcon_##name> temp( g_Conf.Listbook_ImageSize, g_Conf.Listbook_ImageSize ); \ EmbeddedImage<png_ConfigIcon_##name> temp( g_Conf->Listbook_ImageSize, g_Conf->Listbook_ImageSize ); \
m_ImageId.Config.name = m_ConfigImages.Add( LoadImageAny( \ m_ImageId.Config.name = m_ConfigImages.Add( LoadImageAny( \
img, useTheme, mess, L"ConfigIcon_" wxT(#name), temp ) \ img, useTheme, mess, L"ConfigIcon_" wxT(#name), temp ) \
); \ ); \
@ -309,14 +317,14 @@ wxImageList& Pcsx2App::GetImgList_Toolbars()
{ {
if( m_ToolbarImages == NULL ) if( m_ToolbarImages == NULL )
{ {
const int imgSize = g_Conf.Toolbar_ImageSize ? 64 : 32; const int imgSize = g_Conf->Toolbar_ImageSize ? 64 : 32;
m_ToolbarImages = new wxImageList( imgSize, imgSize ); m_ToolbarImages = new wxImageList( imgSize, imgSize );
wxFileName mess; wxFileName mess;
bool useTheme = (g_Conf.DeskTheme != L"default"); bool useTheme = (g_Conf->DeskTheme != L"default");
if( useTheme ) if( useTheme )
{ {
wxDirName theme( PathDefs::GetThemes() + g_Conf.DeskTheme ); wxDirName theme( PathDefs::GetThemes() + g_Conf->DeskTheme );
mess = theme.ToString(); mess = theme.ToString();
} }

View File

@ -20,7 +20,6 @@
<Configurations> <Configurations>
<Configuration <Configuration
Name="Debug|Win32" Name="Debug|Win32"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
InheritedPropertySheets=".\vsprops\common.vsprops;..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\common\vsprops\3rdpartyDeps.vsprops;..\..\..\common\vsprops\pthreads.vsprops;.\vsprops\devbuild.vsprops;..\..\..\common\vsprops\CodeGen_Debug.vsprops;..\..\..\common\vsprops\IncrementalLinking.vsprops" InheritedPropertySheets=".\vsprops\common.vsprops;..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\common\vsprops\3rdpartyDeps.vsprops;..\..\..\common\vsprops\pthreads.vsprops;.\vsprops\devbuild.vsprops;..\..\..\common\vsprops\CodeGen_Debug.vsprops;..\..\..\common\vsprops\IncrementalLinking.vsprops"
UseOfMFC="0" UseOfMFC="0"
@ -99,7 +98,6 @@
</Configuration> </Configuration>
<Configuration <Configuration
Name="Devel|Win32" Name="Devel|Win32"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
InheritedPropertySheets=".\vsprops\common.vsprops;..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\common\vsprops\3rdpartyDeps.vsprops;.\vsprops\devbuild.vsprops;..\..\..\common\vsprops\pthreads.vsprops;..\..\..\common\vsprops\CodeGen_Devel.vsprops;..\..\..\common\vsprops\IncrementalLinking.vsprops" InheritedPropertySheets=".\vsprops\common.vsprops;..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\common\vsprops\3rdpartyDeps.vsprops;.\vsprops\devbuild.vsprops;..\..\..\common\vsprops\pthreads.vsprops;..\..\..\common\vsprops\CodeGen_Devel.vsprops;..\..\..\common\vsprops\IncrementalLinking.vsprops"
UseOfMFC="0" UseOfMFC="0"
@ -180,7 +178,6 @@
</Configuration> </Configuration>
<Configuration <Configuration
Name="Release|Win32" Name="Release|Win32"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
InheritedPropertySheets=".\vsprops\common.vsprops;..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\common\vsprops\3rdpartyDeps.vsprops;..\..\..\common\vsprops\pthreads.vsprops;..\..\..\common\vsprops\CodeGen_Release.vsprops" InheritedPropertySheets=".\vsprops\common.vsprops;..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\common\vsprops\3rdpartyDeps.vsprops;..\..\..\common\vsprops\pthreads.vsprops;..\..\..\common\vsprops\CodeGen_Release.vsprops"
UseOfMFC="0" UseOfMFC="0"

View File

@ -153,9 +153,9 @@ static void iIopDumpBlock( int startpc, u8 * ptr )
int numused, count; int numused, count;
Console::WriteLn( "dump1 %x:%x, %x", params startpc, psxpc, psxRegs.cycle ); Console::WriteLn( "dump1 %x:%x, %x", params startpc, psxpc, psxRegs.cycle );
g_Conf.Folders.Logs.Mkdir(); g_Conf->Folders.Logs.Mkdir();
wxString filename( Path::Combine( g_Conf.Folders.Logs, wxsFormat( L"psxdump%.8X.txt", startpc ) ) ); wxString filename( Path::Combine( g_Conf->Folders.Logs, wxsFormat( L"psxdump%.8X.txt", startpc ) ) );
AsciiFile f( filename, wxFile::write ); AsciiFile f( filename, wxFile::write );
/*for ( i = startpc; i < s_nEndBlock; i += 4 ) { /*for ( i = startpc; i < s_nEndBlock; i += 4 ) {

View File

@ -568,9 +568,9 @@ void SuperVUDumpBlock(list<VuBaseBlock*>& blocks, int vuindex)
u32 *mem; u32 *mem;
u32 i; u32 i;
g_Conf.Folders.Logs.Mkdir(); g_Conf->Folders.Logs.Mkdir();
AsciiFile eff( AsciiFile eff(
Path::Combine( g_Conf.Folders.Logs, wxsFormat(L"svu%cdump%.4X.txt", s_vu?L'0':L'1', s_pFnHeader->startpc) ), Path::Combine( g_Conf->Folders.Logs, wxsFormat(L"svu%cdump%.4X.txt", s_vu?L'0':L'1', s_pFnHeader->startpc) ),
wxFile::write wxFile::write
); );

View File

@ -92,8 +92,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Include", "Include", "{0FAD
common\include\PS2Etypes.h = common\include\PS2Etypes.h common\include\PS2Etypes.h = common\include\PS2Etypes.h
EndProjectSection EndProjectSection
EndProject EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "setup", "setup\setup.vdproj", "{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxBase28", "3rdparty\wxWidgets\build\msw\wx_base_2008.vcproj", "{48AD7E0A-25B1-4974-A1E3-03F8C438D34F}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxBase28", "3rdparty\wxWidgets\build\msw\wx_base_2008.vcproj", "{48AD7E0A-25B1-4974-A1E3-03F8C438D34F}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{C34487AF-228A-4D11-8E50-27803DF76873} = {C34487AF-228A-4D11-8E50-27803DF76873} {C34487AF-228A-4D11-8E50-27803DF76873} = {C34487AF-228A-4D11-8E50-27803DF76873}
@ -479,18 +477,6 @@ Global
{CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release|Win32.ActiveCfg = Release|Win32 {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release|Win32.ActiveCfg = Release|Win32
{CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release|Win32.Build.0 = Release|Win32 {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release|Win32.Build.0 = Release|Win32
{CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release|x64.ActiveCfg = Release|Win32 {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release|x64.ActiveCfg = Release|Win32
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Debug|Win32.ActiveCfg = Release
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Debug|x64.ActiveCfg = Release
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Devel|Win32.ActiveCfg = Release
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Devel|x64.ActiveCfg = Release
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Release SSE2|Win32.ActiveCfg = Release
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Release SSE2|x64.ActiveCfg = Release
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Release SSE4|Win32.ActiveCfg = Release
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Release SSE4|x64.ActiveCfg = Release
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Release SSSE3|Win32.ActiveCfg = Release
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Release SSSE3|x64.ActiveCfg = Release
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Release|Win32.ActiveCfg = Release
{14259DC9-2A12-4B05-A7D7-23C1A9FFEA03}.Release|x64.ActiveCfg = Release
{48AD7E0A-25B1-4974-A1E3-03F8C438D34F}.Debug|Win32.ActiveCfg = Debug|Win32 {48AD7E0A-25B1-4974-A1E3-03F8C438D34F}.Debug|Win32.ActiveCfg = Debug|Win32
{48AD7E0A-25B1-4974-A1E3-03F8C438D34F}.Debug|Win32.Build.0 = Debug|Win32 {48AD7E0A-25B1-4974-A1E3-03F8C438D34F}.Debug|Win32.Build.0 = Debug|Win32
{48AD7E0A-25B1-4974-A1E3-03F8C438D34F}.Debug|x64.ActiveCfg = Debug|Win32 {48AD7E0A-25B1-4974-A1E3-03F8C438D34F}.Debug|x64.ActiveCfg = Debug|Win32

View File

@ -85,7 +85,6 @@
</Configuration> </Configuration>
<Configuration <Configuration
Name="Release|Win32" Name="Release|Win32"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2" ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\common\vsprops\plugin_svnroot.vsprops;..\..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\..\common\vsprops\3rdpartyDeps.vsprops;..\..\..\..\common\vsprops\CodeGen_Release.vsprops" InheritedPropertySheets="..\..\..\..\common\vsprops\plugin_svnroot.vsprops;..\..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\..\common\vsprops\3rdpartyDeps.vsprops;..\..\..\..\common\vsprops\CodeGen_Release.vsprops"
UseOfMFC="0" UseOfMFC="0"

View File

@ -402,6 +402,8 @@
</Configuration> </Configuration>
<Configuration <Configuration
Name="Debug|Win32" Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
> >
<Tool <Tool

View File

@ -295,7 +295,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="" AdditionalIncludeDirectories=""
PreprocessorDefinitions="SPU2X_DEVBUILD;FLOAT_SAMPLES;DEBUG_FAST;_USRDLL" PreprocessorDefinitions="wxUSE_GUI=0;SPU2X_DEVBUILD;FLOAT_SAMPLES;DEBUG_FAST;_USRDLL"
ExceptionHandling="2" ExceptionHandling="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
/> />

View File

@ -16,7 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "analog.h" #include "analog.h"
PADAnalog g_lanalog[NUM_OF_PADS], g_ranalog[NUM_OF_PADS]; PADAnalog g_lanalog[NUM_OF_PADS], g_ranalog[NUM_OF_PADS];
namespace Analog namespace Analog

View File

@ -16,10 +16,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#define NUM_OF_PADS 2 #pragma once
#include "zeropad.h" #define NUM_OF_PADS 2
namespace Analog
#include "zeropad.h"
namespace Analog
{ {
extern void Init(); extern void Init();
extern u8 Pad(int padvalue, u8 i); extern u8 Pad(int padvalue, u8 i);

View File

@ -19,6 +19,9 @@
#ifndef __PAD_H__ #ifndef __PAD_H__
#define __PAD_H__ #define __PAD_H__
#define PADdefs
#include "PS2Edefs.h"
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
@ -40,9 +43,6 @@
#include <pthread.h> #include <pthread.h>
using namespace std; using namespace std;
#define PADdefs
#include "PS2Edefs.h"
#ifdef __LINUX__ #ifdef __LINUX__
#include "joystick.h" #include "joystick.h"
#endif #endif