mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 00:35:46 -04:00
Misc: Normalize code vs serial usage
This commit is contained in:
@ -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());
|
||||
|
Reference in New Issue
Block a user