-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added preframe hook refresh to fix disconnect crash
- Loading branch information
Showing
12 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "refresh_hook.h" | ||
#include "../../Hooks/hooks.h" | ||
#include "../../Utilities/vtablehook.h" | ||
|
||
using namespace big; | ||
namespace plugins | ||
{ | ||
static bool refresh = false; | ||
void refresh_preframe_hook() | ||
{ | ||
const auto border_input_node = BorderInputNode::GetInstance(); | ||
if (!border_input_node) return; | ||
|
||
const auto game_context = ClientGameContext::GetInstance(); | ||
if (!game_context) return; | ||
|
||
const auto player_manager = game_context->m_pPlayerManager; | ||
if (!player_manager) return; | ||
|
||
// Rehooking PreFrameUpdate vtable to prevent crashes when leaving the server (credits Menool) | ||
if (!IsValidPtr(player_manager->m_pLocalPlayer)) | ||
{ | ||
if (!refresh) | ||
{ | ||
refresh = true; | ||
|
||
hook_vtable_func(reinterpret_cast<PDWORD64*>(border_input_node->m_Vtable), reinterpret_cast<PBYTE>(PreFrame::oPreFrameUpdate), 3); | ||
} | ||
|
||
return; | ||
} | ||
else if (refresh) | ||
{ | ||
refresh = false; | ||
|
||
PreFrame::oPreFrameUpdate = reinterpret_cast<PreFrame::PreFrameUpdate_t>(hook_vtable_func(reinterpret_cast<PDWORD64*>(border_input_node->m_Vtable), reinterpret_cast<PBYTE>(&PreFrame::hkPreFrame), 3)); | ||
LOG(INFO) << xorstr_("Refreshed PreFrame."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
#include "../../SDK/sdk.h" | ||
|
||
namespace plugins | ||
{ | ||
void refresh_preframe_hook(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters