fix rewind not working when RetroAchievements cannot identify game

This commit is contained in:
Jamiras 2024-06-11 18:08:35 -06:00 committed by LibretroAdmin
parent af7f1f7f91
commit dfcf0c042c
2 changed files with 14 additions and 2 deletions

View File

@ -5384,7 +5384,7 @@ size_t rc_client_progress_size(rc_client_t* client)
return client->state.external_client->progress_size();
#endif
if (!client->game)
if (!rc_client_is_game_loaded(client))
return 0;
rc_mutex_lock(&client->state.mutex);

View File

@ -448,8 +448,20 @@ bool content_serialize_state_rewind(void* buffer, size_t buffer_size)
{
rastate_size_info_t size;
size_t len = content_get_rastate_size(&size, true);
if (len == 0 || len > buffer_size)
if (len == 0)
return false;
if (len > buffer_size)
{
#ifdef DEBUG
static size_t last_reported_len = 0;
if (len != last_reported_len)
{
last_reported_len = len;
RARCH_WARN("Rewind state size exceeds frame size (%zu > %zu).\n", len, buffer_size);
}
#endif
return false;
}
return content_write_serialized_state(buffer, &size, true);
}