Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

custommodels-037

A client side .asi for SA-MP 0.3.7-R5 (GTA: San Andreas) that adds custom models, both skins and objects, when you connect to an open.mp server. It borrows open.mp's 0.3DL "artwork" custom model system, so a stock 0.3.7 client can use custom models without switching to the 0.3DL client.

How it works

open.mp only sends custom models to clients that identify as 0.3DL, so the plugin makes a 0.3.7-R5 client do exactly that, then leans on samp.dll's own custom model client to do most of the work.

First it masquerades as 0.3DL at connect (version 4062, token challenge ^ 4062) so the server turns artwork on. Then it activates the native 0.3DL client that R5's samp.dll already ships but never wires up: registering its RPC handlers wakes it, so it receives the model list, tracks every model in its manager, and renders custom objects natively (ScrCreateObject routing through CObjectPool::Create). R5 stubbed out the download worker, so the plugin fills that one missing piece by fetching each .dff and .txd over HTTP (User-Agent: SAMP/0.3), checking the CRC32, and dropping the files into samp.dll's cache, where its per frame tick picks them up. Custom skins are the one thing R5's native client can't render, so the plugin mirrors the skin entries out of the native manager and swaps each loaded clump onto the right ped.

The wire format lives in docs/protocol.md.

Requirements

You need GTA: San Andreas 1.0 US with the SA-MP 0.3.7-R5 client, an ASI loader (for example vorbisFile.dll) with custommodels.asi dropped next to gta_sa.exe, and an open.mp server with artwork enabled and at least one AddCharModel (skins) or AddSimpleModel (objects).

Build

A 32 bit (Win32) DLL with a static CRT, built with MSVC (works under Wine).

MSBuild:

msbuild build/custommodels.vcxproj /p:Configuration=Release /p:Platform=Win32

or CMake:

cmake -B build/cmake -A Win32 -DCMAKE_BUILD_TYPE=Release
cmake --build build/cmake --config Release

The output is custommodels.asi.

Layout

src/core is logging and the samp.dll access layer. src/net has the RakNet/RPC hooks, the DL masquerade, the DL packet compat, and nativeart, which activates samp.dll's native object client and bridges skins out of its model manager. src/model is the download worker, CRC32, and the file cache. src/game loads the RenderWare model and does the clump swap that renders skins. vendor holds urmem and the RakNet headers.

Notes

The network patches are mapped to the exact 0.3.7-R5 build and refuse to run on any other, so they need rechecking if you point them at a different client. Objects render through samp.dll's own native pipeline, while skins go through our clump swap renderer.

References

Protocol from openmultiplayer/open.mp (Shared/NetCode/custommodels.hpp, Server/Components/CustomModels/). Packet compat reference from spmn/samp-client-compat. Hooking from spmn/urmem. R5 addresses from BlastHackNet/SAMP-API. RenderWare and GTA SA addresses from DK22Pac/plugin-sdk. GTA SA class layouts from AmyrAhmady/sampvoice.

About

A client side .asi for SA-MP 0.3.7-R5 (GTA: San Andreas) that adds custom models, both skins and objects, when you connect to an open.mp server. It borrows open.mp's 0.3DL "artwork" custom model system, so a stock 0.3.7 client can use custom models without switching to the 0.3DL client

Topics

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages