Note: this fix, its analysis and all code in this repository were created entirely by an AI assistant.
An ASI plugin for Scarface: The World Is Yours 1.0.0.2 that prevents a crash on mission loading screens - typically when the player dies and the game reloads the mission/level. It was reported on the Gaspar Gomez mission.
The game's ambient population spawner can be left with an empty or corrupted list of spawn candidates while a level is being reloaded. Picking from that list returns no candidate and the caller dereferences it, which kills the game on the loading screen.
The plugin validates that list and skips the spawn instead. It does not
modify scarface.exe; everything happens at runtime.
- Copy
dist/Scarface.RngGuard.asinext toscarface.exe(or intoscripts\). - Start the game.
An ASI loader is required. SilentPatch and Scarface Fusion Fix already ship one.
Scarface.RngGuard.ini is created on first launch:
[General]
Logging=1 ; 0 = do not write a log fileAdvanced options (log size cap, individual log categories, guard toggle) are in
the generated file under [Advanced] and normally do not need changing.
"Fix3DAudioPitch" was reverse engineered from GangstaPatch's ASI with AI Tooling, since their project is closed source.
"GuardAudioDivZero=1" is supposed to fix a crash reported here - also related to Gaspar Gomez mission: GangstaTeam/GangstaPatch#32
These optional fixes were made for people who do not need the rest of GangstaPatch fixes AND additions (e.g. for speedrunners).
If you are not a speedrunner and you would like to play Scarface with cool additions and well done fixes, get GangstaPatch here: https://github.com/GangstaTeam/GangstaPatch
Under [Fixes] in the ini:
[Fixes]
Fix3DAudioPitch=1 ; stop 3D sounds changing pitch with distance
GuardAudioDivZero=1 ; prevent a rare divide-by-zero in the audio sequencerFix3DAudioPitch reproduces the 3D listener change GangstaPatch makes (its
"3D Audio causing pitch changes" fix). Both options are now on by default; set
them to 0 if they cause problems. The crash guards remain on by default.
build.bat
Requires the 32-bit MSVC toolset. The plugin is written in C++ and builds to
dist/Scarface.RngGuard.asi.
See docs/technical.md for the crash analysis and the runtime patches.