Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build*
CMakeUserPresets.json
.vscode
.vs
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}})
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -81,7 +87,7 @@ add_library(
target_compile_features(
${PROJECT_NAME}
PRIVATE
cxx_std_20
cxx_std_23
)

target_include_directories(
Expand Down
6 changes: 5 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cmake/ports/autotoml/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmake/version.cmake
Original file line number Diff line number Diff line change
@@ -1 +1 @@
set(VERSION 6.2.0)
set(VERSION 7.0.1)
1 change: 0 additions & 1 deletion external/CommonLibSSE
Submodule CommonLibSSE deleted from 328256
1 change: 1 addition & 0 deletions external/CommonLibSSE-NG
Submodule CommonLibSSE-NG added at e2a29d
4 changes: 2 additions & 2 deletions src/fixes/doubleperkapply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace fixes
{
RemoveBasePerks(a_actor);

auto* currentProcess = a_actor->currentProcess;
auto* currentProcess = a_actor->GetActorRuntimeData().currentProcess;
if (!currentProcess)
{
return;
Expand Down Expand Up @@ -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;

Expand Down
27 changes: 19 additions & 8 deletions src/fixes/miscfixes.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "fixes.h"

#undef GetObject

namespace fixes
{
class AnimationLoadSignedCrashPatch
Expand Down Expand Up @@ -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<RE::Actor*>(refShooter.get());
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<float>(a_this->fadeTime, 4.0f));
a_this->typeStatus = static_cast<RE::BSIMusicType::MUSIC_STATUS>(a_this->tracks[a_this->currentTrackIndex]->GetMusicStatus());
}
};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<decltype(LoadGame)> _LoadGame;
Expand Down
7 changes: 4 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}();

Expand Down Expand Up @@ -114,14 +114,15 @@ 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();
}

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))
Expand Down
2 changes: 1 addition & 1 deletion src/patches/treelodreferencecaching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 6 additions & 2 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
"version-string": "1",
"dependencies": [
"autotoml",
"directxtk",
"directxtex",
"rapidcsv",
"catch2",
"boost-regex",
"boost-stl-interfaces",
"spdlog",
"tbb",
"xbyak",
"rsm-binary-io"
],
"builtin-baseline": "57d3194e702a2959e86a6748999ad71fc24f7922",
"builtin-baseline": "d9ccd77bb554e67137f3f754a2e2f11f4188c82c",
"overrides": [
{
"name": "tbb",
"version-string": "2020_U3"
"version-string": "2022.1.0"
}
]
}