CharmedBaryon / CommonLibSSE-NG

This is a reverse engineered library for Skyrim Special Edition and Skyrim VR.
MIT License
142 stars 32 forks source link

`SKYRIM_SUPPORT_AE` macro break structure #89

Open ccldrepo opened 7 months ago

ccldrepo commented 7 months ago

For example

        struct INPUT_CONTEXT_IDS
        {
            enum INPUT_CONTEXT_ID : std::uint32_t
            {
                kGameplay = 0,
                kMenuMode,
                kConsole,
                kItemMenu,
                kInventory,
                kDebugText,
                kFavorites,
                kMap,
                kStats,
                kCursor,
                kBook,
                kDebugOverlay,
                kJournal,
                kTFCMode,
                kMapDebug,
                kLockpicking,
#ifdef SKYRIM_SUPPORT_AE
                kMarketplace,
#endif
                kFavor,

                kTotal,

                kNone
            };
        };

and


    class ControlMap :
        public BSTSingletonSDM<ControlMap>,      // 00
        public BSTEventSource<UserEventEnabled>  // 08
    {
    public:
        using InputContextID = UserEvents::INPUT_CONTEXT_ID;
        using UEFlag = UserEvents::USER_EVENT_FLAG;

        static ControlMap* GetSingleton();

        // ......

        // members
        // This is broken!!!!!!!!!!!!!!!!!
        InputContext*                                    controlMap[InputContextID::kTotal];  // 060 // !!! Note here depends on kTotal
        BSTArray<LinkedMapping>                          linkedMappings;                      // 0E8
        BSTArray<InputContextID>                         contextPriorityStack;                // 100
        stl::enumeration<UEFlag, std::uint32_t>          enabledControls;                     // 118
        stl::enumeration<UEFlag, std::uint32_t>          unk11C;                              // 11C
        std::int8_t                                      textEntryCount;                      // 120
        bool                                             ignoreKeyboardMouse;                 // 121
        bool                                             ignoreActivateDisabledEvents;        // 122
        std::uint8_t                                     pad123;                              // 123
        stl::enumeration<PC_GAMEPAD_TYPE, std::uint32_t> gamePadMapType;                      // 124
    };
#ifdef SKYRIM_SUPPORT_AE
    static_assert(sizeof(ControlMap) == 0x130);
#else
    static_assert(sizeof(ControlMap) == 0x128);
#endif
ccldrepo commented 7 months ago

so the offset on AE is incorrect.