Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix AE support #336

Merged
merged 1 commit into from
Jul 11, 2024
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
2 changes: 1 addition & 1 deletion src/Features/LightLimitFix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ void LightLimitFix::Draw(const RE::BSShader*, const uint32_t)
void LightLimitFix::PostPostLoad()
{
ParticleLights::GetSingleton()->GetConfigs();
LightLimitFix::InstallHooks();
Hooks::Install();
}

void LightLimitFix::DataLoaded()
Expand Down
4 changes: 0 additions & 4 deletions src/Features/LightLimitFix.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ struct LightLimitFix : Feature
return &render;
}

static void InstallHooks()
{
Hooks::Install();
}
virtual inline std::string GetName() { return "Light Limit Fix"; }
virtual inline std::string GetShortName() { return "LightLimitFix"; }
inline std::string_view GetShaderDefineName() override { return "LIGHT_LIMIT_FIX"; }
Expand Down
5 changes: 0 additions & 5 deletions src/Features/SubsurfaceScattering.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ struct SubsurfaceScattering : Feature
return &singleton;
}

static void InstallHooks()
{
Hooks::Install();
}

struct DiffusionProfile
{
float BlurRadius;
Expand Down
5 changes: 0 additions & 5 deletions src/Features/TerrainBlending.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ struct TerrainBlending : Feature
return &singleton;
}

static void InstallHooks()
{
Hooks::Install();
}

virtual inline std::string GetName() { return "Terrain Blending"; }
virtual inline std::string GetShortName() { return "TerrainBlending"; }
virtual inline std::string_view GetShaderDefineName() { return "TERRAIN_BLENDING"; }
Expand Down
8 changes: 4 additions & 4 deletions src/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ namespace Hooks
logger::info("Hooking BSShader::BeginTechnique");
*(uintptr_t*)&ptr_BSShader_BeginTechnique = Detours::X64::DetourFunction(REL::RelocationID(101341, 108328).address(), (uintptr_t)&hk_BSShader_BeginTechnique);

stl::write_thunk_call<BSShader__BeginTechnique_SetVertexShader>(REL::RelocationID(101341, 101341).address() + REL::Relocate(0xC3, 0x3F3));
stl::write_thunk_call<BSShader__BeginTechnique_SetPixelShader>(REL::RelocationID(101341, 101341).address() + REL::Relocate(0xD7, 0x3F3));
stl::write_thunk_call<BSShader__BeginTechnique_SetVertexShader>(REL::RelocationID(101341, 108328).address() + REL::Relocate(0xC3, 0xD5));
stl::write_thunk_call<BSShader__BeginTechnique_SetPixelShader>(REL::RelocationID(101341, 108328).address() + REL::Relocate(0xD7, 0xEB));

logger::info("Hooking BSGraphics::SetDirtyStates");
*(uintptr_t*)&ptr_BSGraphics_SetDirtyStates = Detours::X64::DetourFunction(REL::RelocationID(75580, 77386).address(), (uintptr_t)&hk_BSGraphics_SetDirtyStates);
Expand All @@ -492,7 +492,7 @@ namespace Hooks
stl::write_thunk_call<CreateRenderTarget_NormalsSwap>(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x46B, 0x46E, 0x5C3));
if (!REL::Module::IsVR())
stl::write_thunk_call<CreateRenderTarget_Snow>(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x406, 0x409));
stl::write_thunk_call<CreateDepthStencil_PrecipitationMask>(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x1245, 0x554, 0x1917));
stl::write_thunk_call<CreateCubemapRenderTarget_Reflections>(REL::RelocationID(100458, 107175).address() + REL::Relocate(0xA25, 0x554, 0xCD2));
stl::write_thunk_call<CreateDepthStencil_PrecipitationMask>(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x1245, 0x123B, 0x1917));
stl::write_thunk_call<CreateCubemapRenderTarget_Reflections>(REL::RelocationID(100458, 107175).address() + REL::Relocate(0xA25, 0xA25, 0xCD2));
}
}
6 changes: 3 additions & 3 deletions src/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ namespace Util

float4 TryGetWaterData(float offsetX, float offsetY)
{
if (auto shadowState = RE::BSGraphics::RendererShadowState::GetSingleton()) {
if (RE::BSGraphics::RendererShadowState::GetSingleton()) {
if (auto tes = RE::TES::GetSingleton()) {
auto position = !REL::Module::IsVR() ? shadowState->GetRuntimeData().posAdjust.getEye() : shadowState->GetVRRuntimeData().posAdjust.getEye();
auto position = GetEyePosition(0);
position.x += offsetX;
position.y += offsetY;
if (auto cell = tes->GetCell(position)) {
Expand Down Expand Up @@ -270,7 +270,7 @@ namespace Util
}

if (!extraCellWater) {
if (auto worldSpace = tes->worldSpace) {
if (auto worldSpace = tes->GetRuntimeData2().worldSpace) {
if (auto water = worldSpace->worldWater) {
data = { float(water->data.deepWaterColor.red) + float(water->data.shallowWaterColor.red),
float(water->data.deepWaterColor.green) + float(water->data.shallowWaterColor.green),
Expand Down
Loading