Skip to content

Commit 8570f78

Browse files
committed
Add GolFileParser (GolFile subclass)
1 parent ee36c0a commit 8570f78

7 files changed

Lines changed: 349 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ set(COMMON_SOURCES
8181
common/src/golfile.cpp
8282
common/src/golfsutil.cpp
8383
common/src/golstream.cpp
84+
common/src/golfileparser.cpp
8485
common/src/golfilesource.cpp
8586
common/src/goldirentry.cpp
8687
common/src/golhashtable.cpp

GolDP/src/goldpexport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ void GolDPExport::VTable0x64(undefined4*)
195195
STUB(0x100156a0);
196196
}
197197

198-
// STUB: GOLDP 0x1002c020
198+
// STUB: GOLDP 0x1002c020 FOLDED
199199
void GolDPExport::VTable0x58(undefined4*)
200200
{
201201
// TODO

common/include/golfile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class GolFile : public GolStream {
1919
LegoS32 Write(void* p_buf, LegoU32 p_size) override; // vtable+0x10
2020
LegoS32 Flush() override; // vtable+0x14
2121

22+
// SYNTHETIC: GOLDP 0x100328e0
2223
// SYNTHETIC: LEGORACERS 0x00450ab0
2324
// GolFile::`scalar deleting destructor'
2425
};

common/include/golfileparser.h

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#ifndef GOLFILEPARSER_H
2+
#define GOLFILEPARSER_H
3+
4+
#include "golfile.h"
5+
6+
#include <string.h>
7+
8+
// SIZE 0x1f0
9+
// VTABLE: GOLDP 0x100578bc
10+
// VTABLE: LEGORACERS 0x004b0ffc
11+
class GolFileParser : public GolFile {
12+
public:
13+
enum ParserErrorCode {
14+
e_syntaxerror = 0,
15+
e_numericTooLong = 1,
16+
e_expectedString = 2,
17+
e_expectedFloat = 3,
18+
e_expectedInt = 4,
19+
e_expectedLeftCurly = 5,
20+
e_expectedRightCurly = 6,
21+
e_expectedLeftBracket = 7,
22+
e_expectedRightBracket = 8,
23+
e_expectedComma = 9,
24+
e_expectedSimicolon = 10,
25+
e_expectedEOF = 11,
26+
e_expectedStringOrBracket = 12,
27+
e_invalidKeyword = 13,
28+
e_invalidString = 14,
29+
e_invalidValue = 15,
30+
e_duplicateName = 16,
31+
e_unsuported = 17,
32+
e_unsuportedKeyword = 18,
33+
e_expectedKeyword = 19
34+
};
35+
36+
GolFileParser();
37+
~GolFileParser() override;
38+
39+
LegoS32 Dispose() override; // vtable+0x20
40+
virtual void VTable0x38(undefined4); // vtable+0x38
41+
virtual const LegoChar* GetSuffix(); // vtable+0x3c
42+
virtual void VTable0x40(undefined4) = 0; // vtable+0x40
43+
virtual undefined4 VTable0x44(); // vtable+0x44
44+
virtual undefined4 VTable0x48(undefined4, undefined4); // vtable+0x48
45+
virtual void VTable0x4c() = 0; // vtable+0x4c
46+
virtual void VTable0x50() = 0; // vtable+0x50
47+
virtual void VTable0x54() = 0; // vtable+0x54
48+
virtual void VTable0x58() = 0; // vtable+0x58
49+
virtual void VTable0x5c() = 0; // vtable+0x5c
50+
virtual void VTable0x60() = 0; // vtable+0x60
51+
virtual void VTable0x64() = 0; // vtable+0x64
52+
virtual void VTable0x68() = 0; // vtable+0x68
53+
virtual void VTable0x6c() = 0; // vtable+0x6c
54+
virtual void VTable0x70() = 0; // vtable+0x70
55+
virtual void VTable0x74() = 0; // vtable+0x74
56+
57+
void FUN_10032580(LegoS32 p_code);
58+
void FUN_10032670(const LegoChar* p_suffix);
59+
undefined4 FUN_100326a0();
60+
float FUN_100326c0();
61+
LegoChar* FUN_100326e0();
62+
LegoChar* FUN_10032700(size_t p_len);
63+
void FUN_10032740(undefined4 p_expected);
64+
void FUN_10032760();
65+
void FUN_10032780();
66+
void FUN_100327a0();
67+
void FUN_100327c0();
68+
undefined4 FUN_100327e0();
69+
70+
const LegoChar* ParserErrorCodeToString(LegoS32 p_code);
71+
72+
// SYNTHETIC: GOLDP 0x10032480
73+
// SYNTHETIC: LEGORACERS 0x0044e5c0
74+
// GolFileParser::`scalar deleting destructor'
75+
76+
private:
77+
undefined4 m_unk0x30; // 0x30
78+
undefined4 m_unk0x34; // 0x34
79+
undefined4 m_unk0x38; // 0x38
80+
undefined m_unk0x3c[0x40 - 0x3c]; // 0x3c
81+
float m_unk0x40; // 0x40
82+
LegoChar m_unk0x44[0x84 - 0x44]; // 0x44
83+
undefined m_unk0x84[0xa4 - 0x84]; // 0x84
84+
LegoChar* m_unk0xa4; // 0xa4
85+
undefined m_unk0xa8[0x1a4 - 0xa8]; // 0xa8
86+
LegoChar* m_filePath; // 0x1a4
87+
LegoChar m_unk0x1a8[0x1e8 - 0x1a8]; // 0x1a8
88+
LegoChar m_suffix[5]; // 0x1a8
89+
};
90+
91+
#endif // GOLFILEPARSER_H

common/src/golfile.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@
1010

1111
DECOMP_SIZE_ASSERT(GolFile, 0x30)
1212

13+
// FUNCTION: GOLDP 0x100328c0
1314
// FUNCTION: LEGORACERS 0x00450a90
1415
GolFile::GolFile()
1516
{
1617
m_fd = -1;
1718
}
1819

20+
// FUNCTION: GOLDP 0x10032900
1921
// FUNCTION: LEGORACERS 0x00450ad0
2022
GolFile::~GolFile()
2123
{
2224
GolStream::Dispose();
2325
}
2426

27+
// FUNCTION: GOLDP 0x10032950
2528
// FUNCTION: LEGORACERS 0x00450b50
2629
LegoS32 GolFile::Open(LegoChar* p_fileName)
2730
{
@@ -90,6 +93,7 @@ LegoS32 GolFile::Open(LegoChar* p_fileName)
9093
return result;
9194
}
9295

96+
// FUNCTION: GOLDP 0x10032a90
9397
// FUNCTION: LEGORACERS 0x00450c90
9498
LegoS32 GolFile::Close()
9599
{
@@ -106,6 +110,7 @@ LegoS32 GolFile::Close()
106110
return e_ioSuccess;
107111
}
108112

113+
// FUNCTION: GOLDP 0x10032ad0
109114
// FUNCTION: LEGORACERS 0x00450cd0
110115
LegoS32 GolFile::Seek(LegoS32 p_offset)
111116
{
@@ -117,6 +122,7 @@ LegoS32 GolFile::Seek(LegoS32 p_offset)
117122
return e_ioSuccess;
118123
}
119124

125+
// FUNCTION: GOLDP 0x10032b00
120126
// FUNCTION: LEGORACERS 0x00450d00
121127
LegoS32 GolFile::Read(void* p_buf, LegoU32 p_size, LegoS32* p_lenRead)
122128
{
@@ -130,12 +136,14 @@ LegoS32 GolFile::Read(void* p_buf, LegoU32 p_size, LegoS32* p_lenRead)
130136
return result != 0 ? e_ioSuccess : e_ioEndOfFile;
131137
}
132138

139+
// FUNCTION: GOLDP 0x10032b40
133140
// FUNCTION: LEGORACERS 0x00450d40
134141
LegoS32 GolFile::Write(void* p_buf, LegoU32 p_size)
135142
{
136143
return _write(m_fd, p_buf, p_size) < 0 ? e_ioWriteError : e_ioSuccess;
137144
}
138145

146+
// FUNCTION: GOLDP 0x10032b70
139147
// FUNCTION: LEGORACERS 0x00450d70
140148
LegoS32 GolFile::Flush()
141149
{

0 commit comments

Comments
 (0)