Skip to content

Commit

Permalink
cleanup old cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan-rsm-McKenzie committed Jun 4, 2021
1 parent 01374c5 commit aa662b4
Show file tree
Hide file tree
Showing 38 changed files with 239 additions and 604 deletions.
1 change: 0 additions & 1 deletion cmake/sourcelist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ set(sources ${sources}
include/RE/H/hkpBroadPhase.cpp
include/RE/H/hkpCdBody.cpp
include/RE/H/hkpCharacterProxyListener.cpp
include/RE/H/hkpCollidable.cpp
include/RE/H/hkpMaterial.cpp
include/RE/H/hkpWorldObject.cpp
include/RE/H/hkReferencedObject.cpp
Expand Down
8 changes: 4 additions & 4 deletions include/RE/A/Array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ namespace RE

[[nodiscard]] TypeInfo::RawType Array::type() const
{
const auto typeID = _elementType.GetRawType();
switch (typeID) {
const stl::enumeration typeID = _elementType.GetRawType();
switch (*typeID) {
case TypeInfo::RawType::kNone:
case TypeInfo::RawType::kObject:
case TypeInfo::RawType::kString:
case TypeInfo::RawType::kInt:
case TypeInfo::RawType::kFloat:
case TypeInfo::RawType::kBool:
return typeID + TypeInfo::RawType::kNoneArray;
return *(typeID + TypeInfo::RawType::kNoneArray);
default:
return typeID + TypeInfo::RawType::kObject;
return *(typeID + TypeInfo::RawType::kObject);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions include/RE/B/BGSDefaultObjectManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,17 +435,17 @@ namespace RE
return func();
}

[[nodiscard]] TESForm* GetObject(DefaultObject a_object) const noexcept { return GetObject(to_underlying(a_object)); }
[[nodiscard]] TESForm* GetObject(DefaultObject a_object) const noexcept { return GetObject(stl::to_underlying(a_object)); }

template <class T>
[[nodiscard]] T* GetObject(DefaultObject a_object) const noexcept
{
return GetObject<T>(to_underlying(a_object));
return GetObject<T>(stl::to_underlying(a_object));
}

[[nodiscard]] TESForm* GetObject(std::size_t a_idx) const noexcept
{
assert(a_idx < to_underlying(DefaultObject::kTotal));
assert(a_idx < stl::to_underlying(DefaultObject::kTotal));
return objectInit[a_idx] ? objects[a_idx] : nullptr;
}

Expand Down
4 changes: 2 additions & 2 deletions include/RE/B/BSAtomic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ namespace RE
BSSemaphoreBase::BSSemaphoreBase() :
semaphore()
{
memzero(&semaphore);
stl::memzero(&semaphore);
semaphore = ::CreateSemaphoreA(nullptr, 0, 40, nullptr);
}

BSSemaphoreBase::~BSSemaphoreBase()
{
::CloseHandle(semaphore);
memzero(&semaphore);
stl::memzero(&semaphore);
}

BSSpinLock::BSSpinLock() :
Expand Down
8 changes: 4 additions & 4 deletions include/RE/B/BSInputDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ namespace RE

BSPCGamepadDeviceHandler* BSInputDeviceManager::GetGamepadHandler()
{
return static_cast<BSPCGamepadDeviceHandler*>(devices[to_underlying(INPUT_DEVICE::kGamepad)]);
return static_cast<BSPCGamepadDeviceHandler*>(devices[stl::to_underlying(INPUT_DEVICE::kGamepad)]);
}

BSWin32KeyboardDevice* BSInputDeviceManager::GetKeyboard()
{
return static_cast<BSWin32KeyboardDevice*>(devices[to_underlying(INPUT_DEVICE::kKeyboard)]);
return static_cast<BSWin32KeyboardDevice*>(devices[stl::to_underlying(INPUT_DEVICE::kKeyboard)]);
}

BSWin32MouseDevice* BSInputDeviceManager::GetMouse()
{
return static_cast<BSWin32MouseDevice*>(devices[to_underlying(INPUT_DEVICE::kMouse)]);
return static_cast<BSWin32MouseDevice*>(devices[stl::to_underlying(INPUT_DEVICE::kMouse)]);
}

BSWin32VirtualKeyboardDevice* BSInputDeviceManager::GetVirtualKeyboard()
{
return static_cast<BSWin32VirtualKeyboardDevice*>(devices[to_underlying(INPUT_DEVICE::kVirtualKeyboard)]);
return static_cast<BSWin32VirtualKeyboardDevice*>(devices[stl::to_underlying(INPUT_DEVICE::kVirtualKeyboard)]);
}

bool BSInputDeviceManager::IsGamepadConnected()
Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/BSIntrusiveRefCounted.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace RE

protected:
// members
volatile std::uint32_t _refCount{ 0 }; // 0
mutable volatile std::uint32_t _refCount{ 0 }; // 0
};
static_assert(sizeof(BSIntrusiveRefCounted) == 0x4);
}
6 changes: 4 additions & 2 deletions include/RE/B/BSScaleformManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ namespace RE
return false;
}

const auto def = loader->CreateMovie(filePath->c_str(), LoadConstants::kLoadKeepBindData | LoadConstants::kLoadWaitFrame1);
const stl::enumeration loadFlags{ LoadConstants::kLoadKeepBindData, LoadConstants::kLoadWaitFrame1 };
const auto def = loader->CreateMovie(filePath->c_str(), *loadFlags);
if (!def) {
return false;
}
Expand Down Expand Up @@ -104,7 +105,8 @@ namespace RE
return false;
}

const auto def = loader->CreateMovie(filePath->c_str(), LoadConstants::kLoadKeepBindData | LoadConstants::kLoadWaitFrame1);
const stl::enumeration loadFlags{ LoadConstants::kLoadKeepBindData, LoadConstants::kLoadWaitFrame1 };
const auto def = loader->CreateMovie(filePath->c_str(), *loadFlags);
if (!def) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/BSTArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace RE
if (_data) {
deallocate(_data);
}
memzero(this);
stl::memzero(this);
}

void* BSScrapArrayAllocator::allocate(std::size_t a_size)
Expand Down
4 changes: 2 additions & 2 deletions include/RE/B/BSTList.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace RE

// members
value_type item; // 00
observer<Node*> next; // ??
stl::observer<Node*> next; // ??
};

template <class U>
Expand Down Expand Up @@ -164,7 +164,7 @@ namespace RE
}

private:
observer<Node*> _cur;
stl::observer<Node*> _cur;
};

using iterator = iterator_base<value_type>;
Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/BSXFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ namespace RE

void BSXFlags::SetFlags(Flag a_flags)
{
value = to_underlying(a_flags);
value = stl::to_underlying(a_flags);
}
}
2 changes: 1 addition & 1 deletion include/RE/B/BipedAnim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace RE
BipedAnim::~BipedAnim()
{
Dtor();
memzero(this);
stl::memzero(this);
}

void BipedAnim::RemoveAllParts()
Expand Down
11 changes: 8 additions & 3 deletions include/RE/G/GFxResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,21 @@ namespace RE

GFxResource::ResourceType GFxResource::GetResourceType() const
{
return (static_cast<ResourceType>(GetResourceTypeCode()) & ResourceType::kTypeCode_Mask) >> ResourceType::kTypeCode_Shift;
return static_cast<GFxResource::ResourceType>(
stl::to_underlying(GetResourceUse()) >>
stl::to_underlying(ResourceType::kTypeCode_Shift));
}

GFxResource::ResourceUse GFxResource::GetResourceUse() const
{
return static_cast<ResourceUse>(GetResourceTypeCode()) & ResourceUse::kTypeCode_Mask;
return static_cast<ResourceUse>(
GetResourceTypeCode() &
stl::to_underlying(ResourceUse::kTypeCode_Mask));
}

std::uint32_t GFxResource::MakeTypeCode(ResourceType a_resourceType, ResourceUse a_resourceUse)
{
return to_underlying(static_cast<ResourceUse>(a_resourceType << ResourceType::kTypeCode_Shift) | a_resourceUse);
return (stl::to_underlying(a_resourceType) << stl::to_underlying(ResourceType::kTypeCode_Shift)) |
stl::to_underlying(a_resourceUse);
}
}
4 changes: 2 additions & 2 deletions include/RE/G/GFxTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ namespace RE

bool GFxTranslator::CanReceiveHTML() const
{
return (GetCaps() & TranslateCap::kReceiveHTML) != TranslateCap::kNone;
return (stl::enumeration{ GetCaps() } & TranslateCap::kReceiveHTML) != TranslateCap::kNone;
}

bool GFxTranslator::NeedStripNewLines() const
{
return (GetCaps() & TranslateCap::kStripTrailingNewLines) != TranslateCap::kNone;
return (stl::enumeration{ GetCaps() } & TranslateCap::kStripTrailingNewLines) != TranslateCap::kNone;
}

bool GFxTranslator::HandlesCustomWordWrapping() const
Expand Down
12 changes: 8 additions & 4 deletions include/RE/G/GFxWWHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ namespace RE
{
bool GFxWWHelper::FindCharWithFlags(WordWrappingType a_wwMode, wchar_t a_ch, BreakInfoFlags a_charBreakFlags)
{
if ((a_wwMode & WordWrappingType::kProhibition) == WordWrappingType::kNone) {
const stl::enumeration wwMode{ a_wwMode };
if ((wwMode & WordWrappingType::kProhibition) == WordWrappingType::kNone) {
return false;
}

Expand All @@ -28,7 +29,8 @@ namespace RE

bool GFxWWHelper::IsAsianChar(WordWrappingType a_wwMode, wchar_t a_ch)
{
if ((a_wwMode & WordWrappingType::kNoHangulWrap) != WordWrappingType::kNone) {
const stl::enumeration wwMode{ a_wwMode };
if ((wwMode & WordWrappingType::kNoHangulWrap) != WordWrappingType::kNone) {
if ((a_ch >= 0x1100 && a_ch <= 0x11FF) || (a_ch >= 0x3130 && a_ch <= 0x318F) || (a_ch >= 0xAC00 && a_ch <= 0xD7A3)) {
return false;
}
Expand Down Expand Up @@ -128,7 +130,9 @@ namespace RE
UPInt GFxWWHelper::FindWordWrapPos(WordWrappingType a_wwMode, [[maybe_unused]] UPInt a_wordWrapPos, const wchar_t* a_paraText, UPInt a_paraLen, UPInt a_lineStartPos, UPInt a_lineLen)
{
assert(a_paraText);
if ((a_wwMode & WordWrappingType::kAll) == WordWrappingType::kNone || a_lineLen == 0) {

const stl::enumeration wwMode{ a_wwMode };
if ((wwMode & WordWrappingType::kAll) == WordWrappingType::kNone || a_lineLen == 0) {
return UPINT_MAX;
}

Expand All @@ -147,7 +151,7 @@ namespace RE
pos = prev + 1;
}

if (IsLineBreakOpportunityAt(a_wwMode, lineText, pos)) {
if (IsLineBreakOpportunityAt(*wwMode, lineText, pos)) {
break;
}

Expand Down
6 changes: 3 additions & 3 deletions include/RE/H/HeapBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ namespace RE
{
std::uint32_t HeapBlock::Used::GetCheckPoint() const
{
return static_cast<std::uint32_t>(pun_bits(memContext1, memContext2, memContext3, memContext4, memContext5, memContext6, memContext7, memContext8));
return static_cast<std::uint32_t>(stl::pun_bits(memContext1, memContext2, memContext3, memContext4, memContext5, memContext6, memContext7, memContext8));
}

std::uint32_t HeapBlock::Used::GetMemContext() const
{
return static_cast<std::uint32_t>(pun_bits(stackTrace1, stackTrace2, stackTrace3, stackTrace4, stackTrace5, stackTrace6, stackTrace7, stackTrace8, stackTrace9, stackTrace10, stackTrace11, stackTrace12, stackTrace13, stackTrace14, stackTrace15, stackTrace16, stackTrace17, stackTrace18, stackTrace19, stackTrace20, stackTrace21, stackTrace22));
return static_cast<std::uint32_t>(stl::pun_bits(stackTrace1, stackTrace2, stackTrace3, stackTrace4, stackTrace5, stackTrace6, stackTrace7, stackTrace8, stackTrace9, stackTrace10, stackTrace11, stackTrace12, stackTrace13, stackTrace14, stackTrace15, stackTrace16, stackTrace17, stackTrace18, stackTrace19, stackTrace20, stackTrace21, stackTrace22));
}

std::uint32_t HeapBlock::Used::GetStackTrace() const
{
return static_cast<std::uint32_t>(pun_bits(checkPoint1, checkPoint2));
return static_cast<std::uint32_t>(stl::pun_bits(checkPoint1, checkPoint2));
}
}
9 changes: 0 additions & 9 deletions include/RE/H/hkpCollidable.cpp

This file was deleted.

6 changes: 5 additions & 1 deletion include/RE/H/hkpCollidable.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ namespace RE
};
static_assert(sizeof(BoundingVolumeData) == 0x38);

void* GetOwner() const;
[[nodiscard]] void* GetOwner() const
{
return const_cast<void*>(stl::adjust_pointer<const void>(this, ownerOffset));
}

template <class T>
T* GetOwner() const
{
Expand Down
2 changes: 1 addition & 1 deletion include/RE/I/IFormFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace RE
{
struct Factories
{
IFormFactory* data[to_underlying(FormType::Max)];
IFormFactory* data[stl::to_underlying(FormType::Max)];
};

REL::Relocation<Factories*> formFactories{ REL::ID(514355) };
Expand Down
2 changes: 1 addition & 1 deletion include/RE/I/InventoryChanges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace RE
InventoryChanges::~InventoryChanges()
{
Dtor();
memzero(this);
stl::memzero(this);
}

void InventoryChanges::AddEntryData(InventoryEntryData* a_entry)
Expand Down
2 changes: 1 addition & 1 deletion include/RE/M/MemoryPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace RE

void* MemoryPage::GetTail()
{
return adjust_pointer<void>(GetHead(), pageSize);
return stl::adjust_pointer<void>(GetHead(), pageSize);
}

bool MemoryPage::IsInRange(const void* a_ptr)
Expand Down
2 changes: 1 addition & 1 deletion include/RE/M/MiddleHighProcessData.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ namespace RE
BSTArray<BGSPerkEntry*>& operator[](BGSEntryPoint::ENTRY_POINT a_pos)
{
assert(a_pos < BGSEntryPoint::ENTRY_POINT::kTotal);
return perkEntryArrays[to_underlying(a_pos)];
return perkEntryArrays[stl::to_underlying(a_pos)];
}

// members
Expand Down
2 changes: 1 addition & 1 deletion include/RE/N/NiTCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace RE
inline static void Deallocate(T* a_array)
{
if (a_array) {
auto head = adjust_pointer<std::size_t>(a_array, -ssizeof_v<std::uintptr_t>);
auto head = stl::adjust_pointer<std::size_t>(a_array, -stl::ssizeof_v<std::uintptr_t>);
for (std::size_t i = 0; i < *head; ++i) {
a_array[i].~T();
}
Expand Down
2 changes: 1 addition & 1 deletion include/RE/O/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace RE
Object::~Object()
{
Dtor();
memzero(this);
stl::memzero(this);
}

VMHandle Object::GetHandle() const
Expand Down
2 changes: 1 addition & 1 deletion include/RE/O/ObjectTypeInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace RE

TypeInfo::RawType ObjectTypeInfo::GetRawType() const
{
return unrestricted_cast<TypeInfo::RawType>(this);
return stl::unrestricted_cast<TypeInfo::RawType>(this);
}

auto ObjectTypeInfo::GetUnlinkedFunctionIter()
Expand Down
6 changes: 3 additions & 3 deletions include/RE/S/ShadowSceneNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ namespace RE
std::uint64_t unk1F0; // 1F0
std::uint64_t unk1F8; // 1F8

owner<void*> unk200; // 200 - smart ptr
stl::owner<void*> unk200; // 200 - smart ptr
std::uint64_t unk208; // 208
owner<void*> unk210; // 210 - smart ptr
stl::owner<void*> unk210; // 210 - smart ptr
std::uint64_t unk218; // 218
owner<void*> unk220; // 220 - smart ptr
stl::owner<void*> unk220; // 220 - smart ptr
std::uint64_t unk228; // 228
BSTArray<void*> unk230; // 230
std::uint64_t unk248; // 248
Expand Down
2 changes: 1 addition & 1 deletion include/RE/S/Stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace RE
Stack::~Stack()
{
Dtor();
memzero(this);
stl::memzero(this);
}

std::uint32_t Stack::GetPageForFrame(const StackFrame* a_frame) const
Expand Down
Loading

0 comments on commit aa662b4

Please sign in to comment.