metaforce/Runtime/MP1/CSaveGameScreen.hpp

126 lines
3.2 KiB
C++
Raw Normal View History

#ifndef __URDE_CSAVEUI_HPP__
#define __URDE_CSAVEUI_HPP__
#include "RetroTypes.hpp"
#include "CToken.hpp"
#include "CIOWin.hpp"
#include "CMemoryCardDriver.hpp"
2017-02-12 03:17:18 +00:00
#include "CSaveGameScreenTouchBar.hpp"
namespace urde
{
class CTexture;
class CStringTable;
class CGuiFrame;
class CSaveWorld;
class CFinalInput;
class CGuiTextPane;
class CGuiTableGroup;
namespace MP1
{
2016-12-30 06:37:01 +00:00
enum class ESaveContext
{
FrontEnd,
InGame
};
2017-02-12 03:17:18 +00:00
class CSaveGameScreen
{
2016-12-21 20:44:30 +00:00
public:
2016-12-30 06:37:01 +00:00
enum class EUIType
{
2016-12-29 05:53:00 +00:00
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,
2017-01-09 03:44:00 +00:00
SaveReady = 16
};
2017-01-09 03:44:00 +00:00
bool IsHiddenFromFrontEnd()
{
switch (x10_uiType)
{
2017-01-09 03:44:00 +00:00
case EUIType::SaveReady:
2016-12-30 06:37:01 +00:00
case EUIType::Empty:
case EUIType::BusyReading:
case EUIType::BusyWriting:
return false;
default:
return true;
}
}
2016-12-21 20:44:30 +00:00
private:
2016-12-30 06:37:01 +00:00
ESaveContext x0_saveCtx;
2016-12-24 00:45:51 +00:00
u64 x8_serial;
2016-12-30 06:37:01 +00:00
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;
CGuiTextPane* x54_textpane_message;
CGuiTableGroup* x58_tablegroup_choices;
CGuiTextPane* x5c_textpane_choice0;
CGuiTextPane* x60_textpane_choice1;
CGuiTextPane* x64_textpane_choice2;
CGuiTextPane* x68_textpane_choice3;
std::unique_ptr<CMemoryCardDriver> x6c_cardDriver;
std::vector<TLockedToken<CSaveWorld>> x70_saveWorlds;
2016-12-24 00:45:51 +00:00
CIOWin::EMessageReturn x80_iowRet = CIOWin::EMessageReturn::Normal;
u32 x84_navConfirmSfx = 1460;
u32 x88_navMoveSfx = 1461;
u32 x8c_navBackSfx = 1459;
2016-12-24 00:45:51 +00:00
bool x90_needsDriverReset = false;
2016-12-29 05:53:00 +00:00
bool x91_uiTextDirty = false;
2016-12-31 00:51:51 +00:00
bool x92_savingDisabled = false;
2016-12-30 06:37:01 +00:00
bool x93_inGame;
2017-02-12 03:17:18 +00:00
std::unique_ptr<CSaveGameScreenTouchBar> m_touchBar;
2017-02-10 23:58:05 +00:00
2016-12-29 05:53:00 +00:00
void ContinueWithoutSaving();
2016-12-24 00:45:51 +00:00
2016-12-21 20:44:30 +00:00
public:
2016-12-30 06:37:01 +00:00
static std::unique_ptr<CMemoryCardDriver> ConstructCardDriver(bool inGame);
2017-01-09 03:44:00 +00:00
void ResetCardDriver();
CIOWin::EMessageReturn Update(float dt);
2016-12-30 06:37:01 +00:00
void SetInGame(bool v) { x93_inGame = v; }
bool PumpLoad();
2016-12-30 06:37:01 +00:00
EUIType SelectUIType() const;
2016-12-29 05:53:00 +00:00
void SetUIText();
void SetUIColors();
void Draw() const;
void DoAdvance(CGuiTableGroup* caller);
void DoSelectionChange(CGuiTableGroup* caller, int oldSel);
void ProcessUserInput(const CFinalInput& input);
void StartGame(int idx);
2016-12-31 00:51:51 +00:00
void SaveNESState();
void EraseGame(int idx);
2016-12-30 06:37:01 +00:00
const CGameState::GameFileStateInfo* GetGameData(int idx) const;
EUIType GetUIType() const { return x10_uiType; }
2016-12-31 00:51:51 +00:00
bool IsSavingDisabled() const { return x92_savingDisabled; }
2017-02-12 03:17:18 +00:00
CSaveGameScreen(ESaveContext saveCtx, u64 serial);
};
}
}
#endif // __URDE_CSAVEUI_HPP__