CommonHostInterface: Add media path to save state info

This commit is contained in:
Connor McLaughlin 2021-01-30 15:47:48 +10:00
parent 4540a190c1
commit bed1abf0b8
2 changed files with 12 additions and 3 deletions

View File

@ -2213,6 +2213,15 @@ CommonHostInterface::GetExtendedSaveStateInfo(const char* game_code, s32 slot)
header.game_code[sizeof(header.game_code) - 1] = 0;
ssi.game_code = header.game_code;
if (header.media_filename_length > 0 &&
(header.offset_to_media_filename + header.media_filename_length) <= stream->GetSize())
{
stream->SeekAbsolute(header.offset_to_media_filename);
ssi.media_path.resize(header.media_filename_length);
if (!stream->Read2(ssi.media_path.data(), header.media_filename_length))
std::string().swap(ssi.media_path);
}
if (header.screenshot_width > 0 && header.screenshot_height > 0 && header.screenshot_size > 0 &&
(static_cast<u64>(header.offset_to_screenshot) + static_cast<u64>(header.screenshot_size)) <= stream->GetSize())
{

View File

@ -67,13 +67,13 @@ public:
struct ExtendedSaveStateInfo
{
std::string path;
std::string title;
std::string game_code;
std::string media_path;
u64 timestamp;
s32 slot;
bool global;
std::string title;
std::string game_code;
u32 screenshot_width;
u32 screenshot_height;
std::vector<u32> screenshot_data;