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)
|
if (!file)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
struct gb_s restored{};
|
std::vector<uint8_t> backup(sizeof(gb));
|
||||||
const size_t read = std::fread(&restored, 1, sizeof(restored), file);
|
std::memcpy(backup.data(), &gb, sizeof(gb));
|
||||||
std::fclose(file);
|
|
||||||
if (read != sizeof(restored))
|
const size_t read = std::fread(&gb, 1, sizeof(gb), file);
|
||||||
return false;
|
std::fclose(file);
|
||||||
|
if (read != sizeof(gb)) {
|
||||||
|
std::memcpy(&gb, backup.data(), sizeof(gb));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
gb = restored;
|
|
||||||
applyRuntimeBindings();
|
applyRuntimeBindings();
|
||||||
gb.direct.joypad = 0xFF;
|
gb.direct.joypad = 0xFF;
|
||||||
frameDirty = true;
|
frameDirty = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user