void MainWnd::OnOptionsSoundStartrecording()
{
  CString captureBuffer;

  CString capdir = regQueryStringValue("soundRecordDir", NULL);

  if(capdir.IsEmpty())
    capdir = getDirFromFile(theApp.filename);

  CString filter = theApp.winLoadFilter(IDS_FILTER_WAV);
  CString title = winResLoadString(IDS_SELECT_WAV_NAME);

  LPCTSTR exts[] = { ".WAV" };

  FileDlg dlg(this, "", filter, 1, "WAV", exts, capdir, title, true);

  if(dlg.DoModal() == IDCANCEL) {
    return;
  }

  captureBuffer = theApp.soundRecordName =  dlg.GetPathName();
  soundRecording = true;

  if(dlg.m_ofn.nFileOffset > 0) {
    captureBuffer = captureBuffer.Left(dlg.m_ofn.nFileOffset);
  }

  int len = captureBuffer.GetLength();

  if(len > 3 && captureBuffer[len-1] == '\\')
    captureBuffer = captureBuffer.Left(len-1);
  regSetStringValue("soundRecordDir", captureBuffer);
}
示例#2
0
bool MainWnd::fileOpenSelect()
{
  theApp.dir = "";
  CString initialDir = regQueryStringValue("romdir",".");
  if(!initialDir.IsEmpty())
    theApp.dir = initialDir;

  int selectedFilter = regQueryDwordValue("selectedFilter", 0);
  if(selectedFilter < 0 || selectedFilter > 2)
    selectedFilter = 0;

  theApp.szFile = "";

  LPCTSTR exts[] = { "" };
  CString filter = winLoadFilter(IDS_FILTER_ROM);
  CString title = winResLoadString(IDS_SELECT_ROM);

  FileDlg dlg(this, "", filter, selectedFilter, "", exts, theApp.dir, title, false);

  if(dlg.DoModal() == IDOK) {
    regSetDwordValue("selectedFilter", dlg.m_ofn.nFilterIndex);
    theApp.szFile = dlg.GetPathName();
    theApp.dir = theApp.szFile.Left(dlg.m_ofn.nFileOffset);
    if(theApp.dir.GetLength() > 3 && theApp.dir[theApp.dir.GetLength()-1] == '\\')
      theApp.dir = theApp.dir.Left(theApp.dir.GetLength()-1);
    regSetStringValue("romdir", theApp.dir);
    return true;
  }
  return false;
}
void MainWnd::OnToolsRecordStartmovierecording()
{
  CString captureBuffer;
  CString capdir = regQueryStringValue("movieRecordDir", "");

  if(capdir.IsEmpty())
    capdir = getDirFromFile(theApp.filename);

  CString filter = theApp.winLoadFilter(IDS_FILTER_VMV);
  CString title = winResLoadString(IDS_SELECT_MOVIE_NAME);

  LPCTSTR exts[] = { ".VMV" };

  FileDlg dlg(this, "", filter, 1, "VMV", exts, capdir, title, true);

  if(dlg.DoModal() == IDCANCEL) {
    return;
  }

  CString movieName = dlg.GetPathName();
  captureBuffer = movieName;

  if(dlg.m_ofn.nFileOffset > 0) {
    captureBuffer = captureBuffer.Left(dlg.m_ofn.nFileOffset);
  }

  int len = captureBuffer.GetLength();

  if(len > 3 && captureBuffer[len-1] == '\\')
    captureBuffer = captureBuffer.Left(len-1);

  regSetStringValue("movieRecordDir", captureBuffer);

  theApp.movieFile = fopen(movieName, "wb");

  if(!theApp.movieFile) {
    systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s",
                  (const char *)movieName);
    return;
  }

  int version = 1;

  fwrite(&version, 1, sizeof(int), theApp.movieFile);

  movieName = movieName.Left(movieName.GetLength()-3) + "VM0";

  if(writeSaveGame(movieName)) {
    movieFrame = 0;
    movieLastJoypad = 0;
    movieRecording = true;
    moviePlaying = false;
  } else {
    systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s",
                  (const char *)movieName);
  }
}
void Directories::OnOK() 
{
  CString buffer;
  m_romPath.GetWindowText(buffer);
  if(!buffer.IsEmpty())
    regSetStringValue("romdir", buffer);
  m_gbromPath.GetWindowText(buffer);
  if(!buffer.IsEmpty())
    regSetStringValue("gbromdir", buffer);      
  m_batteryPath.GetWindowText(buffer);
  if(!buffer.IsEmpty())
    regSetStringValue("batteryDir", buffer);
  m_savePath.GetWindowText(buffer);
  if(!buffer.IsEmpty())
    regSetStringValue("saveDir", buffer);
  m_capturePath.GetWindowText(buffer);
  if(!buffer.IsEmpty())
    regSetStringValue("captureDir", buffer);      
  EndDialog(TRUE);
}
示例#5
0
void winSaveKey(char *name, KeyList& value)
{
	CString txtKeys;

	POSITION p = value.GetHeadPosition();
	while(p!=NULL)
	{
		CString tmp;
		tmp.Format("%d", value.GetNext(p));
		txtKeys+=tmp;
		if (p!=NULL)
			txtKeys+=",";
	}
	regSetStringValue(name, txtKeys);
}
void MainWnd::OnToolsRecordStartavirecording()
{
	CString captureBuffer;
	CString capdir = regQueryStringValue( "aviRecordDir", NULL );

	if( capdir.IsEmpty() ) {
		capdir = getDirFromFile( theApp.filename );
	}

	CString filter = theApp.winLoadFilter( IDS_FILTER_AVI );
	CString title = winResLoadString( IDS_SELECT_AVI_NAME );

	LPCTSTR exts[] = { ".AVI" };

	FileDlg dlg( this, "", filter, 1, "AVI", exts, capdir, title, true );

	if( dlg.DoModal() == IDCANCEL ) {
		return;
	}

	captureBuffer = theApp.soundRecordName =  dlg.GetPathName();
	theApp.aviRecordName = captureBuffer;
	aviRecording = true;

	if( dlg.m_ofn.nFileOffset > 0 ) {
		captureBuffer = captureBuffer.Left( dlg.m_ofn.nFileOffset );
	}

	int len = captureBuffer.GetLength();

	if( ( len > 3 ) && captureBuffer[ len - 1 ] == '\\' ) {
		captureBuffer = captureBuffer.Left( len - 1 );
	}

	regSetStringValue( "aviRecordDir", captureBuffer );


	// create AVI file
	bool ret;

	if( theApp.aviRecorder ) {
		delete theApp.aviRecorder;
		theApp.aviRecorder = NULL;
	}
	theApp.aviRecorder = new AVIWrite();

	// create AVI file
	ret = theApp.aviRecorder->CreateAVIFile( theApp.aviRecordName );
	if( !ret ) {
		systemMessage( IDS_AVI_CANNOT_CREATE_AVI, "Cannot create AVI file." );
		delete theApp.aviRecorder;
		theApp.aviRecorder = NULL;
		aviRecording = false;
		return;
	}

	// add video stream
	ret = theApp.aviRecorder->CreateVideoStream(
		sizeX,
		sizeY,
		( systemColorDepth == 32 ) ? 24 : 16,
		60,
		this->GetSafeHwnd()
		);
	if( !ret ) {
		systemMessage( IDS_AVI_CANNOT_CREATE_VIDEO, "Cannot create video stream in AVI file. Make sure the selected codec supports input in RGB24 color space!" );
		delete theApp.aviRecorder;
		theApp.aviRecorder = NULL;
		aviRecording = false;
		return;
	}

	// add audio stream
	ret = theApp.aviRecorder->CreateAudioStream(
		2,
		soundGetSampleRate(),
		16,
		this->GetSafeHwnd()
		);
	if( !ret ) {
		systemMessage( IDS_AVI_CANNOT_CREATE_AUDIO, "Cannot create audio stream in AVI file." );
		delete theApp.aviRecorder;
		theApp.aviRecorder = NULL;
		aviRecording = false;
		return;
	}
}
示例#7
0
void VBA::saveSettings()
{
  regSetDwordValue("language", languageOption);

  regSetStringValue("languageName", languageName);

  regSetDwordValue("syncToVideo", syncToVideo);
  regSetDwordValue("syncToAudio", syncToAudio);
  regSetDwordValue("stretch", fullScreenStretch);

  regSetDwordValue("video", videoOption);

  regSetDwordValue("fsAdapter", fsAdapter);
  regSetDwordValue("fsWidth", fsWidth);
  regSetDwordValue("fsHeight", fsHeight);
  regSetDwordValue("fsColorDepth", fsColorDepth);
  regSetDwordValue("fsFrequency", fsFrequency);

  regSetDwordValue("windowX", windowPositionX);
  regSetDwordValue("windowY", windowPositionY);


  regSetDwordValue("useBiosGBA", useBiosFileGBA);

  regSetDwordValue("skipBios", skipBiosFile);

  if(!biosFileNameGBA.IsEmpty())
    regSetStringValue("biosFileGBA", biosFileNameGBA);


  regSetDwordValue("soundEnable", soundGetEnable() & 0x30f);

  regSetDwordValue("soundQuality", 44100 / soundGetSampleRate() );

  regSetDwordValue("soundVolume", (DWORD)(soundGetVolume() * 100.0f));

  regSetDwordValue( "gbaSoundInterpolation", soundInterpolation ? 1 : 0 );
  regSetDwordValue( "gbaSoundFiltering", (DWORD)( soundFiltering * 100.0f ) );

  regSetDwordValue("gpuBilinear", gpuBilinear ? 1 : 0);
  regSetDwordValue("gpuMotionBlur", gpuMotionBlur ? 1 : 0);

  regSetDwordValue("disableStatus", disableStatusMessage);

  regSetDwordValue("showSpeed", showSpeed);

  regSetDwordValue("showSpeedTransparent", showSpeedTransparent);

  regSetDwordValue("recentFreeze", recentFreeze);

  CString buffer;
  for(int i = 0; i < 10; i++) {
    buffer.Format("recent%d", i);
    regSetStringValue(buffer, recentFiles[i]);
  }

  regSetDwordValue("joypadDefault", joypadDefault);
  regSetDwordValue("autoLoadMostRecent", autoLoadMostRecent);
  regSetDwordValue("maxScale", maxScale);
  regSetDwordValue("lastFullscreen", lastFullscreen);
  regSetDwordValue("pauseWhenInactive", pauseWhenInactive);

  regSetDwordValue( "xa2Device", xa2Device );
  regSetDwordValue( "xa2BufferCount", xa2BufferCount );
  regSetDwordValue( "xa2Upmixing", xa2Upmixing ? 1 : 0 );
}
示例#8
0
void Directories::OnOK() 
{
	char baseDir[MAX_PATH+1];
	char temp[MAX_PATH+1];
	GetModuleFileName( NULL, baseDir, MAX_PATH );
	baseDir[MAX_PATH] = '\0'; // for security reasons
	PathRemoveFileSpec( baseDir ); // removes the trailing file name and backslash


	CString buffer;

	m_romPath.GetWindowText(buffer);
	if( !buffer.IsEmpty() )
		regSetStringValue( "romdir", buffer );
	if( buffer[0] == '.' ) {
		strcpy( temp, baseDir );
		strcat( temp, "\\" );
		strcat( temp, buffer );
		buffer = temp;
	}
	if( !directoryDoesExist( buffer ) )
		SHCreateDirectoryEx( NULL, buffer, NULL );

	m_gbromPath.GetWindowText(buffer);
	if( !buffer.IsEmpty() )
		regSetStringValue( "gbromdir", buffer );      
	if( buffer[0] == '.' ) {
		strcpy( temp, baseDir );
		strcat( temp, "\\" );
		strcat( temp, buffer );
		buffer = temp;
	}
	if( !directoryDoesExist( buffer ) )
		SHCreateDirectoryEx( NULL, buffer, NULL );

	m_batteryPath.GetWindowText(buffer);
	if( !buffer.IsEmpty() )
		regSetStringValue( "batteryDir", buffer );
	if( buffer[0] == '.' ) {
		strcpy( temp, baseDir );
		strcat( temp, "\\" );
		strcat( temp, buffer );
		buffer = temp;
	}
	if( !directoryDoesExist( buffer ) )
		SHCreateDirectoryEx( NULL, buffer, NULL );

	m_savePath.GetWindowText(buffer);
	if( !buffer.IsEmpty() )
		regSetStringValue( "saveDir", buffer );
	if( buffer[0] == '.' ) {
		strcpy( temp, baseDir );
		strcat( temp, "\\" );
		strcat( temp, buffer );
		buffer = temp;
	}
	if( !directoryDoesExist( buffer ) )
		SHCreateDirectoryEx( NULL, buffer, NULL );

	m_capturePath.GetWindowText(buffer);
	if( !buffer.IsEmpty() )
		regSetStringValue( "captureDir", buffer );
	if( buffer[0] == '.' ) {
		strcpy( temp, baseDir );
		strcat( temp, "\\" );
		strcat( temp, buffer );
		buffer = temp;
	}
	if( !directoryDoesExist( buffer ) )
		SHCreateDirectoryEx( NULL, buffer, NULL );

	EndDialog(TRUE);
}
示例#9
0
bool MainWnd::fileOpenSelect( int system )
{
	theApp.dir = _T("");
	CString initialDir;
	int selectedFilter = 0;
	LPCTSTR exts[] = { _T(""), _T(""), _T(""), _T("") };
	CString filter;
	CString title;

	switch( system )
	{
	case 0:
		// GBA
		initialDir = regQueryStringValue( _T("romdir"), _T(".") );
		selectedFilter = regQueryDwordValue( _T("selectedFilter"), 0);
		if( (selectedFilter < 0) || (selectedFilter > 2) ) {
			selectedFilter = 0;
		}
		filter = winLoadFilter( IDS_FILTER_GBAROM );
		break;
	case 1:
		// GBC
		initialDir = regQueryStringValue( _T("gbcromdir"), _T(".") );
		// TODO: memorize selected filter for GBC as well
		filter = winLoadFilter( IDS_FILTER_GBCROM );
		break;
	case 2:
		// GB
		initialDir = regQueryStringValue( _T("gbromdir"), _T(".") );
		// TODO: memorize selected filter for GB as well
		filter = winLoadFilter( IDS_FILTER_GBROM );
		break;
	}

	title = winResLoadString( IDS_SELECT_ROM );

	if( !initialDir.IsEmpty() ) {
		theApp.dir = initialDir;
	}

	if( initialDir[0] == '.' ) {
		// handle as relative path
		char baseDir[MAX_PATH+1];
		GetModuleFileName( NULL, baseDir, MAX_PATH );
		baseDir[MAX_PATH] = '\0'; // for security reasons
		PathRemoveFileSpec( baseDir ); // removes the trailing file name and backslash
		strcat( baseDir, "\\" );
		strcat( baseDir, initialDir );
		initialDir = baseDir;
	}

	theApp.szFile = _T("");


	FileDlg dlg( this, _T(""), filter, selectedFilter, _T(""), exts, theApp.dir, title, false);

	if( dlg.DoModal() == IDOK ) {
		if( system == 0 ) {
			regSetDwordValue( _T("selectedFilter"), dlg.m_ofn.nFilterIndex );
		}
		theApp.szFile = dlg.GetPathName();
		theApp.dir = theApp.szFile.Left( dlg.m_ofn.nFileOffset );
		if( (theApp.dir.GetLength() > 3) && (theApp.dir[theApp.dir.GetLength()-1] == _T('\\')) ) {
			theApp.dir = theApp.dir.Left( theApp.dir.GetLength() - 1 );
		}
		SetCurrentDirectory( theApp.dir );
		regSetStringValue( _T("lastDir"), theApp.dir );
		return true;
	}
	return false;
}