Post: Help! Ida finding worldpostoscreenos_r
02-25-2016, 09:43 PM #1
TheGreenPlanet
Do a barrel roll!
(adsbygoogle = window.adsbygoogle || []).push({}); Hi NGU, recently ive been looking into SPRX making and therefore IDA. I have the cod4 pdb where the function FX_heightWorldToScreen (WorldToScreenPos_r). The goal is to find the function for BO1, Ive been trying for 4 days with no luck because it only have 1 xref. Could you guys help me find the address for it?
02-25-2016, 09:46 PM #2
Originally posted by PlanetJulgran View Post
Hi NGU, recently ive been looking into SPRX making and therefore IDA. I have the cod4 pdb where the function FX_heightWorldToScreen (WorldToScreenPos_r). The goal is to find the function for BO1, Ive been trying for 4 days with no luck because it only have 1 xref. Could you guys help me find the address for it?


Moved to Computer Programming Inquiries.
02-25-2016, 11:11 PM #3
Sabotage
Gaming Squad
Originally posted by PlanetJulgran View Post
Hi NGU, recently ive been looking into SPRX making and therefore IDA. I have the cod4 pdb where the function FX_heightWorldToScreen (WorldToScreenPos_r). The goal is to find the function for BO1, Ive been trying for 4 days with no luck because it only have 1 xref. Could you guys help me find the address for it?


you will need to remake the function, find refdef which in inside of the cgArray structure, then from there you can google one of the WorldToScreen Functions here is an example of how it.


typedef struct
{
char padding00[0x8]; //0x8
int Width; //0x8
int Height; //0xC
char padding01[0x14]; //0x10
Vector3 Fov_v; //0x24
char padding02[0x4]; //0x30
float Fov; //0x34
Vector3 ViewOrigin; //0x38
char padding03[0x4]; //0x44
Vector3 ViewAxis[3]; //0x48
} RefDef;


    bool WorldPosToScreenPos(int localClient, Vector3* In, Vector2* Out)
{
Vector3 Position = SubstractVector(*In, refdefs.ViewOrigin);
Vector3 Transform;

Transform.x = DotProduct(Position, refdefs.ViewAxis[1]);
Transform.y = DotProduct(Position, refdefs.ViewAxis[2]);
Transform.z = DotProduct(Position, refdefs.ViewAxis[0]);

if (Transform.z < 0.1f)
return false;

Vector2 Center = { (float)refdefs.Width * 0.5f, (float)refdefs.Height * 0.5f };
Vector2 OutPut = { Center.x * (1 - (Transform.x / refdefs.Fov.x / Transform.z)), Center.y * (1 - (Transform.y / refdefs.Fov.y / Transform.z)) };
*Out = OutPut;
return true;
}
Last edited by Sabotage ; 02-25-2016 at 11:36 PM.
02-26-2016, 12:54 AM #4
TheGreenPlanet
Do a barrel roll!
Thanks M8 Smile
Last edited by TheGreenPlanet ; 02-26-2016 at 11:26 AM.
02-26-2016, 01:48 AM #5
Originally posted by PlanetJulgran View Post
Wow, well that explains why i couldn't find it xD thank you so much Smile i have a few questions tho since im a noob. refdef is a function, right? why did you type char padding00 etc? And what is/does cg_s?


Please quote the user, so they know you responded.
02-26-2016, 11:25 AM #6
TheGreenPlanet
Do a barrel roll!
Originally posted by Sabotage View Post
you will need to remake the function, find refdef which in inside of the cgArray structure, then from there you can google one of the WorldToScreen Functions here is an example of how it.


typedef struct
{
char padding00[0x8]; //0x8
int Width; //0x8
int Height; //0xC
char padding01[0x14]; //0x10
Vector3 Fov_v; //0x24
char padding02[0x4]; //0x30
float Fov; //0x34
Vector3 ViewOrigin; //0x38
char padding03[0x4]; //0x44
Vector3 ViewAxis[3]; //0x48
} RefDef;


    bool WorldPosToScreenPos(int localClient, Vector3* In, Vector2* Out)
{
Vector3 Position = SubstractVector(*In, refdefs.ViewOrigin);
Vector3 Transform;

Transform.x = DotProduct(Position, refdefs.ViewAxis[1]);
Transform.y = DotProduct(Position, refdefs.ViewAxis[2]);
Transform.z = DotProduct(Position, refdefs.ViewAxis[0]);

if (Transform.z < 0.1f)
return false;

Vector2 Center = { (float)refdefs.Width * 0.5f, (float)refdefs.Height * 0.5f };
Vector2 OutPut = { Center.x * (1 - (Transform.x / refdefs.Fov.x / Transform.z)), Center.y * (1 - (Transform.y / refdefs.Fov.y / Transform.z)) };
*Out = OutPut;
return true;
}

Wow, well that explains why i couldn't find it xD thank you so much Smile i have a few questions tho since im a noob. refdef is a function, right? why did you type char padding00 etc? And what is/does cg_s?
02-27-2016, 03:56 AM #7
Winter
Purple God
Originally posted by PlanetJulgran View Post
Wow, well that explains why i couldn't find it xD thank you so much Smile i have a few questions tho since im a noob. refdef is a function, right? why did you type char padding00 etc? And what is/does cg_s?


refdef is a typedef definition for a structure.

char is a single byte, the reason that the padding is there is to fill out what is unknown.
an int is four bytes etc..
    
//FF 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 01

struct exmpl {
char a; //FF
int b; //00 00 00 01
char unk_0[0x08]; //00 00 00 00 00 00 00 00, 1 * 8 = 8
int c; // //00 00 00 01
}


cg_s is your local info in simple terms
02-27-2016, 11:41 PM #8
TheGreenPlanet
Do a barrel roll!
ohh, thanks Smile

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo