Skip to content

Commit 5ad031a

Browse files
authored
Fix a few warnings flagged by a MinGW toolchain (isledecomp#490)
* Fix a few warnings flagged by a MinGW toolchain * Fix MenuWidget::DrawString * clang-format * cmake: create MAP file when using MSVC toolchains
1 parent b49eacf commit 5ad031a

18 files changed

Lines changed: 164 additions & 169 deletions

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ reccmp_add_target(goldp ID GOLDP)
233233

234234
if (MSVC)
235235
target_sources(goldp PRIVATE GolDP/GolDP.def)
236+
target_link_options(goldp PRIVATE "-MAP:$<TARGET_FILE_DIR:goldp>/$<TARGET_FILE_BASE_NAME:goldp>.map")
236237
endif()
237238

238239
target_include_directories(goldp PRIVATE
@@ -464,6 +465,9 @@ add_executable(legoracers WIN32
464465
$<TARGET_OBJECTS:common_legoracers>
465466
LEGORacers/src/gol/goltexturelist.cpp
466467
)
468+
if(MSVC)
469+
target_link_options(legoracers PRIVATE "-MAP:$<TARGET_FILE_DIR:legoracers>/$<TARGET_FILE_BASE_NAME:legoracers>.map")
470+
endif()
467471
target_compile_definitions(legoracers PRIVATE BUILDING_LEGORACERS)
468472
target_compile_definitions(legoracers PRIVATE DIRECTINPUT_VERSION=0x500)
469473
reccmp_add_target(legoracers ID LEGORACERS)

GolDP/include/render/gold3drenderdevice.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class GolD3DRenderDevice : public GolRenderDevice {
7878
void VTable0x58(SlatePeak0x58*, undefined4) override; // vtable+0x58
7979
void VTable0x5c() override; // vtable+0x5c
8080
void VTable0x60() override; // vtable+0x60
81-
LegoS32 VTable0x64(
81+
void VTable0x64(
8282
GolString*,
8383
GolFontBase*,
8484
LegoS32,
@@ -98,7 +98,7 @@ class GolD3DRenderDevice : public GolRenderDevice {
9898
Rect*,
9999
undefined4
100100
) override; // vtable+0x68
101-
LegoS32 VTable0x6c(
101+
void VTable0x6c(
102102
GolString*,
103103
GolFontBase*,
104104
LegoS32,

GolDP/include/render/golrenderdevice.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class GolRenderDevice {
115115
virtual void VTable0x58(SlatePeak0x58* p_param1, undefined4 p_param2); // vtable+0x58
116116
virtual void VTable0x5c() = 0; // vtable+0x5c
117117
virtual void VTable0x60(); // vtable+0x60
118-
virtual LegoS32 VTable0x64(
118+
virtual void VTable0x64(
119119
GolString*,
120120
GolFontBase*,
121121
LegoS32,
@@ -135,7 +135,7 @@ class GolRenderDevice {
135135
Rect*,
136136
undefined4
137137
) = 0; // vtable+0x68
138-
virtual LegoS32 VTable0x6c(
138+
virtual void VTable0x6c(
139139
GolString*,
140140
GolFontBase*,
141141
LegoS32,

GolDP/src/render/gold3drenderdevice.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ void GolD3DRenderDevice::VTable0x68(
16891689
}
16901690

16911691
// FUNCTION: GOLDP 0x10009b70
1692-
LegoS32 GolD3DRenderDevice::VTable0x64(
1692+
void GolD3DRenderDevice::VTable0x64(
16931693
GolString* p_unk0x04,
16941694
GolFontBase* p_font,
16951695
LegoS32 p_unk0x0c,
@@ -1700,11 +1700,11 @@ LegoS32 GolD3DRenderDevice::VTable0x64(
17001700
undefined4 p_unk0x20
17011701
)
17021702
{
1703-
return p_font->DrawString(p_unk0x04, this, p_unk0x0c, p_unk0x10, p_unk0x14, p_unk0x18, p_unk0x1c, p_unk0x20);
1703+
p_font->DrawString(p_unk0x04, this, p_unk0x0c, p_unk0x10, p_unk0x14, p_unk0x18, p_unk0x1c, p_unk0x20);
17041704
}
17051705

17061706
// FUNCTION: GOLDP 0x10009ba0
1707-
LegoS32 GolD3DRenderDevice::VTable0x6c(
1707+
void GolD3DRenderDevice::VTable0x6c(
17081708
GolString* p_unk0x04,
17091709
GolFontBase* p_font,
17101710
LegoS32 p_unk0x0c,
@@ -1715,7 +1715,7 @@ LegoS32 GolD3DRenderDevice::VTable0x6c(
17151715
undefined4 p_unk0x20
17161716
)
17171717
{
1718-
return p_font->DrawStringFitted(p_unk0x04, this, p_unk0x0c, p_unk0x10, p_unk0x14, p_unk0x18, p_unk0x1c, p_unk0x20);
1718+
p_font->DrawStringFitted(p_unk0x04, this, p_unk0x0c, p_unk0x10, p_unk0x14, p_unk0x18, p_unk0x1c, p_unk0x20);
17191719
}
17201720

17211721
// FUNCTION: GOLDP 0x10009bd0

LEGORacers/include/menu/runtime/cutscenedefinition.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class CutsceneDefinition : public GolNameTable {
132132

133133
LegoU32 Reset();
134134
LegoU32 FUN_00404a10(CutsceneDefinition* p_parent, GolFileParser* p_parser);
135-
LegoU32 FUN_00404c90();
135+
void FUN_00404c90();
136136
void FUN_00404e80();
137137
GolWorldEntity* GetEntity() const { return m_unk0x24; }
138138
void SetEntity(GolWorldEntity* p_entity) { m_unk0x24 = p_entity; }

LEGORacers/include/menu/widgets/menuwidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class MenuWidget {
7676
Rect* FUN_00472c80(Rect*, Rect*);
7777
Rect* MeasureText(GolFontBase*, GolString*, Rect*, Rect*, LegoS32);
7878
void DrawImage(Rect*, Rect*, UtopianPan0xa4*);
79-
undefined2 DrawString(Rect*, Rect*, GolFontBase*, GolString*, LegoS32, LegoS32);
79+
void DrawString(Rect*, Rect*, GolFontBase*, GolString*, LegoS32, LegoS32);
8080
Rect* TranslateRectByOffset(Rect*);
8181
LegoBool32 FUN_00473a20(Rect*, LegoS32, LegoS32);
8282
void ScreenToLocal(undefined4&, undefined4&);

LEGORacers/src/menu/runtime/cutscenedefinition.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ LegoU32 CutsceneDefinition::Frame::ModelEvent::FUN_00404a10(CutsceneDefinition*
161161
}
162162

163163
// FUNCTION: LEGORACERS 0x00404c90
164-
LegoU32 CutsceneDefinition::Frame::ModelEvent::FUN_00404c90()
164+
void CutsceneDefinition::Frame::ModelEvent::FUN_00404c90()
165165
{
166166
if (!m_unk0x24) {
167167
LegoChar message[64];
@@ -199,7 +199,7 @@ LegoU32 CutsceneDefinition::Frame::ModelEvent::FUN_00404c90()
199199
m_unk0x28->FUN_00406f20(m_unk0x2c.m_indexedRef.m_resourceIndex, m_unk0x2c.m_indexedRef.m_modelIndex);
200200
break;
201201
default:
202-
return m_modelRefType - 1;
202+
return;
203203
}
204204
}
205205

LEGORacers/src/menu/widgets/menuwidget.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ LegoBool32 MenuWidget::VTable0x08()
9292
// FUNCTION: LEGORACERS 0x004113b0 FOLDED
9393
undefined4 MenuWidget::VTable0x3c(undefined4)
9494
{
95-
return NULL;
95+
return 0;
9696
}
9797

9898
// FUNCTION: LEGORACERS 0x0044e7f0 FOLDED
@@ -286,7 +286,7 @@ void MenuWidget::DrawImage(Rect* p_destRect, Rect* p_sourceRect, UtopianPan0xa4*
286286
}
287287

288288
// FUNCTION: LEGORACERS 0x00472da0
289-
undefined2 MenuWidget::DrawString(
289+
void MenuWidget::DrawString(
290290
Rect* p_source,
291291
Rect* p_dest,
292292
GolFontBase* p_font,
@@ -299,7 +299,7 @@ undefined2 MenuWidget::DrawString(
299299
p_font->SetColor(color);
300300

301301
if (p_wrapWidth) {
302-
return p_font->FUN_00408fe0(
302+
p_font->FUN_00408fe0(
303303
p_string,
304304
m_renderer,
305305
p_source->m_left,
@@ -313,19 +313,20 @@ undefined2 MenuWidget::DrawString(
313313
p_unk0x18
314314
);
315315
}
316-
317-
LegoS32 y = p_source->m_top;
318-
LegoS32 x = p_source->m_left;
319-
return m_renderer->VTable0x6c(
320-
p_string,
321-
p_font,
322-
x,
323-
y,
324-
static_cast<LegoFloat>(p_source->m_right - x),
325-
static_cast<LegoFloat>(p_source->m_bottom - y),
326-
p_dest,
327-
0
328-
);
316+
else {
317+
LegoS32 y = p_source->m_top;
318+
LegoS32 x = p_source->m_left;
319+
m_renderer->VTable0x6c(
320+
p_string,
321+
p_font,
322+
x,
323+
y,
324+
static_cast<LegoFloat>(p_source->m_right - x),
325+
static_cast<LegoFloat>(p_source->m_bottom - y),
326+
p_dest,
327+
0
328+
);
329+
}
329330
}
330331

331332
// FUNCTION: LEGORACERS 0x00472e40

LEGORacers/src/menu/widgets/optionsrow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ DECOMP_SIZE_ASSERT(OptionsRow, 0x6ec)
99
// FUNCTION: LEGORACERS 0x004113b0 FOLDED
1010
undefined4 OptionsRowBase::VTable0x3c(undefined4)
1111
{
12-
return NULL;
12+
return 0;
1313
}
1414

1515
// FUNCTION: LEGORACERS 0x0046de60

LEGORacers/src/race/cobalttrail0x140.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ extern const LegoFloat g_unk0x004b02d8 = 0.0020833334f;
4444
extern const LegoFloat g_unk0x004b02e0;
4545

4646
// GLOBAL: LEGORACERS 0x004be8a8
47-
extern const LegoChar* g_unk0x004be8a8 = "font_ths";
47+
const LegoChar* g_unk0x004be8a8 = "font_ths";
4848

4949
// GLOBAL: LEGORACERS 0x004be8ac
50-
extern const LegoChar* g_unk0x004be8ac = "ignum";
50+
const LegoChar* g_unk0x004be8ac = "ignum";
5151

5252
static const LegoChar* g_unk0x004b0270[8] = {"1", "2", "3", "4", "5", "6", "7", "8"};
5353
static const LegoS16 g_unk0x004b0290[8] = {0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20};

0 commit comments

Comments
 (0)