コード例 #1
0
ファイル: GameList.cpp プロジェクト: ToadKing/dolphin
void GameList::ShowContextMenu(const QPoint&)
{
  const auto game = GetSelectedGame();
  if (game.isEmpty())
    return;

  QMenu* menu = new QMenu(this);
  DiscIO::Platform platform = GameFile(game).GetPlatformID();
  menu->addAction(tr("Properties"), this, SLOT(OpenProperties()));
  menu->addAction(tr("Wiki"), this, SLOT(OpenWiki()));
  menu->addSeparator();

  if (platform == DiscIO::Platform::GAMECUBE_DISC || platform == DiscIO::Platform::WII_DISC)
  {
    menu->addAction(tr("Default ISO"), this, SLOT(SetDefaultISO()));
    const auto blob_type = GameFile(game).GetBlobType();

    if (blob_type == DiscIO::BlobType::GCZ)
      menu->addAction(tr("Decompress ISO"), this, SLOT(DecompressISO()));
    else if (blob_type == DiscIO::BlobType::PLAIN)
      menu->addAction(tr("Compress ISO"), this, SLOT(CompressISO()));

    menu->addSeparator();
  }
  if (platform == DiscIO::Platform::WII_WAD)
  {
    menu->addAction(tr("Install to the NAND"), this, SLOT(InstallWAD()));

    if (GameFile(game).IsInstalled())
      menu->addAction(tr("Uninstall from the NAND"), this, SLOT(UninstallWAD()));

    menu->addSeparator();
  }

  if (platform == DiscIO::Platform::WII_WAD || platform == DiscIO::Platform::WII_DISC)
  {
    menu->addAction(tr("Open Wii save folder"), this, SLOT(OpenSaveFolder()));
    menu->addAction(tr("Export Wii save (Experimental)"), this, SLOT(ExportWiiSave()));
    menu->addSeparator();
  }

  menu->addAction(tr("Open Containing Folder"), this, SLOT(OpenContainingFolder()));
  menu->addAction(tr("Remove File"), this, SLOT(DeleteFile()));
  menu->exec(QCursor::pos());
}
コード例 #2
0
ファイル: GameList.cpp プロジェクト: ToadKing/dolphin
void GameList::InstallWAD()
{
  QMessageBox result_dialog(this);

  const bool success = GameFile(GetSelectedGame()).Install();

  result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical);
  result_dialog.setText(success ? tr("Succesfully installed title to the NAND") :
                                  tr("Failed to install title to the NAND"));
  result_dialog.exec();
}
コード例 #3
0
ファイル: GameList.cpp プロジェクト: ToadKing/dolphin
void GameList::ExportWiiSave()
{
  QMessageBox result_dialog(this);

  const bool success = GameFile(GetSelectedGame()).ExportWiiSave();

  result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical);
  result_dialog.setText(success ? tr("Successfully exported save files") :
                                  tr("Failed to export save files!"));
  result_dialog.exec();
}
コード例 #4
0
ファイル: CResourceDb.cpp プロジェクト: alanhorizon/Transport
ALERROR CResourceDb::LoadEntities (CString *retsError)

//	LoadEntities
//
//	Loads the entities of a game file

	{
	ALERROR error;

	if (m_pMainDb == NULL)
		{
		if (m_bGameFileInDb && m_pDb)
			{
			ASSERT(m_pResourceMap);

			CString sGameFile;
			if ((error = m_pDb->ReadEntry(m_iGameFile, &sGameFile)))
				{
				*retsError = strPatternSubst(CONSTLIT("%s is corrupt"), m_sGameFile.GetASCIIZPointer());
				return error;
				}

			//	Parse the XML file from the buffer

			CBufferReadBlock GameFile(sGameFile);

			CString sError;
			if ((error = CXMLElement::ParseEntityTable(&GameFile, &m_Entities, &sError)))
				{
				*retsError = strPatternSubst(CONSTLIT("Unable to parse %s: %s"), m_sGameFile.GetASCIIZPointer(), sError.GetASCIIZPointer());
				return error;
				}
			}
		else
			{
			//	Parse the XML file on disk

			CFileReadBlock DataFile(pathAddComponent(m_sRoot, m_sGameFile));
			CString sError;

			if ((error = CXMLElement::ParseEntityTable(&DataFile, &m_Entities, &sError)))
				{
				*retsError = strPatternSubst(CONSTLIT("Unable to parse %s: %s"), m_sGameFile.GetASCIIZPointer(), sError.GetASCIIZPointer());
				return error;
				}
			}
		}

	return NOERROR;
	}
コード例 #5
0
ファイル: GameList.cpp プロジェクト: jloehr/dolphin
void GameList::ShowContextMenu(const QPoint&)
{
  QMenu* menu = new QMenu(this);
  DiscIO::Platform platform = GameFile(GetSelectedGame()).GetPlatformID();
  if (platform == DiscIO::Platform::GAMECUBE_DISC || platform == DiscIO::Platform::WII_DISC)
  {
    menu->addAction(tr("Properties"), this, SLOT(OpenProperties()));
    menu->addAction(tr("Open Wiki Page"), this, SLOT(OpenWiki()));
    menu->addAction(tr("Set as Default ISO"), this, SLOT(SetDefaultISO()));
  }
  else
  {
    return;
  }
  menu->exec(QCursor::pos());
}
コード例 #6
0
ファイル: GameList.cpp プロジェクト: ToadKing/dolphin
void GameList::UninstallWAD()
{
  QMessageBox warning_dialog(this);

  warning_dialog.setIcon(QMessageBox::Information);
  warning_dialog.setText(tr("Uninstalling the WAD will remove the currently installed version of "
                            "this title from the NAND without deleting its save data. Continue?"));
  warning_dialog.setStandardButtons(QMessageBox::No | QMessageBox::Yes);

  if (warning_dialog.exec() == QMessageBox::No)
    return;

  QMessageBox result_dialog(this);

  const bool success = GameFile(GetSelectedGame()).Uninstall();

  result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical);
  result_dialog.setText(success ? tr("Succesfully removed title from the NAND") :
                                  tr("Failed to remove title from the NAND"));
  result_dialog.exec();
}
コード例 #7
0
ファイル: CResourceDb.cpp プロジェクト: alanhorizon/Transport
CString CResourceDb::GetRootTag (void)

//	GetRootTag
//
//	Returns the tag of the root element (or NULL_STR if there is an error)

	{
	if (m_bGameFileInDb && m_pDb)
		{
		ASSERT(m_pResourceMap);

		int iReadSize = Min(m_pDb->GetEntryLength(m_iGameFile), 1024);

		CString sGameFile;
		if (m_pDb->ReadEntryPartial(m_iGameFile, 0, iReadSize, &sGameFile) != NOERROR)
			return NULL_STR;

		//	Parse the XML file from the buffer

		CBufferReadBlock GameFile(sGameFile);
		CString sTag;

		if (CXMLElement::ParseRootTag(&GameFile, &sTag) != NOERROR)
			return NULL_STR;

		return sTag;
		}
	else
		{
		//	Parse the XML file on disk

		CFileReadBlock DataFile(pathAddComponent(m_sRoot, m_sGameFile));
		CString sTag;

		if (CXMLElement::ParseRootTag(&DataFile, &sTag) != NOERROR)
			return NULL_STR;

		return sTag;
		}
	}
コード例 #8
0
ファイル: MenuBar.cpp プロジェクト: t27duck/dolphin
void MenuBar::InstallWAD()
{
  QString wad_file = QFileDialog::getOpenFileName(this, tr("Select a title to install to NAND"),
                                                  QString(), tr("WAD files (*.wad)"));

  if (wad_file.isEmpty())
    return;

  QMessageBox result_dialog(this);

  if (GameFile(wad_file).Install())
  {
    result_dialog.setIcon(QMessageBox::Information);
    result_dialog.setText(tr("Successfully installed this title to the NAND."));
  }
  else
  {
    result_dialog.setIcon(QMessageBox::Critical);
    result_dialog.setText(tr("Failed to install this title to the NAND."));
  }

  result_dialog.exec();
}
コード例 #9
0
ファイル: GameList.cpp プロジェクト: ToadKing/dolphin
void GameList::OpenSaveFolder()
{
  QUrl url = QUrl::fromLocalFile(GameFile(GetSelectedGame()).GetWiiFSPath());
  QDesktopServices::openUrl(url);
}
コード例 #10
0
ファイル: GameList.cpp プロジェクト: ToadKing/dolphin
void GameList::CompressISO()
{
  const auto original_path = GetSelectedGame();
  auto file = GameFile(original_path);

  const bool compressed = (file.GetBlobType() == DiscIO::BlobType::GCZ);

  if (!compressed && file.GetPlatformID() == DiscIO::Platform::WII_DISC)
  {
    QMessageBox wii_warning(this);
    wii_warning.setIcon(QMessageBox::Warning);
    wii_warning.setText(tr("Are you sure?"));
    wii_warning.setInformativeText(
        tr("Compressing a Wii disc image will irreversibly change the compressed copy by removing "
           "padding data. Your disc image will still work."));
    wii_warning.setStandardButtons(QMessageBox::Yes | QMessageBox::No);

    if (wii_warning.exec() == QMessageBox::No)
      return;
  }

  QString dst_path = QFileDialog::getSaveFileName(
      this, compressed ? tr("Select where you want to save the decompressed image") :
                         tr("Select where you want to save the compressed image"),
      QFileInfo(GetSelectedGame())
          .dir()
          .absoluteFilePath(file.GetGameID())
          .append(compressed ? QStringLiteral(".gcm") : QStringLiteral(".gcz")),
      compressed ? tr("Uncompressed GC/Wii images (*.iso *.gcm") :
                   tr("Compressed GC/Wii images (*.gcz)"));

  if (dst_path.isEmpty())
    return;

  QProgressDialog progress_dialog(compressed ? tr("Decompressing...") : tr("Compressing..."),
                                  tr("Abort"), 0, 100, this);
  progress_dialog.setWindowModality(Qt::WindowModal);

  bool good;

  if (compressed)
  {
    good = DiscIO::DecompressBlobToFile(original_path.toStdString(), dst_path.toStdString(),
                                        &CompressCB, &progress_dialog);
  }
  else
  {
    good = DiscIO::CompressFileToBlob(original_path.toStdString(), dst_path.toStdString(),
                                      file.GetPlatformID() == DiscIO::Platform::WII_DISC ? 1 : 0,
                                      16384, &CompressCB, &progress_dialog);
  }

  if (good)
  {
    QMessageBox(QMessageBox::Information, tr("Success!"), tr("Successfully compressed image."),
                QMessageBox::Ok, this)
        .exec();
  }
  else
  {
    QErrorMessage(this).showMessage(tr("Dolphin failed to complete the requested action."));
  }
}
コード例 #11
0
ファイル: GameList.cpp プロジェクト: ToadKing/dolphin
void GameList::OpenWiki()
{
  QString game_id = GameFile(GetSelectedGame()).GetGameID();
  QString url = QStringLiteral("https://wiki.dolphin-emu.org/index.php?title=").append(game_id);
  QDesktopServices::openUrl(QUrl(url));
}
コード例 #12
0
ファイル: GameList.cpp プロジェクト: ToadKing/dolphin
void GameList::OpenProperties()
{
  PropertiesDialog* properties = new PropertiesDialog(this, GameFile(GetSelectedGame()));
  properties->show();
}
コード例 #13
0
ファイル: CResourceDb.cpp プロジェクト: alanhorizon/Transport
/*
ALERROR CResourceDb::LoadImage (const CString &sFolder, const CString &sFilename, HBITMAP *rethImage)

//	LoadImage
//
//	Loads an image and returns it

	{
	assert(0);
	}
*/
ALERROR CResourceDb::LoadModule (const CString &sFolder, const CString &sFilename, CXMLElement **retpData, CString *retsError)

//	LoadModule
//
//	Loads a module

	{
	ALERROR error;

	if (m_bGameFileInDb && m_pDb)
		{
		ASSERT(m_pResourceMap);

		CString sFilespec;
		if (m_iVersion >= 11)
			sFilespec = pathAddComponent(sFolder, sFilename);
		else
			sFilespec = sFilename;

		//	Look up the file in the map

		int iEntry;
		TRY(m_pResourceMap->Lookup(sFilespec, (CObject **)&iEntry));
		if (error)
			{
			*retsError = strPatternSubst(CONSTLIT("%s: Resource map corrupt."), m_sGameFile.GetASCIIZPointer());
			return error;
			}

		CString sGameFile;
		TRY(m_pDb->ReadEntry(iEntry, &sGameFile));
		if (error)
			{
			*retsError = strPatternSubst(CONSTLIT("%s: Unable to read entry: %d"), m_sGameFile.GetASCIIZPointer(), iEntry);
			return error;
			}

		//	Parse the XML file from the buffer

		CBufferReadBlock GameFile(sGameFile);
		CString sError;
		TRY(CXMLElement::ParseXML(&GameFile, &m_Entities, retpData, &sError));
		if (error)
			{
			*retsError = strPatternSubst(CONSTLIT("%s: %s"), m_sGameFile.GetASCIIZPointer(), sError.GetASCIIZPointer());
			return error;
			}
		}
	else
		{
		//	Parse the XML file on disk

		CFileReadBlock DataFile(pathAddComponent(m_sRoot, pathAddComponent(sFolder, sFilename)));
		CString sError;
		if ((error = CXMLElement::ParseXML(&DataFile, &m_Entities, retpData, &sError)))
			{
			*retsError = strPatternSubst(CONSTLIT("Unable to parse %s: %s"), sFilename.GetASCIIZPointer(), sError.GetASCIIZPointer());
			return error;
			}
		}

	return NOERROR;
	}