Skip to content

Commit 232b157

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

31 files changed

+729
-477
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/Particles/Particle.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,22 @@
55

66
namespace Sonicteam::Particles
77
{
8-
class Particle : public ParticleRef
8+
class Particle : public ParticleRef
99
{
1010
struct Vftable : ParticleRef::Vftable
1111
{
1212
be<uint32_t> fpFunc8;
1313
be<uint32_t> fpFuncC;
14-
be<uint32_t> fpFunc10; // Hint : Used Before Release() with arg 0
14+
be<uint32_t> fpFunc10; // Hint: used before Release() with arg 0.
1515
be<uint32_t> fpFunc14;
1616
be<uint32_t> fpFunc18;
1717
be<uint32_t> fpFunc1C;
1818
be<uint32_t> fpFunc20;
1919
};
2020

21-
void Func10(uint32_t flag)
22-
{
23-
auto pVft = (Vftable*)(m_pVftable.get());
24-
GuestToHostFunction<void>(pVft->fpFunc10, this, flag);
25-
}
26-
21+
void Func10(uint32_t flags)
22+
{
23+
GuestToHostFunction<void>(((Vftable*)m_pVftable.get())->fpFunc10, this, flags);
24+
}
2725
};
2826
}

MarathonRecomp/api/Sonicteam/Particles/ParticleRef.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,23 @@ namespace Sonicteam::Particles
77
class ParticleRef
88
{
99
public:
10-
1110
struct Vftable
1211
{
1312
be<uint32_t> fpDestroy;
1413
be<uint32_t> fpRelease;
1514
};
1615

17-
void Destroy(uint32_t flag)
16+
xpointer<Vftable> m_pVftable;
17+
be<uint32_t> m_ReferenceCount;
18+
19+
void Destroy(uint8_t flags = 1)
1820
{
19-
GuestToHostFunction<void>(m_pVftable->fpDestroy, this, flag);
21+
GuestToHostFunction<void>(m_pVftable->fpDestroy, this, flags);
2022
}
2123

2224
void Release()
2325
{
2426
GuestToHostFunction<void>(m_pVftable->fpRelease, this);
2527
}
26-
27-
xpointer<Vftable> m_pVftable;
28-
be<uint32_t> m_RefCount;
2928
};
3029
}
Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,34 @@
11
#pragma once
22

33
#include <Marathon.inl>
4-
#include <Sonicteam/SoX/LinkNode.h>
5-
#include <Sonicteam/SoX/Graphics/FrameObserver.h>
64
#include <Sonicteam/Particles/Particle.h>
5+
#include <Sonicteam/Player/Effect/ParticleLuaTable.h>
6+
#include <Sonicteam/SoX/Graphics/FrameObserver.h>
77
#include <Sonicteam/SoX/Math/Vector.h>
8+
#include <Sonicteam/SoX/LinkNode.h>
89

910
namespace Sonicteam::Player::Effect
1011
{
11-
// Temp Name, Position
12-
struct ParticleLuaInfo
13-
{
14-
be<uint16_t> BankID;
15-
be<uint16_t> ParticleID;
16-
bool IsAcroarts; //kinda?
17-
bool IsReverse;
18-
be<uint32_t> Direction;
19-
xpointer<const char> AttachNode; //Bone Name
20-
be<float> OffsetX;
21-
be<float> OffsetY;
22-
be<float> OffsetZ;
23-
};
24-
25-
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, BankID, 0x0);
26-
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, IsAcroarts, 0x4);
27-
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, IsReverse, 0x5);
28-
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, Direction, 0x8);
29-
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, AttachNode,0xC);
30-
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, OffsetX, 0x10);
31-
MARATHON_ASSERT_SIZEOF(ParticleLuaInfo, 0x1C);
32-
33-
34-
class ParticleJoint : public SoX::Graphics::FrameObserver::FrameObserver
12+
class ParticleJoint : public SoX::Graphics::FrameObserver
3513
{
3614
public:
3715
xpointer<Particles::Particle> m_pParticle;
3816
bool m_IsAcroarts;
3917
bool m_IsReverse;
4018
be<uint32_t> m_Direction;
41-
xpointer<const char> m_pAttachNode;
19+
xpointer<const char> m_pNodeName;
4220
SoX::Math::Vector m_Offset;
4321
SoX::Math::Vector m_Position;
44-
SoX::Math::Vector m_Rotation; //i guess
22+
SoX::Math::Vector m_Rotation;
4523
};
4624

4725
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_pParticle, 0x14);
4826
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_IsAcroarts, 0x18);
4927
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_IsReverse, 0x19);
5028
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_Direction, 0x1C);
51-
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_pAttachNode, 0x20);
29+
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_pNodeName, 0x20);
5230
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_Offset, 0x30);
5331
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_Position, 0x40);
5432
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_Rotation, 0x50);
5533
MARATHON_ASSERT_SIZEOF(ParticleJoint, 0x60);
56-
5734
}
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+
5+
namespace Sonicteam::Player::Effect
6+
{
7+
struct ParticleLuaInfo
8+
{
9+
be<uint16_t> BankID;
10+
be<uint16_t> ParticleID;
11+
bool IsAcroarts;
12+
bool IsReverse;
13+
be<uint32_t> Direction;
14+
xpointer<const char> pNodeName;
15+
be<float> OffsetX;
16+
be<float> OffsetY;
17+
be<float> OffsetZ;
18+
};
19+
20+
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, BankID, 0x0);
21+
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, IsAcroarts, 0x4);
22+
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, IsReverse, 0x5);
23+
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, Direction, 0x8);
24+
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, pNodeName, 0xC);
25+
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, OffsetX, 0x10);
26+
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, OffsetY, 0x14);
27+
MARATHON_ASSERT_OFFSETOF(ParticleLuaInfo, OffsetZ, 0x18);
28+
MARATHON_ASSERT_SIZEOF(ParticleLuaInfo, 0x1C);
29+
}

0 commit comments

Comments
 (0)