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 signatures broken by the 02/02/2023 update #153

Merged
merged 2 commits into from
Jun 12, 2023
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/core/hooks/overrideview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void Hooks::OverrideView::hook(void* thisptr, ViewSetup* setup) {
Interfaces::trace->TraceRay(traceRay, 0x1, &traceFilter, &tr);

if (CONFIGBOOL("Visuals>World>World>Third Person"))
Interfaces::input->m_vecCameraOffset = Vector(viewAngles.x, viewAngles.y, 100 * ((tr.fraction < 1.0f) ? tr.fraction : 1.0f) );
Interfaces::input->m_vecCameraOffset = Vector(viewAngles.x, viewAngles.y, 100 * ((tr.fraction < 1.0f) ? tr.fraction : 1.0f) );
Interfaces::input->m_fCameraInThirdPerson = CONFIGBOOL("Visuals>World>World>Third Person");


Expand Down
4 changes: 2 additions & 2 deletions src/sdk/interfaces/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ bool Interfaces::init() {

/* Get input (for thirdperson) */
uintptr_t activateMouse = reinterpret_cast<uintptr_t>(getVTable(client)[16]);
input = **reinterpret_cast<CInput***>(getAbsoluteAddress(activateMouse, 3, 7));
input = *reinterpret_cast<CInput**>(getAbsoluteAddress(activateMouse, 3, 7));
Log::log(LOG, " Input %lx", (uintptr_t)input);

/* Get PlayerResource */
uintptr_t instructionAddr = PatternScan::findFirstInModule("/client_client.so", " 48 8B 05 ? ? ? ? 55 48 89 E5 48 85 C0 74 10 48");
_playerResource = reinterpret_cast<PlayerResource**>(getAbsoluteAddress(instructionAddr, 3, 7));
Log::log(LOG, " PlayerResource %lx", (uintptr_t)_playerResource);

renderBeams = **relativeToAbsolute<ViewRenderBeams***>(PatternScan::findFirstInModule("/client_client.so", "4C 89 F6 4C 8B 25 ? ? ? ? 48 8D 05") + 6); // Credit: danielkrupinski
renderBeams = *relativeToAbsolute<ViewRenderBeams**>(PatternScan::findFirstInModule("/client_client.so", "48 8D 05 ? ? ? ? 48 8B 38 48 8B 07 FF 10 48 8D 05 ? ? ? ? 48 8B 38") + 3); // Credit: danielkrupinski
Log::log(LOG, " renderBeams %lx", (uintptr_t)renderBeams);

Log::log(LOG, "Initialised interfaces!");
Expand Down
53 changes: 38 additions & 15 deletions src/sdk/netvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,67 +47,90 @@ bool Netvar::init() {

Log::log(LOG, "Initialising offsets");

// xref: "ClanTagChanged"
Offsets::sendClantag = (Offsets::SendClantag)PatternScan::findFirstInModule("engine_client.so",
"55 48 89 E5 41 55 49 89 FD 41 54 BF");
"55 48 89 E5 41 55 49 89 FD BF ? ? ? ? 41 54 49 89 F4 53 48 83 EC 08 E8 ? ? ? ? 31 C9");
Log::log(LOG, " sendClantag | %lx", Offsets::sendClantag);

Offsets::setPlayerReady = (Offsets::SetPlayerReady)PatternScan::findFirstInModule("/client_client.so",
"55 48 89 F7 48 8D 35 ? ? ? ? 48 89 E5 E8 ? ? ? ? 85 C0");
Log::log(LOG, " setPlayerReady | %lx", Offsets::setPlayerReady);

Offsets::radarIsHltvCheck = PatternScan::findFirstInModule("/client_client.so", "84 C0 74 50 31 F6");
/**
* Find a sub with "mp_radar_showall" lea'd into rsi.
* The find a test al, al; jz there. You want the test insn.
* lea rax, qword_6D1D528
* mov rbx, [rax]
* test rbx, rbx
* jz short loc_105C560
* lea rax, qword_2373E10
* mov rdi, [rax]
* mov rax, [rdi]
* call qword ptr [rax+2E8h]
* test al, al // <--- This insn
* jz short loc_105C530
*/
Offsets::radarIsHltvCheck = PatternScan::findFirstInModule("/client_client.so", "48 8D 05 ? ? ? ? 48 8B 38 48 8B 07 FF 90 E8 02 00 00 84 C0 74");
Log::log(LOG, " radarIsHltvCheck | %lx", Offsets::radarIsHltvCheck);

Offsets::initKeyValues = (Offsets::InitKeyValues)PatternScan::findFirstInModule("/client_client.so",
"81 27 00 00 00 FF 55 45 31 C0 48 89 E5 5D");
Offsets::initKeyValues = (Offsets::InitKeyValues)PatternScan::findFirstInModule("/client_client.so",
"81 27 00 00 00 FF 55 31 C0 48 89 E5 5D");
Log::log(LOG, " initKeyValues | %lx", Offsets::initKeyValues);

// xref: _MemFreeScratch, the first call above it is to the sub we want
Offsets::loadFromBuffer = (Offsets::LoadFromBuffer)PatternScan::findFirstInModule("/client_client.so",
"55 48 89 E5 41 57 41 56 41 55 41 54 49 89 D4 53 48 81 EC ? ? ? ? 48 85"),
"55 48 89 E5 41 57 41 56 41 55 41 54 53 48 81 EC ? ? ? ? 48 85 D2"),
Log::log(LOG, " loadFromBuffer | %lx", Offsets::loadFromBuffer);

Offsets::setNamedSkybox = (Offsets::SetNamedSkybox)PatternScan::findFirstInModule("engine_client.so",
"55 4C 8D 05 ? ? ? ? 48 89 E5 41");
Log::log(LOG, " setNamedSkybox | %lx", Offsets::setNamedSkybox);

Offsets::lineGoesThroughSmoke = (Offsets::LineGoesThroughSmoke)PatternScan::findFirstInModule("/client_client.so",
"55 48 89 E5 41 56 41 55 41 54 53 48 83 EC 30 66 0F D6 45 D0");
"55 48 89 E5 41 56 41 55 41 54 53 48 83 EC 30 8B 05 ? ? ? ? 66");
Log::log(LOG, " lineGoesThroughSmoke | %lx", Offsets::lineGoesThroughSmoke);

Offsets::moveData = **reinterpret_cast<CMoveData***>(getAbsoluteAddress(PatternScan::findFirstInModule("/client_client.so",
"48 8B 0D ? ? ? ? 4C 89 EA"), 3, 7));
// xref: "CPrediction::ProcessMovement", go up by 2 jmps, find the bottommost lea rcx, off_*
Offsets::moveData = *reinterpret_cast<CMoveData**>(getAbsoluteAddress(PatternScan::findFirstInModule("/client_client.so",
"48 8D 0D ? ? ? ? 4C 8B 01"), 3, 7));
Log::log(LOG, " moveData | %lx", Offsets::moveData);

Interfaces::moveHelper = *reinterpret_cast<IMoveHelper **>(getAbsoluteAddress(PatternScan::findFirstInModule("/client_client.so",
"00 48 89 3D ? ? ? ? C3") + 1, 3, 7));
Log::log(LOG, " moveHelper | %lx", Interfaces::moveHelper);

Offsets::predictionSeed = *reinterpret_cast<int **>(getAbsoluteAddress(PatternScan::findFirstInModule("/client_client.so",
"48 8B 05 ? ? ? ? 8B 38 E8 ? ? ? ? 89 C7"), 3, 7));
// xref: _RandomSeed, not in a sub, three calls to _RandomFloat under it
// find whatever is lea'd into rax above the _RandomSeed call
Offsets::predictionSeed = reinterpret_cast<int*>(getAbsoluteAddress(PatternScan::findFirstInModule("/client_client.so",
"48 8D 05 ? ? ? ? 8B 38 E8 ? ? ? ? 89 C7"), 3, 7));
Log::log(LOG, " predictionSeed | %lx", Offsets::predictionSeed);

Offsets::animState = *reinterpret_cast<unsigned int*>(PatternScan::findFirstInModule("/client_client.so",
"55 48 89 E5 53 48 89 FB 48 83 EC 28 48 8B 05 ? ? ? ? 48 8B 00") + 52);
"48 8B BB ? ? ? ? 48 85 FF 74 3E E8") + 3);
Log::log(LOG, " animState | %lx", Offsets::animState);

uintptr_t GetLocalPlayer = reinterpret_cast<uintptr_t>(getVTable(Interfaces::engine)[12]);
Offsets::getLocalClient = reinterpret_cast<Offsets::GetLocalClient>(getAbsoluteAddress(GetLocalPlayer + 9, 1, 5));
Log::log(LOG, " getLocalClient | %lx", Offsets::getLocalClient);

// xref: "C_BaseEntity::SaveData", go up to the start of the sub
Offsets::saveData = (Offsets::SaveData)PatternScan::findFirstInModule("/client_client.so",
"55 48 89 E5 41 57 41 89 CF 41 56 41 55 41 89 D5 41 54 53 48 89 FB 48 81 EC");
"55 48 89 E5 41 57 41 89 CF 41 56 41 55 41 54 41 89 D4 53 48 89 FB 48 83 EC");
Log::log(LOG, " saveData | %lx", Offsets::saveData);

Offsets::restoreData = (Offsets::RestoreData)PatternScan::findFirstInModule("/client_client.so",
"E9 ? ? ? ? 90 55 48 63 F6");
// xref: "PreEntityPacketReceived(no commands ack)", go down to the next (and only) jmp,
// that jump is to the sub we want
Offsets::restoreData = (Offsets::RestoreData)(PatternScan::findFirstInModule("/client_client.so",
"BA FF FF FF FF 48 8D 35 ? ? ? ? E9") + 13);
Log::log(LOG, " restoreData | %lx", Offsets::restoreData);

Offsets::onPostRestoreData = (Offsets::OnPostRestoreData)PatternScan::findFirstInModule("/client_client.so",
"55 BE ? ? ? ? 48 89 E5 41 54 53 48 89 FB E8");
Log::log(LOG, " onPostRestoreData | %lx", Offsets::onPostRestoreData);

// xref: "CPrediction::RestoreEntityToPredictedFrame", go up to the start of the sub
Offsets::restoreEntityToPredictedFrame = (Offsets::RestoreEntityToPredictedFrame)PatternScan::findFirstInModule("/client_client.so",
"55 48 89 E5 41 57 41 89 D7 41 56 41 55 41 89 F5 41 54 53 48 83 EC 18");
"55 48 89 E5 41 57 41 56 41 55 41 89 F5 41 54 53 48 83 EC 18 48 8B 05 ? ? ? ? 89 55 CC 44 8B B8 ? ? ? ? 45 85 FF 0F 85 ? ? ? ? 44 89 EF");
Log::log(LOG, " restoreEntityToPredictedFrame | %lx", Offsets::restoreEntityToPredictedFrame);

return true;
Expand Down