Skip to content

Commit f8cd856

Browse files
authored
Type-model portable findings: font checkpoint, standings context, root icon params (#511)
Adopted from racers-portable, all byte-neutral (full reccmp report diff against baseline: zero changes on either target; datacmp clean): - GolFontLibrary::m_hashTableCheckpoint stores a GolHashTable::Entry*; type it as one instead of undefined4 round-tripped through casts. - CircuitStandings::SetContext returns the previous context pointer; declare it so (the caller keeps its status cast). - g_rootIconParams is a MenuWidget::CreateParams image (zeros with m_id = 1), not an anonymous dword array; model it as the typed aggregate. - compat.h: clang/gcc also take the COMPAT_MODE path (MinGW already did); the MSVC 6.0 configuration is unaffected.
1 parent 8d46da2 commit f8cd856

7 files changed

Lines changed: 18 additions & 17 deletions

File tree

GolDP/include/font/golfontlibrary.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef GOLFONTLIBRARY_H
22
#define GOLFONTLIBRARY_H
33

4+
#include "golhashtable.h"
45
#include "golnametable.h"
56
#include "goltxtparser.h"
67
#include "image/goltiledtexture.h"
@@ -69,13 +70,13 @@ class GolFontLibrary : public GolNameTable {
6970
protected:
7071
void ReadFontCharList(GolFileParser* p_parser, undefined2* p_chars, LegoU16* p_count);
7172

72-
GolD3DRenderDevice* m_renderer; // 0x0c
73-
GolFontLibrary* m_next; // 0x10
74-
LegoU32 m_itemCount; // 0x14
75-
GolString* m_charStrings; // 0x18
76-
undefined2** m_charCodes; // 0x1c
77-
LegoU16* m_charCounts; // 0x20
78-
undefined4 m_hashTableCheckpoint; // 0x24
73+
GolD3DRenderDevice* m_renderer; // 0x0c
74+
GolFontLibrary* m_next; // 0x10
75+
LegoU32 m_itemCount; // 0x14
76+
GolString* m_charStrings; // 0x18
77+
undefined2** m_charCodes; // 0x1c
78+
LegoU16* m_charCounts; // 0x20
79+
GolHashTable::Entry* m_hashTableCheckpoint; // 0x24
7980
};
8081

8182
#endif // GOLFONTLIBRARY_H

GolDP/src/font/golfontlibrary.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ GolFontLibrary::GolFontLibrary()
2121
{
2222
m_renderer = NULL;
2323
m_itemCount = 0;
24-
m_hashTableCheckpoint = 0;
24+
m_hashTableCheckpoint = NULL;
2525
}
2626

2727
// FUNCTION: GOLDP 0x1001d870
@@ -83,7 +83,7 @@ void GolFontLibrary::LoadFontDefinitions(
8383
}
8484

8585
GolNameTable::Allocate(m_itemCount);
86-
m_hashTableCheckpoint = g_hashTable ? (undefined4) g_hashTable->GetCurrentEntry() : 0;
86+
m_hashTableCheckpoint = g_hashTable ? g_hashTable->GetCurrentEntry() : NULL;
8787
AllocateItems();
8888

8989
for (LegoU32 i = 0; i < m_itemCount; i++) {
@@ -171,7 +171,7 @@ void GolFontLibrary::LoadFontDefinitions(
171171
delete parser;
172172

173173
if (g_hashTable) {
174-
g_hashTable->SetCurrentEntry((GolHashTable::Entry*) m_hashTableCheckpoint);
174+
g_hashTable->SetCurrentEntry(m_hashTableCheckpoint);
175175
}
176176

177177
for (LegoU32 j = 0; j < m_itemCount; j++) {

LEGORacers/include/race/circuitstandings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class CircuitStandings {
1616
~CircuitStandings();
1717

1818
void Reset();
19-
undefined4 SetContext(LegoRacers::Context* p_context);
19+
LegoRacers::Context* SetContext(LegoRacers::Context* p_context);
2020
void Shutdown();
2121
LegoU32 GetPoints(LegoU32 p_index);
2222
LegoS32 GetRank(LegoU32 p_index);

LEGORacers/src/menu/screens/menuscreen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ DECOMP_SIZE_ASSERT(MenuScreen, 0x290)
3535
DECOMP_SIZE_ASSERT(SceneRefBinding, 0x54)
3636

3737
// GLOBAL: LEGORACERS 0x004b2240
38-
const undefined4 g_rootIconParams[14] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0};
38+
const MenuWidget::CreateParams g_rootIconParams = {NULL, NULL, NULL, NULL, {0, 0, 0, 0}, 1};
3939

4040
// GLOBAL: LEGORACERS 0x004b2278
4141
const MenuIcon::CreateState g_rootIconState = {{0}};
@@ -132,7 +132,7 @@ LegoBool32 MenuScreen::CreateRootIcon()
132132
MenuIcon::CreateParams createParams;
133133

134134
memset(&createParams, 0, sizeof(createParams));
135-
memcpy(&createParams, g_rootIconParams, sizeof(g_rootIconParams));
135+
memcpy(&createParams, &g_rootIconParams, sizeof(g_rootIconParams));
136136

137137
createParams.m_golExport = m_golExport;
138138
createParams.m_renderer = m_renderer;

LEGORacers/src/race/circuitracerunner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ LegoS32 CircuitRaceRunner::Initialize(LegoRacers::Context* p_context, RaceSessio
4949
m_context = p_context;
5050
m_session = p_session;
5151
sprintf(p_context->m_commonDataDirectory, "GAMEDATA\\COMMON");
52-
return m_standings.SetContext(m_context);
52+
return (LegoS32) m_standings.SetContext(m_context);
5353
}
5454

5555
// FUNCTION: LEGORACERS 0x0041ed60

LEGORacers/src/race/circuitstandings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void CircuitStandings::Reset()
5353
}
5454

5555
// FUNCTION: LEGORACERS 0x00440270
56-
undefined4 CircuitStandings::SetContext(LegoRacers::Context* p_context)
56+
LegoRacers::Context* CircuitStandings::SetContext(LegoRacers::Context* p_context)
5757
{
5858
LegoRacers::Context* previous = m_context;
5959

@@ -63,7 +63,7 @@ undefined4 CircuitStandings::SetContext(LegoRacers::Context* p_context)
6363
}
6464

6565
m_context = p_context;
66-
return (undefined4) previous;
66+
return previous;
6767
}
6868

6969
// FUNCTION: LEGORACERS 0x004402a0

util/compat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#define MSVC600_VERSION 1200
77

8-
#if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER > MSVC600_VERSION)
8+
#if defined(__MINGW32__) || defined(__clang__) || defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER > MSVC600_VERSION)
99
#define COMPAT_MODE
1010
#endif
1111

0 commit comments

Comments
 (0)