Skip to content

Commit f2c9706

Browse files
committed
v2: Second pass dead code removal — 642 more lines
Fixed strip script: TDB_VER > 49 is NOT a TDB49 reference (it means 'everything except old RE7'). Added orphaned #elif handler for chains left behind by first pass. Removed orphaned #elif TDB_VER chains in REManagedObject.cpp, RETypeDB.cpp, RETypeDefinition.cpp, Renderer.cpp/hpp, MotionFsm2Layer.hpp. Remaining #ifdef REFRAMEWORK_UNIVERSAL blocks all contain TDB49 references (RE7 support) or are structural (RETypeDB.hpp versioned struct definitions, TDBVer.hpp legacy builds, ReClass.hpp includes). Total dead code removed across both passes: ~2169 lines.
1 parent 4026142 commit f2c9706

7 files changed

Lines changed: 0 additions & 642 deletions

File tree

shared/sdk/MotionFsm2Layer.hpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "REString.hpp"
77
#include "RENativeArray.hpp"
88

9-
#if TDB_VER >= 69
109
#include "regenny/mhrise_tdb71/via/behaviortree/BehaviorTreeCoreHandleArray.hpp"
1110
#include "regenny/mhrise_tdb71/via/motion/MotionFsm2Layer.hpp"
1211
#include "regenny/mhrise_tdb71/via/behaviortree/TreeNodeData.hpp"
@@ -22,15 +21,6 @@
2221
#include "regenny/re2_tdb70/via/behaviortree/TreeObjectData.hpp"
2322
#include "regenny/re2_tdb70/via/behaviortree/TreeObject.hpp"
2423
#include "regenny/re2_tdb70/via/behaviortree/BehaviorTree.hpp"*/
25-
#else
26-
#include "regenny/re3/via/behaviortree/TreeObjectData.hpp"
27-
#include "regenny/re3/via/behaviortree/BehaviorTreeCoreHandleArray.hpp"
28-
#include "regenny/re3/via/motion/MotionFsm2Layer.hpp"
29-
#include "regenny/re3/via/behaviortree/TreeNodeData.hpp"
30-
#include "regenny/re3/via/behaviortree/TreeNode.hpp"
31-
#include "regenny/re3/via/behaviortree/TreeObject.hpp"
32-
#include "regenny/re3/via/behaviortree/BehaviorTree.hpp"
33-
#endif
3424

3525
namespace sdk {
3626
class MotionFsm2Layer;
@@ -161,11 +151,7 @@ class TreeNode : public regenny::via::behaviortree::TreeNode {
161151
}
162152

163153
regenny::via::behaviortree::Condition* get_parent_condition() const {
164-
#if TDB_VER >= 69
165154
return this->parent_condition;
166-
#else
167-
return nullptr;
168-
#endif
169155
}
170156

171157
regenny::via::behaviortree::NodeStatus get_status1() const {
@@ -353,17 +339,13 @@ class TreeObject : public regenny::via::behaviortree::TreeObject {
353339
uint32_t get_transition_count() const;
354340

355341
uint32_t get_unloaded_action_count() const {
356-
#if TDB_VER >= 69
357342
const auto data = get_data();
358343

359344
if (data == nullptr) {
360345
return 0;
361346
}
362347

363348
return data->actions.count;
364-
#else
365-
return 0;
366-
#endif
367349
}
368350

369351
uint32_t get_static_action_count() const {

shared/sdk/REManagedObject.cpp

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ bool is_managed_object(Address address) {
262262
return false;
263263
}
264264

265-
#ifdef REFRAMEWORK_UNIVERSAL
266265
const auto& gi = sdk::GameIdentity::get();
267266
if (gi.tdb_ver() >= 71) {
268267
const auto td = (sdk::RETypeDefinition*)class_info;
@@ -308,80 +307,6 @@ bool is_managed_object(Address address) {
308307
return false;
309308
}
310309
}
311-
#elif TDB_VER >= 71
312-
const auto td = (sdk::RETypeDefinition*)class_info;
313-
314-
if ((uintptr_t)td->managed_vt != (uintptr_t)object->info) {
315-
// This allows for cases when a vtable hook is being used to replace this pointer.
316-
if (IsBadReadPtr(td->managed_vt, sizeof(void*)) || *(sdk::RETypeDefinition**)td->managed_vt != td) {
317-
return false;
318-
}
319-
}
320-
321-
if (td->type == nullptr) {
322-
return false;
323-
}
324-
325-
if (IsBadReadPtr(td->type, REType::runtime_size()) || td->type->get_type_name() == nullptr) {
326-
return false;
327-
}
328-
329-
if (IsBadReadPtr(td->type->get_type_name(), sizeof(void*))) {
330-
return false;
331-
}
332-
#elif TDB_VER > 49
333-
if (class_info->get_managed_vt() != object->info) {
334-
// This allows for cases when a vtable hook is being used to replace this pointer.
335-
if (IsBadReadPtr(class_info->get_managed_vt(), sizeof(void*)) || class_info->get_managed_vt()->get_class_info() != class_info) {
336-
return false;
337-
}
338-
}
339-
340-
if (class_info->get_type() == nullptr) {
341-
return false;
342-
}
343-
344-
if (IsBadReadPtr(class_info->get_type(), REType::runtime_size()) || class_info->get_type()->get_type_name() == nullptr) {
345-
return false;
346-
}
347-
348-
if (IsBadReadPtr(class_info->get_type()->get_type_name(), sizeof(void*))) {
349-
return false;
350-
}
351-
#else
352-
auto info = object->info;
353-
354-
if (info->type == nullptr) {
355-
return false;
356-
}
357-
358-
if (IsBadReadPtr(info->type, REType::runtime_size()) || info->type->get_type_name() == nullptr) {
359-
return false;
360-
}
361-
362-
if (IsBadReadPtr(info->type->get_type_name(), sizeof(void*))) {
363-
return false;
364-
}
365-
366-
if (get_super(info->type) != nullptr && IsBadReadPtr(get_super(info->type), REType::runtime_size())) {
367-
return false;
368-
}
369-
370-
if (get_classInfo(info->type) != nullptr && IsBadReadPtr(get_classInfo(info->type), sizeof(REObjectInfo))) {
371-
return false;
372-
}
373-
374-
static auto vm = sdk::VM::get();
375-
const auto tdef = (sdk::RETypeDefinition*)info->get_class_info();
376-
377-
if (&vm->types[tdef->get_index()] != (regenny::via::clr::VM::Type*)object->info) {
378-
return false;
379-
}
380-
381-
/*if (info->type->classInfo != nullptr && info->type->classInfo != object->info) {
382-
return false;
383-
}*/
384-
#endif
385310

386311
return true;
387312
}
@@ -397,7 +322,6 @@ REType* get_type(::REManagedObject* object) {
397322
return nullptr;
398323
}
399324

400-
#ifdef REFRAMEWORK_UNIVERSAL
401325
const auto& gi = sdk::GameIdentity::get();
402326
if (gi.tdb_ver() >= 71) {
403327
const auto td = get_type_definition(object);
@@ -416,25 +340,6 @@ REType* get_type(::REManagedObject* object) {
416340

417341
return ((sdk::RETypeDefinition*)class_info)->get_type();
418342
}
419-
#elif TDB_VER >= 71
420-
const auto td = get_type_definition(object);
421-
422-
if (td == nullptr) {
423-
return nullptr;
424-
}
425-
426-
return td->type;
427-
#elif TDB_VER > 49
428-
auto class_info = info->get_class_info();
429-
430-
if (class_info == nullptr) {
431-
return nullptr;
432-
}
433-
434-
return class_info->get_type();
435-
#else
436-
return info->type;
437-
#endif
438343
}
439344

440345
sdk::RETypeDefinition* get_type_definition(::REManagedObject* object) {
@@ -510,12 +415,8 @@ uint32_t get_size(::REManagedObject* object) {
510415
return 0;
511416
}
512417

513-
#if TDB_VER > 49
514418
const auto td = get_type_definition(object);
515419
auto size = td->get_size();
516-
#else
517-
auto size = info->size;
518-
#endif
519420

520421
switch (get_vm_type(object)) {
521422
case via::clr::VMObjType::Array:

0 commit comments

Comments
 (0)