From 267246d4666f04988630af8305ac29d299022b1c Mon Sep 17 00:00:00 2001 From: nickp Date: Fri, 1 Apr 2022 23:19:30 +0200 Subject: [PATCH] Attempt to double the ref handle limit --- .../src/patches/CKSSE/BSHandleRefObject_CK.h | 12 ++++++------ .../src/patches/CKSSE/BSPointerHandleManager.h | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/skyrim64_test/src/patches/CKSSE/BSHandleRefObject_CK.h b/skyrim64_test/src/patches/CKSSE/BSHandleRefObject_CK.h index bd91d819..14ceca13 100644 --- a/skyrim64_test/src/patches/CKSSE/BSHandleRefObject_CK.h +++ b/skyrim64_test/src/patches/CKSSE/BSHandleRefObject_CK.h @@ -6,13 +6,13 @@ class BSHandleRefObject : public NiRefObject { private: // - // 31 11 10 0 - // |--------------|--------|-----------| - // | Handle Index | Active | Ref Count | - // |--------------|--------|-----------| + // 31 10 9 0 + // |--------------|---------|----------| + // | Handle Index | Active |Ref Count | + // |--------------|---------|----------| // - constexpr static uint32_t ACTIVE_BIT_INDEX = 10; - constexpr static uint32_t HANDLE_BIT_INDEX = 11; + constexpr static uint32_t ACTIVE_BIT_INDEX = 9; + constexpr static uint32_t HANDLE_BIT_INDEX = 10; constexpr static uint32_t REF_COUNT_MASK = (1u << 10) - 1u; public: diff --git a/skyrim64_test/src/patches/CKSSE/BSPointerHandleManager.h b/skyrim64_test/src/patches/CKSSE/BSPointerHandleManager.h index 66cfecb2..92e4d501 100644 --- a/skyrim64_test/src/patches/CKSSE/BSPointerHandleManager.h +++ b/skyrim64_test/src/patches/CKSSE/BSPointerHandleManager.h @@ -4,25 +4,25 @@ #include "../TES/BSReadWriteLock.h" #include "TESForm_CK.h" -template +template class BSUntypedPointerHandle { public: // - // NOTE: Handle index bits increased from 20 (vanilla) to 21 (limit doubled) + // NOTE: Handle index bits increased from 20 (vanilla) to 25 // - // 31 28 27 21 0 - // |--------|--------|-----|--------------| - // | Unused | Active | Age | Handle Index | - // |--------|--------|-----|--------------| + // 31 30 24 0 + // |--------|--------|--------------------| + // | Active | Age | Handle Index | + // |--------|--------|--------------------| // constexpr static uint32_t INDEX_BITS = IndexBits; constexpr static uint32_t AGE_BITS = AgeCountBits; constexpr static uint32_t UNUSED_BIT_START = INDEX_BITS + AGE_BITS; // 26 in vanilla - constexpr static uint32_t INDEX_MASK = (1u << INDEX_BITS) - 1u; // 0x00FFFFF - constexpr static uint32_t AGE_MASK = ((1u << AGE_BITS) - 1u) << INDEX_BITS;// 0x3F00000 - constexpr static uint32_t ACTIVE_BIT_MASK = 1u << UNUSED_BIT_START; // 0x4000000 + constexpr static uint32_t INDEX_MASK = (1u << INDEX_BITS) - 1u; // 0x01FFFFFF + constexpr static uint32_t AGE_MASK = ((1u << AGE_BITS) - 1u) << INDEX_BITS;// 0x7E000000 + constexpr static uint32_t ACTIVE_BIT_MASK = 1u << UNUSED_BIT_START; // 0x80000000 constexpr static uint32_t MAX_HANDLE_COUNT = 1u << INDEX_BITS;