From 82b46de170d4d2b39405986a6d2ec83db48f37d7 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 23 Dec 2024 08:59:41 -0700 Subject: [PATCH 1/2] Refactor `geom` library into `geom` and `util` --- CMakeLists.txt | 34 +++++++++++++++---- LEGO1/lego/sources/roi/legolod.cpp | 2 +- LEGO1/lego/sources/roi/legoroi.cpp | 4 +-- LEGO1/lego/sources/{geom => util}/legobox.cpp | 1 + LEGO1/lego/sources/{geom => util}/legobox.h | 0 .../lego/sources/{misc => util}/legocolor.cpp | 2 +- LEGO1/lego/sources/{misc => util}/legocolor.h | 2 +- .../lego/sources/{geom => util}/legomesh.cpp | 0 LEGO1/lego/sources/{geom => util}/legomesh.h | 2 +- .../sources/{geom => util}/legosphere.cpp | 0 .../lego/sources/{geom => util}/legosphere.h | 0 .../sources/{geom => util}/legovertex.cpp | 0 .../lego/sources/{geom => util}/legovertex.h | 0 13 files changed, 35 insertions(+), 12 deletions(-) rename LEGO1/lego/sources/{geom => util}/legobox.cpp (92%) rename LEGO1/lego/sources/{geom => util}/legobox.h (100%) rename LEGO1/lego/sources/{misc => util}/legocolor.cpp (94%) rename LEGO1/lego/sources/{misc => util}/legocolor.h (95%) rename LEGO1/lego/sources/{geom => util}/legomesh.cpp (100%) rename LEGO1/lego/sources/{geom => util}/legomesh.h (98%) rename LEGO1/lego/sources/{geom => util}/legosphere.cpp (100%) rename LEGO1/lego/sources/{geom => util}/legosphere.h (100%) rename LEGO1/lego/sources/{geom => util}/legovertex.cpp (100%) rename LEGO1/lego/sources/{geom => util}/legovertex.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6415d39d24..eb51782868 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,12 +153,8 @@ function(add_lego_libraries NAME) target_link_libraries(roi${ARG_SUFFIX} PRIVATE viewmanager${ARG_SUFFIX} Vec::Vec) add_library(geom${ARG_SUFFIX} STATIC - LEGO1/lego/sources/geom/legobox.cpp LEGO1/lego/sources/geom/legoedge.cpp - LEGO1/lego/sources/geom/legomesh.cpp - LEGO1/lego/sources/geom/legosphere.cpp LEGO1/lego/sources/geom/legounkown100db7f4.cpp - LEGO1/lego/sources/geom/legovertex.cpp LEGO1/lego/sources/geom/legoweedge.cpp LEGO1/lego/sources/geom/legowegedge.cpp ) @@ -167,6 +163,18 @@ function(add_lego_libraries NAME) target_include_directories(geom${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") target_link_libraries(geom${ARG_SUFFIX} PRIVATE) + add_library(util${ARG_SUFFIX} STATIC + LEGO1/lego/sources/util/legocolor.cpp + LEGO1/lego/sources/util/legobox.cpp + LEGO1/lego/sources/util/legomesh.cpp + LEGO1/lego/sources/util/legosphere.cpp + LEGO1/lego/sources/util/legovertex.cpp + ) + list(APPEND list_targets util${ARG_SUFFIX}) + set_property(TARGET util${ARG_SUFFIX} PROPERTY ARCHIVE_OUTPUT_NAME "util$<$:d>${ARG_SUFFIX}") + target_include_directories(util${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") + target_link_libraries(util${ARG_SUFFIX} PRIVATE) + add_library(anim${ARG_SUFFIX} STATIC LEGO1/lego/sources/anim/legoanim.cpp ) @@ -175,7 +183,6 @@ function(add_lego_libraries NAME) target_include_directories(anim${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") add_library(misc${ARG_SUFFIX} STATIC - LEGO1/lego/sources/misc/legocolor.cpp LEGO1/lego/sources/misc/legocontainer.cpp LEGO1/lego/sources/misc/legoimage.cpp LEGO1/lego/sources/misc/legostorage.cpp @@ -422,7 +429,22 @@ function(add_lego_libraries NAME) target_include_directories(${NAME} PUBLIC "${PROJECT_SOURCE_DIR}/LEGO1/lego/legoomni/include/actions") # Link libraries - target_link_libraries(${NAME} PRIVATE tglrl${ARG_SUFFIX} viewmanager${ARG_SUFFIX} realtime${ARG_SUFFIX} mxdirectx${ARG_SUFFIX} roi${ARG_SUFFIX} geom${ARG_SUFFIX} anim${ARG_SUFFIX} Vec::Vec dinput dxguid misc${ARG_SUFFIX} 3dmanager${ARG_SUFFIX} omni${ARG_SUFFIX}) + target_link_libraries(${NAME} PRIVATE + tglrl${ARG_SUFFIX} + viewmanager${ARG_SUFFIX} + realtime${ARG_SUFFIX} + mxdirectx${ARG_SUFFIX} + roi${ARG_SUFFIX} + geom${ARG_SUFFIX} + anim${ARG_SUFFIX} + Vec::Vec + dinput + dxguid + misc${ARG_SUFFIX} + 3dmanager${ARG_SUFFIX} + omni${ARG_SUFFIX} + util${ARG_SUFFIX} + ) foreach(tgt IN LISTS list_targets) target_link_libraries(${tgt} PRIVATE ${ARG_LINK_LIBRARIES}) diff --git a/LEGO1/lego/sources/roi/legolod.cpp b/LEGO1/lego/sources/roi/legolod.cpp index 45f0f8640f..db8776b3fb 100644 --- a/LEGO1/lego/sources/roi/legolod.cpp +++ b/LEGO1/lego/sources/roi/legolod.cpp @@ -1,11 +1,11 @@ #include "legolod.h" -#include "geom/legomesh.h" #include "legoroi.h" #include "misc/legocontainer.h" #include "misc/legostorage.h" #include "tgl/d3drm/impl.h" +#include "util/legomesh.h" DECOMP_SIZE_ASSERT(LODObject, 0x04) DECOMP_SIZE_ASSERT(ViewLOD, 0x0c) diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index f9a8549bd8..c363c031d9 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -1,12 +1,12 @@ #include "legoroi.h" #include "anim/legoanim.h" -#include "geom/legobox.h" -#include "geom/legosphere.h" #include "legolod.h" #include "misc/legocontainer.h" #include "misc/legostorage.h" #include "realtime/realtime.h" +#include "util/legobox.h" +#include "util/legosphere.h" #include #include diff --git a/LEGO1/lego/sources/geom/legobox.cpp b/LEGO1/lego/sources/util/legobox.cpp similarity index 92% rename from LEGO1/lego/sources/geom/legobox.cpp rename to LEGO1/lego/sources/util/legobox.cpp index 0a5f2bdb3e..0f7654d64f 100644 --- a/LEGO1/lego/sources/geom/legobox.cpp +++ b/LEGO1/lego/sources/util/legobox.cpp @@ -6,6 +6,7 @@ DECOMP_SIZE_ASSERT(LegoBox, 0x18) // FUNCTION: LEGO1 0x100d3740 +// FUNCTION: BETA10 0x1018f83c LegoResult LegoBox::Read(LegoStorage* p_storage) { LegoResult result; diff --git a/LEGO1/lego/sources/geom/legobox.h b/LEGO1/lego/sources/util/legobox.h similarity index 100% rename from LEGO1/lego/sources/geom/legobox.h rename to LEGO1/lego/sources/util/legobox.h diff --git a/LEGO1/lego/sources/misc/legocolor.cpp b/LEGO1/lego/sources/util/legocolor.cpp similarity index 94% rename from LEGO1/lego/sources/misc/legocolor.cpp rename to LEGO1/lego/sources/util/legocolor.cpp index 1dc1dce46c..146e8818e0 100644 --- a/LEGO1/lego/sources/misc/legocolor.cpp +++ b/LEGO1/lego/sources/util/legocolor.cpp @@ -1,7 +1,7 @@ #include "legocolor.h" #include "decomp.h" -#include "legostorage.h" +#include "misc/legostorage.h" DECOMP_SIZE_ASSERT(LegoColor, 0x03) diff --git a/LEGO1/lego/sources/misc/legocolor.h b/LEGO1/lego/sources/util/legocolor.h similarity index 95% rename from LEGO1/lego/sources/misc/legocolor.h rename to LEGO1/lego/sources/util/legocolor.h index 027362cee9..ac0f2ec075 100644 --- a/LEGO1/lego/sources/misc/legocolor.h +++ b/LEGO1/lego/sources/util/legocolor.h @@ -1,7 +1,7 @@ #ifndef __LEGOCOLOR_H #define __LEGOCOLOR_H -#include "legotypes.h" +#include "misc/legotypes.h" class LegoStorage; diff --git a/LEGO1/lego/sources/geom/legomesh.cpp b/LEGO1/lego/sources/util/legomesh.cpp similarity index 100% rename from LEGO1/lego/sources/geom/legomesh.cpp rename to LEGO1/lego/sources/util/legomesh.cpp diff --git a/LEGO1/lego/sources/geom/legomesh.h b/LEGO1/lego/sources/util/legomesh.h similarity index 98% rename from LEGO1/lego/sources/geom/legomesh.h rename to LEGO1/lego/sources/util/legomesh.h index 1832ae7b81..da1b1a2764 100644 --- a/LEGO1/lego/sources/geom/legomesh.h +++ b/LEGO1/lego/sources/util/legomesh.h @@ -2,7 +2,7 @@ #define __LEGOMESH_H #include "decomp.h" -#include "misc/legocolor.h" +#include "legocolor.h" #include "misc/legotypes.h" class LegoStorage; diff --git a/LEGO1/lego/sources/geom/legosphere.cpp b/LEGO1/lego/sources/util/legosphere.cpp similarity index 100% rename from LEGO1/lego/sources/geom/legosphere.cpp rename to LEGO1/lego/sources/util/legosphere.cpp diff --git a/LEGO1/lego/sources/geom/legosphere.h b/LEGO1/lego/sources/util/legosphere.h similarity index 100% rename from LEGO1/lego/sources/geom/legosphere.h rename to LEGO1/lego/sources/util/legosphere.h diff --git a/LEGO1/lego/sources/geom/legovertex.cpp b/LEGO1/lego/sources/util/legovertex.cpp similarity index 100% rename from LEGO1/lego/sources/geom/legovertex.cpp rename to LEGO1/lego/sources/util/legovertex.cpp diff --git a/LEGO1/lego/sources/geom/legovertex.h b/LEGO1/lego/sources/util/legovertex.h similarity index 100% rename from LEGO1/lego/sources/geom/legovertex.h rename to LEGO1/lego/sources/util/legovertex.h From a22717ae1c1f39eae6cbc44b5bfd7a1ea8539068 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 23 Dec 2024 09:15:35 -0700 Subject: [PATCH 2/2] Rename to `shape` --- CMakeLists.txt | 22 +++++++++---------- LEGO1/lego/sources/roi/legolod.cpp | 2 +- LEGO1/lego/sources/roi/legoroi.cpp | 4 ++-- .../lego/sources/{util => shape}/legobox.cpp | 0 LEGO1/lego/sources/{util => shape}/legobox.h | 0 .../sources/{util => shape}/legocolor.cpp | 0 .../lego/sources/{util => shape}/legocolor.h | 0 .../lego/sources/{util => shape}/legomesh.cpp | 0 LEGO1/lego/sources/{util => shape}/legomesh.h | 0 .../sources/{util => shape}/legosphere.cpp | 0 .../lego/sources/{util => shape}/legosphere.h | 0 .../sources/{util => shape}/legovertex.cpp | 0 .../lego/sources/{util => shape}/legovertex.h | 0 13 files changed, 14 insertions(+), 14 deletions(-) rename LEGO1/lego/sources/{util => shape}/legobox.cpp (100%) rename LEGO1/lego/sources/{util => shape}/legobox.h (100%) rename LEGO1/lego/sources/{util => shape}/legocolor.cpp (100%) rename LEGO1/lego/sources/{util => shape}/legocolor.h (100%) rename LEGO1/lego/sources/{util => shape}/legomesh.cpp (100%) rename LEGO1/lego/sources/{util => shape}/legomesh.h (100%) rename LEGO1/lego/sources/{util => shape}/legosphere.cpp (100%) rename LEGO1/lego/sources/{util => shape}/legosphere.h (100%) rename LEGO1/lego/sources/{util => shape}/legovertex.cpp (100%) rename LEGO1/lego/sources/{util => shape}/legovertex.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb51782868..fddedcabc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,17 +163,17 @@ function(add_lego_libraries NAME) target_include_directories(geom${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") target_link_libraries(geom${ARG_SUFFIX} PRIVATE) - add_library(util${ARG_SUFFIX} STATIC - LEGO1/lego/sources/util/legocolor.cpp - LEGO1/lego/sources/util/legobox.cpp - LEGO1/lego/sources/util/legomesh.cpp - LEGO1/lego/sources/util/legosphere.cpp - LEGO1/lego/sources/util/legovertex.cpp + add_library(shape${ARG_SUFFIX} STATIC + LEGO1/lego/sources/shape/legocolor.cpp + LEGO1/lego/sources/shape/legobox.cpp + LEGO1/lego/sources/shape/legomesh.cpp + LEGO1/lego/sources/shape/legosphere.cpp + LEGO1/lego/sources/shape/legovertex.cpp ) - list(APPEND list_targets util${ARG_SUFFIX}) - set_property(TARGET util${ARG_SUFFIX} PROPERTY ARCHIVE_OUTPUT_NAME "util$<$:d>${ARG_SUFFIX}") - target_include_directories(util${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") - target_link_libraries(util${ARG_SUFFIX} PRIVATE) + list(APPEND list_targets shape${ARG_SUFFIX}) + set_property(TARGET shape${ARG_SUFFIX} PROPERTY ARCHIVE_OUTPUT_NAME "shape$<$:d>${ARG_SUFFIX}") + target_include_directories(shape${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") + target_link_libraries(shape${ARG_SUFFIX} PRIVATE) add_library(anim${ARG_SUFFIX} STATIC LEGO1/lego/sources/anim/legoanim.cpp @@ -443,7 +443,7 @@ function(add_lego_libraries NAME) misc${ARG_SUFFIX} 3dmanager${ARG_SUFFIX} omni${ARG_SUFFIX} - util${ARG_SUFFIX} + shape${ARG_SUFFIX} ) foreach(tgt IN LISTS list_targets) diff --git a/LEGO1/lego/sources/roi/legolod.cpp b/LEGO1/lego/sources/roi/legolod.cpp index db8776b3fb..7db2a0a99e 100644 --- a/LEGO1/lego/sources/roi/legolod.cpp +++ b/LEGO1/lego/sources/roi/legolod.cpp @@ -4,8 +4,8 @@ #include "legoroi.h" #include "misc/legocontainer.h" #include "misc/legostorage.h" +#include "shape/legomesh.h" #include "tgl/d3drm/impl.h" -#include "util/legomesh.h" DECOMP_SIZE_ASSERT(LODObject, 0x04) DECOMP_SIZE_ASSERT(ViewLOD, 0x0c) diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index c363c031d9..50a2611371 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -5,8 +5,8 @@ #include "misc/legocontainer.h" #include "misc/legostorage.h" #include "realtime/realtime.h" -#include "util/legobox.h" -#include "util/legosphere.h" +#include "shape/legobox.h" +#include "shape/legosphere.h" #include #include diff --git a/LEGO1/lego/sources/util/legobox.cpp b/LEGO1/lego/sources/shape/legobox.cpp similarity index 100% rename from LEGO1/lego/sources/util/legobox.cpp rename to LEGO1/lego/sources/shape/legobox.cpp diff --git a/LEGO1/lego/sources/util/legobox.h b/LEGO1/lego/sources/shape/legobox.h similarity index 100% rename from LEGO1/lego/sources/util/legobox.h rename to LEGO1/lego/sources/shape/legobox.h diff --git a/LEGO1/lego/sources/util/legocolor.cpp b/LEGO1/lego/sources/shape/legocolor.cpp similarity index 100% rename from LEGO1/lego/sources/util/legocolor.cpp rename to LEGO1/lego/sources/shape/legocolor.cpp diff --git a/LEGO1/lego/sources/util/legocolor.h b/LEGO1/lego/sources/shape/legocolor.h similarity index 100% rename from LEGO1/lego/sources/util/legocolor.h rename to LEGO1/lego/sources/shape/legocolor.h diff --git a/LEGO1/lego/sources/util/legomesh.cpp b/LEGO1/lego/sources/shape/legomesh.cpp similarity index 100% rename from LEGO1/lego/sources/util/legomesh.cpp rename to LEGO1/lego/sources/shape/legomesh.cpp diff --git a/LEGO1/lego/sources/util/legomesh.h b/LEGO1/lego/sources/shape/legomesh.h similarity index 100% rename from LEGO1/lego/sources/util/legomesh.h rename to LEGO1/lego/sources/shape/legomesh.h diff --git a/LEGO1/lego/sources/util/legosphere.cpp b/LEGO1/lego/sources/shape/legosphere.cpp similarity index 100% rename from LEGO1/lego/sources/util/legosphere.cpp rename to LEGO1/lego/sources/shape/legosphere.cpp diff --git a/LEGO1/lego/sources/util/legosphere.h b/LEGO1/lego/sources/shape/legosphere.h similarity index 100% rename from LEGO1/lego/sources/util/legosphere.h rename to LEGO1/lego/sources/shape/legosphere.h diff --git a/LEGO1/lego/sources/util/legovertex.cpp b/LEGO1/lego/sources/shape/legovertex.cpp similarity index 100% rename from LEGO1/lego/sources/util/legovertex.cpp rename to LEGO1/lego/sources/shape/legovertex.cpp diff --git a/LEGO1/lego/sources/util/legovertex.h b/LEGO1/lego/sources/shape/legovertex.h similarity index 100% rename from LEGO1/lego/sources/util/legovertex.h rename to LEGO1/lego/sources/shape/legovertex.h