├── sfe ├── f4se │ ├── exports.def │ ├── BSSkin.cpp │ ├── BSLight.cpp │ ├── bhkWorld.cpp │ ├── BSCollision.cpp │ ├── GameMemory.cpp │ ├── GameThreads.cpp │ ├── NiSerialization.cpp │ ├── ScaleformMovie.cpp │ ├── ScaleformTypes.cpp │ ├── PapyrusNativeFunctions.cpp │ ├── BSParticleShaderEmitter.cpp │ ├── Hooks_Camera.h │ ├── Hooks_Debug.h │ ├── Hooks_Input.h │ ├── Hooks_GameData.h │ ├── Hooks_Gameplay.h │ ├── Hooks_ObScript.h │ ├── Hooks_SaveLoad.h │ ├── BSGeometry.cpp │ ├── Hooks_Memory.h │ ├── PapyrusArmor.h │ ├── PapyrusLocation.h │ ├── packages.config │ ├── PapyrusArmorAddon.h │ ├── PapyrusEquipSlot.h │ ├── PapyrusEncounterZone.h │ ├── BSModelDB.cpp │ ├── ScaleformLoader.cpp │ ├── InternalSerialization.h │ ├── PapyrusCell.h │ ├── PapyrusPerk.h │ ├── PapyrusUI.h │ ├── GameUtilities.cpp │ ├── PapyrusInput.h │ ├── PapyrusMath.h │ ├── PapyrusWeapon.h │ ├── GameMessages.cpp │ ├── PapyrusComponent.h │ ├── PapyrusObjectMod.h │ ├── PapyrusUtilities.h │ ├── PapyrusUtility.h │ ├── PapyrusWaterType.h │ ├── PapyrusMiscObject.h │ ├── PapyrusInstanceData.h │ ├── PapyrusMaterialSwap.h │ ├── PapyrusScriptObject.h │ ├── PapyrusActorBase.h │ ├── PapyrusConstructibleObject.h │ ├── PapyrusDefaultObject.h │ ├── PapyrusObjectReference.h │ ├── ScaleformState.cpp │ ├── NiNodes.cpp │ ├── PapyrusForm.h │ ├── PapyrusGame.h │ ├── PapyrusActor.h │ ├── PapyrusFavoritesManager.h │ ├── NiMaterials.cpp │ ├── NiTextures.cpp │ ├── ObScript.cpp │ ├── Translation.h │ ├── Hooks_Scaleform.h │ ├── Hooks_Threads.h │ ├── PapyrusDelayFunctorsDef.inl │ ├── PapyrusHeadPart.h │ ├── ScaleformTranslator.cpp │ ├── PapyrusVM.cpp │ ├── GameEvents.cpp │ ├── Hooks_Papyrus.h │ ├── ScaleformCallbacks.cpp │ ├── GameCamera.cpp │ ├── GameUtilities.h │ ├── ScaleformAPI.cpp │ ├── PapyrusSerialization.h │ ├── ScaleformSerialization.h │ ├── GameForms.cpp │ ├── PapyrusEventsDef.inl │ ├── NiCloningProcess.h │ ├── PapyrusScaleformAdapter.h │ ├── PapyrusF4SE.h │ ├── NiProperties.cpp │ ├── PapyrusInterfaces.cpp │ ├── NiRTTI.h │ ├── GameFormComponents.cpp │ ├── PapyrusNativeFunctionDef.inl │ ├── PapyrusStruct.cpp │ ├── GameWorkshop.cpp │ ├── PapyrusUtilities.cpp │ ├── BSGraphics.cpp │ ├── NiRTTI.cpp │ ├── GameRTTI.cpp │ ├── ScaleformAPI.h │ ├── CustomMenu.h │ ├── GameAPI.h │ ├── PapyrusArmor.cpp │ ├── PapyrusEquipSlot.cpp │ ├── PapyrusArmorAddon.cpp │ ├── GameAPI.cpp │ ├── GameThreads.h │ ├── NiObjects.cpp │ ├── ScaleformTypes.h │ ├── PapyrusWeapon.cpp │ ├── BSSkin.h │ ├── GameReferences.cpp │ ├── PapyrusUtility.cpp │ ├── GameMessages.h │ ├── NiSerialization.h │ ├── PapyrusDefaultObject.cpp │ ├── PapyrusCell.cpp │ ├── ObScript.h │ ├── BSModelDB.h │ ├── ScaleformLoader.h │ ├── InputMap.h │ ├── PapyrusEvents.cpp │ ├── PapyrusWaterType.cpp │ ├── PapyrusComponent.cpp │ ├── Hooks_GameData.cpp │ ├── ScaleformTranslator.h │ ├── GameObjects.cpp │ ├── Hooks_ObScript.cpp │ ├── PapyrusLocation.cpp │ ├── GameWorkshop.h │ ├── BSParticleShaderEmitter.h │ ├── GameStreams.cpp │ ├── ScaleformSerialization.cpp │ ├── Hooks_Camera.cpp │ ├── PapyrusMaterialSwap.cpp │ ├── PluginManager.h │ ├── PapyrusMiscObject.cpp │ ├── PapyrusPerk.cpp │ ├── PapyrusHeadPart.cpp │ ├── NiTypes.cpp │ ├── NiNodes.h │ └── ScaleformCallbacks.h ├── openssl │ ├── version.txt │ └── include │ │ └── openssl │ │ ├── ecdh.h │ │ ├── ecdsa.h │ │ ├── asn1_mac.h │ │ ├── pem2.h │ │ ├── __DECC_INCLUDE_EPILOGUE.H │ │ ├── ssl2.h │ │ ├── __DECC_INCLUDE_PROLOGUE.H │ │ ├── buffererr.h │ │ ├── rc4.h │ │ ├── ebcdic.h │ │ ├── mdc2.h │ │ ├── cmac.h │ │ ├── md2.h │ │ ├── comperr.h │ │ ├── objectserr.h │ │ ├── asyncerr.h │ │ ├── ripemd.h │ │ ├── symhacks.h │ │ ├── conf_api.h │ │ ├── srtp.h │ │ ├── md5.h │ │ ├── md4.h │ │ ├── comp.h │ │ ├── whrlpool.h │ │ ├── rc2.h │ │ ├── hmac.h │ │ ├── buffer.h │ │ ├── dtls1.h │ │ ├── cast.h │ │ ├── txt_db.h │ │ ├── blowfish.h │ │ ├── rc5.h │ │ ├── kdferr.h │ │ ├── idea.h │ │ └── cryptoerr.h ├── f4se_loader_common │ ├── LoaderError.h │ ├── Steam.h │ ├── IdentifyEXE.h │ ├── f4se_loader_common.vcxproj.filters │ └── LoaderError.cpp ├── f4se_loader │ ├── f4se_loader.vcxproj.filters │ └── Options.h ├── f4se_common │ ├── SafeWrite.h │ ├── resource.h │ ├── f4se_common.vcxproj.filters │ ├── f4se_version.rc │ ├── BranchTrampoline.h │ ├── SafeWrite.cpp │ ├── Relocation.cpp │ └── Relocation.h └── xbyak │ └── COPYRIGHT ├── common ├── IPrefix.cpp ├── IDatabase.cpp ├── IRangeMap.cpp ├── IInterlockedLong.cpp ├── ISingleton.cpp ├── IMutex.h ├── IPipeClient.h ├── IPipeServer.h ├── IEvent.h ├── IReadWriteLock.h ├── ITextParser.h ├── IDirectoryIterator.h ├── IConsole.h ├── IInterlockedLong.h ├── IMutex.cpp ├── IThread.h ├── ITimer.h ├── IPrefix.h ├── ICriticalSection.h ├── IReadWriteLock.cpp ├── IBufferStream.h ├── IMemPool.cpp ├── IDynamicCreate.cpp ├── IEvent.cpp ├── IFIFO.h ├── IFileStream.h ├── common_license.txt ├── common_vc11.sln ├── ISegmentStream.h ├── IThread.cpp ├── ISingleton.h ├── common_vc14.sln ├── IDirectoryIterator.cpp ├── IDatabase.inc ├── IPipeClient.cpp ├── ITypes.cpp ├── IBufferStream.cpp ├── ITextParser.cpp ├── IPipeServer.cpp ├── ILinkedList.h ├── IErrors.cpp ├── IFIFO.cpp ├── ISegmentStream.cpp ├── IErrors.h └── IArchive.cpp ├── LICENSE.md └── README.md /sfe/f4se/exports.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | -------------------------------------------------------------------------------- /common/IPrefix.cpp: -------------------------------------------------------------------------------- 1 | #include "IPrefix.h" 2 | -------------------------------------------------------------------------------- /common/IDatabase.cpp: -------------------------------------------------------------------------------- 1 | #include "IDatabase.h" 2 | -------------------------------------------------------------------------------- /common/IRangeMap.cpp: -------------------------------------------------------------------------------- 1 | #include "IRangeMap.h" 2 | -------------------------------------------------------------------------------- /sfe/f4se/BSSkin.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/BSSkin.h" 2 | -------------------------------------------------------------------------------- /sfe/f4se/BSLight.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/BSLight.h" 2 | -------------------------------------------------------------------------------- /sfe/f4se/bhkWorld.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/bhkWorld.h" 2 | -------------------------------------------------------------------------------- /sfe/f4se/BSCollision.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/BSCollision.h" 2 | -------------------------------------------------------------------------------- /sfe/f4se/GameMemory.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameMemory.h" 2 | -------------------------------------------------------------------------------- /sfe/f4se/GameThreads.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameThreads.h" 2 | -------------------------------------------------------------------------------- /sfe/openssl/version.txt: -------------------------------------------------------------------------------- 1 | OpenSSL_1_1_0j-17-g47c55f881f 2 | -------------------------------------------------------------------------------- /sfe/f4se/NiSerialization.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/NiSerialization.h" 2 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformMovie.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/ScaleformMovie.h" 2 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformTypes.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/ScaleformTypes.h" 2 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusNativeFunctions.cpp: -------------------------------------------------------------------------------- 1 | #include "PapyrusNativeFunctions.h" 2 | -------------------------------------------------------------------------------- /sfe/f4se/BSParticleShaderEmitter.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/BSParticleShaderEmitter.h" 2 | -------------------------------------------------------------------------------- /common/IInterlockedLong.cpp: -------------------------------------------------------------------------------- 1 | #include "IInterlockedLong.h" 2 | 3 | // all functions are inlined 4 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_Camera.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void Hooks_Camera_Init(); 4 | void Hooks_Camera_Commit(); 5 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_Debug.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void Hooks_Debug_Init(); 4 | void Hooks_Debug_Commit(); 5 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_Input.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void Hooks_Input_Init(); 4 | void Hooks_Input_Commit(); 5 | -------------------------------------------------------------------------------- /sfe/f4se_loader_common/LoaderError.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void PrintLoaderError(const char * fmt, ...); 4 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_GameData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void Hooks_GameData_Init(); 4 | void Hooks_GameData_Commit(); 5 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_Gameplay.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void Hooks_Gameplay_Init(); 4 | void Hooks_Gameplay_Commit(); 5 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_ObScript.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void Hooks_ObScript_Init(); 4 | void Hooks_ObScript_Commit(); 5 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_SaveLoad.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void Hooks_SaveLoad_Init(); 4 | void Hooks_SaveLoad_Commit(); 5 | -------------------------------------------------------------------------------- /sfe/f4se_loader_common/Steam.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | bool SteamCheckPassive(void); 4 | bool SteamLaunch(void); 5 | -------------------------------------------------------------------------------- /common/ISingleton.cpp: -------------------------------------------------------------------------------- 1 | #include "common/ISingleton.h" 2 | 3 | //template T * Singleton ::ms_Singleton = 0; -------------------------------------------------------------------------------- /sfe/f4se/BSGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/BSGeometry.h" 2 | 3 | RelocAddr <_ConvertHalfToFloat> ConvertHalfToFloat(0x006944A0); 4 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_Memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void Hooks_Memory_Init(); 4 | void Hooks_Memory_Commit(); 5 | 6 | void PrintHeapStatus(); 7 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusArmor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VirtualMachine; 4 | 5 | namespace papyrusArmor 6 | { 7 | void RegisterFuncs(VirtualMachine* vm); 8 | } 9 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusLocation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VirtualMachine; 4 | 5 | namespace papyrusLocation 6 | { 7 | void RegisterFuncs(VirtualMachine* vm); 8 | } 9 | -------------------------------------------------------------------------------- /sfe/f4se/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusArmorAddon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VirtualMachine; 4 | 5 | namespace papyrusArmorAddon 6 | { 7 | void RegisterFuncs(VirtualMachine* vm); 8 | } 9 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusEquipSlot.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VirtualMachine; 4 | 5 | namespace papyrusEquipSlot 6 | { 7 | void RegisterFuncs(VirtualMachine* vm); 8 | } 9 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusEncounterZone.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VirtualMachine; 4 | 5 | namespace papyrusEncounterZone 6 | { 7 | void RegisterFuncs(VirtualMachine* vm); 8 | } 9 | -------------------------------------------------------------------------------- /sfe/f4se/BSModelDB.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/BSModelDB.h" 2 | 3 | // 76A9720CA598893620233A95993057BD7FAF98DD+71 4 | RelocPtr g_TESProcessor(0x0590C3F0); 5 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformLoader.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/ScaleformLoader.h" 2 | 3 | // 7A4A1713A39F72AA5098850E74E38B4655E445AF+4D 4 | RelocPtr g_scaleformManager(0x05917490); 5 | -------------------------------------------------------------------------------- /sfe/f4se/InternalSerialization.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | UInt8 ResolveModIndex(UInt8 modIndexIn); 4 | UInt16 ResolveLightModIndex(UInt16 modIndexIn); 5 | void Init_CoreSerialization_Callbacks(); 6 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusCell.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusCell 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusPerk.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusPerk 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusUI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusUI 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/GameUtilities.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameUtilities.h" 2 | 3 | RelocAddr <_CalculateCRC32_64> CalculateCRC32_64(0x01B10710); 4 | RelocAddr <_CalculateCRC32_32> CalculateCRC32_32(0x01B10680); 5 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusInput.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusInput 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusMath.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusMath 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusWeapon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusWeapon 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/GameMessages.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameMessages.h" 2 | 3 | // C23839741F04EC9FEBD007709BC69ED7012F147A+5D 4 | RelocPtr *> g_messageQueue(0x05AFF540); 5 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusComponent 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusObjectMod.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusObjectMod 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusUtilities.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace PapyrusVM 4 | { 5 | UInt64 GetHandleFromObject(void * src, UInt32 typeID); 6 | void * GetObjectFromHandle(UInt64 handle, UInt32 typeID); 7 | }; 8 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusUtility.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusUtility 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusWaterType.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusWaterType 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusMiscObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusMiscObject 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusInstanceData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusInstanceData 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusMaterialSwap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusMaterialSwap 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusScriptObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusScriptObject 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusActorBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/GameTypes.h" 4 | 5 | class VirtualMachine; 6 | 7 | namespace papyrusActorBase 8 | { 9 | void RegisterFuncs(VirtualMachine* vm); 10 | }; 11 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusConstructibleObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct StaticFunctionTag; 4 | class VirtualMachine; 5 | 6 | namespace papyrusConstructibleObject 7 | { 8 | void RegisterFuncs(VirtualMachine* vm); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusDefaultObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/GameTypes.h" 4 | 5 | class VirtualMachine; 6 | 7 | namespace papyrusDefaultObject 8 | { 9 | void RegisterFuncs(VirtualMachine* vm); 10 | }; 11 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusObjectReference.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VirtualMachine; 4 | 5 | #include "f4se/GameTypes.h" 6 | 7 | namespace papyrusObjectReference 8 | { 9 | void RegisterFuncs(VirtualMachine* vm); 10 | } 11 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformState.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/ScaleformState.h" 2 | 3 | void F4SEGFxLogger::LogMessageVarg(UInt32 messageType, const char* fmt, va_list args) 4 | { 5 | gLog.LogNNL(IDebugLog::kLevel_Message, fmt, args); 6 | } 7 | -------------------------------------------------------------------------------- /sfe/f4se/NiNodes.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/NiNodes.h" 2 | 3 | NiNode * NiNode::Create(UInt16 children) 4 | { 5 | NiNode * node = (NiNode*)Heap_Allocate(sizeof(NiNode)); 6 | CALL_MEMBER_FN(node, ctor)(children); 7 | return node; 8 | } 9 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusForm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VirtualMachine; 4 | struct StaticFunctionTag; 5 | 6 | #include "f4se/GameTypes.h" 7 | 8 | namespace papyrusForm 9 | { 10 | void RegisterFuncs(VirtualMachine* vm); 11 | } 12 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusGame.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VirtualMachine; 4 | struct StaticFunctionTag; 5 | 6 | #include "f4se/GameTypes.h" 7 | 8 | namespace papyrusGame 9 | { 10 | void RegisterFuncs(VirtualMachine* vm); 11 | } 12 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusActor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VirtualMachine; 4 | struct StaticFunctionTag; 5 | 6 | #include "f4se/GameTypes.h" 7 | 8 | namespace papyrusActor 9 | { 10 | void RegisterFuncs(VirtualMachine* vm); 11 | } 12 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusFavoritesManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VirtualMachine; 4 | struct StaticFunctionTag; 5 | 6 | #include "f4se/GameTypes.h" 7 | 8 | namespace papyrusFavoritesManager 9 | { 10 | void RegisterFuncs(VirtualMachine* vm); 11 | } 12 | -------------------------------------------------------------------------------- /sfe/f4se/NiMaterials.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/NiMaterials.h" 2 | 3 | // 84348FDD81710405CBC1A9C84103811EF7BF8394+3E 4 | RelocAddr <_CreateShaderMaterialByType> CreateShaderMaterialByType(0x0284BC60); 5 | 6 | RelocAddr <_LoadMaterialFile> LoadMaterialFile(0x01C9D050); 7 | -------------------------------------------------------------------------------- /sfe/f4se/NiTextures.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/NiTextures.h" 2 | 3 | RelocAddr <_CreateTexture> CreateTexture(0x01BA5100); 4 | 5 | RelocAddr <_CreateBSShaderTextureSet> CreateBSShaderTextureSet(0x027E2180); 6 | 7 | RelocAddr <_LoadTextureByPath> LoadTextureByPath(0x027FB1A0); -------------------------------------------------------------------------------- /sfe/f4se/ObScript.cpp: -------------------------------------------------------------------------------- 1 | #include "ObScript.h" 2 | 3 | // 61A506FAB79EC111F852CE23E1E7A87D3E195A1B+43 4 | RelocPtr g_firstObScriptCommand(0x0372EDD0); 5 | // 61A506FAB79EC111F852CE23E1E7A87D3E195A1B+1A 6 | RelocPtr g_firstConsoleCommand(0x0373EDC0); 7 | -------------------------------------------------------------------------------- /sfe/f4se/Translation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class BSScaleformTranslator; 4 | 5 | namespace Translation 6 | { 7 | void ImportTranslationFiles(BSScaleformTranslator * translator); 8 | void ParseTranslation(BSScaleformTranslator * translator, std::string & name); 9 | } 10 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_Scaleform.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/PluginAPI.h" 4 | 5 | void Hooks_Scaleform_Init(); 6 | void Hooks_Scaleform_Commit(); 7 | 8 | bool RegisterScaleformPlugin(const char * name, F4SEScaleformInterface::RegisterCallback callback); 9 | void Hooks_OpenCloseHandler(); -------------------------------------------------------------------------------- /sfe/f4se/Hooks_Threads.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class ITaskDelegate; 4 | 5 | void Hooks_Threads_Init(void); 6 | void Hooks_Threads_Commit(void); 7 | 8 | namespace TaskInterface 9 | { 10 | void AddTask(ITaskDelegate * task); 11 | void AddUITask(ITaskDelegate * task); 12 | } 13 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusDelayFunctorsDef.inl: -------------------------------------------------------------------------------- 1 | 2 | #define CLASS_NAME __MACRO_JOIN__(F4SEDelayFunctor, NUM_PARAMS) 3 | #define VOID_SPEC 0 4 | #include "PapyrusDelayFunctorsDef_Base.inl" 5 | 6 | #define VOID_SPEC 1 7 | #include "PapyrusDelayFunctorsDef_Base.inl" 8 | #undef CLASS_NAME 9 | #undef NUM_PARAMS -------------------------------------------------------------------------------- /sfe/f4se/PapyrusHeadPart.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/GameTypes.h" 4 | 5 | class BGSHeadPart; 6 | class BGSListForm; 7 | class VirtualMachine; 8 | struct StaticFunctionTag; 9 | 10 | namespace papyrusHeadPart 11 | { 12 | void RegisterFuncs(VirtualMachine* vm); 13 | }; 14 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformTranslator.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/ScaleformTranslator.h" 2 | 3 | // E33FAE94A9BB57E033DF51B26B8EC718FD4FAA35+3B 4 | RelocAddr <_CreateEmptyString> CreateEmptyString(0x01B429A0); 5 | // E33FAE94A9BB57E033DF51B26B8EC718FD4FAA35+73 6 | RelocAddr <_SetWideString> SetWideString(0x01B42AF0); 7 | -------------------------------------------------------------------------------- /common/IMutex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class IMutex 4 | { 5 | public: 6 | static const UInt32 kDefaultTimeout = 1000 * 10; 7 | 8 | IMutex(); 9 | ~IMutex(); 10 | 11 | bool Wait(UInt32 timeout = kDefaultTimeout); 12 | void Release(void); 13 | 14 | private: 15 | HANDLE theMutex; 16 | }; 17 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusVM.cpp: -------------------------------------------------------------------------------- 1 | #include "PapyrusVM.h" 2 | 3 | // 1E364B1377EA84E44CC933976A8BE6D548B7D5AF+C 4 | RelocPtr g_gameVM(0x0590C388); 5 | 6 | bool VirtualMachine::HasStack(UInt32 stackId) 7 | { 8 | BSReadLocker locker(&stackLock); 9 | return m_allStacks.Find(&stackId) != NULL; 10 | } 11 | -------------------------------------------------------------------------------- /sfe/f4se/GameEvents.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameEvents.h" 2 | 3 | // 7D79D7BCBD040E10630ADDBE12B957FD115304A2+D 4 | RelocPtr *> g_colorUpdateDispatcher(0x065B0DF0); 5 | 6 | // 61A1F6B0E46CB298CD32C55D9A653D702CCD1B67+63 7 | RelocPtr g_globalEvents(0x05907C98); -------------------------------------------------------------------------------- /sfe/f4se/Hooks_Papyrus.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/PluginAPI.h" 4 | 5 | void Hooks_Papyrus_Init(); 6 | void Hooks_Papyrus_Commit(); 7 | 8 | bool RegisterPapyrusPlugin(F4SEPapyrusInterface::RegisterFunctions); 9 | void GetExternalEventRegistrations(const char * eventName, void * data, F4SEPapyrusInterface::RegistrantFunctor functor); 10 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Fallout 4 Script Extender (F4SE) source is used by permission by the F4SE development team. For more information about F4SE please visit https://f4se.silverlock.org/. 2 | Minimal DXGI shim is used under permission by reg2k (https://github.com/reg2k) 3 | OpenSSL, Xbyak, and the common libraries' license information can be found in their respective folders. 4 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformCallbacks.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/ScaleformCallbacks.h" 2 | 3 | UInt32 g_GFxFunctionHandler_count = 0; 4 | 5 | GFxFunctionHandler::GFxFunctionHandler() 6 | { 7 | g_GFxFunctionHandler_count++; 8 | } 9 | 10 | GFxFunctionHandler::~GFxFunctionHandler() 11 | { 12 | g_GFxFunctionHandler_count--; 13 | } 14 | 15 | FunctionHandlerCache g_functionHandlerCache; 16 | -------------------------------------------------------------------------------- /sfe/f4se/GameCamera.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameCamera.h" 2 | 3 | // 05C2864F8B39388E329CE28479B6A5636B4D529C+11 4 | RelocPtr g_playerCamera(0x05907BA8); 5 | 6 | SInt32 PlayerCamera::GetCameraStateId(TESCameraState * state) 7 | { 8 | for(int i = 0; i < kNumCameraStates; i++) { 9 | if(state == cameraStates[i]) 10 | return i; 11 | } 12 | 13 | return -1; 14 | } 15 | -------------------------------------------------------------------------------- /sfe/f4se/GameUtilities.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se_common/Relocation.h" 4 | 5 | typedef void (* _CalculateCRC32_64)(UInt32 * out, UInt64 data, UInt32 previous); 6 | extern RelocAddr <_CalculateCRC32_64> CalculateCRC32_64; 7 | 8 | typedef void (* _CalculateCRC32_32)(UInt32 * out, UInt32 data, UInt32 previous); 9 | extern RelocAddr <_CalculateCRC32_32> CalculateCRC32_32; 10 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformAPI.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/ScaleformAPI.h" 2 | 3 | // 2D9A7EEA0F5FCB0ACE8EC9010926351C3F504E26+28 4 | RelocPtr g_scaleformHeap(0x065B0EB0); 5 | 6 | void * ScaleformHeap_Allocate(UInt32 size) 7 | { 8 | return (*g_scaleformHeap)->Allocate(size); 9 | } 10 | 11 | void ScaleformHeap_Free(void * ptr) 12 | { 13 | (*g_scaleformHeap)->Free(ptr); 14 | } 15 | -------------------------------------------------------------------------------- /sfe/f4se_loader_common/IdentifyEXE.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum 4 | { 5 | kProcType_Steam, 6 | kProcType_Normal, 7 | 8 | kProcType_Packed, 9 | 10 | kProcType_Unknown 11 | }; 12 | 13 | struct ProcHookInfo 14 | { 15 | UInt64 version; 16 | UInt32 procType; 17 | }; 18 | 19 | bool IdentifyEXE(const char * procName, bool isEditor, std::string * dllSuffix, ProcHookInfo * hookInfo); 20 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusSerialization.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/Serialization.h" 4 | #include "f4se/PluginAPI.h" 5 | #include "f4se/PapyrusArgs.h" 6 | 7 | class VMVariable; 8 | 9 | namespace Serialization 10 | { 11 | bool WriteVMData(const F4SESerializationInterface* intfc, const VMValue * val); 12 | bool ReadVMData(const F4SESerializationInterface* intfc, VMValue * val); 13 | }; 14 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformSerialization.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/Serialization.h" 4 | #include "f4se/PluginAPI.h" 5 | 6 | class GFxValue; 7 | 8 | namespace Serialization 9 | { 10 | template <> 11 | bool WriteData(const F4SESerializationInterface* intfc, const GFxValue* val); 12 | 13 | template <> 14 | bool ReadData(const F4SESerializationInterface* intfc, GFxValue* val); 15 | }; 16 | -------------------------------------------------------------------------------- /common/IPipeClient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common/IPipeServer.h" 4 | 5 | class IPipeClient 6 | { 7 | public: 8 | IPipeClient(); 9 | virtual ~IPipeClient(); 10 | 11 | bool Open(const char * name); 12 | void Close(void); 13 | 14 | bool ReadMessage(UInt8 * buf, UInt32 length); 15 | bool WriteMessage(IPipeServer::MessageHeader * msg); 16 | 17 | private: 18 | HANDLE m_pipe; 19 | std::string m_name; 20 | }; 21 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/ecdh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /sfe/f4se/GameForms.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameForms.h" 2 | #include "f4se/GameUtilities.h" 3 | 4 | RelocAddr <_LookupFormByID> LookupFormByID(0x00152C90); 5 | 6 | // 19AD05F2961D07B65E7987D210D6A47199FC0EFA+21 7 | RelocPtr g_formFactoryList(0x0590CC70); 8 | 9 | // 7156C2CD12E2BEAE5271E10ECFC738D8D24050B8+F1 10 | RelocPtr > g_modAttachmentMap(0x0371A148-0x08); 11 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusEventsDef.inl: -------------------------------------------------------------------------------- 1 | 2 | #define EVENT_OBJECT 1 3 | #define EVENT_NAME __MACRO_JOIN__(SendPapyrusEvent, NUM_PARAMS) 4 | #include "PapyrusEventsDef_Base.inl" 5 | #undef EVENT_NAME 6 | #undef EVENT_OBJECT 7 | 8 | #define EVENT_OBJECT 0 9 | #define EVENT_NAME __MACRO_JOIN__(CallGlobalFunctionNoWait, NUM_PARAMS) 10 | #include "PapyrusEventsDef_Base.inl" 11 | #undef EVENT_NAME 12 | #undef EVENT_OBJECT 13 | #undef NUM_PARAMS 14 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/ecdsa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /common/IPipeServer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class IPipeServer 4 | { 5 | public: 6 | struct MessageHeader 7 | { 8 | UInt32 type; 9 | UInt32 length; 10 | }; 11 | 12 | IPipeServer(); 13 | virtual ~IPipeServer(); 14 | 15 | bool Open(const char * name); 16 | void Close(void); 17 | 18 | bool WaitForClient(void); 19 | 20 | bool ReadMessage(UInt8 * buf, UInt32 length); 21 | bool WriteMessage(MessageHeader * msg); 22 | 23 | private: 24 | HANDLE m_pipe; 25 | }; 26 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/asn1_mac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #error "This file is obsolete; please update your software." 11 | -------------------------------------------------------------------------------- /common/IEvent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common/IInterlockedLong.h" 4 | 5 | class IEvent 6 | { 7 | public: 8 | static const UInt32 kDefaultTimeout = 1000 * 10; 9 | 10 | IEvent(); 11 | ~IEvent(); 12 | 13 | bool Block(void); 14 | bool UnBlock(void); 15 | bool Wait(UInt32 timeout = kDefaultTimeout); 16 | 17 | bool IsBlocked(void) { return blockCount.Get() > 0; } 18 | 19 | private: 20 | HANDLE theEvent; 21 | IInterlockedLong blockCount; 22 | }; 23 | -------------------------------------------------------------------------------- /sfe/f4se/NiCloningProcess.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/NiObjects.h" 4 | #include "f4se/NiTypes.h" 5 | 6 | // 68 7 | class NiCloningProcess 8 | { 9 | public: 10 | tHashSet unk00; // 00 11 | void * unk30; // 30 12 | UInt64 unk38; // 38 13 | UInt64 unk40; // 40 14 | void * unk48; // 48 - DEADBEEF 15 | void * unk50; // 50 - bucket 16 | UInt64 unk58; // 58 17 | UInt32 unk60; // 60 - copytype? 0, 1, 2 18 | UInt32 unk64; // 64 19 | }; 20 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusScaleformAdapter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class GFxValue; 4 | class VMValue; 5 | class GFxMovieRoot; 6 | class VirtualMachine; 7 | 8 | namespace PlatformAdapter 9 | { 10 | // Converts a Papyrus value to a Scaleform Value 11 | bool ConvertPapyrusValue(GFxValue * dest, VMValue * src, GFxMovieRoot * root); 12 | 13 | // Converts a Scaleform value to a Papyrus value 14 | bool ConvertScaleformValue(VMValue * dest, GFxValue * src, VirtualMachine * vm); 15 | }; 16 | -------------------------------------------------------------------------------- /sfe/f4se_loader/f4se_loader.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_PEM2_H 11 | # define HEADER_PEM2_H 12 | # include 13 | #endif 14 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusF4SE.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VirtualMachine; 4 | struct StaticFunctionTag; 5 | 6 | #include "f4se/GameTypes.h" 7 | 8 | namespace papyrusF4SE 9 | { 10 | void RegisterFuncs(VirtualMachine* vm); 11 | 12 | UInt32 GetVersion(StaticFunctionTag* base); 13 | UInt32 GetVersionMinor(StaticFunctionTag* base); 14 | UInt32 GetVersionBeta(StaticFunctionTag* base); 15 | UInt32 GetVersionRelease(StaticFunctionTag* base); 16 | UInt32 GetPluginVersion(StaticFunctionTag* base, BSFixedString name); 17 | } 18 | -------------------------------------------------------------------------------- /sfe/f4se_loader_common/f4se_loader_common.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /sfe/f4se_loader_common/LoaderError.cpp: -------------------------------------------------------------------------------- 1 | #include "LoaderError.h" 2 | #include 3 | 4 | void PrintLoaderError(const char * fmt, ...) 5 | { 6 | char buf[4096]; 7 | 8 | va_list args; 9 | 10 | va_start(args, fmt); 11 | gLog.Log(IDebugLog::kLevel_FatalError, fmt, args); 12 | va_end(args); 13 | 14 | va_start(args, fmt); 15 | vsprintf_s(buf, sizeof(buf), fmt, args); 16 | va_end(args); 17 | 18 | //MessageBox(NULL, buf, "F4SE Loader", MB_OK | MB_ICONEXCLAMATION); 19 | MessageBox(NULL, buf, "SFE", MB_OK | MB_ICONEXCLAMATION); 20 | } 21 | -------------------------------------------------------------------------------- /sfe/f4se/NiProperties.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/NiProperties.h" 2 | 3 | BSEffectShaderProperty * BSEffectShaderProperty::Create() 4 | { 5 | BSEffectShaderProperty * prop = (BSEffectShaderProperty *)Heap_Allocate(sizeof(BSEffectShaderProperty)); 6 | CALL_MEMBER_FN(prop, ctor)(); 7 | return prop; 8 | } 9 | 10 | BSLightingShaderProperty * BSLightingShaderProperty::Create() 11 | { 12 | BSLightingShaderProperty * prop = (BSLightingShaderProperty *)Heap_Allocate(sizeof(BSLightingShaderProperty)); 13 | CALL_MEMBER_FN(prop, ctor)(); 14 | return prop; 15 | } 16 | -------------------------------------------------------------------------------- /common/IReadWriteLock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common/ICriticalSection.h" 4 | #include "common/IEvent.h" 5 | #include "common/IInterlockedLong.h" 6 | 7 | class IReadWriteLock 8 | { 9 | public: 10 | IReadWriteLock(); 11 | ~IReadWriteLock(); 12 | 13 | void StartRead(void); 14 | void EndRead(void); 15 | void StartWrite(void); 16 | void EndWrite(void); 17 | 18 | private: 19 | IEvent readBlocker; 20 | IEvent writeBlocker; 21 | ICriticalSection enterBlocker; 22 | ICriticalSection writeMutex; 23 | IInterlockedLong readCount; 24 | }; 25 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusInterfaces.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusInterfaces.h" 2 | 3 | // 84C7A0FD630AF430626C929A1B9A7FC62FDC358A+1B1 4 | RelocPtr g_objectHandlePolicy(0x06755BC0); 5 | 6 | RelocAddr <_GetRefFromHandle> GetRefFromHandle(0x012C6470); 7 | 8 | RelocAddr <_GetVMPropertyInfo> GetVMPropertyInfo(0x02718920); 9 | 10 | void IComplexType::AddRef(void) 11 | { 12 | InterlockedIncrement(&m_refCount); 13 | } 14 | 15 | void IComplexType::Release(void) 16 | { 17 | if(!InterlockedDecrement(&m_refCount)) 18 | { 19 | delete this; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /common/ITextParser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common/IDataStream.h" 4 | 5 | class ITextParser 6 | { 7 | public: 8 | ITextParser(); 9 | ITextParser(IDataStream * stream); 10 | ~ITextParser(); 11 | 12 | void Attach(IDataStream * stream); 13 | IDataStream * GetStream(void) { return m_stream; } 14 | 15 | bool HitEOF(void) { return m_stream->HitEOF(); } 16 | 17 | void SkipWhitespace(void); 18 | void SkipLine(void); 19 | 20 | void ReadLine(char * out, UInt32 length); 21 | void ReadToken(char * out, UInt32 length); 22 | 23 | private: 24 | IDataStream * m_stream; 25 | }; 26 | -------------------------------------------------------------------------------- /common/IDirectoryIterator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class IDirectoryIterator 4 | { 5 | public: 6 | IDirectoryIterator(const char * path, const char * match = NULL); 7 | virtual ~IDirectoryIterator(); 8 | 9 | WIN32_FIND_DATA * Get(void) { return &m_result; } 10 | void GetFullPath(char * out, UInt32 outLen); 11 | std::string GetFullPath(void); 12 | 13 | void Next(void); 14 | bool Done(void); 15 | 16 | private: 17 | IDirectoryIterator(); // undefined, disallow 18 | 19 | HANDLE m_searchHandle; 20 | WIN32_FIND_DATA m_result; 21 | bool m_done; 22 | 23 | char m_path[MAX_PATH]; 24 | }; 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sfe 2 | SFE is a project wholly based on F4SE, which can be found at https://f4se.silverlock.org/. 3 | The purpose of SFE is to enable F4SE's Scaleform hook functionality to extend mod features in Fallout 76, currently to be used in Text Chat, Perk Loadout Manager, and Save Everything. 4 | This is NOT in any way a replacement for F4SE. 5 | 6 | Acknowledgments: 7 | - The F4SE team for making this possible and permitting its use in the project. 8 | - Reg2k for his very helpful DXGI shim (https://github.com/reg2k). 9 | 10 | TODO: 11 | - Clean up all unused code that is not Scaleform-specific. 12 | -------------------------------------------------------------------------------- /common/IConsole.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common/ITypes.h" 4 | #include "common/ISingleton.h" 5 | #include 6 | 7 | /** 8 | * Wrapper class for a standard Windows console 9 | * 10 | * @todo make nonblocking 11 | */ 12 | class IConsole : public ISingleton 13 | { 14 | public: 15 | IConsole(); 16 | ~IConsole(); 17 | 18 | void Write(char * buf); 19 | void Write(char * buf, UInt32 bufLen, const char * fmt, ...); 20 | 21 | char ReadChar(void); 22 | UInt32 ReadBuf(char * buf, UInt32 len); 23 | 24 | private: 25 | HANDLE inputHandle, outputHandle; 26 | }; 27 | -------------------------------------------------------------------------------- /sfe/f4se/NiRTTI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se_common/Relocation.h" 4 | 5 | class NiObject; 6 | 7 | // 10 8 | class NiRTTI 9 | { 10 | public: 11 | const char * name; 12 | NiRTTI * parent; 13 | }; 14 | 15 | NiObject * DoNiRTTICast(NiObject * src, const NiRTTI * typeInfo); 16 | 17 | #define ni_cast(obj, type) (type *)DoNiRTTICast(obj, NiRTTI_##type) 18 | 19 | extern const RelocPtr NiRTTI_BSLightingShaderProperty; 20 | extern const RelocPtr NiRTTI_BSEffectShaderProperty; 21 | extern const RelocPtr NiRTTI_BSShaderProperty; 22 | extern const RelocPtr NIRTTI_NiExtraData; 23 | -------------------------------------------------------------------------------- /sfe/f4se_common/SafeWrite.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void SafeWriteBuf(uintptr_t addr, void * data, size_t len); 4 | void SafeWrite8(uintptr_t addr, UInt8 data); 5 | void SafeWrite16(uintptr_t addr, UInt16 data); 6 | void SafeWrite32(uintptr_t addr, UInt32 data); 7 | void SafeWrite64(uintptr_t addr, UInt64 data); 8 | 9 | // ### warning: if you try to branch more than +/- 2GB with these, they will fail and return false 10 | // ### this is a limitation of the 'jmp' instruction and more generally the x64 ISA 11 | // 5 bytes written to src 12 | bool SafeWriteJump(uintptr_t src, uintptr_t dst); 13 | bool SafeWriteCall(uintptr_t src, uintptr_t dst); 14 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/__DECC_INCLUDE_EPILOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* restore state. Must correspond to the save in __decc_include_prologue.h */ 16 | #pragma names restore 17 | -------------------------------------------------------------------------------- /sfe/f4se/GameFormComponents.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameFormComponents.h" 2 | #include "f4se/GameForms.h" 3 | 4 | RelocAddr <_EvaluationConditions> EvaluationConditions(0x0072AE60); 5 | 6 | #ifdef _DEBUG 7 | #include "f4se/GameExtraData.h" 8 | 9 | void BGSInventoryItem::Dump() 10 | { 11 | _MESSAGE("%016I64X %s", form->formID, GetObjectClassName(form)); 12 | gLog.Indent(); 13 | stack->Dump(); 14 | gLog.Outdent(); 15 | } 16 | 17 | void BGSInventoryItem::Stack::Dump() 18 | { 19 | _MESSAGE("Count: %d", count); 20 | if(extraData) 21 | extraData->Dump(); 22 | 23 | if(next) { 24 | gLog.Indent(); 25 | next->Dump(); 26 | gLog.Outdent(); 27 | } 28 | 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusNativeFunctionDef.inl: -------------------------------------------------------------------------------- 1 | // Native 2 | 3 | #define CLASS_NAME __MACRO_JOIN__(NativeFunction, NUM_PARAMS) 4 | 5 | #define VOID_SPEC 0 6 | #include "PapyrusNativeFunctionDef_Base.inl" 7 | 8 | #define VOID_SPEC 1 9 | #include "PapyrusNativeFunctionDef_Base.inl" 10 | 11 | #undef CLASS_NAME 12 | 13 | // Latent native 14 | 15 | #define CLASS_NAME __MACRO_JOIN__(LatentNativeFunction, NUM_PARAMS) 16 | #define LATENT_SPEC 1 17 | 18 | #define VOID_SPEC 0 19 | #include "PapyrusNativeFunctionDef_Base.inl" 20 | 21 | #define VOID_SPEC 1 22 | #include "PapyrusNativeFunctionDef_Base.inl" 23 | 24 | #undef LATENT_SPEC 25 | #undef CLASS_NAME 26 | 27 | #undef NUM_PARAMS 28 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/ssl2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SSL2_H 11 | # define HEADER_SSL2_H 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | # define SSL2_VERSION 0x0002 18 | 19 | # define SSL2_MT_CLIENT_HELLO 1 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusStruct.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusStruct.h" 2 | 3 | bool CreateStruct(VMValue * dst, BSFixedString * structName, VirtualMachine * vm, bool bNone) 4 | { 5 | dst->SetNone(); 6 | 7 | VMValue::StructData * structData = nullptr; 8 | VMStructTypeInfo * typeInfo = nullptr; 9 | if(vm->GetStructTypeInfo(structName, &typeInfo)) { 10 | dst->type.id = typeInfo; // Always set the type info if its valid 11 | if(!bNone) { 12 | vm->CreateStruct(structName, &structData); 13 | if(structData) { 14 | dst->data.strct = structData; 15 | } 16 | } 17 | 18 | typeInfo->Release(); 19 | return structData ? true : false; 20 | } 21 | 22 | return false; 23 | } 24 | -------------------------------------------------------------------------------- /common/IInterlockedLong.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct IInterlockedLong 4 | { 5 | public: 6 | long Increment(void) { return InterlockedIncrement(&value); } 7 | long Decrement(void) { return InterlockedDecrement(&value); } 8 | long Get(void) { return value; } 9 | long Set(long in) { return InterlockedExchange(&value, in); } 10 | long TrySetIf(long newValue, long expectedOldValue) 11 | { return InterlockedCompareExchange(&value, newValue, expectedOldValue); } 12 | 13 | // interlock variable semantics 14 | bool Claim(void) { return TrySetIf(1, 0) == 0; } 15 | bool Release(void) { return TrySetIf(0, 1) == 1; } 16 | 17 | private: 18 | volatile long value; 19 | }; 20 | -------------------------------------------------------------------------------- /sfe/f4se_loader/Options.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class Options 4 | { 5 | public: 6 | Options(); 7 | ~Options(); 8 | 9 | bool Read(int argc, char ** argv); 10 | 11 | void PrintUsage(void); 12 | 13 | bool m_launchCS; 14 | 15 | bool m_setPriority; 16 | DWORD m_priority; 17 | 18 | bool m_optionsOnly; 19 | bool m_crcOnly; 20 | bool m_waitForClose; 21 | bool m_verbose; 22 | bool m_moduleInfo; 23 | bool m_skipLauncher; 24 | bool m_launchSteam; 25 | bool m_noTimeout; 26 | bool m_forceSteamLoader; 27 | 28 | UInt64 m_affinity; 29 | 30 | std::string m_altEXE; 31 | std::string m_altDLL; 32 | 33 | private: 34 | bool Verify(void); 35 | }; 36 | 37 | extern Options g_options; 38 | -------------------------------------------------------------------------------- /sfe/f4se/GameWorkshop.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameWorkshop.h" 2 | 3 | RelocAddr <_LinkPower> LinkPower_Internal(0x001F6D70); // Power related natives 4 | RelocAddr <_LinkPower2> LinkPower2_Internal(0x00201A60); // Usually paired with LinkPower 5 | RelocAddr <_GetObjectAtConnectPoint> GetObjectAtConnectPoint(0x001FF2B0); // Acquires objects that are touching attach points 6 | RelocAddr <_LinkPower3> LinkPower3_Internal(0x001F67E0); // Wire related calls 7 | RelocAddr <_LinkPower4> LinkPower4_Internal(0x00204560); 8 | RelocAddr <_SetWireEndpoints> SetWireEndpoints_Internal(0x00200DA0); 9 | RelocAddr <_FinalizeWireLink> FinalizeWireLink(0x00200AA0); 10 | RelocAddr <_ScrapReference> ScrapReference(0x002083D0); 11 | -------------------------------------------------------------------------------- /sfe/f4se_common/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by f4se_version.rc 4 | // 5 | #define F4SE_VERSION_INTEGER 0 6 | #define F4SE_TARGETING_BETA_VERSION 0 7 | #define F4SE_VERSION_INTEGER_MINOR 0 8 | #define F4SE_VERSION_INTEGER_BETA 1 9 | #define F4SE_VERSION_RELEASEIDX 1 10 | 11 | // Next default values for new objects 12 | // 13 | #ifdef APSTUDIO_INVOKED 14 | #ifndef APSTUDIO_READONLY_SYMBOLS 15 | #define _APS_NEXT_RESOURCE_VALUE 101 16 | #define _APS_NEXT_COMMAND_VALUE 40001 17 | #define _APS_NEXT_CONTROL_VALUE 1000 18 | #define _APS_NEXT_SYMED_VALUE 101 19 | #endif 20 | #endif 21 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusUtilities.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusUtilities.h" 2 | #include "f4se/PapyrusVM.h" 3 | 4 | UInt64 PapyrusVM::GetHandleFromObject(void * src, UInt32 typeID) 5 | { 6 | VirtualMachine * registry = (*g_gameVM)->m_virtualMachine; 7 | IObjectHandlePolicy * policy = registry->GetHandlePolicy(); 8 | 9 | return policy->Create(typeID, (void*)src); 10 | } 11 | 12 | void * PapyrusVM::GetObjectFromHandle(UInt64 handle, UInt32 typeID) 13 | { 14 | VirtualMachine * registry = (*g_gameVM)->m_virtualMachine; 15 | IObjectHandlePolicy * policy = registry->GetHandlePolicy(); 16 | 17 | if(handle == policy->GetInvalidHandle()) { 18 | return NULL; 19 | } 20 | 21 | return policy->Resolve(typeID, handle); 22 | } 23 | -------------------------------------------------------------------------------- /common/IMutex.cpp: -------------------------------------------------------------------------------- 1 | #include "IMutex.h" 2 | 3 | IMutex::IMutex() 4 | { 5 | theMutex = CreateMutex(NULL, true, NULL); 6 | } 7 | 8 | IMutex::~IMutex() 9 | { 10 | CloseHandle(theMutex); 11 | } 12 | 13 | bool IMutex::Wait(UInt32 timeout) 14 | { 15 | switch(WaitForSingleObject(theMutex, timeout)) 16 | { 17 | case WAIT_ABANDONED: 18 | HALT("IMutex::Wait: got abandoned mutex"); 19 | return false; 20 | 21 | case WAIT_OBJECT_0: 22 | return true; 23 | 24 | default: 25 | case WAIT_TIMEOUT: 26 | gLog.FormattedMessage("IMutex::Wait: timeout"); 27 | return false; 28 | } 29 | } 30 | 31 | void IMutex::Release(void) 32 | { 33 | ASSERT_STR(ReleaseMutex(theMutex), "IMutex::Release: failed to release mutex"); 34 | } 35 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/__DECC_INCLUDE_PROLOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* save state */ 16 | #pragma names save 17 | /* have the compiler shorten symbols larger than 31 chars to 23 chars 18 | * followed by a 8 hex char CRC 19 | */ 20 | #pragma names as_is,shortened 21 | -------------------------------------------------------------------------------- /sfe/f4se_common/f4se_common.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /sfe/f4se/BSGraphics.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/BSGraphics.h" 2 | 3 | // 2CA5233612B3158658DB6DB9C90FD0258F1836E2+124 4 | RelocPtr g_renderer(0x06759728); 5 | 6 | // 6BF9214E9DC5338FC817F85B0716990E5CA7C862+31 7 | RelocPtr g_renderManager(0x06219900); 8 | 9 | // FA43F2F87927D8F20B17E756782BC91BB6BD04C2+3B 10 | RelocPtr g_renderTargetManager(0x03887D30); 11 | 12 | // 4A4A200E8F9173F8CE99D39E27F4BDAF680DF52B+9C 13 | RelocPtr g_shaderResourceManager(0x05C41F08); 14 | 15 | // 84E19996C30AD51CE0D4AEF3E6ED8FFFF4AE4BD7+18 16 | RelocPtr g_D3D11Device(0x060D4F88); 17 | 18 | // BFDAF477B684098E9F394A636CCDC1BBD06EDEBF+25 19 | RelocPtr g_D3D11DeviceContext(0x06216C60); 20 | -------------------------------------------------------------------------------- /sfe/f4se/NiRTTI.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/NiRTTI.h" 2 | #include "f4se/NiObjects.h" 3 | 4 | NiObject * DoNiRTTICast(NiObject * src, const NiRTTI * typeInfo) 5 | { 6 | if(src) 7 | for(NiRTTI * iter = src->GetRTTI(); iter; iter = iter->parent) 8 | if(iter == typeInfo) 9 | return src; 10 | 11 | return nullptr; 12 | } 13 | 14 | // E8007B50AB42A5298C03123C69989D33E62E5595+3D 15 | const RelocPtr NiRTTI_BSLightingShaderProperty(0x06758F48); 16 | 17 | // E8007B50AB42A5298C03123C69989D33E62E5595+79 18 | const RelocPtr NiRTTI_BSEffectShaderProperty(0x06758F38); 19 | 20 | const RelocPtr NiRTTI_BSShaderProperty(0x06758ED0); // xref aBsshaderproper, loaded to ecx 21 | 22 | const RelocPtr NiRTTI_NiExtraData(0x05C41E90); // xref aNiextradata, loaded to ecx 23 | -------------------------------------------------------------------------------- /sfe/f4se/GameRTTI.cpp: -------------------------------------------------------------------------------- 1 | #include "GameRTTI.h" 2 | #include "f4se_common/Relocation.h" 3 | 4 | typedef void * (* _Runtime_DynamicCast_Internal)(void * srcObj, UInt32 arg1, const void * fromType, const void * toType, UInt32 arg4); 5 | 6 | // 11BCFFABF53E33EAC4BAE470FD237D36B63F868A+ED 7 | RelocAddr <_Runtime_DynamicCast_Internal> Runtime_DynamicCast_Internal(0x0295BC2A); // __RTDynamicCast 8 | 9 | void * Runtime_DynamicCast(void * srcObj, const void * fromType, const void * toType) 10 | { 11 | uintptr_t fromTypeAddr = uintptr_t(fromType) + RelocationManager::s_baseAddr; 12 | uintptr_t toTypeAddr = uintptr_t(toType) + RelocationManager::s_baseAddr; 13 | 14 | return Runtime_DynamicCast_Internal(srcObj, 0, (void *)fromTypeAddr, (void *)toTypeAddr, 0); 15 | } 16 | 17 | #include "GameRTTI.inl" 18 | -------------------------------------------------------------------------------- /common/IThread.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // TODO: I really don't like the interface for this 4 | 5 | class IThread 6 | { 7 | public: 8 | typedef void (* MainProcPtr)(void * param); 9 | 10 | IThread(); 11 | ~IThread(); 12 | 13 | void Start(MainProcPtr proc, void * procParam = NULL); 14 | void Stop(void); 15 | void ForceStop(void); 16 | 17 | bool IsRunning(void) { return isRunning; } 18 | bool StopRequested(void) { return stopRequested; } 19 | 20 | HANDLE GetHandle(void) { return theThread; } 21 | 22 | protected: 23 | MainProcPtr mainProc; 24 | void * mainProcParam; 25 | volatile bool stopRequested; 26 | bool isRunning; 27 | HANDLE theThread; 28 | UInt32 threadID; 29 | 30 | private: 31 | static UInt32 WINAPI _ThreadProc(void * param); 32 | }; 33 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformAPI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se_common/Relocation.h" 4 | 5 | class ScaleformHeap 6 | { 7 | public: 8 | virtual void Fn_00(void); 9 | virtual void Fn_01(void); 10 | virtual void Fn_02(void); 11 | virtual void Fn_03(void); 12 | virtual void Fn_04(void); 13 | virtual void Fn_05(void); 14 | virtual void Fn_06(void); 15 | virtual void Fn_07(void); 16 | virtual void Fn_08(void); 17 | virtual void Fn_09(void); 18 | virtual void * Allocate(size_t size, UInt32 unk = 0); // unk is probably align, maybe flags (haven't traced) 19 | virtual void Fn_0B(void); 20 | virtual void Free(void * ptr); 21 | }; 22 | 23 | extern RelocPtr g_scaleformHeap; 24 | 25 | extern void * ScaleformHeap_Allocate(UInt32 size); 26 | extern void ScaleformHeap_Free(void * ptr); 27 | -------------------------------------------------------------------------------- /common/ITimer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common/ITypes.h" 4 | 5 | /** 6 | * A high-resolution timer. 7 | */ 8 | class ITimer 9 | { 10 | public: 11 | ITimer(); 12 | ~ITimer(); 13 | 14 | static void Init(void); 15 | static void DeInit(void); 16 | 17 | void Start(void); 18 | 19 | double GetElapsedTime(void); // seconds 20 | 21 | private: 22 | UInt64 m_qpcBase; // QPC 23 | UInt32 m_tickBase; // timeGetTime 24 | 25 | static double s_secondsPerCount; 26 | static TIMECAPS s_timecaps; 27 | static bool s_setTime; 28 | 29 | // safe QPC stuff 30 | static UInt64 GetQPC(void); 31 | 32 | static UInt64 s_lastQPC; 33 | static UInt64 s_qpcWrapMargin; 34 | static bool s_hasLastQPC; 35 | 36 | static UInt32 s_qpcWrapCount; 37 | static UInt32 s_qpcInaccurateCount; 38 | }; 39 | -------------------------------------------------------------------------------- /common/IPrefix.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 4018 - signed/unsigned mismatch 4 | // 4200 - zero-sized array 5 | // 4244 - loss of data by assignment 6 | // 4267 - possible loss of data (truncation) 7 | // 4305 - truncation by assignment 8 | // 4288 - disable warning for crap microsoft extension screwing up the scope of variables defined in for loops 9 | // 4311 - pointer truncation 10 | // 4312 - pointer extension 11 | #pragma warning(disable: 4018 4200 4244 4267 4305 4288 4312 4311) 12 | 13 | // winxp and above 14 | #define _WIN32_WINNT 0x0501 15 | 16 | #include 17 | #include 18 | #include 19 | #include "common/ITypes.h" 20 | #include "common/IErrors.h" 21 | #include "common/IDynamicCreate.h" 22 | #include "common/IDebugLog.h" 23 | #include "common/ISingleton.h" 24 | #include 25 | #include 26 | -------------------------------------------------------------------------------- /common/ICriticalSection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class ICriticalSection 4 | { 5 | public: 6 | ICriticalSection() { InitializeCriticalSection(&critSection); } 7 | ~ICriticalSection() { DeleteCriticalSection(&critSection); } 8 | 9 | void Enter(void) { EnterCriticalSection(&critSection); } 10 | void Leave(void) { LeaveCriticalSection(&critSection); } 11 | bool TryEnter(void) { return TryEnterCriticalSection(&critSection) != 0; } 12 | 13 | private: 14 | CRITICAL_SECTION critSection; 15 | }; 16 | 17 | class IScopedCriticalSection 18 | { 19 | public: 20 | IScopedCriticalSection(ICriticalSection * cs) 21 | :m_cs(cs) 22 | { 23 | m_cs->Enter(); 24 | } 25 | 26 | ~IScopedCriticalSection() 27 | { 28 | m_cs->Leave(); 29 | } 30 | 31 | private: 32 | IScopedCriticalSection(); // undefined 33 | 34 | ICriticalSection * m_cs; 35 | }; 36 | -------------------------------------------------------------------------------- /sfe/f4se/CustomMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/GameMenus.h" 4 | #include 5 | #include 6 | 7 | struct CustomMenuData 8 | { 9 | BSFixedString menuPath; 10 | BSFixedString rootPath; 11 | UInt32 menuFlags; 12 | UInt32 movieFlags; 13 | UInt32 extFlags; 14 | UInt32 depth; 15 | 16 | enum ExtendedFlags 17 | { 18 | kExtFlag_InheritColors = 1, 19 | kExtFlag_CheckForGamepad = 2 20 | }; 21 | }; 22 | 23 | extern BSReadWriteLock g_customMenuLock; 24 | extern std::unordered_map g_customMenuData; 25 | 26 | class CustomMenu : public GameMenuBase 27 | { 28 | public: 29 | CustomMenu(); 30 | 31 | virtual void RegisterFunctions() override; 32 | virtual void Invoke(Args * args) override final; 33 | }; 34 | 35 | void LoadCustomMenu_Hook(IMenu * menu); 36 | IMenu * CreateCustomMenu(); -------------------------------------------------------------------------------- /sfe/f4se/GameAPI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se_common/Utilities.h" 4 | 5 | class Heap 6 | { 7 | public: 8 | MEMBER_FN_PREFIX(Heap); 9 | DEFINE_MEMBER_FN(Allocate, void *, 0x01B0EEB0, size_t size, size_t alignment, bool aligned); 10 | DEFINE_MEMBER_FN(Free, void, 0x01B0F1C0, void * buf, bool aligned); 11 | }; 12 | 13 | extern RelocPtr g_mainHeap; 14 | 15 | void * Heap_Allocate(size_t size); 16 | void Heap_Free(void * ptr); 17 | 18 | class ConsoleManager 19 | { 20 | public: 21 | MEMBER_FN_PREFIX(ConsoleManager); 22 | DEFINE_MEMBER_FN(VPrint, void, 0x01262DA0, const char * fmt, va_list args); 23 | DEFINE_MEMBER_FN(Print, void, 0x01262E30, const char * str); 24 | }; 25 | 26 | extern RelocPtr g_console; 27 | extern RelocAddr g_consoleHandle; 28 | 29 | void Console_Print(const char * fmt, ...); 30 | 31 | LONGLONG GetPerfCounter(void); 32 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusArmor.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusVM.h" 2 | #include "f4se/PapyrusNativeFunctions.h" 3 | 4 | #include "f4se/GameObjects.h" 5 | #include "f4se/PapyrusArmor.h" 6 | 7 | namespace papyrusArmor 8 | { 9 | VMArray GetArmorAddons(TESObjectARMO* thisArmor) 10 | { 11 | VMArray results; 12 | if(!thisArmor) 13 | return results; 14 | 15 | for(UInt32 i = 0; i < thisArmor->addons.count; ++i) 16 | { 17 | TESObjectARMO::ArmorAddons addon; 18 | if(thisArmor->addons.GetNthItem(i, addon)) 19 | results.Push(&addon.armorAddon); 20 | } 21 | 22 | return results; 23 | } 24 | } 25 | 26 | void papyrusArmor::RegisterFuncs(VirtualMachine* vm) 27 | { 28 | // Armor Addons 29 | vm->RegisterFunction( 30 | new NativeFunction0 >("GetArmorAddons", "Armor", papyrusArmor::GetArmorAddons, vm)); 31 | } 32 | -------------------------------------------------------------------------------- /common/IReadWriteLock.cpp: -------------------------------------------------------------------------------- 1 | #include "IReadWriteLock.h" 2 | 3 | IReadWriteLock::IReadWriteLock() 4 | { 5 | readCount.Set(0); 6 | readBlocker.UnBlock(); 7 | writeBlocker.UnBlock(); 8 | } 9 | 10 | IReadWriteLock::~IReadWriteLock() 11 | { 12 | // 13 | } 14 | 15 | void IReadWriteLock::StartRead(void) 16 | { 17 | enterBlocker.Enter(); 18 | readBlocker.Wait(); 19 | if(readCount.Increment() == 1) 20 | writeBlocker.Block(); 21 | enterBlocker.Leave(); 22 | } 23 | 24 | void IReadWriteLock::EndRead(void) 25 | { 26 | if(!readCount.Decrement()) 27 | writeBlocker.UnBlock(); 28 | } 29 | 30 | void IReadWriteLock::StartWrite(void) 31 | { 32 | writeMutex.Enter(); 33 | enterBlocker.Enter(); 34 | readBlocker.Block(); 35 | writeBlocker.Wait(); 36 | enterBlocker.Leave(); 37 | } 38 | 39 | void IReadWriteLock::EndWrite(void) 40 | { 41 | readBlocker.UnBlock(); 42 | writeMutex.Leave(); 43 | } 44 | -------------------------------------------------------------------------------- /common/IBufferStream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common/IDataStream.h" 4 | 5 | class IBufferStream : public IDataStream 6 | { 7 | public: 8 | IBufferStream(); 9 | IBufferStream(const IBufferStream & rhs); 10 | IBufferStream(void * buf, UInt64 inLength); 11 | virtual ~IBufferStream(); 12 | 13 | IBufferStream & operator=(IBufferStream & rhs); 14 | 15 | void SetBuffer(void * buf, UInt64 inLength); 16 | void * GetBuffer(void) { return streamBuf; } 17 | 18 | void OwnBuffer(void) { flags |= kFlag_OwnedBuf; } 19 | void DisownBuffer(void) { flags &= ~kFlag_OwnedBuf; } 20 | 21 | // read 22 | virtual void ReadBuf(void * buf, UInt32 inLength); 23 | 24 | // write 25 | virtual void WriteBuf(const void * buf, UInt32 inLength); 26 | 27 | protected: 28 | UInt8 * streamBuf; 29 | UInt32 flags; 30 | 31 | enum 32 | { 33 | kFlag_OwnedBuf = 1 << 0 34 | }; 35 | }; 36 | -------------------------------------------------------------------------------- /common/IMemPool.cpp: -------------------------------------------------------------------------------- 1 | #include "IMemPool.h" 2 | 3 | void Test_IMemPool(void) 4 | { 5 | IMemPool pool; 6 | 7 | _DMESSAGE("main: pool test"); 8 | gLog.Indent(); 9 | 10 | _DMESSAGE("start"); 11 | pool.Dump(); 12 | 13 | UInt32 * data0, * data1, * data2; 14 | 15 | data0 = pool.Allocate(); 16 | _DMESSAGE("alloc0 = %08X", data0); 17 | pool.Dump(); 18 | 19 | data1 = pool.Allocate(); 20 | _DMESSAGE("alloc1 = %08X", data1); 21 | pool.Dump(); 22 | 23 | data2 = pool.Allocate(); 24 | _DMESSAGE("alloc2 = %08X", data2); 25 | pool.Dump(); 26 | 27 | _DMESSAGE("free0 %08X", data0); 28 | pool.Free(data0); 29 | pool.Dump(); 30 | 31 | data0 = pool.Allocate(); 32 | _DMESSAGE("alloc0 = %08X", data0); 33 | pool.Dump(); 34 | 35 | _DMESSAGE("free2 %08X", data2); 36 | pool.Free(data2); 37 | pool.Dump(); 38 | 39 | _DMESSAGE("done"); 40 | pool.Dump(); 41 | 42 | gLog.Outdent(); 43 | } 44 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/buffererr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_BUFERR_H 12 | # define HEADER_BUFERR_H 13 | 14 | # ifdef __cplusplus 15 | extern "C" 16 | # endif 17 | int ERR_load_BUF_strings(void); 18 | 19 | /* 20 | * BUF function codes. 21 | */ 22 | # define BUF_F_BUF_MEM_GROW 100 23 | # define BUF_F_BUF_MEM_GROW_CLEAN 105 24 | # define BUF_F_BUF_MEM_NEW 101 25 | 26 | /* 27 | * BUF reason codes. 28 | */ 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /common/IDynamicCreate.cpp: -------------------------------------------------------------------------------- 1 | #include "IDynamicCreate.h" 2 | 3 | #if ENABLE_IDYNAMICCREATE 4 | 5 | IClassRegistry _gClassRegistry; 6 | 7 | IClassRegistry::IClassRegistry() 8 | { 9 | // 10 | } 11 | 12 | IClassRegistry::~IClassRegistry() 13 | { 14 | // 15 | } 16 | 17 | void IClassRegistry::RegisterClassInfo(UInt32 id, IDynamicType * typeInfo) 18 | { 19 | theClassRegistry[id] = typeInfo; 20 | } 21 | 22 | IDynamicType * IClassRegistry::LookupClassInfo(UInt32 id) 23 | { 24 | ClassRegistryType::iterator iter = theClassRegistry.find(id); 25 | 26 | return (iter == theClassRegistry.end()) ? NULL : (*iter).second; 27 | } 28 | 29 | IDynamicType * IClassRegistry::LookupClassInfo(char * name) 30 | { 31 | for(ClassRegistryType::iterator iter = theClassRegistry.begin(); iter != theClassRegistry.end(); iter++) 32 | if(!strcmp((*iter).second->GetName(), name)) 33 | return (*iter).second; 34 | 35 | return NULL; 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusEquipSlot.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusEquipSlot.h" 2 | 3 | #include "f4se/GameForms.h" 4 | #include "f4se/PapyrusArgs.h" 5 | 6 | namespace papyrusEquipSlot 7 | { 8 | VMArray GetParents(BGSEquipSlot* equipSlot) 9 | { 10 | VMArray results; 11 | if(equipSlot) 12 | { 13 | for(UInt32 i = 0; i < equipSlot->parentSlots.count; i++) 14 | { 15 | BGSEquipSlot * slot = nullptr; 16 | equipSlot->parentSlots.GetNthItem(i, slot); 17 | results.Push(&slot); 18 | } 19 | } 20 | 21 | return results; 22 | } 23 | } 24 | 25 | #include "f4se/PapyrusVM.h" 26 | #include "f4se/PapyrusNativeFunctions.h" 27 | 28 | void papyrusEquipSlot::RegisterFuncs(VirtualMachine* vm) 29 | { 30 | vm->RegisterForm(BGSEquipSlot::kTypeID, "EquipSlot"); 31 | 32 | vm->RegisterFunction( 33 | new NativeFunction0 >("GetParents", "EquipSlot", papyrusEquipSlot::GetParents, vm)); 34 | } 35 | -------------------------------------------------------------------------------- /common/IEvent.cpp: -------------------------------------------------------------------------------- 1 | #include "IEvent.h" 2 | 3 | IEvent::IEvent() 4 | { 5 | theEvent = CreateEvent(NULL, true, true, NULL); 6 | ASSERT(theEvent); 7 | 8 | blockCount.Set(0); 9 | } 10 | 11 | IEvent::~IEvent() 12 | { 13 | CloseHandle(theEvent); 14 | } 15 | 16 | bool IEvent::Block(void) 17 | { 18 | if(blockCount.Increment() == 1) 19 | return (ResetEvent(theEvent) != 0); 20 | else 21 | return true; 22 | } 23 | 24 | bool IEvent::UnBlock(void) 25 | { 26 | if(blockCount.Decrement() == 0) 27 | return (SetEvent(theEvent) != 0); 28 | else 29 | return true; 30 | } 31 | 32 | bool IEvent::Wait(UInt32 timeout) 33 | { 34 | switch(WaitForSingleObject(theEvent, timeout)) 35 | { 36 | case WAIT_ABANDONED: 37 | HALT("IEvent::Wait: got abandoned event"); 38 | return false; 39 | 40 | case WAIT_OBJECT_0: 41 | return true; 42 | 43 | default: 44 | case WAIT_TIMEOUT: 45 | gLog.FormattedMessage("IEvent::Wait: timeout"); 46 | return false; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /common/IFIFO.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class IFIFO 4 | { 5 | public: 6 | IFIFO(UInt32 length = 0); 7 | virtual ~IFIFO(); 8 | 9 | virtual bool Push(UInt8 * buf, UInt32 length); 10 | virtual bool Pop(UInt8 * buf, UInt32 length); 11 | virtual bool Peek(UInt8 * buf, UInt32 length); 12 | virtual void Clear(void); 13 | 14 | UInt32 GetBufferSize(void) { return fifoBufSize; } 15 | UInt32 GetBufferRemain(void) { return fifoBufSize - fifoDataLength; } 16 | UInt32 GetDataLength(void) { return fifoDataLength; } 17 | 18 | private: 19 | UInt32 ToRawOffset(UInt32 in) { return in % fifoBufSize; } 20 | UInt32 ToDataOffset(UInt32 in) { return ToRawOffset(fifoBase + in); } 21 | UInt32 GetWriteOffset(void) { return ToDataOffset(fifoDataLength); } 22 | 23 | UInt8 * fifoBuf; 24 | UInt32 fifoBufSize; // size of the buffer (in bytes) 25 | UInt32 fifoBase; // pointer to the beginning of the data block 26 | UInt32 fifoDataLength; // size of the data block 27 | }; 28 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusArmorAddon.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusVM.h" 2 | #include "f4se/PapyrusNativeFunctions.h" 3 | #include "f4se/PapyrusArmorAddon.h" 4 | 5 | #include "f4se/GameObjects.h" 6 | 7 | namespace papyrusArmorAddon 8 | { 9 | VMArray GetAdditionalRaces(TESObjectARMA* thisArmorAddon) 10 | { 11 | VMArray results; 12 | if(!thisArmorAddon) 13 | return results; 14 | 15 | for(UInt32 i = 0; i < thisArmorAddon->additionalRaces.count; ++i) 16 | { 17 | TESRace * race = nullptr; 18 | if(thisArmorAddon->additionalRaces.GetNthItem(i, race)) 19 | results.Push(&race); 20 | } 21 | 22 | return results; 23 | } 24 | } 25 | 26 | void papyrusArmorAddon::RegisterFuncs(VirtualMachine* vm) 27 | { 28 | vm->RegisterForm(TESObjectARMA::kTypeID, "ArmorAddon"); 29 | 30 | // Races 31 | vm->RegisterFunction( 32 | new NativeFunction0 >("GetAdditionalRaces", "ArmorAddon", papyrusArmorAddon::GetAdditionalRaces, vm)); 33 | } 34 | -------------------------------------------------------------------------------- /sfe/f4se/GameAPI.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameAPI.h" 2 | 3 | // B53CEF7AA7FC153E48CDE9DBD36CD8242577E27F+11D 4 | RelocPtr g_mainHeap(0x03905A00); 5 | 6 | void * Heap_Allocate(size_t size) 7 | { 8 | return CALL_MEMBER_FN(g_mainHeap, Allocate)(size, 0, false); 9 | } 10 | 11 | void Heap_Free(void * ptr) 12 | { 13 | CALL_MEMBER_FN(g_mainHeap, Free)(ptr, false); 14 | } 15 | 16 | // CF40EA3DCB94FC3927A17CCA60198108D4742CA7+68 17 | RelocPtr g_console(0x05919B30); 18 | 19 | // 1C0F98B1DC3F82F9BD55E938765C22AD25B75571+15 20 | RelocAddr g_consoleHandle(0x05B144A8); 21 | 22 | void Console_Print(const char * fmt, ...) 23 | { 24 | ConsoleManager * mgr = *g_console; 25 | if(mgr) 26 | { 27 | va_list args; 28 | va_start(args, fmt); 29 | 30 | CALL_MEMBER_FN(mgr, VPrint)(fmt, args); 31 | 32 | va_end(args); 33 | } 34 | } 35 | 36 | LONGLONG GetPerfCounter(void) 37 | { 38 | LARGE_INTEGER li; 39 | QueryPerformanceCounter(&li); 40 | return li.QuadPart; 41 | } 42 | -------------------------------------------------------------------------------- /sfe/f4se/GameThreads.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class ITaskDelegate 4 | { 5 | public: 6 | virtual ~ITaskDelegate() { } 7 | 8 | virtual void Run() = 0; 9 | }; 10 | 11 | // 50 12 | class BSThread 13 | { 14 | public: 15 | virtual ~BSThread(); 16 | 17 | virtual UInt64 Run() 18 | { 19 | return 0; 20 | } 21 | 22 | CRITICAL_SECTION cs; // 08 23 | /* 24 | LONG LockCount; // 08 25 | LONG RecursionCount; // 0C 26 | HANDLE OwningThread; // 10 27 | HANDLE LockSemaphore; // 18 28 | ULONG_PTR SpinCount; // 20 29 | */ 30 | UInt64 unk28; // 28 31 | HANDLE handle; // 30 32 | UInt64 unk38; // 38 33 | UInt64 unk40; // 40 34 | UInt8 unk48; // 48 35 | UInt8 unk49[7]; // 49 36 | }; 37 | 38 | class VMInitThread : public BSThread 39 | { 40 | public: 41 | virtual UInt64 Run(); 42 | 43 | HANDLE eventHandle; // 50 44 | }; 45 | 46 | // 58 47 | class InitGameDataThread : public BSThread 48 | { 49 | public: 50 | virtual UInt64 Run(); 51 | 52 | HANDLE eventHandle; // 50 53 | }; 54 | -------------------------------------------------------------------------------- /sfe/f4se/NiObjects.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/NiObjects.h" 2 | #include "f4se/NiExtraData.h" 3 | 4 | RelocAddr <_WorldToScreen> WorldToScreen_Internal(0x00AE2720); 5 | 6 | void NiRefObject::IncRef(void) 7 | { 8 | InterlockedIncrement(&m_uiRefCount); 9 | } 10 | 11 | bool NiRefObject::Release(void) 12 | { 13 | return InterlockedDecrement(&m_uiRefCount) == 0; 14 | } 15 | 16 | void NiRefObject::DecRef(void) 17 | { 18 | if(Release()) 19 | DeleteThis(); 20 | } 21 | 22 | NiExtraData * NiObjectNET::GetExtraData(const BSFixedString & name) 23 | { 24 | if(!m_extraData) 25 | return false; 26 | 27 | SimpleLocker locker(&m_extraData->lock); 28 | for(UInt32 i = 0; i < m_extraData->count; i++) 29 | { 30 | NiPointer data = m_extraData->entries[i]; 31 | if(data && data->m_name == name) 32 | return data; 33 | } 34 | 35 | return nullptr; 36 | } 37 | 38 | bool NiObjectNET::AddExtraData(NiExtraData * extraData) 39 | { 40 | return CALL_MEMBER_FN(this, Internal_AddExtraData)(extraData); 41 | } 42 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RC4_H 11 | # define HEADER_RC4_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_RC4 16 | # include 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | typedef struct rc4_key_st { 22 | RC4_INT x, y; 23 | RC4_INT data[256]; 24 | } RC4_KEY; 25 | 26 | const char *RC4_options(void); 27 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 28 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 29 | unsigned char *outdata); 30 | 31 | # ifdef __cplusplus 32 | } 33 | # endif 34 | # endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /common/IFileStream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common/IDataStream.h" 4 | 5 | /** 6 | * An input file stream 7 | */ 8 | class IFileStream : public IDataStream 9 | { 10 | public: 11 | IFileStream(); 12 | IFileStream(const char * name); 13 | ~IFileStream(); 14 | 15 | bool Open(const char * name); 16 | bool BrowseOpen(void); 17 | 18 | bool Create(const char * name); 19 | bool BrowseCreate(const char * defaultName = NULL, const char * defaultPath = NULL, const char * title = NULL); 20 | 21 | void Close(void); 22 | 23 | HANDLE GetHandle(void) { return theFile; } 24 | 25 | virtual void ReadBuf(void * buf, UInt32 inLength); 26 | virtual void WriteBuf(const void * buf, UInt32 inLength); 27 | virtual void SetOffset(SInt64 inOffset); 28 | 29 | // can truncate. implicitly seeks to the end of the file 30 | void SetLength(UInt64 length); 31 | 32 | static void MakeAllDirs(const char * path); 33 | static char * ExtractFileName(char * path); 34 | 35 | protected: 36 | HANDLE theFile; 37 | }; 38 | -------------------------------------------------------------------------------- /common/common_license.txt: -------------------------------------------------------------------------------- 1 | This license applies to all of the files in src/common: 2 | 3 | Copyright (c) 2006-2011 Ian Patterson 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. -------------------------------------------------------------------------------- /sfe/f4se/ScaleformTypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 10 4 | class GRefCountImplCore 5 | { 6 | public: 7 | GRefCountImplCore() :refCount(1) { } 8 | virtual ~GRefCountImplCore() { } 9 | 10 | // void ** _vtbl; // 00 11 | volatile SInt32 refCount; // 08 12 | UInt32 pad0C; // 0C 13 | }; 14 | 15 | class GRefCountImpl : public GRefCountImplCore 16 | { 17 | public: 18 | GRefCountImpl() { } 19 | virtual ~GRefCountImpl() { } 20 | }; 21 | 22 | class GRefCountBaseStatImpl : public GRefCountImpl 23 | { 24 | public: 25 | GRefCountBaseStatImpl() { } 26 | virtual ~GRefCountBaseStatImpl() { } 27 | }; 28 | 29 | class GRefCountBase : public GRefCountBaseStatImpl 30 | { 31 | public: 32 | GRefCountBase() { } 33 | virtual ~GRefCountBase() { } 34 | }; 35 | 36 | template 37 | class GRect 38 | { 39 | public: 40 | T left; 41 | T top; 42 | T right; 43 | T bottom; 44 | }; 45 | 46 | class GMatrix3F 47 | { 48 | public: 49 | float m[3][4]; 50 | }; 51 | 52 | class GMatrix4F 53 | { 54 | public: 55 | float m[4][4]; 56 | }; 57 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusWeapon.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusWeapon.h" 2 | 3 | #include "f4se/GameObjects.h" 4 | #include "f4se/GameData.h" 5 | 6 | #include "f4se/PapyrusStruct.h" 7 | 8 | namespace papyrusWeapon 9 | { 10 | BGSMod::Attachment::Mod * GetEmbeddedMod(TESObjectWEAP* thisWeapon) 11 | { 12 | return thisWeapon ? thisWeapon->weapData.embeddedMod : nullptr; 13 | } 14 | 15 | void SetEmbeddedMod(TESObjectWEAP* thisWeapon, BGSMod::Attachment::Mod * mod) 16 | { 17 | if(thisWeapon) { 18 | thisWeapon->weapData.embeddedMod = mod; 19 | } 20 | } 21 | } 22 | 23 | #include "f4se/PapyrusVM.h" 24 | #include "f4se/PapyrusNativeFunctions.h" 25 | 26 | void papyrusWeapon::RegisterFuncs(VirtualMachine* vm) 27 | { 28 | vm->RegisterFunction( 29 | new NativeFunction0 ("GetEmbeddedMod", "Weapon", papyrusWeapon::GetEmbeddedMod, vm)); 30 | 31 | vm->RegisterFunction( 32 | new NativeFunction1 ("SetEmbeddedMod", "Weapon", papyrusWeapon::SetEmbeddedMod, vm)); 33 | } 34 | -------------------------------------------------------------------------------- /sfe/f4se_common/f4se_version.rc: -------------------------------------------------------------------------------- 1 | #include "f4se_version.h" 2 | 3 | 1 VERSIONINFO 4 | FILEVERSION 0,F4SE_VERSION_INTEGER,F4SE_VERSION_INTEGER_MINOR,F4SE_VERSION_INTEGER_BETA 5 | PRODUCTVERSION 0,F4SE_VERSION_INTEGER,F4SE_VERSION_INTEGER_MINOR,F4SE_VERSION_INTEGER_BETA 6 | FILEFLAGSMASK 0x17L 7 | #ifdef _DEBUG 8 | FILEFLAGS 0x1L 9 | #else 10 | FILEFLAGS 0x0L 11 | #endif 12 | FILEOS 0x4L 13 | FILETYPE 0x1L 14 | FILESUBTYPE 0x0L 15 | BEGIN 16 | BLOCK "StringFileInfo" 17 | BEGIN 18 | BLOCK "040904b0" 19 | BEGIN 20 | VALUE "FileDescription", "A component of Text Chat, Perk Loadout Manager, and Save Everything, powered by F4SE" 21 | VALUE "FileVersion", F4SE_VERSION_VERSTRING 22 | VALUE "InternalName", "SFE" 23 | VALUE "LegalCopyright", "Copyright (C) 2019" 24 | VALUE "ProductName", "SFE" 25 | VALUE "ProductVersion", F4SE_VERSION_VERSTRING 26 | END 27 | END 28 | BLOCK "VarFileInfo" 29 | BEGIN 30 | VALUE "Translation", 0x409, 1200 31 | END 32 | END 33 | -------------------------------------------------------------------------------- /common/common_vc11.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common_vc11", "common_vc11.vcxproj", "{D4C128A1-73DC-4941-A453-CE55AF239BA8}" 5 | EndProject 6 | Global 7 | GlobalSection(SourceCodeControl) = preSolution 8 | SccNumberOfProjects = 1 9 | SccLocalPath0 = . 10 | EndGlobalSection 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|x64 = Debug|x64 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {D4C128A1-73DC-4941-A453-CE55AF239BA8}.Debug|x64.ActiveCfg = Debug|x64 17 | {D4C128A1-73DC-4941-A453-CE55AF239BA8}.Debug|x64.Build.0 = Debug|x64 18 | {D4C128A1-73DC-4941-A453-CE55AF239BA8}.Release|x64.ActiveCfg = Release|x64 19 | {D4C128A1-73DC-4941-A453-CE55AF239BA8}.Release|x64.Build.0 = Release|x64 20 | EndGlobalSection 21 | GlobalSection(SolutionProperties) = preSolution 22 | HideSolutionNode = FALSE 23 | EndGlobalSection 24 | EndGlobal 25 | -------------------------------------------------------------------------------- /sfe/f4se/BSSkin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "NiObjects.h" 5 | 6 | class BSSkin 7 | { 8 | public: 9 | // 28 10 | class BoneData : public NiObject 11 | { 12 | public: 13 | struct BoneTransforms 14 | { 15 | NiPoint3 boundingSphere; // 00 16 | float radius; // 0C 17 | NiTransform transform; // 10 18 | }; 19 | 20 | tArray transforms; // 10 21 | void * unk20; // 20 22 | }; 23 | 24 | // C0 25 | class Instance : public NiObject 26 | { 27 | public: 28 | tArray bones; // 10 29 | tArray worldTransforms; // 28 - These are pointers to the corresponding bone's worldTransforms 30 | BoneData * boneData; // 40 31 | NiAVObject * rootNode; // 48 32 | void * unk50; // 50 33 | UInt64 unk58; // 58 34 | __m128 unk60; // 60 35 | __m128 unk70; // 64 36 | __m128 unk80; // 68 37 | __m128 unk90; // 90 38 | void * unkA0; // A0 39 | void * unkA8; // A8 40 | UInt64 unkB0; // B0 41 | UInt32 unkB8; // B8 42 | SInt32 unkBC; // BC 43 | }; 44 | }; 45 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_EBCDIC_H 11 | # define HEADER_EBCDIC_H 12 | 13 | # include 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | /* Avoid name clashes with other applications */ 20 | # define os_toascii _openssl_os_toascii 21 | # define os_toebcdic _openssl_os_toebcdic 22 | # define ebcdic2ascii _openssl_ebcdic2ascii 23 | # define ascii2ebcdic _openssl_ascii2ebcdic 24 | 25 | extern const unsigned char os_toascii[256]; 26 | extern const unsigned char os_toebcdic[256]; 27 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 28 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /sfe/f4se/GameReferences.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameReferences.h" 2 | 3 | // 1FA931E3C3B406454210A0EDC37BDD0C84C8C04A+6B 4 | RelocPtr g_player(0x05ADD3D8); 5 | 6 | // 0BE70664D4DF11A3F88748D9CB45B23D0B4FD50C+2F 7 | RelocAddr <_LookupREFRByHandle> LookupREFRByHandle(0x0000AB60); 8 | 9 | // 4369DFCC9BCC88536EEB89E5A107B60941016295+26 10 | RelocAddr <_CreateHandleByREFR> CreateHandleByREFR(0x0000A8A0); 11 | 12 | // 3A53807E195FFAEA7AA0EF7FD42D84E4EA0B755A+D0 13 | RelocPtr g_invalidRefHandle(0x03905E84); 14 | 15 | RelocAddr <_HasDetectionLOS> HasDetectionLOS(0x0135B560); 16 | 17 | RelocAddr <_GetLinkedRef_Native> GetLinkedRef_Native(0x00480EE0); 18 | 19 | RelocAddr <_SetLinkedRef_Native> SetLinkedRef_Native(0x00480F00); 20 | 21 | RelocAddr <_MoveRefrToPosition> MoveRefrToPosition(0x013FE6C0); 22 | 23 | UInt32 TESObjectREFR::CreateRefHandle(void) 24 | { 25 | if (handleRefObject.GetRefCount() > 0) 26 | { 27 | UInt32 refHandle = 0; 28 | CreateHandleByREFR(&refHandle, this); 29 | return refHandle; 30 | } 31 | else 32 | { 33 | return *g_invalidRefHandle; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /common/ISegmentStream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common/IDataStream.h" 4 | #include 5 | 6 | /** 7 | * An stream composed of many non-contiguous segments of a larger stream 8 | */ 9 | class ISegmentStream : public IDataStream 10 | { 11 | public: 12 | ISegmentStream(); 13 | ~ISegmentStream(); 14 | 15 | void AttachStream(IDataStream * inStream); 16 | 17 | void AddSegment(UInt64 offset, UInt64 length, UInt64 parentOffset); 18 | 19 | virtual void ReadBuf(void * buf, UInt32 inLength); 20 | virtual void WriteBuf(const void * buf, UInt32 inLength); 21 | virtual void SetOffset(SInt64 inOffset); 22 | 23 | protected: 24 | IDataStream * parent; 25 | 26 | struct SegmentInfo 27 | { 28 | SegmentInfo(UInt64 inOffset, UInt64 inLength, UInt64 inParentOffset) 29 | { 30 | offset = inOffset; 31 | length = inLength; 32 | parentOffset = inParentOffset; 33 | } 34 | 35 | UInt64 offset; 36 | UInt64 length; 37 | UInt64 parentOffset; 38 | }; 39 | 40 | typedef std::vector SegmentInfoListType; 41 | SegmentInfoListType segmentInfo; 42 | 43 | SegmentInfo * LookupInfo(UInt64 offset); 44 | }; 45 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusUtility.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusUtility.h" 2 | 3 | #include "f4se/PapyrusVM.h" 4 | #include "f4se/PapyrusNativeFunctions.h" 5 | 6 | namespace papyrusUtility 7 | { 8 | VMArray VarToVarArray(StaticFunctionTag * tag, VMVariable var) 9 | { 10 | VMArray result; 11 | var.Get>(&result); 12 | return result; 13 | } 14 | 15 | VMVariable VarArrayToVar(StaticFunctionTag * tag, VMArray vars) 16 | { 17 | VMVariable result; 18 | result.Set>(&vars); 19 | return result; 20 | } 21 | } 22 | 23 | void papyrusUtility::RegisterFuncs(VirtualMachine* vm) 24 | { 25 | vm->RegisterFunction( 26 | new NativeFunction1 , VMVariable>("VarToVarArray", "Utility", papyrusUtility::VarToVarArray, vm)); 27 | 28 | vm->RegisterFunction( 29 | new NativeFunction1 >("VarArrayToVar", "Utility", papyrusUtility::VarArrayToVar, vm)); 30 | 31 | vm->SetFunctionFlags("Utility", "VarToVarArray", IFunction::kFunctionFlag_NoWait); 32 | vm->SetFunctionFlags("Utility", "VarArrayToVar", IFunction::kFunctionFlag_NoWait); 33 | } 34 | -------------------------------------------------------------------------------- /common/IThread.cpp: -------------------------------------------------------------------------------- 1 | #include "IThread.h" 2 | 3 | IThread::IThread() 4 | { 5 | mainProc = NULL; 6 | mainProcParam = NULL; 7 | stopRequested = false; 8 | isRunning = false; 9 | theThread = NULL; 10 | threadID = 0; 11 | } 12 | 13 | IThread::~IThread() 14 | { 15 | ForceStop(); 16 | 17 | if(theThread) 18 | { 19 | CloseHandle(theThread); 20 | } 21 | } 22 | 23 | void IThread::Start(MainProcPtr proc, void * procParam) 24 | { 25 | if(!isRunning) 26 | { 27 | isRunning = true; 28 | stopRequested = false; 29 | 30 | mainProc = proc; 31 | mainProcParam = procParam; 32 | 33 | theThread = CreateThread(NULL, 0, _ThreadProc, static_cast(this), 0, &threadID); 34 | } 35 | } 36 | 37 | void IThread::Stop(void) 38 | { 39 | if(isRunning) 40 | { 41 | stopRequested = true; 42 | } 43 | } 44 | 45 | void IThread::ForceStop(void) 46 | { 47 | if(isRunning) 48 | { 49 | TerminateThread(theThread, 0); 50 | 51 | isRunning = false; 52 | } 53 | } 54 | 55 | UInt32 IThread::_ThreadProc(void * param) 56 | { 57 | IThread * _this = (IThread *)param; 58 | 59 | if(_this->mainProc) 60 | _this->mainProc(_this->mainProcParam); 61 | 62 | _this->isRunning = false; 63 | 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /common/ISingleton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common/IErrors.h" 4 | 5 | #pragma warning(push) 6 | #pragma warning(disable: 4311 4312) 7 | 8 | /** 9 | * A singleton base class 10 | * 11 | * Singletons are useful when you have a class that will be instantiated once, 12 | * like a global manager. 13 | */ 14 | template 15 | class ISingleton 16 | { 17 | static T * ms_Singleton; 18 | 19 | public: 20 | ISingleton() 21 | { 22 | ASSERT(!ms_Singleton); 23 | intptr_t offset = (intptr_t)(T *)1 - (intptr_t)(ISingleton *)(T *)1; 24 | ms_Singleton = (T *)((intptr_t)this + offset); 25 | } 26 | 27 | virtual ~ISingleton() 28 | { 29 | ASSERT(ms_Singleton); 30 | ms_Singleton = 0; 31 | } 32 | 33 | /** 34 | * Returns the single instance of the derived class 35 | */ 36 | static T& GetSingleton(void) 37 | { 38 | ASSERT(ms_Singleton); 39 | return *ms_Singleton; 40 | } 41 | 42 | /** 43 | * Returns a pointer to the single instance of the derived class 44 | */ 45 | static T * GetSingletonPtr(void) 46 | { 47 | return ms_Singleton; 48 | } 49 | }; 50 | 51 | template T * ISingleton ::ms_Singleton = 0; 52 | 53 | #pragma warning(pop) 54 | -------------------------------------------------------------------------------- /common/common_vc14.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common_vc14", "common_vc14.vcxproj", "{472E19AB-DEF0-42DF-819B-18722E8DC822}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {472E19AB-DEF0-42DF-819B-18722E8DC822}.Debug|x64.ActiveCfg = Debug|x64 15 | {472E19AB-DEF0-42DF-819B-18722E8DC822}.Debug|x64.Build.0 = Debug|x64 16 | {472E19AB-DEF0-42DF-819B-18722E8DC822}.Release|x64.ActiveCfg = Release|x64 17 | {472E19AB-DEF0-42DF-819B-18722E8DC822}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(SourceCodeControl) = preSolution 23 | SccNumberOfProjects = 2 24 | SccLocalPath0 = . 25 | SccProjectUniqueName1 = common_vc14.vcxproj 26 | SccLocalPath1 = . 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /common/IDirectoryIterator.cpp: -------------------------------------------------------------------------------- 1 | #include "IDirectoryIterator.h" 2 | #include 3 | 4 | IDirectoryIterator::IDirectoryIterator(const char * path, const char * match) 5 | :m_searchHandle(INVALID_HANDLE_VALUE), m_done(false) 6 | { 7 | if(!match) match = "*"; 8 | 9 | strcpy_s(m_path, sizeof(m_path), path); 10 | 11 | char wildcardPath[MAX_PATH]; 12 | sprintf_s(wildcardPath, sizeof(wildcardPath), "%s\\%s", path, match); 13 | 14 | m_searchHandle = FindFirstFile(wildcardPath, &m_result); 15 | if(m_searchHandle == INVALID_HANDLE_VALUE) 16 | m_done = true; 17 | } 18 | 19 | IDirectoryIterator::~IDirectoryIterator() 20 | { 21 | if(m_searchHandle != INVALID_HANDLE_VALUE) 22 | FindClose(m_searchHandle); 23 | } 24 | 25 | void IDirectoryIterator::GetFullPath(char * out, UInt32 outLen) 26 | { 27 | sprintf_s(out, outLen, "%s\\%s", m_path, m_result.cFileName); 28 | } 29 | 30 | std::string IDirectoryIterator::GetFullPath(void) 31 | { 32 | return std::string(m_path) + "\\" + std::string(m_result.cFileName); 33 | } 34 | 35 | void IDirectoryIterator::Next(void) 36 | { 37 | BOOL result = FindNextFile(m_searchHandle, &m_result); 38 | if(!result) 39 | m_done = true; 40 | } 41 | 42 | bool IDirectoryIterator::Done(void) 43 | { 44 | return m_done; 45 | } 46 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/mdc2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MDC2_H 11 | # define HEADER_MDC2_H 12 | 13 | # include 14 | 15 | #ifndef OPENSSL_NO_MDC2 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | # define MDC2_BLOCK 8 23 | # define MDC2_DIGEST_LENGTH 16 24 | 25 | typedef struct mdc2_ctx_st { 26 | unsigned int num; 27 | unsigned char data[MDC2_BLOCK]; 28 | DES_cblock h, hh; 29 | int pad_type; /* either 1 or 2, default 1 */ 30 | } MDC2_CTX; 31 | 32 | int MDC2_Init(MDC2_CTX *c); 33 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); 34 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); 35 | unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); 36 | 37 | # ifdef __cplusplus 38 | } 39 | # endif 40 | # endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /sfe/f4se/GameMessages.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se_common/Utilities.h" 4 | 5 | class ScrapHeap; 6 | class BSGeometry; 7 | class BGSTextureSet; 8 | 9 | struct BSPackedTask 10 | { 11 | 12 | }; 13 | 14 | template 15 | class BSTMessageQueue 16 | { 17 | public: 18 | virtual void Unk_01() = 0; 19 | virtual void Unk_02() = 0; 20 | virtual void Unk_03() = 0; 21 | virtual void Unk_04() = 0; 22 | }; 23 | 24 | template 25 | class BSTCommonMessageQueue : public BSTMessageQueue 26 | { 27 | public: 28 | virtual void Unk_01(); 29 | virtual void Unk_02(); 30 | virtual void Unk_03(); 31 | virtual void Unk_04(); 32 | virtual void Unk_05(); 33 | virtual void Unk_06(); 34 | 35 | volatile UInt32 m_refCount; // 08 36 | UInt32 pad0C; // 0C 37 | }; 38 | 39 | template 40 | class BSTCommonScrapHeapMessageQueue : public BSTCommonMessageQueue 41 | { 42 | public: 43 | virtual void Unk_05(); 44 | virtual void Unk_06(); 45 | 46 | ScrapHeap * m_pScrapHeap; 47 | 48 | MEMBER_FN_PREFIX(BSTCommonScrapHeapMessageQueue); 49 | DEFINE_MEMBER_FN(SetTextureSet, void, 0x00D5DE40, BSGeometry * geometry, BGSTextureSet * textureSet); 50 | }; 51 | 52 | extern RelocPtr *> g_messageQueue; 53 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/cmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_CMAC_H 11 | # define HEADER_CMAC_H 12 | 13 | # ifndef OPENSSL_NO_CMAC 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | # include 20 | 21 | /* Opaque */ 22 | typedef struct CMAC_CTX_st CMAC_CTX; 23 | 24 | CMAC_CTX *CMAC_CTX_new(void); 25 | void CMAC_CTX_cleanup(CMAC_CTX *ctx); 26 | void CMAC_CTX_free(CMAC_CTX *ctx); 27 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 28 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 29 | 30 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 31 | const EVP_CIPHER *cipher, ENGINE *impl); 32 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 33 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 34 | int CMAC_resume(CMAC_CTX *ctx); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | # endif 41 | #endif 42 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/md2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MD2_H 11 | # define HEADER_MD2_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_MD2 16 | # include 17 | # ifdef __cplusplus 18 | extern "C" { 19 | # endif 20 | 21 | typedef unsigned char MD2_INT; 22 | 23 | # define MD2_DIGEST_LENGTH 16 24 | # define MD2_BLOCK 16 25 | 26 | typedef struct MD2state_st { 27 | unsigned int num; 28 | unsigned char data[MD2_BLOCK]; 29 | MD2_INT cksm[MD2_BLOCK]; 30 | MD2_INT state[MD2_BLOCK]; 31 | } MD2_CTX; 32 | 33 | const char *MD2_options(void); 34 | int MD2_Init(MD2_CTX *c); 35 | int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); 36 | int MD2_Final(unsigned char *md, MD2_CTX *c); 37 | unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md); 38 | 39 | # ifdef __cplusplus 40 | } 41 | # endif 42 | # endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /common/IDatabase.inc: -------------------------------------------------------------------------------- 1 | template 2 | void IDatabase ::Save(IDataStream * stream) 3 | { 4 | stream->Write32(theDataMap.size()); 5 | stream->Write64(newKeyHint); 6 | 7 | for(DataMapType::iterator iter = theDataMap.begin(); iter != theDataMap.end(); iter++) 8 | { 9 | stream->Write64((*iter).first); 10 | stream->WriteBuf(&((*iter).second), sizeof(DataType)); 11 | } 12 | } 13 | 14 | template 15 | void IDatabase ::Load(IDataStream * stream) 16 | { 17 | UInt32 numEntries = stream->Read32(); 18 | newKeyHint = stream->Read64(); 19 | 20 | theDataMap.clear(); 21 | 22 | for(UInt32 i = 0; i < numEntries; i++) 23 | { 24 | UInt64 key = stream->Read64(); 25 | stream->ReadBuf(&(theDataMap[key]), sizeof(DataType)); 26 | } 27 | } 28 | 29 | template 30 | bool IDatabase ::SaveToFile(char * name) 31 | { 32 | IFileStream stream; 33 | 34 | if(stream.Create(name)) 35 | { 36 | Save(&stream); 37 | return true; 38 | } 39 | 40 | return false; 41 | } 42 | 43 | template 44 | bool IDatabase ::LoadFromFile(char * name) 45 | { 46 | IFileStream stream; 47 | 48 | if(stream.Open(name)) 49 | { 50 | Load(&stream); 51 | return true; 52 | } 53 | 54 | return false; 55 | } 56 | -------------------------------------------------------------------------------- /sfe/f4se/NiSerialization.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se_common/Utilities.h" 4 | 5 | class NiBinaryStream; 6 | class NiObject; 7 | 8 | // 708 9 | class NiStream 10 | { 11 | public: 12 | virtual ~NiStream(); 13 | 14 | virtual bool LoadStream(NiBinaryStream * stream); 15 | virtual bool LoadBuf(char * buf, UInt32 len); 16 | virtual bool LoadPath(const char * path); 17 | virtual bool SaveStream(NiBinaryStream * stream); 18 | virtual bool SaveBuf(char ** buf, UInt32 * len); 19 | virtual bool SavePath(const char * path); 20 | 21 | virtual void Unk_07(void); 22 | virtual void Unk_08(void); 23 | virtual void Unk_09(void); 24 | virtual void Unk_0A(void); 25 | virtual void Unk_0B(void); 26 | virtual void Unk_0C(void); 27 | virtual void Unk_0D(void); 28 | virtual void Unk_0E(void); 29 | virtual void Unk_0F(void); 30 | virtual void Unk_10(void); 31 | virtual void Unk_11(void); 32 | virtual void Unk_12(void); 33 | virtual void Unk_13(void); 34 | virtual void Unk_14(void); 35 | virtual void Unk_15(void); 36 | virtual void Unk_16(void); 37 | 38 | UInt64 unk08[(0x708 - 0x08) >> 3]; // 08 39 | 40 | MEMBER_FN_PREFIX(NiStream); 41 | DEFINE_MEMBER_FN(ctor, NiStream *, 0x01BB8E70); 42 | DEFINE_MEMBER_FN(dtor, void, 0x01BB90A0); 43 | DEFINE_MEMBER_FN(AddObject, void, 0x01BB91D0, NiObject * object); 44 | }; 45 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusDefaultObject.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusDefaultObject.h" 2 | 3 | #include "f4se/GameData.h" 4 | #include "f4se/GameForms.h" 5 | 6 | #include "f4se/PapyrusVM.h" 7 | #include "f4se/PapyrusNativeFunctions.h" 8 | 9 | namespace papyrusDefaultObject 10 | { 11 | TESForm * GetDefaultObject(StaticFunctionTag*, BSFixedString name) 12 | { 13 | return (*g_defaultObjectMap)->GetDefaultObject(name); 14 | } 15 | 16 | TESForm * Get(BGSDefaultObject * defaultObject) 17 | { 18 | return defaultObject ? defaultObject->form : nullptr; 19 | } 20 | 21 | void Set(BGSDefaultObject * defaultObject, TESForm * form) 22 | { 23 | if(defaultObject) 24 | defaultObject->form = form; 25 | } 26 | } 27 | 28 | void papyrusDefaultObject::RegisterFuncs(VirtualMachine* vm) 29 | { 30 | vm->RegisterForm(BGSDefaultObject::kTypeID, "DefaultObject"); 31 | 32 | vm->RegisterFunction( 33 | new NativeFunction1 ("GetDefaultObject", "DefaultObject", papyrusDefaultObject::GetDefaultObject, vm)); 34 | 35 | vm->RegisterFunction( 36 | new NativeFunction0 ("Get", "DefaultObject", papyrusDefaultObject::Get, vm)); 37 | 38 | vm->RegisterFunction( 39 | new NativeFunction1 ("Set", "DefaultObject", papyrusDefaultObject::Set, vm)); 40 | } -------------------------------------------------------------------------------- /sfe/f4se_common/BranchTrampoline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class BranchTrampoline 4 | { 5 | public: 6 | BranchTrampoline(); 7 | ~BranchTrampoline(); 8 | 9 | bool Create(size_t len, void * module = NULL); 10 | void Destroy(); 11 | 12 | // allocate unsized 13 | void * StartAlloc(); 14 | void EndAlloc(const void * end); 15 | 16 | void * Allocate(size_t size = sizeof(void *)); 17 | 18 | size_t Remain() { return m_len - m_allocated; } 19 | 20 | // takes 6 bytes of space at src, 8 bytes in trampoline 21 | bool Write6Branch(uintptr_t src, uintptr_t dst); 22 | bool Write6Call(uintptr_t src, uintptr_t dst); 23 | 24 | // takes 5 bytes of space at src, 14 bytes in trampoline 25 | bool Write5Branch(uintptr_t src, uintptr_t dst); 26 | bool Write5Call(uintptr_t src, uintptr_t dst); 27 | 28 | private: 29 | // takes 6 bytes of space at src, 8 bytes in trampoline 30 | bool Write6Branch_Internal(uintptr_t src, uintptr_t dst, UInt8 op); 31 | 32 | // takes 5 bytes of space at src, 14 bytes in trampoline 33 | bool Write5Branch_Internal(uintptr_t src, uintptr_t dst, UInt8 op); 34 | 35 | void * m_base; 36 | size_t m_len; // bytes 37 | size_t m_allocated; // bytes 38 | 39 | void * m_curAlloc; // currently active StartAlloc base 40 | }; 41 | 42 | extern BranchTrampoline g_branchTrampoline; 43 | extern BranchTrampoline g_localTrampoline; 44 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/comperr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_COMPERR_H 12 | # define HEADER_COMPERR_H 13 | 14 | # include 15 | 16 | # ifndef OPENSSL_NO_COMP 17 | 18 | # ifdef __cplusplus 19 | extern "C" 20 | # endif 21 | int ERR_load_COMP_strings(void); 22 | 23 | /* 24 | * COMP function codes. 25 | */ 26 | # define COMP_F_BIO_ZLIB_FLUSH 99 27 | # define COMP_F_BIO_ZLIB_NEW 100 28 | # define COMP_F_BIO_ZLIB_READ 101 29 | # define COMP_F_BIO_ZLIB_WRITE 102 30 | # define COMP_F_COMP_CTX_NEW 103 31 | 32 | /* 33 | * COMP reason codes. 34 | */ 35 | # define COMP_R_ZLIB_DEFLATE_ERROR 99 36 | # define COMP_R_ZLIB_INFLATE_ERROR 100 37 | # define COMP_R_ZLIB_NOT_SUPPORTED 101 38 | 39 | # endif 40 | #endif 41 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusCell.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusCell.h" 2 | 3 | #include "f4se/GameExtraData.h" 4 | #include "f4se/GameForms.h" 5 | #include "f4se/GameRTTI.h" 6 | 7 | namespace papyrusCell 8 | { 9 | TESWaterForm * GetWaterType(TESObjectCELL* thisCell) 10 | { 11 | if(!thisCell) 12 | return nullptr; 13 | 14 | // If there is a water override there should be one in its ExtraData 15 | if((thisCell->flags & TESObjectCELL::kFlag_HasWater) == TESObjectCELL::kFlag_HasWater) { 16 | auto pExtraData = thisCell->extraDataList; 17 | if(pExtraData) { 18 | ExtraCellWaterType * extraWaterType = (ExtraCellWaterType *)pExtraData->GetByType(kExtraData_CellWaterType); 19 | if(extraWaterType) 20 | return extraWaterType->waterForm; 21 | } 22 | } 23 | 24 | // Exteriors have implied water, the default water if theres no override 25 | if((thisCell->flags & TESObjectCELL::kFlag_IsInterior) != TESObjectCELL::kFlag_IsInterior) 26 | return DYNAMIC_CAST(LookupFormByID(0x18), TESForm, TESWaterForm); 27 | 28 | return nullptr; 29 | } 30 | } 31 | 32 | #include "f4se/PapyrusVM.h" 33 | #include "f4se/PapyrusNativeFunctions.h" 34 | 35 | void papyrusCell::RegisterFuncs(VirtualMachine* vm) 36 | { 37 | vm->RegisterFunction( 38 | new NativeFunction0 ("GetWaterType", "Cell", papyrusCell::GetWaterType, vm)); 39 | } 40 | -------------------------------------------------------------------------------- /common/IPipeClient.cpp: -------------------------------------------------------------------------------- 1 | #include "IPipeClient.h" 2 | 3 | IPipeClient::IPipeClient() 4 | :m_pipe(INVALID_HANDLE_VALUE) 5 | { 6 | // 7 | } 8 | 9 | IPipeClient::~IPipeClient() 10 | { 11 | Close(); 12 | } 13 | 14 | bool IPipeClient::Open(const char * name) 15 | { 16 | Close(); 17 | 18 | m_pipe = CreateFile( 19 | name, 20 | GENERIC_READ | GENERIC_WRITE, 21 | 0, 22 | NULL, 23 | OPEN_EXISTING, 24 | 0, 25 | NULL); 26 | 27 | return m_pipe != INVALID_HANDLE_VALUE; 28 | } 29 | 30 | void IPipeClient::Close(void) 31 | { 32 | if(m_pipe != INVALID_HANDLE_VALUE) 33 | { 34 | CloseHandle(m_pipe); 35 | m_pipe = INVALID_HANDLE_VALUE; 36 | } 37 | } 38 | 39 | bool IPipeClient::ReadMessage(UInt8 * buf, UInt32 length) 40 | { 41 | UInt32 bytesRead; 42 | 43 | ReadFile(m_pipe, buf, length, &bytesRead, NULL); 44 | 45 | IPipeServer::MessageHeader * header = (IPipeServer::MessageHeader *)buf; 46 | 47 | return 48 | (bytesRead >= sizeof(IPipeServer::MessageHeader)) && // has a valid header 49 | (bytesRead >= (sizeof(IPipeServer::MessageHeader) + header->length)); 50 | } 51 | 52 | bool IPipeClient::WriteMessage(IPipeServer::MessageHeader * msg) 53 | { 54 | UInt32 bytesWritten; 55 | UInt32 length = sizeof(IPipeServer::MessageHeader) + msg->length; 56 | 57 | WriteFile(m_pipe, msg, length, &bytesWritten, NULL); 58 | 59 | return bytesWritten >= length; 60 | } 61 | -------------------------------------------------------------------------------- /sfe/f4se/ObScript.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se_common/Utilities.h" 4 | 5 | class TESObjectREFR; 6 | 7 | // 0C 8 | struct ObScriptParam 9 | { 10 | const char * typeStr; // 00 11 | UInt32 typeID; // 04 12 | UInt32 isOptional; // 08 13 | }; 14 | 15 | typedef bool (* ObScript_Execute)(void * paramInfo, void * scriptData, TESObjectREFR * thisObj, void * containingObj, void * scriptObj, void * locals, double * result, void * opcodeOffsetPtr); 16 | 17 | // 50 18 | struct ObScriptCommand 19 | { 20 | const char * longName; // 00 21 | const char * shortName; // 08 22 | UInt32 opcode; // 10 23 | UInt32 pad14; // 14 24 | const char * helpText; // 18 25 | UInt8 needsParent; // 20 26 | UInt8 pad21; // 21 27 | UInt16 numParams; // 22 28 | UInt32 pad24; // 24 29 | ObScriptParam * params; // 28 30 | 31 | // handlers 32 | ObScript_Execute execute; // 30 33 | void * parse; // 38 34 | void * eval; // 40 35 | 36 | UInt32 flags; // 48 37 | UInt32 pad4C; // 4C 38 | }; 39 | 40 | enum 41 | { 42 | kObScript_NumObScriptCommands = 0x0332, 43 | kObScript_NumConsoleCommands = 0x0209, 44 | 45 | kObScript_ScriptOpBase = 0x1000, 46 | kObScript_ConsoleOpBase = 0x0100, 47 | }; 48 | 49 | extern RelocPtr g_firstObScriptCommand; 50 | extern RelocPtr g_firstConsoleCommand; 51 | -------------------------------------------------------------------------------- /common/ITypes.cpp: -------------------------------------------------------------------------------- 1 | #include "ITypes.h" 2 | 3 | Bitstring::Bitstring() 4 | :data(NULL) 5 | { 6 | 7 | } 8 | 9 | Bitstring::Bitstring(UInt32 inLength) 10 | :data(NULL) 11 | { 12 | Alloc(inLength); 13 | } 14 | 15 | Bitstring::~Bitstring() 16 | { 17 | Dispose(); 18 | } 19 | 20 | void Bitstring::Alloc(UInt32 inLength) 21 | { 22 | Dispose(); 23 | 24 | inLength = (inLength + 7) & ~7; 25 | length = inLength >> 3; 26 | 27 | data = new UInt8[length]; 28 | } 29 | 30 | void Bitstring::Dispose(void) 31 | { 32 | delete [] data; 33 | } 34 | 35 | void Bitstring::Clear(void) 36 | { 37 | std::memset(data, 0, length); 38 | } 39 | 40 | void Bitstring::Clear(UInt32 idx) 41 | { 42 | ASSERT_STR(idx < (length << 3), "Bitstring::Clear: out of range"); 43 | 44 | data[idx >> 3] &= ~(1 << (idx & 7)); 45 | } 46 | 47 | void Bitstring::Set(UInt32 idx) 48 | { 49 | ASSERT_STR(idx < (length << 3), "Bitstring::Set: out of range"); 50 | 51 | data[idx >> 3] |= (1 << (idx & 7)); 52 | } 53 | 54 | bool Bitstring::IsSet(UInt32 idx) 55 | { 56 | ASSERT_STR(idx < (length << 3), "Bitstring::IsSet: out of range"); 57 | 58 | return (data[idx >> 3] & (1 << (idx & 7))) ? true : false; 59 | } 60 | 61 | bool Bitstring::IsClear(UInt32 idx) 62 | { 63 | ASSERT_STR(idx < (length << 3), "Bitstring::IsClear: out of range"); 64 | 65 | return (data[idx >> 3] & (1 << (idx & 7))) ? false : true; 66 | } 67 | -------------------------------------------------------------------------------- /common/IBufferStream.cpp: -------------------------------------------------------------------------------- 1 | #include "IBufferStream.h" 2 | 3 | IBufferStream::IBufferStream() 4 | :streamBuf(NULL), flags(0) 5 | { 6 | 7 | } 8 | 9 | IBufferStream::IBufferStream(const IBufferStream & rhs) 10 | { 11 | // explicitly not supporting copy constructor for self-owned buffers 12 | ASSERT((flags & kFlag_OwnedBuf) == 0); 13 | } 14 | 15 | IBufferStream::IBufferStream(void * buf, UInt64 inLength) 16 | :streamBuf(NULL), flags(0) 17 | { 18 | SetBuffer(buf, inLength); 19 | } 20 | 21 | IBufferStream::~IBufferStream() 22 | { 23 | if(flags & kFlag_OwnedBuf) 24 | { 25 | delete [] streamBuf; 26 | } 27 | } 28 | 29 | IBufferStream & IBufferStream::operator=(IBufferStream & rhs) 30 | { 31 | // explicitly not supporting copying for self-owned buffers 32 | ASSERT((flags & kFlag_OwnedBuf) == 0); 33 | 34 | streamBuf = rhs.streamBuf; 35 | flags = rhs.flags; 36 | 37 | return *this; 38 | } 39 | 40 | void IBufferStream::SetBuffer(void * buf, UInt64 inLength) 41 | { 42 | streamBuf = (UInt8 *)buf; 43 | streamLength = inLength; 44 | 45 | Rewind(); 46 | } 47 | 48 | void IBufferStream::ReadBuf(void * buf, UInt32 inLength) 49 | { 50 | memcpy(buf, &streamBuf[streamOffset], inLength); 51 | streamOffset += inLength; 52 | } 53 | 54 | void IBufferStream::WriteBuf(const void * buf, UInt32 inLength) 55 | { 56 | memcpy(&streamBuf[streamOffset], buf, inLength); 57 | streamOffset += inLength; 58 | } 59 | -------------------------------------------------------------------------------- /sfe/f4se/BSModelDB.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se_common/Utilities.h" 4 | 5 | class NiAVObject; 6 | 7 | class BSModelDB 8 | { 9 | public: 10 | struct ModelData 11 | { 12 | UInt64 unk00; // 00 13 | 14 | enum 15 | { 16 | kFlag_Unk1 = (1 << 0), 17 | kFlag_Dynamic = (1 << 1), 18 | kFlag_PostProcess = (1 << 3), 19 | kFlag_Unk2 = (1 << 4), 20 | kFlag_Unk3 = (1 << 5) 21 | }; 22 | 23 | UInt8 modelFlags; // 08 24 | // ... 25 | }; 26 | 27 | class BSModelProcessor 28 | { 29 | public: 30 | virtual ~BSModelProcessor() { }; 31 | 32 | virtual void Process(ModelData * modelData, const char * modelName, NiAVObject ** root, UInt32 * typeOut) { }; 33 | }; 34 | 35 | class TESProcessor : public BSModelProcessor 36 | { 37 | public: 38 | TESProcessor() { } 39 | virtual ~TESProcessor() { CALL_MEMBER_FN(this, dtor)(); }; 40 | 41 | virtual void Process(ModelData * modelData, const char * modelName, NiAVObject ** root, UInt32 * typeOut) override { CALL_MEMBER_FN(this, Impl_Process)(modelData, modelName, root, typeOut); } 42 | 43 | MEMBER_FN_PREFIX(TESProcessor); 44 | // ??_7BSModelProcessor@BSModelDB@@6B@ 45 | DEFINE_MEMBER_FN(dtor, void, 0x02C81C20); 46 | DEFINE_MEMBER_FN(Impl_Process, void, 0x00137E50, ModelData * modelData, const char * modelName, NiAVObject ** root, UInt32 * typeOut); 47 | }; 48 | }; 49 | 50 | extern RelocPtr g_TESProcessor; 51 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/objectserr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_OBJERR_H 12 | # define HEADER_OBJERR_H 13 | 14 | # ifdef __cplusplus 15 | extern "C" 16 | # endif 17 | int ERR_load_OBJ_strings(void); 18 | 19 | /* 20 | * OBJ function codes. 21 | */ 22 | # define OBJ_F_OBJ_ADD_OBJECT 105 23 | # define OBJ_F_OBJ_ADD_SIGID 107 24 | # define OBJ_F_OBJ_CREATE 100 25 | # define OBJ_F_OBJ_DUP 101 26 | # define OBJ_F_OBJ_NAME_NEW_INDEX 106 27 | # define OBJ_F_OBJ_NID2LN 102 28 | # define OBJ_F_OBJ_NID2OBJ 103 29 | # define OBJ_F_OBJ_NID2SN 104 30 | # define OBJ_F_OBJ_TXT2OBJ 108 31 | 32 | /* 33 | * OBJ reason codes. 34 | */ 35 | # define OBJ_R_OID_EXISTS 102 36 | # define OBJ_R_UNKNOWN_NID 101 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/asyncerr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_ASYNCERR_H 12 | # define HEADER_ASYNCERR_H 13 | 14 | # ifdef __cplusplus 15 | extern "C" 16 | # endif 17 | int ERR_load_ASYNC_strings(void); 18 | 19 | /* 20 | * ASYNC function codes. 21 | */ 22 | # define ASYNC_F_ASYNC_CTX_NEW 100 23 | # define ASYNC_F_ASYNC_INIT_THREAD 101 24 | # define ASYNC_F_ASYNC_JOB_NEW 102 25 | # define ASYNC_F_ASYNC_PAUSE_JOB 103 26 | # define ASYNC_F_ASYNC_START_FUNC 104 27 | # define ASYNC_F_ASYNC_START_JOB 105 28 | # define ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD 106 29 | 30 | /* 31 | * ASYNC reason codes. 32 | */ 33 | # define ASYNC_R_FAILED_TO_SET_POOL 101 34 | # define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102 35 | # define ASYNC_R_INIT_FAILED 105 36 | # define ASYNC_R_INVALID_POOL_SIZE 103 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/ripemd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RIPEMD_H 11 | # define HEADER_RIPEMD_H 12 | 13 | # include 14 | 15 | #ifndef OPENSSL_NO_RMD160 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | # define RIPEMD160_LONG unsigned int 23 | 24 | # define RIPEMD160_CBLOCK 64 25 | # define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) 26 | # define RIPEMD160_DIGEST_LENGTH 20 27 | 28 | typedef struct RIPEMD160state_st { 29 | RIPEMD160_LONG A, B, C, D, E; 30 | RIPEMD160_LONG Nl, Nh; 31 | RIPEMD160_LONG data[RIPEMD160_LBLOCK]; 32 | unsigned int num; 33 | } RIPEMD160_CTX; 34 | 35 | int RIPEMD160_Init(RIPEMD160_CTX *c); 36 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); 37 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); 38 | unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); 39 | void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); 40 | 41 | # ifdef __cplusplus 42 | } 43 | # endif 44 | # endif 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se_common/Relocation.h" 4 | #include "f4se_common/Utilities.h" 5 | 6 | #include "f4se/ScaleformState.h" 7 | 8 | class GImageInfoBase; 9 | class IMenu; 10 | class GFxMovieView; 11 | 12 | class GFxImageLoader : public GFxState 13 | { 14 | public: 15 | virtual GImageInfoBase* LoadImage(const char * url) = 0; 16 | }; 17 | 18 | class BSScaleformImageLoader : public GFxImageLoader 19 | { 20 | public: 21 | virtual ~BSScaleformImageLoader(); 22 | virtual GImageInfoBase* LoadImage(const char * url); 23 | virtual void Unk_02(void); 24 | virtual void Unk_03(void); 25 | virtual void Unk_04(void); 26 | virtual void Unk_06(void); 27 | 28 | MEMBER_FN_PREFIX(BSScaleformImageLoader); 29 | DEFINE_MEMBER_FN_1(MountImage, bool, 0x022E59B0, NiTexture **); 30 | DEFINE_MEMBER_FN_1(UnmountImage, bool, 0x022E5CC0, NiTexture **); 31 | }; 32 | 33 | class BSScaleformManager 34 | { 35 | public: 36 | virtual ~BSScaleformManager(); 37 | virtual void Unk_01(void); // Init image loader? 38 | 39 | UInt64 unk08; // 08 - 0 40 | GFxStateBag * stateBag; // 10 41 | void * unk18; // 18 42 | void * unk20; // 20 43 | BSScaleformImageLoader * imageLoader; // 28 44 | 45 | MEMBER_FN_PREFIX(BSScaleformManager); 46 | DEFINE_MEMBER_FN(LoadMovie, bool, 0x021109B0, IMenu * menu, GFxMovieView *&, const char * name, const char * stagePath, UInt32 flags); 47 | }; 48 | 49 | extern RelocPtr g_scaleformManager; 50 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/symhacks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SYMHACKS_H 11 | # define HEADER_SYMHACKS_H 12 | 13 | # include 14 | 15 | /* Case insensitive linking causes problems.... */ 16 | # if defined(OPENSSL_SYS_VMS) 17 | # undef ERR_load_CRYPTO_strings 18 | # define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings 19 | # undef OCSP_crlID_new 20 | # define OCSP_crlID_new OCSP_crlID2_new 21 | 22 | # undef d2i_ECPARAMETERS 23 | # define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS 24 | # undef i2d_ECPARAMETERS 25 | # define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS 26 | # undef d2i_ECPKPARAMETERS 27 | # define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS 28 | # undef i2d_ECPKPARAMETERS 29 | # define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS 30 | 31 | /* This one clashes with CMS_data_create */ 32 | # undef cms_Data_create 33 | # define cms_Data_create priv_cms_Data_create 34 | 35 | # endif 36 | 37 | #endif /* ! defined HEADER_VMS_IDHACKS_H */ 38 | -------------------------------------------------------------------------------- /sfe/f4se/InputMap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace InputMap 4 | { 5 | 6 | enum 7 | { 8 | // first 256 for keyboard, then 8 mouse buttons, then mouse wheel up, wheel down, then 16 gamepad buttons 9 | kMacro_KeyboardOffset = 0, // not actually used, just for self-documentation 10 | kMacro_NumKeyboardKeys = 256, 11 | 12 | kMacro_MouseButtonOffset = kMacro_NumKeyboardKeys, // 256 13 | kMacro_NumMouseButtons = 8, 14 | 15 | kMacro_MouseWheelOffset = kMacro_MouseButtonOffset + kMacro_NumMouseButtons, // 264 16 | kMacro_MouseWheelDirections = 2, 17 | 18 | kMacro_GamepadOffset = kMacro_MouseWheelOffset + kMacro_MouseWheelDirections, // 266 19 | kMacro_NumGamepadButtons = 16, 20 | 21 | kMaxMacros = kMacro_GamepadOffset + kMacro_NumGamepadButtons // 282 22 | }; 23 | 24 | enum 25 | { 26 | kGamepadButtonOffset_DPAD_UP = kMacro_GamepadOffset, // 266 27 | kGamepadButtonOffset_DPAD_DOWN, 28 | kGamepadButtonOffset_DPAD_LEFT, 29 | kGamepadButtonOffset_DPAD_RIGHT, 30 | kGamepadButtonOffset_START, 31 | kGamepadButtonOffset_BACK, 32 | kGamepadButtonOffset_LEFT_THUMB, 33 | kGamepadButtonOffset_RIGHT_THUMB, 34 | kGamepadButtonOffset_LEFT_SHOULDER, 35 | kGamepadButtonOffset_RIGHT_SHOULDER, 36 | kGamepadButtonOffset_A, 37 | kGamepadButtonOffset_B, 38 | kGamepadButtonOffset_X, 39 | kGamepadButtonOffset_Y, 40 | kGamepadButtonOffset_LT, 41 | kGamepadButtonOffset_RT // 281 42 | }; 43 | 44 | UInt32 GamepadMaskToKeycode(UInt32 keyMask); 45 | UInt32 GamepadKeycodeToMask(UInt32 keyCode); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/conf_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_CONF_API_H 11 | # define HEADER_CONF_API_H 12 | 13 | # include 14 | # include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* Up until OpenSSL 0.9.5a, this was new_section */ 21 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); 22 | /* Up until OpenSSL 0.9.5a, this was get_section */ 23 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); 24 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ 25 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, 26 | const char *section); 27 | 28 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); 29 | char *_CONF_get_string(const CONF *conf, const char *section, 30 | const char *name); 31 | long _CONF_get_number(const CONF *conf, const char *section, 32 | const char *name); 33 | 34 | int _CONF_new_data(CONF *conf); 35 | void _CONF_free_data(CONF *conf); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif 41 | -------------------------------------------------------------------------------- /common/ITextParser.cpp: -------------------------------------------------------------------------------- 1 | #include "ITextParser.h" 2 | #include "IDataStream.h" 3 | 4 | ITextParser::ITextParser() 5 | :m_stream(NULL) 6 | { 7 | // 8 | } 9 | 10 | ITextParser::ITextParser(IDataStream * stream) 11 | :m_stream(stream) 12 | { 13 | // 14 | } 15 | 16 | ITextParser::~ITextParser() 17 | { 18 | // 19 | } 20 | 21 | void ITextParser::Attach(IDataStream * stream) 22 | { 23 | m_stream = stream; 24 | } 25 | 26 | void ITextParser::SkipWhitespace(void) 27 | { 28 | while(!m_stream->HitEOF()) 29 | { 30 | char data = m_stream->Peek8(); 31 | 32 | if(!isspace(data)) 33 | break; 34 | 35 | m_stream->Skip(1); 36 | } 37 | } 38 | 39 | void ITextParser::SkipLine(void) 40 | { 41 | while(!m_stream->HitEOF()) 42 | { 43 | char data = m_stream->Peek8(); 44 | 45 | if((data != '\n') && (data != '\r')) 46 | break; 47 | 48 | m_stream->Skip(1); 49 | } 50 | } 51 | 52 | void ITextParser::ReadLine(char * out, UInt32 length) 53 | { 54 | m_stream->ReadString(out, length, '\n', '\r'); 55 | } 56 | 57 | void ITextParser::ReadToken(char * buf, UInt32 bufLength) 58 | { 59 | char * traverse = buf; 60 | 61 | ASSERT_STR(bufLength > 0, "ITextParser::ReadToken: zero-sized buffer"); 62 | 63 | if(bufLength == 1) 64 | { 65 | buf[0] = 0; 66 | } 67 | else 68 | { 69 | bufLength--; 70 | 71 | for(UInt32 i = 0; (i < bufLength) && !m_stream->HitEOF(); i++) 72 | { 73 | UInt8 data = m_stream->Read8(); 74 | 75 | if(isspace(data) || !data) 76 | break; 77 | 78 | *traverse++ = data; 79 | } 80 | 81 | *traverse++ = 0; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/srtp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * DTLS code by Eric Rescorla 12 | * 13 | * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. 14 | */ 15 | 16 | #ifndef HEADER_D1_SRTP_H 17 | # define HEADER_D1_SRTP_H 18 | 19 | # include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | # define SRTP_AES128_CM_SHA1_80 0x0001 26 | # define SRTP_AES128_CM_SHA1_32 0x0002 27 | # define SRTP_AES128_F8_SHA1_80 0x0003 28 | # define SRTP_AES128_F8_SHA1_32 0x0004 29 | # define SRTP_NULL_SHA1_80 0x0005 30 | # define SRTP_NULL_SHA1_32 0x0006 31 | 32 | /* AEAD SRTP protection profiles from RFC 7714 */ 33 | # define SRTP_AEAD_AES_128_GCM 0x0007 34 | # define SRTP_AEAD_AES_256_GCM 0x0008 35 | 36 | # ifndef OPENSSL_NO_SRTP 37 | 38 | __owur int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); 39 | __owur int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles); 40 | 41 | __owur STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); 42 | __owur SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); 43 | 44 | # endif 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MD5_H 11 | # define HEADER_MD5_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_MD5 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | /* 23 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 24 | * ! MD5_LONG has to be at least 32 bits wide. ! 25 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 26 | */ 27 | # define MD5_LONG unsigned int 28 | 29 | # define MD5_CBLOCK 64 30 | # define MD5_LBLOCK (MD5_CBLOCK/4) 31 | # define MD5_DIGEST_LENGTH 16 32 | 33 | typedef struct MD5state_st { 34 | MD5_LONG A, B, C, D; 35 | MD5_LONG Nl, Nh; 36 | MD5_LONG data[MD5_LBLOCK]; 37 | unsigned int num; 38 | } MD5_CTX; 39 | 40 | int MD5_Init(MD5_CTX *c); 41 | int MD5_Update(MD5_CTX *c, const void *data, size_t len); 42 | int MD5_Final(unsigned char *md, MD5_CTX *c); 43 | unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); 44 | void MD5_Transform(MD5_CTX *c, const unsigned char *b); 45 | # ifdef __cplusplus 46 | } 47 | # endif 48 | # endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/md4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MD4_H 11 | # define HEADER_MD4_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_MD4 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | /*- 23 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 24 | * ! MD4_LONG has to be at least 32 bits wide. ! 25 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 26 | */ 27 | # define MD4_LONG unsigned int 28 | 29 | # define MD4_CBLOCK 64 30 | # define MD4_LBLOCK (MD4_CBLOCK/4) 31 | # define MD4_DIGEST_LENGTH 16 32 | 33 | typedef struct MD4state_st { 34 | MD4_LONG A, B, C, D; 35 | MD4_LONG Nl, Nh; 36 | MD4_LONG data[MD4_LBLOCK]; 37 | unsigned int num; 38 | } MD4_CTX; 39 | 40 | int MD4_Init(MD4_CTX *c); 41 | int MD4_Update(MD4_CTX *c, const void *data, size_t len); 42 | int MD4_Final(unsigned char *md, MD4_CTX *c); 43 | unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); 44 | void MD4_Transform(MD4_CTX *c, const unsigned char *b); 45 | 46 | # ifdef __cplusplus 47 | } 48 | # endif 49 | # endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/comp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_COMP_H 11 | # define HEADER_COMP_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_COMP 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | 23 | 24 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 25 | const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx); 26 | int COMP_CTX_get_type(const COMP_CTX* comp); 27 | int COMP_get_type(const COMP_METHOD *meth); 28 | const char *COMP_get_name(const COMP_METHOD *meth); 29 | void COMP_CTX_free(COMP_CTX *ctx); 30 | 31 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 32 | unsigned char *in, int ilen); 33 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 34 | unsigned char *in, int ilen); 35 | 36 | COMP_METHOD *COMP_zlib(void); 37 | 38 | #if OPENSSL_API_COMPAT < 0x10100000L 39 | #define COMP_zlib_cleanup() while(0) continue 40 | #endif 41 | 42 | # ifdef HEADER_BIO_H 43 | # ifdef ZLIB 44 | const BIO_METHOD *BIO_f_zlib(void); 45 | # endif 46 | # endif 47 | 48 | 49 | # ifdef __cplusplus 50 | } 51 | # endif 52 | # endif 53 | #endif 54 | -------------------------------------------------------------------------------- /sfe/f4se_common/SafeWrite.cpp: -------------------------------------------------------------------------------- 1 | #include "SafeWrite.h" 2 | 3 | void SafeWriteBuf(uintptr_t addr, void * data, size_t len) 4 | { 5 | UInt32 oldProtect; 6 | 7 | VirtualProtect((void *)addr, len, PAGE_EXECUTE_READWRITE, &oldProtect); 8 | memcpy((void *)addr, data, len); 9 | VirtualProtect((void *)addr, len, oldProtect, &oldProtect); 10 | } 11 | 12 | void SafeWrite8(uintptr_t addr, UInt8 data) 13 | { 14 | SafeWriteBuf(addr, &data, sizeof(data)); 15 | } 16 | 17 | void SafeWrite16(uintptr_t addr, UInt16 data) 18 | { 19 | SafeWriteBuf(addr, &data, sizeof(data)); 20 | } 21 | 22 | void SafeWrite32(uintptr_t addr, UInt32 data) 23 | { 24 | SafeWriteBuf(addr, &data, sizeof(data)); 25 | } 26 | 27 | void SafeWrite64(uintptr_t addr, UInt64 data) 28 | { 29 | SafeWriteBuf(addr, &data, sizeof(data)); 30 | } 31 | 32 | static bool SafeWriteJump_Internal(uintptr_t src, uintptr_t dst, UInt8 op) 33 | { 34 | #pragma pack(push, 1) 35 | struct Code 36 | { 37 | UInt8 op; 38 | SInt32 displ; 39 | }; 40 | #pragma pack(pop) 41 | 42 | STATIC_ASSERT(sizeof(Code) == 5); 43 | 44 | ptrdiff_t delta = dst - (src + sizeof(Code)); 45 | if((delta < INT_MIN) || (delta > INT_MAX)) 46 | return false; 47 | 48 | Code code; 49 | 50 | code.op = op; 51 | code.displ = delta; 52 | 53 | SafeWriteBuf(src, &code, sizeof(code)); 54 | 55 | return true; 56 | } 57 | 58 | bool SafeWriteJump(uintptr_t src, uintptr_t dst) 59 | { 60 | return SafeWriteJump_Internal(src, dst, 0xE9); 61 | } 62 | 63 | bool SafeWriteCall(uintptr_t src, uintptr_t dst) 64 | { 65 | return SafeWriteJump_Internal(src, dst, 0xE8); 66 | } 67 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/whrlpool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_WHRLPOOL_H 11 | # define HEADER_WHRLPOOL_H 12 | 13 | #include 14 | 15 | # ifndef OPENSSL_NO_WHIRLPOOL 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | # define WHIRLPOOL_DIGEST_LENGTH (512/8) 23 | # define WHIRLPOOL_BBLOCK 512 24 | # define WHIRLPOOL_COUNTER (256/8) 25 | 26 | typedef struct { 27 | union { 28 | unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; 29 | /* double q is here to ensure 64-bit alignment */ 30 | double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; 31 | } H; 32 | unsigned char data[WHIRLPOOL_BBLOCK / 8]; 33 | unsigned int bitoff; 34 | size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; 35 | } WHIRLPOOL_CTX; 36 | 37 | int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 38 | int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); 39 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); 40 | int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); 41 | unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); 42 | 43 | # ifdef __cplusplus 44 | } 45 | # endif 46 | # endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusEvents.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusEvents.h" 2 | #include "f4se/PapyrusUtilities.h" 3 | 4 | #include "f4se/GameReferences.h" 5 | 6 | RelocAddr <_SendCustomEvent> SendCustomEvent_Internal(0x013D9340); 7 | RelocAddr <_CallFunctionNoWait> CallFunctionNoWait_Internal(0x013D68B0); 8 | RelocAddr <_CallGlobalFunctionNoWait> CallGlobalFunctionNoWait_Internal(0x01451960); 9 | 10 | RegistrationMapHolder g_inputKeyEventRegs; 11 | RegistrationMapHolder g_inputControlEventRegs; 12 | RegistrationMapHolder g_externalEventRegs; 13 | RegistrationSetHolder g_cameraEventRegs; 14 | RegistrationSetHolder g_furnitureEventRegs; 15 | 16 | F4SEFurnitureEventSink g_furnitureEventSink; 17 | 18 | EventResult F4SEFurnitureEventSink::ReceiveEvent(TESFurnitureEvent * evn, void * dispatcher) 19 | { 20 | g_furnitureEventRegs.ForEach( 21 | [&evn](const EventRegistration & reg) 22 | { 23 | if(reg.params.NoFilter() || reg.params.HasFilter(evn->actor) || reg.params.HasFilter(evn->furniture)) 24 | SendPapyrusEvent3(reg.handle, reg.scriptName, "OnFurnitureEvent", evn->actor, evn->furniture, evn->isGettingUp); 25 | } 26 | ); 27 | #if 0 28 | UInt64 handle = PapyrusVM::GetHandleFromObject(evn->furniture, TESObjectREFR::kTypeID); 29 | // Do not use, function signature is not correct 30 | CALL_MEMBER_FN(*g_gameVM, SendPapyrusEvent)(handle, "OnFurnitureEvent", [handle](void * scriptVariable) 31 | { 32 | DumpClass(scriptVariable, 8); 33 | return true; 34 | }); 35 | #endif 36 | return kEvent_Continue; 37 | } 38 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusWaterType.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusWaterType.h" 2 | 3 | #include "f4se/GameObjects.h" 4 | #include "f4se/GameData.h" 5 | 6 | #include "f4se/PapyrusStruct.h" 7 | 8 | namespace papyrusWaterType 9 | { 10 | SpellItem* GetConsumeSpell(TESWaterForm* thisWater) 11 | { 12 | return thisWater ? thisWater->consumeSpell : nullptr; 13 | } 14 | 15 | void SetConsumeSpell(TESWaterForm* thisWater, SpellItem* spell) 16 | { 17 | if(thisWater) { 18 | thisWater->consumeSpell = spell; 19 | } 20 | } 21 | 22 | SpellItem* GetContactSpell(TESWaterForm* thisWater) 23 | { 24 | return thisWater ? thisWater->contactSpell : nullptr; 25 | } 26 | 27 | void SetContactSpell(TESWaterForm* thisWater, SpellItem* spell) 28 | { 29 | if(thisWater) { 30 | thisWater->contactSpell = spell; 31 | } 32 | } 33 | } 34 | 35 | #include "f4se/PapyrusVM.h" 36 | #include "f4se/PapyrusNativeFunctions.h" 37 | 38 | void papyrusWaterType::RegisterFuncs(VirtualMachine* vm) 39 | { 40 | vm->RegisterForm(TESWaterForm::kTypeID, "WaterType"); 41 | 42 | vm->RegisterFunction( 43 | new NativeFunction0 ("GetConsumeSpell", "WaterType", papyrusWaterType::GetConsumeSpell, vm)); 44 | 45 | vm->RegisterFunction( 46 | new NativeFunction1 ("SetConsumeSpell", "WaterType", papyrusWaterType::SetConsumeSpell, vm)); 47 | 48 | vm->RegisterFunction( 49 | new NativeFunction0 ("GetContactSpell", "WaterType", papyrusWaterType::GetContactSpell, vm)); 50 | 51 | vm->RegisterFunction( 52 | new NativeFunction1 ("SetContactSpell", "WaterType", papyrusWaterType::SetContactSpell, vm)); 53 | } 54 | -------------------------------------------------------------------------------- /common/IPipeServer.cpp: -------------------------------------------------------------------------------- 1 | #include "IPipeServer.h" 2 | 3 | IPipeServer::IPipeServer() 4 | :m_pipe(INVALID_HANDLE_VALUE) 5 | { 6 | // 7 | } 8 | 9 | IPipeServer::~IPipeServer() 10 | { 11 | Close(); 12 | } 13 | 14 | bool IPipeServer::Open(const char * name) 15 | { 16 | Close(); 17 | 18 | m_pipe = CreateNamedPipe( 19 | name, 20 | PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE, 21 | PIPE_TYPE_MESSAGE | PIPE_TYPE_MESSAGE | PIPE_WAIT, 22 | PIPE_UNLIMITED_INSTANCES, 23 | 8192, 8192, 24 | 10 * 1000, // 10 seconds 25 | NULL); 26 | 27 | return m_pipe != INVALID_HANDLE_VALUE; 28 | } 29 | 30 | void IPipeServer::Close(void) 31 | { 32 | if(m_pipe != INVALID_HANDLE_VALUE) 33 | { 34 | CloseHandle(m_pipe); 35 | m_pipe = INVALID_HANDLE_VALUE; 36 | } 37 | } 38 | 39 | bool IPipeServer::WaitForClient(void) 40 | { 41 | bool result = ConnectNamedPipe(m_pipe, NULL) != 0; 42 | 43 | // already connected? 44 | if(!result) 45 | { 46 | if(GetLastError() == ERROR_PIPE_CONNECTED) 47 | result = true; 48 | } 49 | 50 | return result; 51 | } 52 | 53 | bool IPipeServer::ReadMessage(UInt8 * buf, UInt32 length) 54 | { 55 | UInt32 bytesRead; 56 | 57 | ReadFile(m_pipe, buf, length, &bytesRead, NULL); 58 | 59 | MessageHeader * header = (MessageHeader *)buf; 60 | 61 | return 62 | (bytesRead >= sizeof(MessageHeader)) && // has a valid header 63 | (bytesRead >= (sizeof(MessageHeader) + header->length)); 64 | } 65 | 66 | bool IPipeServer::WriteMessage(MessageHeader * msg) 67 | { 68 | UInt32 bytesWritten; 69 | UInt32 length = sizeof(MessageHeader) + msg->length; 70 | 71 | WriteFile(m_pipe, msg, length, &bytesWritten, NULL); 72 | 73 | return bytesWritten >= length; 74 | } 75 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusComponent.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/papyrusComponent.h" 2 | 3 | #include "f4se/GameExtraData.h" 4 | #include "f4se/GameForms.h" 5 | #include "f4se/GameObjects.h" 6 | #include "f4se/GameRTTI.h" 7 | 8 | namespace papyrusComponent 9 | { 10 | TESObjectMISC * GetScrapItem(BGSComponent * thisObject) 11 | { 12 | return thisObject ? thisObject->scrapItem : nullptr; 13 | } 14 | 15 | void SetScrapItem(BGSComponent * thisObject, TESObjectMISC * scrapItem) 16 | { 17 | if(thisObject && scrapItem) { 18 | thisObject->scrapItem = scrapItem; 19 | } 20 | } 21 | 22 | TESGlobal * GetScrapScalar(BGSComponent * thisObject) 23 | { 24 | return thisObject ? thisObject->scrapScalar : nullptr; 25 | } 26 | 27 | void SetScrapScalar(BGSComponent * thisObject, TESGlobal * scrapScalar) 28 | { 29 | if(thisObject && scrapScalar) { 30 | thisObject->scrapScalar = scrapScalar; 31 | } 32 | } 33 | } 34 | 35 | #include "f4se/PapyrusVM.h" 36 | #include "f4se/PapyrusNativeFunctions.h" 37 | 38 | void papyrusComponent::RegisterFuncs(VirtualMachine* vm) 39 | { 40 | vm->RegisterFunction( 41 | new NativeFunction0 ("GetScrapItem", "Component", papyrusComponent::GetScrapItem, vm)); 42 | 43 | vm->RegisterFunction( 44 | new NativeFunction1 ("SetScrapItem", "Component", papyrusComponent::SetScrapItem, vm)); 45 | 46 | vm->RegisterFunction( 47 | new NativeFunction0 ("GetScrapScalar", "Component", papyrusComponent::GetScrapScalar, vm)); 48 | 49 | vm->RegisterFunction( 50 | new NativeFunction1 ("SetScrapScalar", "Component", papyrusComponent::SetScrapScalar, vm)); 51 | } 52 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_GameData.cpp: -------------------------------------------------------------------------------- 1 | #include "Hooks_GameData.h" 2 | #include "f4se/GameThreads.h" 3 | #include "f4se/GameData.h" 4 | #include "f4se_common/Relocation.h" 5 | #include "f4se_common/SafeWrite.h" 6 | #include "f4se_common/BranchTrampoline.h" 7 | #include "xbyak/xbyak.h" 8 | #include "f4se/PluginManager.h" 9 | 10 | typedef UInt64 (* _InitGameDataThread_Run_Original)(InitGameDataThread * thread); 11 | RelocAddr <_InitGameDataThread_Run_Original> InitGameDataThread_Run_Original(0x00D53460); 12 | 13 | typedef void (* _GameDataReady_Original)(bool isReady); 14 | // writes to g_isGameDataReady 15 | 16 | // 936C94CC97C598DFE8A81979F95A75088F8B44C2+3AF 17 | RelocAddr <_GameDataReady_Original> GameDataReady_Original(0x0082F930); 18 | 19 | UInt64 InitGameDataRun_Hook(InitGameDataThread * thread) 20 | { 21 | UInt64 res = InitGameDataThread_Run_Original(thread); 22 | PluginManager::Dispatch_Message(0, F4SEMessagingInterface::kMessage_GameLoaded, (void*)NULL, 0, NULL); 23 | return res; 24 | } 25 | 26 | void GameDataReady_Hook(bool isReady) 27 | { 28 | // This message is before so if the listener reads from the global it will be the previous value 29 | PluginManager::Dispatch_Message(0, F4SEMessagingInterface::kMessage_GameDataReady, (void*)isReady, 1, NULL); 30 | (*g_isGameDataReady) = isReady; 31 | } 32 | 33 | void Hooks_GameData_Init() 34 | { 35 | 36 | } 37 | 38 | void Hooks_GameData_Commit() 39 | { 40 | // ??_7InitGameDataThread@?A0x1eb8b661@@6B@ 41 | RelocAddr InitGameDataThread_Run(0x02D65EE8 + 8); 42 | 43 | SafeWrite64(InitGameDataThread_Run.GetUIntPtr(), (UInt64)InitGameDataRun_Hook); 44 | g_branchTrampoline.Write6Branch(GameDataReady_Original.GetUIntPtr(), (uintptr_t)GameDataReady_Hook); 45 | } 46 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformTranslator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/ScaleformState.h" 4 | #include "f4se/GameTypes.h" 5 | #include "f4se/GameUtilities.h" 6 | 7 | class GFxTranslator : public GFxState 8 | { 9 | public: 10 | virtual ~GFxTranslator(); 11 | 12 | virtual void Unk_01(void); 13 | virtual void Unk_02(void); 14 | virtual void Unk_03(void); 15 | virtual void Unk_04(void); 16 | }; 17 | 18 | // 10 19 | class TranslationTableItem 20 | { 21 | public: 22 | BSFixedString key; 23 | BSFixedStringW translation; 24 | 25 | TranslationTableItem(BSFixedString a_key, BSFixedStringW a_translation) 26 | : key(a_key), translation(a_translation) {} 27 | 28 | bool operator==(const BSFixedString & a_name) const { return key == a_name; } 29 | operator BSFixedString() const { return key; } 30 | 31 | static inline UInt32 GetHash(BSFixedString * key) 32 | { 33 | UInt32 hash; 34 | CalculateCRC32_64(&hash, (UInt64)key->data, 0); 35 | return hash; 36 | } 37 | 38 | void Dump(void) 39 | { 40 | _MESSAGE("\t\tkey: %S ", key.data ? key.data->Get() : ""); 41 | _MESSAGE("\t\ttranslation: %S", translation.data ? translation.data->Get() : L""); 42 | } 43 | }; 44 | 45 | typedef tHashSet TranslationTable; 46 | 47 | // 50 48 | class BSScaleformTranslator : public GFxTranslator 49 | { 50 | public: 51 | UInt64 unk18[(0x20 - 0x18) / 8]; // 18 52 | TranslationTable translations; // 20 53 | }; 54 | 55 | typedef void (__cdecl * _CreateEmptyString)(BSFixedString * pOut); 56 | extern RelocAddr<_CreateEmptyString> CreateEmptyString; 57 | 58 | typedef void (__cdecl * _SetWideString)(BSFixedString * pOut, wchar_t * bufIn); 59 | extern RelocAddr<_SetWideString> SetWideString; 60 | -------------------------------------------------------------------------------- /sfe/f4se/GameObjects.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameObjects.h" 2 | #include "f4se/GameReferences.h" 3 | #include "f4se/GameUtilities.h" 4 | 5 | RelocAddr <_PlaceAtMe_Native> PlaceAtMe_Native(0x0140AFC0); 6 | 7 | bool TESObjectARMA::GetNodeName(char * dstBuff, TESNPC * npc, TESObjectARMO * armor) 8 | { 9 | if(npc) { 10 | UInt32 sex = npc ? CALL_MEMBER_FN(npc, GetSex)() : 0; 11 | sprintf_s(dstBuff, MAX_PATH, " (%08X)[%d]/ (%08X)", formID, sex, armor->formID); 12 | return true; 13 | } 14 | 15 | return false; 16 | } 17 | 18 | void TESNPC::ChangeHeadPart(BGSHeadPart * headPart, bool bRemovePart, bool bRemoveExtraParts) 19 | { 20 | if(bRemovePart) 21 | CALL_MEMBER_FN(this, ChangeHeadPartRemovePart)(headPart, bRemoveExtraParts); 22 | else 23 | CALL_MEMBER_FN(this, ChangeHeadPart)(headPart); 24 | } 25 | 26 | BGSHeadPart * TESNPC::GetHeadPartByType(UInt32 type, bool bOverlays) 27 | { 28 | BGSHeadPart ** parts = headParts; 29 | UInt32 numParts = numHeadParts; 30 | if(bOverlays) { 31 | parts = CALL_MEMBER_FN(this, GetOverlayHeadParts)(); 32 | numParts = CALL_MEMBER_FN(this, GetNumOverlayHeadParts)(); 33 | } 34 | 35 | for(UInt32 i = 0; i < numParts; ++i) 36 | { 37 | BGSHeadPart * part = parts[i]; 38 | if(part && part->type == type) 39 | { 40 | return part; 41 | } 42 | } 43 | 44 | return nullptr; 45 | } 46 | 47 | BGSColorForm * TESNPC::GetHairColor() 48 | { 49 | if(!headData || headData->hairColor == nullptr) 50 | { 51 | TESRace * raceForm = race.race; 52 | if(raceForm) { 53 | CharacterCreation::CharGenData * charGenData = raceForm->chargenData[ CALL_MEMBER_FN(this, GetSex)()]; 54 | if(charGenData) { 55 | return charGenData->defaultColor; 56 | } 57 | } 58 | } 59 | 60 | return headData->hairColor; 61 | } 62 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_ObScript.cpp: -------------------------------------------------------------------------------- 1 | #include "Hooks_ObScript.h" 2 | #include "ObScript.h" 3 | #include "GameAPI.h" 4 | #include "GameReferences.h" 5 | #include "f4se_common/SafeWrite.h" 6 | #include "f4se_common/f4se_version.h" 7 | 8 | // currently ForceRSXCrash, could also use ToggleESRAM and several others 9 | static ObScriptCommand * s_hijackedCommand = nullptr; 10 | 11 | void Hooks_ObScript_Init() 12 | { 13 | // instead of hooking the entire classic scripting system, we're just hijacking some unused commands 14 | 15 | for(ObScriptCommand * iter = g_firstConsoleCommand; iter->opcode < (kObScript_NumConsoleCommands + kObScript_ConsoleOpBase); ++iter) 16 | { 17 | if(!strcmp(iter->longName, "ForceRSXCrash")) 18 | { 19 | s_hijackedCommand = iter; 20 | break; 21 | } 22 | } 23 | 24 | if(!s_hijackedCommand) 25 | { 26 | _ERROR("couldn't find obscript command to use"); 27 | } 28 | } 29 | 30 | bool GetF4SEVersion_Execute(void * paramInfo, void * scriptData, TESObjectREFR * thisObj, void * containingObj, void * scriptObj, void * locals, double * result, void * opcodeOffsetPtr) 31 | { 32 | _MESSAGE("GetF4SEVersion_Execute"); 33 | 34 | Console_Print("F4SE version: %d.%d.%d, release idx %d, runtime %08X", 35 | F4SE_VERSION_INTEGER, F4SE_VERSION_INTEGER_MINOR, F4SE_VERSION_INTEGER_BETA, 36 | F4SE_VERSION_RELEASEIDX, RUNTIME_VERSION); 37 | 38 | return true; 39 | } 40 | 41 | void Hooks_ObScript_Commit() 42 | { 43 | ObScriptCommand cmd = *s_hijackedCommand; 44 | 45 | cmd.longName = "GetF4SEVersion"; 46 | cmd.shortName = ""; 47 | cmd.helpText = ""; 48 | cmd.needsParent = 0; 49 | cmd.numParams = 0; 50 | cmd.execute = GetF4SEVersion_Execute; 51 | cmd.flags = 0; 52 | 53 | SafeWriteBuf((uintptr_t)s_hijackedCommand, &cmd, sizeof(cmd)); 54 | } 55 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/rc2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RC2_H 11 | # define HEADER_RC2_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_RC2 16 | # ifdef __cplusplus 17 | extern "C" { 18 | # endif 19 | 20 | typedef unsigned int RC2_INT; 21 | 22 | # define RC2_ENCRYPT 1 23 | # define RC2_DECRYPT 0 24 | 25 | # define RC2_BLOCK 8 26 | # define RC2_KEY_LENGTH 16 27 | 28 | typedef struct rc2_key_st { 29 | RC2_INT data[64]; 30 | } RC2_KEY; 31 | 32 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); 33 | void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, 34 | RC2_KEY *key, int enc); 35 | void RC2_encrypt(unsigned long *data, RC2_KEY *key); 36 | void RC2_decrypt(unsigned long *data, RC2_KEY *key); 37 | void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 38 | RC2_KEY *ks, unsigned char *iv, int enc); 39 | void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, 40 | long length, RC2_KEY *schedule, unsigned char *ivec, 41 | int *num, int enc); 42 | void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, 43 | long length, RC2_KEY *schedule, unsigned char *ivec, 44 | int *num); 45 | 46 | # ifdef __cplusplus 47 | } 48 | # endif 49 | # endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /common/ILinkedList.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // ILink members must be public 4 | template 5 | struct ILink 6 | { 7 | static const UInt32 s_offset; 8 | 9 | ILink * next; 10 | ILink * prev; 11 | 12 | T * GetObj(void) { return (T *)(((uintptr_t)this) - s_offset); } 13 | 14 | static ILink * GetLink(T * obj) { return (ILink *)(((uintptr_t)obj) + s_offset); } 15 | 16 | void Unlink(void) 17 | { 18 | if(next) next->prev = prev; 19 | if(prev) prev->next = next; 20 | 21 | next = prev = NULL; 22 | } 23 | 24 | void LinkBefore(T * obj) 25 | { 26 | LinkBefore(GetLink(obj)); 27 | } 28 | 29 | void LinkAfter(T * obj) 30 | { 31 | LinkAfter(GetLink(obj)); 32 | } 33 | 34 | void LinkBefore(ILink * link) 35 | { 36 | link->next = this; 37 | link->prev = prev; 38 | 39 | if(prev) 40 | { 41 | prev->next = link; 42 | } 43 | 44 | prev = link; 45 | } 46 | 47 | void LinkAfter(ILink * link) 48 | { 49 | link->next = next; 50 | link->prev = this; 51 | 52 | if(next) 53 | { 54 | next->prev = link; 55 | } 56 | 57 | next = link; 58 | } 59 | }; 60 | 61 | template 62 | struct ILinkedList 63 | { 64 | ILink begin; 65 | ILink end; 66 | 67 | void Reset(void) 68 | { 69 | begin.next = &end; 70 | begin.prev = NULL; 71 | end.next = NULL; 72 | end.prev = &begin; 73 | } 74 | 75 | void PushFront(T * obj) 76 | { 77 | ILink * objLink = ILink ::GetLink(obj); 78 | 79 | objLink->next = begin.next; 80 | objLink->prev = &begin; 81 | 82 | if(objLink->next) 83 | { 84 | objLink->next->prev = objLink; 85 | } 86 | 87 | begin.next = objLink; 88 | } 89 | }; 90 | 91 | #define ILINK_INIT(baseType, memberName) template const UInt32 ILink ::s_offset = offsetof(baseType, memberName) 92 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusLocation.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusLocation.h" 2 | 3 | #include "f4se/GameForms.h" 4 | #include "f4se/PapyrusArgs.h" 5 | 6 | namespace papyrusLocation 7 | { 8 | BGSLocation * GetParent(BGSLocation * thisLocation) 9 | { 10 | return thisLocation ? thisLocation->parent : nullptr; 11 | } 12 | 13 | void SetParent(BGSLocation * thisLocation, BGSLocation * newLoc) 14 | { 15 | if(thisLocation) { 16 | thisLocation->parent = newLoc; 17 | } 18 | } 19 | 20 | BGSEncounterZone * GetEncounterZone(BGSLocation * thisLocation, bool recursive) 21 | { 22 | BGSEncounterZone * result = nullptr; 23 | while(!result && thisLocation) 24 | { 25 | result = thisLocation->encounterZone; 26 | if(!recursive) 27 | break; 28 | thisLocation = thisLocation->parent; 29 | } 30 | return result; 31 | } 32 | 33 | void SetEncounterZone(BGSLocation * thisLocation, BGSEncounterZone * encounterZone) 34 | { 35 | if(thisLocation) { 36 | thisLocation->encounterZone = encounterZone; 37 | } 38 | } 39 | } 40 | 41 | #include "f4se/PapyrusVM.h" 42 | #include "f4se/PapyrusNativeFunctions.h" 43 | 44 | void papyrusLocation::RegisterFuncs(VirtualMachine* vm) 45 | { 46 | vm->RegisterFunction( 47 | new NativeFunction0 ("GetParent", "Location", papyrusLocation::GetParent, vm)); 48 | 49 | vm->RegisterFunction( 50 | new NativeFunction1 ("SetParent", "Location", papyrusLocation::SetParent, vm)); 51 | 52 | vm->RegisterFunction( 53 | new NativeFunction1 ("GetEncounterZone", "Location", papyrusLocation::GetEncounterZone, vm)); 54 | 55 | vm->RegisterFunction( 56 | new NativeFunction1 ("SetEncounterZone", "Location", papyrusLocation::SetEncounterZone, vm)); 57 | } 58 | -------------------------------------------------------------------------------- /sfe/f4se/GameWorkshop.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/GameTypes.h" 4 | 5 | class TESObjectREFR; 6 | class LocationData; 7 | class BSExtraData; 8 | class NiPoint3; 9 | class bhkWorld; 10 | 11 | typedef void(*_LinkPower)(BSExtraData* workshopExtraData, TESObjectREFR* akRef1, TESObjectREFR* akRef2, TESObjectREFR* akWireRef); // Wire optional 12 | extern RelocAddr <_LinkPower> LinkPower_Internal; 13 | 14 | typedef void(*_LinkPower2)(TESObjectREFR* akRef, BSExtraData* workshopExtraData); 15 | extern RelocAddr <_LinkPower2> LinkPower2_Internal; 16 | 17 | // Wire related calls 18 | typedef void(*_LinkPower3)(BSExtraData* workshopExtraData, TESObjectREFR* akWireRef); 19 | extern RelocAddr <_LinkPower3> LinkPower3_Internal; 20 | 21 | typedef void(*_LinkPower4)(TESObjectREFR* akWireRef); 22 | extern RelocAddr <_LinkPower4> LinkPower4_Internal; 23 | 24 | typedef void(*_SetWireEndpoints)(TESObjectREFR* akRef1, SInt32 unk2, TESObjectREFR* akRef2, SInt32 unk4, TESObjectREFR* akWireRef); // unk2 and unk4 always 0 - Adds the ExtraData 25 | extern RelocAddr <_SetWireEndpoints> SetWireEndpoints_Internal; 26 | 27 | typedef void(*_FinalizeWireLink)(LocationData* locationData, TESObjectREFR* akWireRef, TESObjectREFR* akRef1, int unk4, TESObjectREFR* akRef2, int unk6); // unk4 and unk6 always 0 28 | extern RelocAddr <_FinalizeWireLink> FinalizeWireLink; 29 | 30 | typedef TESObjectREFR * (*_GetObjectAtConnectPoint)(TESObjectREFR * source, NiPoint3 * connectPos, bhkWorld * world, float unk1); 31 | extern RelocAddr <_GetObjectAtConnectPoint> GetObjectAtConnectPoint; 32 | 33 | struct MaterialsReturned 34 | { 35 | TESForm * form; 36 | UInt32 amount; 37 | }; 38 | 39 | typedef void(*_ScrapReference)(LocationData* locationData, TESObjectREFR** akRef, tArray * materials); 40 | extern RelocAddr <_ScrapReference> ScrapReference; 41 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/hmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_HMAC_H 11 | # define HEADER_HMAC_H 12 | 13 | # include 14 | 15 | # include 16 | 17 | # if OPENSSL_API_COMPAT < 0x10200000L 18 | # define HMAC_MAX_MD_CBLOCK 128 /* Deprecated */ 19 | # endif 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | size_t HMAC_size(const HMAC_CTX *e); 26 | HMAC_CTX *HMAC_CTX_new(void); 27 | int HMAC_CTX_reset(HMAC_CTX *ctx); 28 | void HMAC_CTX_free(HMAC_CTX *ctx); 29 | 30 | DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, 31 | const EVP_MD *md)) 32 | 33 | /*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, 34 | const EVP_MD *md, ENGINE *impl); 35 | /*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, 36 | size_t len); 37 | /*__owur*/ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, 38 | unsigned int *len); 39 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, 40 | const unsigned char *d, size_t n, unsigned char *md, 41 | unsigned int *md_len); 42 | __owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); 43 | 44 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); 45 | const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /sfe/f4se/BSParticleShaderEmitter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/NiTypes.h" 4 | #include "f4se/NiObjects.h" 5 | 6 | class BSParticleShaderProperty; 7 | 8 | // 60 9 | class BSParticleShaderEmitter : public NiRefObject 10 | { 11 | protected: 12 | BSParticleShaderProperty * pProperty; // 10 13 | UInt16 uiEmitterType; // 18 14 | UInt16 uiParticleCount; // 1A 15 | float fAlpha; // 1C 16 | float fGenerateRemainder; // 20 17 | float fMaxParticleRatio; // 24 18 | 19 | // 8 20 | struct TextureAnimInfo 21 | { 22 | float fCurrentFrame; // 00 23 | UInt32 usTotalFrames; // 04 24 | }; 25 | 26 | TextureAnimInfo * pTextureAnims; // 28 27 | 28 | // 30 29 | struct ParticleData 30 | { 31 | float fXPos; // 00 32 | float fYPos; // 04 33 | float fZPos; // 08 34 | float fAge; // 0C 35 | float fXVel; // 10 36 | float fYVel; // 14 37 | float fZVel; // 18 38 | float fLifeAdjust; // 1C 39 | float fRotationStart; // 20 40 | float fRotationSpeed; // 24 41 | float fSpeedMult; // 28 42 | char ucTexCoordU; // 2C 43 | char ucTexCoordV; // 2D 44 | char ucVertexX; // 2E 45 | char ucVertexY; // 2F 46 | }; 47 | 48 | ParticleData InstanceDataA[78]; // 30 49 | }; 50 | 51 | // 2B0 52 | class BSParticleShaderCubeEmitter : public BSParticleShaderEmitter 53 | { 54 | public: 55 | float kOcclusionWorldViewProj[4][4]; // 60 56 | NiPoint3 kCameraOffsetVector; // A0 57 | NiPoint3 kOffsetVector; // AC 58 | NiPoint3 kCompositeOffsetVector; // B8 59 | NiPoint3 kFrameVelocityVector; // C4 60 | NiPoint3 kWindVelocity; // D0 61 | NiPoint3 kGravityVelocity; // DC 62 | float fRotation; // C0 63 | float fRotationVelocity; // C4 64 | float fDensity; // C8 65 | float fEnvCubeSize; // CC 66 | NiPoint3 pInstanceOffset[40]; // D0 67 | }; 68 | -------------------------------------------------------------------------------- /sfe/f4se/GameStreams.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/GameStreams.h" 2 | 3 | RelocAddr <_CreateFileStream> CreateFileStream(0x00535940); 4 | 5 | BSResourceNiBinaryStream::BSResourceNiBinaryStream() 6 | { 7 | // 8 | } 9 | 10 | BSResourceNiBinaryStream::BSResourceNiBinaryStream(const char * path) 11 | { 12 | CALL_MEMBER_FN(this, Construct)(path, 0, 0, 0); 13 | } 14 | 15 | BSResourceNiBinaryStream::~BSResourceNiBinaryStream() 16 | { 17 | CALL_MEMBER_FN(this, Destroy)(); 18 | } 19 | 20 | bool BSResourceNiBinaryStream::IsValid(void) 21 | { 22 | return CALL_MEMBER_FN(this, IsValid)(); 23 | } 24 | 25 | void BSResourceNiBinaryStream::Seek(SInt64 delta) 26 | { 27 | CALL_MEMBER_FN(this, Seek)(delta); 28 | } 29 | 30 | UInt64 BSResourceNiBinaryStream::GetOffset(void) 31 | { 32 | return offset; 33 | } 34 | 35 | SInt64 BSResourceNiBinaryStream::Unk_04(void * unk1) 36 | { 37 | return CALL_MEMBER_FN(this, Unk_04)(unk1); 38 | } 39 | 40 | UInt32 BSResourceNiBinaryStream::Read(void * buf, UInt64 length) 41 | { 42 | return CALL_MEMBER_FN(this, Read)(buf, length); 43 | } 44 | 45 | UInt32 BSResourceNiBinaryStream::Write(void * buf, UInt64 length) 46 | { 47 | return CALL_MEMBER_FN(this, Write)(buf, length); 48 | } 49 | 50 | UInt32 BSResourceNiBinaryStream::ReadLine(char * dst, UInt32 dstLen, UInt32 terminator) 51 | { 52 | return CALL_MEMBER_FN(this, ReadLine)(dst, dstLen, terminator); 53 | } 54 | 55 | UInt32 BSResourceNiBinaryStream::ReadLine_w(wchar_t * dst, UInt32 dstLen, UInt32 terminator) 56 | { 57 | wchar_t * iter = dst; 58 | 59 | if(dstLen == 0) 60 | return 0; 61 | 62 | for(UInt32 i = 0; i < dstLen - 1; i++) 63 | { 64 | wchar_t data; 65 | 66 | if(Read(&data, sizeof(data)) != sizeof(data)) 67 | break; 68 | 69 | if(data == terminator) 70 | break; 71 | 72 | *iter++ = data; 73 | } 74 | 75 | // null terminate 76 | *iter = 0; 77 | 78 | return iter - dst; 79 | } 80 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_BUFFER_H 11 | # define HEADER_BUFFER_H 12 | 13 | # include 14 | # ifndef HEADER_CRYPTO_H 15 | # include 16 | # endif 17 | # include 18 | 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | # include 25 | # include 26 | 27 | /* 28 | * These names are outdated as of OpenSSL 1.1; a future release 29 | * will move them to be deprecated. 30 | */ 31 | # define BUF_strdup(s) OPENSSL_strdup(s) 32 | # define BUF_strndup(s, size) OPENSSL_strndup(s, size) 33 | # define BUF_memdup(data, size) OPENSSL_memdup(data, size) 34 | # define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size) 35 | # define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size) 36 | # define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen) 37 | 38 | struct buf_mem_st { 39 | size_t length; /* current number of bytes */ 40 | char *data; 41 | size_t max; /* size of buffer */ 42 | unsigned long flags; 43 | }; 44 | 45 | # define BUF_MEM_FLAG_SECURE 0x01 46 | 47 | BUF_MEM *BUF_MEM_new(void); 48 | BUF_MEM *BUF_MEM_new_ex(unsigned long flags); 49 | void BUF_MEM_free(BUF_MEM *a); 50 | size_t BUF_MEM_grow(BUF_MEM *str, size_t len); 51 | size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); 52 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); 53 | 54 | 55 | # ifdef __cplusplus 56 | } 57 | # endif 58 | #endif 59 | -------------------------------------------------------------------------------- /common/IErrors.cpp: -------------------------------------------------------------------------------- 1 | #include "common/IErrors.h" 2 | #include "common/IDebugLog.h" 3 | #include 4 | 5 | __declspec(noreturn) static void IErrors_Halt(void) 6 | { 7 | // crash 8 | *((int *)0) = 0xDEADBEEF; 9 | } 10 | 11 | /** 12 | * Report a failed assertion and exit the program 13 | * 14 | * @param file the file where the error occured 15 | * @param line the line number where the error occured 16 | * @param desc an error message 17 | */ 18 | void _AssertionFailed(const char * file, unsigned long line, const char * desc) 19 | { 20 | _FATALERROR("Assertion failed in %s (%d): %s", file, line, desc); 21 | 22 | IErrors_Halt(); 23 | } 24 | 25 | /** 26 | * Report a failed assertion and exit the program 27 | * 28 | * @param file the file where the error occured 29 | * @param line the line number where the error occured 30 | * @param desc an error message 31 | * @param code the error code 32 | */ 33 | void _AssertionFailed_ErrCode(const char * file, unsigned long line, const char * desc, unsigned long long code) 34 | { 35 | if(code & 0xFFFFFFFF00000000) 36 | _FATALERROR("Assertion failed in %s (%d): %s (code = %16I64X (%I64d))", file, line, desc, code, code); 37 | else 38 | { 39 | UInt32 code32 = code; 40 | _FATALERROR("Assertion failed in %s (%d): %s (code = %08X (%d))", file, line, desc, code32, code32); 41 | } 42 | 43 | IErrors_Halt(); 44 | } 45 | 46 | /** 47 | * Report a failed assertion and exit the program 48 | * 49 | * @param file the file where the error occured 50 | * @param line the line number where the error occured 51 | * @param desc an error message 52 | * @param code the error code 53 | */ 54 | void _AssertionFailed_ErrCode(const char * file, unsigned long line, const char * desc, const char * code) 55 | { 56 | _FATALERROR("Assertion failed in %s (%d): %s (code = %s)", file, line, desc, code); 57 | 58 | IErrors_Halt(); 59 | } 60 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformSerialization.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/ScaleformSerialization.h" 2 | 3 | #include "f4se/ScaleformCallbacks.h" 4 | #include "f4se/ScaleformValue.h" 5 | 6 | namespace Serialization 7 | { 8 | template <> 9 | bool WriteData(const F4SESerializationInterface* intfc, const GFxValue* val) 10 | { 11 | UInt32 type = val->GetType(); 12 | if (! WriteData(intfc, &type)) 13 | return false; 14 | 15 | switch (type) 16 | { 17 | case GFxValue::kType_Bool: 18 | { 19 | bool t = val->GetBool(); 20 | return WriteData(intfc, &t); 21 | } 22 | case GFxValue::kType_Number: 23 | { 24 | double t = val->GetNumber(); 25 | return WriteData(intfc, &t); 26 | } 27 | case GFxValue::kType_String: 28 | { 29 | const char* t = val->GetString(); 30 | return WriteData(intfc, &t); 31 | } 32 | default: 33 | // Unsupported 34 | return false; 35 | } 36 | 37 | return false; 38 | } 39 | 40 | template <> 41 | bool ReadData(const F4SESerializationInterface* intfc, GFxValue* val) 42 | { 43 | UInt32 type; 44 | if (! ReadData(intfc, &type)) 45 | return false; 46 | 47 | switch (type) 48 | { 49 | case GFxValue::kType_Bool: 50 | { 51 | bool t; 52 | if (! ReadData(intfc, &t)) 53 | return false; 54 | val->SetBool(t); 55 | return true; 56 | } 57 | case GFxValue::kType_Number: 58 | { 59 | double t; 60 | if (! ReadData(intfc, &t)) 61 | return false; 62 | val->SetNumber(t); 63 | return true; 64 | } 65 | case GFxValue::kType_String: 66 | { 67 | // As usual, using string cache to manage strings 68 | BSFixedString t; 69 | if (! ReadData(intfc, &t)) 70 | return false; 71 | val->SetString(t.c_str()); 72 | return true; 73 | } 74 | default: 75 | // Unsupported 76 | return false; 77 | } 78 | 79 | return false; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/dtls1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_DTLS1_H 11 | # define HEADER_DTLS1_H 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | # define DTLS1_VERSION 0xFEFF 18 | # define DTLS1_2_VERSION 0xFEFD 19 | # define DTLS_MIN_VERSION DTLS1_VERSION 20 | # define DTLS_MAX_VERSION DTLS1_2_VERSION 21 | # define DTLS1_VERSION_MAJOR 0xFE 22 | 23 | # define DTLS1_BAD_VER 0x0100 24 | 25 | /* Special value for method supporting multiple versions */ 26 | # define DTLS_ANY_VERSION 0x1FFFF 27 | 28 | /* lengths of messages */ 29 | /* 30 | * Actually the max cookie length in DTLS is 255. But we can't change this now 31 | * due to compatibility concerns. 32 | */ 33 | # define DTLS1_COOKIE_LENGTH 256 34 | 35 | # define DTLS1_RT_HEADER_LENGTH 13 36 | 37 | # define DTLS1_HM_HEADER_LENGTH 12 38 | 39 | # define DTLS1_HM_BAD_FRAGMENT -2 40 | # define DTLS1_HM_FRAGMENT_RETRY -3 41 | 42 | # define DTLS1_CCS_HEADER_LENGTH 1 43 | 44 | # define DTLS1_AL_HEADER_LENGTH 2 45 | 46 | /* Timeout multipliers (timeout slice is defined in apps/timeouts.h */ 47 | # define DTLS1_TMO_READ_COUNT 2 48 | # define DTLS1_TMO_WRITE_COUNT 2 49 | 50 | # define DTLS1_TMO_ALERT_COUNT 12 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif 56 | -------------------------------------------------------------------------------- /sfe/f4se/Hooks_Camera.cpp: -------------------------------------------------------------------------------- 1 | #include "Hooks_Camera.h" 2 | 3 | #include "xbyak/xbyak.h" 4 | #include "f4se_common/BranchTrampoline.h" 5 | #include "f4se_common/Relocation.h" 6 | 7 | #include "f4se/PapyrusEvents.h" 8 | #include "f4se/GameCamera.h" 9 | 10 | void Hooks_Camera_Init() 11 | { 12 | 13 | } 14 | 15 | typedef void (* _SetCameraState)(TESCamera * camera, TESCameraState * newState); 16 | RelocAddr <_SetCameraState> SetCameraState(0x0082E810); 17 | _SetCameraState SetCameraState_Original = nullptr; 18 | 19 | void SetCameraState_Hook(TESCamera * camera, TESCameraState * newCameraState) 20 | { 21 | if(camera == (*g_playerCamera)) 22 | { 23 | SInt32 oldState = (*g_playerCamera)->GetCameraStateId(camera->cameraState); 24 | SInt32 newState = (*g_playerCamera)->GetCameraStateId(newCameraState); 25 | 26 | g_cameraEventRegs.ForEach( 27 | [&oldState, &newState](const EventRegistration & reg) 28 | { 29 | SendPapyrusEvent2(reg.handle, reg.scriptName, "OnPlayerCameraState", oldState, newState); 30 | } 31 | ); 32 | } 33 | 34 | SetCameraState_Original(camera, newCameraState); 35 | } 36 | 37 | void Hooks_Camera_Commit() 38 | { 39 | // hook global tinting of objects 40 | { 41 | struct SetCameraState_Code : Xbyak::CodeGenerator { 42 | SetCameraState_Code(void * buf) : Xbyak::CodeGenerator(4096, buf) 43 | { 44 | Xbyak::Label retnLabel; 45 | 46 | mov(ptr[rsp+0x08], rbx); 47 | push(rdi); 48 | 49 | jmp(ptr [rip + retnLabel]); 50 | 51 | L(retnLabel); 52 | dq(SetCameraState.GetUIntPtr() + 6); 53 | } 54 | }; 55 | 56 | void * codeBuf = g_localTrampoline.StartAlloc(); 57 | SetCameraState_Code code(codeBuf); 58 | g_localTrampoline.EndAlloc(code.getCurr()); 59 | 60 | SetCameraState_Original = (_SetCameraState)codeBuf; 61 | 62 | g_branchTrampoline.Write6Branch(SetCameraState.GetUIntPtr(), (uintptr_t)SetCameraState_Hook); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/cast.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_CAST_H 11 | # define HEADER_CAST_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_CAST 16 | # ifdef __cplusplus 17 | extern "C" { 18 | # endif 19 | 20 | # define CAST_ENCRYPT 1 21 | # define CAST_DECRYPT 0 22 | 23 | # define CAST_LONG unsigned int 24 | 25 | # define CAST_BLOCK 8 26 | # define CAST_KEY_LENGTH 16 27 | 28 | typedef struct cast_key_st { 29 | CAST_LONG data[32]; 30 | int short_key; /* Use reduced rounds for short key */ 31 | } CAST_KEY; 32 | 33 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); 34 | void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, 35 | const CAST_KEY *key, int enc); 36 | void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); 37 | void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); 38 | void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, 39 | long length, const CAST_KEY *ks, unsigned char *iv, 40 | int enc); 41 | void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, 42 | long length, const CAST_KEY *schedule, 43 | unsigned char *ivec, int *num, int enc); 44 | void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, 45 | long length, const CAST_KEY *schedule, 46 | unsigned char *ivec, int *num); 47 | 48 | # ifdef __cplusplus 49 | } 50 | # endif 51 | # endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/txt_db.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_TXT_DB_H 11 | # define HEADER_TXT_DB_H 12 | 13 | # include 14 | # include 15 | # include 16 | # include 17 | 18 | # define DB_ERROR_OK 0 19 | # define DB_ERROR_MALLOC 1 20 | # define DB_ERROR_INDEX_CLASH 2 21 | # define DB_ERROR_INDEX_OUT_OF_RANGE 3 22 | # define DB_ERROR_NO_INDEX 4 23 | # define DB_ERROR_INSERT_INDEX_CLASH 5 24 | # define DB_ERROR_WRONG_NUM_FIELDS 6 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | typedef OPENSSL_STRING *OPENSSL_PSTRING; 31 | DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) 32 | 33 | typedef struct txt_db_st { 34 | int num_fields; 35 | STACK_OF(OPENSSL_PSTRING) *data; 36 | LHASH_OF(OPENSSL_STRING) **index; 37 | int (**qual) (OPENSSL_STRING *); 38 | long error; 39 | long arg1; 40 | long arg2; 41 | OPENSSL_STRING *arg_row; 42 | } TXT_DB; 43 | 44 | TXT_DB *TXT_DB_read(BIO *in, int num); 45 | long TXT_DB_write(BIO *out, TXT_DB *db); 46 | int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), 47 | OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp); 48 | void TXT_DB_free(TXT_DB *db); 49 | OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, 50 | OPENSSL_STRING *value); 51 | int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /common/IFIFO.cpp: -------------------------------------------------------------------------------- 1 | #include "IFIFO.h" 2 | 3 | IFIFO::IFIFO(UInt32 length) 4 | { 5 | fifoBuf = new UInt8[length]; 6 | fifoBufSize = length; 7 | fifoBase = 0; 8 | fifoDataLength = 0; 9 | } 10 | 11 | IFIFO::~IFIFO() 12 | { 13 | delete fifoBuf; 14 | } 15 | 16 | bool IFIFO::Push(UInt8 * buf, UInt32 length) 17 | { 18 | // would that overflow the buffer? 19 | if(length > GetBufferRemain()) 20 | return false; 21 | 22 | UInt32 writeOffset = GetWriteOffset(); 23 | 24 | // will this cross the end of the buffer? 25 | if(writeOffset + length > fifoBufSize) 26 | { 27 | UInt32 segmentLength = fifoBufSize - writeOffset; 28 | 29 | std::memcpy(&fifoBuf[writeOffset], buf, segmentLength); 30 | std::memcpy(fifoBuf, &buf[segmentLength], length - segmentLength); 31 | } 32 | else 33 | { 34 | std::memcpy(&fifoBuf[writeOffset], buf, length); 35 | } 36 | 37 | // update pointers 38 | fifoDataLength += length; 39 | 40 | return true; 41 | } 42 | 43 | bool IFIFO::Pop(UInt8 * buf, UInt32 length) 44 | { 45 | bool result = Peek(buf, length); 46 | 47 | // update pointers if we were successful 48 | if(result) 49 | { 50 | fifoDataLength -= length; 51 | fifoBase = ToRawOffset(fifoBase + length); 52 | } 53 | 54 | return result; 55 | } 56 | 57 | bool IFIFO::Peek(UInt8 * buf, UInt32 length) 58 | { 59 | // would that underflow the buffer? 60 | if(length > fifoDataLength) 61 | return false; 62 | 63 | // will this cross the end of the buffer? 64 | if(fifoBase + length > fifoBufSize) 65 | { 66 | UInt32 segmentLength = fifoBufSize - fifoBase; 67 | 68 | std::memcpy(buf, &fifoBuf[fifoBase], segmentLength); 69 | std::memcpy(&buf[segmentLength], fifoBuf, length - segmentLength); 70 | } 71 | else 72 | { 73 | std::memcpy(buf, &fifoBuf[fifoBase], length); 74 | } 75 | 76 | return true; 77 | } 78 | 79 | void IFIFO::Clear(void) 80 | { 81 | fifoDataLength = 0; 82 | 83 | // this isn't needed, but staying away from the buffer end is always good 84 | fifoBase = 0; 85 | } 86 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusMaterialSwap.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusMaterialSwap.h" 2 | 3 | #include "f4se/GameObjects.h" 4 | #include "f4se/GameData.h" 5 | 6 | #include "f4se/PapyrusStruct.h" 7 | 8 | DECLARE_STRUCT(RemapData, "MatSwap"); 9 | 10 | namespace papyrusMaterialSwap 11 | { 12 | VMArray GetRemapData(BGSMaterialSwap * materialSwap) 13 | { 14 | VMArray result; 15 | if(!materialSwap) 16 | return result; 17 | 18 | materialSwap->materialSwaps.ForEach([&](BGSMaterialSwap::MaterialSwap * swap) 19 | { 20 | RemapData swapData; 21 | swapData.Set("source", swap->source); 22 | swapData.Set("target", swap->target); 23 | swapData.Set("colorIndex", swap->colorRemapIndex); 24 | result.Push(&swapData); 25 | return true; 26 | }); 27 | return result; 28 | } 29 | 30 | void SetRemapData(BGSMaterialSwap * materialSwap, VMArray newData) 31 | { 32 | if(materialSwap && newData.Length()) 33 | { 34 | materialSwap->materialSwaps.Clear(); 35 | 36 | for(int i = 0; i < newData.Length(); ++i) 37 | { 38 | RemapData swapData; 39 | newData.Get(&swapData, i); 40 | 41 | BGSMaterialSwap::MaterialSwap matSwap; 42 | swapData.Get("source", &matSwap.source); 43 | swapData.Get("target", &matSwap.target); 44 | swapData.Get("colorIndex", &matSwap.colorRemapIndex); 45 | matSwap.unk14 = 0; 46 | materialSwap->materialSwaps.Add(&matSwap); 47 | } 48 | } 49 | } 50 | } 51 | 52 | #include "f4se/PapyrusVM.h" 53 | #include "f4se/PapyrusNativeFunctions.h" 54 | 55 | void papyrusMaterialSwap::RegisterFuncs(VirtualMachine* vm) 56 | { 57 | vm->RegisterForm(BGSMaterialSwap::kTypeID, "MatSwap"); 58 | 59 | vm->RegisterFunction( 60 | new NativeFunction0 >("GetRemapData", "MatSwap", papyrusMaterialSwap::GetRemapData, vm)); 61 | 62 | vm->RegisterFunction( 63 | new NativeFunction1 >("SetRemapData", "MatSwap", papyrusMaterialSwap::SetRemapData, vm)); 64 | } 65 | -------------------------------------------------------------------------------- /sfe/f4se_common/Relocation.cpp: -------------------------------------------------------------------------------- 1 | #include "Relocation.h" 2 | 3 | // the goal of this file is to support pointers in to a relocated binary with as little runtime overhead, code bloat, and hassle as possible 4 | // 5 | // since the main executable will always be loaded before the dll, the easiest solution is to perform the relocation in the constructor of 6 | // a pointer class that supports conversion to T*. however, since we can't control anything about initialization order, each constructor 7 | // must call GetModuleHandle(NULL) locally, which sucks. each pointer will need an entry in the static init table, and nothing can be done 8 | // with the pointers in any other static constructors. 9 | // 10 | // one solution to this problem is init_seg(lib). any objects constructed in a file containing this pragma will be constructed before standard 11 | // 'user' level code. this means we can use the constructor of that object to call GetModuleHandle once and initialize a global with the load 12 | // address, which the pointer class constructor then references to fix up the addresses. this still creates an entry in the static init table 13 | // for each pointer, but only calls GetModuleHandle once. pointers are not fixed up until all static init has finished, so other static ctors 14 | // can't safely use pointers. 15 | // 16 | // the problem can't be solved further without moving the RelocPtr constructors in to init_seg(lib), which doesn't appear to be possible 17 | // without forcing all pointers to be defined in a file with init_seg(lib). that is really ugly and doesn't seem like a good idea. 18 | 19 | // anything in this file will initialized after the crt but before any user code 20 | #pragma warning(disable: 4073) // yes this is intentional 21 | #pragma init_seg(lib) 22 | 23 | static RelocationManager s_relocMgr; 24 | 25 | uintptr_t RelocationManager::s_baseAddr = 0; 26 | 27 | RelocationManager::RelocationManager() 28 | { 29 | s_baseAddr = reinterpret_cast(GetModuleHandle(NULL)); 30 | } 31 | -------------------------------------------------------------------------------- /sfe/f4se_common/Relocation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class RelocationManager 4 | { 5 | public: 6 | RelocationManager(); 7 | 8 | static uintptr_t s_baseAddr; 9 | }; 10 | 11 | // use this for addresses that represent pointers to a type T 12 | template 13 | class RelocPtr 14 | { 15 | public: 16 | RelocPtr(uintptr_t offset) 17 | :m_offset(offset + RelocationManager::s_baseAddr) 18 | { 19 | // 20 | } 21 | 22 | operator T *() const 23 | { 24 | return GetPtr(); 25 | } 26 | 27 | T * operator->() const 28 | { 29 | return GetPtr(); 30 | } 31 | 32 | T * GetPtr() const 33 | { 34 | return reinterpret_cast (m_offset); 35 | } 36 | 37 | const T * GetConst() const 38 | { 39 | return reinterpret_cast (m_offset); 40 | } 41 | 42 | uintptr_t GetUIntPtr() const 43 | { 44 | return m_offset; 45 | } 46 | 47 | private: 48 | uintptr_t m_offset; 49 | 50 | // hide 51 | RelocPtr(); 52 | RelocPtr(RelocPtr & rhs); 53 | RelocPtr & operator=(RelocPtr & rhs); 54 | }; 55 | 56 | // use this for direct addresses to types T. needed to avoid ambiguity 57 | template 58 | class RelocAddr 59 | { 60 | public: 61 | RelocAddr(uintptr_t offset) 62 | :m_offset(reinterpret_cast (offset + RelocationManager::s_baseAddr)) 63 | { 64 | // 65 | } 66 | 67 | operator T() 68 | { 69 | return reinterpret_cast (m_offset); 70 | } 71 | 72 | uintptr_t GetUIntPtr() const 73 | { 74 | return reinterpret_cast (m_offset); 75 | } 76 | 77 | private: 78 | // apparently you can't reinterpret_cast from a type to the same type 79 | // that's kind of stupid and makes it impossible to use this for uintptr_ts if I use the same type 80 | // so we make a new type by storing the data in a pointer to this useless struct 81 | // at least this is hidden by a wrapper 82 | struct BlockConversionType { }; 83 | BlockConversionType * m_offset; 84 | 85 | // hide 86 | RelocAddr(); 87 | RelocAddr(RelocAddr & rhs); 88 | RelocAddr & operator=(RelocAddr & rhs); 89 | }; 90 | -------------------------------------------------------------------------------- /common/ISegmentStream.cpp: -------------------------------------------------------------------------------- 1 | #include "common/ISegmentStream.h" 2 | 3 | ISegmentStream::ISegmentStream() 4 | { 5 | streamLength = 0; 6 | } 7 | 8 | ISegmentStream::~ISegmentStream() 9 | { 10 | 11 | } 12 | 13 | void ISegmentStream::AttachStream(IDataStream * inStream) 14 | { 15 | parent = inStream; 16 | streamLength = 0; 17 | streamOffset = 0; 18 | } 19 | 20 | void ISegmentStream::AddSegment(UInt64 offset, UInt64 length, UInt64 parentOffset) 21 | { 22 | segmentInfo.push_back(SegmentInfo(offset, length, parentOffset)); 23 | 24 | if(streamLength < (parentOffset + length)) 25 | streamLength = parentOffset + length; 26 | } 27 | 28 | void ISegmentStream::ReadBuf(void * buf, UInt32 inLength) 29 | { 30 | UInt32 remain = inLength; 31 | UInt8 * out = (UInt8 *)buf; 32 | 33 | while(remain > 0) 34 | { 35 | SegmentInfo * info = LookupInfo(streamOffset); 36 | ASSERT(info); 37 | 38 | UInt64 segmentOffset = streamOffset - info->offset; 39 | UInt64 transferLength = info->length - segmentOffset; 40 | 41 | if(transferLength > remain) 42 | transferLength = remain; 43 | 44 | parent->SetOffset(info->parentOffset + segmentOffset); 45 | parent->ReadBuf(out, transferLength); 46 | 47 | streamOffset += transferLength; 48 | remain -= transferLength; 49 | } 50 | } 51 | 52 | void ISegmentStream::WriteBuf(const void * buf, UInt32 inLength) 53 | { 54 | HALT("ISegmentStream::WriteBuf: writing unsupported"); 55 | } 56 | 57 | void ISegmentStream::SetOffset(SInt64 inOffset) 58 | { 59 | SegmentInfo * info = LookupInfo(inOffset); 60 | ASSERT(info); 61 | 62 | UInt64 segmentOffset = inOffset - info->offset; 63 | 64 | parent->SetOffset(info->parentOffset + segmentOffset); 65 | 66 | streamOffset = inOffset; 67 | } 68 | 69 | ISegmentStream::SegmentInfo * ISegmentStream::LookupInfo(UInt64 offset) 70 | { 71 | for(SegmentInfoListType::iterator iter = segmentInfo.begin(); iter != segmentInfo.end(); iter++) 72 | if((offset >= (*iter).offset) && (offset < (*iter).offset + (*iter).length)) 73 | return &(*iter); 74 | 75 | return NULL; 76 | } 77 | -------------------------------------------------------------------------------- /sfe/f4se/PluginManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "f4se/PluginAPI.h" 7 | 8 | class PluginManager 9 | { 10 | public: 11 | PluginManager(); 12 | ~PluginManager(); 13 | 14 | bool Init(void); 15 | void DeInit(void); 16 | 17 | PluginInfo * GetInfoByName(const char * name); 18 | const char * GetPluginNameFromHandle(PluginHandle handle); 19 | 20 | PluginHandle LookupHandleFromName(const char* pluginName); 21 | 22 | 23 | UInt32 GetNumPlugins(void); 24 | 25 | static void * QueryInterface(UInt32 id); 26 | static PluginHandle GetPluginHandle(void); 27 | static UInt32 GetReleaseIndex(void); 28 | 29 | static bool Dispatch_Message(PluginHandle sender, UInt32 messageType, void * data, UInt32 dataLen, const char* receiver); 30 | static bool RegisterListener(PluginHandle listener, const char* sender, F4SEMessagingInterface::EventCallback handler); 31 | 32 | private: 33 | struct LoadedPlugin 34 | { 35 | // internals 36 | HMODULE handle; 37 | PluginInfo info; 38 | 39 | _F4SEPlugin_Query query; 40 | _F4SEPlugin_Load load; 41 | }; 42 | 43 | bool FindPluginDirectory(void); 44 | void InstallPlugins(void); 45 | 46 | const char * SafeCallQueryPlugin(LoadedPlugin * plugin, const F4SEInterface * f4se); 47 | const char * SafeCallLoadPlugin(LoadedPlugin * plugin, const F4SEInterface * f4se); 48 | 49 | const char * CheckPluginCompatibility(LoadedPlugin * plugin); 50 | 51 | typedef std::vector LoadedPluginList; 52 | 53 | std::string m_pluginDirectory; 54 | LoadedPluginList m_plugins; 55 | 56 | static LoadedPlugin * s_currentLoadingPlugin; 57 | static PluginHandle s_currentPluginHandle; 58 | }; 59 | 60 | extern PluginManager g_pluginManager; 61 | 62 | extern const F4SESerializationInterface g_F4SESerializationInterface; 63 | extern const F4SEPapyrusInterface g_F4SEPapyrusInterface; 64 | extern const F4SEScaleformInterface g_F4SEScaleformInterface; 65 | extern const F4SEMessagingInterface g_F4SEMessagingInterface; 66 | extern const F4SETaskInterface g_F4SETaskInterface; 67 | -------------------------------------------------------------------------------- /common/IErrors.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void _AssertionFailed(const char * file, unsigned long line, const char * desc); 4 | void _AssertionFailed_ErrCode(const char * file, unsigned long line, const char * desc, unsigned long long code); 5 | void _AssertionFailed_ErrCode(const char * file, unsigned long line, const char * desc, const char * code); 6 | 7 | //! Exit the program if the condition is not true 8 | #define ASSERT(a) do { if(!(a)) _AssertionFailed(__FILE__, __LINE__, #a); } while(0) 9 | //! Exit the program if the condition is not true, with an error message 10 | #define ASSERT_STR(a, b) do { if(!(a)) _AssertionFailed(__FILE__, __LINE__, b); } while(0) 11 | //! Exit the program if the condition is not true, reporting an error code 12 | #define ASSERT_CODE(a, b) do { if(!(a)) _AssertionFailed_ErrCode(__FILE__, __LINE__, #a, b); } while(0) 13 | //! Exit the program if the condition is not true, reporting an error code and message 14 | #define ASSERT_STR_CODE(a, b, c) do { if(!(a)) _AssertionFailed_ErrCode(__FILE__, __LINE__, b, c); } while(0) 15 | //! Exit the program with an error message 16 | #define HALT(a) do { _AssertionFailed(__FILE__, __LINE__, a); } while(0) 17 | //! Exit the program with and error code and message 18 | #define HALT_CODE(a, b) do { _AssertionFailed_ErrCode(__FILE__, __LINE__, a, b); } while(0) 19 | 20 | // based on the boost implementation of static asserts 21 | template struct StaticAssertFailure; 22 | template <> struct StaticAssertFailure { enum { a = 1 }; }; 23 | template struct static_assert_test { }; 24 | 25 | #define __MACRO_JOIN__(a, b) __MACRO_JOIN_2__(a, b) 26 | #define __MACRO_JOIN_2__(a, b) __MACRO_JOIN_3__(a, b) 27 | #define __MACRO_JOIN_3__(a, b) a##b 28 | #define __PREPRO_TOKEN_STR2__(a) #a 29 | #define __PREPRO_TOKEN_STR__(a) __PREPRO_TOKEN_STR2__(a) 30 | #define __LOC__ __FILE__ "("__PREPRO_TOKEN_STR__(__LINE__)") : " 31 | 32 | //#define STATIC_ASSERT(a) typedef static_assert_test )> __MACRO_JOIN__(static_assert_typedef_, __COUNTER__) 33 | #define STATIC_ASSERT(a) ;; 34 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusMiscObject.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/papyrusMiscObject.h" 2 | 3 | #include "f4se/PapyrusArgs.h" 4 | #include "f4se/PapyrusStruct.h" 5 | 6 | #include "f4se/GameExtraData.h" 7 | #include "f4se/GameForms.h" 8 | #include "f4se/GameObjects.h" 9 | #include "f4se/GameRTTI.h" 10 | 11 | namespace papyrusMiscObject 12 | { 13 | DECLARE_STRUCT(MiscComponent, "MiscObject") 14 | 15 | VMArray GetMiscComponents(TESObjectMISC * thisObject) 16 | { 17 | VMArray result; 18 | if(!thisObject) 19 | return result; 20 | 21 | if(!thisObject->components) 22 | return result; 23 | 24 | for(UInt32 i = 0; i < thisObject->components->count; i++) 25 | { 26 | TESObjectMISC::Component cp; 27 | thisObject->components->GetNthItem(i, cp); 28 | 29 | MiscComponent comp; 30 | comp.Set("object", cp.component); 31 | comp.Set("count", (UInt32)cp.count); 32 | result.Push(&comp); 33 | } 34 | 35 | return result; 36 | } 37 | 38 | void SetMiscComponents(TESObjectMISC * thisObject, VMArray components) 39 | { 40 | if(thisObject) { 41 | if(!thisObject->components) 42 | thisObject->components = new tArray(); 43 | 44 | thisObject->components->Clear(); 45 | 46 | for(UInt32 i = 0; i < components.Length(); i++) 47 | { 48 | MiscComponent comp; 49 | components.Get(&comp, i); 50 | 51 | UInt32 count; 52 | TESObjectMISC::Component cp; 53 | comp.Get("object", &cp.component); 54 | comp.Get("count", &count); 55 | cp.count = count; 56 | thisObject->components->Push(cp); 57 | } 58 | } 59 | } 60 | } 61 | 62 | #include "f4se/PapyrusVM.h" 63 | #include "f4se/PapyrusNativeFunctions.h" 64 | 65 | void papyrusMiscObject::RegisterFuncs(VirtualMachine* vm) 66 | { 67 | vm->RegisterFunction( 68 | new NativeFunction0 >("GetMiscComponents", "MiscObject", papyrusMiscObject::GetMiscComponents, vm)); 69 | 70 | vm->RegisterFunction( 71 | new NativeFunction1 >("SetMiscComponents", "MiscObject", papyrusMiscObject::SetMiscComponents, vm)); 72 | } 73 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/blowfish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_BLOWFISH_H 11 | # define HEADER_BLOWFISH_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_BF 16 | # include 17 | # ifdef __cplusplus 18 | extern "C" { 19 | # endif 20 | 21 | # define BF_ENCRYPT 1 22 | # define BF_DECRYPT 0 23 | 24 | /*- 25 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 26 | * ! BF_LONG has to be at least 32 bits wide. ! 27 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 28 | */ 29 | # define BF_LONG unsigned int 30 | 31 | # define BF_ROUNDS 16 32 | # define BF_BLOCK 8 33 | 34 | typedef struct bf_key_st { 35 | BF_LONG P[BF_ROUNDS + 2]; 36 | BF_LONG S[4 * 256]; 37 | } BF_KEY; 38 | 39 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); 40 | 41 | void BF_encrypt(BF_LONG *data, const BF_KEY *key); 42 | void BF_decrypt(BF_LONG *data, const BF_KEY *key); 43 | 44 | void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, 45 | const BF_KEY *key, int enc); 46 | void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 47 | const BF_KEY *schedule, unsigned char *ivec, int enc); 48 | void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, 49 | long length, const BF_KEY *schedule, 50 | unsigned char *ivec, int *num, int enc); 51 | void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, 52 | long length, const BF_KEY *schedule, 53 | unsigned char *ivec, int *num); 54 | const char *BF_options(void); 55 | 56 | # ifdef __cplusplus 57 | } 58 | # endif 59 | # endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/rc5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RC5_H 11 | # define HEADER_RC5_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_RC5 16 | # ifdef __cplusplus 17 | extern "C" { 18 | # endif 19 | 20 | # define RC5_ENCRYPT 1 21 | # define RC5_DECRYPT 0 22 | 23 | # define RC5_32_INT unsigned int 24 | 25 | # define RC5_32_BLOCK 8 26 | # define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ 27 | 28 | /* 29 | * This are the only values supported. Tweak the code if you want more The 30 | * most supported modes will be RC5-32/12/16 RC5-32/16/8 31 | */ 32 | # define RC5_8_ROUNDS 8 33 | # define RC5_12_ROUNDS 12 34 | # define RC5_16_ROUNDS 16 35 | 36 | typedef struct rc5_key_st { 37 | /* Number of rounds */ 38 | int rounds; 39 | RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; 40 | } RC5_32_KEY; 41 | 42 | void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, 43 | int rounds); 44 | void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, 45 | RC5_32_KEY *key, int enc); 46 | void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); 47 | void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); 48 | void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, 49 | long length, RC5_32_KEY *ks, unsigned char *iv, 50 | int enc); 51 | void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, 52 | long length, RC5_32_KEY *schedule, 53 | unsigned char *ivec, int *num, int enc); 54 | void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, 55 | long length, RC5_32_KEY *schedule, 56 | unsigned char *ivec, int *num); 57 | 58 | # ifdef __cplusplus 59 | } 60 | # endif 61 | # endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/kdferr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_KDFERR_H 12 | # define HEADER_KDFERR_H 13 | 14 | # ifdef __cplusplus 15 | extern "C" 16 | # endif 17 | int ERR_load_KDF_strings(void); 18 | 19 | /* 20 | * KDF function codes. 21 | */ 22 | # define KDF_F_PKEY_HKDF_CTRL_STR 103 23 | # define KDF_F_PKEY_HKDF_DERIVE 102 24 | # define KDF_F_PKEY_HKDF_INIT 108 25 | # define KDF_F_PKEY_SCRYPT_CTRL_STR 104 26 | # define KDF_F_PKEY_SCRYPT_CTRL_UINT64 105 27 | # define KDF_F_PKEY_SCRYPT_DERIVE 109 28 | # define KDF_F_PKEY_SCRYPT_INIT 106 29 | # define KDF_F_PKEY_SCRYPT_SET_MEMBUF 107 30 | # define KDF_F_PKEY_TLS1_PRF_CTRL_STR 100 31 | # define KDF_F_PKEY_TLS1_PRF_DERIVE 101 32 | # define KDF_F_PKEY_TLS1_PRF_INIT 110 33 | # define KDF_F_TLS1_PRF_ALG 111 34 | 35 | /* 36 | * KDF reason codes. 37 | */ 38 | # define KDF_R_INVALID_DIGEST 100 39 | # define KDF_R_MISSING_ITERATION_COUNT 109 40 | # define KDF_R_MISSING_KEY 104 41 | # define KDF_R_MISSING_MESSAGE_DIGEST 105 42 | # define KDF_R_MISSING_PARAMETER 101 43 | # define KDF_R_MISSING_PASS 110 44 | # define KDF_R_MISSING_SALT 111 45 | # define KDF_R_MISSING_SECRET 107 46 | # define KDF_R_MISSING_SEED 106 47 | # define KDF_R_UNKNOWN_PARAMETER_TYPE 103 48 | # define KDF_R_VALUE_ERROR 108 49 | # define KDF_R_VALUE_MISSING 102 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusPerk.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusPerk.h" 2 | 3 | #include "f4se/GameForms.h" 4 | #include "f4se/GameFormComponents.h" 5 | #include "f4se/GameReferences.h" 6 | 7 | namespace papyrusPerk 8 | { 9 | bool IsPlayable(BGSPerk* thisPerk) 10 | { 11 | return thisPerk ? (thisPerk->playable >= 0) : false; 12 | } 13 | 14 | bool IsHidden(BGSPerk* thisPerk) 15 | { 16 | return thisPerk ? (thisPerk->hidden >= 0) : false; 17 | } 18 | 19 | UInt32 GetLevel(BGSPerk* thisPerk) 20 | { 21 | return thisPerk ? thisPerk->perkLevel : 0; 22 | } 23 | 24 | UInt32 GetNumRanks(BGSPerk* thisPerk) 25 | { 26 | return thisPerk ? thisPerk->numRanks : 0; 27 | } 28 | 29 | BGSPerk* GetNextPerk(BGSPerk* thisPerk) 30 | { 31 | return thisPerk ? thisPerk->nextPerk : nullptr; 32 | } 33 | 34 | BSFixedString GetSWFPath(BGSPerk* thisPerk) 35 | { 36 | return thisPerk ? thisPerk->swfPath : BSFixedString(); 37 | } 38 | 39 | bool IsEligible(BGSPerk* thisPerk, Actor * actor) 40 | { 41 | if(!thisPerk || !actor) 42 | return false; 43 | 44 | Condition ** condition = &thisPerk->condition; 45 | if(condition) 46 | return EvaluationConditions(condition, actor, actor); 47 | 48 | // No conditions to fulfill 49 | return true; 50 | } 51 | } 52 | 53 | #include "f4se/PapyrusVM.h" 54 | #include "f4se/PapyrusNativeFunctions.h" 55 | 56 | void papyrusPerk::RegisterFuncs(VirtualMachine* vm) 57 | { 58 | vm->RegisterFunction( 59 | new NativeFunction0 ("IsPlayable", "Perk", papyrusPerk::IsPlayable, vm)); 60 | 61 | vm->RegisterFunction( 62 | new NativeFunction0 ("IsHidden", "Perk", papyrusPerk::IsHidden, vm)); 63 | 64 | vm->RegisterFunction( 65 | new NativeFunction0 ("GetLevel", "Perk", papyrusPerk::GetLevel, vm)); 66 | 67 | vm->RegisterFunction( 68 | new NativeFunction0 ("GetNumRanks", "Perk", papyrusPerk::GetNumRanks, vm)); 69 | 70 | vm->RegisterFunction( 71 | new NativeFunction0 ("GetNextPerk", "Perk", papyrusPerk::GetNextPerk, vm)); 72 | 73 | vm->RegisterFunction( 74 | new NativeFunction0 ("GetSWFPath", "Perk", papyrusPerk::GetSWFPath, vm)); 75 | 76 | vm->RegisterFunction( 77 | new NativeFunction1 ("IsEligible", "Perk", papyrusPerk::IsEligible, vm)); 78 | } 79 | -------------------------------------------------------------------------------- /common/IArchive.cpp: -------------------------------------------------------------------------------- 1 | #include "IArchive.h" 2 | #include "IErrors.h" 3 | 4 | #if ENABLE_IDYNAMICCREATE 5 | 6 | IDynamic * IArchive::iterator::Instantiate(void) 7 | { 8 | IDataSubStream subStream(owner->theStream, GetDataOffset(), GetDataLength()); 9 | 10 | return IClassRegistry::Instantiate(GetTypeID(), &subStream); 11 | } 12 | 13 | void * IArchive::iterator::GetBuffer(UInt32 * outLength) 14 | { 15 | HeaderEntry * entry = GetData(); 16 | UInt8 * buf = new UInt8[entry->dataLength]; 17 | 18 | owner->theStream->SetOffset(entry->dataOffset); 19 | owner->theStream->ReadBuf(buf, entry->dataLength); 20 | 21 | if(outLength) 22 | *outLength = entry->dataLength; 23 | 24 | return buf; 25 | } 26 | 27 | void IArchive::iterator::NextOfType(UInt32 typeID) 28 | { 29 | idx++; 30 | 31 | while((GetData()->typeID != typeID) && (idx < owner->header.numEntries)) 32 | idx++; 33 | } 34 | 35 | void IArchive::iterator::PrevOfType(UInt32 typeID) 36 | { 37 | idx--; 38 | 39 | while((GetData()->typeID != typeID) && (idx > 0)) 40 | idx--; 41 | } 42 | 43 | IArchive::IArchive() 44 | :theStream(NULL), entries(NULL), nameTable(NULL) 45 | { 46 | 47 | } 48 | 49 | IArchive::IArchive(IDataStream * stream) 50 | :theStream(NULL), entries(NULL), nameTable(NULL) 51 | { 52 | AttachStream(stream); 53 | } 54 | 55 | IArchive::~IArchive() 56 | { 57 | Dispose(); 58 | } 59 | 60 | void IArchive::AttachStream(IDataStream * inStream) 61 | { 62 | Dispose(); 63 | 64 | theStream = inStream; 65 | } 66 | 67 | void IArchive::Dispose(void) 68 | { 69 | if(entries) 70 | { 71 | delete entries; 72 | entries = NULL; 73 | } 74 | 75 | if(nameTable) 76 | { 77 | delete nameTable; 78 | nameTable = NULL; 79 | } 80 | } 81 | 82 | void IArchive::ReadHeader(void) 83 | { 84 | ASSERT(theStream); 85 | 86 | theStream->Rewind(); 87 | 88 | theStream->ReadBuf(&header, sizeof(FileHeader)); 89 | 90 | entries = new HeaderEntry[header.numEntries]; 91 | theStream->ReadBuf(entries, header.numEntries * sizeof(HeaderEntry)); 92 | 93 | if(header.nameTableLength) 94 | { 95 | nameTable = new char[header.nameTableLength]; 96 | 97 | theStream->SetOffset(header.nameTableOffset); 98 | theStream->ReadBuf(nameTable, header.nameTableLength); 99 | } 100 | } 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /sfe/xbyak/COPYRIGHT: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2007 MITSUNARI Shigeo 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | Neither the name of the copyright owner nor the names of its contributors may 14 | be used to endorse or promote products derived from this software without 15 | specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 | THE POSSIBILITY OF SUCH DAMAGE. 28 | ----------------------------------------------------------------------------- 29 | ソースコード形式かバイナリ形式か、変更するかしないかを問わず、以下の条件を満た 30 | す場合に限り、再頒布および使用が許可されます。 31 | 32 | ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、および下記免責条項 33 | を含めること。 34 | バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の資料に、上記の著作 35 | 権表示、本条件一覧、および下記免責条項を含めること。 36 | 書面による特別の許可なしに、本ソフトウェアから派生した製品の宣伝または販売促進 37 | に、著作権者の名前またはコントリビューターの名前を使用してはならない。 38 | 本ソフトウェアは、著作権者およびコントリビューターによって「現状のまま」提供さ 39 | れており、明示黙示を問わず、商業的な使用可能性、および特定の目的に対する適合性 40 | に関する暗黙の保証も含め、またそれに限定されない、いかなる保証もありません。 41 | 著作権者もコントリビューターも、事由のいかんを問わず、 損害発生の原因いかんを 42 | 問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その他の)不法行為で 43 | あるかを問わず、仮にそのような損害が発生する可能性を知らされていたとしても、 44 | 本ソフトウェアの使用によって発生した(代替品または代用サービスの調達、使用の 45 | 喪失、データの喪失、利益の喪失、業務の中断も含め、またそれに限定されない)直接 46 | 損害、間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害について、 47 | 一切責任を負わないものとします。 48 | -------------------------------------------------------------------------------- /sfe/f4se/PapyrusHeadPart.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/PapyrusHeadPart.h" 2 | 3 | #include "f4se/PapyrusVM.h" 4 | #include "f4se/PapyrusNativeFunctions.h" 5 | 6 | #include "f4se/GameObjects.h" 7 | #include "f4se/GameData.h" 8 | 9 | namespace papyrusHeadPart 10 | { 11 | UInt32 GetType(BGSHeadPart* thisPart) 12 | { 13 | if(!thisPart) 14 | return 0; 15 | return thisPart->type; 16 | } 17 | 18 | VMArray GetExtraParts(BGSHeadPart* thisPart) 19 | { 20 | VMArray result; 21 | if(!thisPart) 22 | return result; 23 | 24 | BGSHeadPart* headPart; 25 | for(UInt32 i = 0; i < thisPart->extraParts.count; i++) 26 | { 27 | thisPart->extraParts.GetNthItem(i, headPart); 28 | result.Push(&headPart); 29 | } 30 | 31 | return result; 32 | } 33 | 34 | bool IsExtraPart(BGSHeadPart* thisPart) 35 | { 36 | return (thisPart && thisPart->IsExtraPart()) ? true : false; 37 | } 38 | 39 | bool HasExtraPart(BGSHeadPart* thisPart, BGSHeadPart* extraPart) 40 | { 41 | return (thisPart && thisPart->extraParts.GetItemIndex(extraPart) != -1) ? true : false; 42 | } 43 | 44 | BGSListForm* GetValidRaces(BGSHeadPart* thisPart) 45 | { 46 | return (thisPart) ? thisPart->validRaces : NULL; 47 | } 48 | 49 | void SetValidRaces(BGSHeadPart* thisPart, BGSListForm* raceList) 50 | { 51 | if(thisPart && raceList) { 52 | thisPart->validRaces = raceList; 53 | } 54 | } 55 | } 56 | 57 | void papyrusHeadPart::RegisterFuncs(VirtualMachine* vm) 58 | { 59 | vm->RegisterFunction( 60 | new NativeFunction0("GetType", "HeadPart", papyrusHeadPart::GetType, vm)); 61 | 62 | vm->RegisterFunction( 63 | new NativeFunction0>("GetExtraParts", "HeadPart", papyrusHeadPart::GetExtraParts, vm)); 64 | 65 | vm->RegisterFunction( 66 | new NativeFunction1("HasExtraPart", "HeadPart", papyrusHeadPart::HasExtraPart, vm)); 67 | 68 | vm->RegisterFunction( 69 | new NativeFunction0("IsExtraPart", "HeadPart", papyrusHeadPart::IsExtraPart, vm)); 70 | 71 | vm->RegisterFunction( 72 | new NativeFunction0("GetValidRaces", "HeadPart", papyrusHeadPart::GetValidRaces, vm)); 73 | 74 | vm->RegisterFunction( 75 | new NativeFunction1("SetValidRaces", "HeadPart", papyrusHeadPart::SetValidRaces, vm)); 76 | } 77 | -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/idea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_IDEA_H 11 | # define HEADER_IDEA_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_IDEA 16 | # ifdef __cplusplus 17 | extern "C" { 18 | # endif 19 | 20 | typedef unsigned int IDEA_INT; 21 | 22 | # define IDEA_ENCRYPT 1 23 | # define IDEA_DECRYPT 0 24 | 25 | # define IDEA_BLOCK 8 26 | # define IDEA_KEY_LENGTH 16 27 | 28 | typedef struct idea_key_st { 29 | IDEA_INT data[9][6]; 30 | } IDEA_KEY_SCHEDULE; 31 | 32 | const char *IDEA_options(void); 33 | void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out, 34 | IDEA_KEY_SCHEDULE *ks); 35 | void IDEA_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); 36 | void IDEA_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); 37 | void IDEA_cbc_encrypt(const unsigned char *in, unsigned char *out, 38 | long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, 39 | int enc); 40 | void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out, 41 | long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, 42 | int *num, int enc); 43 | void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out, 44 | long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, 45 | int *num); 46 | void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); 47 | 48 | # if OPENSSL_API_COMPAT < 0x10100000L 49 | # define idea_options IDEA_options 50 | # define idea_ecb_encrypt IDEA_ecb_encrypt 51 | # define idea_set_encrypt_key IDEA_set_encrypt_key 52 | # define idea_set_decrypt_key IDEA_set_decrypt_key 53 | # define idea_cbc_encrypt IDEA_cbc_encrypt 54 | # define idea_cfb64_encrypt IDEA_cfb64_encrypt 55 | # define idea_ofb64_encrypt IDEA_ofb64_encrypt 56 | # define idea_encrypt IDEA_encrypt 57 | # endif 58 | 59 | # ifdef __cplusplus 60 | } 61 | # endif 62 | # endif 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /sfe/f4se/NiTypes.cpp: -------------------------------------------------------------------------------- 1 | #include "f4se/NiTypes.h" 2 | 3 | NiPoint3::NiPoint3() 4 | { 5 | x = 0.0f; 6 | y = 0.0f; 7 | z = 0.0f; 8 | } 9 | 10 | NiPoint3 NiPoint3::operator- () const 11 | { 12 | return NiPoint3(-x, -y, -z); 13 | } 14 | 15 | NiPoint3 NiPoint3::operator+ (const NiPoint3& pt) const 16 | { 17 | return NiPoint3(x + pt.x, y + pt.y, z + pt.z); 18 | } 19 | 20 | NiPoint3 NiPoint3::operator- (const NiPoint3& pt) const 21 | { 22 | return NiPoint3(x - pt.x, y - pt.y, z - pt.z); 23 | } 24 | 25 | NiPoint3& NiPoint3::operator+= (const NiPoint3& pt) 26 | { 27 | x += pt.x; 28 | y += pt.y; 29 | z += pt.z; 30 | return *this; 31 | } 32 | NiPoint3& NiPoint3::operator-= (const NiPoint3& pt) 33 | { 34 | x -= pt.x; 35 | y -= pt.y; 36 | z -= pt.z; 37 | return *this; 38 | } 39 | 40 | // Scalar operations 41 | NiPoint3 NiPoint3::operator* (float scalar) const 42 | { 43 | return NiPoint3(scalar * x, scalar * y, scalar * z); 44 | } 45 | NiPoint3 NiPoint3::operator/ (float scalar) const 46 | { 47 | float invScalar = 1.0f / scalar; 48 | return NiPoint3(invScalar * x, invScalar * y, invScalar * z); 49 | } 50 | 51 | NiPoint3& NiPoint3::operator*= (float scalar) 52 | { 53 | x *= scalar; 54 | y *= scalar; 55 | z *= scalar; 56 | return *this; 57 | } 58 | NiPoint3& NiPoint3::operator/= (float scalar) 59 | { 60 | float invScalar = 1.0f / scalar; 61 | x *= invScalar; 62 | y *= invScalar; 63 | z *= invScalar; 64 | return *this; 65 | } 66 | 67 | NiPoint3 NiMatrix43::operator* (const NiPoint3& pt) const 68 | { 69 | return NiPoint3 70 | ( 71 | data[0][0]*pt.x+data[0][1]*pt.y+data[0][2]*pt.z, 72 | data[1][0]*pt.x+data[1][1]*pt.y+data[1][2]*pt.z, 73 | data[2][0]*pt.x+data[2][1]*pt.y+data[2][2]*pt.z 74 | ); 75 | } 76 | 77 | NiMatrix43 NiMatrix43::Transpose() const 78 | { 79 | NiMatrix43 result; 80 | result.data[0][0] = data[0][0]; 81 | result.data[0][1] = data[1][0]; 82 | result.data[0][2] = data[2][0]; 83 | result.data[0][3] = data[0][3]; 84 | result.data[1][0] = data[0][1]; 85 | result.data[1][1] = data[1][1]; 86 | result.data[1][2] = data[2][1]; 87 | result.data[1][3] = data[1][3]; 88 | result.data[2][0] = data[0][2]; 89 | result.data[2][1] = data[1][2]; 90 | result.data[2][2] = data[2][2]; 91 | result.data[2][3] = data[2][3]; 92 | return result; 93 | } 94 | 95 | NiPoint3 NiTransform::operator*(const NiPoint3 & pt) const 96 | { 97 | return (((rot * pt) * scale) + pos); 98 | } 99 | -------------------------------------------------------------------------------- /sfe/f4se/NiNodes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se/NiObjects.h" 4 | #include "f4se/BSLight.h" 5 | 6 | // 140 7 | class NiNode : public NiAVObject 8 | { 9 | public: 10 | virtual void Unk_39(void); 11 | virtual void AttachChild(NiAVObject * obj, bool firstAvail); 12 | virtual void InsertChildAt(UInt32 index, NiAVObject * obj); 13 | virtual void DetachChild(NiAVObject * obj, NiPointer & out); 14 | virtual void RemoveChild(NiAVObject * obj); 15 | virtual void DetachChildAt(UInt32 i, NiPointer & out); 16 | virtual void RemoveChildAt(UInt32 i); 17 | virtual void SetAt(UInt32 index, NiAVObject * obj, NiPointer & replaced); 18 | virtual void SetAt(UInt32 index, NiAVObject * obj); 19 | virtual void Unk_42(void); 20 | 21 | NiTArray m_children; // 120 22 | float unk138; 23 | float unk13C; 24 | 25 | static NiNode * Create(UInt16 children = 0); 26 | 27 | MEMBER_FN_PREFIX(NiNode); 28 | DEFINE_MEMBER_FN(ctor, NiNode*, 0x01B98800, UInt16 children); 29 | }; 30 | STATIC_ASSERT(sizeof(NiNode) == 0x140); 31 | 32 | // 1C0 33 | class BSFadeNode : public NiNode 34 | { 35 | public: 36 | virtual ~BSFadeNode(); 37 | 38 | struct FlattenedGeometryData 39 | { 40 | NiBound kBound; // 00 41 | NiPointer spGeometry; // 10 42 | UInt32 uiFlags; // 18 43 | }; 44 | 45 | BSShaderPropertyLightData kLightData; // 140 46 | tArray kGeomArray; // 168 47 | tArray MergedGeomBoundsA; // 180 48 | float fNearDistSqr; // 198 49 | float fFarDistSqr; // 19C 50 | float fCurrentFade; // 1A0 51 | float fCurrentDecalFade; // 1A4 52 | float fBoundRadius; // 1A8 53 | float fTimeSinceUpdate; // 1AC 54 | SInt32 iFrameCounter; // 1B0 55 | float fPreviousMaxA; // 1B4 56 | float fCurrentShaderLODLevel; // 1B8 57 | float fPreviousShaderLODLevel; // 1BC 58 | }; 59 | 60 | // 190 61 | class BSFaceGenNiNode : public NiNode 62 | { 63 | public: 64 | UInt64 unk140[(0x178 - 0x140) >> 3]; // 140 65 | UInt32 unk178; // 178 66 | 67 | // 1FA2A8F9E63D0F771FC6A9BAB875E88A9215810B 68 | enum 69 | { 70 | kFlag_UpdateModel = (1 << 0), 71 | kFlag_Unk1 = (1 << 7), 72 | kFlag_Unk2 = (1 << 8) 73 | }; 74 | 75 | UInt32 flags; // 17C 76 | UInt64 unk180; // 180 77 | UInt64 unk188; // 188 78 | }; 79 | -------------------------------------------------------------------------------- /sfe/f4se/ScaleformCallbacks.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "f4se_common/Utilities.h" 4 | 5 | #include "f4se/ScaleformTypes.h" 6 | #include "f4se/ScaleformMovie.h" 7 | 8 | #include 9 | #include 10 | 11 | class GFxValue; 12 | class GFxMovieView; 13 | 14 | class GFxFunctionHandler : public GRefCountBase 15 | { 16 | public: 17 | GFxFunctionHandler(); 18 | virtual ~GFxFunctionHandler(); 19 | 20 | // 38 21 | class Args 22 | { 23 | public: 24 | GFxValue * result; // 00 25 | GFxMovieView * movie; // 08 26 | GFxValue * thisObj; // 10 27 | GFxValue * unk18; // 18 28 | GFxValue * args; // 20 29 | UInt32 numArgs; // 28 30 | UInt32 pad2C; // 2C 31 | UInt32 optionID; // 30 pUserData 32 | }; 33 | 34 | virtual void Invoke(Args * args) = 0; 35 | }; 36 | 37 | typedef std::map FunctionHandlerCache; 38 | extern FunctionHandlerCache g_functionHandlerCache; 39 | 40 | template 41 | void CreateFunction(GFxValue * dst, GFxMovieRoot * movie) 42 | { 43 | // either allocate the object or retrieve an existing instance from the cache 44 | GFxFunctionHandler * fn = nullptr; 45 | 46 | // check the cache 47 | FunctionHandlerCache::iterator iter = g_functionHandlerCache.find(&typeid(T)); 48 | if(iter != g_functionHandlerCache.end()) 49 | fn = iter->second; 50 | 51 | if(!fn) 52 | { 53 | // not found, allocate a new one 54 | fn = new T; 55 | 56 | // add it to the cache 57 | // cache now owns the object as far as refcounting goes 58 | g_functionHandlerCache[&typeid(T)] = fn; 59 | } 60 | 61 | // create the function object 62 | movie->CreateFunction(dst, fn); 63 | } 64 | 65 | template 66 | void RegisterFunction(GFxValue * dst, GFxMovieRoot * movie, const char * name) 67 | { 68 | // either allocate the object or retrieve an existing instance from the cache 69 | GFxValue fnValue; 70 | CreateFunction(&fnValue, movie); 71 | dst->SetMember(name, &fnValue); 72 | } 73 | 74 | class BSGFxFunctionHandler : public GFxFunctionHandler 75 | { 76 | public: 77 | virtual ~BSGFxFunctionHandler() { }; 78 | }; 79 | 80 | class SWFToCodeFunctionHandler : public GFxFunctionHandler 81 | { 82 | public: 83 | virtual ~SWFToCodeFunctionHandler() { } 84 | virtual void RegisterFunctions() = 0; // 02 85 | 86 | DEFINE_MEMBER_FN_2(RegisterNativeFunction, void, 0x02110270, const char * name, UInt32 index); 87 | }; -------------------------------------------------------------------------------- /sfe/openssl/include/openssl/cryptoerr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_CRYPTOERR_H 12 | # define HEADER_CRYPTOERR_H 13 | 14 | # ifdef __cplusplus 15 | extern "C" 16 | # endif 17 | 18 | # include 19 | 20 | int ERR_load_CRYPTO_strings(void); 21 | 22 | /* 23 | * CRYPTO function codes. 24 | */ 25 | # define CRYPTO_F_CMAC_CTX_NEW 120 26 | # define CRYPTO_F_CRYPTO_DUP_EX_DATA 110 27 | # define CRYPTO_F_CRYPTO_FREE_EX_DATA 111 28 | # define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 29 | # define CRYPTO_F_CRYPTO_MEMDUP 115 30 | # define CRYPTO_F_CRYPTO_NEW_EX_DATA 112 31 | # define CRYPTO_F_CRYPTO_OCB128_COPY_CTX 121 32 | # define CRYPTO_F_CRYPTO_OCB128_INIT 122 33 | # define CRYPTO_F_CRYPTO_SET_EX_DATA 102 34 | # define CRYPTO_F_FIPS_MODE_SET 109 35 | # define CRYPTO_F_GET_AND_LOCK 113 36 | # define CRYPTO_F_OPENSSL_ATEXIT 114 37 | # define CRYPTO_F_OPENSSL_BUF2HEXSTR 117 38 | # define CRYPTO_F_OPENSSL_FOPEN 119 39 | # define CRYPTO_F_OPENSSL_HEXSTR2BUF 118 40 | # define CRYPTO_F_OPENSSL_INIT_CRYPTO 116 41 | # define CRYPTO_F_OPENSSL_LH_NEW 126 42 | # define CRYPTO_F_OPENSSL_SK_DEEP_COPY 127 43 | # define CRYPTO_F_OPENSSL_SK_DUP 128 44 | # define CRYPTO_F_PKEY_HMAC_INIT 123 45 | # define CRYPTO_F_PKEY_POLY1305_INIT 124 46 | # define CRYPTO_F_PKEY_SIPHASH_INIT 125 47 | # define CRYPTO_F_SK_RESERVE 129 48 | 49 | /* 50 | * CRYPTO reason codes. 51 | */ 52 | # define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101 53 | # define CRYPTO_R_ILLEGAL_HEX_DIGIT 102 54 | # define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103 55 | 56 | #endif 57 | --------------------------------------------------------------------------------