Skip to content

Dev Tips

Jacek Hałas vel Łagoda edited this page May 8, 2024 · 14 revisions

Let's document things. Even tiny ones. Don't ask, don't think too much about formatting. Just put any important knowledge about the project here in any readable form.

Project Modules

Raw memory access

botder Today at 5:51 PM
You might not like it, but changing memory directly in deathmatch.dll is not ok
Raw memory address + memcpy in mods/deathmatch/logic/CClientGame.cpp
botder Today at 5:52 PM
multiplayer are hooks and some other weird stuff
game_sa is the "game interface layer"
so if you want to modify the game, do it through the game layer
if you make code for deathmath.dll you are not forced to understand how the game is in memory(edited)
Cazomino05 Today at 6:02 PM
multiplayer sa is hooks and memory modifications e.g. disabling code paths or any other memory overwrites you can think of

Assembler

Getting return address (credits: Saml1er)

Declare DWORD dwReturnAddress = 0; outside function, then in _asm block add this code

push eax // save eax
mov eax, [esp + 4] // get return address
mov dwReturnAddress, eax
pop eax  // restore eax value

Now you can check from where gta function was called.

General

Modify CCoreInterface

Remember to add new interface methods at the end of that class, not in the middle ~ Botder

How to find implementation of any function

Look for function but name put in brackets example "isElement", if you click find all, you got client and server side then you just click on function and right click go to definition and here's your function.

How do you set, clear, and toggle a single bit? Useful for flags fields.

https://stackoverflow.com/questions/47981/how-do-you-set-clear-and-toggle-a-single-bit

Other stuff

  1. If function accept any number of arguments, and one of them is wrong - function should fail completely and none changes should be applied.
  2. To extend the client timeout, put timeout.longtime in the same directory as netc.dll

Authors: Paweł K, Saml1er, CrosRoad95