diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index dfa7bbf06..29c4b22d6 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -61,8 +61,8 @@ add_library(core host_settings.h interrupt_controller.cpp interrupt_controller.h - libcrypt_game_codes.cpp - libcrypt_game_codes.h + libcrypt_serials.cpp + libcrypt_serials.h mdec.cpp mdec.h memory_card.cpp diff --git a/src/core/cheats.cpp b/src/core/cheats.cpp index 7c8161fbe..8822702bf 100644 --- a/src/core/cheats.cpp +++ b/src/core/cheats.cpp @@ -684,7 +684,7 @@ bool CheatList::SaveToPCSXRFile(const char* filename) return (std::ferror(fp.get()) == 0); } -bool CheatList::LoadFromPackage(const std::string& game_code) +bool CheatList::LoadFromPackage(const std::string& serial) { const std::optional db_string(Host::ReadResourceFileToString("chtdb.txt")); if (!db_string.has_value()) @@ -712,7 +712,7 @@ bool CheatList::LoadFromPackage(const std::string& game_code) if (start == end) continue; - if (start[0] != ':' || std::strcmp(&start[1], game_code.c_str()) != 0) + if (start[0] != ':' || std::strcmp(&start[1], serial.c_str()) != 0) continue; // game code match @@ -788,11 +788,11 @@ bool CheatList::LoadFromPackage(const std::string& game_code) if (current_code.Valid()) m_codes.push_back(std::move(current_code)); - Log_InfoPrintf("Loaded %zu codes from package for %s", m_codes.size(), game_code.c_str()); + Log_InfoPrintf("Loaded %zu codes from package for %s", m_codes.size(), serial.c_str()); return !m_codes.empty(); } - Log_WarningPrintf("No codes found in package for %s", game_code.c_str()); + Log_WarningPrintf("No codes found in package for %s", serial.c_str()); return false; } diff --git a/src/core/cheats.h b/src/core/cheats.h index 30f87c1d4..c1761ffcb 100644 --- a/src/core/cheats.h +++ b/src/core/cheats.h @@ -183,7 +183,7 @@ public: bool SaveToPCSXRFile(const char* filename); - bool LoadFromPackage(const std::string& game_code); + bool LoadFromPackage(const std::string& serial); void Apply(); diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj index f9c735d1c..af3ec2215 100644 --- a/src/core/core.vcxproj +++ b/src/core/core.vcxproj @@ -55,7 +55,7 @@ - + @@ -129,7 +129,7 @@ - + @@ -165,4 +165,4 @@ - + \ No newline at end of file diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters index f6f793a03..f809c9330 100644 --- a/src/core/core.vcxproj.filters +++ b/src/core/core.vcxproj.filters @@ -53,7 +53,7 @@ - + @@ -114,7 +114,7 @@ - + diff --git a/src/core/game_database.cpp b/src/core/game_database.cpp index 1c573b3d0..af2fe4a17 100644 --- a/src/core/game_database.cpp +++ b/src/core/game_database.cpp @@ -32,6 +32,7 @@ enum : u32 }; static Entry* GetMutableEntry(const std::string_view& serial); +static const Entry* GetEntryForId(const std::string_view& code); static bool LoadFromCache(); static bool SaveToCache(); @@ -105,7 +106,7 @@ void GameDatabase::Unload() s_loaded = false; } -const GameDatabase::Entry* GameDatabase::GetEntryForCode(const std::string_view& code) +const GameDatabase::Entry* GameDatabase::GetEntryForId(const std::string_view& code) { EnsureLoaded(); @@ -140,24 +141,23 @@ std::string GameDatabase::GetSerialForPath(const char* path) const GameDatabase::Entry* GameDatabase::GetEntryForDisc(CDImage* image) { - std::string exe_name_code(System::GetGameCodeForImage(image, false)); - if (!exe_name_code.empty()) + std::string id(System::GetGameIdFromImage(image, false)); + if (!id.empty()) { - const Entry* entry = GetEntryForCode(exe_name_code); + const Entry* entry = GetEntryForId(id); if (entry) return entry; } - std::string exe_hash_code(System::GetGameHashCodeForImage(image)); - if (!exe_hash_code.empty()) + std::string hash_id(System::GetGameHashIdFromImage(image)); + if (!hash_id.empty()) { - const Entry* entry = GetEntryForCode(exe_hash_code); + const Entry* entry = GetEntryForId(hash_id); if (entry) return entry; } - Log_WarningPrintf("No entry found for disc (exe code: '%s', hash code: '%s')", exe_name_code.c_str(), - exe_hash_code.c_str()); + Log_WarningPrintf("No entry found for disc (exe code: '%s', hash code: '%s')", id.c_str(), hash_id.c_str()); return nullptr; } @@ -365,7 +365,8 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { Host::AddKeyedOSDMessage( "gamedb_disable_pgxp_texture", - Host::TranslateStdString("OSDMessage", "PGXP perspective corrected textures disabled by game settings."), osd_duration); + Host::TranslateStdString("OSDMessage", "PGXP perspective corrected textures disabled by game settings."), + osd_duration); } settings.gpu_pgxp_texture_correction = false; @@ -378,7 +379,8 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { Host::AddKeyedOSDMessage( "gamedb_disable_pgxp_texture", - Host::TranslateStdString("OSDMessage", "PGXP perspective corrected colors disabled by game settings."), osd_duration); + Host::TranslateStdString("OSDMessage", "PGXP perspective corrected colors disabled by game settings."), + osd_duration); } settings.gpu_pgxp_color_correction = false; diff --git a/src/core/game_database.h b/src/core/game_database.h index bbfc894f8..d393a5d48 100644 --- a/src/core/game_database.h +++ b/src/core/game_database.h @@ -86,7 +86,6 @@ void Unload(); const Entry* GetEntryForDisc(CDImage* image); const Entry* GetEntryForSerial(const std::string_view& serial); -const Entry* GetEntryForCode(const std::string_view& code); std::string GetSerialForDisc(CDImage* image); std::string GetSerialForPath(const char* path); diff --git a/src/core/libcrypt_game_codes.cpp b/src/core/libcrypt_serials.cpp similarity index 99% rename from src/core/libcrypt_game_codes.cpp rename to src/core/libcrypt_serials.cpp index 78a0aac0e..1c20d55aa 100644 --- a/src/core/libcrypt_game_codes.cpp +++ b/src/core/libcrypt_serials.cpp @@ -1,4 +1,4 @@ -#include "libcrypt_game_codes.h" +#include "libcrypt_serials.h" namespace LibcryptGameList { diff --git a/src/core/libcrypt_game_codes.h b/src/core/libcrypt_serials.h similarity index 100% rename from src/core/libcrypt_game_codes.h rename to src/core/libcrypt_serials.h diff --git a/src/core/save_state_version.h b/src/core/save_state_version.h index ded26d505..9ed21708c 100644 --- a/src/core/save_state_version.h +++ b/src/core/save_state_version.h @@ -13,7 +13,7 @@ struct SAVE_STATE_HEADER enum : u32 { MAX_TITLE_LENGTH = 128, - MAX_GAME_CODE_LENGTH = 32, + MAX_SERIAL_LENGTH = 32, COMPRESSION_TYPE_NONE = 0, COMPRESSION_TYPE_ZLIB = 1, @@ -23,7 +23,7 @@ struct SAVE_STATE_HEADER u32 magic; u32 version; char title[MAX_TITLE_LENGTH]; - char game_code[MAX_GAME_CODE_LENGTH]; + char serial[MAX_SERIAL_LENGTH]; u32 media_filename_length; u32 offset_to_media_filename; diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 8a394c395..e0b754480 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -1112,8 +1112,8 @@ static std::array s_memory_card_type_names = { {"None", "Shared", "PerGame", "PerGameTitle", "PerGameFileTitle", "NonPersistent"}}; static std::array s_memory_card_type_display_names = { {TRANSLATABLE("MemoryCardType", "No Memory Card"), TRANSLATABLE("MemoryCardType", "Shared Between All Games"), - TRANSLATABLE("MemoryCardType", "Separate Card Per Game (Game Code)"), - TRANSLATABLE("MemoryCardType", "Separate Card Per Game (Game Title)"), + TRANSLATABLE("MemoryCardType", "Separate Card Per Game (Serial)"), + TRANSLATABLE("MemoryCardType", "Separate Card Per Game (Title)"), TRANSLATABLE("MemoryCardType", "Separate Card Per Game (File Title)"), TRANSLATABLE("MemoryCardType", "Non-Persistent Card (Do Not Save)")}}; @@ -1160,9 +1160,9 @@ std::string Settings::GetSharedMemoryCardPath(u32 slot) const return ret; } -std::string Settings::GetGameMemoryCardPath(const char* game_code, u32 slot) +std::string Settings::GetGameMemoryCardPath(const char* serial, u32 slot) { - return Path::Combine(EmuFolders::MemoryCards, fmt::format("{}_{}.mcd", game_code, slot + 1)); + return Path::Combine(EmuFolders::MemoryCards, fmt::format("{}_{}.mcd", serial, slot + 1)); } static std::array s_multitap_enable_mode_names = {{"Disabled", "Port1Only", "Port2Only", "BothPorts"}}; diff --git a/src/core/settings.h b/src/core/settings.h index a9f95442e..903c6450f 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -294,7 +294,7 @@ struct Settings std::string GetSharedMemoryCardPath(u32 slot) const; /// Returns the default path to a memory card for a specific game. - static std::string GetGameMemoryCardPath(const char* game_code, u32 slot); + static std::string GetGameMemoryCardPath(const char* serial, u32 slot); static void CPUOverclockPercentToFraction(u32 percent, u32* numerator, u32* denominator); static u32 CPUOverclockFractionToPercent(u32 numerator, u32 denominator); diff --git a/src/core/system.cpp b/src/core/system.cpp index 26973dc01..61c071f7a 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -26,7 +26,7 @@ #include "host_interface_progress_callback.h" #include "host_settings.h" #include "interrupt_controller.h" -#include "libcrypt_game_codes.h" +#include "libcrypt_serials.h" #include "mdec.h" #include "memory_card.h" #include "multitap.h" @@ -135,7 +135,7 @@ static u32 s_frame_number = 1; static u32 s_internal_frame_number = 1; static std::string s_running_game_path; -static std::string s_running_game_code; +static std::string s_running_game_serial; static std::string s_running_game_title; static bool s_running_bios; @@ -305,9 +305,9 @@ const std::string& System::GetRunningPath() { return s_running_game_path; } -const std::string& System::GetRunningCode() +const std::string& System::GetRunningSerial() { - return s_running_game_code; + return s_running_game_serial; } const std::string& System::GetRunningTitle() @@ -419,16 +419,16 @@ ConsoleRegion System::GetConsoleRegionForDiscRegion(DiscRegion region) } } -std::string System::GetGameCodeForPath(const char* image_path, bool fallback_to_hash) +std::string System::GetGameSerialForPath(const char* image_path, bool fallback_to_hash) { std::unique_ptr cdi = CDImage::Open(image_path, false, nullptr); if (!cdi) return {}; - return GetGameCodeForImage(cdi.get(), fallback_to_hash); + return GetGameIdFromImage(cdi.get(), fallback_to_hash); } -std::string System::GetGameCodeForImage(CDImage* cdi, bool fallback_to_hash) +std::string System::GetGameIdFromImage(CDImage* cdi, bool fallback_to_hash) { std::string code(GetExecutableNameForImage(cdi)); if (!code.empty()) @@ -456,10 +456,10 @@ std::string System::GetGameCodeForImage(CDImage* cdi, bool fallback_to_hash) if (!fallback_to_hash) return {}; - return GetGameHashCodeForImage(cdi); + return GetGameHashIdFromImage(cdi); } -std::string System::GetGameHashCodeForImage(CDImage* cdi) +std::string System::GetGameHashIdFromImage(CDImage* cdi) { ISOReader iso; if (!iso.Open(cdi, 1)) @@ -623,12 +623,12 @@ bool System::ReadExecutableFromImage(CDImage* cdi, std::string* out_executable_n return ReadExecutableFromImage(iso, out_executable_name, out_executable_data); } -DiscRegion System::GetRegionForCode(std::string_view code) +DiscRegion System::GetRegionForSerial(std::string_view serial) { std::string prefix; - for (size_t pos = 0; pos < code.length(); pos++) + for (size_t pos = 0; pos < serial.length(); pos++) { - const int ch = std::tolower(code[pos]); + const int ch = std::tolower(serial[pos]); if (ch < 'a' || ch > 'z') break; @@ -673,11 +673,11 @@ DiscRegion System::GetRegionForImage(CDImage* cdi) if (system_area_region != DiscRegion::Other) return system_area_region; - std::string code = GetGameCodeForImage(cdi, false); - if (code.empty()) + std::string serial = GetGameIdFromImage(cdi, false); + if (serial.empty()) return DiscRegion::Other; - return GetRegionForCode(code); + return GetRegionForSerial(serial); } DiscRegion System::GetRegionForExe(const char* path) @@ -778,9 +778,9 @@ void System::LoadSettings(bool display_osd_messages) Host::LoadSettings(si, lock); // apply compatibility settings - if (g_settings.apply_compatibility_settings && !s_running_game_code.empty()) + if (g_settings.apply_compatibility_settings && !s_running_game_serial.empty()) { - const GameDatabase::Entry* entry = GameDatabase::GetEntryForSerial(s_running_game_code); + const GameDatabase::Entry* entry = GameDatabase::GetEntryForSerial(s_running_game_serial); if (entry) entry->ApplySettings(g_settings, display_osd_messages); } @@ -828,9 +828,9 @@ bool System::ReloadGameSettings(bool display_osd_messages) bool System::UpdateGameSettingsLayer() { std::unique_ptr new_interface; - if (g_settings.apply_game_settings && !s_running_game_code.empty()) + if (g_settings.apply_game_settings && !s_running_game_serial.empty()) { - std::string filename(GetGameSettingsPath(s_running_game_code)); + std::string filename(GetGameSettingsPath(s_running_game_serial)); if (FileSystem::FileExists(filename.c_str())) { Log_InfoPrintf("Loading game settings from '%s'...", filename.c_str()); @@ -1039,10 +1039,10 @@ bool System::SaveState(const char* filename, bool backup_existing_save) bool System::SaveResumeState() { - if (s_running_game_code.empty()) + if (s_running_game_serial.empty()) return false; - const std::string path(GetGameSaveStateFileName(s_running_game_code, -1)); + const std::string path(GetGameSaveStateFileName(s_running_game_serial, -1)); return SaveState(path.c_str(), false); } @@ -1430,14 +1430,14 @@ void System::DestroySystem() void System::ClearRunningGame() { - s_running_game_code.clear(); + s_running_game_serial.clear(); s_running_game_path.clear(); s_running_game_title.clear(); s_running_bios = false; s_cheat_list.reset(); s_state = State::Shutdown; - Host::OnGameChanged(s_running_game_path, s_running_game_code, s_running_game_title); + Host::OnGameChanged(s_running_game_path, s_running_game_serial, s_running_game_title); #ifdef WITH_CHEEVOS Achievements::GameChanged(s_running_game_path, nullptr); @@ -1906,7 +1906,7 @@ bool System::InternalSaveState(ByteStream* state, u32 screenshot_size /* = 256 * header.magic = SAVE_STATE_MAGIC; header.version = SAVE_STATE_VERSION; StringUtil::Strlcpy(header.title, s_running_game_title.c_str(), sizeof(header.title)); - StringUtil::Strlcpy(header.game_code, s_running_game_code.c_str(), sizeof(header.game_code)); + StringUtil::Strlcpy(header.serial, s_running_game_serial.c_str(), sizeof(header.serial)); if (g_cdrom.HasMedia()) { @@ -2634,7 +2634,7 @@ std::unique_ptr System::GetMemoryCardForSlot(u32 slot, MemoryCardTyp { case MemoryCardType::PerGame: { - if (s_running_game_code.empty()) + if (s_running_game_serial.empty()) { Host::AddFormattedOSDMessage( 5.0f, @@ -2645,7 +2645,7 @@ std::unique_ptr System::GetMemoryCardForSlot(u32 slot, MemoryCardTyp } else { - return MemoryCard::Open(g_settings.GetGameMemoryCardPath(s_running_game_code.c_str(), slot)); + return MemoryCard::Open(g_settings.GetGameMemoryCardPath(s_running_game_serial.c_str(), slot)); } } @@ -2857,13 +2857,13 @@ bool System::InsertMedia(const char* path) UpdateRunningGame(path, image.get(), false); g_cdrom.InsertMedia(std::move(image)); - Log_InfoPrintf("Inserted media from %s (%s, %s)", s_running_game_path.c_str(), s_running_game_code.c_str(), + Log_InfoPrintf("Inserted media from %s (%s, %s)", s_running_game_path.c_str(), s_running_game_serial.c_str(), s_running_game_title.c_str()); if (g_settings.cdrom_load_image_to_ram) g_cdrom.PrecacheMedia(); Host::AddFormattedOSDMessage(10.0f, Host::TranslateString("OSDMessage", "Inserted disc '%s' (%s)."), - s_running_game_title.c_str(), s_running_game_code.c_str()); + s_running_game_title.c_str(), s_running_game_serial.c_str()); if (g_settings.HasAnyPerGameMemoryCards()) { @@ -2887,7 +2887,7 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting) return; s_running_game_path.clear(); - s_running_game_code.clear(); + s_running_game_serial.clear(); s_running_game_title.clear(); if (path && std::strlen(path) > 0) @@ -2904,13 +2904,13 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting) const GameDatabase::Entry* entry = GameDatabase::GetEntryForDisc(image); if (entry) { - s_running_game_code = entry->serial; + s_running_game_serial = entry->serial; s_running_game_title = entry->title; } else { const std::string display_name(FileSystem::GetDisplayNameFromPath(path)); - s_running_game_code = GetGameCodeForImage(image, true); + s_running_game_serial = GetGameIdFromImage(image, true); s_running_game_title = Path::GetFileTitle(display_name); } @@ -2923,7 +2923,7 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting) } } - g_texture_replacements.SetGameID(s_running_game_code); + g_texture_replacements.SetGameID(s_running_game_serial); s_cheat_list.reset(); if (g_settings.auto_load_cheats && !Achievements::ChallengeModeActive()) @@ -2932,7 +2932,7 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting) UpdateGameSettingsLayer(); ApplySettings(true); - Host::OnGameChanged(s_running_game_path, s_running_game_code, s_running_game_title); + Host::OnGameChanged(s_running_game_path, s_running_game_serial, s_running_game_title); #ifdef WITH_CHEEVOS if (booting) @@ -2944,13 +2944,13 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting) bool System::CheckForSBIFile(CDImage* image) { - if (s_running_game_code.empty() || !LibcryptGameList::IsLibcryptGameCode(s_running_game_code) || !image || + if (s_running_game_serial.empty() || !LibcryptGameList::IsLibcryptGameCode(s_running_game_serial) || !image || image->HasNonStandardSubchannel()) { return true; } - Log_WarningPrintf("SBI file missing but required for %s (%s)", s_running_game_code.c_str(), + Log_WarningPrintf("SBI file missing but required for %s (%s)", s_running_game_serial.c_str(), s_running_game_title.c_str()); if (Host::GetBoolSettingValue("CDROM", "AllowBootingWithoutSBIFile", false)) @@ -2963,7 +2963,7 @@ bool System::CheckForSBIFile(CDImage* image) "You are attempting to run a libcrypt protected game without an SBI file:\n\n%s: %s\n\nThe game will " "likely not run properly.\n\nPlease check the README for instructions on how to add an SBI file.\n\nDo " "you wish to continue?"), - s_running_game_code.c_str(), s_running_game_title.c_str()) + s_running_game_serial.c_str(), s_running_game_title.c_str()) .c_str()); } else @@ -2976,7 +2976,7 @@ bool System::CheckForSBIFile(CDImage* image) "You are attempting to run a libcrypt protected game without an SBI file:\n\n%s: %s\n\nYour dump is " "incomplete, you must add the SBI file to run this game. \n\n" "The name of the SBI file must match the name of the disc image."), - s_running_game_code.c_str(), s_running_game_title.c_str())); + s_running_game_serial.c_str(), s_running_game_title.c_str())); return false; } } @@ -3695,15 +3695,15 @@ bool System::StartDumpingAudio(const char* filename) std::string auto_filename; if (!filename) { - const auto& code = System::GetRunningCode(); - if (code.empty()) + const auto& serial = System::GetRunningSerial(); + if (serial.empty()) { auto_filename = Path::Combine( EmuFolders::Dumps, fmt::format("audio" FS_OSPATH_SEPARATOR_STR "{}.wav", GetTimestampStringForFileName())); } else { - auto_filename = Path::Combine(EmuFolders::Dumps, fmt::format("audio" FS_OSPATH_SEPARATOR_STR "{}_{}.wav", code, + auto_filename = Path::Combine(EmuFolders::Dumps, fmt::format("audio" FS_OSPATH_SEPARATOR_STR "{}_{}.wav", serial, GetTimestampStringForFileName())); } @@ -3740,7 +3740,7 @@ bool System::SaveScreenshot(const char* filename /* = nullptr */, bool full_reso std::string auto_filename; if (!filename) { - const auto& code = System::GetRunningCode(); + const auto& code = System::GetRunningSerial(); const char* extension = "png"; if (code.empty()) { @@ -3779,12 +3779,12 @@ bool System::SaveScreenshot(const char* filename /* = nullptr */, bool full_reso return true; } -std::string System::GetGameSaveStateFileName(const std::string_view& game_code, s32 slot) +std::string System::GetGameSaveStateFileName(const std::string_view& serial, s32 slot) { if (slot < 0) - return Path::Combine(EmuFolders::SaveStates, fmt::format("{}_resume.sav", game_code)); + return Path::Combine(EmuFolders::SaveStates, fmt::format("{}_resume.sav", serial)); else - return Path::Combine(EmuFolders::SaveStates, fmt::format("{}_{}.sav", game_code, slot)); + return Path::Combine(EmuFolders::SaveStates, fmt::format("{}_{}.sav", serial, slot)); } std::string System::GetGlobalSaveStateFileName(s32 slot) @@ -3795,7 +3795,7 @@ std::string System::GetGlobalSaveStateFileName(s32 slot) return Path::Combine(EmuFolders::SaveStates, fmt::format("savestate_{}.sav", slot)); } -std::vector System::GetAvailableSaveStates(const char* game_code) +std::vector System::GetAvailableSaveStates(const char* serial) { std::vector si; std::string path; @@ -3808,11 +3808,11 @@ std::vector System::GetAvailableSaveStates(const char* game_code) si.push_back(SaveStateInfo{std::move(path), sd.ModificationTime, static_cast(slot), global}); }; - if (game_code && std::strlen(game_code) > 0) + if (serial && std::strlen(serial) > 0) { - add_path(GetGameSaveStateFileName(game_code, -1), -1, false); + add_path(GetGameSaveStateFileName(serial, -1), -1, false); for (s32 i = 1; i <= PER_GAME_SAVE_STATE_SLOTS; i++) - add_path(GetGameSaveStateFileName(game_code, i), i, false); + add_path(GetGameSaveStateFileName(serial, i), i, false); } for (s32 i = 1; i <= GLOBAL_SAVE_STATE_SLOTS; i++) @@ -3821,10 +3821,10 @@ std::vector System::GetAvailableSaveStates(const char* game_code) return si; } -std::optional System::GetSaveStateInfo(const char* game_code, s32 slot) +std::optional System::GetSaveStateInfo(const char* serial, s32 slot) { - const bool global = (!game_code || game_code[0] == 0); - std::string path = global ? GetGlobalSaveStateFileName(slot) : GetGameSaveStateFileName(game_code, slot); + const bool global = (!serial || serial[0] == 0); + std::string path = global ? GetGlobalSaveStateFileName(slot) : GetGameSaveStateFileName(serial, slot); FILESYSTEM_STAT_DATA sd; if (!FileSystem::StatFile(path.c_str(), &sd)) @@ -3868,8 +3868,8 @@ std::optional System::InternalGetExtendedSaveStateInfo(By header.title[sizeof(header.title) - 1] = 0; ssi.title = header.title; - header.game_code[sizeof(header.game_code) - 1] = 0; - ssi.game_code = header.game_code; + header.serial[sizeof(header.serial) - 1] = 0; + ssi.serial = header.serial; if (header.media_filename_length > 0 && (header.offset_to_media_filename + header.media_filename_length) <= stream->GetSize()) @@ -3899,9 +3899,9 @@ std::optional System::InternalGetExtendedSaveStateInfo(By return ssi; } -void System::DeleteSaveStates(const char* game_code, bool resume) +void System::DeleteSaveStates(const char* serial, bool resume) { - const std::vector states(GetAvailableSaveStates(game_code)); + const std::vector states(GetAvailableSaveStates(serial)); for (const SaveStateInfo& si : states) { if (si.global || (!resume && si.slot < 0)) @@ -3982,11 +3982,11 @@ bool System::LoadCheatListFromGameTitle() bool System::LoadCheatListFromDatabase() { - if (IsShutdown() || s_running_game_code.empty() || Achievements::ChallengeModeActive()) + if (IsShutdown() || s_running_game_serial.empty() || Achievements::ChallengeModeActive()) return false; std::unique_ptr cl = std::make_unique(); - if (!cl->LoadFromPackage(s_running_game_code)) + if (!cl->LoadFromPackage(s_running_game_serial)) return false; Log_InfoPrintf("Loaded %u cheats from database.", cl->GetCodeCount()); diff --git a/src/core/system.h b/src/core/system.h index 145633c74..03322781e 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -45,7 +45,7 @@ struct SaveStateInfo struct ExtendedSaveStateInfo { std::string title; - std::string game_code; + std::string serial; std::string media_path; std::time_t timestamp; @@ -98,10 +98,10 @@ ConsoleRegion GetConsoleRegionForDiscRegion(DiscRegion region); std::string GetExecutableNameForImage(CDImage* cdi); bool ReadExecutableFromImage(CDImage* cdi, std::string* out_executable_name, std::vector* out_executable_data); -std::string GetGameHashCodeForImage(CDImage* cdi); -std::string GetGameCodeForImage(CDImage* cdi, bool fallback_to_hash); -std::string GetGameCodeForPath(const char* image_path, bool fallback_to_hash); -DiscRegion GetRegionForCode(std::string_view code); +std::string GetGameHashIdFromImage(CDImage* cdi); +std::string GetGameIdFromImage(CDImage* cdi, bool fallback_to_hash); +std::string GetGameSerialForPath(const char* image_path, bool fallback_to_hash); +DiscRegion GetRegionForSerial(std::string_view serial); DiscRegion GetRegionFromSystemArea(CDImage* cdi); DiscRegion GetRegionForImage(CDImage* cdi); DiscRegion GetRegionForExe(const char* path); @@ -168,7 +168,7 @@ void FrameDone(); void IncrementInternalFrameNumber(); const std::string& GetRunningPath(); -const std::string& GetRunningCode(); +const std::string& GetRunningSerial(); const std::string& GetRunningTitle(); bool IsRunningBIOS(); @@ -317,7 +317,7 @@ void DoFrameStep(); void DoToggleCheats(); /// Returns the path to a save state file. Specifying an index of -1 is the "resume" save state. -std::string GetGameSaveStateFileName(const std::string_view& game_code, s32 slot); +std::string GetGameSaveStateFileName(const std::string_view& serial, s32 slot); /// Returns the path to a save state file. Specifying an index of -1 is the "resume" save state. std::string GetGlobalSaveStateFileName(s32 slot); @@ -341,16 +341,16 @@ std::optional GetUndoSaveStateInfo(); bool UndoLoadState(); /// Returns a list of save states for the specified game code. -std::vector GetAvailableSaveStates(const char* game_code); +std::vector GetAvailableSaveStates(const char* serial); -/// Returns save state info if present. If game_code is null or empty, assumes global state. -std::optional GetSaveStateInfo(const char* game_code, s32 slot); +/// Returns save state info if present. If serial is null or empty, assumes global state. +std::optional GetSaveStateInfo(const char* serial, s32 slot); /// Returns save state info from opened save state stream. std::optional GetExtendedSaveStateInfo(const char* path); /// Deletes save states for the specified game code. If resume is set, the resume state is deleted too. -void DeleteSaveStates(const char* game_code, bool resume); +void DeleteSaveStates(const char* serial, bool resume); /// Returns intended output volume considering fast forwarding. s32 GetAudioOutputVolume(); diff --git a/src/duckstation-qt/gamelistmodel.cpp b/src/duckstation-qt/gamelistmodel.cpp index 72495bf3e..a8db4681f 100644 --- a/src/duckstation-qt/gamelistmodel.cpp +++ b/src/duckstation-qt/gamelistmodel.cpp @@ -566,7 +566,7 @@ void GameListModel::loadCommonImages() void GameListModel::setColumnDisplayNames() { m_column_display_names[Column_Type] = tr("Type"); - m_column_display_names[Column_Serial] = tr("Code"); + m_column_display_names[Column_Serial] = tr("Serial"); m_column_display_names[Column_Title] = tr("Title"); m_column_display_names[Column_FileTitle] = tr("File Title"); m_column_display_names[Column_Developer] = tr("Developer"); diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 67dc3d77f..6137c57ef 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -556,10 +556,10 @@ void MainWindow::onSystemDestroyed() } } -void MainWindow::onRunningGameChanged(const QString& filename, const QString& game_code, const QString& game_title) +void MainWindow::onRunningGameChanged(const QString& filename, const QString& game_serial, const QString& game_title) { m_current_game_title = game_title.toStdString(); - m_current_game_code = game_code.toStdString(); + m_current_game_serial = game_serial.toStdString(); updateWindowTitle(); // updateSaveStateMenus(path, serial, crc); @@ -770,10 +770,10 @@ static QString FormatTimestampForSaveStateMenu(u64 timestamp) return qtime.toString(QLocale::system().dateTimeFormat(QLocale::ShortFormat)); } -void MainWindow::populateLoadStateMenu(const char* game_code, QMenu* menu) +void MainWindow::populateLoadStateMenu(const char* game_serial, QMenu* menu) { - auto add_slot = [this, game_code, menu](const QString& title, const QString& empty_title, bool global, s32 slot) { - std::optional ssi = System::GetSaveStateInfo(global ? nullptr : game_code, slot); + auto add_slot = [this, game_serial, menu](const QString& title, const QString& empty_title, bool global, s32 slot) { + std::optional ssi = System::GetSaveStateInfo(global ? nullptr : game_serial, slot); const QString menu_title = ssi.has_value() ? title.arg(slot).arg(FormatTimestampForSaveStateMenu(ssi->timestamp)) : empty_title.arg(slot); @@ -802,7 +802,7 @@ void MainWindow::populateLoadStateMenu(const char* game_code, QMenu* menu) connect(load_from_state, &QAction::triggered, g_emu_thread, &EmuThread::undoLoadState); menu->addSeparator(); - if (game_code && std::strlen(game_code) > 0) + if (game_serial && std::strlen(game_serial) > 0) { for (u32 slot = 1; slot <= System::PER_GAME_SAVE_STATE_SLOTS; slot++) add_slot(tr("Game Save %1 (%2)"), tr("Game Save %1 (Empty)"), false, static_cast(slot)); @@ -814,10 +814,10 @@ void MainWindow::populateLoadStateMenu(const char* game_code, QMenu* menu) add_slot(tr("Global Save %1 (%2)"), tr("Global Save %1 (Empty)"), true, static_cast(slot)); } -void MainWindow::populateSaveStateMenu(const char* game_code, QMenu* menu) +void MainWindow::populateSaveStateMenu(const char* game_serial, QMenu* menu) { - auto add_slot = [game_code, menu](const QString& title, const QString& empty_title, bool global, s32 slot) { - std::optional ssi = System::GetSaveStateInfo(global ? nullptr : game_code, slot); + auto add_slot = [game_serial, menu](const QString& title, const QString& empty_title, bool global, s32 slot) { + std::optional ssi = System::GetSaveStateInfo(global ? nullptr : game_serial, slot); const QString menu_title = ssi.has_value() ? title.arg(slot).arg(FormatTimestampForSaveStateMenu(ssi->timestamp)) : empty_title.arg(slot); @@ -841,7 +841,7 @@ void MainWindow::populateSaveStateMenu(const char* game_code, QMenu* menu) }); menu->addSeparator(); - if (game_code && std::strlen(game_code) > 0) + if (game_serial && std::strlen(game_serial) > 0) { for (u32 slot = 1; slot <= System::PER_GAME_SAVE_STATE_SLOTS; slot++) add_slot(tr("Game Save %1 (%2)"), tr("Game Save %1 (Empty)"), false, static_cast(slot)); @@ -1094,12 +1094,12 @@ void MainWindow::onChangeDiscMenuAboutToHide() void MainWindow::onLoadStateMenuAboutToShow() { - populateLoadStateMenu(m_current_game_code.c_str(), m_ui.menuLoadState); + populateLoadStateMenu(m_current_game_serial.c_str(), m_ui.menuLoadState); } void MainWindow::onSaveStateMenuAboutToShow() { - populateSaveStateMenu(m_current_game_code.c_str(), m_ui.menuSaveState); + populateSaveStateMenu(m_current_game_serial.c_str(), m_ui.menuSaveState); } void MainWindow::onCheatsMenuAboutToShow() @@ -1161,7 +1161,7 @@ void MainWindow::onViewGamePropertiesActionTriggered() return; const std::string& path = System::GetRunningPath(); - const std::string& serial = System::GetRunningCode(); + const std::string& serial = System::GetRunningSerial(); if (path.empty() || serial.empty()) return; @@ -2375,7 +2375,7 @@ bool MainWindow::requestShutdown(bool allow_confirm /* = true */, bool allow_sav return true; // If we don't have a serial, we can't save state. - allow_save_to_state &= !m_current_game_code.empty(); + allow_save_to_state &= !m_current_game_serial.empty(); save_state &= allow_save_to_state; // Only confirm on UI thread because we need to display a msgbox. diff --git a/src/duckstation-qt/mainwindow.h b/src/duckstation-qt/mainwindow.h index e1590edfd..be3760c02 100644 --- a/src/duckstation-qt/mainwindow.h +++ b/src/duckstation-qt/mainwindow.h @@ -118,7 +118,7 @@ private Q_SLOTS: void onSystemDestroyed(); void onSystemPaused(); void onSystemResumed(); - void onRunningGameChanged(const QString& filename, const QString& game_code, const QString& game_title); + void onRunningGameChanged(const QString& filename, const QString& game_serial, const QString& game_title); void onAchievementsChallengeModeChanged(); void onApplicationStateChanged(Qt::ApplicationState state); @@ -221,8 +221,8 @@ private: /// Fills menu with save state info and handlers. void populateGameListContextMenu(const GameList::Entry* entry, QWidget* parent_window, QMenu* menu); - void populateLoadStateMenu(const char* game_code, QMenu* menu); - void populateSaveStateMenu(const char* game_code, QMenu* menu); + void populateLoadStateMenu(const char* game_serial, QMenu* menu); + void populateSaveStateMenu(const char* game_serial, QMenu* menu); /// Fills menu with the current playlist entries. The disc index is marked as checked. void populateChangeDiscSubImageMenu(QMenu* menu, QActionGroup* action_group); @@ -257,7 +257,7 @@ private: DebuggerWindow* m_debugger_window = nullptr; std::string m_current_game_title; - std::string m_current_game_code; + std::string m_current_game_serial; bool m_was_paused_by_focus_loss = false; bool m_open_debugger_on_start = false; diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index 9ac2cb80b..deaa36703 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -1096,11 +1096,11 @@ void EmuThread::loadState(bool global, qint32 slot) } // shouldn't even get here if we don't have a running game - if (!global && System::GetRunningCode().empty()) + if (!global && System::GetRunningSerial().empty()) return; bootOrLoadState(global ? System::GetGlobalSaveStateFileName(slot) : - System::GetGameSaveStateFileName(System::GetRunningCode(), slot)); + System::GetGameSaveStateFileName(System::GetRunningSerial(), slot)); } void EmuThread::saveState(const QString& filename, bool block_until_done /* = false */) @@ -1127,11 +1127,11 @@ void EmuThread::saveState(bool global, qint32 slot, bool block_until_done /* = f return; } - if (!global && System::GetRunningCode().empty()) + if (!global && System::GetRunningSerial().empty()) return; System::SaveState((global ? System::GetGlobalSaveStateFileName(slot) : - System::GetGameSaveStateFileName(System::GetRunningCode(), slot)) + System::GetGameSaveStateFileName(System::GetRunningSerial(), slot)) .c_str(), g_settings.create_save_state_backups); } diff --git a/src/duckstation-qt/qthost.h b/src/duckstation-qt/qthost.h index 6572217d1..b506f9122 100644 --- a/src/duckstation-qt/qthost.h +++ b/src/duckstation-qt/qthost.h @@ -134,7 +134,7 @@ Q_SIGNALS: void displaySizeRequested(qint32 width, qint32 height); void focusDisplayWidgetRequested(); void destroyDisplayRequested(); - void runningGameChanged(const QString& filename, const QString& game_code, const QString& game_title); + void runningGameChanged(const QString& filename, const QString& game_serial, const QString& game_title); void inputProfileLoaded(); void mouseModeRequested(bool relative, bool hide_cursor); void achievementsRefreshed(quint32 id, const QString& game_info_string, quint32 total, quint32 points); diff --git a/src/duckstation-regtest/regtest_host_interface.cpp b/src/duckstation-regtest/regtest_host_interface.cpp index 7149b7c39..a26ef36b6 100644 --- a/src/duckstation-regtest/regtest_host_interface.cpp +++ b/src/duckstation-regtest/regtest_host_interface.cpp @@ -103,7 +103,7 @@ void RegTestHostInterface::GetGameInfo(const char* path, CDImage* image, std::st return; } - *code = System::GetGameCodeForImage(image, true); + *code = System::GetGameIdFromImage(image, true); } *title = Path::GetFileTitle(path); @@ -181,13 +181,13 @@ void RegTestHostInterface::UpdateSettings() SettingsInterface& si = m_settings_interface; HostInterface::LoadSettings(si); - const std::string& code = System::GetRunningCode(); - if (!code.empty()) + const std::string& serial = System::GetRunningSerial(); + if (!serial.empty()) { - const GameSettings::Entry* entry = s_game_settings_db.GetEntry(code); + const GameSettings::Entry* entry = s_game_settings_db.GetEntry(serial); if (entry) { - Log_InfoPrintf("Applying game settings for '%s'", code.c_str()); + Log_InfoPrintf("Applying game settings for '%s'", serial.c_str()); entry->ApplySettings(true); } } diff --git a/src/frontend-common/common_host.cpp b/src/frontend-common/common_host.cpp index e78faa06b..69ef1af97 100644 --- a/src/frontend-common/common_host.cpp +++ b/src/frontend-common/common_host.cpp @@ -536,7 +536,7 @@ void CommonHost::UpdateDiscordPresence(bool rich_presence_only) if (!System::IsShutdown()) { details_string.AppendFormattedString("%s (%s)", System::GetRunningTitle().c_str(), - System::GetRunningCode().c_str()); + System::GetRunningSerial().c_str()); } else { @@ -600,7 +600,7 @@ static void HotkeyLoadStateSlot(bool global, s32 slot) if (!System::IsValid()) return; - if (!global && System::GetRunningCode().empty()) + if (!global && System::GetRunningSerial().empty()) { Host::AddKeyedOSDMessage("LoadState", TRANSLATABLE("OSDMessage", "Cannot load state for game without serial."), 5.0f); @@ -608,7 +608,7 @@ static void HotkeyLoadStateSlot(bool global, s32 slot) } std::string path(global ? System::GetGlobalSaveStateFileName(slot) : - System::GetGameSaveStateFileName(System::GetRunningCode(), slot)); + System::GetGameSaveStateFileName(System::GetRunningSerial(), slot)); if (!FileSystem::FileExists(path.c_str())) { Host::AddKeyedOSDMessage("LoadState", @@ -624,7 +624,7 @@ static void HotkeySaveStateSlot(bool global, s32 slot) if (!System::IsValid()) return; - if (!global && System::GetRunningCode().empty()) + if (!global && System::GetRunningSerial().empty()) { Host::AddKeyedOSDMessage("LoadState", TRANSLATABLE("OSDMessage", "Cannot save state for game without serial."), 5.0f); @@ -632,7 +632,7 @@ static void HotkeySaveStateSlot(bool global, s32 slot) } std::string path(global ? System::GetGlobalSaveStateFileName(slot) : - System::GetGameSaveStateFileName(System::GetRunningCode(), slot)); + System::GetGameSaveStateFileName(System::GetRunningSerial(), slot)); System::SaveState(path.c_str(), g_settings.create_save_state_backups); } diff --git a/src/frontend-common/fullscreen_ui.cpp b/src/frontend-common/fullscreen_ui.cpp index db3a77935..c7da2b1e8 100644 --- a/src/frontend-common/fullscreen_ui.cpp +++ b/src/frontend-common/fullscreen_ui.cpp @@ -625,7 +625,7 @@ void FullscreenUI::OnRunningGameChanged() return; const std::string& path = System::GetRunningPath(); - const std::string& serial = System::GetRunningCode(); + const std::string& serial = System::GetRunningSerial(); if (!serial.empty()) s_current_game_subtitle = fmt::format("{0} - {1}", serial, Path::GetFileName(path)); else @@ -2006,14 +2006,14 @@ void FullscreenUI::SwitchToGameSettingsForSerial(const std::string_view& serial) void FullscreenUI::SwitchToGameSettings() { - if (System::GetRunningCode().empty()) + if (System::GetRunningSerial().empty()) return; auto lock = GameList::GetLock(); const GameList::Entry* entry = GameList::GetEntryForPath(System::GetRunningPath().c_str()); if (!entry) { - SwitchToGameSettingsForSerial(System::GetRunningCode()); + SwitchToGameSettingsForSerial(System::GetRunningSerial()); return; } @@ -3833,11 +3833,11 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type) // title info { const std::string& title = System::GetRunningTitle(); - const std::string& code = System::GetRunningCode(); + const std::string& serial = System::GetRunningSerial(); SmallString subtitle; - if (!code.empty()) - subtitle.Format("%s - ", code.c_str()); + if (!serial.empty()) + subtitle.Format("%s - ", serial.c_str()); subtitle.AppendString(Path::GetFileName(System::GetRunningPath())); const ImVec2 title_size( @@ -3909,7 +3909,7 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type) case PauseSubMenu::None: { // NOTE: Menu close must come first, because otherwise VM destruction options will race. - const bool has_game = System::IsValid() && !System::GetRunningCode().empty(); + const bool has_game = System::IsValid() && !System::GetRunningSerial().empty(); if (ActiveButton(ICON_FA_PLAY " Resume Game", false) || WantsToCloseMenu()) ClosePauseMenu(); @@ -3933,7 +3933,7 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type) } if (ActiveButton(ICON_FA_FROWN_OPEN " Cheat List", false, - !System::GetRunningCode().empty() && !Achievements::ChallengeModeActive())) + !System::GetRunningSerial().empty() && !Achievements::ChallengeModeActive())) { s_current_main_window = MainWindowType::None; DoCheatsMenu(); @@ -4070,7 +4070,7 @@ bool FullscreenUI::InitializeSaveStateListEntry(SaveStateListEntry* li, const st li->title = StringUtil::StdStringFromFormat("%s Slot %d##game_slot_%d", ssi->title.c_str(), slot, slot); } - li->summary = fmt::format("{} - Saved {:%c}", ssi->game_code.c_str(), fmt::localtime(ssi->timestamp)); + li->summary = fmt::format("{} - Saved {:%c}", ssi->serial.c_str(), fmt::localtime(ssi->timestamp)); li->timestamp = ssi->timestamp; li->slot = slot; li->path = std::move(filename); @@ -4171,7 +4171,7 @@ bool FullscreenUI::OpenSaveStateSelector(bool is_loading) s_save_state_selector_game_path = {}; s_save_state_selector_loading = is_loading; s_save_state_selector_resuming = false; - if (PopulateSaveStateListEntries(System::GetRunningTitle().c_str(), System::GetRunningCode().c_str()) > 0) + if (PopulateSaveStateListEntries(System::GetRunningTitle().c_str(), System::GetRunningSerial().c_str()) > 0) { s_save_state_selector_open = true; return true; @@ -4435,7 +4435,7 @@ void FullscreenUI::DoSaveState(s32 slot, bool global) return; std::string filename(global ? System::GetGlobalSaveStateFileName(slot) : - System::GetGameSaveStateFileName(System::GetRunningCode(), slot)); + System::GetGameSaveStateFileName(System::GetRunningSerial(), slot)); System::SaveState(filename.c_str(), g_settings.create_save_state_backups); }); } diff --git a/src/frontend-common/game_list.cpp b/src/frontend-common/game_list.cpp index 259c7c36b..e84217bbc 100644 --- a/src/frontend-common/game_list.cpp +++ b/src/frontend-common/game_list.cpp @@ -197,7 +197,7 @@ bool GameList::GetDiscListEntry(const std::string& path, Entry* entry) const std::string display_name(FileSystem::GetDisplayNameFromPath(path)); // no game code, so use the filename title - entry->serial = System::GetGameCodeForImage(cdi.get(), true); + entry->serial = System::GetGameIdFromImage(cdi.get(), true); entry->title = Path::GetFileTitle(display_name); entry->compatibility = GameDatabase::CompatibilityRating::Unknown; entry->release_date = 0; @@ -211,7 +211,7 @@ bool GameList::GetDiscListEntry(const std::string& path, Entry* entry) // region detection entry->region = System::GetRegionFromSystemArea(cdi.get()); if (entry->region == DiscRegion::Other) - entry->region = System::GetRegionForCode(entry->serial); + entry->region = System::GetRegionForSerial(entry->serial); if (cdi->HasSubImages()) { diff --git a/src/frontend-common/imgui_overlays.cpp b/src/frontend-common/imgui_overlays.cpp index 8a7e1708b..ac252085b 100644 --- a/src/frontend-common/imgui_overlays.cpp +++ b/src/frontend-common/imgui_overlays.cpp @@ -162,7 +162,8 @@ void ImGuiManager::DrawPerformanceOverlay() DRAW_LINE(fixed_font, text, IM_COL32(255, 255, 255, 255)); text.Clear(); - if (g_settings.cpu_overclock_active || (!g_settings.IsUsingRecompiler() || g_settings.cpu_recompiler_icache || g_settings.cpu_recompiler_memory_exceptions)) + if (g_settings.cpu_overclock_active || (!g_settings.IsUsingRecompiler() || g_settings.cpu_recompiler_icache || + g_settings.cpu_recompiler_memory_exceptions)) { first = true; text.AppendString("CPU["); @@ -251,7 +252,8 @@ void ImGuiManager::DrawPerformanceOverlay() void ImGuiManager::DrawEnhancementsOverlay() { LargeString text; - text.AppendFmtString("{} {}", Settings::GetConsoleRegionName(System::GetRegion()), Settings::GetRendererName(g_gpu->GetRendererType())); + text.AppendFmtString("{} {}", Settings::GetConsoleRegionName(System::GetRegion()), + Settings::GetRendererName(g_gpu->GetRendererType())); if (g_settings.rewind_enable) text.AppendFormattedString(" RW=%g/%u", g_settings.rewind_save_frequency, g_settings.rewind_save_slots); @@ -407,7 +409,7 @@ namespace SaveStateSelectorUI { struct ListEntry { std::string path; - std::string game_code; + std::string serial; std::string title; std::string formatted_timestamp; std::unique_ptr preview_texture; @@ -462,11 +464,11 @@ void SaveStateSelectorUI::RefreshList() if (System::IsShutdown()) return; - if (!System::GetRunningCode().empty()) + if (!System::GetRunningSerial().empty()) { for (s32 i = 1; i <= System::PER_GAME_SAVE_STATE_SLOTS; i++) { - std::string path(System::GetGameSaveStateFileName(System::GetRunningCode(), i)); + std::string path(System::GetGameSaveStateFileName(System::GetRunningSerial(), i)); std::optional ssi = System::GetExtendedSaveStateInfo(path.c_str()); ListEntry li; @@ -551,7 +553,7 @@ void SaveStateSelectorUI::InitializeListEntry(ListEntry* li, ExtendedSaveStateIn bool global) { li->title = std::move(ssi->title); - li->game_code = std::move(ssi->game_code); + li->serial = std::move(ssi->serial); li->path = std::move(path); li->formatted_timestamp = fmt::format("{:%c}", fmt::localtime(ssi->timestamp)); li->slot = slot; @@ -564,9 +566,9 @@ void SaveStateSelectorUI::InitializeListEntry(ListEntry* li, ExtendedSaveStateIn { if (ssi && !ssi->screenshot_data.empty()) { - li->preview_texture = g_host_display->CreateTexture(ssi->screenshot_width, ssi->screenshot_height, 1, 1, 1, - GPUTexture::Format::RGBA8, ssi->screenshot_data.data(), - sizeof(u32) * ssi->screenshot_width, false); + li->preview_texture = + g_host_display->CreateTexture(ssi->screenshot_width, ssi->screenshot_height, 1, 1, 1, GPUTexture::Format::RGBA8, + ssi->screenshot_data.data(), sizeof(u32) * ssi->screenshot_width, false); } else { @@ -583,7 +585,7 @@ void SaveStateSelectorUI::InitializeListEntry(ListEntry* li, ExtendedSaveStateIn void SaveStateSelectorUI::InitializePlaceholderListEntry(ListEntry* li, std::string path, s32 slot, bool global) { li->title = Host::TranslateStdString("SaveStateSelectorUI", "No Save State"); - std::string().swap(li->game_code); + std::string().swap(li->serial); li->path = std::move(path); std::string().swap(li->formatted_timestamp); li->slot = slot; @@ -591,9 +593,9 @@ void SaveStateSelectorUI::InitializePlaceholderListEntry(ListEntry* li, std::str if (g_host_display) { - li->preview_texture = g_host_display->CreateTexture(PLACEHOLDER_ICON_WIDTH, PLACEHOLDER_ICON_HEIGHT, 1, 1, 1, - GPUTexture::Format::RGBA8, PLACEHOLDER_ICON_DATA, - sizeof(u32) * PLACEHOLDER_ICON_WIDTH, false); + li->preview_texture = + g_host_display->CreateTexture(PLACEHOLDER_ICON_WIDTH, PLACEHOLDER_ICON_HEIGHT, 1, 1, 1, GPUTexture::Format::RGBA8, + PLACEHOLDER_ICON_DATA, sizeof(u32) * PLACEHOLDER_ICON_WIDTH, false); if (!li->preview_texture) Log_ErrorPrintf("Failed to upload save state image to GPU"); } @@ -657,13 +659,13 @@ void SaveStateSelectorUI::Draw() { ImGui::Text(Host::TranslateString("SaveStateSelectorUI", "Global Slot %d"), entry.slot); } - else if (entry.game_code.empty()) + else if (entry.serial.empty()) { ImGui::Text(Host::TranslateString("SaveStateSelectorUI", "Game Slot %d"), entry.slot); } else { - ImGui::Text(Host::TranslateString("SaveStateSelectorUI", "%s Slot %d"), entry.game_code.c_str(), entry.slot); + ImGui::Text(Host::TranslateString("SaveStateSelectorUI", "%s Slot %d"), entry.serial.c_str(), entry.slot); } ImGui::TextUnformatted(entry.title.c_str()); ImGui::TextUnformatted(entry.formatted_timestamp.c_str());