Boot: Move StateFlags from Boot_WiiWAD to Boot

It's not specific to WADs. The BS2 emulation boot code will also need
to update the state file.

Move the struct to Boot and add a helper function that will handle
reading + computing the checksum + writing the state file.
This commit is contained in:
Léo Lam
2017-08-06 19:09:45 +08:00
parent 7a74e8ad0b
commit 8489d9da90
3 changed files with 58 additions and 50 deletions

View File

@ -5,6 +5,7 @@
#pragma once
#include <cstdlib>
#include <functional>
#include <memory>
#include <optional>
#include <string>
@ -128,3 +129,18 @@ public:
protected:
std::vector<u8> m_bytes;
};
struct StateFlags
{
void UpdateChecksum();
u32 checksum;
u8 flags;
u8 type;
u8 discstate;
u8 returnto;
u32 unknown[6];
};
// Reads the state file from the NAND, then calls the passed update function to update the struct,
// and finally writes the updated state file to the NAND.
void UpdateStateFlags(std::function<void(StateFlags*)> update_function);