MCPcopy Create free account
hub / github.com/TASEmulators/fceux / fdsLoadBiosFile

Method fdsLoadBiosFile

src/drivers/Qt/ConsoleWindow.cpp:3586–3657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3584}
3585
3586void consoleWin_t::fdsLoadBiosFile(void)
3587{
3588 int ret, useNativeFileDialogVal;
3589 QString filename;
3590 std::string last;
3591 std::string dir;
3592 QFileDialog dialog(this, tr("Load FDS BIOS (disksys.rom)") );
3593 QList<QUrl> urls;
3594
3595 urls << QUrl::fromLocalFile( QDir::rootPath() );
3596 urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first());
3597 urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::DesktopLocation).first());
3598 urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::DownloadLocation).first());
3599
3600 dialog.setFileMode(QFileDialog::ExistingFile);
3601
3602 dialog.setNameFilter(tr("ROM files (*.rom *.ROM) ;; All files (*)"));
3603
3604 dialog.setViewMode(QFileDialog::List);
3605 dialog.setFilter( QDir::AllEntries | QDir::AllDirs | QDir::Hidden );
3606 dialog.setLabelText( QFileDialog::Accept, tr("Load") );
3607
3608 g_config->getOption ("SDL.LastOpenFile", &last );
3609
3610 getDirFromFile( last.c_str(), dir);
3611
3612 dialog.setDirectory( tr(dir.c_str()) );
3613
3614 // Check config option to use native file dialog or not
3615 g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
3616
3617 dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal);
3618 dialog.setSidebarUrls(urls);
3619
3620 ret = dialog.exec();
3621
3622 if ( ret )
3623 {
3624 QStringList fileList;
3625 fileList = dialog.selectedFiles();
3626
3627 if ( fileList.size() > 0 )
3628 {
3629 filename = fileList[0];
3630 }
3631 }
3632
3633 if ( filename.isNull() )
3634 {
3635 return;
3636 }
3637 qDebug() << "selected file path : " << filename.toUtf8();
3638
3639 // copy BIOS file to proper place (~/.fceux/disksys.rom)
3640 std::ifstream fdsBios (filename.toStdString().c_str(), std::fstream::binary);
3641 std::string output_filename =
3642 FCEU_MakeFName (FCEUMKF_FDSROM, 0, "");
3643 std::ofstream outFile (output_filename.c_str (),

Callers

nothing calls this directly

Calls 9

getDirFromFileFunction · 0.85
FCEU_MakeFNameFunction · 0.85
getOptionMethod · 0.80
setOptionMethod · 0.80
execMethod · 0.80
failMethod · 0.80
FCEUD_PrintErrorFunction · 0.70
trFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected