rpcsx/rpcs3/Emu/savestate_utils.hpp

48 lines
1.2 KiB
C++
Raw Permalink Normal View History

2023-11-15 20:07:42 +01:00
#pragma once
2023-11-27 21:13:49 +01:00
#include "util/serialization_ext.hpp"
2023-11-15 20:07:42 +01:00
struct version_entry
{
u16 type;
u16 version;
ENABLE_BITWISE_SERIALIZATION;
};
2025-01-23 00:30:53 +01:00
struct savestate_header
{
ENABLE_BITWISE_SERIALIZATION;
nse_t<u64, 1> magic;
bool LE_format;
bool state_inspection_support;
nse_t<u64, 1> offset;
b8 flag_versions_is_following_data;
};
struct hle_locks_t
{
atomic_t<s64> lock_val{0};
enum states : s64
{
waiting_for_evaluation = -1,
finalized = -2,
};
2024-03-27 14:34:14 +01:00
[[noreturn]] void lock();
bool try_lock();
void unlock();
bool try_finalize(std::function<bool()> test);
};
2025-01-23 00:30:53 +01:00
std::shared_ptr<utils::serial> make_savestate_reader(const std::string& path);
2023-11-15 20:07:42 +01:00
bool load_and_check_reserved(utils::serial& ar, usz size);
bool is_savestate_version_compatible(const std::vector<version_entry>& data, bool is_boot_check);
std::vector<version_entry> get_savestate_versioning_data(fs::file&& file, std::string_view filepath);
bool is_savestate_compatible(fs::file&& file, std::string_view filepath);
2025-01-23 00:30:53 +01:00
bool is_savestate_compatible(const std::string& filepath);
2023-11-15 20:07:42 +01:00
std::vector<version_entry> read_used_savestate_versions();
2025-01-23 00:30:53 +01:00
std::string get_savestate_file(std::string_view title_id, std::string_view boot_path, s64 abs_id, s64 rel_id);