Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #10693 from AdmiralCurtiss/state-header-implicit-o…
…ffsets

Core/State: Make memory layout of StateHeader more explicit.
  • Loading branch information
lioncash committed May 24, 2022
2 parents 1e64d21 + b18fd3d commit 4f6d474
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Source/Core/Core/State.h
Expand Up @@ -5,6 +5,7 @@

#pragma once

#include <cstddef>
#include <functional>
#include <string>
#include <vector>
Expand All @@ -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();

Expand Down

0 comments on commit 4f6d474

Please sign in to comment.