diff --git a/.gitignore b/.gitignore index 20db8a4..9cd1e6b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /build* CMakeUserPresets.json .vscode +.vs diff --git a/.gitmodules b/.gitmodules index 2997a57..6b4835a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ -[submodule "external/CommonLibSSE"] - path = external/CommonLibSSE - url = https://github.com/Ryan-rsm-McKenzie/CommonLibSSE +[submodule "external/CommonLibSSE-NG"] + path = external/CommonLibSSE-NG + url = https://github.com/alandtse/CommonLibVR.git + branch = ng diff --git a/CMakeLists.txt b/CMakeLists.txt index e9f568f..e11b8a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.21) macro(set_from_environment VARIABLE) if (NOT DEFINED ${VARIABLE} AND DEFINED ENV{${VARIABLE}}) @@ -14,6 +14,11 @@ project( LANGUAGES CXX ) +add_compile_definitions(SKYRIM) +set(CommonLibPath "external/CommonLibSSE-NG") +set(CommonLibName "CommonLibSSE") +set(GameVersion "Skyrim") + configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/include/Version.h" @@ -36,8 +41,9 @@ add_compile_definitions( UNICODE ) -add_subdirectory(external/CommonLibSSE CommonLibSSE) +add_subdirectory(${CommonLibPath} ${CommonLibName} EXCLUDE_FROM_ALL) +find_package(spdlog CONFIG REQUIRED) find_package(AutoTOML REQUIRED CONFIG) find_package(Boost MODULE @@ -81,7 +87,7 @@ add_library( target_compile_features( ${PROJECT_NAME} PRIVATE - cxx_std_20 + cxx_std_23 ) target_include_directories( diff --git a/CMakePresets.json b/CMakePresets.json index 1722752..f3f81f0 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -35,7 +35,11 @@ "CMAKE_TOOLCHAIN_FILE": { "type": "STRING", "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" - } + }, + "SKSE_SUPPORT_XBYAK": "ON", + "ENABLE_SKYRIM_AE": "ON", + "ENABLE_SKYRIM_SE": "OFF", + "ENABLE_SKYRIM_VR": "OFF" }, "hidden": true, "name": "vcpkg" diff --git a/cmake/ports/autotoml/portfile.cmake b/cmake/ports/autotoml/portfile.cmake index abfe20c..1e95bb0 100644 --- a/cmake/ports/autotoml/portfile.cmake +++ b/cmake/ports/autotoml/portfile.cmake @@ -1,6 +1,6 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - REPO shad0wshayd3/AutoTOML + REPO Ryan-rsm-McKenzie/AutoTOML REF fc0ba2364334503684c4d4dbda6bd10c35dde1fb SHA512 36e8d2d7f042256723b28865067a7317b4783a419c16c62c02a0b5b4ed1e2256d4ed485a0a921bcd5b74ab74007f6d619e1cf06f63eccf386ea56b7d87785a25 HEAD_REF master diff --git a/cmake/version.cmake b/cmake/version.cmake index 672c37b..a374fb7 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -1 +1 @@ -set(VERSION 6.2.0) +set(VERSION 7.0.1) diff --git a/external/CommonLibSSE b/external/CommonLibSSE deleted file mode 160000 index 3282565..0000000 --- a/external/CommonLibSSE +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3282565a2c86535036f5a556758fb1cf8ab85225 diff --git a/external/CommonLibSSE-NG b/external/CommonLibSSE-NG new file mode 160000 index 0000000..e2a29de --- /dev/null +++ b/external/CommonLibSSE-NG @@ -0,0 +1 @@ +Subproject commit e2a29de9ff59d998b75fbad4d7135cfef4b45ded diff --git a/src/fixes/doubleperkapply.cpp b/src/fixes/doubleperkapply.cpp index 4396ecd..34d53e5 100644 --- a/src/fixes/doubleperkapply.cpp +++ b/src/fixes/doubleperkapply.cpp @@ -24,7 +24,7 @@ namespace fixes { RemoveBasePerks(a_actor); - auto* currentProcess = a_actor->currentProcess; + auto* currentProcess = a_actor->GetActorRuntimeData().currentProcess; if (!currentProcess) { return; @@ -79,7 +79,7 @@ namespace fixes { ApplyBasePerksActorImplementation(a_player); - for (auto* addedPerkRank : a_player->addedPerks) + for (auto* addedPerkRank : a_player->GetPlayerRuntimeData().addedPerks) { auto* perk = addedPerkRank->perk; diff --git a/src/fixes/miscfixes.cpp b/src/fixes/miscfixes.cpp index e8e282a..d7c7ac6 100644 --- a/src/fixes/miscfixes.cpp +++ b/src/fixes/miscfixes.cpp @@ -1,5 +1,7 @@ #include "fixes.h" +#undef GetObject + namespace fixes { class AnimationLoadSignedCrashPatch @@ -36,7 +38,7 @@ namespace fixes private: static void Move(RE::Projectile* a_this, /*const*/ RE::NiPoint3& a_from, const RE::NiPoint3& a_to) { - const auto refShooter = a_this->shooter.get(); + const auto refShooter = a_this->GetProjectileRuntimeData().shooter.get(); if (refShooter && refShooter->Is(RE::FormType::ActorCharacter)) { const auto akShooter = static_cast(refShooter.get()); @@ -440,7 +442,9 @@ namespace fixes constexpr std::uintptr_t BRANCH_OFF = 0x13D; constexpr std::uintptr_t SEND_EVENT_BEGIN = 0x149; constexpr std::uintptr_t SEND_EVENT_END = 0x1C7; - constexpr std::size_t EQUIPPED_SHOUT = offsetof(RE::Actor, selectedPower); + // TODO: runtime independent EQUIPPED_SHOUT + constexpr std::size_t EQUIPPED_SHOUT = 0xE8 + offsetof(RE::Actor::ACTOR_RUNTIME_DATA, selectedPower); // > SSE_1_6_629 TO + //constexpr std::size_t EQUIPPED_SHOUT = 0xE0 + offsetof(RE::Actor::ACTOR_RUNTIME_DATA, selectedPower); // < SSE_1_6_629 constexpr std::uint32_t BRANCH_SIZE = 5; constexpr std::uint32_t CODE_CAVE_SIZE = 12; constexpr std::uint32_t DIFF = CODE_CAVE_SIZE - BRANCH_SIZE; @@ -738,11 +742,11 @@ namespace fixes const bool retVal = _Load(a_this, a_file); // the game doesn't allow more than 10 here - if (a_this->data.size() >= 12) + if (a_this->GetRuntimeData().data.size() >= 12) { - const auto particleDensity = a_this->data[11]; + const auto particleDensity = a_this->GetRuntimeData().data[11]; if (particleDensity.f > 10.0) - a_this->data[11].f = 10.0f; + a_this->GetRuntimeData().data[11].f = 10.0f; } return retVal; @@ -772,7 +776,7 @@ namespace fixes static void DoFinish(RE::BSIMusicType* a_this, bool a_immediate) { - a_this->tracks[a_this->currentTrackIndex]->DoFinish(a_immediate, std::max(a_this->fadeTime, 4.0f)); + a_this->tracks[a_this->currentTrackIndex]->DoFinish(a_immediate, std::max(a_this->fadeTime, 4.0f)); a_this->typeStatus = static_cast(a_this->tracks[a_this->currentTrackIndex]->GetMusicStatus()); } }; @@ -1300,7 +1304,7 @@ namespace fixes static RE::TESObjectWEAP* GetWeaponData(RE::Actor* a_actor) { - const auto proc = a_actor->currentProcess; + const auto proc = a_actor->GetActorRuntimeData().currentProcess; if (!proc || !proc->middleHigh) { return nullptr; @@ -1617,7 +1621,14 @@ namespace fixes static void LoadGame(RE::Sky* a_this, RE::BGSLoadGameBuffer* a_loadGameBuffer) { _LoadGame(a_this, a_loadGameBuffer); - a_this->flags |= 0x7E00; + a_this->flags.set( + RE::Sky::Flags::kUpdateSunriseBegin, + RE::Sky::Flags::kUpdateSunriseEnd, + RE::Sky::Flags::kUpdateSunsetBegin, + RE::Sky::Flags::kUpdateSunsetEnd, + RE::Sky::Flags::kUpdateColorsSunriseBegin, + RE::Sky::Flags::kUpdateColorsSunsetEnd + ); } static inline REL::Relocation _LoadGame; diff --git a/src/main.cpp b/src/main.cpp index 853353f..2792aa4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -60,8 +60,8 @@ extern "C" DLLEXPORT constinit auto SKSEPlugin_Version = []() { v.PluginName(Version::NAME); v.AuthorName("aers"sv); v.CompatibleVersions({ RUNTIME_1_6_1170 }); - v.UsesAddressLibrary(true); - v.UsesStructsPost629(true); + v.UsesAddressLibrary(); + v.UsesUpdatedStructs(); return v; }(); @@ -114,6 +114,7 @@ extern "C" void DLLEXPORT APIENTRY Initialize() logger::info("enabling verbose logging"sv); spdlog::set_level(spdlog::level::trace); spdlog::flush_on(spdlog::level::trace); + spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%L] [%t] %g(%#): %v"s); } patches::Preload(); @@ -121,7 +122,7 @@ extern "C" void DLLEXPORT APIENTRY Initialize() extern "C" DLLEXPORT bool SKSEAPI SKSEPlugin_Load(const SKSE::LoadInterface* a_skse) { - SKSE::Init(a_skse); + SKSE::Init(a_skse, false); const auto messaging = SKSE::GetMessagingInterface(); if (!messaging->RegisterListener("SKSE", MessageHandler)) diff --git a/src/patches/treelodreferencecaching.cpp b/src/patches/treelodreferencecaching.cpp index 1cc15ab..10cc317 100644 --- a/src/patches/treelodreferencecaching.cpp +++ b/src/patches/treelodreferencecaching.cpp @@ -75,7 +75,7 @@ namespace patches const auto fadeNode = obj3D->AsFadeNode(); if (fadeNode) { - alpha = 1.0f - fadeNode->currentFade; + alpha = 1.0f - fadeNode->GetRuntimeData().currentFade; if (alpha <= 0.0f) fullyHidden = true; } diff --git a/vcpkg.json b/vcpkg.json index df29b72..2a81169 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -3,6 +3,10 @@ "version-string": "1", "dependencies": [ "autotoml", + "directxtk", + "directxtex", + "rapidcsv", + "catch2", "boost-regex", "boost-stl-interfaces", "spdlog", @@ -10,11 +14,11 @@ "xbyak", "rsm-binary-io" ], - "builtin-baseline": "57d3194e702a2959e86a6748999ad71fc24f7922", + "builtin-baseline": "d9ccd77bb554e67137f3f754a2e2f11f4188c82c", "overrides": [ { "name": "tbb", - "version-string": "2020_U3" + "version-string": "2022.1.0" } ] }