示例#1
0
void GameList::OpenGCSaveFolder()
{
  const auto game = GetSelectedGame();
  if (!game)
    return;

  bool found = false;

  for (int i = 0; i < 2; i++)
  {
    QUrl url;
    switch (SConfig::GetInstance().m_EXIDevice[i])
    {
    case ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER:
    {
      std::string path = StringFromFormat("%s/%s/%s", File::GetUserPath(D_GCUSER_IDX).c_str(),
                                          SConfig::GetDirectoryForRegion(game->GetRegion()),
                                          i == 0 ? "Card A" : "Card B");

      std::string override_path = i == 0 ? Config::Get(Config::MAIN_GCI_FOLDER_A_PATH_OVERRIDE) :
                                           Config::Get(Config::MAIN_GCI_FOLDER_B_PATH_OVERRIDE);

      if (!override_path.empty())
        path = override_path;

      QDir dir(QString::fromStdString(path));

      if (!dir.entryList({QStringLiteral("%1-%2-*.gci")
                              .arg(QString::fromStdString(game->GetMakerID()))
                              .arg(QString::fromStdString(game->GetGameID().substr(0, 4)))})
               .empty())
      {
        url = QUrl::fromLocalFile(dir.absolutePath());
      }
      break;
    }
    case ExpansionInterface::EXIDEVICE_MEMORYCARD:
      std::string memcard_path = i == 0 ? Config::Get(Config::MAIN_MEMCARD_A_PATH) :
                                          Config::Get(Config::MAIN_MEMCARD_B_PATH);

      std::string memcard_dir;

      SplitPath(memcard_path, &memcard_dir, nullptr, nullptr);
      url = QUrl::fromLocalFile(QString::fromStdString(memcard_dir));
      break;
    }

    found |= !url.isEmpty();

    if (!url.isEmpty())
      QDesktopServices::openUrl(url);
  }

  if (!found)
    ModalMessageBox::information(this, tr("Information"), tr("No save data found."));
}
示例#2
0
std::string CVolumeWAD::GetUniqueID() const
{
  char GameCode[6];
  if (!Read(m_offset + 0x01E0, 4, (u8*)GameCode))
    return "0";

  std::string temp = GetMakerID();
  GameCode[4] = temp.at(0);
  GameCode[5] = temp.at(1);

  return DecodeString(GameCode);
}