Post: Trouble Drawing a Line in BO1 Non-Host SPRX
04-12-2016, 11:08 PM #1
Jim Halpert
Bounty hunter
(adsbygoogle = window.adsbygoogle || []).push({}); I'm trying to use CG_DrawRotatedPicPhysical to draw lines for BO1 (for ESP). However, when I call my draw line function in my hook, the game freezes when the match starts. Here's all my code that has to do with drawing a line, and I found the addresses myself (I'm pretty sure they are correct):

Function pointers:
    opd_s CG_DrawRotatedPicPhysical_t = { 0xFA640, TOC };
opd_s Material_RegisterHandle_t = { 0x7458D8, TOC };

void(*CG_DrawRotatedPicPhysical)(ScreenPlacement *scrPlace, float x, float y, float width, float height, float angle, const float *color, void *material) = (void(*)(ScreenPlacement*, float, float, float, float, float, const float*, void*))&CG_DrawRotatedPicPhysical_t;
void*(*Material_RegisterHandle)(const char *name, int imageTrack) = (void*(*)(const char *, int))&Material_RegisterHandle_t;


Screenplacement truct:
    struct ScreenPlacement
{
int64_t scaleVirtualToReal;
int64_t scaleVirtualToFull;
int64_t scaleRealToVirtual;
int64_t virtualViewableMin;
int64_t virtualViewableMax;
int64_t virtualTweakableMin;
int64_t virtualTweakableMax;
int64_t realViewportBase;
int64_t realViewportSize;
int64_t realViewportMid;
int64_t realViewableMin;
int32_t realViewableMaxX;
int32_t realViewableMaxY;
int64_t realTweakableMin;
int64_t realTweakableMax;
int64_t subScreen;
};


drawLine function:
    void drawLine(float X1, float Y1, float X2, float Y2, Color color, float a, float Width)
{
ScreenPlacement* scr = (ScreenPlacement*)0xD69D04;
float X, Y, Angle, L1, L2, H1;
H1 = Y2 - Y1;
L1 = X2 - X1;
L2 = sqrt(L1 * L1 + H1 * H1);
X = X1 + ((L1 - L2) / 2);
Y = Y1 + (H1 / 2);
scr->realViewableMaxX = (int32_t)X;
scr->realViewableMaxY = (int32_t)Y;
Angle = (float)atan(H1 / L1) * (180 / 3.14159265358979323846);
float colorf[4] = { color.r, color.g, color.b, a};
CG_DrawRotatedPicPhysical(scr, X, Y, L2, Width, Angle, colorf, Material_RegisterHandle("white", 0));
}


here's how I call it in the hook:
    UI::drawLine(400, 100, 150, 150, UI::Colors::green, 1.0f, 1.0f);


You must login or register to view this content.

Please help, I would really like getting along with my menu but this is killing me.
04-14-2016, 01:31 PM #2
Toxic
former staff
Originally posted by Jim
I'm trying to use CG_DrawRotatedPicPhysical to draw lines for BO1 (for ESP). However, when I call my draw line function in my hook, the game freezes when the match starts. Here's all my code that has to do with drawing a line, and I found the addresses myself (I'm pretty sure they are correct):

Function pointers:
    opd_s CG_DrawRotatedPicPhysical_t = { 0xFA640, TOC };
opd_s Material_RegisterHandle_t = { 0x7458D8, TOC };

void(*CG_DrawRotatedPicPhysical)(ScreenPlacement *scrPlace, float x, float y, float width, float height, float angle, const float *color, void *material) = (void(*)(ScreenPlacement*, float, float, float, float, float, const float*, void*))&CG_DrawRotatedPicPhysical_t;
void*(*Material_RegisterHandle)(const char *name, int imageTrack) = (void*(*)(const char *, int))&Material_RegisterHandle_t;


Screenplacement truct:
    struct ScreenPlacement
{
int64_t scaleVirtualToReal;
int64_t scaleVirtualToFull;
int64_t scaleRealToVirtual;
int64_t virtualViewableMin;
int64_t virtualViewableMax;
int64_t virtualTweakableMin;
int64_t virtualTweakableMax;
int64_t realViewportBase;
int64_t realViewportSize;
int64_t realViewportMid;
int64_t realViewableMin;
int32_t realViewableMaxX;
int32_t realViewableMaxY;
int64_t realTweakableMin;
int64_t realTweakableMax;
int64_t subScreen;
};


drawLine function:
    void drawLine(float X1, float Y1, float X2, float Y2, Color color, float a, float Width)
{
ScreenPlacement* scr = (ScreenPlacement*)0xD69D04;
float X, Y, Angle, L1, L2, H1;
H1 = Y2 - Y1;
L1 = X2 - X1;
L2 = sqrt(L1 * L1 + H1 * H1);
X = X1 + ((L1 - L2) / 2);
Y = Y1 + (H1 / 2);
scr->realViewableMaxX = (int32_t)X;
scr->realViewableMaxY = (int32_t)Y;
Angle = (float)atan(H1 / L1) * (180 / 3.14159265358979323846);
float colorf[4] = { color.r, color.g, color.b, a};
CG_DrawRotatedPicPhysical(scr, X, Y, L2, Width, Angle, colorf, Material_RegisterHandle("white", 0));
}


here's how I call it in the hook:
    UI::drawLine(400, 100, 150, 150, UI::Colors::green, 1.0f, 1.0f);


You must login or register to view this content.

Please help, I would really like getting along with my menu but this is killing me.


Thread has been moved to Computer Programming Inquires section hoping you'll get some good answers :p
04-14-2016, 03:35 PM #3
Jim Halpert
Bounty hunter
Thx m80

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo