mirror of https://github.com/PCSX2/pcsx2.git
UI:
* Fix for Issue 780 (missing uppercase iso extensions in the Open File Dialog). * A few minor threading fixes for the GameDB loader to avoid crashes/hangs when closing the emulator immediately as it opens. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3350 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
25887c62ee
commit
5ad95b28eb
|
@ -454,4 +454,4 @@ public:
|
||||||
|
|
||||||
// For lack of a better place for now (they depend on SafeList so they can't go in StringUtil)
|
// For lack of a better place for now (they depend on SafeList so they can't go in StringUtil)
|
||||||
extern void SplitString( SafeList<wxString>& dest, const wxString& src, const wxString& delims );
|
extern void SplitString( SafeList<wxString>& dest, const wxString& src, const wxString& delims );
|
||||||
extern void JoinString( wxString& dest, const SafeList<wxString>& src, const wxString& separator );
|
extern wxString JoinString( const SafeList<wxString>& src, const wxString& separator );
|
||||||
|
|
|
@ -69,7 +69,8 @@ extern wxString fromAscii( const char* src );
|
||||||
extern const wxRect wxDefaultRect;
|
extern const wxRect wxDefaultRect;
|
||||||
|
|
||||||
extern void SplitString( wxArrayString& dest, const wxString& src, const wxString& delims, wxStringTokenizerMode mode = wxTOKEN_RET_EMPTY_ALL );
|
extern void SplitString( wxArrayString& dest, const wxString& src, const wxString& delims, wxStringTokenizerMode mode = wxTOKEN_RET_EMPTY_ALL );
|
||||||
extern void JoinString( wxString& dest, const wxArrayString& src, const wxString& separator );
|
extern wxString JoinString( const wxArrayString& src, const wxString& separator );
|
||||||
|
extern wxString JoinString( const wxChar** src, const wxString& separator );
|
||||||
|
|
||||||
extern wxString ToString( const wxPoint& src, const wxString& separator=L"," );
|
extern wxString ToString( const wxPoint& src, const wxString& separator=L"," );
|
||||||
extern wxString ToString( const wxSize& src, const wxString& separator=L"," );
|
extern wxString ToString( const wxSize& src, const wxString& separator=L"," );
|
||||||
|
|
|
@ -61,24 +61,46 @@ void SplitString( wxArrayString& dest, const wxString& src, const wxString& deli
|
||||||
//
|
//
|
||||||
// Note: wxWidgets 2.9 / 3.0 has a wxJoin function, but we're using 2.8 so I had to make
|
// Note: wxWidgets 2.9 / 3.0 has a wxJoin function, but we're using 2.8 so I had to make
|
||||||
// my own.
|
// my own.
|
||||||
void JoinString( wxString& dest, const SafeList<wxString>& src, const wxString& separator )
|
wxString JoinString( const SafeList<wxString>& src, const wxString& separator )
|
||||||
{
|
{
|
||||||
|
wxString dest;
|
||||||
for( int i=0, len=src.GetLength(); i<len; ++i )
|
for( int i=0, len=src.GetLength(); i<len; ++i )
|
||||||
{
|
{
|
||||||
if( i != 0 )
|
if( src[i].IsEmpty() ) continue;
|
||||||
|
if( !dest.IsEmpty() )
|
||||||
dest += separator;
|
dest += separator;
|
||||||
dest += src[i];
|
dest += src[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JoinString( wxString& dest, const wxArrayString& src, const wxString& separator )
|
wxString JoinString( const wxArrayString& src, const wxString& separator )
|
||||||
{
|
{
|
||||||
|
wxString dest;
|
||||||
for( int i=0, len=src.GetCount(); i<len; ++i )
|
for( int i=0, len=src.GetCount(); i<len; ++i )
|
||||||
{
|
{
|
||||||
if( i != 0 )
|
if( src[i].IsEmpty() ) continue;
|
||||||
|
if( !dest.IsEmpty() )
|
||||||
dest += separator;
|
dest += separator;
|
||||||
dest += src[i];
|
dest += src[i];
|
||||||
}
|
}
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString JoinString( const wxChar** src, const wxString& separator )
|
||||||
|
{
|
||||||
|
wxString dest;
|
||||||
|
while( *src != NULL )
|
||||||
|
{
|
||||||
|
if( *src[0] == 0 ) continue;
|
||||||
|
|
||||||
|
if( !dest.IsEmpty() )
|
||||||
|
dest += separator;
|
||||||
|
dest += *src;
|
||||||
|
++src;
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempts to parse and return a value for the given template type, and throws a ParseError
|
// Attempts to parse and return a value for the given template type, and throws a ParseError
|
||||||
|
|
|
@ -154,9 +154,11 @@ void SysLogMachineCaps()
|
||||||
if( x86caps.has3DNOWInstructionExtensionsExt ) features[1].Add( L"3DNOW2" );
|
if( x86caps.has3DNOWInstructionExtensionsExt ) features[1].Add( L"3DNOW2" );
|
||||||
if( x86caps.hasStreamingSIMD4ExtensionsA ) features[1].Add( L"SSE4a " );
|
if( x86caps.hasStreamingSIMD4ExtensionsA ) features[1].Add( L"SSE4a " );
|
||||||
|
|
||||||
wxString result[2];
|
const wxString result[2] =
|
||||||
JoinString( result[0], features[0], L".. " );
|
{
|
||||||
JoinString( result[1], features[1], L".. " );
|
JoinString( features[0], L".. " ),
|
||||||
|
JoinString( features[1], L".. " )
|
||||||
|
};
|
||||||
|
|
||||||
Console.WriteLn( Color_StrongBlack, L"x86 Features Detected:" );
|
Console.WriteLn( Color_StrongBlack, L"x86 Features Detected:" );
|
||||||
Console.Indent().WriteLn( result[0] + (result[1].IsEmpty() ? L"" : (L"\n" + result[1])) );
|
Console.Indent().WriteLn( result[0] + (result[1].IsEmpty() ? L"" : (L"\n" + result[1])) );
|
||||||
|
|
|
@ -448,7 +448,10 @@ protected:
|
||||||
int m_PendingSaves;
|
int m_PendingSaves;
|
||||||
bool m_ScheduledTermination;
|
bool m_ScheduledTermination;
|
||||||
bool m_UseGUI;
|
bool m_UseGUI;
|
||||||
|
|
||||||
|
Threading::Mutex m_mtx_Resources;
|
||||||
|
Threading::Mutex m_mtx_LoadingGameDB;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FramerateManager FpsManager;
|
FramerateManager FpsManager;
|
||||||
ScopedPtr<CommandDictionary> GlobalCommands;
|
ScopedPtr<CommandDictionary> GlobalCommands;
|
||||||
|
@ -466,9 +469,6 @@ protected:
|
||||||
ScopedPtr<RecentIsoList> m_RecentIsoList;
|
ScopedPtr<RecentIsoList> m_RecentIsoList;
|
||||||
ScopedPtr<pxAppResources> m_Resources;
|
ScopedPtr<pxAppResources> m_Resources;
|
||||||
|
|
||||||
Threading::Mutex m_mtx_Resources;
|
|
||||||
Threading::Mutex m_mtx_LoadingGameDB;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Executor Thread for complex VM/System tasks. This thread is used to execute such tasks
|
// Executor Thread for complex VM/System tasks. This thread is used to execute such tasks
|
||||||
// in parallel to the main message pump, to allow the main pump to run without fear of
|
// in parallel to the main message pump, to allow the main pump to run without fear of
|
||||||
|
|
|
@ -129,6 +129,7 @@ void DBLoaderHelper::ReadGames()
|
||||||
}
|
}
|
||||||
|
|
||||||
while(!m_reader.Eof()) { // Fill game data, find new game, repeat...
|
while(!m_reader.Eof()) { // Fill game data, find new game, repeat...
|
||||||
|
pthread_testcancel();
|
||||||
pxReadLine(m_reader, m_dest, m_intermediate);
|
pxReadLine(m_reader, m_dest, m_intermediate);
|
||||||
m_dest.Trim(true).Trim(false);
|
m_dest.Trim(true).Trim(false);
|
||||||
if( m_dest.IsEmpty() ) continue;
|
if( m_dest.IsEmpty() ) continue;
|
||||||
|
|
|
@ -470,9 +470,10 @@ typedef void (wxEvtHandler::*pxInvokeAppMethodEventFunction)(Pcsx2AppMethodEvent
|
||||||
typedef void (wxEvtHandler::*pxStuckThreadEventHandler)(pxMessageBoxEvent&);
|
typedef void (wxEvtHandler::*pxStuckThreadEventHandler)(pxMessageBoxEvent&);
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// CompressThread_gzip
|
// GameDatabaseLoaderThread
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
class GameDatabaseLoaderThread : public pxThread
|
class GameDatabaseLoaderThread : public pxThread
|
||||||
|
, EventListener_AppStatus
|
||||||
{
|
{
|
||||||
typedef pxThread _parent;
|
typedef pxThread _parent;
|
||||||
|
|
||||||
|
@ -480,7 +481,11 @@ protected:
|
||||||
gzFile m_gzfp;
|
gzFile m_gzfp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GameDatabaseLoaderThread() : pxThread( L"GameDatabaseLoader" ) {}
|
GameDatabaseLoaderThread()
|
||||||
|
: pxThread( L"GameDatabaseLoader" )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~GameDatabaseLoaderThread() throw()
|
virtual ~GameDatabaseLoaderThread() throw()
|
||||||
{
|
{
|
||||||
_parent::Cancel();
|
_parent::Cancel();
|
||||||
|
@ -489,13 +494,20 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void ExecuteTaskInThread()
|
void ExecuteTaskInThread()
|
||||||
{
|
{
|
||||||
|
Sleep(2);
|
||||||
wxGetApp().GetGameDatabase();
|
wxGetApp().GetGameDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnCleanupInThread()
|
void OnCleanupInThread()
|
||||||
{
|
{
|
||||||
|
_parent::OnCleanupInThread();
|
||||||
wxGetApp().DeleteThread(this);
|
wxGetApp().DeleteThread(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppStatusEvent_OnExit()
|
||||||
|
{
|
||||||
|
Block();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool Pcsx2App::OnInit()
|
bool Pcsx2App::OnInit()
|
||||||
|
@ -640,8 +652,8 @@ void Pcsx2App::PrepForExit()
|
||||||
if( m_ScheduledTermination ) return;
|
if( m_ScheduledTermination ) return;
|
||||||
m_ScheduledTermination = true;
|
m_ScheduledTermination = true;
|
||||||
|
|
||||||
SysExecutorThread.ShutdownQueue();
|
|
||||||
DispatchEvent( AppStatus_Exiting );
|
DispatchEvent( AppStatus_Exiting );
|
||||||
|
SysExecutorThread.ShutdownQueue();
|
||||||
|
|
||||||
m_timer_Termination->Start( 500 );
|
m_timer_Termination->Start( 500 );
|
||||||
|
|
||||||
|
@ -711,6 +723,8 @@ void Pcsx2App::CleanupResources()
|
||||||
while( wxGetLocale() != NULL )
|
while( wxGetLocale() != NULL )
|
||||||
delete wxGetLocale();
|
delete wxGetLocale();
|
||||||
|
|
||||||
|
m_mtx_LoadingGameDB.Wait();
|
||||||
|
ScopedLock lock(m_mtx_Resources);
|
||||||
m_Resources = NULL;
|
m_Resources = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -829,6 +843,6 @@ struct CrtDebugBreak
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//CrtDebugBreak breakAt( 737 );
|
//CrtDebugBreak breakAt( 909 );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -213,17 +213,55 @@ wxWindowID SwapOrReset_CdvdSrc( wxWindow* owner, CDVD_SourceType newsrc )
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static wxString JoinFiletypes( const wxChar** src )
|
||||||
|
{
|
||||||
|
wxString dest;
|
||||||
|
while( *src != NULL )
|
||||||
|
{
|
||||||
|
if( *src[0] == 0 ) continue;
|
||||||
|
if( !dest.IsEmpty() )
|
||||||
|
dest += L";";
|
||||||
|
|
||||||
|
dest += wxsFormat(L"*.%s", *src);
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
// omgosh! linux is CaSE SeNSiTiVE!!
|
||||||
|
dest += wxsFormat(L";*.%s", *src).MakeUpper();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
++src;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns FALSE if the user canceled the action.
|
// Returns FALSE if the user canceled the action.
|
||||||
bool MainEmuFrame::_DoSelectIsoBrowser( wxString& result )
|
bool MainEmuFrame::_DoSelectIsoBrowser( wxString& result )
|
||||||
{
|
{
|
||||||
static const wxChar* isoFilterTypes =
|
static const wxChar* isoSupportedTypes[] =
|
||||||
L"All Supported (.iso .mdf .nrg .bin .img .dump)|*.iso;*.mdf;*.nrg;*.bin;*.img;*.dump|"
|
{
|
||||||
L"Disc Images (.iso .mdf .nrg .bin .img)|*.iso;*.mdf;*.nrg;*.bin;*.img|"
|
L"iso", L"mdf", L"nrg", L"bin", L"img", NULL
|
||||||
L"Blockdumps (.dump)|*.dump|"
|
};
|
||||||
L"All Files (*.*)|*.*";
|
|
||||||
|
|
||||||
|
const wxString isoSupportedLabel( JoinString(isoSupportedTypes, L" ") );
|
||||||
|
const wxString isoSupportedList( JoinFiletypes(isoSupportedTypes) );
|
||||||
|
|
||||||
|
wxArrayString isoFilterTypes;
|
||||||
|
|
||||||
|
isoFilterTypes.Add(wxsFormat(_("All Supported (%s)"), (isoSupportedLabel + L" .dump").c_str()));
|
||||||
|
isoFilterTypes.Add(isoSupportedList + L";*.dump");
|
||||||
|
|
||||||
|
isoFilterTypes.Add(wxsFormat(_("Disc Images (%s)"), isoSupportedLabel.c_str() ));
|
||||||
|
isoFilterTypes.Add(isoSupportedList);
|
||||||
|
|
||||||
|
isoFilterTypes.Add(wxsFormat(_("Blockdumps (%s)"), L".dump" ));
|
||||||
|
isoFilterTypes.Add(L"*.dump");
|
||||||
|
|
||||||
|
isoFilterTypes.Add(_("All Files (*.*)"));
|
||||||
|
isoFilterTypes.Add(L"*.*");
|
||||||
|
|
||||||
wxFileDialog ctrl( this, _("Select CDVD source iso..."), g_Conf->Folders.RunIso.ToString(), wxEmptyString,
|
wxFileDialog ctrl( this, _("Select CDVD source iso..."), g_Conf->Folders.RunIso.ToString(), wxEmptyString,
|
||||||
isoFilterTypes, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
JoinString(isoFilterTypes, L"|"), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
if( ctrl.ShowModal() != wxID_CANCEL )
|
if( ctrl.ShowModal() != wxID_CANCEL )
|
||||||
{
|
{
|
||||||
|
@ -237,12 +275,10 @@ bool MainEmuFrame::_DoSelectIsoBrowser( wxString& result )
|
||||||
|
|
||||||
bool MainEmuFrame::_DoSelectELFBrowser()
|
bool MainEmuFrame::_DoSelectELFBrowser()
|
||||||
{
|
{
|
||||||
static const wxChar* elfFilterTypes =
|
static const wxChar* elfFilterType = L"ELF Files (.elf)|*.elf;*.ELF|";
|
||||||
L"ELF Files (.elf)|*.elf|"
|
|
||||||
L"All Files (*.*)|*.*";
|
|
||||||
|
|
||||||
wxFileDialog ctrl( this, _("Select ELF file..."), g_Conf->Folders.RunELF.ToString(), wxEmptyString,
|
wxFileDialog ctrl( this, _("Select ELF file..."), g_Conf->Folders.RunELF.ToString(), wxEmptyString,
|
||||||
elfFilterTypes, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
(wxString)elfFilterType + L"|" + _("All Files (*.*)") + L"|*.*", wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
if( ctrl.ShowModal() != wxID_CANCEL )
|
if( ctrl.ShowModal() != wxID_CANCEL )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue