Add BETA10 macro to enable conditional compilation for BETA10 targets (#1270)

* Add BETA10 macro to enable conditional compilation for BETA10 targets

* Adjustments to CMakeLists.txt
This commit is contained in:
Christian Semmler
2025-01-06 16:06:07 -07:00
committed by GitHub
parent 2cdbd1b94f
commit 4c32abd16d
6 changed files with 40 additions and 27 deletions

View File

@@ -64,7 +64,12 @@ option(ISLE_USE_SMARTHEAP "Build LEGO1.DLL with SmartHeap" ${MSVC_FOR_DECOMP})
option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" ON) option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" ON)
option(ISLE_DECOMP_ASSERT "Assert struct size" ${MSVC_FOR_DECOMP}) option(ISLE_DECOMP_ASSERT "Assert struct size" ${MSVC_FOR_DECOMP})
cmake_dependent_option(ISLE_USE_DX5_LIBS "Build with internal DirectX 5 SDK Libraries" ON ISLE_USE_DX5 OFF) cmake_dependent_option(ISLE_USE_DX5_LIBS "Build with internal DirectX 5 SDK Libraries" ON ISLE_USE_DX5 OFF)
option(ISLE_BUILD_BETA10 "Build BETA10.EXE library" OFF) option(ISLE_BUILD_LEGO1 "Build LEGO1.DLL library" ON)
option(ISLE_BUILD_BETA10 "Build BETA10.DLL library" OFF)
if(NOT (ISLE_BUILD_LEGO1 OR ISLE_BUILD_BETA10))
message(FATAL_ERROR "ISLE_BUILD_LEGO1 AND ISLE_BUILD_BETA10 cannot be both disabled")
endif()
add_cxx_warning(parentheses) add_cxx_warning(parentheses)
@@ -460,14 +465,16 @@ if (ISLE_USE_SMARTHEAP)
list(APPEND lego1_link_libraries SmartHeap::SmartHeap) list(APPEND lego1_link_libraries SmartHeap::SmartHeap)
endif() endif()
add_lego_libraries(lego1 if(ISLE_BUILD_LEGO1)
LINK_LIBRARIES ${lego1_link_libraries} add_lego_libraries(lego1
DLL_OUTPUT_NAME "LEGO1" LINK_LIBRARIES ${lego1_link_libraries}
DLL_PREFIX "" DLL_OUTPUT_NAME "LEGO1"
DLL_SUFFIX ".DLL" DLL_PREFIX ""
OUT_TARGETS lego1_targets DLL_SUFFIX ".DLL"
) OUT_TARGETS lego1_targets
reccmp_add_target(lego1 ID LEGO1) )
reccmp_add_target(lego1 ID LEGO1)
endif()
if(ISLE_BUILD_BETA10) if(ISLE_BUILD_BETA10)
add_lego_libraries(beta10 add_lego_libraries(beta10
@@ -478,6 +485,7 @@ if(ISLE_BUILD_BETA10)
OUT_TARGETS beta10_targets OUT_TARGETS beta10_targets
) )
reccmp_add_target(beta10 ID BETA10) reccmp_add_target(beta10 ID BETA10)
target_compile_definitions(beta10 PRIVATE BETA10)
endif() endif()
if (ISLE_BUILD_APP) if (ISLE_BUILD_APP)
@@ -497,7 +505,12 @@ if (ISLE_BUILD_APP)
endif() endif()
# Link DSOUND, WINMM, and LEGO1 # Link DSOUND, WINMM, and LEGO1
target_link_libraries(isle PRIVATE dsound winmm lego1) target_link_libraries(isle PRIVATE dsound winmm)
if(ISLE_BUILD_LEGO1)
target_link_libraries(isle PRIVATE lego1)
else()
target_link_libraries(isle PRIVATE beta10)
endif()
# Make sure filenames are ALL CAPS # Make sure filenames are ALL CAPS
set_property(TARGET isle PROPERTY OUTPUT_NAME ISLE) set_property(TARGET isle PROPERTY OUTPUT_NAME ISLE)
@@ -576,10 +589,11 @@ if (MSVC_FOR_DECOMP)
set_property(TARGET isle ${lego1_targets} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET isle ${lego1_targets} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif() endif()
target_link_options(lego1 PRIVATE "/OPT:REF") if(TARGET lego1)
target_link_options(lego1 PRIVATE "/OPT:REF")
# Equivalent to target_compile_options(... PRIVATE "/MT$<$<CONFIG:Debug>:d>") # Equivalent to target_compile_options(... PRIVATE "/MT$<$<CONFIG:Debug>:d>")
set_property(TARGET lego1 ${lego1_targets} ${beta10_targets} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET lego1 ${lego1_targets} ${beta10_targets} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
set(CMAKE_CXX_FLAGS "/W3 /GX /D \"WIN32\" /D \"_WINDOWS\"") set(CMAKE_CXX_FLAGS "/W3 /GX /D \"WIN32\" /D \"_WINDOWS\"")
set(CMAKE_CXX_FLAGS_DEBUG "/Gm /Zi /Od /D \"_DEBUG\"") set(CMAKE_CXX_FLAGS_DEBUG "/Gm /Zi /Od /D \"_DEBUG\"")

View File

@@ -200,7 +200,7 @@ void Act2Actor::Animate(float p_time)
{ {
int dummy1; // for BETA10, not sure what it is being used for int dummy1; // for BETA10, not sure what it is being used for
#ifdef NDEBUG #ifndef BETA10
MxFloat local48float = 0.0f; MxFloat local48float = 0.0f;
if (g_unk0x100f0f1c != 0.0f) { if (g_unk0x100f0f1c != 0.0f) {
local48float = p_time - g_unk0x100f0f1c; local48float = p_time - g_unk0x100f0f1c;
@@ -221,14 +221,14 @@ void Act2Actor::Animate(float p_time)
m_unk0x20 = 0; m_unk0x20 = 0;
} }
else { else {
#ifdef NDEBUG #ifndef BETA10
m_unk0x20 += local48float; m_unk0x20 += local48float;
#endif #endif
MxMatrix matrix = m_roi->GetLocal2World(); MxMatrix matrix = m_roi->GetLocal2World();
matrix[3][1] += 3.0f; matrix[3][1] += 3.0f;
m_roi->UpdateTransformationRelativeToParent(matrix); m_roi->UpdateTransformationRelativeToParent(matrix);
#ifdef NDEBUG #ifndef BETA10
LegoROI* brickstrROI = FindROI("brickstr"); LegoROI* brickstrROI = FindROI("brickstr");
MxMatrix brickstrMatrix = brickstrROI->GetLocal2World(); MxMatrix brickstrMatrix = brickstrROI->GetLocal2World();
brickstrMatrix[3][1] += 3.0f; brickstrMatrix[3][1] += 3.0f;
@@ -272,7 +272,7 @@ void Act2Actor::Animate(float p_time)
CurrentWorld()->RemoveActor(this); CurrentWorld()->RemoveActor(this);
return; return;
} }
#ifdef NDEBUG #ifndef BETA10
else if (m_unk0x1e == 4) { else if (m_unk0x1e == 4) {
if (m_worldSpeed == 0.0f) { if (m_worldSpeed == 0.0f) {
return; return;
@@ -340,7 +340,7 @@ void Act2Actor::Animate(float p_time)
FUN_100199f0(0); FUN_100199f0(0);
} }
else else
#ifdef NDEBUG #ifndef BETA10
if (p_time - m_unk0x24 > 3000.0f) { if (p_time - m_unk0x24 > 3000.0f) {
#endif #endif
SetWorldSpeed(m_unk0x28 - 1); SetWorldSpeed(m_unk0x28 - 1);
@@ -350,7 +350,7 @@ void Act2Actor::Animate(float p_time)
if (((LegoAct2*) CurrentWorld())->FUN_100516b0() == SUCCESS) { if (((LegoAct2*) CurrentWorld())->FUN_100516b0() == SUCCESS) {
FUN_100199f0(1); FUN_100199f0(1);
} }
#ifdef NDEBUG #ifndef BETA10
} }
#endif #endif
} }

View File

@@ -945,7 +945,7 @@ MxS32 LegoCarBuild::FUN_10024850(MxLong p_x, MxLong p_y)
return result; return result;
} }
#ifdef NDEBUG #ifndef BETA10
// FUNCTION: LEGO1 0x10024890 // FUNCTION: LEGO1 0x10024890
undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param) undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param)
@@ -1492,8 +1492,7 @@ void LegoCarBuild::FUN_10025720(undefined4 p_param)
m_unk0x10a = 0; m_unk0x10a = 0;
MxS32 uVar6; MxS32 uVar6;
#ifdef NDEBUG #ifndef BETA10
if (GameState()->GetCurrentAct() == LegoGameState::e_act2) { if (GameState()->GetCurrentAct() == LegoGameState::e_act2) {
// This is most likely related to the helicopter rebuild in Act 2 // This is most likely related to the helicopter rebuild in Act 2
switch (p_param) { switch (p_param) {
@@ -1595,7 +1594,7 @@ void LegoCarBuild::FUN_10025720(undefined4 p_param)
assert(m_numAnimsRun >= 0); assert(m_numAnimsRun >= 0);
return; return;
} }
#ifdef NDEBUG #ifndef BETA10
} }
#endif #endif

View File

@@ -147,7 +147,7 @@ void LegoCarBuildAnimPresenter::ReadyTickle()
return; return;
} }
#ifdef NDEBUG #ifndef BETA10
if (!m_anim) { if (!m_anim) {
return; return;
} }

View File

@@ -100,7 +100,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
} }
if (VTable0x80(m_roi->GetWorldPosition(), worldDirection, a, c)) { if (VTable0x80(m_roi->GetWorldPosition(), worldDirection, a, c)) {
#ifdef NDEBUG #ifndef BETA10
m_unk0x7c = 0; m_unk0x7c = 0;
return 0; return 0;
#else #else

View File

@@ -271,7 +271,7 @@ MxResult LegoCarRaceActor::VTable0x9c()
MxResult res = VTable0x80(m_roi->GetWorldPosition(), point4, point1, point5); MxResult res = VTable0x80(m_roi->GetWorldPosition(), point4, point1, point5);
#ifndef NDEBUG // BETA10 only #ifdef BETA10
if (res) { if (res) {
assert(0); assert(0);
return -1; return -1;