2y ago · Oct 18, 2023 7:30 PM
In Rockstar's RAGE engine (GTA V / FiveM), game functions are exposed through a hash-based Native Registration Table.
How Native Calling Works:
1. Every game function (like or ) is identified by a 64-bit hash.
2. The game contains a 256-bucket registration table where each hash is mapped to its native handler function pointer.
3. A structure holds the argument stack and return value pointers.
Across game updates, native hashes get remapped via a crossmap table, which maps old hashes to the new build hashes!
How Native Calling Works:
1. Every game function (like
CPP
PLAYER::PLAYER_PED_ID() CPP
ENTITY::GET_ENTITY_COORDS()2. The game contains a 256-bucket registration table where each hash is mapped to its native handler function pointer.
3. A
CPP
scrNativeCallContext CPP
class scrNativeCallContext {
public:
void* m_pReturn;
uint32_t m_nArgCount;
void* m_pArgs;
uint32_t m_nDataCount;
Vector3 m_vectorSpace[4];
};
typedef void(__cdecl* NativeHandler)(scrNativeCallContext* context);Across game updates, native hashes get remapped via a crossmap table, which maps old hashes to the new build hashes!
CitizenNative | RAGE Engine & FiveM Native Calls
The following users thanked CitizenNative for this post: