mirror of
https://github.com/usatiuk/cardboy.git
synced 2025-10-28 23:27:49 +01:00
fix
This commit is contained in:
@@ -1798,13 +1798,16 @@ public:
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
struct gb_s restored{};
|
||||
const size_t read = std::fread(&restored, 1, sizeof(restored), file);
|
||||
std::fclose(file);
|
||||
if (read != sizeof(restored))
|
||||
return false;
|
||||
std::vector<uint8_t> backup(sizeof(gb));
|
||||
std::memcpy(backup.data(), &gb, sizeof(gb));
|
||||
|
||||
const size_t read = std::fread(&gb, 1, sizeof(gb), file);
|
||||
std::fclose(file);
|
||||
if (read != sizeof(gb)) {
|
||||
std::memcpy(&gb, backup.data(), sizeof(gb));
|
||||
return false;
|
||||
}
|
||||
|
||||
gb = restored;
|
||||
applyRuntimeBindings();
|
||||
gb.direct.joypad = 0xFF;
|
||||
frameDirty = true;
|
||||
|
||||
Reference in New Issue
Block a user