mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-18 06:25:37 +00:00
Misc: Normalize code vs serial usage
This commit is contained in:
parent
4c3a5dd4d7
commit
10f98106dd
|
@ -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
|
||||
|
|
|
@ -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<std::string> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<ClCompile Include="host_display.cpp" />
|
||||
<ClCompile Include="host_interface_progress_callback.cpp" />
|
||||
<ClCompile Include="interrupt_controller.cpp" />
|
||||
<ClCompile Include="libcrypt_game_codes.cpp" />
|
||||
<ClCompile Include="libcrypt_serials.cpp" />
|
||||
<ClCompile Include="mdec.cpp" />
|
||||
<ClCompile Include="memory_card.cpp" />
|
||||
<ClCompile Include="memory_card_image.cpp" />
|
||||
|
@ -129,7 +129,7 @@
|
|||
<ClInclude Include="host_interface_progress_callback.h" />
|
||||
<ClInclude Include="host_settings.h" />
|
||||
<ClInclude Include="interrupt_controller.h" />
|
||||
<ClInclude Include="libcrypt_game_codes.h" />
|
||||
<ClInclude Include="libcrypt_serials.h" />
|
||||
<ClInclude Include="mdec.h" />
|
||||
<ClInclude Include="memory_card.h" />
|
||||
<ClInclude Include="memory_card_image.h" />
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<ClCompile Include="cpu_recompiler_code_generator_aarch32.cpp" />
|
||||
<ClCompile Include="gpu_backend.cpp" />
|
||||
<ClCompile Include="gpu_sw_backend.cpp" />
|
||||
<ClCompile Include="libcrypt_game_codes.cpp" />
|
||||
<ClCompile Include="libcrypt_serials.cpp" />
|
||||
<ClCompile Include="texture_replacements.cpp" />
|
||||
<ClCompile Include="multitap.cpp" />
|
||||
<ClCompile Include="gpu_hw_d3d12.cpp" />
|
||||
|
@ -114,7 +114,7 @@
|
|||
<ClInclude Include="gpu_types.h" />
|
||||
<ClInclude Include="gpu_backend.h" />
|
||||
<ClInclude Include="gpu_sw_backend.h" />
|
||||
<ClInclude Include="libcrypt_game_codes.h" />
|
||||
<ClInclude Include="libcrypt_serials.h" />
|
||||
<ClInclude Include="texture_replacements.h" />
|
||||
<ClInclude Include="shader_cache_version.h" />
|
||||
<ClInclude Include="multitap.h" />
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "libcrypt_game_codes.h"
|
||||
#include "libcrypt_serials.h"
|
||||
|
||||
namespace LibcryptGameList {
|
||||
|
|
@ -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;
|
||||
|
|
|
@ -1112,8 +1112,8 @@ static std::array<const char*, 6> s_memory_card_type_names = {
|
|||
{"None", "Shared", "PerGame", "PerGameTitle", "PerGameFileTitle", "NonPersistent"}};
|
||||
static std::array<const char*, 6> 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<const char*, 4> s_multitap_enable_mode_names = {{"Disabled", "Port1Only", "Port2Only", "BothPorts"}};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<CDImage> 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<INISettingsInterface> 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<MemoryCard> 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<MemoryCard> 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<SaveStateInfo> System::GetAvailableSaveStates(const char* game_code)
|
||||
std::vector<SaveStateInfo> System::GetAvailableSaveStates(const char* serial)
|
||||
{
|
||||
std::vector<SaveStateInfo> si;
|
||||
std::string path;
|
||||
|
@ -3808,11 +3808,11 @@ std::vector<SaveStateInfo> System::GetAvailableSaveStates(const char* game_code)
|
|||
si.push_back(SaveStateInfo{std::move(path), sd.ModificationTime, static_cast<s32>(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<SaveStateInfo> System::GetAvailableSaveStates(const char* game_code)
|
|||
return si;
|
||||
}
|
||||
|
||||
std::optional<SaveStateInfo> System::GetSaveStateInfo(const char* game_code, s32 slot)
|
||||
std::optional<SaveStateInfo> 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<ExtendedSaveStateInfo> 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<ExtendedSaveStateInfo> 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<SaveStateInfo> states(GetAvailableSaveStates(game_code));
|
||||
const std::vector<SaveStateInfo> 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<CheatList> cl = std::make_unique<CheatList>();
|
||||
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());
|
||||
|
|
|
@ -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<u8>* 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<ExtendedSaveStateInfo> GetUndoSaveStateInfo();
|
|||
bool UndoLoadState();
|
||||
|
||||
/// Returns a list of save states for the specified game code.
|
||||
std::vector<SaveStateInfo> GetAvailableSaveStates(const char* game_code);
|
||||
std::vector<SaveStateInfo> GetAvailableSaveStates(const char* serial);
|
||||
|
||||
/// Returns save state info if present. If game_code is null or empty, assumes global state.
|
||||
std::optional<SaveStateInfo> GetSaveStateInfo(const char* game_code, s32 slot);
|
||||
/// Returns save state info if present. If serial is null or empty, assumes global state.
|
||||
std::optional<SaveStateInfo> GetSaveStateInfo(const char* serial, s32 slot);
|
||||
|
||||
/// Returns save state info from opened save state stream.
|
||||
std::optional<ExtendedSaveStateInfo> 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();
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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<SaveStateInfo> 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<SaveStateInfo> 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<s32>(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<s32>(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<SaveStateInfo> 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<SaveStateInfo> 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<s32>(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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -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<GPUTexture> 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<ExtendedSaveStateInfo> 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());
|
||||
|
|
Loading…
Reference in a new issue