Implementing cpp-sdk Changes
To implement a new cpp-sdk
change or add a missing implementation, follow these steps:
-
Create a New Branch
-
Update the cpp-sdk Version
- If required, update the
cpp-sdk
version in theruntime
branch.
- If required, update the
-
Add the cpp-sdk Method
- Add the new
cpp-sdk
method to the appropriate classes.
For example, to implement IPlayer.GetSocialClubId(), update the following runtime classes:
- Add the new
-
Run the CApi Generator
- Run the CApi Generator with the
runtime/c-api
folder as the working directory.
- Run the CApi Generator with the
-
Push Changes
- Push all changes to the
runtime
branch.
- Push all changes to the
-
Implement the Method in the C# Module
- Use the
runtime
branch to implement the method within the C# module.
For the example above, add theSocialClubId
as a getter to theIPlayer
interface.
- Use the
-
Add the Getter Implementation
- Implement the getter in the
Player
class to invoke the unsafe runtime callCore.Library.*
.
- Implement the getter in the
-
Extend the AsyncPlayer Class
- Add the method to the
AsyncPlayer
class, ensuring it calls the parent method from thePlayer
class.
- Add the method to the
-
Push Changes
- Push all changes to the
module
branch.
- Push all changes to the
-
Testing
- Open powershell window, change directory to root module folder. Run
gen_local_win_env.ps1
and wait everything downloaded. - To test the changes, use the
windows-build.bat
file in theruntime/server
folder to generate acoreclr-module.dll
. - Place the generated DLL in the server's
modules
folder. - Build the module project and copy the new module DLLs to the C# resource folder and the project directory of the resource.
<ItemGroup> <Reference Include="AltV.Net"> <HintPath>lib\AltV.Net.dll</HintPath> </Reference> <Reference Include="AltV.Net.Async"> <HintPath>lib\AltV.Net.Async.dll</HintPath> </Reference> <Reference Include="AltV.Net.Interactions"> <HintPath>lib\AltV.Net.Interactions.dll</HintPath> </Reference> <None Update="lib\*.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None>
- Open powershell window, change directory to root module folder. Run
- Submit Pull Requests
- Create separate pull requests for both the
module
branch and theruntime
branch.