Skip to content

API Improvements#189

Closed
IsaacMarovitz wants to merge 25 commits into
sonicnext-dev:mainfrom
IsaacMarovitz:graphics-api
Closed

API Improvements#189
IsaacMarovitz wants to merge 25 commits into
sonicnext-dev:mainfrom
IsaacMarovitz:graphics-api

Conversation

@IsaacMarovitz

@IsaacMarovitz IsaacMarovitz commented Nov 4, 2025

Copy link
Copy Markdown
Member

Adds a bunch of headers for mostly graphics and graphics adjacent things. Some are more researched than others.

{
public:
xpointer<void> m_pVftable;
MARATHON_INSERT_PADDING(0x4);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These first two may be properties of the base class

Comment thread MarathonRecomp/api/Sonicteam/MyRenderProcess.h Outdated
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Co-authored-by: ReimousTH <reimousth@gmail.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
@IsaacMarovitz
IsaacMarovitz marked this pull request as ready for review November 6, 2025 18:17
@IsaacMarovitz IsaacMarovitz changed the title Graphics API Improvements API Improvements Nov 6, 2025
@IsaacMarovitz
IsaacMarovitz requested a review from hyperbx November 6, 2025 18:37

@hyperbx hyperbx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot of empty classes in here, are these awaiting mappings or are they just here for the sake of it?

It makes me a bit uneasy given some of these mappings are incorrect at a glance, so I don't know if half of this stuff has even been tested.

}

template<typename T>
shared_ptr<T> make_shared(T* pointer,uint32_t vftable)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
shared_ptr<T> make_shared(T* pointer,uint32_t vftable)
shared_ptr<T> make_shared(T* pointer, uint32_t vftable)

Comment on lines +12 to +13
xpointer<const char> m_pName;
lua_CFunction m_Func;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use official Lua variable names.

Suggested change
xpointer<const char> m_pName;
lua_CFunction m_Func;
xpointer<const char> name;
lua_CFunction func;

Comment on lines +10 to +11
//.peb

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//.peb

Comment on lines +14 to +25
// No name left for type
class EffectBankData
{
public:
be<uint32_t> m_Field0; // 0x3E - no idea
stdx::string m_DataName; // player_sonic
// From .peb (raw converted since they released after)
xpointer<void> m_Data1;
xpointer<void> m_Data2;
xpointer<void> m_Data3;
stdx::map<stdx::string, be<uint32_t>> m_EffectDataIndices; // barrier_g = 0x23
};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// No name left for type
class EffectBankData
{
public:
be<uint32_t> m_Field0; // 0x3E - no idea
stdx::string m_DataName; // player_sonic
// From .peb (raw converted since they released after)
xpointer<void> m_Data1;
xpointer<void> m_Data2;
xpointer<void> m_Data3;
stdx::map<stdx::string, be<uint32_t>> m_EffectDataIndices; // barrier_g = 0x23
};
struct EffectBankData
{
be<uint32_t> Field00;
stdx::string Name;
xpointer<void> pData1;
xpointer<void> pData2;
xpointer<void> pData3;
stdx::map<stdx::string, be<uint32_t>> mEffectDataIndices;
};

Comment on lines +27 to +38
MARATHON_ASSERT_OFFSETOF(EffectBankData, m_EffectDataIndices, 0x2C);
MARATHON_ASSERT_SIZEOF(EffectBankData, 0x38);

class EffectBank : public SoX::RefCountObject
{
public:
xpointer<ParticleEngine> m_pParticleEngine;
be<uint32_t> m_FieldC; // Index ?
xpointer<EffectBankData> m_pEffectBankA;
};

MARATHON_ASSERT_SIZEOF(EffectBank, 0x14);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Place assertions below classes.

Suggested change
MARATHON_ASSERT_OFFSETOF(EffectBankData, m_EffectDataIndices, 0x2C);
MARATHON_ASSERT_SIZEOF(EffectBankData, 0x38);
class EffectBank : public SoX::RefCountObject
{
public:
xpointer<ParticleEngine> m_pParticleEngine;
be<uint32_t> m_FieldC; // Index ?
xpointer<EffectBankData> m_pEffectBankA;
};
MARATHON_ASSERT_SIZEOF(EffectBank, 0x14);
class EffectBank : public SoX::RefCountObject
{
public:
xpointer<ParticleEngine> m_pParticleEngine;
be<uint32_t> m_Field0C; // Index?
xpointer<EffectBankData> m_pEffectBankA;
};
MARATHON_ASSERT_OFFSETOF(EffectBankData, mEffectDataIndices, 0x2C);
MARATHON_ASSERT_SIZEOF(EffectBankData, 0x38);
MARATHON_ASSERT_SIZEOF(EffectBank, 0x14);

Comment on lines +13 to +37
class DocMarathonImp;

struct SFXMatrixArrayCounted;
struct SFXMatrixArrayNode;
struct SFXMatrixArray;

struct SFXMatrixArrayCounted
{
be<uint32_t> m_Capacity;
};

struct SFXMatrixArrayNode
{
xpointer<SoX::Math::Matrix4x4> m_pData[4];

SFXMatrixArray* GetArray()
{
return reinterpret_cast<SFXMatrixArray*>((uint64_t*)((uint64_t)this - 4));
}
};

struct SFXMatrixArray : SFXMatrixArrayCounted, SFXMatrixArrayNode
{

};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class DocMarathonImp;
struct SFXMatrixArrayCounted;
struct SFXMatrixArrayNode;
struct SFXMatrixArray;
struct SFXMatrixArrayCounted
{
be<uint32_t> m_Capacity;
};
struct SFXMatrixArrayNode
{
xpointer<SoX::Math::Matrix4x4> m_pData[4];
SFXMatrixArray* GetArray()
{
return reinterpret_cast<SFXMatrixArray*>((uint64_t*)((uint64_t)this - 4));
}
};
struct SFXMatrixArray : SFXMatrixArrayCounted, SFXMatrixArrayNode
{
};
struct SFXMatrixNodeArray;
struct SFXMatrixNode
{
xpointer<SoX::Math::Matrix4x4> m_pData[4];
SFXMatrixArray* GetArray()
{
return reinterpret_cast<SFXMatrixArray*>((uint8_t*)this - 4);
}
};
struct SFXMatrixNodeArray
{
be<uint32_t> m_Length;
SFXMatrixNode m_First;
};

Comment on lines +45 to +46
be<uint32_t> fpFieldC; //some with capture0
be<uint32_t> fpField10; //some with capture0, yes again

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
be<uint32_t> fpFieldC; //some with capture0
be<uint32_t> fpField10; //some with capture0, yes again
be<uint32_t> fpField0C;
be<uint32_t> fpField10;

Comment on lines +50 to +52
xpointer<SFXMatrixArrayNode> m_aSFXMatrices1;
xpointer<SFXMatrixArrayNode> m_aSFXMatrices2;
stdx::map<stdx::string, boost::shared_ptr<SoX::Engine::RenderProcess>> m_msspRenderProcess;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xpointer<SFXMatrixArrayNode> m_aSFXMatrices1;
xpointer<SFXMatrixArrayNode> m_aSFXMatrices2;
stdx::map<stdx::string, boost::shared_ptr<SoX::Engine::RenderProcess>> m_msspRenderProcess;
xpointer<SFXMatrixNode> m_aSFXMatrices1;
xpointer<SFXMatrixNode> m_aSFXMatrices2;
stdx::map<stdx::string, boost::shared_ptr<SoX::Engine::RenderProcess>> m_mspRenderProcesses;

};

MARATHON_ASSERT_SIZEOF(SFXAgent, 0x24);
MARATHON_ASSERT_OFFSETOF(SFXAgent, m_msspRenderProcess, 0x10);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MARATHON_ASSERT_OFFSETOF(SFXAgent, m_msspRenderProcess, 0x10);
MARATHON_ASSERT_OFFSETOF(SFXAgent, m_mspRenderProcess, 0x10);

xpointer<DocMarathonImp> m_pDoc;
xpointer<SFXMatrixArrayNode> m_aSFXMatrices1;
xpointer<SFXMatrixArrayNode> m_aSFXMatrices2;
stdx::map<stdx::string, boost::shared_ptr<SoX::Engine::RenderProcess>> m_msspRenderProcess;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing offset assertions.

@hyperbx hyperbx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot of empty classes in here, are these awaiting mappings or are they just here for the sake of it?

It makes me a bit uneasy given some of these mappings are incorrect at a glance, so I don't know if half of this stuff has even been tested.

@IsaacMarovitz
IsaacMarovitz marked this pull request as draft November 7, 2025 03:28
@hyperbx

hyperbx commented Nov 8, 2025

Copy link
Copy Markdown
Collaborator

Closing as these changes should be merged in with work from other branches, rather than being one large PR.

@hyperbx hyperbx closed this Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants