#include "inc/include.h" namespace d3d { typedef struct _D3DMATRIX { union { struct { float _11, _12, _13, _14; float _21, _22, _23, _24; float _31, _32, _33, _34; float _41, _42, _43, _44; }; float m[4][4]; }; } D3DMATRIX; } bool render::w2s(Context* ctx, Vector3D &vIn, Vector3D* vOut) { bool result = !ctx->pfn_transform_position( vIn, vOut ); int screenWidth = 1680; int screenHeight = 1050; // NDC ranges from -1 to 1 → convert to pixel coordinates float screenX = (vOut->x * ctx->state.fp_cache[0] + ctx->state.fp_cache[0]) * screenWidth; float screenY = (ctx->state.fp_cache[1] - (vOut->y * ctx->state.fp_cache[0] + ctx->state.fp_cache[0])) * screenHeight; vOut->x = screenX; vOut->y = screenY; vOut->z = ctx->state.fp_cache[2]; return result; } /*void TestRenderAPI( Context *ctx) { volatile char buf[] = "Drofnet"; ctx->pfn_draw_colored_text( *ctx->mss_ptr, 2, 14, 75, 75, 255, 255, 255, 255, 0, (const char*)buf ); render::draw_set_color(ctx, 255, 255, 255, 255); render::draw_filled_rect(ctx, 5, 5, 50, 50); }*/ /*void DrawWorldToScreenStats(Context* ctx) { auto me = ctx->me; if(me != 0ull && PLAYER__IS_ALIVE(me)) { auto me_ent = Entity(me); auto origin = me_ent.vec_origin(); auto center = me_ent.get_center_pos(); auto coll = me_ent.collision(); Vector3D scr(xf(0), xf(0), xf(0)); int push_y = 0; ctx->pfn_draw_colored_text(*ctx->mss_ptr, 2, 14, 150, 150 + push_y, 255, 255, 255, 255, 0, "Center Pos: (%f, %f, %f)", center.x, center.y, center.z); push_y += 15; if (coll) { auto vec_mins = coll->vec_mins(); auto vec_maxs = coll->vec_maxs(); ctx->pfn_draw_colored_text(*ctx->mss_ptr, 2, 14, 150, 150 + push_y, 255, 255, 255, 255, 0, "Vec Mins: (%f, %f, %f)", vec_mins.x, vec_mins.y, vec_mins.z); push_y += 15; ctx->pfn_draw_colored_text(*ctx->mss_ptr, 2, 14, 150, 150 + push_y, 255, 255, 255, 255, 0, "Vec Maxs: (%f, %f, %f)", vec_maxs.x, vec_maxs.y, vec_maxs.z); push_y += 15; } ctx->pfn_draw_colored_text( *ctx->mss_ptr, 2, 14, 150, 150 + push_y, 255, 255, 255, 255, 0, "My Position: (%f, %f, %f)", origin.x, origin.y, origin.z ); push_y += 15; bool status = render::w2s(ctx, origin, &scr); render::draw_set_color(ctx, 255, 255, 255, 255); render::draw_filled_rect(ctx, (int)scr.x, (int)scr.y, (int)(scr.x + xf(0x42480000)), (int)(scr.y + xf(0x42480000))); status = render::w2s(ctx, center, &scr); render::draw_set_color(ctx, 255, 65, 65, 255); render::draw_filled_rect(ctx, (int)scr.x, (int)scr.y, (int)(scr.x + xf(0x42480000)), (int)(scr.y + xf(0x42480000))); if(status) { ctx->pfn_draw_colored_text( *ctx->mss_ptr, 2, 14, 150, 300, 255, 255, 255, 255, 0, "Status: VISIBLE"); } else{ ctx->pfn_draw_colored_text( *ctx->mss_ptr, 2, 14, 150, 300, 255, 255, 255, 255, 0, "Status: OBSCURED"); } } }*/ void DrawRenderStats(Context *ctx) { int push_y = 0; float time_base = r5::cur_time(ctx); ctx->pfn_draw_colored_text( *ctx->mss_ptr, 2, 14, 75, 90 + push_y, 255, 255, 255, 255, 0, "GT: %f | Highest EIDX: %llu | IC:%i", time_base, ctx->state.highest_eidx, ctx->state.is_controller); push_y += 15; ctx->pfn_draw_colored_text( *ctx->mss_ptr, 2, 14, 75, 90 + push_y, 255, 255, 255, 255, 0, "Game Mode: %i", ctx->state.game_mode ); push_y += 15; ctx->pfn_draw_colored_text( *ctx->mss_ptr, 2, 14, 75, 90 + push_y, 255, 255, 255, 255, 0, "Game Mode (Raw): %llx", ctx->state.game_mode_raw ); push_y += 15; //DrawWorldToScreenStats(ctx); } void render::tick(Context *ctx) { if(*ctx->mss_ptr == 0ull) return; //TestRenderAPI( ctx ); DrawRenderStats( ctx ); features::esp( ctx ); }