Exemplo n.º 1
0
bool YabauseThread::pauseEmulation( bool pause, bool reset )
{
	if ( mPause == pause && !reset ) {
		return true;
	}
	
	if ( mInit == 0 && reset ) {
		deInitEmulation();
	}
	
	if ( mInit < 0 ) {
		initEmulation();
	}
	
	if ( mInit < 0 )
	{
		emit error( QtYabause::translate( "Can't initialize Yabause" ), false );
		return false;
	}
	
	mPause = pause;
	
	if ( mPause ) {
		ScspMuteAudio(SCSP_MUTE_SYSTEM);
		killTimer( mTimerId );
		mTimerId = -1;
	}
	else {
		ScspUnMuteAudio(SCSP_MUTE_SYSTEM);
		mTimerId = startTimer( 0 );
	}
	
	VolatileSettings * vs = QtYabause::volatileSettings();

	if (vs->value("autostart").toBool())
	{
		if (vs->value("autostart/binary").toBool()) {
			MappedMemoryLoadExec(
				vs->value("autostart/binary/filename").toString().toLocal8Bit().constData(),
				vs->value("autostart/binary/address").toUInt());
		}
		else if (vs->value("autostart/load").toBool()) {
			YabLoadStateSlot( QtYabause::volatileSettings()->value( "General/SaveStates", getDataDirPath() ).toString().toLatin1().constData(), vs->value("autostart/load/slot").toInt() );
		}
		vs->setValue("autostart", false);
	}

	emit this->pause( mPause );
	
	return true;
}
Exemplo n.º 2
0
QString getIniFile( const QString& s )
{
#if defined Q_OS_MAC
	return QString( "%1/../%2.ini" ).arg( QApplication::applicationDirPath() ).arg( s );
#elif defined Q_OS_WIN
	/* We used to store the ini file in the application directory, before moving to the
	correct location, but some users like it better the old way... so if we find a .ini
	file in the application directory, we're using it */
	QString oldinifile = QString( "%1/%2.ini" ).arg( QApplication::applicationDirPath() ).arg( s );
	if ( QFile::exists( oldinifile )) return oldinifile;

	return QString( "%1/%2.ini" ).arg( getDataDirPath() ).arg(s);
#else
	/*
	We used to store the ini file in ~/.$SOMETHING/$SOMETHING.ini, were $SOMETHING could
	be at least yabause or yabause-qt
	With release 0.9.12 we moved to the XDG compliant location ~/.config/yabause/qt/yabause.ini
	and we don't want this location to depends on the program name anymore.
	This code is trying to copy the content from the old location to the new.
	In the future, we may drop support for the old location and rewrite the following to:

	return QString( "%1/.config/yabause/qt/yabause.ini" ).arg( QDir::homePath() );
	*/

	QString xdginifile = QString( "%1/.config/yabause/qt/yabause.ini" ).arg( QDir::homePath() );
	QString oldinifile = QString( "%1/.%2/%2.ini" ).arg( QDir::homePath() ).arg( s );

	if ( not QFile::exists( xdginifile ) )
	{
		QString xdgpath = QString( "%1/.config/yabause/qt" ).arg( QDir::homePath() );
		if ( ! QFile::exists( xdgpath ) )
		{
			// for some reason, Qt doesn't provide a static mkpath method O_o
			QDir dir;
			dir.mkpath( xdgpath );
		}

		if ( QFile::exists( oldinifile ) )
			QFile::copy( oldinifile, xdginifile );
	}

	return xdginifile;
#endif
}
Exemplo n.º 3
0
void UIMemoryEditor::on_pbSaveTab_clicked()
{
	QString fn = CommonDialogs::getSaveFileName(getDataDirPath(), QtYabause::translate("Choose a location for binary file"), QtYabause::translate("Binary Files (*.bin)"));
	if (!fn.isEmpty())
		saMemoryEditor->saveTab(fn);
}