DSPHLE: Require implementing DoState

CARDUCode, GBAUCode, and INITUCode previously didn't have an implementation of it. In practice it's unlikely that this caused an issue, since these uCodes are only active for a few frames at most, but now that GBAUCode doesn't have global state, we can implement it there. I also implemented it for CARDUCode, although our CARDUCode implementation does not have all states handled yet - this is simply future-proofing so that when the card uCode is properly implemented, the save state version does not need to be bumped. INITUCode does not have any state to save, though.
This commit is contained in:
Pokechu22 2022-06-20 12:37:58 -07:00
parent f2e833b5c4
commit bf70026728
8 changed files with 35 additions and 2 deletions

View File

@ -3,6 +3,7 @@
#include "Core/HW/DSPHLE/UCodes/CARD.h"
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Core/HW/DSP.h"
@ -44,4 +45,10 @@ void CARDUCode::HandleMail(u32 mail)
m_mail_handler.PushMail(DSP_DONE);
m_dsphle->SetUCode(UCODE_ROM);
}
void CARDUCode::DoState(PointerWrap& p)
{
DoStateShared(p);
p.Do(m_state);
}
} // namespace DSP::HLE

View File

@ -18,5 +18,17 @@ public:
void Initialize() override;
void HandleMail(u32 mail) override;
void Update() override;
void DoState(PointerWrap& p) override;
private:
enum class State
{
WaitingForRequest,
WaitingForAddress,
WaitingForNextTask,
};
// Currently unused, will be used in a later version
State m_state = State::WaitingForRequest;
};
} // namespace DSP::HLE

View File

@ -4,6 +4,7 @@
#include "Core/HW/DSPHLE/UCodes/GBA.h"
#include "Common/Align.h"
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Core/HW/DSP.h"
@ -142,4 +143,10 @@ void GBAUCode::HandleMail(u32 mail)
}
}
}
void GBAUCode::DoState(PointerWrap& p)
{
DoStateShared(p);
p.Do(m_mail_state);
}
} // namespace DSP::HLE

View File

@ -23,6 +23,7 @@ public:
void Initialize() override;
void HandleMail(u32 mail) override;
void Update() override;
void DoState(PointerWrap& p) override;
private:
static constexpr u32 REQUEST_MAIL = 0xabba0000;

View File

@ -28,4 +28,9 @@ void INITUCode::Update()
void INITUCode::HandleMail(u32 mail)
{
}
void INITUCode::DoState(PointerWrap& p)
{
// We don't need to call DoStateShared() as the init uCode doesn't support launching new uCode
}
} // namespace DSP::HLE

View File

@ -18,5 +18,6 @@ public:
void Initialize() override;
void HandleMail(u32 mail) override;
void Update() override;
void DoState(PointerWrap& p) override;
};
} // namespace DSP::HLE

View File

@ -46,7 +46,7 @@ public:
virtual void HandleMail(u32 mail) = 0;
virtual void Update() = 0;
virtual void DoState(PointerWrap& p) { DoStateShared(p); }
virtual void DoState(PointerWrap& p) = 0;
static u32 GetCRC(UCodeInterface* ucode) { return ucode ? ucode->m_crc : UCODE_NULL; }
protected:

View File

@ -74,7 +74,7 @@ static std::recursive_mutex g_save_thread_mutex;
static std::thread g_save_thread;
// Don't forget to increase this after doing changes on the savestate system
constexpr u32 STATE_VERSION = 147; // Last changed in PR 10935
constexpr u32 STATE_VERSION = 148; // Last changed in PR 10768
// Maps savestate versions to Dolphin versions.
// Versions after 42 don't need to be added to this list,