diff --git a/src/Features/InteriorSun.cpp b/src/Features/InteriorSun.cpp index 0b1e466dff..691ec8b00e 100644 --- a/src/Features/InteriorSun.cpp +++ b/src/Features/InteriorSun.cpp @@ -45,6 +45,8 @@ void InteriorSun::RestoreDefaultSettings() void InteriorSun::PostPostLoad() { + stl::write_thunk_call(REL::RelocationID(100852, 107642).address() + REL::Relocate(0x29E, 0x28F)); + // Hooks and patch to enable directional lighting for interiors stl::write_thunk_call(REL::RelocationID(35562, 36561).address() + REL::Relocate(0x399, 0x37D, 0x639)); stl::write_thunk_call(REL::RelocationID(35562, 36561).address() + REL::Relocate(0x3AE, 0x392, 0x64E)); @@ -123,6 +125,12 @@ void InteriorSun::DirShadowLightCulling::thunk(RE::BSShadowDirectionalLight* dir func(dirLight, *passedJobArrays, nodes); } +void InteriorSun::BSBatchRenderer_RenderPassImmediately::thunk(RE::BSRenderPass* a_pass, uint32_t a_technique, bool a_alphaTest, uint32_t a_renderFlags) +{ + globals::features::interiorSun.UpdateRasterStateCullMode(a_pass, a_technique); + func(a_pass, a_technique, a_alphaTest, a_renderFlags); +} + void InteriorSun::ClearArrays() { currentCellRoomsAndPortals.clear(); diff --git a/src/Features/InteriorSun.h b/src/Features/InteriorSun.h index fb74e3473a..353c962da9 100644 --- a/src/Features/InteriorSun.h +++ b/src/Features/InteriorSun.h @@ -50,6 +50,12 @@ struct InteriorSun : Feature static inline REL::Relocation func; }; + struct BSBatchRenderer_RenderPassImmediately + { + static void thunk(RE::BSRenderPass* a_pass, uint32_t a_technique, bool a_alphaTest, uint32_t a_renderFlags); + static inline REL::Relocation func; + }; + void UpdateRasterStateCullMode(const RE::BSRenderPass* pass, const uint32_t technique) const { if (isInteriorWithSun && settings.ForceDoubleSidedRendering && technique & static_cast(SIE::ShaderCache::UtilityShaderFlags::RenderShadowmap)) { diff --git a/src/Hooks.cpp b/src/Hooks.cpp index 72bd0858ea..fdcb084a6c 100644 --- a/src/Hooks.cpp +++ b/src/Hooks.cpp @@ -498,16 +498,6 @@ namespace Hooks static inline REL::Relocation func; }; - struct CreateRenderTarget_Snow - { - static void thunk(RE::BSGraphics::Renderer* This, RE::RENDER_TARGETS::RENDER_TARGET a_target, RE::BSGraphics::RenderTargetProperties* a_properties) - { - globals::state->ModifyRenderTarget(a_target, a_properties); - func(This, a_target, a_properties); - } - static inline REL::Relocation func; - }; - struct CreateRenderTarget_MotionVectors { static void thunk(RE::BSGraphics::Renderer* This, RE::RENDER_TARGETS::RENDER_TARGET a_target, RE::BSGraphics::RenderTargetProperties* a_properties) @@ -702,32 +692,6 @@ namespace Hooks static inline REL::Relocation func; }; - void BSBatchRenderer_RenderPassImmediately1::thunk(RE::BSRenderPass* a_pass, uint32_t a_technique, bool a_alphaTest, uint32_t a_renderFlags) - { - func(a_pass, a_technique, a_alphaTest, a_renderFlags); - } - - struct BSBatchRenderer_RenderPassImmediately2 - { - static void thunk(RE::BSRenderPass* a_pass, uint32_t a_technique, bool a_alphaTest, uint32_t a_renderFlags) - { - if (globals::features::interiorSun.loaded) - globals::features::interiorSun.UpdateRasterStateCullMode(a_pass, a_technique); - - func(a_pass, a_technique, a_alphaTest, a_renderFlags); - } - static inline REL::Relocation func; - }; - - struct BSBatchRenderer_RenderPassImmediately3 - { - static void thunk(RE::BSRenderPass* a_pass, uint32_t a_technique, bool a_alphaTest, uint32_t a_renderFlags) - { - func(a_pass, a_technique, a_alphaTest, a_renderFlags); - } - static inline REL::Relocation func; - }; - #ifdef TRACY_ENABLE struct Main_Update { @@ -901,7 +865,6 @@ namespace Hooks stl::write_thunk_call(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x3F0, 0x3F3, 0x548)); stl::write_thunk_call(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x458, 0x45B, 0x5B0)); stl::write_thunk_call(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x46B, 0x46E, 0x5C3)); - stl::write_thunk_call(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x406, 0x409, 0x55e)); stl::write_thunk_call(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x4F0, 0x4EF, 0x64E)); stl::write_thunk_call(REL::RelocationID(100458, 107175).address() + REL::Relocate(0x503, 0x502, 0x661)); @@ -939,11 +902,6 @@ namespace Hooks logger::info("Hooking BSLightingShader"); stl::write_vfunc<0x4, BSLightingShader_SetupMaterial>(RE::VTABLE_BSLightingShader[0]); - logger::info("Hooking BSBatchRenderer::RenderPassImmediately"); - stl::write_thunk_call(REL::RelocationID(100877, 107673).address() + REL::Relocate(0x1E5, 0x1EE)); - stl::write_thunk_call(REL::RelocationID(100852, 107642).address() + REL::Relocate(0x29E, 0x28F)); - stl::write_thunk_call(REL::RelocationID(100871, 107667).address() + REL::Relocate(0xEE, 0xED)); - // 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