Skip to content

Commit 0b88fe6

Browse files
committed
Proper WindowsResize
Particles & CSM & Reflection & Hint Text & Combo Text TODO : Proper Main Menu MST Text during Resize
1 parent 700265b commit 0b88fe6

File tree

10 files changed

+417
-172
lines changed

10 files changed

+417
-172
lines changed

MarathonRecomp/api/Sonicteam/DocMarathonImp.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <Sonicteam/RaderMapManager.h>
1010
#include <Sonicteam/RenderTargetContainer.h>
1111
#include <Sonicteam/Particles/ParticleManager.h>
12+
#include <Sonicteam/SoX/LinkNode.h>
13+
#include <Sonicteam/SoX/Thread.h>
1214
#include <stdx/vector.h>
1315

1416
namespace Sonicteam
@@ -25,11 +27,16 @@ namespace Sonicteam
2527
MARATHON_INSERT_PADDING(4);
2628
xpointer<RenderTargetContainer> m_pRenderTargetContainer;
2729
xpointer<SFXAgent> m_pSFXAgent;
28-
MARATHON_INSERT_PADDING(0x2A4);
30+
MARATHON_INSERT_PADDING(0xC);
31+
be<uint32_t> m_PauseFlags;
32+
MARATHON_INSERT_PADDING(0x8);
33+
xpointer<SoX::LinkedList<SoX::Thread>> m_lnThread;
34+
MARATHON_INSERT_PADDING(0x288);
2935
xpointer<Particles::ParticleManager> m_pParticleManager;
3036
MARATHON_INSERT_PADDING(0x15D0);
3137
xpointer<RaderMapManager> m_pRaderMapManager;
3238
MARATHON_INSERT_PADDING(0x542D0);
3339
be<uint32_t> m_PlayerControllerID[4];
3440
};
41+
MARATHON_ASSERT_OFFSETOF(DocMarathonImp, m_PauseFlags, 0xEC);
3542
}

MarathonRecomp/api/Sonicteam/SoX/Component.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ namespace Sonicteam::SoX
1414
class Component : public Object
1515
{
1616
public:
17+
struct Vftable : public Object::Vftable
18+
{
19+
be<uint32_t> fpDestroy;
20+
be<uint32_t> fpUpdate;
21+
};
22+
1723
xpointer<Component> m_pParent;
1824
LinkNode<Component> m_lnComponent;
1925
LinkedList<Component> m_llComponent;
@@ -23,5 +29,11 @@ namespace Sonicteam::SoX
2329
{
2430
return (T*)m_pParent.get();
2531
}
32+
33+
void Update(float delta)
34+
{
35+
auto vft = (Vftable*)m_pVftable.get();
36+
GuestToHostFunction<void>(vft->fpUpdate, this,delta);
37+
}
2638
};
2739
}

MarathonRecomp/api/Sonicteam/SoX/Engine/Doc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ namespace Sonicteam::SoX::Engine
1919
MARATHON_INSERT_PADDING(8);
2020
xpointer<Task> m_pDocModeExecutor;
2121
xpointer<RenderScheduler> m_pRenderScheduler;
22-
MARATHON_INSERT_PADDING(0x38);
22+
XRTL_CRITICAL_SECTION m_CriticalSection1;
23+
XRTL_CRITICAL_SECTION m_CriticalSection2;
2324

2425
template <typename T = DocMode>
2526
inline T* GetDocMode()

MarathonRecomp/api/Sonicteam/SoX/Engine/Task.h

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ namespace Sonicteam::SoX::Engine
1212
class Task : public Component, public MessageReceiver
1313
{
1414
public:
15-
be<uint32_t> m_Flags;
15+
char m_Flag1;
16+
MARATHON_INSERT_PADDING(3);
1617
be<uint32_t> m_Timestamp;
1718
xpointer<Task> m_pPrevSibling;
1819
xpointer<Task> m_pNextSibling;
@@ -21,7 +22,34 @@ namespace Sonicteam::SoX::Engine
2122
xpointer<Doc> m_pDoc;
2223
LinkNode<Task> m_lnTask;
2324

24-
Task* GetFirstDependency() const
25+
class Iterator
26+
{
27+
public:
28+
Iterator(Task* current = nullptr) : m_current(current) {}
29+
30+
Task& operator*() const { return *m_current; }
31+
Task* operator->() const { return m_current; }
32+
33+
Iterator& operator++()
34+
{
35+
if (m_current)
36+
m_current = m_current->m_pPrevSibling.get();
37+
return *this;
38+
}
39+
40+
bool operator!=(const Iterator& other) const
41+
{
42+
return m_current != other.m_current;
43+
}
44+
45+
private:
46+
Task* m_current;
47+
};
48+
49+
Iterator begin() { return Iterator(this); }
50+
Iterator end() { return Iterator(nullptr); }
51+
52+
Task* GetFirstDependency() const
2553
{
2654
if (!m_pDependencies)
2755
return nullptr;

MarathonRecomp/api/Sonicteam/SoX/LinkNode.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ namespace Sonicteam::SoX
2727
: m_pCurrent(start ? start->m_pNext.get() : nullptr)
2828
, m_pStart(start)
2929
{
30+
31+
if (m_pStart && m_pStart->m_pNext.get() == m_pStart)
32+
{
33+
m_pCurrent = nullptr;
34+
}
35+
36+
else if (m_pStart)
37+
{
38+
m_pCurrent = m_pStart->m_pNext.get();
39+
}
3040
}
3141

3242
reference operator*() const
@@ -39,7 +49,6 @@ namespace Sonicteam::SoX
3949
return m_pCurrent;
4050
}
4151

42-
// Prefix increment - traverse to next node
4352
iterator& operator++()
4453
{
4554
if (m_pCurrent && m_pCurrent->m_pNext)
@@ -58,7 +67,6 @@ namespace Sonicteam::SoX
5867
return *this;
5968
}
6069

61-
// Postfix increment
6270
iterator operator++(int)
6371
{
6472
iterator tmp = *this;
@@ -95,6 +103,14 @@ namespace Sonicteam::SoX
95103
: m_pCurrent(start ? start->m_pNext.get() : nullptr)
96104
, m_pStart(start)
97105
{
106+
if (m_pStart && m_pStart->m_pNext.get() == m_pStart)
107+
{
108+
m_pCurrent = nullptr;
109+
}
110+
else if (m_pStart)
111+
{
112+
m_pCurrent = m_pStart->m_pNext.get();
113+
}
98114
}
99115

100116
const_iterator(const iterator& it)

MarathonRecomp/api/Sonicteam/SoX/Object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Sonicteam::SoX
1616

1717
const char* GetName() const
1818
{
19-
return GuestToHostFunction<const char*>(m_pVftable->fpGetName.get());
19+
return GuestToHostFunction<const char*>(m_pVftable->fpGetName.get(),this);
2020
}
2121
};
2222
}
Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,59 @@
11
#pragma once
22

33
#include <Marathon.inl>
4+
#include <Sonicteam/SoX/LinkNode.h>
45

56
namespace Sonicteam::SoX
67
{
78
class Thread
89
{
910
public:
10-
xpointer<void> m_pVftable;
11-
MARATHON_INSERT_PADDING(8);
12-
xpointer<Thread> m_pParent;
13-
be<uint32_t> m_EventHandleA;
14-
be<uint32_t> m_EventHandleB;
15-
MARATHON_INSERT_PADDING(4);
16-
be<uint32_t> m_ThreadHandle;
17-
bool m_Field20;
11+
struct Vftable
12+
{
13+
be<uint32_t> fpDestroy;
14+
be<uint32_t> fpFunc4;
15+
be<uint32_t> fpFunc8;
16+
be<uint32_t> fpFuncC;
17+
};
18+
19+
xpointer<Vftable> m_pVftable;
20+
LinkNode<Thread> m_lnThread;
21+
be<uint32_t> m_StartEvent;
22+
be<uint32_t> m_EndEvent;
23+
be<uint32_t> m_ID;
24+
be<uint32_t> m_Handle;
25+
bool m_IsExecutable; // while ( a1->IsExecutable ) ref to 82586C00
1826
MARATHON_INSERT_PADDING(3);
1927
be<float> m_DeltaTime;
20-
MARATHON_INSERT_PADDING(8);
21-
xpointer<const char> m_pName;
2228
MARATHON_INSERT_PADDING(4);
23-
bool m_Field38;
24-
bool m_Field39;
25-
MARATHON_INSERT_PADDING(6);
29+
be<uint32_t> m_StepCount;
30+
xpointer<const char> m_pName;
31+
be<uint32_t> m_StepTime; //ref to 82586A08
32+
bool m_IsThreadReady;
33+
bool m_IsWaitForStartEvent; //ref to 82586C00
34+
MARATHON_INSERT_PADDING(2);
35+
be<uint32_t> m_WaitForEndMicroSeconds; //82586AC0, BaseTimeAfter - BaseTime(Before WaitForEndEvent), then / 1000000 (TICK_PER_SEC )
2636
xpointer<void> m_pContext;
2737
MARATHON_INSERT_PADDING(8);
2838

39+
40+
void Func4()
41+
{
42+
GuestToHostFunction<void>(m_pVftable->fpFunc4, this);
43+
}
44+
45+
void Func8(float delta)
46+
{
47+
GuestToHostFunction<void>(m_pVftable->fpFunc8, this,delta);
48+
}
49+
2950
template <typename T>
3051
T* GetContext()
3152
{
3253
return (T*)m_pContext.get();
3354
}
3455
};
56+
MARATHON_ASSERT_OFFSETOF(Thread, m_StartEvent, 0x10);
57+
MARATHON_ASSERT_OFFSETOF(Thread, m_IsThreadReady, 0x38);
58+
3559
}

MarathonRecomp/api/lua/lua.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ namespace lua50
1111
lua_CFunction func;
1212
};
1313

14+
inline extern const void* lua_topointer(lua_State* L, int idx)
15+
{
16+
return GuestToHostFunction<const void*>(sub_825D5800,L,idx);
17+
}
1418
}

0 commit comments

Comments
 (0)