From 87a20e15574851ed7a1ee405d7e0e304bff9931e Mon Sep 17 00:00:00 2001 From: Mark Langen Date: Wed, 29 Nov 2023 22:45:53 -0800 Subject: [PATCH] Rename Something -> Unk --- CMakeLists.txt | 2 +- LEGO1/tgl/d3drm/impl.h | 15 ++++++++------- LEGO1/tgl/d3drm/mesh.cpp | 20 ++++++++++---------- LEGO1/tgl/d3drm/renderer.cpp | 14 +++++++------- LEGO1/tgl/d3drm/{something.cpp => unk.cpp} | 16 ++++++++-------- LEGO1/tgl/tgl.h | 12 ++++++------ 6 files changed, 40 insertions(+), 39 deletions(-) rename LEGO1/tgl/d3drm/{something.cpp => unk.cpp} (73%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b1a6c67..a43a1390 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,7 +216,7 @@ add_library(lego1 SHARED LEGO1/tgl/d3drm/light.cpp LEGO1/tgl/d3drm/mesh.cpp LEGO1/tgl/d3drm/renderer.cpp - LEGO1/tgl/d3drm/something.cpp + LEGO1/tgl/d3drm/unk.cpp LEGO1/tgl/d3drm/texture.cpp LEGO1/tgl/d3drm/view.cpp LEGO1/towtrack.cpp diff --git a/LEGO1/tgl/d3drm/impl.h b/LEGO1/tgl/d3drm/impl.h index 287f107e..621daf2e 100644 --- a/LEGO1/tgl/d3drm/impl.h +++ b/LEGO1/tgl/d3drm/impl.h @@ -33,6 +33,7 @@ class CameraImpl; class GroupImpl; class MeshImpl; class TextureImpl; +class UnkImpl; // VTABLE 0x100db910 class RendererImpl : public Renderer { @@ -60,7 +61,7 @@ class RendererImpl : public Renderer { virtual Group* CreateGroup(const Group* p_parent); // vtable+0x20 - virtual Something* CreateSomething(); + virtual Unk* CreateUnk(); virtual Texture* CreateTexture(); virtual Texture* CreateTexture( int p_width, @@ -216,10 +217,10 @@ class MeshImpl : public Mesh { virtual Result GetTexture(Texture*&); virtual Result SetTextureMappingMode(ProjectionType); virtual Result SetShadingModel(ShadingModel); - virtual Mesh* DeepClone(Something*); + virtual Mesh* DeepClone(Unk*); // vtable+0x20 - virtual Mesh* ShallowClone(Something*); + virtual Mesh* ShallowClone(Unk*); struct MeshData { IDirect3DRMMesh* groupMesh; @@ -268,10 +269,10 @@ class GroupImpl : public Group { }; // VTABLE 0x100dbb18 -class SomethingImpl : public Something { +class UnkImpl : public Unk { public: - SomethingImpl() : m_data(0) {} - ~SomethingImpl(); + UnkImpl() : m_data(0) {} + ~UnkImpl(); virtual void* ImplementationDataPtr(); @@ -288,7 +289,7 @@ class SomethingImpl : public Something { virtual Result GetBoundingBox(float p_min[3], float p_max[3]); // vtable+0x10 - virtual Something* Clone(); + virtual Unk* Clone(); inline IDirect3DRMMesh* ImplementationData() const { return m_data; } diff --git a/LEGO1/tgl/d3drm/mesh.cpp b/LEGO1/tgl/d3drm/mesh.cpp index df94015d..fd8afbd1 100644 --- a/LEGO1/tgl/d3drm/mesh.cpp +++ b/LEGO1/tgl/d3drm/mesh.cpp @@ -82,12 +82,12 @@ Result MeshImpl::SetShadingModel(ShadingModel p_model) } // OFFSET: LEGO1 0x100a4030 -Mesh* MeshImpl::DeepClone(Something* p_mesh) +Mesh* MeshImpl::DeepClone(Unk* p_mesh) { // Create group - MeshImpl* newSomething = new MeshImpl(); + MeshImpl* newMesh = new MeshImpl(); MeshData* data = new MeshData(); - newSomething->m_data = data; + newMesh->m_data = data; // Query information from old group DWORD dataSize; @@ -105,10 +105,10 @@ Mesh* MeshImpl::DeepClone(Something* p_mesh) D3DCOLOR color = m_data->groupMesh->GetGroupColor(m_data->groupIndex); // Push information to new group - SomethingImpl* target = static_cast(p_mesh); + UnkImpl* target = static_cast(p_mesh); D3DRMGROUPINDEX index; target->ImplementationData()->AddGroup(vcount, fcount, vperface, faceBuffer, &index); - newSomething->m_data->groupIndex = index; + newMesh->m_data->groupIndex = index; target->ImplementationData()->SetVertices(index, 0, vcount, vertexBuffer); target->ImplementationData()->SetGroupTexture(index, textureRef); target->ImplementationData()->SetGroupMapping(index, mapping); @@ -119,22 +119,22 @@ Mesh* MeshImpl::DeepClone(Something* p_mesh) delete[] faceBuffer; delete[] vertexBuffer; if (result == Error) { - delete newSomething; - newSomething = NULL; + delete newMesh; + newMesh = NULL; } - return newSomething; + return newMesh; } // OFFSET: LEGO1 0x100a4240 -Mesh* MeshImpl::ShallowClone(Something* p_mesh) +Mesh* MeshImpl::ShallowClone(Unk* p_mesh) { MeshImpl* newGroup = new MeshImpl(); MeshData* newData = new MeshData(); newGroup->m_data = newData; if (newData) { newData->groupIndex = m_data->groupIndex; - newData->groupMesh = static_cast(p_mesh)->ImplementationData(); + newData->groupMesh = static_cast(p_mesh)->ImplementationData(); } else { delete newGroup; diff --git a/LEGO1/tgl/d3drm/renderer.cpp b/LEGO1/tgl/d3drm/renderer.cpp index 5aac9752..cf57bf4e 100644 --- a/LEGO1/tgl/d3drm/renderer.cpp +++ b/LEGO1/tgl/d3drm/renderer.cpp @@ -216,20 +216,20 @@ Light* RendererImpl::CreateLight(LightType p_type, float p_r, float p_g, float p } // OFFSET: LEGO1 0x100a1e90 -Something* RendererImpl::CreateSomething() +Unk* RendererImpl::CreateUnk() { - // Note: I'm fairly certain that Something is not what Tgl calls a + // Note: I'm fairly certain that Unknown is not what Tgl calls a // "Mesh", because the methods on Mesh in the Tgl leak line up much // more closely with a different vtable than the one assigned in // this method (meaning this method is not creating a Mesh). // Maybe this method is something like CreateMeshBuilder where the // Mesh data type in the Tgl leak was split into builder/result? - SomethingImpl* something = new SomethingImpl(); - if (FAILED(m_data->CreateMesh(&something->m_data))) { - delete something; - something = NULL; + UnkImpl* unknown = new UnkImpl(); + if (FAILED(m_data->CreateMesh(&unknown->m_data))) { + delete unknown; + unknown = NULL; } - return something; + return unknown; } inline Result RendererCreateTexture( diff --git a/LEGO1/tgl/d3drm/something.cpp b/LEGO1/tgl/d3drm/unk.cpp similarity index 73% rename from LEGO1/tgl/d3drm/something.cpp rename to LEGO1/tgl/d3drm/unk.cpp index 1edbb046..304b7e9d 100644 --- a/LEGO1/tgl/d3drm/something.cpp +++ b/LEGO1/tgl/d3drm/unk.cpp @@ -2,11 +2,11 @@ using namespace TglImpl; -DECOMP_SIZE_ASSERT(Something, 0x4); -DECOMP_SIZE_ASSERT(SomethingImpl, 0x8); +DECOMP_SIZE_ASSERT(Unk, 0x4); +DECOMP_SIZE_ASSERT(UnkImpl, 0x8); // Inlined only -SomethingImpl::~SomethingImpl() +UnkImpl::~UnkImpl() { if (m_data) { m_data->Release(); @@ -15,13 +15,13 @@ SomethingImpl::~SomethingImpl() } // OFFSET: LEGO1 0x100a3830 -void* SomethingImpl::ImplementationDataPtr() +void* UnkImpl::ImplementationDataPtr() { return reinterpret_cast(&m_data); } // OFFSET: LEGO1 0x100a3840 STUB -Result SomethingImpl::SetMeshData( +Result UnkImpl::SetMeshData( unsigned long p_faceCount, unsigned long p_vertexCount, const float (*p_positions)[3], @@ -35,7 +35,7 @@ Result SomethingImpl::SetMeshData( } // OFFSET: LEGO1 0x100a3ae0 -Result SomethingImpl::GetBoundingBox(float p_min[3], float p_max[3]) +Result UnkImpl::GetBoundingBox(float p_min[3], float p_max[3]) { D3DRMBOX box; Result result = ResultVal(m_data->GetBox(&box)); @@ -51,9 +51,9 @@ Result SomethingImpl::GetBoundingBox(float p_min[3], float p_max[3]) } // OFFSET: LEGO1 0x100a3b40 -Something* SomethingImpl::Clone() +Unk* UnkImpl::Clone() { - SomethingImpl* mesh = new SomethingImpl(); + UnkImpl* mesh = new UnkImpl(); int ret = m_data->Clone(0, IID_IDirect3DRMMeshBuilder, (void**) &mesh->m_data); if (ret < 0) { delete mesh; diff --git a/LEGO1/tgl/tgl.h b/LEGO1/tgl/tgl.h index 0006e4db..9c1b54ee 100644 --- a/LEGO1/tgl/tgl.h +++ b/LEGO1/tgl/tgl.h @@ -96,7 +96,7 @@ class Camera; class Group; class Mesh; class Texture; -class Something; +class Unk; // VTABLE 0x100db980 class Object { @@ -127,7 +127,7 @@ class Renderer : public Object { virtual Group* CreateGroup(const Group* p_parent = 0) = 0; // vtable+0x20 - virtual Something* CreateSomething() = 0; + virtual Unk* CreateUnk() = 0; virtual Texture* CreateTexture() = 0; virtual Texture* CreateTexture( int p_width, @@ -243,10 +243,10 @@ class Mesh : public Object { virtual Result SetShadingModel(ShadingModel) = 0; // Clone data in underlying group - virtual Mesh* DeepClone(Something*) = 0; + virtual Mesh* DeepClone(Unk*) = 0; // Just get another Group pointing to the same underlying data - virtual Mesh* ShallowClone(Something*) = 0; + virtual Mesh* ShallowClone(Unk*) = 0; }; // VTABLE 0x100dbaa0 @@ -272,7 +272,7 @@ class Group : public Object { // was not in the leaked Tgl code. My suspicion is that it's // some kind of builder class for creating meshes. // VTABLE 0x100dbb30 -class Something : public Object { +class Unk : public Object { public: virtual Result SetMeshData( unsigned long p_faceCount, @@ -284,7 +284,7 @@ class Something : public Object { unsigned long* p_faceData ) = 0; virtual Result GetBoundingBox(float p_min[3], float p_max[3]) = 0; - virtual Something* Clone() = 0; + virtual Unk* Clone() = 0; }; // VTABLE 0x100dbb68