Merge pull request #10693 from AdmiralCurtiss/state-header-implicit-offsets

Core/State: Make memory layout of StateHeader more explicit.
This commit is contained in:
Mai M 2022-05-23 22:16:48 -04:00 committed by GitHub
commit 4f6d474e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@
#pragma once
#include <cstddef>
#include <functional>
#include <string>
#include <vector>
@ -19,9 +20,15 @@ static const u32 NUM_STATES = 10;
struct StateHeader
{
char gameID[6];
u16 reserved1;
u32 size;
u32 reserved2;
double time;
};
constexpr size_t STATE_HEADER_SIZE = sizeof(StateHeader);
static_assert(STATE_HEADER_SIZE == 24);
static_assert(offsetof(StateHeader, size) == 8);
static_assert(offsetof(StateHeader, time) == 16);
void Init();