Skip to content

Commit edef18f

Browse files
authored
PeridotTrace (isledecomp#292)
1 parent 239b31b commit edef18f

4 files changed

Lines changed: 83 additions & 27 deletions

File tree

LEGORacers/include/peridottrace0x4e0.h

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "decomp.h"
55
#include "displaydriverguid.h"
6+
#include "golfile.h"
67
#include "types.h"
78

89
#include <string.h>
@@ -116,6 +117,7 @@ class PeridotTraceBase0x24 {
116117
void FUN_0042b830();
117118

118119
friend class PeridotTrace0x4a8;
120+
friend class PeridotTrace0x4e0;
119121

120122
LegoU32 m_unk0x00; // 0x00
121123
Record* m_unk0x04; // 0x04
@@ -156,27 +158,51 @@ class PeridotTrace0x4a8 : public PeridotTraceBase0x24 {
156158
undefined4 m_unk0x4a4;
157159
};
158160

159-
// SIZE 0x34
160-
class PeridotTraceActionBase0x34 {
161+
// VTABLE: LEGORACERS 0x004b0fac
162+
// SIZE 0x30
163+
class PeridotTraceActionFile0x30 : public GolFile {
161164
public:
162-
PeridotTraceActionBase0x34();
163-
~PeridotTraceActionBase0x34();
165+
~PeridotTraceActionFile0x30() override; // vtable+0x18
164166

165167
enum {
166168
c_unk0x08Flag0x01 = 1 << 0,
167169
};
168170

169-
LegoBool32 HasUnk0x08Flag0x01() const { return m_unk0x08 & c_unk0x08Flag0x01; }
171+
LegoS32 BufferedOpen(const LegoChar* p_fileName, LegoS32 p_mode, LegoU32 p_bufferSize) override; // vtable+0x1c
172+
LegoS32 Dispose() override; // vtable+0x20
173+
174+
LegoBool32 HasUnk0x08Flag0x01() const { return m_flags & c_unk0x08Flag0x01; }
175+
176+
// SYNTHETIC: LEGORACERS 0x0044e110
177+
// PeridotTraceActionFile0x30::`scalar deleting destructor'
178+
};
179+
180+
// VTABLE: LEGORACERS 0x004b1288
181+
// SIZE 0x34
182+
class PeridotTraceActionBase0x34 : public PeridotTraceActionFile0x30 {
183+
public:
184+
PeridotTraceActionBase0x34();
185+
186+
// SYNTHETIC: LEGORACERS 0x00450e70 FOLDED
187+
// PeridotTraceActionBase0x34::~PeridotTraceActionBase0x34
188+
189+
// SYNTHETIC: LEGORACERS 0x00450e50 FOLDED
190+
// PeridotTraceActionBase0x34::`scalar deleting destructor'
170191

171192
private:
172-
undefined4 m_unk0x00; // 0x00
173-
undefined4 m_unk0x04; // 0x04
174-
LegoU32 m_unk0x08; // 0x08
175-
undefined m_unk0x0c[0x34 - 0x0c]; // 0x0c
193+
undefined4 m_unk0x30; // 0x30
176194
};
177195

196+
// VTABLE: LEGORACERS 0x004b0ba4
178197
// SIZE 0x34
179-
class PeridotTraceAction0x34 : public PeridotTraceActionBase0x34 {};
198+
class PeridotTraceAction0x34 : public PeridotTraceActionBase0x34 {
199+
public:
200+
// SYNTHETIC: LEGORACERS 0x00450e70 FOLDED
201+
// PeridotTraceAction0x34::~PeridotTraceAction0x34
202+
203+
// SYNTHETIC: LEGORACERS 0x00450e50 FOLDED
204+
// PeridotTraceAction0x34::`scalar deleting destructor'
205+
};
180206

181207
// SIZE 0x4e0
182208
class PeridotTrace0x4e0 : public PeridotTrace0x4a8 {

LEGORacers/src/peridottrace0x4a8.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,27 @@ void PeridotTrace0x4a8::FUN_00442c20(PeridotTracePersistentState* p_state)
138138
}
139139
}
140140

141-
// STUB: LEGORACERS 0x004437e0
141+
// FUNCTION: LEGORACERS 0x004437e0
142142
PeridotTrace0x4e0::PeridotTrace0x4e0()
143143
{
144-
// TODO
145-
STUB(0x4437e0);
144+
m_unk0x4a8 = NULL;
146145
}
147146

148-
// STUB: LEGORACERS 0x00443840
147+
// FUNCTION: LEGORACERS 0x00443840
149148
PeridotTrace0x4e0::~PeridotTrace0x4e0()
150149
{
151-
// TODO
152-
STUB(0x443840);
150+
FUN_004438e0();
153151
}
154152

155-
// STUB: LEGORACERS 0x004438e0
153+
// FUNCTION: LEGORACERS 0x004438e0
156154
void PeridotTrace0x4e0::FUN_004438e0()
157155
{
158-
// TODO
159-
STUB(0x4438e0);
156+
if (m_unk0x4ac.GetFlags() & GolStream::c_flagOpen) {
157+
PeridotTraceActionBase0x34* action = &m_unk0x4ac;
158+
action->Dispose();
159+
}
160+
161+
PeridotTraceBase0x24::Destroy();
160162
}
161163

162164
// STUB: LEGORACERS 0x00443910
Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,46 @@
11
#include "peridottrace0x4e0.h"
22

3+
DECOMP_SIZE_ASSERT(PeridotTraceActionFile0x30, 0x30)
34
DECOMP_SIZE_ASSERT(PeridotTraceActionBase0x34, 0x34)
45
DECOMP_SIZE_ASSERT(PeridotTraceAction0x34, 0x34)
56

6-
// STUB: LEGORACERS 0x0044e0a0
7-
PeridotTraceActionBase0x34::~PeridotTraceActionBase0x34()
7+
// FUNCTION: LEGORACERS 0x0044e0a0
8+
PeridotTraceActionFile0x30::~PeridotTraceActionFile0x30()
89
{
9-
// TODO
10-
STUB(0x44e0a0);
10+
if (m_buffer) {
11+
delete[] m_buffer;
12+
m_buffer = NULL;
13+
}
14+
15+
Dispose();
16+
}
17+
18+
// STUB: LEGORACERS 0x0044e130
19+
LegoS32 PeridotTraceActionFile0x30::BufferedOpen(const LegoChar* p_fileName, LegoS32 p_mode, LegoU32 p_bufferSize)
20+
{
21+
STUB(0x0044e130);
22+
return GolStream::BufferedOpen(p_fileName, p_mode, p_bufferSize);
23+
}
24+
25+
// FUNCTION: LEGORACERS 0x0044e1e0
26+
LegoS32 PeridotTraceActionFile0x30::Dispose()
27+
{
28+
if (!(m_mode & c_modeKeepBuffer) && m_buffer) {
29+
delete[] m_buffer;
30+
m_buffer = NULL;
31+
}
32+
33+
LegoS32 result = Close();
34+
35+
m_bufferStart = 0;
36+
m_bufferEnd = 0;
37+
m_mode = 0;
38+
m_flags = 0;
39+
return result;
1140
}
1241

13-
// STUB: LEGORACERS 0x00450e30
42+
// FUNCTION: LEGORACERS 0x00450e30
1443
PeridotTraceActionBase0x34::PeridotTraceActionBase0x34()
1544
{
16-
// TODO
17-
STUB(0x450e30);
45+
m_unk0x30 = 0;
1846
}

LEGORacers/src/peridottraceroot0x108.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ PeridotTraceRootEntry0x10::PeridotTraceRootEntry0x10()
7979
m_index = 0;
8080
}
8181

82-
// STUB: LEGORACERS 0x004510e0
82+
// FUNCTION: LEGORACERS 0x004510e0
8383
PeridotTraceRootEntry0x10::~PeridotTraceRootEntry0x10()
8484
{
8585
Reset();

0 commit comments

Comments
 (0)