From d66c4da19bd5c58eca6e70f4f3e32f0a3a9e172d Mon Sep 17 00:00:00 2001 From: drof Date: Sat, 7 Nov 2026 20:24:24 +0000 Subject: [PATCH] Dateien nach "/" hochladen --- entry.cpp | 298 +++++++++++++++++++++++++++++++++++++++++++++++++ stackcheck.asm | 4 + xmm_reg.asm | 27 +++++ 3 files changed, 329 insertions(+) create mode 100644 entry.cpp create mode 100644 stackcheck.asm create mode 100644 xmm_reg.asm diff --git a/entry.cpp b/entry.cpp new file mode 100644 index 0000000..dc94c52 --- /dev/null +++ b/entry.cpp @@ -0,0 +1,298 @@ +#include "inc/include.h" + +extern "C" +{ + extern u64 some_stuff(); + + __attribute__((naked)) void nopstub() + { + __asm + { + jmp some_stuff + } + } + + void init(Context* pctx) + { + auto& state = pctx->state; + state.in_forward.construct( pctx->game_base + OFF_IN_FORWARD ); + state.in_duck.construct( pctx->game_base + OFF_IN_DUCK ); + state.in_jump.construct( pctx->game_base + OFF_IN_JUMP ); + + state.fp_cache[0] = xf(0x3F000000); + state.fp_cache[1] = xf(0x3F800000); + state.fp_cache[2] = xf(0); + } + + const char *get_player_name(Context *ctx, u64 player) + { + return ctx->pfn_get_player_name(player); + } + + GameModes get_game_mode(Context* pctx) + { + u64 mp_gamemode_base = pctx->game_base + OFF_GAMEMODE; + if(mp_gamemode_base != 0ull) + { + auto gamemode_addr = *(u64*)(mp_gamemode_base + 0x50); + auto gamemode = *(u64*)gamemode_addr; + + pctx->state.game_mode_raw = gamemode; + + if(gamemode == 0x6c61766976727573) + return GameModes::SURVIVAL; + else if(gamemode == 0x6c006d6465657266) + { + auto squad_id = *(int*)(pctx->me + OFF_ENTITY_SQUAD_ID); + if(squad_id == -1) + { + return GameModes::TEAM_DEATHMATCH; + } else + { + return GameModes::GUN_RUN; + } + } else if(gamemode == 0x6c6f72746e6f63) + { + return GameModes::CONTROL; + } + } + + return GameModes::INVALID; + } + + bool process_entity(Context* pctx, Entity& me, size_t eidx, Entity& ent, CachedEntity* prec) + { + if(ent.is_alive()) + { + auto type = ent.type(); + if(type != EEntityType::INVALID) + { + if(type == EEntityType::DUMMIE || type == EEntityType::PLAYER) + { + prec->is_valid = true; + prec->signifier = ent.signifier_id(); + + if(type == EEntityType::PLAYER) + { + prec->is_ally = ent.is_ally_of(pctx, me); + prec->name = get_player_name(pctx, ent.base()); // TODO + prec->level = ent.get_level(pctx); + } else + { + prec->name = nullptr; + } + + auto vec_origin = ent.vec_origin(); + auto my_origin = me.vec_origin(); + auto vec_delta = (vec_origin - my_origin); + float dist = vec_delta.length_sqr(); + prec->dist_to_local = fabsf( pctx, dist ); + + prec->health = ent.health(); + prec->vec_origin = ent.vec_origin(); + + auto coll = ent.collision(); + auto coord_frame = ent.coord_frame(); + if (coll == nullptr) + { + prec->rpts_avail = false; + } else + { + auto vec_mins = coll->vec_mins(); + auto vec_maxs = coll->vec_maxs(); + + prec->rpts_avail = math::setup_render_points(pctx, coord_frame, vec_mins, vec_maxs, prec->rpts); + + if(prec->rpts_avail == true) + { + prec->draw_pos_top[0] = prec->rpts.x; + prec->draw_pos_top[1] = prec->rpts.y - xf(0x41B80000); + } + } + + auto curr_health = prec->health; + if(curr_health == 100) + { + prec->color[0] = 65; + prec->color[1] = 255; + prec->color[2] = 65; + } else if(curr_health > 65) + { + prec->color[0] = 255; + prec->color[1] = 255; + prec->color[2] = 65; + } else{ + prec->color[0] = 255; + prec->color[1] = 65; + prec->color[2] = 65; + } + + return true; + } else + { + prec->is_valid = false; + } + } else + { + prec->is_valid = false; + } + } else + { + prec->is_valid = false; + } + return false; + } + + void cache_entities(Context* pctx, Entity& me) + { + auto entlist = reinterpret_cast(pctx->game_base + OFF_ENTITY_LIST); + + size_t highest_eidx = 0ull; + + for(size_t i = 0ull; i < 0x10000; i++) + { + auto prec = &pctx->state.entity_cache[ i ]; + auto rec = &entlist[i]; + if(rec->ptr != 0ull && rec->ptr != me.base()) + { + auto ent = Entity(rec->ptr); + if(process_entity( pctx, me, i, ent, prec ) && i > highest_eidx) + { + highest_eidx = i; + } + } else + { + prec->is_valid = false; + } + } + + pctx->state.highest_eidx = highest_eidx; + } + + void think(Context* pctx) + { + auto me = r5::local_player(pctx); + if(me.is_valid() && me.is_alive()) + { + pctx->state.game_mode = get_game_mode(pctx); + pctx->me = me.base(); + features::glow( pctx ); + features::movement( pctx ); + features::esp_tick( pctx ); + } + } + + __declspec(dllexport) bool __fastcall hkIsGamepadDisabled(u64 inst) + { + u64 retaddr = BASE_OF(_ReturnAddress()) & 0xFFFF; + + u64 context_base = 0xFAFBFCFDFEFAFDFE; + Context* pctx = (Context*)context_base; + + bool result = pctx->state.is_controller; + + if(retaddr != 0xB6A0) + return result; + + if(r5::is_valid_context(pctx) && pctx->state.is_controller == false) + { + float mouse_x = xf(0x0), mouse_y = xf(0x0); + float orig_mouse_x = xf(0x0), orig_mouse_y = xf(0x0); + + read_xmm6(&mouse_x); + read_xmm7(&mouse_y); + + orig_mouse_x = mouse_x; + orig_mouse_y = mouse_y; + + features::rcs(pctx, mouse_x, mouse_y); + + if (orig_mouse_x != mouse_x) + write_xmm6(mouse_x); + if(orig_mouse_y != mouse_y) + write_xmm7(mouse_y); + } + + return result; + } + + extern void MkrCtxHook(); + + __declspec(dllexport) __attribute__((naked)) void __fastcall hkMkrCtxRenderPre() + { + __asm + { + mov rbx, qword ptr [rsp+0x98] + call MkrCtxHook + movaps xmm6, xmmword ptr [rsp+0x70] + add rsp, 0x88 + pop rdi + pop rbx + ret + } + } + + void __fastcall MkrCtxHook() + { + u64 retaddr = 0ull; + __asm mov retaddr, rbx; + + if( (retaddr & 0xFFFF) != 0x6701 ) + return; // prevent rendering multiple times. + + u64 context_base = 0xFAFBFCFDFEFAFEEE; + Context *pctx = (Context *)context_base; + + if (r5::is_valid_context(pctx)) + { + u64 apex_base = pctx->game_base; + + u32 signon_state = *(u32*)(apex_base + OFF_SIGNON_STATE); + + if(signon_state == 8) + { + auto me = r5::local_player(pctx); + if(me.is_valid()) + { + cache_entities(pctx, me); + } + render::tick( pctx ); + } + } else + { + pctx->pfn_draw_colored_text( *pctx->mss_ptr, 2, 14, 450, 450, 255, 255, 255, 255, 0, "DrauseHook [DEBUG]"); + + } + } + + u64 some_stuff() + { + u64 retaddr = BASE_OF(_ReturnAddress()) & 0xFFFF; + if(retaddr == 0x7024) + { + u64 context_base = 0xFAFBFCFDFEFAFDFC; + Context* pctx = (Context*)context_base; + + if(!r5::is_valid_context(pctx)) + { + return 0ull; + } + + if(pctx->inited != 1u) + { + init(pctx); + pctx->inited = 1u; + } + + u64 apex_base = pctx->game_base; + u32 signon_state = *(u32*)(apex_base + OFF_SIGNON_STATE); + if(signon_state == 8) + { + pctx->state.is_controller = *(u8*)( apex_base + 0x1C64440 + 0x1084 ) == 1u; + think(pctx); + } + } + + return 0ull; + } +} \ No newline at end of file diff --git a/stackcheck.asm b/stackcheck.asm new file mode 100644 index 0000000..1ef509f --- /dev/null +++ b/stackcheck.asm @@ -0,0 +1,4 @@ +.text +.global __chkstk +__chkstk: + ret \ No newline at end of file diff --git a/xmm_reg.asm b/xmm_reg.asm new file mode 100644 index 0000000..9b6d469 --- /dev/null +++ b/xmm_reg.asm @@ -0,0 +1,27 @@ + +.intel_syntax + +.text +.global read_xmm7 +read_xmm7: + movaps xmm0, xmm7 + movss dword ptr [rcx], xmm0 + ret + +.global write_xmm7 +write_xmm7: + shufps xmm0, xmm0, 0 + movaps xmm7, xmm0 + ret + +.global read_xmm6 +read_xmm6: + movaps xmm0, xmm6 + movss dword ptr [rcx], xmm0 + ret + +.global write_xmm6 +write_xmm6: + shufps xmm0, xmm0, 0 + movaps xmm6, xmm0 + ret