2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CMAIN
|
|
|
|
#define _CMAIN
|
2022-04-10 00:17:06 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
#include "rstl/reserved_vector.hpp"
|
|
|
|
|
2022-07-18 22:42:58 +00:00
|
|
|
#include "Kyoto/Basics/COsContext.hpp"
|
|
|
|
#include "Kyoto/Basics/CStopwatch.hpp"
|
2022-10-12 08:07:35 +00:00
|
|
|
#include "Kyoto/Alloc/CMemorySys.hpp"
|
2022-07-18 22:42:58 +00:00
|
|
|
#include "Kyoto/Streams/CInputStream.hpp"
|
|
|
|
#include "Kyoto/TReservedAverage.hpp"
|
2022-08-09 23:03:51 +00:00
|
|
|
#include "MetroidPrime/CGameArchitectureSupport.hpp"
|
|
|
|
#include "MetroidPrime/CGameGlobalObjects.hpp"
|
2022-07-18 22:42:58 +00:00
|
|
|
#include "MetroidPrime/TGameTypes.hpp"
|
|
|
|
#include "MetroidPrime/Tweaks/CTweaks.hpp"
|
2022-04-10 00:17:06 +00:00
|
|
|
|
2022-09-13 04:26:54 +00:00
|
|
|
class CMain;
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
class UnkClassArena {
|
|
|
|
public:
|
|
|
|
UnkClassArena(CMain*);
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO move to new header
|
|
|
|
class CDvdRequestSys {
|
|
|
|
public:
|
|
|
|
CDvdRequestSys() {
|
|
|
|
if (mManagerInstalled != true) {
|
|
|
|
mManagerInstalled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
~CDvdRequestSys() {
|
|
|
|
if (mManagerInstalled == true) {
|
|
|
|
mManagerInstalled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
static bool mManagerInstalled;
|
|
|
|
};
|
|
|
|
|
2022-04-10 00:17:06 +00:00
|
|
|
class CMain {
|
|
|
|
public:
|
2022-10-05 00:16:03 +00:00
|
|
|
enum ERestartMode {
|
|
|
|
kRM_None,
|
|
|
|
kRM_WinBad,
|
|
|
|
kRM_WinGood,
|
|
|
|
kRM_WinBest,
|
|
|
|
kRM_LoseGame,
|
|
|
|
kRM_Default,
|
|
|
|
kRM_StateSetter,
|
|
|
|
kRM_PreFrontEnd,
|
|
|
|
kRM_FrontEnd,
|
|
|
|
kRM_Game,
|
|
|
|
kRM_GameExit,
|
|
|
|
};
|
|
|
|
|
2022-09-13 04:26:54 +00:00
|
|
|
CMain();
|
|
|
|
~CMain();
|
|
|
|
|
2022-04-10 00:17:06 +00:00
|
|
|
void UpdateStreamedAudio();
|
|
|
|
void RegisterResourceTweaks();
|
|
|
|
void ResetGameState();
|
|
|
|
void StreamNewGameState(CInputStream& in, int saveIdx);
|
|
|
|
void RefreshGameState();
|
|
|
|
void AddWorldPaks();
|
2022-09-05 04:01:13 +00:00
|
|
|
void AsyncIdle(uint time);
|
2022-04-15 19:24:52 +00:00
|
|
|
int RsMain(int argc, const char* const* argv);
|
2022-04-10 00:17:06 +00:00
|
|
|
void InitializeSubsystems();
|
|
|
|
void FillInAssetIDs();
|
|
|
|
void ShutdownSubsystems();
|
|
|
|
void MemoryCardInitializePump();
|
|
|
|
void DoPredrawMetrics();
|
|
|
|
void DrawDebugMetrics(double dt, CStopwatch& stopWatch);
|
|
|
|
bool CheckTerminate();
|
|
|
|
bool CheckReset();
|
2022-09-13 04:26:54 +00:00
|
|
|
void OpenWindow();
|
2022-10-05 00:16:03 +00:00
|
|
|
void SetRestartMode(ERestartMode s) { x12c_restartMode = s; }
|
2022-10-13 23:31:53 +00:00
|
|
|
ERestartMode GetRestartMode() const { return x12c_restartMode; }
|
2022-10-10 22:53:28 +00:00
|
|
|
void SetCardBusy(bool v) { x160_31_cardBusy = v; }
|
2022-09-13 04:26:54 +00:00
|
|
|
|
|
|
|
void SetMaxSpeed(bool v) {
|
|
|
|
// ?
|
|
|
|
x160_26_screenFading = v;
|
|
|
|
}
|
2022-04-10 00:17:06 +00:00
|
|
|
|
2022-04-11 22:42:08 +00:00
|
|
|
static void EnsureWorldPaksReady();
|
|
|
|
static void EnsureWorldPakReady(CAssetId id);
|
|
|
|
|
2022-09-13 04:26:54 +00:00
|
|
|
// TODO
|
|
|
|
COsContext& InitOsContext() {
|
|
|
|
OpenWindow();
|
|
|
|
return x0_osContext;
|
|
|
|
}
|
|
|
|
|
2022-04-10 00:17:06 +00:00
|
|
|
private:
|
|
|
|
COsContext x0_osContext;
|
2022-09-13 04:26:54 +00:00
|
|
|
UnkClassArena x6c_unk;
|
2022-04-10 00:17:06 +00:00
|
|
|
CMemorySys x6d_memorySys;
|
2022-09-13 04:26:54 +00:00
|
|
|
CDvdRequestSys x6e_dvdRequestSys;
|
2022-04-10 00:17:06 +00:00
|
|
|
CTweaks x70_tweaks;
|
2022-10-09 05:37:23 +00:00
|
|
|
uchar pad[0x14];
|
|
|
|
double xe8_;
|
|
|
|
TReservedAverage< float, 4 > xf0_;
|
|
|
|
TReservedAverage< float, 4 > x104_;
|
|
|
|
float x118_;
|
|
|
|
float x11c_;
|
|
|
|
float x120_;
|
|
|
|
float x124_;
|
2022-04-10 00:17:06 +00:00
|
|
|
CGameGlobalObjects* x128_gameGlobalObjects;
|
2022-10-05 00:16:03 +00:00
|
|
|
ERestartMode x12c_restartMode;
|
2022-09-05 04:01:13 +00:00
|
|
|
rstl::reserved_vector< uint, 10 > x130_frameTimes;
|
|
|
|
int x15c_frameTimeIdx;
|
2022-04-10 00:17:06 +00:00
|
|
|
bool x160_24_finished : 1;
|
|
|
|
bool x160_25_mfGameBuilt : 1;
|
|
|
|
bool x160_26_screenFading : 1;
|
|
|
|
bool x160_27_ : 1;
|
|
|
|
bool x160_28_manageCard : 1;
|
|
|
|
bool x160_29_ : 1;
|
|
|
|
bool x160_30_ : 1;
|
|
|
|
bool x160_31_cardBusy : 1;
|
|
|
|
bool x161_24_gameFrameDrawn : 1;
|
|
|
|
CGameArchitectureSupport* x164_;
|
|
|
|
};
|
2022-10-01 06:19:09 +00:00
|
|
|
CHECK_SIZEOF(CMain, 0x168)
|
2022-04-10 00:17:06 +00:00
|
|
|
|
|
|
|
extern CMain* gpMain;
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CMAIN
|