MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / UpdateDiscDetails

Method UpdateDiscDetails

pcsx2/VMManager.cpp:1036–1162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1034}
1035
1036void VMManager::UpdateDiscDetails(bool booting)
1037{
1038 std::string memcardFilters;
1039 {
1040 // Only need to protect writes with the mutex.
1041 std::unique_lock lock(s_info_mutex);
1042 const std::string old_serial = std::move(s_disc_serial);
1043 const u32 old_crc = s_disc_crc;
1044 bool serial_is_valid = false;
1045 std::string title;
1046
1047 if (GSDumpReplayer::IsReplayingDump())
1048 {
1049 s_disc_serial = GSDumpReplayer::GetDumpSerial();
1050 s_disc_crc = GSDumpReplayer::GetDumpCRC();
1051 s_disc_elf = {};
1052 s_disc_version = {};
1053 serial_is_valid = !s_disc_serial.empty();
1054 }
1055 else if (CDVDsys_GetSourceType() != CDVD_SourceType::NoDisc)
1056 {
1057 cdvdGetDiscInfo(&s_disc_serial, &s_disc_elf, &s_disc_version, &s_disc_crc, nullptr);
1058 serial_is_valid = !s_disc_serial.empty();
1059 }
1060 else if (!s_elf_override.empty())
1061 {
1062 s_disc_serial = Path::GetFileTitle(s_elf_override);
1063 s_disc_version = {};
1064 s_disc_crc = 0; // set below
1065 }
1066 else
1067 {
1068 s_disc_serial = BiosSerial;
1069 s_disc_version = {};
1070 s_disc_crc = 0;
1071 title = fmt::format(TRANSLATE_FS("VMManager", "PS2 BIOS ({})"), BiosZone);
1072 }
1073
1074 // If we're booting an ELF, use its CRC, not the disc (if any).
1075 if (!s_elf_override.empty())
1076 s_disc_crc = cdvdGetElfCRC(s_elf_override);
1077
1078 if (!booting && s_disc_serial == old_serial && s_disc_crc == old_crc)
1079 {
1080 Console.WriteLn("Skipping disc details update, no change.");
1081 return;
1082 }
1083
1084 SaveSessionTime(old_serial);
1085
1086 s_title_en_search.clear();
1087 s_title_en_replace.clear();
1088 std::string custom_title = GameList::GetCustomTitleForPath(CDVDsys_GetFile(CDVDsys_GetSourceType()));
1089 if (serial_is_valid)
1090 {
1091 if (const GameDatabaseSchema::GameEntry* game = GameDatabase::findGame(s_disc_serial))
1092 {
1093 if (!game->name_en.empty())

Callers

nothing calls this directly

Calls 11

CDVDsys_GetSourceTypeFunction · 0.85
cdvdGetDiscInfoFunction · 0.85
cdvdGetElfCRCFunction · 0.85
FileMcd_ReopenFunction · 0.85
formatFunction · 0.50
emptyMethod · 0.45
WriteLnMethod · 0.45
clearMethod · 0.45
WarningMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected