1#pragma once
2
3#include <framework/seadGameFramework.h>
4#include <gfx/seadFrameBuffer.h>
5#include <math/seadVector.h>
6#include <nvn/nvn.h>
7#include <thread/seadThread.h>
8
9namespace nn
10{
11namespace mem
12{
13class StandardAllocator;
14}
15namespace vi
16{
17class Layer;
18class Display;
19} // namespace vi
20} // namespace nn
21
22namespace sead
23{
24class DisplayBufferNvn;
25
26class GameFrameworkNx : public GameFramework
27{
28 SEAD_RTTI_OVERRIDE(GameFrameworkNx, GameFramework)
29public:
30 struct CreateArg
31 {
32 s32 mVBlankWaitInterval;
33 Color4f mClearColor;
34 Vector2u mDisplayResolution;
35 bool _1c;
36 bool mIsTripleBuffer;
37 bool mIsUseDebug;
38 bool _1f;
39 u32 _20;
40 u32 _24;
41 u32 _28;
42 s32 mTransferMemorySize;
43 s32 mGraphicsDevToolsMemorySize;
44 s32 mComputeMemorySize;
45 s32 mCommandMemorySize;
46 s32 mControlMemorySize;
47 u32 mDebugLevel;
48 u32 _44;
49 };
50
51 static_assert(sizeof(CreateArg) == 0x48);
52
53 GameFrameworkNx(const CreateArg&);
54 ~GameFrameworkNx() override;
55
56 FrameBuffer* getMethodFrameBuffer(int) const override;
57 LogicalFrameBuffer* getMethodLogicalFrameBuffer(int) const override;
58 void initRun_(Heap*) override;
59 void runImpl_() override;
60 MethodTreeMgr* createMethodTreeMgr_(Heap*) override;
61 float calcFps() override;
62 virtual void setCaption(const SafeString&);
63 virtual void mainLoop_();
64 virtual void procFrame_();
65 virtual void procDraw_();
66 virtual void procCalc_();
67 virtual void present_();
68 virtual void swapBuffer_();
69 virtual void clearFrameBuffers_(int);
70 virtual void waitForGpuDone_();
71 virtual void setGpuTimeStamp_();
72
73 void initializeArg(const Framework::InitializeArg&);
74 void initializeGraphicsSystem(Heap*, const Vector2f&);
75 void outOfMemoryCallback_(NVNcommandBuffer*, NVNcommandBufferMemoryEvent, size_t, void*);
76 void presentAsync_(Thread*, long);
77 void getAcquiredDisplayBufferTexture() const; // unknown return type
78 void setVBlankWaitInterval(u32);
79 void requestChangeUseGPU(bool);
80 void getGraphicsDevToolsAllocatorTotalFreeSize() const; // unknown return type
81 void waitVsyncEvent_();
82
83private:
84 CreateArg mCreateArg;
85 u64 mFrameDuration;
86 u64 mPrevFrameTick;
87 FrameBuffer* mMethodFrameBuffer;
88 LogicalFrameBuffer mMethodLogicalFrameBuffer;
89 u64 mVBlankWaitTicks;
90 DisplayBufferNvn* mDisplayBuffer;
91 char _130[8];
92 void* mGpuErrorCallback;
93 NVNmemoryPool* _140;
94 void* mCommandBufferControl;
95 NVNcommandBuffer* mCommandBuffer;
96 NVNbuffer* _158;
97 NVNcounterData* _160;
98 NVNmemoryPool* mShaderScratchMemory;
99 u32 _170;
100 nn::mem::StandardAllocator* mGraphicsDevToolsAllocator;
101 u64 mCommandBufferCommandMemoryUsed;
102 u64 mCommandBufferControlMemoryUsed;
103 NVNqueue* _190;
104 FrameBuffer* mCurFrameBuffer;
105 nn::vi::Display* mDisplay;
106 nn::vi::Layer* mLayer;
107 DelegateThread* mPresentationThread;
108 NVNsync* _1B8;
109 SafeString _1C0;
110 NVNcommandHandle mCommandHandle;
111 nn::os::SystemEventType mVsyncEvent;
112 bool _208;
113 u8 _209;
114 bool _20a;
115 u8 _20b;
116};
117
118static_assert(sizeof(GameFrameworkNx) == 0x210);
119
120} // namespace sead
121