What's new

Tutorial Create Your Own Natives [XEX/SPRX]

  • Thread starter Sockstress
  • Start date
  • Views 4,406
S

Sockstress

Enthusiast
Messages
51
Reaction score
94
Today, I figured I would release how to create your own natives. It requires RGH or CFW. Could​
be done on PC no idea how though. What you will need to do is do some research or reversing to figure out what kind of native you want to do. I will be creating a native to show if a player has godmode and if he doesn't. You will need these offsets first:
One of the Large Importing Native Functions
Xex: 0x8257D0B8
BLES: 0x6F0838
BLUS: 0x6F0668

Function To Import Natives Into the Native Hash Table
Xex: 0x82845600
BLES: 0xA389B8
BLUS: 0xA387E8
Now, in the xex/sprx you will need to create a HookFunctionStart so we can import our natives like so.​
C:
HookFunctionStart((PDWORD)0x8257D0B8, (PDWORD)SetNativeStub, (DWORD)SetNative);
What this will be doing is hooking the large import table, so before the large import table is called we can import our native with the rest of the natives. Your stub can just be the same as any other stub you would call from CoD. And the last parameter will be your function you created like below.
After that you will need to create a SetNative function like so.​
C:
HRESULT SetNative()
{
    PushNative("IS_PLAYER_INVINCIBLE", (DWORD)IS_PLAYER_INVINCIBLE);
    DbgPrint("Custom Native Entered!\n");
    return SetNativeStub();
}
I called the function to import natives into the game PushNative. The parameters for the​
function go as PushNative(const char *NativeName, DWORD NativeAddress); The first parameter being what you want to call the native and that will be the native name the game hashes and imports into the native table. The next parameter being your function address we are going to import this will be the function you are going to create.
Code:
void IS_PLAYER_INVINCIBLE(DWORD native)
{
    DWORD dwReturn = *(DWORD*)(native);
    int Params = *(int*)(native + 0x04);
    DWORD dwNative = *(DWORD*)(native + 0x08);
}
Your function will only take one parameter and will only be a void, this goes for any function you​
make even if it is returning a value. The reason for this is because GTA will send a pointer to your function as the first parameter. That pointer will go somewhere in memory and will store the return address for you function, how many parameters were sent to the native, and the address of those parameters.
Once you finish creating your native and the xex/sprx builds fine you will then need to import​
your native into the sco compiler and import the native how you want in your script.
If all goes well you should be able to do something like this.
PM if you need help or need more explaining done.​
 
S

SBHAX

Aye so...
Messages
2,934
Reaction score
2,137
This is pretty cool, thanks for this releasing this :smile:
 
M

Monofire

Newbie
Messages
4
Reaction score
1
Sweet man! Maybe you could make a function to display keyboard on screen and get result like how there is in GTA V. That would be EPIC! How about a native to get the last bullet impact coord? There is on V. That would be amazing to see.
 
Last edited:
S

SBHAX

Aye so...
Messages
2,934
Reaction score
2,137
Sweet man! Maybe you could make a function to display keyboard on screen and get result like how there is in GTA V. That would be EPIC! How about a native to get the last bullet impact coord? There is on V. That would be amazing to see.
That would be awesome, instead of using objects and recording collision.
 
S

SBHAX

Aye so...
Messages
2,934
Reaction score
2,137
How the f*** is Sockstress even banned from here anyway? lol
 
M

Monofire

Newbie
Messages
4
Reaction score
1
How the f*** is Sockstress even banned from here anyway? lol
idk i just noticed that too. It's stupid! He was contributing to the community and they ban him for it? I hate that.
 
S

SBHAX

Aye so...
Messages
2,934
Reaction score
2,137
idk i just noticed that too. It's stupid! He was contributing to the community and they ban him for it? I hate that.
Yeah, he hardly ever posts aswell.
 
P

PPRX

what you want from me
Messages
46
Reaction score
43
Most of the community can't understand these but it is a very useful thread for some people :biggrin:
 
A

Analysis774

Newbie
Messages
7
Reaction score
0
Today, I figured I would release how to create your own natives. It requires RGH or CFW. Could​
be done on PC no idea how though. What you will need to do is do some research or reversing to figure out what kind of native you want to do. I will be creating a native to show if a player has godmode and if he doesn't. You will need these offsets first:
One of the Large Importing Native Functions
Xex: 0x8257D0B8
BLES: 0x6F0838
BLUS: 0x6F0668

Function To Import Natives Into the Native Hash Table
Xex: 0x82845600
BLES: 0xA389B8
BLUS: 0xA387E8
Now, in the xex/sprx you will need to create a HookFunctionStart so we can import our natives like so.​
C:
HookFunctionStart((PDWORD)0x8257D0B8, (PDWORD)SetNativeStub, (DWORD)SetNative);
What this will be doing is hooking the large import table, so before the large import table is called we can import our native with the rest of the natives. Your stub can just be the same as any other stub you would call from CoD. And the last parameter will be your function you created like below.
After that you will need to create a SetNative function like so.​
C:
HRESULT SetNative()
{
    PushNative("IS_PLAYER_INVINCIBLE", (DWORD)IS_PLAYER_INVINCIBLE);
    DbgPrint("Custom Native Entered!\n");
    return SetNativeStub();
}
I called the function to import natives into the game PushNative. The parameters for the​
function go as PushNative(const char *NativeName, DWORD NativeAddress); The first parameter being what you want to call the native and that will be the native name the game hashes and imports into the native table. The next parameter being your function address we are going to import this will be the function you are going to create.
Code:
void IS_PLAYER_INVINCIBLE(DWORD native)
{
    DWORD dwReturn = *(DWORD*)(native);
    int Params = *(int*)(native + 0x04);
    DWORD dwNative = *(DWORD*)(native + 0x08);
}
Your function will only take one parameter and will only be a void, this goes for any function you​
make even if it is returning a value. The reason for this is because GTA will send a pointer to your function as the first parameter. That pointer will go somewhere in memory and will store the return address for you function, how many parameters were sent to the native, and the address of those parameters.
Once you finish creating your native and the xex/sprx builds fine you will then need to import​
your native into the sco compiler and import the native how you want in your script.
If all goes well you should be able to do something like this.
PM if you need help or need more explaining done.​
I have the functions and all but I don't know how to put it in my sprx
 
S

SwaeLeeRay

Newbie
Messages
7
Reaction score
0
Where do I research native for Blackscreen protection?
 
Top Bottom