From 9b85d8e1d6b0a3badd31bce8892fd671b879a99c Mon Sep 17 00:00:00 2001 From: DK Date: Sun, 28 May 2023 03:33:58 -0500 Subject: [PATCH] Remove `BSInputDevice` constructor related code ref #68 The added constructor (w/ new DeviceFactory) causes linker error attempting to call `BSInputDevice::IsPressed()` virtual function, this forces compiler to instantiate the class. --- include/RE/B/BSIInputDevice.h | 7 +------ include/RE/B/BSInputDevice.h | 3 --- src/RE/B/BSInputDevice.cpp | 9 --------- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/include/RE/B/BSIInputDevice.h b/include/RE/B/BSIInputDevice.h index a50955129..c98e69fab 100644 --- a/include/RE/B/BSIInputDevice.h +++ b/include/RE/B/BSIInputDevice.h @@ -11,7 +11,7 @@ namespace RE inline static constexpr auto RTTI = RTTI_BSIInputDevice; inline static constexpr auto VTABLE = VTABLE_BSIInputDevice; - virtual ~BSIInputDevice() = default; // 00 + virtual ~BSIInputDevice(); // 00 // add virtual void Initialize() = 0; // 01 @@ -22,11 +22,6 @@ namespace RE virtual bool GetMappedKeycode(std::uint32_t a_key, std::uint32_t& outKeyCode) = 0; // 06 [[nodiscard]] virtual bool IsEnabled() const = 0; // 07 virtual void Reset() = 0; // 08 - - protected: - friend class BSInputDeviceFactory; - TES_HEAP_REDEFINE_NEW(); - BSIInputDevice() = default; }; static_assert(sizeof(BSIInputDevice) == 0x8); } diff --git a/include/RE/B/BSInputDevice.h b/include/RE/B/BSInputDevice.h index d9f1dcfab..fcb02a0bd 100644 --- a/include/RE/B/BSInputDevice.h +++ b/include/RE/B/BSInputDevice.h @@ -43,9 +43,6 @@ namespace RE std::uint32_t pad0C; // 0C BSTHashMap deviceButtons; // 10 BSTHashMap buttonNameIDMap; // 40 - - protected: - BSInputDevice(); }; static_assert(sizeof(BSInputDevice) == 0x70); } diff --git a/src/RE/B/BSInputDevice.cpp b/src/RE/B/BSInputDevice.cpp index 07bc4b2d8..79417337a 100644 --- a/src/RE/B/BSInputDevice.cpp +++ b/src/RE/B/BSInputDevice.cpp @@ -23,15 +23,6 @@ namespace RE return (it != deviceButtons.end()) && (it->second->heldDownSecs > 0.0f); } - BSInputDevice::BSInputDevice() : - BSIInputDevice(), - pad0C(0), - deviceButtons(), - buttonNameIDMap() - { - device = INPUT_DEVICE::kNone; - } - bool BSInputDevice::LoadControlsDefinitionFile(const char* a_fileName) { using func_t = decltype(&BSInputDevice::LoadControlsDefinitionFile);