diff --git a/.clang-format b/.clang-format index 415f78e..1190c21 100644 --- a/.clang-format +++ b/.clang-format @@ -1,9 +1,9 @@ ---- +--- AccessModifierOffset: -4 AlignAfterOpenBracket: DontAlign AlignConsecutiveAssignments: 'false' AlignConsecutiveBitFields: 'false' -AlignConsecutiveDeclarations: 'false' +AlignConsecutiveDeclarations: 'true' AlignConsecutiveMacros: 'false' AlignEscapedNewlines: Left AlignOperands: Align diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e2343e..9a54094 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,10 +16,14 @@ jobs: with: CMAKE_VR_CONFIG_PRESET: '' CMAKE_VR_BUILD_PRESET: '' - AE_353_BRANCH: master-1.6.353 FOMOD_INCLUDE_PDB: true FOMOD_MOD_NAME: "Frozen Electrocuted Combustion" FOMOD_MOD_AUTHOR: "powerofthree" FOMOD_MOD_NEXUS_ID: "3532" FOMOD_REQUIRED_INSTALLATION_DIR: "Skyrim/Data" + FOMOD_AE_NAME: 'SSE v1.640+ ("Anniversary Edition")' + FOMOD_AE_DESCR: 'Select this if you are using Skyrim Anniversary Edition v1.6.640 or higher.' + FOMOD_AE_MIN_GAME_VERSION: '1.6' PUBLISH_ARCHIVE_TYPE: '7z' + VCPKG_COMMIT_ID: '198d68dbcc6c907cb3d0b9b1d93c3df6ecf93c62' + diff --git a/.github/workflows/maintenance.yml b/.github/workflows/maintenance.yml index 69687e1..b026c24 100644 --- a/.github/workflows/maintenance.yml +++ b/.github/workflows/maintenance.yml @@ -7,18 +7,18 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: actions/setup-python@v2 - with: - python-version: "3.9" + - uses: actions/setup-python@v5 + with: + python-version: '3.10' - - name: Run clang-format - run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format-14 -style=file -i + - name: Run clang-format + run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format-14 -style=file -i - - name: Glob files - run: python ${{ github.workspace }}/ProjectGen.py + - name: Glob files + run: python ${{ github.workspace }}/ProjectGen.py - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: maintenance + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: maintenance diff --git a/CMakeLists.txt b/CMakeLists.txt index ff7b0ab..24283fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,6 +134,7 @@ find_path(SRELL_INCLUDE_DIRS "srell.hpp") find_path(CLIB_UTIL_INCLUDE_DIRS "ClibUtil/utils.hpp") find_package(frozen CONFIG REQUIRED) +find_package(unordered_dense CONFIG REQUIRED) # ---- Add source files ---- include(cmake/headerlist.cmake) @@ -186,6 +187,7 @@ target_link_libraries( PRIVATE ${CommonLibName}::${CommonLibName} frozen::frozen + unordered_dense::unordered_dense ) target_precompile_headers( diff --git a/CMakePresets.json b/CMakePresets.json index 5bab6a1..0c0b350 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,121 +1,115 @@ { + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, "configurePresets": [ { - "binaryDir": "${sourceDir}/build", + "name": "cmake-dev", + "hidden": true, "cacheVariables": { - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "Release" - } + "CMAKE_CONFIGURATION_TYPES": "Debug;Release", + "CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /external:anglebrackets /external:W0 $penv{CXXFLAGS}" }, "errors": { "deprecated": true }, - "hidden": true, - "name": "cmake-dev", "warnings": { "deprecated": true, "dev": true } }, { - "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": { - "type": "STRING", - "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" - }, - "VCPKG_OVERLAY_PORTS": { - "type": "STRING", - "value": "${sourceDir}/cmake/ports/" - } - }, + "name": "vcpkg", "hidden": true, - "name": "vcpkg" + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "cacheVariables": { + "VCPKG_OVERLAY_PORTS": "${sourceDir}/cmake/ports/" + } }, { + "name": "windows", + "hidden": true, "cacheVariables": { - "CMAKE_MSVC_RUNTIME_LIBRARY": { - "type": "STRING", - "value": "MultiThreaded$<$:Debug>" - }, - "VCPKG_TARGET_TRIPLET": { - "type": "STRING", - "value": "x64-windows-static" - } - }, + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$:Debug>", + "VCPKG_TARGET_TRIPLET": "x64-windows-static" + } + }, + { + "name": "vs2022", + "hidden": true, + "generator": "Visual Studio 17 2022", + "toolset": "v143" + }, + { + "name": "se", "hidden": true, - "name": "windows" + "binaryDir": "${sourceDir}/build" }, { + "name": "ae", + "hidden": true, "binaryDir": "${sourceDir}/buildae", "cacheVariables": { "BUILD_SKYRIMAE": true - }, - "hidden": true, - "name": "ae" + } }, { + "name": "vr", + "hidden": true, "binaryDir": "${sourceDir}/buildvr", "cacheVariables": { "BUILD_SKYRIMVR": true - }, - "hidden": true, - "name": "vr" + } }, { - "cacheVariables": { - "CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /external:anglebrackets /external:W0 $penv{CXXFLAGS}" - }, - "generator": "Visual Studio 16 2019", + "name": "vs2022-windows-vcpkg-se", "inherits": [ - "vr", "cmake-dev", "vcpkg", - "windows" - ], - "name": "vs2019-windows-vcpkg-vr" + "windows", + "vs2022", + "se" + ] }, { - "cacheVariables": { - "CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /external:anglebrackets /external:W0 $penv{CXXFLAGS}" - }, - "generator": "Visual Studio 17 2022", + "name": "vs2022-windows-vcpkg-ae", "inherits": [ "cmake-dev", "vcpkg", - "windows" - ], - "name": "vs2022-windows-vcpkg-se", - "toolset": "v143" + "windows", + "vs2022", + "ae" + ] }, { - "cacheVariables": { - "CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /external:anglebrackets /external:W0 $penv{CXXFLAGS}" - }, - "generator": "Visual Studio 17 2022", - "inherits": [ - "vr", - "cmake-dev", - "vcpkg", - "windows" - ], "name": "vs2022-windows-vcpkg-vr", - "toolset": "v143" - }, - { - "cacheVariables": { - "CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /external:anglebrackets /external:W0 $penv{CXXFLAGS}" - }, - "generator": "Visual Studio 17 2022", "inherits": [ - "ae", "cmake-dev", "vcpkg", - "windows" - ], - "name": "vs2022-windows-vcpkg-ae", - "toolset": "v143" + "windows", + "vs2022", + "vr" + ] } ], - "version": 3 + "buildPresets": [ + { + "name": "vs2022-windows-vcpkg-ae", + "configurePreset": "vs2022-windows-vcpkg-ae", + "configuration": "Release" + }, + { + "name": "vs2022-windows-vcpkg-se", + "configurePreset": "vs2022-windows-vcpkg-se", + "configuration": "Release" + }, + { + "name": "vs2022-windows-vcpkg-vr", + "configurePreset": "vs2022-windows-vcpkg-vr", + "configuration": "Release" + } + ] } diff --git a/LICENSE b/LICENSE index 5f46588..74f4487 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 powerofthree +Copyright (c) 2021-2024 powerofthree Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/cmake/ports/clib-util/portfile.cmake b/cmake/ports/clib-util/portfile.cmake index c8722b3..e099051 100644 --- a/cmake/ports/clib-util/portfile.cmake +++ b/cmake/ports/clib-util/portfile.cmake @@ -2,8 +2,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO powerof3/CLibUtil - REF 8dff3f8f064ba662d987b94e1b007ff299cf4ef1 - SHA512 fdc0a82aa8e6863eefc968e45df2aaf782e1ccad083fa4fd308f6dc53a402641ad1efc26ca9eae2a2526be30def6c3d865719c4a9d82d575b218aac7ef581ba4 + REF 88d78d94464a04e582669beac56346edbbc4a662 + SHA512 960cf62e5317356f7c0d994e49f56effb89c415377e9c865e801c5ec28b57e9ec0fd2a9fd54136cd2382addedb6745cd5cc062c46cab5cccb1f634999491c9e1 HEAD_REF master ) diff --git a/cmake/ports/clib-util/vcpkg.json b/cmake/ports/clib-util/vcpkg.json index 6f97f5f..a89b7ff 100644 --- a/cmake/ports/clib-util/vcpkg.json +++ b/cmake/ports/clib-util/vcpkg.json @@ -1,6 +1,6 @@ { "name": "clib-util", - "version-string": "1.1.2", + "version-string": "1.4.2", "port-version": 1, "description": "", "homepage": "https://github.com/powerof3/CLibUtil" diff --git a/extern/CommonLibSSE b/extern/CommonLibSSE index 9037208..98f8018 160000 --- a/extern/CommonLibSSE +++ b/extern/CommonLibSSE @@ -1 +1 @@ -Subproject commit 9037208d70e81f91e30939bcb9ed413f212ae6fa +Subproject commit 98f801811235a9b14dc38968b0be04af7f39fc4c diff --git a/extern/CommonLibVR b/extern/CommonLibVR index f80b914..db1e020 160000 --- a/extern/CommonLibVR +++ b/extern/CommonLibVR @@ -1 +1 @@ -Subproject commit f80b9144d6bac29797f90053b8dc8475318b9bfb +Subproject commit db1e020ee5e5924a5fc7c6cbff6991065509ce4b diff --git a/include/Dependencies.h b/include/Dependencies.h index 7da2d7a..e1fa5fc 100644 --- a/include/Dependencies.h +++ b/include/Dependencies.h @@ -31,13 +31,13 @@ namespace Dependencies using _PEGETVERSION = const char* (*)(); + std::string CheckErrors(); + inline constexpr auto PapyrusExtender{ "po3_PapyrusExtender"sv }; inline constexpr auto PapyrusUtil{ "PapyrusUtil"sv }; inline constexpr auto po3Tweaks{ "po3_Tweaks"sv }; inline Version requiredPE{ 5, 4, 0 }; - - std::string CheckErrors(); } template <> diff --git a/include/Globals.h b/include/Globals.h index 755362c..7b77140 100644 --- a/include/Globals.h +++ b/include/Globals.h @@ -13,7 +13,7 @@ namespace FEC using StackID = RE::VMStackID; using Severity = RE::BSScript::ErrorLogger::Severity; - inline RE::TESFile* mod; + inline RE::TESFile* mod; inline RE::SpellItem* deathEffectsPCAbility; inline RE::SpellItem* deathEffectsAbility; @@ -128,7 +128,7 @@ namespace FEC inline constexpr RE::FormID DLC1_SunCloakSpellHandFX{ 0x0200A3BD }; inline constexpr std::array FEC_fireFXS = { 0x8E2, 0x877, 0x896 }; - inline constexpr RE::FormID FEC_sunFXS{ 0x807 }; + inline constexpr RE::FormID FEC_sunFXS{ 0x807 }; inline constexpr std::array sunHitFXS = { 0x02019C9D, 0x0200A3BB, 0x0200A3BC }; inline constexpr std::array sunHitArt = { 0x0200A3B7, 0x0200A3B8 }; diff --git a/include/Graphics.h b/include/Graphics.h index b4addde..6e25bf9 100644 --- a/include/Graphics.h +++ b/include/Graphics.h @@ -17,7 +17,7 @@ namespace FEC::GRAPHICS namespace TEXTURE { - void sanitize_path(std::string& a_path); + void sanitize_path(std::string& a_path); RE::BSShaderTextureSet* create_textureset(char** a_value); } @@ -47,7 +47,7 @@ namespace FEC::GRAPHICS using ShaderData = std::tuple; - void stop_all_skin_shaders(RE::TESObjectREFR* a_ref); + void stop_all_skin_shaders(RE::TESObjectREFR* a_ref); std::pair get_data(RE::NiAVObject* a_object); void Toggle(RE::NiAVObject* a_root, RE::NiStringsExtraData* a_data); diff --git a/include/PCH.h b/include/PCH.h index bc58e91..ce01dd7 100644 --- a/include/PCH.h +++ b/include/PCH.h @@ -12,9 +12,10 @@ #include "SKSE/SKSE.h" #include +#include #include +#include #include -#include #include #include #include @@ -24,9 +25,9 @@ namespace logger = SKSE::log; namespace numeric = clib_util::numeric; namespace string = clib_util::string; -namespace WinAPI = SKSE::WinAPI; using namespace std::literals; +using namespace clib_util::singleton; namespace stl { @@ -36,6 +37,8 @@ namespace stl void write_thunk_call(std::uintptr_t a_src) { auto& trampoline = SKSE::GetTrampoline(); + SKSE::AllocTrampoline(14); + T::func = trampoline.write_call<5>(a_src, T::thunk); } diff --git a/include/Papyrus.h b/include/Papyrus.h index 8d75621..5934bb5 100644 --- a/include/Papyrus.h +++ b/include/Papyrus.h @@ -57,7 +57,7 @@ namespace FEC namespace Papyrus { std::vector GetCauseOfDeath(VM* a_vm, StackID a_stackID, RE::StaticFunctionTag*, RE::Actor* a_actor, std::uint32_t a_type); - void RemoveEffectsNotOfType(VM* a_vm, StackID a_stackID, RE::StaticFunctionTag*, RE::Actor* a_actor, std::int32_t a_type); + void RemoveEffectsNotOfType(VM* a_vm, StackID a_stackID, RE::StaticFunctionTag*, RE::Actor* a_actor, std::int32_t a_type); bool GetPermanentDeathEffect(VM* a_vm, StackID a_stackID, RE::StaticFunctionTag*, RE::Actor* a_actor, std::int32_t a_type); bool GetTemporaryDeathEffect(VM* a_vm, StackID a_stackID, RE::StaticFunctionTag*, RE::Actor* a_actor, std::int32_t a_type); diff --git a/include/Serialization.h b/include/Serialization.h index ecc2b6d..3a29540 100644 --- a/include/Serialization.h +++ b/include/Serialization.h @@ -44,12 +44,13 @@ namespace FEC::Serialization }; class Manager : + public ISingleton, public RE::BSTEventSink, public RE::BSTEventSink, public RE::BSTEventSink { public: - using TempEffectSet = robin_hood::unordered_flat_set; + using TempEffectSet = ankerl::unordered_dense::set; template class ActorEffectMap @@ -112,7 +113,7 @@ namespace FEC::Serialization _map.clear(); if constexpr (std::is_same_v) { - RE::FormID formID; + RE::FormID formID; std::int32_t effect; for (std::size_t i = 0; i < numRegs; i++) { @@ -127,8 +128,8 @@ namespace FEC::Serialization } } else { - RE::FormID formID; - std::size_t numEffects; + RE::FormID formID; + std::size_t numEffects; std::int32_t effect; for (std::size_t i = 0; i < numRegs; i++) { @@ -169,27 +170,27 @@ namespace FEC::Serialization if constexpr (std::is_same_v) { for (auto& [key, mapped] : _map) { if (!a_intfc->WriteRecordData(key)) { - logger::error(" Failed to save key ({:X}: {})!", key, stl::to_underlying(mapped)); + logger::error("\tFailed to save key ({:X}: {})!", key, std::to_underlying(mapped)); return false; } - if (!a_intfc->WriteRecordData(stl::to_underlying(mapped))) { - logger::error(" Failed to save value ({:X}: {})!", key, stl::to_underlying(mapped)); + if (!a_intfc->WriteRecordData(std::to_underlying(mapped))) { + logger::error("\tFailed to save value ({:X}: {})!", key, std::to_underlying(mapped)); return false; } } } else { for (auto& [key, set] : _map) { if (!a_intfc->WriteRecordData(key)) { - logger::error(" Failed to save key ({:X})!", key); + logger::error("\tFailed to save key ({:X})!", key); return false; } if (!a_intfc->WriteRecordData(set.size())) { - logger::error(" Failed to save value size ({:X})!", key); + logger::error("\tFailed to save value size ({:X})!", key); return false; } for (auto& mapped : set) { - if (!a_intfc->WriteRecordData(stl::to_underlying(mapped))) { - logger::error(" Failed to save reg ({:X} : {})!", key, stl::to_underlying(mapped)); + if (!a_intfc->WriteRecordData(std::to_underlying(mapped))) { + logger::error("\tFailed to save reg ({:X} : {})!", key, std::to_underlying(mapped)); return false; } } @@ -206,16 +207,10 @@ namespace FEC::Serialization } private: - mutable Lock _lock{}; - robin_hood::unordered_flat_map _map{}; + mutable Lock _lock{}; + ankerl::unordered_dense::map _map{}; }; - static Manager* GetSingleton() - { - static Manager singleton; - return &singleton; - } - static void Register() { if (const auto scripts = RE::ScriptEventSourceHolder::GetSingleton()) { @@ -226,8 +221,6 @@ namespace FEC::Serialization } } - SKSE::RegistrationMap FECreset{ "OnFECReset"sv }; - void Save(SKSE::SerializationInterface* a_intfc); void Load(SKSE::SerializationInterface* a_intfc); void Revert(SKSE::SerializationInterface* a_intfc); @@ -237,17 +230,10 @@ namespace FEC::Serialization EventResult ProcessEvent(const RE::TESResetEvent* a_event, RE::BSTEventSource*) override; EventResult ProcessEvent(const RE::TESLoadGameEvent* a_event, RE::BSTEventSource*) override; - ActorEffectMap permanentEffectMap; - ActorEffectMap temporaryEffectMap; - - private: - Manager() = default; - Manager(const Manager&) = delete; - Manager(Manager&&) = delete; - ~Manager() override = default; - - Manager& operator=(const Manager&) = delete; - Manager& operator=(Manager&&) = delete; + // members + SKSE::RegistrationMap FECreset{ "OnFECReset"sv }; + ActorEffectMap permanentEffectMap; + ActorEffectMap temporaryEffectMap; }; void SaveCallback(SKSE::SerializationInterface* a_intfc); diff --git a/src/Papyrus.cpp b/src/Papyrus.cpp index c3c1759..3c59999 100644 --- a/src/Papyrus.cpp +++ b/src/Papyrus.cpp @@ -103,7 +103,7 @@ namespace FEC::Papyrus #endif deathEffectPair effectPair{ -1, nullptr }; - deathEffectMap effectMap{}; + deathEffectMap effectMap{}; const auto deathMode = static_cast(a_type); @@ -130,7 +130,7 @@ namespace FEC::Papyrus if (effectMap.size() == 1) { const auto& type = effectMap.begin()->first; - auto [effect, effectMag] = *std::ranges::max_element(effectMap.begin()->second, mag_cmp); + auto& [effect, effectMag] = *std::ranges::max_element(effectMap.begin()->second, mag_cmp); effectPair = { type, effect }; } else { if (a_type != 0) { @@ -139,7 +139,7 @@ namespace FEC::Papyrus if (poison) { auto& poisonVec = effectMap[DEATH::TYPE::kPoison]; - auto poisonEffect = *std::ranges::max_element(poisonVec, mag_cmp); + auto& poisonEffect = *std::ranges::max_element(poisonVec, mag_cmp); effectPair = { DEATH::TYPE::kPoison, poisonEffect.first }; if (fear) { @@ -147,7 +147,7 @@ namespace FEC::Papyrus } } else if (fear) { auto& fearVec = effectMap[DEATH::TYPE::kFear]; - auto poisonEffect = *std::ranges::max_element(fearVec, mag_cmp); + auto& poisonEffect = *std::ranges::max_element(fearVec, mag_cmp); effectPair = { DEATH::TYPE::kFear, poisonEffect.first }; } @@ -159,7 +159,7 @@ namespace FEC::Papyrus if (fire) { auto& fireVec = effectMap[DEATH::TYPE::kFire]; - auto fireEffect = *std::ranges::max_element(fireVec, mag_cmp); + auto& fireEffect = *std::ranges::max_element(fireVec, mag_cmp); effectPair = { DEATH::TYPE::kFire, fireEffect.first }; if (frost) { @@ -169,13 +169,13 @@ namespace FEC::Papyrus } } else if (drain) { auto& drainVec = effectMap[DEATH::TYPE::kDrain]; - auto drainEffect = *std::ranges::max_element(drainVec, mag_cmp); + auto& drainEffect = *std::ranges::max_element(drainVec, mag_cmp); effectPair = { DEATH::TYPE::kDrain, drainEffect.first }; if (shock) { effectPair.first = DEATH::TYPE::kDrainShock; auto& shockVec = effectMap[DEATH::TYPE::kShock]; - auto shockEffect = *std::ranges::max_element(shockVec, mag_cmp); + auto& shockEffect = *std::ranges::max_element(shockVec, mag_cmp); if (numeric::definitely_less_than(drainEffect.second, shockEffect.second)) { effectPair.second = shockEffect.first; @@ -183,7 +183,7 @@ namespace FEC::Papyrus } else if (frost) { effectPair.first = DEATH::TYPE::kDrainFrost; auto& frostVec = effectMap[DEATH::TYPE::kFrost]; - auto frostEffect = *std::ranges::max_element(frostVec, mag_cmp); + auto& frostEffect = *std::ranges::max_element(frostVec, mag_cmp); if (numeric::definitely_less_than(drainEffect.second, frostEffect.second)) { effectPair.second = frostEffect.first; @@ -191,12 +191,12 @@ namespace FEC::Papyrus } } else if (frost) { auto& frostVec = effectMap[DEATH::TYPE::kFrost]; - auto frostEffect = *std::ranges::max_element(frostVec, mag_cmp); + auto frostEffect = *std::ranges::max_element(frostVec, mag_cmp); effectPair = { DEATH::TYPE::kFrost, frostEffect.first }; if (shock) { auto& shockVec = effectMap[DEATH::TYPE::kShock]; - auto shockEffect = *std::ranges::max_element(shockVec, mag_cmp); + auto& shockEffect = *std::ranges::max_element(shockVec, mag_cmp); if (numeric::definitely_less_than(frostEffect.second, shockEffect.second)) { effectPair = { DEATH::TYPE::kShockFrost, shockEffect.first }; @@ -206,7 +206,7 @@ namespace FEC::Papyrus } } else if (shock) { auto& shockVec = effectMap[DEATH::TYPE::kShock]; - auto shockEffect = *std::ranges::max_element(shockVec, mag_cmp); + auto shockEffect = *std::ranges::max_element(shockVec, mag_cmp); effectPair = { DEATH::TYPE::kShock, shockEffect.first }; } @@ -243,7 +243,7 @@ namespace FEC::Papyrus return; } - bool result = false; + bool result = false; RESET::ResetData resetData{}; std::tie(result, resetData) = RESET::get_data(root); diff --git a/src/Patches.cpp b/src/Patches.cpp index e44d618..9ecc78c 100644 --- a/src/Patches.cpp +++ b/src/Patches.cpp @@ -251,7 +251,7 @@ namespace FEC using Flag = RE::EffectSetting::EffectSettingData::Flag; const auto hitFXS = a_mgef->data.effectShader; - bool isSunEffect = hitFXS && std::ranges::find(shader::sunHitFXS, hitFXS->GetFormID()) != shader::sunHitFXS.end(); + bool isSunEffect = hitFXS && std::ranges::find(shader::sunHitFXS, hitFXS->GetFormID()) != shader::sunHitFXS.end(); if (!isSunEffect) { const auto hitArt = a_mgef->data.hitEffectArt; diff --git a/src/Serialization.cpp b/src/Serialization.cpp index 49501df..97d66a2 100644 --- a/src/Serialization.cpp +++ b/src/Serialization.cpp @@ -36,14 +36,14 @@ namespace FEC::Serialization std::uint32_t length; while (a_intfc->GetNextRecordInfo(type, version, length)) { if (version < kSerializationVersion) { - logger::critical("Loaded data is out of date! Read ({}), expected ({}) for type code ({})", version, stl::to_underlying(kSerializationVersion), DecodeTypeCode(type)); + logger::critical("Loaded data is out of date! Read ({}), expected ({}) for type code ({})", version, std::to_underlying(kSerializationVersion), DecodeTypeCode(type)); continue; } switch (type) { case kFECReset: { if (version != kFECResetVersion) { - logger::critical("Loaded data for FEC reset is out of date! Read ({}), expected ({}) for type code ({})", version, stl::to_underlying(kFECResetVersion), DecodeTypeCode(type)); + logger::critical("Loaded data for FEC reset is out of date! Read ({}), expected ({}) for type code ({})", version, std::to_underlying(kFECResetVersion), DecodeTypeCode(type)); } else { FECreset.Load(a_intfc); } diff --git a/src/graphics.cpp b/src/graphics.cpp index 7e684d3..6237230 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -101,11 +101,11 @@ namespace FEC::GRAPHICS object->UpdateMaterialAlpha(a_alpha, false); if (a_setData) { - const auto name = "PO3_HEADPART - " + std::to_string(stl::to_underlying(a_type)); + const auto name = "PO3_HEADPART - " + std::to_string(std::to_underlying(a_type)); if (a_alpha == 1.0f) { a_root->RemoveExtraData(name); } else { - EXTRA::add_data_if_none(a_root, name, stl::to_underlying(a_type)); + EXTRA::add_data_if_none(a_root, name, std::to_underlying(a_type)); } } } @@ -119,7 +119,7 @@ namespace FEC::GRAPHICS static std::pair get_original_shaders(RE::NiStringsExtraData* a_data) { ShaderData shaderData; - bool result = true; + bool result = true; if (a_data && a_data->value && a_data->size > 0) { auto& [textureSet, feature, flags, emissiveColor, emissiveMult] = shaderData; @@ -253,12 +253,12 @@ namespace FEC::GRAPHICS if (const auto processLists = RE::ProcessLists::GetSingleton(); processLists) { const auto handle = a_ref->CreateRefHandle(); - processLists->ForEachShaderEffect([&](RE::ShaderReferenceEffect& a_shaderEffect) { - if (a_shaderEffect.target == handle) { - if (const auto effectData = a_shaderEffect.effectData; effectData && + processLists->ForEachShaderEffect([&](RE::ShaderReferenceEffect* a_shaderEffect) { + if (a_shaderEffect->target == handle) { + if (const auto effectData = a_shaderEffect->effectData; effectData && effectData->data.flags.all(Flags::kSkinOnly) && !effectData->holesTexture.textureName.empty()) { - a_shaderEffect.finished = true; + a_shaderEffect->finished = true; } } return RE::BSContainer::ForEachResult::kContinue; @@ -269,7 +269,7 @@ namespace FEC::GRAPHICS std::pair get_data(RE::NiAVObject* a_object) { ResetData resetData; - bool success = false; + bool success = false; if (!a_object->extra || a_object->extraDataSize == 0) { return { success, resetData }; diff --git a/src/main.cpp b/src/main.cpp index 105daab..b530599 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,10 @@ void OnInit(SKSE::MessagingInterface::Message* a_msg) if (!FEC::mod) { logger::error("unable to find FEC.esp"); + if (consoleLog) { + consoleLog->Print("[FEC] FEC.esp is not loaded! Disabling FEC helper plugin\n"); + } + return; } FEC::deathEffectsAbility = dataHandler->LookupForm(0x8E7, "FEC.esp"); @@ -26,11 +30,9 @@ void OnInit(SKSE::MessagingInterface::Message* a_msg) if (!FEC::deathEffectsAbility || !deathEffectsPCAbility) { logger::error("unable to find death effect abilities"); - if (consoleLog) { consoleLog->Print("[FEC] FEC.esp is not loaded! Disabling FEC helper plugin\n"); } - return; } } @@ -124,13 +126,12 @@ void InitializeLog() extern "C" DLLEXPORT bool SKSEAPI SKSEPlugin_Load(const SKSE::LoadInterface* a_skse) { + SKSE::Init(a_skse); + InitializeLog(); logger::info("Game version : {}", a_skse->RuntimeVersion().string()); - SKSE::Init(a_skse); - SKSE::AllocTrampoline(75); - const auto messaging = SKSE::GetMessagingInterface(); messaging->RegisterListener(OnInit); diff --git a/vcpkg.json b/vcpkg.json index 15d5bd1..aca28b8 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -5,11 +5,10 @@ "homepage": "https://github.com/powerof3/FEC", "license": "MIT", "dependencies": [ - "boost-stl-interfaces", "clib-util", "frozen", "rsm-binary-io", - "robin-hood-hashing", + "unordered-dense", "spdlog", "srell", "xbyak"