Skip to content

Commit

Permalink
feat: weird pointers now use address library as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Yamashi committed Feb 12, 2022
1 parent 8c098f7 commit 543a379
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
21 changes: 16 additions & 5 deletions Code/client/Games/Skyrim/BSGraphics/BSGraphicsRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,25 @@ void Hook_StopTimer(int type)
}

static TiltedPhoques::Initializer s_viewportHooks([]() {
const VersionDbPtr<void> initWindowLoc(77226);
// patch dwStyle in BSGraphics::InitWindows
TiltedPhoques::Put(0x140DA38E4 + 1, WS_OVERLAPPEDWINDOW);

TiltedPhoques::Put(mem::pointer(initWindowLoc.GetPtr()) + 0x174 + 1, WS_OVERLAPPEDWINDOW);

const VersionDbPtr<void> windowLoc(68781);
// TODO: move me to input patches.
// don't let the game steal the media keys in windowed mode
TiltedPhoques::Put(0x140C40235 + 2, /*strip DISCL_EXCLUSIVE bits and append DISCL_NONEXCLUSIVE*/ 3);
TiltedPhoques::Put(mem::pointer(windowLoc.GetPtr()) + 0x55 + 2, /*strip DISCL_EXCLUSIVE bits and append DISCL_NONEXCLUSIVE*/ 3);


const VersionDbPtr<void> timerLoc(77246);
const VersionDbPtr<void> renderInit(77226);

TiltedPhoques::SwapCall(mem::pointer(timerLoc.GetPtr()) + 9, StopTimer, &Hook_StopTimer);

Renderer_Init = static_cast<decltype(Renderer_Init)>(renderInit.GetPtr());

TiltedPhoques::SwapCall(0x140DA5B09, StopTimer, &Hook_StopTimer);
TiltedPhoques::SwapCall(0x1405D4C2A, Renderer_Init, &Hook_Renderer_Init);
// Once we find a proper way to locate it for different versions, go back to swapcall
//TiltedPhoques::SwapCall(mem::pointer(initLoc.GetPtr()) + 0xD1A, Renderer_Init, &Hook_Renderer_Init);
TP_HOOK_IMMEDIATE(&Renderer_Init, &Hook_Renderer_Init);
});
} // namespace BSGraphics
6 changes: 4 additions & 2 deletions Code/client/Games/Skyrim/Projectiles/Projectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ static TiltedPhoques::Initializer s_projectileHooks([]() {

TP_HOOK(&RealLaunch, HookLaunch);

static VersionDbPtr<void*> hookLoc(34452);

struct C : TiltedPhoques::CodeGenerator
{
C()
Expand All @@ -119,7 +121,7 @@ static TiltedPhoques::Initializer s_projectileHooks([]() {
cmp(rbx, 0);
jz("exit");
// jump back
jmp_S(0x14056B9D9);
jmp_S(uintptr_t(hookLoc.Get()) + 0x379);

L("exit");
// return false; scratch space from the registers
Expand All @@ -136,6 +138,6 @@ static TiltedPhoques::Initializer s_projectileHooks([]() {
ret();
}
} gen;
TiltedPhoques::Jump(0x14056B9D4, gen.getCode());
TiltedPhoques::Jump(uintptr_t(hookLoc.Get()) + 0x374, gen.getCode());
});

2 changes: 1 addition & 1 deletion Code/client/VersionDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ VersionDb& GetVersionDb()
static VersionDb db;
static std::once_flag flag;
std::call_once(flag, []() {
auto result = db.Load(1,6,323,0);
auto result = db.Load(1,6,353,0);
if (result != true)
{
spdlog::error("Failed to load address library!");
Expand Down
4 changes: 2 additions & 2 deletions Code/immersive_launcher/TargetConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ static constexpr TargetConfig CurrentTarget{
L"SkyrimTogether.dll",
L"Skyrim Special Edition",
L"Skyrim Special Edition",
"1.6.323.0",
489830, 0x40000000, 35403608};
"1.6.353.0",
489830, 0x40000000, 35410264};
#define TARGET_NAME = "SkyrimSE";
#elif defined(TARGET_FT)
static constexpr TargetConfig CurrentTarget{
Expand Down

0 comments on commit 543a379

Please sign in to comment.