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
1 change: 1 addition & 0 deletions src-bedrock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ set(SELAURA_BEDROCK_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src-client/gui/ScreenView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src-client/renderer/screen/MinecraftUIRenderContext.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src-client/uri/GameArguments.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src-client/world/BaseLightTextureImageBuilder.cpp
PARENT_SCOPE
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
void MinecraftUIRenderContext::renderCustom_hk(gsl::not_null<CustomRenderComponent*> customRender, int pass, RectangleArea* renderAABB) {
auto ofunc = selaura::trampolines::MinecraftUIRenderContext_renderCustom;

//spdlog::debug("the thing: {}", customRender->mOwner->name);
if (customRender->mOwner->name == "splash_text") {
(this->*ofunc)(customRender, pass, renderAABB);
SplashTextRenderer* renderer = reinterpret_cast<SplashTextRenderer*>(customRender->renderer);
Expand Down
12 changes: 12 additions & 0 deletions src-bedrock/src-client/world/BaseLightTextureImageBuilder.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "BaseLightTextureImageBuilder.hpp"
#include "../../../../../src-client/core/instance.hpp"

std::unique_ptr<BaseLightData> BaseLightTextureImageBuilder::createBaseLightTextureData_hk(void* clientInstance, const BaseLightData& base_light_data) {
auto ofunc = selaura::trampolines::BaseLightTextureImageBuilder_createBaseLightTextureData;
auto data = (this->*ofunc)(clientInstance, base_light_data);

data->mNightvisionActive = true;
data->mNightvisionScale = 1.0f;

return data;
}
17 changes: 17 additions & 0 deletions src-bedrock/src-client/world/BaseLightTextureImageBuilder.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once
#include <memory>
#include <cstddef>
#include <cstdint>

#include "../../../src-client/memory/patterns.hpp"

struct BaseLightData {
std::byte pad[0x24];
bool mNightvisionActive;
std::byte pad2[0x03];
float mNightvisionScale;
};

struct BaseLightTextureImageBuilder {
std::unique_ptr<BaseLightData> createBaseLightTextureData_hk(void* clientInstance, const BaseLightData& base_light_data);
};
5 changes: 5 additions & 0 deletions src-client/memory/patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ namespace selaura {
reinterpret_cast<void**>(&selaura::trampolines::GameArguments_onUri));
}));

tasks.push_back(std::async(std::launch::async, [&] {
REGISTER_HOOK(&BaseLightTextureImageBuilder::createBaseLightTextureData_hk,
reinterpret_cast<void**>(&selaura::trampolines::BaseLightTextureImageBuilder_createBaseLightTextureData));
}));

for (auto& task : tasks) task.get();
}
};
4 changes: 3 additions & 1 deletion src-client/memory/patterns/latest_windows.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
#include "src-client/bgfx/bgfx.hpp"
#include "src-client/gui/ScreenView.hpp"
#include "src-client/uri/GameArguments.hpp"
#include "src-client/world/BaseLightTextureImageBuilder.hpp"

DEFINE_SIG(&bgfx::d3d11::RendererContextD3D11::submit_hk, "48 8B C4 55 53 56 57 41 54 41 55 41 56 41 57 48 81 EC ? ? ? ?");
DEFINE_SIG(&bgfx::d3d12::RendererContextD3D12::submit_hk, "40 55 53 56 57 41 54 41 55 41 56 41 57 B8");
DEFINE_SIG(&GameArguments::_onUri_hk, "48 89 5C 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? B8 ? ? ? ? E8 ? ? ? ? 48 2B E0 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8B FA 48 8B F1");
DEFINE_SIG(&ScreenView::setupAndRender_hk, "48 8B C4 48 89 58 18 55 56 57 41 54 41 55 41 56 41 57 48 8D A8 98 FD");
DEFINE_SIG(&ScreenView::setupAndRender_hk, "48 8B C4 48 89 58 18 55 56 57 41 54 41 55 41 56 41 57 48 8D A8 98 FD");
DEFINE_SIG(&BaseLightTextureImageBuilder::createBaseLightTextureData_hk, "48 89 5C 24 ? 48 89 54 24 ? 55 56 57 41 56 41 57 48 83 EC 40 4D 8B F1");
2 changes: 2 additions & 0 deletions src-client/memory/trampolines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
#include "src-client/gui/ScreenView.hpp"
#include "src-client/gui/controls/renderers/SplashTextRenderer.hpp"
#include "src-client/uri/GameArguments.hpp"
#include "src-client/world/BaseLightTextureImageBuilder.hpp"

namespace selaura::trampolines {
inline decltype(&bgfx::d3d11::RendererContextD3D11::submit_hk) bgfx_d3d11_RendererContextD3D11_submit = 0;
inline decltype(&bgfx::d3d12::RendererContextD3D12::submit_hk) bgfx_d3d12_RendererContextD3D12_submit = 0;
inline decltype(&GameArguments::_onUri_hk) GameArguments_onUri = 0;
inline decltype(&ScreenView::setupAndRender_hk) ScreenView_setupAndRender = 0;
inline decltype(&MinecraftUIRenderContext::renderCustom_hk) MinecraftUIRenderContext_renderCustom = 0;
inline decltype(&BaseLightTextureImageBuilder::createBaseLightTextureData_hk) BaseLightTextureImageBuilder_createBaseLightTextureData = 0;

#ifdef SELAURA_WINDOWS
inline decltype(&IDXGIFactory2_hk_CreateSwapChainForCoreWindow) IDXGIFactory2_CreateSwapChainForCoreWindow = 0;
Expand Down
Loading