System: Rewrite save state I/O

No more ByteStream or virtual calls for every piece of data.
This commit is contained in:
Stenzek
2024-07-29 16:23:39 +10:00
parent dd8bf2c9d9
commit a6518ff9dc
14 changed files with 724 additions and 515 deletions

View File

@ -891,11 +891,11 @@ void SaveStateSelectorUI::InitializeListEntry(ListEntry* li, ExtendedSaveStateIn
{
g_gpu_device->RecycleTexture(std::move(li->preview_texture));
if (ssi && !ssi->screenshot_data.empty())
if (ssi->screenshot.IsValid())
{
li->preview_texture = g_gpu_device->FetchTexture(
ssi->screenshot_width, ssi->screenshot_height, 1, 1, 1, GPUTexture::Type::Texture, GPUTexture::Format::RGBA8,
ssi->screenshot_data.data(), sizeof(u32) * ssi->screenshot_width);
li->preview_texture = g_gpu_device->FetchTexture(ssi->screenshot.GetWidth(), ssi->screenshot.GetHeight(), 1, 1, 1,
GPUTexture::Type::Texture, GPUTexture::Format::RGBA8,
ssi->screenshot.GetPixels(), ssi->screenshot.GetPitch());
if (!li->preview_texture) [[unlikely]]
ERROR_LOG("Failed to upload save state image to GPU");
}
@ -1084,7 +1084,7 @@ void SaveStateSelectorUI::LoadCurrentSlot()
if (FileSystem::FileExists(path.c_str()))
{
Error error;
if (!System::LoadState(path.c_str(), &error))
if (!System::LoadState(path.c_str(), &error, true))
{
Host::AddKeyedOSDMessage("LoadState",
fmt::format(TRANSLATE_FS("OSDMessage", "Failed to load state from slot {0}:\n{1}"),