mirror of
https://github.com/PrimeDecomp/echoes.git
synced 2025-02-18 12:18:54 +00:00
More main code
This commit is contained in:
parent
fc13398549
commit
429de14736
@ -1,5 +1,5 @@
|
||||
MetroidPrime/main.cpp:
|
||||
.text start:0x800053B8 end:0x80007040
|
||||
.text start:0x800053B8 end:0x80008B60
|
||||
.sbss start:0x80418EA0 end:0x80418EC4
|
||||
|
||||
MetroidPrime/Player/CPlayerState.cpp:
|
||||
|
@ -139,29 +139,29 @@ fn_80006B80 = .text:0x80006B80; // type:function size:0x24 align:0x4
|
||||
CheckReset__5CMainFv = .text:0x80006BA4; // type:function size:0x49C
|
||||
fn_80007040 = .text:0x80007040; // type:function size:0x64
|
||||
fn_800070A4 = .text:0x800070A4; // type:function size:0x50
|
||||
fn_800070F4 = .text:0x800070F4; // type:function size:0x8
|
||||
fn_800070FC = .text:0x800070FC; // type:function size:0x6C
|
||||
fn_80007168 = .text:0x80007168; // type:function size:0x790
|
||||
fn_800078F8 = .text:0x800078F8; // type:function size:0x60 align:0x4
|
||||
fn_80007958 = .text:0x80007958; // type:function size:0xBC
|
||||
fn_80007A14 = .text:0x80007A14; // type:function size:0x6C
|
||||
CheckTerminate__5CMainFv = .text:0x800070F4; // type:function size:0x8
|
||||
DrawDebugMetrics__5CMainFdR10CStopwatch = .text:0x800070FC; // type:function size:0x6C
|
||||
AddPaksAndFactories__18CGameGlobalObjectsFv = .text:0x80007168; // type:function size:0x790
|
||||
__dt__800078F8 = .text:0x800078F8; // type:function size:0x60 align:0x4
|
||||
MemoryCardInitializePump__5CMainFv = .text:0x80007958; // type:function size:0xBC
|
||||
Update__24CGameArchitectureSupportFv = .text:0x80007A14; // type:function size:0x6C
|
||||
fn_80007A80 = .text:0x80007A80; // type:function size:0x20
|
||||
fn_80007AA0 = .text:0x80007AA0; // type:function size:0x28
|
||||
fn_80007AC8 = .text:0x80007AC8; // type:function size:0x70
|
||||
fn_80007B38 = .text:0x80007B38; // type:function size:0x88
|
||||
fn_80007BC0 = .text:0x80007BC0; // type:function size:0x228
|
||||
fn_80007DE8 = .text:0x80007DE8; // type:function size:0xDC
|
||||
fn_80007EC4 = .text:0x80007EC4; // type:function size:0x378
|
||||
fn_8000823C = .text:0x8000823C; // type:function size:0x80 align:0x4
|
||||
fn_800082BC = .text:0x800082BC; // type:function size:0xA0
|
||||
fn_8000835C = .text:0x8000835C; // type:function size:0x84
|
||||
fn_800083E0 = .text:0x800083E0; // type:function size:0xAC
|
||||
fn_8000848C = .text:0x8000848C; // type:function size:0xE4
|
||||
fn_80008570 = .text:0x80008570; // type:function size:0x110
|
||||
fn_80008680 = .text:0x80008680; // type:function size:0x15C
|
||||
fn_800087DC = .text:0x800087DC; // type:function size:0x3C
|
||||
fn_80008818 = .text:0x80008818; // type:function size:0x80
|
||||
fn_80008898 = .text:0x80008898; // type:function size:0x114
|
||||
UpdateTicks__24CGameArchitectureSupportFv = .text:0x80007BC0; // type:function size:0x228
|
||||
__dt__24CGameArchitectureSupportFv = .text:0x80007DE8; // type:function size:0xDC
|
||||
__ct__24CGameArchitectureSupportFR10COsContext = .text:0x80007EC4; // type:function size:0x378
|
||||
InfiniteLoopAlarm__FP7OSAlarmP9OSContext = .text:0x8000823C; // type:function size:0x80 align:0x4
|
||||
LoadStringTable__18CGameGlobalObjectsFv = .text:0x800082BC; // type:function size:0xA0
|
||||
optional_StringTable_assign_8000835C = .text:0x8000835C; // type:function size:0x84
|
||||
PostInitialize__18CGameGlobalObjectsFR10COsContextR10CMemorySys = .text:0x800083E0; // type:function size:0xAC
|
||||
__ct__18CGameGlobalObjectsFR10COsContextR10CMemorySys = .text:0x8000848C; // type:function size:0xE4
|
||||
ShutdownSubsystems__5CMainFv = .text:0x80008570; // type:function size:0x110
|
||||
InitializeSubsystems__5CMainFv = .text:0x80008680; // type:function size:0x15C
|
||||
__dt__5CMainFv = .text:0x800087DC; // type:function size:0x3C
|
||||
main = .text:0x80008818; // type:function size:0x80
|
||||
__ct__5CMainFv = .text:0x80008898; // type:function size:0x114
|
||||
fn_800089AC = .text:0x800089AC; // type:function size:0x10 align:0x4
|
||||
fn_800089BC = .text:0x800089BC; // type:function size:0x60
|
||||
fn_80008A1C__5CMainFv = .text:0x80008A1C; // type:function size:0xC
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "rstl/auto_ptr.hpp"
|
||||
#include "rstl/string.hpp"
|
||||
#include "rstl/vector.hpp"
|
||||
#include "rstl/pair.hpp"
|
||||
|
||||
#include "Kyoto/CDvdFile.hpp"
|
||||
#include "Kyoto/CResLoader.hpp"
|
||||
|
48
include/MetroidPrime/CArchitectureMessage.hpp
Normal file
48
include/MetroidPrime/CArchitectureMessage.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef _CARCHITECTUREMESSAGE
|
||||
#define _CARCHITECTUREMESSAGE
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "rstl/rc_ptr.hpp"
|
||||
|
||||
enum EArchMsgTarget {
|
||||
kAMT_IOWinManager,
|
||||
kAMT_Game,
|
||||
};
|
||||
|
||||
enum EArchMsgType {
|
||||
kAM_RemoveIOWin = 0,
|
||||
kAM_CreateIOWin = 1,
|
||||
kAM_ChangeIOWinPriority = 2,
|
||||
kAM_RemoveAllIOWins = 3,
|
||||
kAM_TimerTick = 4,
|
||||
kAM_UserInput = 5,
|
||||
kAM_SetGameState = 6,
|
||||
kAM_ControllerStatus = 7,
|
||||
kAM_QuitGameplay = 8,
|
||||
kAM_FrameBegin = 10,
|
||||
kAM_FrameEnd = 11,
|
||||
};
|
||||
|
||||
struct IArchitectureMessageParm {
|
||||
virtual ~IArchitectureMessageParm() {}
|
||||
};
|
||||
|
||||
class CArchitectureMessage {
|
||||
|
||||
public:
|
||||
CArchitectureMessage(EArchMsgTarget target, int type,
|
||||
const rstl::rc_ptr< IArchitectureMessageParm >& parm)
|
||||
: x0_target(target), x4_type(static_cast< EArchMsgType >(type)), x8_parm(parm) {}
|
||||
|
||||
EArchMsgType GetType() const { return x4_type; }
|
||||
const IArchitectureMessageParm* GetParm() const { return x8_parm.GetPtr(); }
|
||||
EArchMsgTarget GetTarget() const { return x0_target; }
|
||||
|
||||
private:
|
||||
EArchMsgTarget x0_target;
|
||||
EArchMsgType x4_type;
|
||||
rstl::rc_ptr< IArchitectureMessageParm > x8_parm;
|
||||
};
|
||||
|
||||
#endif // _CARCHITECTUREMESSAGE
|
25
include/MetroidPrime/CArchitectureQueue.hpp
Normal file
25
include/MetroidPrime/CArchitectureQueue.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef _CARCHITECTUREQUEUE
|
||||
#define _CARCHITECTUREQUEUE
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "MetroidPrime/CArchitectureMessage.hpp"
|
||||
|
||||
#include "rstl/list.hpp"
|
||||
|
||||
class CArchitectureQueue {
|
||||
public:
|
||||
void Push(const CArchitectureMessage& msg) { x0_queue.push_back(msg); }
|
||||
CArchitectureMessage Pop() {
|
||||
CArchitectureMessage result = *x0_queue.begin();
|
||||
x0_queue.pop_front();
|
||||
return result;
|
||||
}
|
||||
void Clear() { x0_queue.clear(); }
|
||||
bool IsEmpty() const { return x0_queue.empty(); }
|
||||
|
||||
private:
|
||||
rstl::list< CArchitectureMessage > x0_queue;
|
||||
};
|
||||
|
||||
#endif // _CARCHITECTUREQUEUE
|
53
include/MetroidPrime/CGameArchitectureSupport.hpp
Normal file
53
include/MetroidPrime/CGameArchitectureSupport.hpp
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef _CGAMEARCHITECTURESUPPORT
|
||||
#define _CGAMEARCHITECTURESUPPORT
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "Kyoto/Audio/CAudioSys.hpp"
|
||||
#include "Kyoto/Basics/COsContext.hpp"
|
||||
#include "Kyoto/Basics/CStopwatch.hpp"
|
||||
#include "Kyoto/TOneStatic.hpp"
|
||||
|
||||
#include "MetroidPrime/CArchitectureQueue.hpp"
|
||||
#include "MetroidPrime/CIOWinManager.hpp"
|
||||
// #include "MetroidPrime/CInputGenerator.hpp"
|
||||
|
||||
#include "rstl/vector.hpp"
|
||||
|
||||
class CToken;
|
||||
|
||||
class CGameArchitectureSupport : public TOneStatic< CGameArchitectureSupport > {
|
||||
public:
|
||||
CGameArchitectureSupport(COsContext&);
|
||||
~CGameArchitectureSupport();
|
||||
|
||||
void PreloadAudio();
|
||||
bool UpdateTicks();
|
||||
void Update();
|
||||
void UnloadAudio();
|
||||
|
||||
inline CStopwatch& GetStopwatch1() { return x20_stopwatch1; }
|
||||
inline CStopwatch& GetStopwatch2() { return x28_stopwatch2; }
|
||||
inline CIOWinManager& GetIOWinManager() { return x58_ioWinMgr; }
|
||||
inline int& GetFramesDrawn() { return x78_gameFrameCount; }
|
||||
|
||||
private:
|
||||
CAudioSys x0_audioSys;
|
||||
CArchitectureQueue x4_archQueue;
|
||||
CStopwatch x20_stopwatch1;
|
||||
CStopwatch x28_stopwatch2;
|
||||
// CInputGenerator x30_inputGenerator;
|
||||
// CGuiSys x44_guiSys;
|
||||
CIOWinManager x58_ioWinMgr;
|
||||
int x78_gameFrameCount;
|
||||
float x7c_;
|
||||
float x80_;
|
||||
float x84_;
|
||||
uint x88_;
|
||||
rstl::vector< CToken > x90_;
|
||||
OSAlarm xa0_infiniteLoopAlarm;
|
||||
bool xc8_infiniteLoopAlarmSet;
|
||||
};
|
||||
// CHECK_SIZEOF(CGameArchitectureSupport, 0xd0)
|
||||
|
||||
#endif // _CGAMEARCHITECTURESUPPORT
|
48
include/MetroidPrime/CIOWinManager.hpp
Normal file
48
include/MetroidPrime/CIOWinManager.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef _CIOWINMANAGER
|
||||
#define _CIOWINMANAGER
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "MetroidPrime/CArchitectureQueue.hpp"
|
||||
|
||||
#include "rstl/list.hpp"
|
||||
#include "rstl/rc_ptr.hpp"
|
||||
|
||||
class CIOWin;
|
||||
|
||||
class CIOWinManager {
|
||||
public:
|
||||
struct IOWinPQNode {
|
||||
rstl::rc_ptr<CIOWin> x0_iowin;
|
||||
int x4_prio;
|
||||
IOWinPQNode* x8_next;
|
||||
|
||||
IOWinPQNode(rstl::ncrc_ptr<CIOWin> iowin, int prio, IOWinPQNode* next);
|
||||
|
||||
rstl::ncrc_ptr<CIOWin> GetIOWin() const;
|
||||
};
|
||||
|
||||
CIOWinManager();
|
||||
~CIOWinManager();
|
||||
|
||||
void Draw() const;
|
||||
void AddIOWin(rstl::ncrc_ptr< CIOWin >, int, int);
|
||||
void RemoveIOWin(rstl::ncrc_ptr<CIOWin> chIow);
|
||||
void RemoveAllIOWins();
|
||||
void ChangeIOWinPriority(rstl::ncrc_ptr<CIOWin> toChange, int pumpPrio, int drawPrio);
|
||||
rstl::ncrc_ptr<CIOWin> FindIOWin(const char* name);
|
||||
|
||||
void PumpMessages(CArchitectureQueue& queue);
|
||||
bool DistributeOneMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
|
||||
bool OnIOWinMessage(const CArchitectureMessage& msg);
|
||||
|
||||
inline bool IsEmpty() const { return x4_pumpRoot == nullptr && x0_drawRoot == nullptr; }
|
||||
|
||||
private:
|
||||
IOWinPQNode* x0_drawRoot;
|
||||
IOWinPQNode* x4_pumpRoot;
|
||||
CArchitectureQueue x8_localGatherQueue;
|
||||
};
|
||||
CHECK_SIZEOF(CIOWinManager, 0x20)
|
||||
|
||||
#endif // _CIOWINMANAGER
|
@ -1,14 +1,16 @@
|
||||
#include "MetroidPrime/CMain.hpp"
|
||||
|
||||
#include "Kyoto/Basics/CBasics.hpp"
|
||||
#include "Kyoto/Basics/RAssertDolphin.hpp"
|
||||
#include "Kyoto/CPakFile.hpp"
|
||||
#include "Kyoto/CResFactory.hpp"
|
||||
#include "Kyoto/CSimplePool.hpp"
|
||||
#include "Kyoto/CPakFile.hpp"
|
||||
#include "Kyoto/Text/CStringTable.hpp"
|
||||
#include "Kyoto/Basics/CBasics.hpp"
|
||||
|
||||
#include "MetroidPrime/Tweaks/CTweakGame.hpp"
|
||||
#include "MetroidPrime/CGameArchitectureSupport.hpp"
|
||||
#include "MetroidPrime/CGameGlobalObjects.hpp"
|
||||
#include "MetroidPrime/Player/CGameState.hpp"
|
||||
#include "MetroidPrime/Tweaks/CTweakGame.hpp"
|
||||
|
||||
class CCharacterFactoryBuilder;
|
||||
class CGameState;
|
||||
@ -24,11 +26,135 @@ unkptr gpController;
|
||||
CGameState* gpGameState;
|
||||
CMemoryCard* gpMemoryCard;
|
||||
CInGameTweakManager* gpTweakManager;
|
||||
float sInfiniteLoopTime;
|
||||
|
||||
bool CMain::CheckReset() {
|
||||
|
||||
static uchar sMainSpace[sizeof(CMain)];
|
||||
|
||||
CMain::CMain()
|
||||
// : x0_osContext(true, true)
|
||||
// , x6c_unk(this)
|
||||
// , x6d_memorySys(x0_osContext, CMemorySys::GetGameAllocator())
|
||||
// , xe8_(0.0)
|
||||
// , x118_(0.f)
|
||||
// , x11c_(0.f)
|
||||
// , x120_(0.f)
|
||||
// , x124_(0.f)
|
||||
// , x128_gameGlobalObjects(nullptr)
|
||||
// , x12c_restartMode(kRM_Default)
|
||||
// , x130_frameTimes(0xF4240)
|
||||
// , x15c_frameTimeIdx(0)
|
||||
// , x160_24_finished(false)
|
||||
// , x160_25_mfGameBuilt(false)
|
||||
// , x160_26_screenFading(false)
|
||||
// , x160_27_(false)
|
||||
// , x160_28_manageCard(false)
|
||||
// , x160_29_(false)
|
||||
// , x160_30_(false)
|
||||
// , x160_31_cardBusy(false)
|
||||
// , x161_24_gameFrameDrawn(false)
|
||||
// , x164_(nullptr)
|
||||
{
|
||||
gpMain = this;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
DVDSetAutoFatalMessaging(TRUE);
|
||||
SetErrorHandlers();
|
||||
CMain* main = new (&sMainSpace) CMain();
|
||||
gpMain->RsMain(argc, argv);
|
||||
main->~CMain();
|
||||
return 0;
|
||||
}
|
||||
|
||||
CMain::~CMain() {}
|
||||
|
||||
void CMain::InitializeSubsystems() {}
|
||||
|
||||
void CMain::ShutdownSubsystems() {}
|
||||
|
||||
CGameGlobalObjects::CGameGlobalObjects(COsContext& osContext, CMemorySys& memorySys)
|
||||
: simplePool(resFactory) {}
|
||||
|
||||
void CGameGlobalObjects::PostInitialize(COsContext&, CMemorySys&) {}
|
||||
|
||||
void CGameGlobalObjects::LoadStringTable() {
|
||||
stringTable = gpSimplePool->GetObj("STRG_Main");
|
||||
gpStringTable = **stringTable;
|
||||
}
|
||||
|
||||
void InfiniteLoopAlarm(OSAlarm* alarm, OSContext* context) {
|
||||
if (sInfiniteLoopTime >= 10.f) {
|
||||
rs_debugger_printf("INFINITE LOOP");
|
||||
}
|
||||
sInfiniteLoopTime += alarm->period / OS_TIMER_CLOCK;
|
||||
}
|
||||
|
||||
CGameArchitectureSupport::CGameArchitectureSupport(COsContext& osContext)
|
||||
: x0_audioSys(0x30, 0x30, 0x30, 0x30, 0x5fc000)
|
||||
// , x30_inputGenerator(&osContext, gpTweakPlayer->GetLeftAnalogMax(),
|
||||
// gpTweakPlayer->GetRightAnalogMax())
|
||||
// , x44_guiSys(gpResourceFactory, gpSimplePool, CGuiSys::kUM_Zero)
|
||||
, x78_gameFrameCount(0)
|
||||
, x7c_(0.f)
|
||||
, x80_(0.f)
|
||||
, x84_(0.f)
|
||||
, x88_(2)
|
||||
, xc8_infiniteLoopAlarmSet(false) {
|
||||
CAudioSys::SysSetVolume(0x7F, 0, 0xFF);
|
||||
CAudioSys::SetDefaultVolumeScale(0x75);
|
||||
CAudioSys::SetVolumeScale(CAudioSys::GetDefaultVolumeScale());
|
||||
// CDSPStreamManager::Initialize();
|
||||
// CStreamAudioManager::SetMusicVolume(0x7F);
|
||||
CAudioSys::TrkSetSampleRate(kTSR_One);
|
||||
gpMain->SetMaxSpeed(false);
|
||||
gpMain->ResetGameState();
|
||||
// if (!gpTweakGame->GetSplashScreensDisabled()) {
|
||||
// x58_ioWinMgr.AddIOWin(new CSplashScreen(CSplashScreen::Nintendo), 1000, 10000);
|
||||
// }
|
||||
// x58_ioWinMgr.AddIOWin(new CMainFlow(), 0, 0);
|
||||
// x58_ioWinMgr.AddIOWin(new CConsoleOutputWindow(8, 5.f, 0.75f), 100, 0);
|
||||
// x58_ioWinMgr.AddIOWin(new CAudioStateWin(), 100, -1);
|
||||
// x58_ioWinMgr.AddIOWin(new CErrorOutputWindow(false), 10000, 100000);
|
||||
// InitializeApplicationUI(x44_guiSys);
|
||||
// CGuiSys::SetGlobalGuiSys(&x44_guiSys);
|
||||
// gpController = x30_inputGenerator.GetController();
|
||||
// gpGameState->GameOptions().EnsureOptions();
|
||||
sInfiniteLoopTime = 0.f;
|
||||
OSSetPeriodicAlarm(&xa0_infiniteLoopAlarm, OSGetTime(), (float)OS_TIMER_CLOCK, InfiniteLoopAlarm);
|
||||
xc8_infiniteLoopAlarmSet = true;
|
||||
}
|
||||
|
||||
CGameArchitectureSupport::~CGameArchitectureSupport() {
|
||||
if (xc8_infiniteLoopAlarmSet) {
|
||||
OSCancelAlarm(&xa0_infiniteLoopAlarm);
|
||||
xc8_infiniteLoopAlarmSet = false;
|
||||
}
|
||||
x58_ioWinMgr.RemoveAllIOWins();
|
||||
UnloadAudio();
|
||||
// CSfxManager::Shutdown();
|
||||
// CDSPStreamManager::Shutdown();
|
||||
}
|
||||
|
||||
bool CGameArchitectureSupport::UpdateTicks() {}
|
||||
|
||||
void CGameArchitectureSupport::Update() {}
|
||||
|
||||
void CMain::MemoryCardInitializePump() {}
|
||||
|
||||
void CGameGlobalObjects::AddPaksAndFactories() {}
|
||||
|
||||
void CMain::DrawDebugMetrics(double dt, CStopwatch& stopWatch) {}
|
||||
|
||||
bool CMain::CheckTerminate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" void fn_800070A4() {}
|
||||
|
||||
extern "C" void fn_80007040() {}
|
||||
|
||||
bool CMain::CheckReset() {}
|
||||
|
||||
void CMain::FillInAssetIDs() {
|
||||
gpSimplePool->fn_8029c7e8(*gpResourceFactory->GetResourceIdByName("sound_lookup_ATBL"));
|
||||
}
|
||||
@ -72,8 +198,7 @@ void CMain::AddWorldPaks() {
|
||||
rstl::string basePath = gpTweakGame->GetPakFile();
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
rstl::string pak =
|
||||
basePath +
|
||||
(i == 0 ? rstl::string_l("") : rstl::string(CBasics::Stringize("%d", i)));
|
||||
basePath + (i == 0 ? rstl::string_l("") : rstl::string(CBasics::Stringize("%d", i)));
|
||||
if (CDvdFile::FileExists((pak + rstl::string_l(".pak")).data())) {
|
||||
gpResourceFactory->GetResLoader().AddPakFileAsync(pak, false, true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user