Skip to content

Commit 4bdfb37

Browse files
author
ReimousTH
committed
Graphics Api & Resize Base
1 parent 6198f0e commit 4bdfb37

33 files changed

Lines changed: 1112 additions & 41 deletions

MarathonRecomp/api/Marathon.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include "Sonicteam/HintWindowTask.h"
5656
#include "Sonicteam/HudTextParts.h"
5757
#include "Sonicteam/ImageFilter.h"
58+
#include "Sonicteam/LuaSystemManager.h"
5859
#include "Sonicteam/MainDisplayTask.h"
5960
#include "Sonicteam/MainMenuTask.h"
6061
#include "Sonicteam/MainMode.h"
@@ -136,11 +137,13 @@
136137
#include "Sonicteam/Player/Zock.h"
137138
#include "Sonicteam/PropFixture.h"
138139
#include "Sonicteam/RaderMapManager.h"
140+
#include "Sonicteam/RenderTargetContainer.h"
139141
#include "Sonicteam/SaveDataTask.h"
140142
#include "Sonicteam/SaveDataTaskXENON.h"
141143
#include "Sonicteam/SelectWindowTask.h"
142144
#include "Sonicteam/SoX/AI/StateMachine.h"
143145
#include "Sonicteam/SoX/ApplicationXenon.h"
146+
#include "Sonicteam/SoX/Array.h"
144147
#include "Sonicteam/SoX/Audio/Cue.h"
145148
#include "Sonicteam/SoX/Audio/IAudioEngine.h"
146149
#include "Sonicteam/SoX/Audio/Player.h"
@@ -154,10 +157,15 @@
154157
#include "Sonicteam/SoX/Graphics/Frame.h"
155158
#include "Sonicteam/SoX/Graphics/FrameGP.h"
156159
#include "Sonicteam/SoX/Graphics/FrameObserver.h"
160+
#include "Sonicteam/SoX/Graphics/Surface.h"
161+
#include "Sonicteam/SoX/Graphics/SurfaceMgr.h"
157162
#include "Sonicteam/SoX/Graphics/Technique.h"
158163
#include "Sonicteam/SoX/Graphics/TechniqueFXL.h"
164+
#include "Sonicteam/SoX/Graphics/Texture.h"
165+
#include "Sonicteam/SoX/Graphics/TextureMgr.h"
159166
#include "Sonicteam/SoX/Graphics/Transforms.h"
160167
#include "Sonicteam/SoX/Graphics/Xenon/DeviceXenon.h"
168+
#include "Sonicteam/SoX/Graphics/Xenon/SurfaceXenon.h"
161169
#include "Sonicteam/SoX/Graphics/Xenon/TextureXenon.h"
162170
#include "Sonicteam/SoX/IResource.h"
163171
#include "Sonicteam/SoX/IResource2.h"
@@ -185,6 +193,7 @@
185193
#include "Sonicteam/SoX/Physics/World.h"
186194
#include "Sonicteam/SoX/RefCountObject.h"
187195
#include "Sonicteam/SoX/RefSharedPointer.h"
196+
#include "Sonicteam/SoX/ResourceManager.h"
188197
#include "Sonicteam/SoX/Scenery/Camera.h"
189198
#include "Sonicteam/SoX/Scenery/CameraEventCallback.h"
190199
#include "Sonicteam/SoX/Scenery/CameraImp.h"
@@ -227,6 +236,7 @@
227236
#include "hk330/hkpTypedBroadPhaseHandle.h"
228237
#include "hk330/hkpWorld.h"
229238
#include "hk330/hkpWorldObject.h"
239+
#include "stdx/map.h"
230240
#include "stdx/string.h"
231241
#include "stdx/vector.h"
232242
#include "stdx/wstring.h"

MarathonRecomp/api/Sonicteam/AppMarathon.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Sonicteam
1010
class AppMarathon : public SoX::ApplicationXenon
1111
{
1212
public:
13-
xpointer<DocMarathonState> m_pDoc;
13+
xpointer<DocMarathonState> m_pDocState;
1414

1515
static AppMarathon* GetInstance();
1616

@@ -22,6 +22,10 @@ namespace Sonicteam
2222
return nullptr;
2323
}
2424
};
25+
26+
MARATHON_ASSERT_OFFSETOF(AppMarathon, m_pDocState, 0x180);
27+
28+
2529
}
2630

2731
#include <Sonicteam/AppMarathon.inl>

MarathonRecomp/api/Sonicteam/DocMarathonImp.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@
22

33
#include <Marathon.inl>
44
#include <Sonicteam/SoX/Engine/Doc.h>
5+
#include <Sonicteam/MyGraphicsDevice.h>
56
#include <Sonicteam/SoX/Input/Manager.h>
67
#include <boost/smart_ptr/shared_ptr.h>
78
#include <api/stdx/vector.h>
9+
#include <Sonicteam/RenderTargetContainer.h>
810

911
namespace Sonicteam
1012
{
1113
class DocMarathonImp : public SoX::Engine::Doc
1214
{
1315
public:
14-
MARATHON_INSERT_PADDING(0x40);
16+
MARATHON_INSERT_PADDING(0x4);
17+
xpointer<MyGraphicsDevice> m_pMyGraphicDevice;
18+
MARATHON_INSERT_PADDING(0x38);
1519
stdx::vector<boost::shared_ptr<SoX::Input::Manager>> m_vspInputManager;
1620
MARATHON_INSERT_PADDING(0x24);
1721
bool m_VFrame;
18-
MARATHON_INSERT_PADDING(0x55B58);
22+
MARATHON_INSERT_PADDING(0x4);
23+
xpointer<RenderTargetContainer> m_pRenderTargetContainer;
24+
MARATHON_INSERT_PADDING(0x55B50);
1925
be<uint32_t> m_PlayerControllerID[4];
2026
};
2127
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#pragma once
2+
3+
#include <Marathon.inl>
4+
#include <Sonicteam/SoX/IResourceMgr.h>
5+
6+
namespace Sonicteam
7+
{
8+
class LuaSystemManager : public SoX::IResourceMgr, public System::Singleton<LuaSystemManager, 0x82D35EDC, System::CreateStatic<LuaSystemManager, 0x82162DF8>> {};
9+
}

MarathonRecomp/api/Sonicteam/MyGraphicsDevice.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,30 @@
22

33
#include <Marathon.inl>
44
#include <Sonicteam/SoX/Graphics/Xenon/DeviceXenon.h>
5+
#include <gpu/video.h>
56

67
namespace Sonicteam
78
{
9+
810
class MyGraphicsDevice : public SoX::Graphics::Xenon::DeviceXenon
911
{
1012
public:
13+
// Info : sub_8289CF60(this,CreationDeviceLocal*)
14+
struct CreationDeviceLocal
15+
{
16+
xpointer<GuestDevice> pGuestDevice;
17+
GuestSurfaceCreateParams SurfaceParamA;
18+
GuestSurfaceCreateParams SurfaceParamB;
19+
GuestSurfaceCreateParams SurfaceParamC;
20+
xpointer<GuestSurface> pColorTile2X;
21+
xpointer<GuestSurface> pDepthTile2X;
22+
xpointer<GuestSurface> pColorTile4X;
23+
xpointer<GuestSurface> pDepthTile4X;
24+
be<uint32_t> BackBufferWidth;
25+
be<uint32_t> BackBufferHeight;
26+
xpointer<char> AtgFontFile;
27+
};
28+
1129
MARATHON_INSERT_PADDING(0x180);
1230
};
1331
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#pragma once
2+
3+
#include <Marathon.inl>
4+
#include <api/stdx/map.h>
5+
#include <api/stdx/string.h>
6+
#include <Sonicteam/SoX/RefCountObject.h>
7+
#include <Sonicteam/SoX/RefSharedPointer.h>
8+
#include <Sonicteam/SoX/Graphics/Xenon/SurfaceXenon.h>
9+
#include <Sonicteam/SoX/Graphics/Xenon/TextureXenon.h>
10+
#include <Sonicteam/SoX/Graphics/Device.h>
11+
12+
namespace Sonicteam
13+
{
14+
class RenderTargetContainer
15+
{
16+
public:
17+
struct Vftable
18+
{
19+
be<uint32_t> fpDestroy;
20+
};
21+
xpointer<Vftable> m_pVftable;
22+
xpointer<Sonicteam::SoX::Graphics::Device> m_pDevice;
23+
stdx::map<stdx::string, SoX::RefSharedPointer<SoX::Graphics::Xenon::SurfaceXenon>> m_mspDepthStencill_1_4; // m_mspDepthStencill_1_4 ??
24+
stdx::map<stdx::string, SoX::RefSharedPointer<SoX::Graphics::Xenon::SurfaceXenon>> m_mspDepthStencill_256;
25+
stdx::map<stdx::string, SoX::RefSharedPointer<SoX::Graphics::Xenon::TextureXenon>> m_mspFrameBuffer;
26+
stdx::map<stdx::string, SoX::RefSharedPointer<SoX::Graphics::Xenon::TextureXenon>> m_mspPostEffect; //relection, csm, radermap,... better name ?
27+
stdx::map<stdx::string, SoX::RefSharedPointer<SoX::Graphics::Xenon::TextureXenon>> m_mspPostEffectAfter; //radermap_mask, better name ?
28+
};
29+
}

MarathonRecomp/api/Sonicteam/SoX/ApplicationXenon.h

Lines changed: 111 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,126 @@
22

33
#include <Marathon.inl>
44
#include <Sonicteam/SoX/Engine/Application.h>
5+
#include <gpu/video.h>
6+
57

68
namespace Sonicteam::SoX
79
{
810
class ApplicationXenon : public Engine::Application
911
{
1012
public:
11-
MARATHON_INSERT_PADDING(0x174);
13+
MARATHON_INSERT_PADDING(0x4);
14+
uint64_t m_FirstTimeBase;
15+
uint64_t m_FirstPerfomanceFraquency;
16+
uint32_t m_GuestDeviceState;
17+
xpointer<GuestDevice> m_GuestDevice;
18+
19+
//set only if device is created
20+
enum _GUESTMULTISAMPLE_TYPE : int32_t
21+
{
22+
GUESTMULTISAMPLE_NONE = 0x0,
23+
GUESTMULTISAMPLE_2_SAMPLES = 0x1,
24+
GUESTMULTISAMPLE_4_SAMPLES = 0x2,
25+
GUESTMULTISAMPLE_FORCE_DWORD = 0x7FFFFFFF,
26+
};
27+
28+
enum _GUESTSWAPEFFECT : int32_t
29+
{
30+
GUESTSWAPEFFECT_DISCARD = 0x1,
31+
GUESTSWAPEFFECT_FLIP = 0x2,
32+
GUESTSWAPEFFECT_COPY = 0x3,
33+
GUESTSWAPEFFECT_FORCE_DWORD = 0x7FFFFFFF,
34+
};
35+
36+
enum _GUESTCOLORSPACE : int32_t
37+
{
38+
GUESTCOLORSPACE_RGB = 0x0,
39+
GUESTCOLORSPACE_YCbCr601 = 0x1,
40+
GUESTCOLORSPACE_YCbCr709 = 0x2,
41+
GUESTCOLORSPACE_FORCE_DWORD = 0x7FFFFFFF,
42+
};
43+
44+
struct _GUESTRING_BUFFER_PARAMETERS
45+
{
46+
be<uint32_t> Flags;
47+
be<uint32_t> PrimarySize;
48+
xpointer<void> pPrimary;
49+
be<uint32_t> SecondarySize;
50+
xpointer<void> pSecondary;
51+
be<uint32_t> SegmentCount;
52+
};
53+
54+
struct _GUESTVIDEO_SCALER_PARAMETERS
55+
{
56+
GuestRect ScalerSourceRect;
57+
be<uint32_t> ScaledOutputWidth;
58+
be<uint32_t> ScaledOutputHeight;
59+
be<uint32_t> FilterProfile;
60+
};
61+
62+
struct _GUESTPRESENT_PARAMETERS_
63+
{
64+
be<uint32_t> BackBufferWidth;
65+
be<uint32_t> BackBufferHeight;
66+
be<GuestFormat> BackBufferFormat;
67+
be<uint32_t> BackBufferCount;
68+
be<_GUESTMULTISAMPLE_TYPE> MultiSampleType;
69+
be<uint32_t> MultiSampleQuality;
70+
be<_GUESTSWAPEFFECT> SwapEffect;
71+
xpointer<void> hDeviceWindow; //HWND??
72+
be<int32_t> Windowed;
73+
be<int32_t> EnableAutoDepthStencil;
74+
be<GuestFormat> AutoDepthStencilFormat;
75+
be<uint32_t> Flags;
76+
be<uint32_t> FullScreen_RefreshRateInHz;
77+
be<uint32_t> PresentationInterval;
78+
be<int32_t> DisableAutoBackBuffer;
79+
be<int32_t> DisableAutoFrontBuffer;
80+
be<GuestFormat> FrontBufferFormat;
81+
be < _GUESTCOLORSPACE> FrontBufferColorSpace;
82+
_GUESTRING_BUFFER_PARAMETERS RingBufferParameters;
83+
_GUESTVIDEO_SCALER_PARAMETERS VideoScalerParameters;
84+
};
85+
86+
struct GuestDeviceInfo
87+
{
88+
be<uint32_t> GuestDeviceState;
89+
xpointer<::GuestDevice> pGuestDevice;
90+
GuestSurfaceCreateParams SurfaceParamA;
91+
GuestSurfaceCreateParams SurfaceParamB;
92+
GuestSurfaceCreateParams SurfaceParamC;
93+
xpointer<GuestSurface> pColorTile2X;
94+
xpointer<GuestSurface> pDepthTile2X;
95+
xpointer<GuestSurface> pColorTile4X;
96+
xpointer<GuestSurface> pDepthTile4X;
97+
_GUESTPRESENT_PARAMETERS_ GuestPresentParameters;
98+
};
99+
100+
GuestDeviceInfo m_GuestDeviceInfo;
101+
102+
//TODO: check once more these (for order)
103+
be<uint64_t> m_DeltaTimePost;
104+
be<uint64_t> m_DeltaTimePre;
105+
106+
bool m_IsBufferInitialized; //buffers? all initialized, created, better name pls
107+
MARATHON_INSERT_PADDING(7);
108+
xpointer<GuestTexture> m_pFrontBufferTexture;
109+
xpointer<GuestSurface> m_pBackBufferSurface;
110+
xpointer<GuestSurface> m_pDepthStencilSurface;
111+
xpointer<GuestSurface> m_pColorTile2X;
112+
xpointer<GuestSurface> m_pDepthTile2X;
113+
xpointer<GuestSurface> m_pColorTile4X;
114+
xpointer<GuestSurface> m_pDepthTile4X;
115+
116+
be<uint32_t> m_ShaderVertexCount;
117+
be<uint32_t> m_PixelShaderVertexCount;
118+
be<uint32_t> m_hNotification; //handle
119+
120+
MARATHON_INSERT_PADDING(0x60);
12121

13122
static ApplicationXenon* GetInstance();
14123
};
124+
//0x384
15125
}
16126

17127
#include <Sonicteam/SoX/ApplicationXenon.inl>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#pragma once
2+
3+
#include <Marathon.h>
4+
5+
namespace Sonicteam::SoX
6+
{
7+
/*
8+
for (j = 1; j >= 0; --j)
9+
{
10+
v8 += 0xFFFFFFFF;
11+
if (*v8)
12+
RefCountObjectRemoveReference(*v8);
13+
}
14+
* if you have better name suggestion do IT */
15+
//be<T> or RefSharedPointer
16+
template <typename T, uint32_t count>
17+
class Array
18+
{
19+
private:
20+
T m_container[count];
21+
22+
public:
23+
Array()
24+
{
25+
}
26+
~Array() = default;
27+
28+
T& operator[](uint32_t index)
29+
{
30+
return m_container[index];
31+
}
32+
33+
const T& operator[](uint32_t index) const
34+
{
35+
return m_container[index];
36+
}
37+
38+
uint32_t size() const
39+
{
40+
return count;
41+
}
42+
};
43+
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#pragma once
22

33
#include <Marathon.inl>
4+
#include <Sonicteam/SoX/Object.h>
5+
#include <Sonicteam/SoX/Engine/Doc.h>
46

57
namespace Sonicteam::SoX::Engine
68
{
7-
class Application
9+
class Application: SoX::Object
810
{
911
public:
10-
xpointer<void> m_pVftable;
11-
MARATHON_INSERT_PADDING(8);
12+
bool IsField4;
13+
xpointer<SoX::Engine::Doc> m_pDoc;
1214
};
1315
}

MarathonRecomp/api/Sonicteam/SoX/Graphics/Device.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#include <Marathon.inl>
44
#include <Sonicteam/SoX/Math/Matrix.h>
5+
#include <Sonicteam/SoX/RefCountObject.h>
6+
#include <Sonicteam/SoX/RefSharedPointer.h>
57

68
namespace Sonicteam::SoX::Graphics
79
{
@@ -12,6 +14,8 @@ namespace Sonicteam::SoX::Graphics
1214
MARATHON_INSERT_PADDING(0x3C);
1315
Math::Matrix4x4 m_Field40;
1416
be<float> m_Field80;
15-
MARATHON_INSERT_PADDING(0x4C);
17+
MARATHON_INSERT_PADDING(0x3C);
18+
SoX::RefSharedPointer<SoX::RefCountObject> m_FrameBufferObject;
19+
MARATHON_INSERT_PADDING(0xC);
1620
};
1721
}

0 commit comments

Comments
 (0)