Skip to content

Commit 9f50318

Browse files
committed
Clean-up, enable gfx options, use pre-existing window resize notifications
1 parent 7085176 commit 9f50318

27 files changed

+682
-433
lines changed

MarathonRecomp/api/Marathon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
#include "Sonicteam/Player/Unit/ITestCase.h"
139139
#include "Sonicteam/Player/Weapon/SonicWeapons.h"
140140
#include "Sonicteam/Player/Zock.h"
141+
#include "Sonicteam/PopupScreenTask.h"
141142
#include "Sonicteam/PropFixture.h"
142143
#include "Sonicteam/RaderMapManager.h"
143144
#include "Sonicteam/RenderTargetContainer.h"

MarathonRecomp/api/Marathon.inl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ constexpr double DEG2RAD = 0.01745329238474369;
2424
#define MARATHON_VIRTUAL_FUNCTION(returnType, virtualIndex, ...) \
2525
GuestToHostFunction<returnType>(*(be<uint32_t>*)(g_memory.Translate(*(be<uint32_t>*)(this) + (4 * virtualIndex))), __VA_ARGS__)
2626

27-
struct marathon_null_ctor {};
27+
struct MARATHON_NULL_CTOR {};
28+
29+
struct MARATHON_STD_MAP_CONST_CHAR_COMPARE
30+
{
31+
bool operator()(xpointer<const char> lhs, xpointer<const char> rhs) const
32+
{
33+
return std::strcmp(lhs.get(), rhs.get()) < 0;
34+
}
35+
};
2836

2937
inline std::vector<std::string_view> ParseTextVariables(const char* pVariables)
3038
{

MarathonRecomp/api/Sonicteam/AppMarathon.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ namespace Sonicteam
2424
};
2525

2626
MARATHON_ASSERT_OFFSETOF(AppMarathon, m_pDocState, 0x180);
27-
28-
2927
}
3028

3129
#include <Sonicteam/AppMarathon.inl>

MarathonRecomp/api/Sonicteam/DocMarathonImp.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
#pragma once
22

33
#include <Marathon.inl>
4+
#include <boost/smart_ptr/shared_ptr.h>
45
#include <Sonicteam/SoX/Engine/Doc.h>
5-
#include <Sonicteam/MyGraphicsDevice.h>
66
#include <Sonicteam/SoX/Input/Manager.h>
7-
#include <boost/smart_ptr/shared_ptr.h>
8-
#include <api/stdx/vector.h>
7+
#include <Sonicteam/MyGraphicsDevice.h>
8+
#include <Sonicteam/RaderMapManager.h>
99
#include <Sonicteam/RenderTargetContainer.h>
10+
#include <stdx/vector.h>
1011

1112
namespace Sonicteam
1213
{
1314
class DocMarathonImp : public SoX::Engine::Doc
1415
{
1516
public:
16-
MARATHON_INSERT_PADDING(0x4);
17-
xpointer<MyGraphicsDevice> m_pMyGraphicDevice;
17+
MARATHON_INSERT_PADDING(4);
18+
xpointer<MyGraphicsDevice> m_pMyGraphicsDevice;
1819
MARATHON_INSERT_PADDING(0x38);
1920
stdx::vector<boost::shared_ptr<SoX::Input::Manager>> m_vspInputManager;
2021
MARATHON_INSERT_PADDING(0x24);
2122
bool m_VFrame;
22-
MARATHON_INSERT_PADDING(0x4);
23+
MARATHON_INSERT_PADDING(4);
2324
xpointer<RenderTargetContainer> m_pRenderTargetContainer;
2425
MARATHON_INSERT_PADDING(0x187C);
25-
xpointer<void> m_pGameRaderMapManager;
26+
xpointer<RaderMapManager> m_pRaderMapManager;
2627
MARATHON_INSERT_PADDING(0x542D0);
2728
be<uint32_t> m_PlayerControllerID[4];
2829
};

MarathonRecomp/api/Sonicteam/GameImp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#include <Sonicteam/SoX/Physics/World.h>
88
#include <Sonicteam/SoX/Scenery/Camera.h>
99
#include <Sonicteam/SoX/Scenery/CameraImp.h>
10-
#include <Sonicteam/SoX/RefSharedPointer.h>
1110
#include <Sonicteam/SoX/LinkNode.h>
12-
#include <Sonicteam/PopupScreenTask.h>
11+
#include <Sonicteam/SoX/RefSharedPointer.h>
1312
#include <Sonicteam/Game.h>
13+
#include <Sonicteam/PopupScreenTask.h>
1414
#include <Sonicteam/TextBook.h>
1515
#include <stdx/vector.h>
1616

@@ -87,7 +87,7 @@ namespace Sonicteam
8787
MARATHON_INSERT_PADDING(4);
8888
xpointer<Mission::Core> m_pMissionCore;
8989
MARATHON_INSERT_PADDING(0x248);
90-
SoX::LinkRef<Sonicteam::PopupScreenTask> m_lrPopulScreenTask;
90+
SoX::LinkRef<Sonicteam::PopupScreenTask> m_lrPopupScreenTask;
9191
MARATHON_INSERT_PADDING(0x4C);
9292
SoX::RefSharedPointer<SoX::Physics::World> m_spPhysicsWorld;
9393
xpointer<void> m_pMyCollisionFilter;

MarathonRecomp/api/Sonicteam/MyGraphicsDevice.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,27 @@
22

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

77
namespace Sonicteam
88
{
9-
109
class MyGraphicsDevice : public SoX::Graphics::Xenon::DeviceXenon
1110
{
1211
public:
13-
// Info : sub_8289CF60(this,CreationDeviceLocal*)
12+
// Info : sub_8289CF60(this, CreationDeviceLocal*)
1413
struct CreationDeviceLocal
1514
{
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;
15+
xpointer<void> pDevice;
16+
D3DXBSURFACE_PARAMETERS SurfaceParamsA;
17+
D3DXBSURFACE_PARAMETERS SurfaceParamsB;
18+
D3DXBSURFACE_PARAMETERS SurfaceParamsC;
19+
xpointer<void> pColorTile2x;
20+
xpointer<void> pDepthTile2x;
21+
xpointer<void> pColorTile4x;
22+
xpointer<void> pDepthTile4x;
2423
be<uint32_t> BackBufferWidth;
2524
be<uint32_t> BackBufferHeight;
26-
xpointer<char> AtgFontFile;
25+
xpointer<uint8_t> pAtgFontFile;
2726
};
2827

2928
MARATHON_INSERT_PADDING(0x180);

MarathonRecomp/api/Sonicteam/PopupScreenTask.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ namespace Sonicteam
1212
public:
1313
SoX::RefSharedPointer<HUDPopupScreen> m_spHUDPopupScreen;
1414

15-
template <typename HUDPopupType>
16-
HUDPopupType* GetHUDPopupScreen()
15+
template <typename T = HUDPopupScreen>
16+
T* GetHUDPopupScreen()
1717
{
18-
return static_cast<HUDPopupType*>(m_spHUDPopupScreen.get());
18+
return static_cast<T*>(m_spHUDPopupScreen.get());
1919
}
2020
};
21-
2221
}

MarathonRecomp/api/Sonicteam/RaderMapManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#pragma once
22

33
#include <Marathon.inl>
4+
#include <Sonicteam/SoX/Graphics/FrameGP.h>
5+
#include <Sonicteam/SoX/Math/Vector.h>
46

57
namespace Sonicteam
68
{
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#pragma once
22

33
#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>
84
#include <Sonicteam/SoX/Graphics/Xenon/SurfaceXenon.h>
95
#include <Sonicteam/SoX/Graphics/Xenon/TextureXenon.h>
106
#include <Sonicteam/SoX/Graphics/Device.h>
7+
#include <Sonicteam/SoX/RefCountObject.h>
8+
#include <Sonicteam/SoX/RefSharedPointer.h>
9+
#include <api/stdx/map.h>
10+
#include <api/stdx/string.h>
1111

1212
namespace Sonicteam
1313
{
@@ -18,12 +18,13 @@ namespace Sonicteam
1818
{
1919
be<uint32_t> fpDestroy;
2020
};
21+
2122
xpointer<Vftable> m_pVftable;
2223
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;
24+
stdx::map<stdx::string, SoX::RefSharedPointer<SoX::Graphics::Xenon::SurfaceXenon>> m_mspDepthStencil_1_4;
25+
stdx::map<stdx::string, SoX::RefSharedPointer<SoX::Graphics::Xenon::SurfaceXenon>> m_mspDepthStencil_256;
2526
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 ?
27+
stdx::map<stdx::string, SoX::RefSharedPointer<SoX::Graphics::Xenon::TextureXenon>> m_mspPostEffect; // reflection, csm, radermap
28+
stdx::map<stdx::string, SoX::RefSharedPointer<SoX::Graphics::Xenon::TextureXenon>> m_mspPostEffectAfter; // radermap_mask
2829
};
2930
}

MarathonRecomp/api/Sonicteam/SoX/ApplicationXenon.h

Lines changed: 29 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -2,126 +2,47 @@
22

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

87
namespace Sonicteam::SoX
98
{
109
class ApplicationXenon : public Engine::Application
1110
{
1211
public:
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
12+
struct DeviceInfo
8713
{
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;
14+
be<uint32_t> DeviceState;
15+
xpointer<void> pDevice;
16+
D3DXBSURFACE_PARAMETERS SurfaceParamsA;
17+
D3DXBSURFACE_PARAMETERS SurfaceParamsB;
18+
D3DXBSURFACE_PARAMETERS SurfaceParamsC;
19+
xpointer<void> pColorTile2x;
20+
xpointer<void> pDepthTile2x;
21+
xpointer<void> pColorTile4x;
22+
xpointer<void> pDepthTile4x;
23+
D3DXBPRESENT_PARAMETERS PresentParameters;
9824
};
9925

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
26+
MARATHON_INSERT_PADDING(4);
27+
be<uint64_t> m_FirstTimeBase;
28+
be<uint64_t> m_FirstPerformanceFrequency;
29+
be<uint32_t> m_DeviceState;
30+
xpointer<void> m_pDevice;
31+
DeviceInfo m_DeviceInfo;
32+
be<uint64_t> m_DeltaTimePost; // TODO: check if these are in the correct order.
33+
be<uint64_t> m_DeltaTimePre; // TODO: check if these are in the correct order.
34+
bool m_IsInitBuffers;
10735
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-
36+
xpointer<void> m_pFrontBufferTexture;
37+
xpointer<void> m_pBackBufferSurface;
38+
xpointer<void> m_pDepthStencilSurface;
39+
xpointer<void> m_pColorTile2x;
40+
xpointer<void> m_pDepthTile2x;
41+
xpointer<void> m_pColorTile4x;
42+
xpointer<void> m_pDepthTile4x;
11643
be<uint32_t> m_ShaderVertexCount;
11744
be<uint32_t> m_PixelShaderVertexCount;
118-
be<uint32_t> m_hNotification; //handle
119-
45+
be<uint32_t> m_hNotification;
12046
MARATHON_INSERT_PADDING(0x60);
121-
122-
//static ApplicationXenon* GetInstance();
12347
};
124-
//0x384
12548
}
126-
127-
//#include <Sonicteam/SoX/ApplicationXenon.inl>

0 commit comments

Comments
 (0)