As far as I tested, this works for any cod...
Load up the CoD you want on IDA Pro and go to Search Text and search for "Can't create Dvar"
You'll end up on something like this:
https://screenshotuploader.com/i/01/ats10bjbf.png
This function has everything you need.
Press F5 to go to PseudoCode view.
You'll see a if testing if the dvar list is full:
Code:
if ( dword_59B3CA0 >= 4096 )
in this case, dword_59B3CA0 holds the max of dvars allowed (usually 4096).
Right after the is the pointer to the dvar struct:
Code:
v10 = (int)((char *)&unk_59B8CC8 + 76 * v9);
unk_59B8CC8 is the start of the dvar list. 76(0x4C) is the size of the dvar struct. v9 is the Dvar index on the list.
After this there's a switch testing for the dvar type and setting the value.
Code:
*(_BYTE *)(v10 + 8) = a2;
switch ( a2 )
{
case 7:
v11 = sub_42BE30(LODWORD(a4));
*(_DWORD *)(v10 + 12) = v11;
*(_DWORD *)(v10 + 28) = v11;
*(_DWORD *)(v10 + 44) = v11;
break;
bla bla bla...
}
Hopefully, now you can already see the dvar struct (more or less)...
This is the base struct (it has more stuff in it) for MW3:
Code:
class dvar_t_mw3
{
public:
char* Name; //0x0000
char unk1[4]; //0x0004
BYTE bType; //0x0008
char unk2[3]; //0x0009
__int32 iValue; //0x000C
char unk3[60]; //0x0010
};//Size=0x004C
To log all dvars you can now simply do:
Code:
for(int i = 0; i < *(DWORD*)0x59B3CA0; i++)
{
dvar_t_mw3 *Dvar = (dvar_t_mw3*)(0x59B8CC8 + i * 0x4C);
if(Dvar != NULL)
Log("%s 0x%.8X\n", Dvar->Name, &Dvar->iValue);
}