Skip to content

Commit 022c388

Browse files
committed
After
1 parent 4bdfb37 commit 022c388

4 files changed

Lines changed: 129 additions & 6 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#pragma once
2+
3+
#include <Marathon.inl>
4+
#include <Sonicteam/Particles/ParticleRef.h>
5+
6+
namespace Sonicteam::Particles
7+
{
8+
class Particle : public ParticleRef
9+
{
10+
struct Vftable : ParticleRef::Vftable
11+
{
12+
be<uint32_t> fpFunc8;
13+
be<uint32_t> fpFuncC;
14+
be<uint32_t> fpFunc10; // Hint : Used Before Release() with arg 0
15+
be<uint32_t> fpFunc14;
16+
be<uint32_t> fpFunc18;
17+
be<uint32_t> fpFunc1C;
18+
be<uint32_t> fpFunc20;
19+
};
20+
21+
void Func10(uint32_t flag)
22+
{
23+
auto pVft = (Vftable*)(m_pVftable.get());
24+
GuestToHostFunction<void>(pVft->fpFunc10, this, flag);
25+
}
26+
27+
};
28+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#pragma once
2+
3+
#include <Marathon.inl>
4+
5+
namespace Sonicteam::Particles
6+
{
7+
class ParticleRef
8+
{
9+
public:
10+
11+
struct Vftable
12+
{
13+
be<uint32_t> fpDestroy;
14+
be<uint32_t> fpRelease;
15+
};
16+
17+
void Destroy(uint32_t flag)
18+
{
19+
GuestToHostFunction<void>(m_pVftable->fpDestroy, this, flag);
20+
}
21+
22+
void Release()
23+
{
24+
GuestToHostFunction<void>(m_pVftable->fpRelease, this);
25+
}
26+
27+
xpointer<Vftable> m_pVftable;
28+
be<uint32_t> m_RefCount;
29+
};
30+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#pragma once
2+
3+
#include <Marathon.inl>
4+
#include <Sonicteam/SoX/LinkNode.h>
5+
#include <Sonicteam/SoX/Graphics/FrameObserver.h>
6+
#include <Sonicteam/Particles/Particle.h>
7+
#include <Sonicteam/SoX/Math/Vector.h>
8+
9+
namespace Sonicteam::Player::Effect
10+
{
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
35+
{
36+
public:
37+
xpointer<Particles::Particle> m_pParticle;
38+
bool m_IsAcroarts;
39+
bool m_IsReverse;
40+
be<uint32_t> m_Direction;
41+
xpointer<const char> m_pAttachNode;
42+
SoX::Math::Vector m_Offset;
43+
SoX::Math::Vector m_Position;
44+
SoX::Math::Vector m_Rotation; //i guess
45+
};
46+
47+
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_pParticle, 0x14);
48+
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_IsAcroarts, 0x18);
49+
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_IsReverse, 0x19);
50+
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_Direction, 0x1C);
51+
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_pAttachNode, 0x20);
52+
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_Offset, 0x30);
53+
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_Position, 0x40);
54+
MARATHON_ASSERT_OFFSETOF(ParticleJoint, m_Rotation, 0x50);
55+
MARATHON_ASSERT_SIZEOF(ParticleJoint, 0x60);
56+
57+
}

MarathonRecomp/gpu/video.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3314,16 +3314,19 @@ void Video::Present()
33143314

33153315

33163316
// Update surfaces and textures
3317-
for (auto& surface : pRenderTargetContainer->m_mspDepthStencill_1_4) {
3317+
for (auto& surface : pRenderTargetContainer->m_mspDepthStencill_1_4)
3318+
{
33183319
printf("Buffer %s scaled \n", surface.first.c_str());
33193320
if (_buffers_.find(surface.first.c_str()) == _buffers_.end()) continue;
33203321
auto params = _buffers_[surface.first.c_str()];
33213322
GuestSurfaceCreateParams* surfaceparams = nullptr;
33223323

3323-
if (pFormatConfig[params.r8].usage != 1 || (params.r10 & 1) != 0) {
3324+
if (pFormatConfig[params.r8].usage != 1 || (params.r10 & 1) != 0)
3325+
{
33243326
surfaceparams = &pMyGraphicDevice->m_SurfaceParamB;
33253327
}
3326-
else {
3328+
else
3329+
{
33273330
surfaceparams = (params.r10 & 2) == 0 ? &pMyGraphicDevice->m_SurfaceParamA : &pMyGraphicDevice->m_SurfaceParamC;
33283331
}
33293332

@@ -3333,7 +3336,8 @@ void Video::Present()
33333336

33343337

33353338

3336-
for (auto& texture : pRenderTargetContainer->m_mspFrameBuffer) {
3339+
for (auto& texture : pRenderTargetContainer->m_mspFrameBuffer)
3340+
{
33373341
const auto& textureName = texture.first;
33383342
auto& texturePtr = texture.second;
33393343
if (_buffers_.find(textureName.c_str()) == _buffers_.end()) continue;
@@ -3348,10 +3352,12 @@ void Video::Present()
33483352

33493353
// Determine surface parameters
33503354
GuestSurfaceCreateParams* surfaceparams = nullptr;
3351-
if (pFormatConfig[s2].usage != 1 || (params.r10 & 1) != 0) {
3355+
if (pFormatConfig[s2].usage != 1 || (params.r10 & 1) != 0)
3356+
{
33523357
surfaceparams = &pMyGraphicDevice->m_SurfaceParamB;
33533358
}
3354-
else {
3359+
else
3360+
{
33553361
surfaceparams = (params.r10 & 2) == 0 ? &pMyGraphicDevice->m_SurfaceParamA : &pMyGraphicDevice->m_SurfaceParamC;
33563362
}
33573363

@@ -3438,6 +3444,8 @@ void Video::Present()
34383444
// Refresh Lua Render
34393445
// 0x82B814F8 (stdx::string) gCurrentRenderScript
34403446
GuestToHostFunction<void>(sub_8260DF88, pDocState, 0x82B814F8, 1);
3447+
3448+
// TODO: Fix particle not updating position or disappearing after Lua refresh
34413449

34423450
}
34433451
}

0 commit comments

Comments
 (0)