Classes Conversion C++ --> Delphi
Okay so I have decided to start converting some of the C++ classes, As you probably know I dont use any classes except for my own built ones in the Delphi hacks, But I have come to realize these Delphi hacks could be alot more "useful" if I had some of the SDK classes to get easy access to common values for the game. I see some people talk about the classes changing so it's poinless me just converting from F.E.A.R SDK, I instead took a look at the classes in mmob C++ base and attemoted to convert some small classes to start with, But what I need to know are these classes outdated or will these be okay to convert and use?
C++ Classes
I have converted to Delphi:
I am just having a problem at the moment typecasting it pLocalInfo (pointer to LocalInfo)
I have tried the following without success...
pLocal:= pLocalInfo(ADDR_LOCALPTR); //TypeCast to pLocalInfo
iKills:= pLocal.gotoInfo.gotoPlayers.Kills; /Failer...
Before I continue failing I thought I would just check to make sure that I am using the currently correct classes. Any help is appreciated
C++ Classes
Code:
class c_player
{
public:
char unknown1[4];
__int32 ClientID;
char unknown2[8];
char Name[24];
int* Object;
__int32 Kills;
__int32 Deaths;
char unknown3[44];
__int32 HeadShots;
char unknown4[12];
__int32 TeamID;
char unknown5[4];
bool isDead;
char unknown6[507];
c_player* Next;
};
class Something
{
public:
bool bIsAlive;
};
class WepInfo
{
public:
__int32 iBackPackABulletsLeft;
__int32 i2ndaryBulletsLeft;
__int32 Unknown1;
__int32 iGrenadesLeft;
__int32 iBackPackBBulletsLeft;
};
class Info
{
public:
char unknown1[12];
__int32 iHP;
__int32 iAP;
__int32 iMaxHP;
__int32 iMaxAP;
WepInfo* gotoWepInfo;
Something* goToSomething;
char unknown2[364];
float fStamina;
__int32 iIsRunning;
__int32 iIsJumping;
__int32 iWeaponSlotInUse;
char unknown3[44];
c_player* goToPlayers;
};
class LocalInfo
{
public:
Info* goToInfoClass;
};
I have converted to Delphi:
Code:
interface uses Windows; Const ADDR_LOCALPTR = $378314F0; type pSomething = ^Something; Something = Record iIsA****** Boolean; end; type pC_Player = ^C_Player; C_Player = Record Unknown1: array[0..3] of Char; ClientID: Integer; Unknown2: array[0..7] of Char; Name: array[0..23] of Char; Object1: ^Integer; Kills: Integer; Deaths: Integer; Unknown3: array[0..43] of Char; HeadShots: Integer; Unknown4: array[0..11] of Char; TeamID: Integer; Unknown5: array[0..3] of Char; isDead: Boolean; Next: pC_Player; end; type pWepInfo = ^WepInfo; WepInfo = Record iBackPackABulletsLeft: Integer; i2ndaryBulletsLeft: Integer; Unknown1: Integer; iGrenadesLeft: Integer; iBackPackBBulletsLeft: Integer; end; type pInfo = ^Info; Info = Record Unknown1: array[0..11] of Char; iHP: Integer; iAP: Integer; iMaxAP: Integer; gotoWepInfo: pWepInfo; gotoSomething: pSomething; Unknown2: array[0..362] of Char; fStamina: Single; iIsRunning: Integer; iIsJumping: Integer; iWeaponSlotInUse: Integer; Unknown3: array[0..43] of Char; gotoPlayers: pC_player; end; type pLocalInfo = ^LocalInfo; LocalInfo = Record gotoInfo: pInfo; end; Var pLocal: pLocalInfo; implementation end.
I have tried the following without success...
pLocal:= pLocalInfo(ADDR_LOCALPTR); //TypeCast to pLocalInfo
iKills:= pLocal.gotoInfo.gotoPlayers.Kills; /Failer...
Before I continue failing I thought I would just check to make sure that I am using the currently correct classes. Any help is appreciated