Post: How do I reverse/find the RefDef struct?
07-25-2016, 08:17 PM #1
TheGreenPlanet
Do a barrel roll!
(adsbygoogle = window.adsbygoogle || []).push({}); Hi! So I need some help with reversing the RefDef struct. I've looked at the Quake Source to find where its being used but ive had no luck in finding it. Can someone help? Is there a string or a known function I can use to find it?
(adsbygoogle = window.adsbygoogle || []).push({});
08-01-2016, 10:11 AM #2
SyGnUs
Give a F*** About Your Lifestyle
Originally posted by PlanetJulgran View Post
Hi! So I need some help with reversing the RefDef struct. I've looked at the Quake Source to find where its being used but ive had no luck in finding it. Can someone help? Is there a string or a known function I can use to find it?


Find a function that uses it as a parameter as that will make it easier to find. Also, it can be accessed through the cg_t struct and that is how most functions use it.

Here's an example, CL_RenderScene takes RefDef_t as a parameter so you want to go to a function that calls CL_RenderScene in BO2 that is CG_DrawActive. So once you find those two functions you will be able to find the location of RefDef_t in cg_t by looking at where CL_RenderScene is called in CG_DrawActive as if you look in IDA you can see the the parameters that are being given to call CL_RenderScene.

If you have some PPC knowledge you should be able to know how it is doing cg_t + 0x????? for refdef_t, I won't go into much detail but it will be like this - lis r#, 0x? then ori r#, r#, 0x????. That;s how you get the location of RefDef_t in cg_t, there is other ways to, but can't really recall any.

Note: There is a leaked pdb for BO2 so you are better off using that rather than Quake Source, same for most newer cods, it's better to use one of the leaked PDBs.

The following user thanked SyGnUs for this useful post:

TheGreenPlanet
08-02-2016, 02:19 PM #3
TheGreenPlanet
Do a barrel roll!
Originally posted by SyGnUs View Post
Find a function that uses it as a parameter as that will make it easier to find. Also, it can be accessed through the cg_t struct and that is how most functions use it.

Here's an example, CL_RenderScene takes RefDef_t as a parameter so you want to go to a function that calls CL_RenderScene in BO2 that is CG_DrawActive. So once you find those two functions you will be able to find the location of RefDef_t in cg_t by looking at where CL_RenderScene is called in CG_DrawActive as if you look in IDA you can see the the parameters that are being given to call CL_RenderScene.

If you have some PPC knowledge you should be able to know how it is doing cg_t + 0x????? for refdef_t, I won't go into much detail but it will be like this - lis r#, 0x? then ori r#, r#, 0x????. That;s how you get the location of RefDef_t in cg_t, there is other ways to, but can't really recall any.

Note: There is a leaked pdb for BO2 so you are better off using that rather than Quake Source, same for most newer cods, it's better to use one of the leaked PDBs.

Thanks for the reply Smile I'll try using cl_drawactive. Btw isn't that function huge?
08-03-2016, 04:29 AM #4
SyGnUs
Give a F*** About Your Lifestyle
Originally posted by PlanetJulgran View Post
Thanks for the reply Smile I'll try using cl_drawactive. Btw isn't that function huge?


It's a decent size, but you only need to look at the end of the function Winky Winky

The following user thanked SyGnUs for this useful post:

TheGreenPlanet

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo