metaforce/Runtime/MP1/CSaveGameScreen.hpp

118 lines
3.3 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
#include <memory>
#include <vector>
#include "Runtime/CIOWin.hpp"
#include "Runtime/CToken.hpp"
2020-09-15 23:35:22 +00:00
#include "Runtime/GuiSys/CGuiFrame.hpp"
#include "Runtime/MP1/CMemoryCardDriver.hpp"
#include "Runtime/MP1/CSaveGameScreenTouchBar.hpp"
2020-09-15 23:35:22 +00:00
#include "Runtime/RetroTypes.hpp"
2021-04-10 08:42:06 +00:00
namespace metaforce {
class CGuiTableGroup;
class CGuiTextPane;
class CWorldSaveGameInfo;
class CStringTable;
class CTexture;
2018-02-04 06:46:47 +00:00
struct CFinalInput;
2018-12-08 05:30:43 +00:00
namespace MP1 {
2018-12-08 05:30:43 +00:00
enum class ESaveContext { FrontEnd, InGame };
2016-12-30 06:37:01 +00:00
2018-12-08 05:30:43 +00:00
class CSaveGameScreen {
2016-12-21 20:44:30 +00:00
public:
2018-12-08 05:30:43 +00:00
enum class EUIType {
Empty = 0,
BusyReading = 1,
BusyWriting = 2,
NoCardFound = 3,
NeedsFormatBroken = 4,
NeedsFormatEncoding = 5,
CardDamaged = 6,
WrongDevice = 7,
InsufficientSpaceBadCheck = 8,
InsufficientSpaceOKCheck = 9,
IncompatibleCard = 10,
SaveCorrupt = 11,
StillInsufficientSpace = 12,
ProgressWillBeLost = 13,
NotOriginalCard = 14,
AllDataWillBeLost = 15,
SaveReady = 16,
// Metaforce Addition
CreateDolphinCardFailed
2018-12-08 05:30:43 +00:00
};
bool IsHiddenFromFrontEnd() const {
2018-12-08 05:30:43 +00:00
switch (x10_uiType) {
case EUIType::SaveReady:
case EUIType::Empty:
case EUIType::BusyReading:
case EUIType::BusyWriting:
return false;
default:
return true;
}
2018-12-08 05:30:43 +00:00
}
2016-12-21 20:44:30 +00:00
private:
2018-12-08 05:30:43 +00:00
ESaveContext x0_saveCtx;
u64 x8_serial;
EUIType x10_uiType = EUIType::Empty;
TLockedToken<CTexture> x14_txtrSaveBanner;
TLockedToken<CTexture> x20_txtrSaveIcon0;
TLockedToken<CTexture> x2c_txtrSaveIcon1;
TLockedToken<CStringTable> x38_strgMemoryCard;
TLockedToken<CGuiFrame> x44_frmeGenericMenu;
CGuiFrame* x50_loadedFrame = nullptr;
2020-09-13 01:13:38 +00:00
CGuiTextPane* x54_textpane_message{};
CGuiTableGroup* x58_tablegroup_choices{};
CGuiTextPane* x5c_textpane_choice0{};
CGuiTextPane* x60_textpane_choice1{};
CGuiTextPane* x64_textpane_choice2{};
CGuiTextPane* x68_textpane_choice3{};
2018-12-08 05:30:43 +00:00
std::unique_ptr<CMemoryCardDriver> x6c_cardDriver;
std::vector<TLockedToken<CWorldSaveGameInfo>> x70_saveWorlds;
2018-12-08 05:30:43 +00:00
CIOWin::EMessageReturn x80_iowRet = CIOWin::EMessageReturn::Normal;
u32 x84_navConfirmSfx = SFXui_frontend_save_confirm;
u32 x88_navMoveSfx = SFXui_frontend_save_move;
u32 x8c_navBackSfx = SFXui_frontend_save_back;
bool x90_needsDriverReset = false;
bool x91_uiTextDirty = false;
bool x92_savingDisabled = false;
bool x93_inGame;
2018-12-08 05:30:43 +00:00
std::unique_ptr<CSaveGameScreenTouchBar> m_touchBar;
2017-02-10 23:58:05 +00:00
2018-12-08 05:30:43 +00:00
void ContinueWithoutSaving();
2016-12-24 00:45:51 +00:00
2016-12-21 20:44:30 +00:00
public:
2018-12-08 05:30:43 +00:00
static std::unique_ptr<CMemoryCardDriver> ConstructCardDriver(bool inGame);
void ResetCardDriver();
CIOWin::EMessageReturn Update(float dt);
void SetInGame(bool v) { x93_inGame = v; }
bool PumpLoad();
2020-09-13 01:13:38 +00:00
[[nodiscard]] EUIType SelectUIType() const;
2018-12-08 05:30:43 +00:00
void SetUIText();
void SetUIColors();
void Draw() const;
2018-12-08 05:30:43 +00:00
void DoAdvance(CGuiTableGroup* caller);
void DoSelectionChange(CGuiTableGroup* caller, int oldSel);
2018-12-08 05:30:43 +00:00
void ProcessUserInput(const CFinalInput& input);
void StartGame(int idx);
void SaveNESState();
void EraseGame(int idx);
2020-09-13 01:13:38 +00:00
[[nodiscard]] const CGameState::GameFileStateInfo* GetGameData(int idx) const;
[[nodiscard]] EUIType GetUIType() const { return x10_uiType; }
[[nodiscard]] bool IsSavingDisabled() const { return x92_savingDisabled; }
explicit CSaveGameScreen(ESaveContext saveCtx, u64 serial);
};
2018-12-08 05:30:43 +00:00
} // namespace MP1
2021-04-10 08:42:06 +00:00
} // namespace metaforce