std::string GameFile::GetUniqueIdentifier() const { std::vector<std::string> info; if (!GetGameID().empty()) info.push_back(GetGameID()); if (GetRevision() != 0) info.push_back("Revision " + std::to_string(GetRevision())); std::string name = GetLongName(DiscIO::Language::English); if (name.empty()) { // Use the file name as a fallback. Not necessarily consistent, but it's the best we have name = m_file_name; } int disc_number = GetDiscNumber() + 1; std::string lower_name = name; std::transform(lower_name.begin(), lower_name.end(), lower_name.begin(), ::tolower); if (disc_number > 1 && lower_name.find(StringFromFormat("disc %i", disc_number)) == std::string::npos && lower_name.find(StringFromFormat("disc%i", disc_number)) == std::string::npos) { std::string disc_text = "Disc "; info.push_back(disc_text + std::to_string(disc_number)); } if (info.empty()) return name; std::ostringstream ss; std::copy(info.begin(), info.end() - 1, std::ostream_iterator<std::string>(ss, ", ")); ss << info.back(); return name + " (" + ss.str() + ")"; }
std::string GameFile::GetUniqueIdentifier() const { std::vector<std::string> info; if (!GetGameID().empty()) info.push_back(GetGameID()); if (GetRevision() != 0) info.push_back("Revision " + std::to_string(GetRevision())); const std::string& name = GetName(); int disc_number = GetDiscNumber() + 1; std::string lower_name = name; std::transform(lower_name.begin(), lower_name.end(), lower_name.begin(), ::tolower); if (disc_number > 1 && lower_name.find(StringFromFormat("disc %i", disc_number)) == std::string::npos && lower_name.find(StringFromFormat("disc%i", disc_number)) == std::string::npos) { std::string disc_text = "Disc "; info.push_back(disc_text + std::to_string(disc_number)); } if (info.empty()) return name; std::ostringstream ss; std::copy(info.begin(), info.end() - 1, std::ostream_iterator<std::string>(ss, ", ")); ss << info.back(); return name + " (" + ss.str() + ")"; }
std::string GameListItem::GetUniqueIdentifier() const { const DiscIO::Language lang = DiscIO::Language::LANGUAGE_ENGLISH; std::vector<std::string> info; if (!GetGameID().empty()) info.push_back(GetGameID()); if (GetRevision() != 0) { std::string rev_str = "Revision "; info.push_back(rev_str + std::to_string((long long)GetRevision())); } std::string name(GetName(lang)); if (name.empty()) name = GetName(); int disc_number = GetDiscNumber() + 1; std::string lower_name = name; std::transform(lower_name.begin(), lower_name.end(), lower_name.begin(), ::tolower); if (disc_number > 1 && lower_name.find(std::string(wxString::Format("disc %i", disc_number))) == std::string::npos && lower_name.find(std::string(wxString::Format("disc%i", disc_number))) == std::string::npos) { std::string disc_text = "Disc "; info.push_back(disc_text + std::to_string(disc_number)); } if (info.empty()) return name; std::ostringstream ss; std::copy(info.begin(), info.end() - 1, std::ostream_iterator<std::string>(ss, ", ")); ss << info.back(); return name + " (" + ss.str() + ")"; }
void TITLE_BLOCK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const throw( IO_ERROR ) { // Don't write the title block information if there is nothing to write. bool isempty = true; for( unsigned idx = 0; idx < m_tbTexts.GetCount(); idx++ ) { if( ! m_tbTexts[idx].IsEmpty() ) { isempty = false; break; } } if( !isempty ) { aFormatter->Print( aNestLevel, "(title_block\n" ); if( !GetTitle().IsEmpty() ) aFormatter->Print( aNestLevel+1, "(title %s)\n", aFormatter->Quotew( GetTitle() ).c_str() ); if( !GetDate().IsEmpty() ) aFormatter->Print( aNestLevel+1, "(date %s)\n", aFormatter->Quotew( GetDate() ).c_str() ); if( !GetRevision().IsEmpty() ) aFormatter->Print( aNestLevel+1, "(rev %s)\n", aFormatter->Quotew( GetRevision() ).c_str() ); if( !GetCompany().IsEmpty() ) aFormatter->Print( aNestLevel+1, "(company %s)\n", aFormatter->Quotew( GetCompany() ).c_str() ); for( int ii = 0; ii < 4; ii++ ) { if( !GetComment(ii).IsEmpty() ) aFormatter->Print( aNestLevel+1, "(comment %d %s)\n", ii+1, aFormatter->Quotew( GetComment(ii) ).c_str() ); } aFormatter->Print( aNestLevel, ")\n\n" ); } }
void MIOSEHCIInit2( void ) { GetRevision( SP+1, SP ); if( SP[1] <= 1 ) { write32( 0xD8001E0, 0x65244A ); write32( 0xD8001E4, 0x46A024 ); return; } // dbgprintf("Unsupported CPU version!\n"); }
void MIOSHWInit( u32 A, u32 B ) { GetRevision( SP+1, SP ); set32( HW_EXICTRL, 1 ); MIOSDoStuff( SP[1], SP[0] ); MIOSUnkInit(); MIOSEHCIInit( SP[1] ); set32( HW_RESETS, 0x7FDFBCF ); MIOSEHCIInit2(); }
int ReadFMailCfg(char *pchFileName, USERDATAOPT *pUserdata, OUTBOUND *pOutbounds, PAREALIST pRetList, PDRIVEREMAP driveremap, ULONG ulOptions) { driveremap = driveremap; switch(GetRevision(pchFileName)) { case -1: return CFGFILE_OPEN; /* CFGFILE_OPEN */ case -2: return CFGFILE_READ; /* CFGFILE_READ */ case 0x5e00: /* Revision 1 */ return ReadRev1(pchFileName, pUserdata, pOutbounds, pRetList, ulOptions); default: return CFGFILE_VERSION; /* CFGFILE_VERSION */ } }
void FLevelCollectionModel::SCCDiffAgainstDepot(const FLevelModelList& InList, UEditorEngine* InEditor) { // Load the asset registry module FAssetToolsModule& AssetToolsModule = FModuleManager::GetModuleChecked<FAssetToolsModule>("AssetTools"); ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider(); // Iterate over each selected asset for (auto It = InList.CreateConstIterator(); It; ++It) { ULevel* Level = (*It)->GetLevelObject(); if (Level == NULL) { return; } UPackage* OriginalPackage = Level->GetOutermost(); FString PackageName = OriginalPackage->GetName(); // Make sure our history is up to date auto UpdateStatusOperation = ISourceControlOperation::Create<FUpdateStatus>(); UpdateStatusOperation->SetUpdateHistory(true); SourceControlProvider.Execute(UpdateStatusOperation, OriginalPackage); // Get the SCC state FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState( OriginalPackage, EStateCacheUsage::Use ); // If the level is in SCC. if (SourceControlState.IsValid() && SourceControlState->IsSourceControlled()) { // Get the file name of package FString RelativeFileName; if(FPackageName::DoesPackageExist(PackageName, NULL, &RelativeFileName)) { if (SourceControlState->GetHistorySize() > 0) { auto Revision = SourceControlState->GetHistoryItem(0); check(Revision.IsValid()); // Get the head revision of this package from source control FString AbsoluteFileName = FPaths::ConvertRelativePathToFull(RelativeFileName); FString TempFileName; if (Revision->Get(TempFileName)) { // Forcibly disable compile on load in case we are loading old blueprints that might try to update/compile TGuardValue<bool> DisableCompileOnLoad(GForceDisableBlueprintCompileOnLoad, true); // Try and load that package FText NotMapReason; UPackage* OldPackage = LoadPackage(NULL, *TempFileName, LOAD_None); if(OldPackage != NULL && InEditor->PackageIsAMapFile(*TempFileName, NotMapReason)) { /* Set the revision information*/ UPackage* Package = OriginalPackage; FRevisionInfo OldRevision; OldRevision.Changelist = Revision->GetCheckInIdentifier(); OldRevision.Date = Revision->GetDate(); OldRevision.Revision = Revision->GetRevision(); FRevisionInfo NewRevision; NewRevision.Revision = TEXT(""); // Dump assets to temp text files FString OldTextFilename = AssetToolsModule.Get().DumpAssetToTempFile(OldPackage); FString NewTextFilename = AssetToolsModule.Get().DumpAssetToTempFile(OriginalPackage); FString DiffCommand = GetDefault<UEditorLoadingSavingSettings>()->TextDiffToolPath.FilePath; AssetToolsModule.Get().CreateDiffProcess(DiffCommand, OldTextFilename, NewTextFilename); AssetToolsModule.Get().DiffAssets(OldPackage, OriginalPackage, OldRevision, NewRevision); } } } } } } }
std::string CVolumeGC::GetRevisionSpecificUniqueID() const { return GetUniqueID() + StringFromFormat("r%d", GetRevision()); }
// called from ---GUI--- thread bool NetPlayServer::SyncSaveData() { m_save_data_synced_players = 0; u8 save_count = 0; constexpr size_t exi_device_count = 2; for (size_t i = 0; i < exi_device_count; i++) { if (m_settings.m_EXIDevice[i] == ExpansionInterface::EXIDEVICE_MEMORYCARD || SConfig::GetInstance().m_EXIDevice[i] == ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER) { save_count++; } } const auto game = m_dialog->FindGameFile(m_selected_game); if (game == nullptr) { PanicAlertT("Selected game doesn't exist in game list!"); return false; } bool wii_save = false; if (m_settings.m_CopyWiiSave && (game->GetPlatform() == DiscIO::Platform::WiiDisc || game->GetPlatform() == DiscIO::Platform::WiiWAD)) { wii_save = true; save_count++; } { sf::Packet pac; pac << static_cast<MessageId>(NP_MSG_SYNC_SAVE_DATA); pac << static_cast<MessageId>(SYNC_SAVE_DATA_NOTIFY); pac << save_count; SendAsyncToClients(std::move(pac)); } if (save_count == 0) return true; const std::string region = SConfig::GetDirectoryForRegion(SConfig::ToGameCubeRegion(game->GetRegion())); for (size_t i = 0; i < exi_device_count; i++) { const bool is_slot_a = i == 0; if (m_settings.m_EXIDevice[i] == ExpansionInterface::EXIDEVICE_MEMORYCARD) { std::string path = is_slot_a ? Config::Get(Config::MAIN_MEMCARD_A_PATH) : Config::Get(Config::MAIN_MEMCARD_B_PATH); MemoryCard::CheckPath(path, region, is_slot_a); bool mc251; IniFile gameIni = SConfig::LoadGameIni(game->GetGameID(), game->GetRevision()); gameIni.GetOrCreateSection("Core")->Get("MemoryCard251", &mc251, false); if (mc251) path.insert(path.find_last_of('.'), ".251"); sf::Packet pac; pac << static_cast<MessageId>(NP_MSG_SYNC_SAVE_DATA); pac << static_cast<MessageId>(SYNC_SAVE_DATA_RAW); pac << is_slot_a << region << mc251; if (File::Exists(path)) { if (!CompressFileIntoPacket(path, pac)) return false; } else { // No file, so we'll say the size is 0 pac << sf::Uint64{0}; } SendAsyncToClients(std::move(pac)); } else if (SConfig::GetInstance().m_EXIDevice[i] == ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER) { const std::string path = File::GetUserPath(D_GCUSER_IDX) + region + DIR_SEP + StringFromFormat("Card %c", is_slot_a ? 'A' : 'B'); sf::Packet pac; pac << static_cast<MessageId>(NP_MSG_SYNC_SAVE_DATA); pac << static_cast<MessageId>(SYNC_SAVE_DATA_GCI); pac << is_slot_a; if (File::IsDirectory(path)) { std::vector<std::string> files = GCMemcardDirectory::GetFileNamesForGameID(path + DIR_SEP, game->GetGameID()); pac << static_cast<u8>(files.size()); for (const std::string& file : files) { pac << file.substr(file.find_last_of('/') + 1); if (!CompressFileIntoPacket(file, pac)) return false; } } else { pac << static_cast<u8>(0); } SendAsyncToClients(std::move(pac)); } } if (wii_save) { const auto configured_fs = IOS::HLE::FS::MakeFileSystem(IOS::HLE::FS::Location::Configured); const auto save = WiiSave::MakeNandStorage(configured_fs.get(), game->GetTitleID()); sf::Packet pac; pac << static_cast<MessageId>(NP_MSG_SYNC_SAVE_DATA); pac << static_cast<MessageId>(SYNC_SAVE_DATA_WII); if (save->SaveExists()) { const std::optional<WiiSave::Header> header = save->ReadHeader(); const std::optional<WiiSave::BkHeader> bk_header = save->ReadBkHeader(); const std::optional<std::vector<WiiSave::Storage::SaveFile>> files = save->ReadFiles(); if (!header || !bk_header || !files) return false; pac << true; // save exists // Header pac << sf::Uint64{header->tid}; pac << header->banner_size << header->permissions << header->unk1; for (size_t i = 0; i < header->md5.size(); i++) pac << header->md5[i]; pac << header->unk2; for (size_t i = 0; i < header->banner_size; i++) pac << header->banner[i]; // BkHeader pac << bk_header->size << bk_header->magic << bk_header->ngid << bk_header->number_of_files << bk_header->size_of_files << bk_header->unk1 << bk_header->unk2 << bk_header->total_size; for (size_t i = 0; i < bk_header->unk3.size(); i++) pac << bk_header->unk3[i]; pac << sf::Uint64{bk_header->tid}; for (size_t i = 0; i < bk_header->mac_address.size(); i++) pac << bk_header->mac_address[i]; // Files for (const WiiSave::Storage::SaveFile& file : *files) { pac << file.mode << file.attributes << static_cast<u8>(file.type) << file.path; if (file.type == WiiSave::Storage::SaveFile::Type::File) { const std::optional<std::vector<u8>>& data = *file.data; if (!data || !CompressBufferIntoPacket(*data, pac)) return false; } } } else { pac << false; // save does not exist } SendAsyncToClients(std::move(pac)); } return true; }
int CLuaInstMisc::GetRevision_old(lua_State *L) { MISC_FUNC_DEPRECATED(L, "GetRevision"); return GetRevision(L); }