* 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:
Jake.Stine 2010-06-30 03:21:59 +00:00
parent 25887c62ee
commit 5ad95b28eb
8 changed files with 103 additions and 27 deletions

View File

@ -454,4 +454,4 @@ public:
// 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 JoinString( wxString& dest, const SafeList<wxString>& src, const wxString& separator );
extern wxString JoinString( const SafeList<wxString>& src, const wxString& separator );

View File

@ -69,7 +69,8 @@ extern wxString fromAscii( const char* src );
extern const wxRect wxDefaultRect;
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 wxSize& src, const wxString& separator=L"," );

View File

@ -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
// 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 )
{
if( i != 0 )
if( src[i].IsEmpty() ) continue;
if( !dest.IsEmpty() )
dest += separator;
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 )
{
if( i != 0 )
if( src[i].IsEmpty() ) continue;
if( !dest.IsEmpty() )
dest += separator;
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

View File

@ -154,9 +154,11 @@ void SysLogMachineCaps()
if( x86caps.has3DNOWInstructionExtensionsExt ) features[1].Add( L"3DNOW2" );
if( x86caps.hasStreamingSIMD4ExtensionsA ) features[1].Add( L"SSE4a " );
wxString result[2];
JoinString( result[0], features[0], L".. " );
JoinString( result[1], features[1], L".. " );
const wxString result[2] =
{
JoinString( features[0], L".. " ),
JoinString( features[1], L".. " )
};
Console.WriteLn( Color_StrongBlack, L"x86 Features Detected:" );
Console.Indent().WriteLn( result[0] + (result[1].IsEmpty() ? L"" : (L"\n" + result[1])) );

View File

@ -449,6 +449,9 @@ protected:
bool m_ScheduledTermination;
bool m_UseGUI;
Threading::Mutex m_mtx_Resources;
Threading::Mutex m_mtx_LoadingGameDB;
public:
FramerateManager FpsManager;
ScopedPtr<CommandDictionary> GlobalCommands;
@ -466,9 +469,6 @@ protected:
ScopedPtr<RecentIsoList> m_RecentIsoList;
ScopedPtr<pxAppResources> m_Resources;
Threading::Mutex m_mtx_Resources;
Threading::Mutex m_mtx_LoadingGameDB;
public:
// 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

View File

@ -129,6 +129,7 @@ void DBLoaderHelper::ReadGames()
}
while(!m_reader.Eof()) { // Fill game data, find new game, repeat...
pthread_testcancel();
pxReadLine(m_reader, m_dest, m_intermediate);
m_dest.Trim(true).Trim(false);
if( m_dest.IsEmpty() ) continue;

View File

@ -470,9 +470,10 @@ typedef void (wxEvtHandler::*pxInvokeAppMethodEventFunction)(Pcsx2AppMethodEvent
typedef void (wxEvtHandler::*pxStuckThreadEventHandler)(pxMessageBoxEvent&);
// --------------------------------------------------------------------------------------
// CompressThread_gzip
// GameDatabaseLoaderThread
// --------------------------------------------------------------------------------------
class GameDatabaseLoaderThread : public pxThread
, EventListener_AppStatus
{
typedef pxThread _parent;
@ -480,7 +481,11 @@ protected:
gzFile m_gzfp;
public:
GameDatabaseLoaderThread() : pxThread( L"GameDatabaseLoader" ) {}
GameDatabaseLoaderThread()
: pxThread( L"GameDatabaseLoader" )
{
}
virtual ~GameDatabaseLoaderThread() throw()
{
_parent::Cancel();
@ -489,13 +494,20 @@ public:
protected:
void ExecuteTaskInThread()
{
Sleep(2);
wxGetApp().GetGameDatabase();
}
void OnCleanupInThread()
{
_parent::OnCleanupInThread();
wxGetApp().DeleteThread(this);
}
void AppStatusEvent_OnExit()
{
Block();
}
};
bool Pcsx2App::OnInit()
@ -640,8 +652,8 @@ void Pcsx2App::PrepForExit()
if( m_ScheduledTermination ) return;
m_ScheduledTermination = true;
SysExecutorThread.ShutdownQueue();
DispatchEvent( AppStatus_Exiting );
SysExecutorThread.ShutdownQueue();
m_timer_Termination->Start( 500 );
@ -711,6 +723,8 @@ void Pcsx2App::CleanupResources()
while( wxGetLocale() != NULL )
delete wxGetLocale();
m_mtx_LoadingGameDB.Wait();
ScopedLock lock(m_mtx_Resources);
m_Resources = NULL;
}
@ -829,6 +843,6 @@ struct CrtDebugBreak
}
};
//CrtDebugBreak breakAt( 737 );
//CrtDebugBreak breakAt( 909 );
#endif

View File

@ -213,17 +213,55 @@ wxWindowID SwapOrReset_CdvdSrc( wxWindow* owner, CDVD_SourceType newsrc )
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.
bool MainEmuFrame::_DoSelectIsoBrowser( wxString& result )
{
static const wxChar* isoFilterTypes =
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"Blockdumps (.dump)|*.dump|"
L"All Files (*.*)|*.*";
static const wxChar* isoSupportedTypes[] =
{
L"iso", L"mdf", L"nrg", L"bin", L"img", NULL
};
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,
isoFilterTypes, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
JoinString(isoFilterTypes, L"|"), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( ctrl.ShowModal() != wxID_CANCEL )
{
@ -237,12 +275,10 @@ bool MainEmuFrame::_DoSelectIsoBrowser( wxString& result )
bool MainEmuFrame::_DoSelectELFBrowser()
{
static const wxChar* elfFilterTypes =
L"ELF Files (.elf)|*.elf|"
L"All Files (*.*)|*.*";
static const wxChar* elfFilterType = L"ELF Files (.elf)|*.elf;*.ELF|";
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 )
{