Skip to content
Merged
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
37 changes: 0 additions & 37 deletions src/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,43 +856,6 @@ namespace Hooks
stl::write_thunk_call<BSBatchRenderer_RenderPassImmediately2>(REL::RelocationID(100852, 107642).address() + REL::Relocate(0x29E, 0x28F));
stl::write_thunk_call<BSBatchRenderer_RenderPassImmediately3>(REL::RelocationID(100871, 107667).address() + REL::Relocate(0xEE, 0xED));

const auto renderPassCacheCtor = REL::VariantID(100720, 107500, 0x1340330); // VR function is identical to SE
const int32_t passCount = 4194240;
const int32_t passCountSE = 4194240 * 16;

const int32_t passSize = 4194240 * sizeof(RE::BSRenderPass);
const int32_t lightsCount = passCount * 16;
const int32_t lightsSize = lightsCount * sizeof(void*);
const int32_t lastPassIndex = passCount - 1;
const int32_t lastPassOffset =
(passCount - 1) * sizeof(RE::BSRenderPass);
const int32_t lastPassNextOffset =
(passCount - 1) * sizeof(RE::BSRenderPass) + offsetof(RE::BSRenderPass, next);
PatchMemory(
REL::Relocation<std::uintptr_t>(renderPassCacheCtor, 0x76).address(),
reinterpret_cast<const uint8_t*>(&lightsSize), 4);
PatchMemory(
REL::Relocation<std::uintptr_t>(renderPassCacheCtor, 0xAD).address(),
reinterpret_cast<const uint8_t*>(&passSize), 4);
PatchMemory(
REL::Relocation<std::uintptr_t>(renderPassCacheCtor, 0xCB).address(),
reinterpret_cast<const uint8_t*>(&lastPassIndex), 4);
PatchMemory(
REL::Relocation<std::uintptr_t>(renderPassCacheCtor, 0xF0).address(),
reinterpret_cast<const uint8_t*>(&lastPassNextOffset), 4);
PatchMemory(
REL::Relocation<std::uintptr_t>(renderPassCacheCtor, 0xFD).address(),
reinterpret_cast<const uint8_t*>(&lastPassOffset), 4);
if (REL::Module::IsAE()) {
PatchMemory(
REL::Relocation<std::uintptr_t>(renderPassCacheCtor, 0x191).address(),
reinterpret_cast<const uint8_t*>(&passCount), 4);
} else {
PatchMemory(
REL::Relocation<std::uintptr_t>(renderPassCacheCtor, 0x191 - 2).address(),
reinterpret_cast<const uint8_t*>(&passCountSE), 4);
}

// Patch render space in BSLightingShader::SetupGeometry to always use world space
// The variable updateEyePosition is set to 1 when not skinned. By patching to be 0 it will always use world space
// We offset from the base address of the containing function to the start of the patch
Expand Down
16 changes: 14 additions & 2 deletions src/XSEPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,32 @@ bool Load()
auto log = spdlog::default_logger();
log->set_level(state->GetLogLevel());

const std::array dlls = {
const std::array incompatibleDLLs = {
L"Data/SKSE/Plugins/ShaderTools.dll",
L"Data/SKSE/Plugins/SSEShaderTools.dll",
L"Data/SKSE/Plugins/SkyrimUpscaler.dll"
};

for (const auto dll : dlls) {
for (const auto dll : incompatibleDLLs) {
if (LoadLibrary(dll)) {
auto errorMessage = std::format("Incompatible DLL {} detected", stl::utf16_to_utf8(dll).value_or("<unicode conversion error>"s));
logger::error("{}", errorMessage);
errors.push_back(errorMessage);
}
}
Comment thread
doodlum marked this conversation as resolved.

const std::array requiredDLLs = {
L"Data/SKSE/Plugins/EngineFixes.dll"
};

for (const auto dll : requiredDLLs) {
if (LoadLibrary(dll)) {
auto errorMessage = std::format("Required DLL {} was missing", stl::utf16_to_utf8(dll).value_or("<unicode conversion error>"s));
logger::error("{}", errorMessage);
errors.push_back(errorMessage);
}
}

Comment thread
doodlum marked this conversation as resolved.
if (errors.empty()) {
logger::info("Calling feature Load methods");
for (auto* feature : Feature::GetFeatureList()) {
Expand Down